import { createApp } from 'vue'
import App from './App.vue'
import dayjs from 'dayjs'
import 'dayjs/locale/zh-cn'
import router from '../router/index-teacher'
import { postMessage } from '@/helpers/native-message'

import 'normalize.css'

import '../styles/index.less'
import { state } from '@/state'
import { browser } from '@/helpers/utils'

const app = createApp(App)

// 将selects全局混入当前vue实例中
// import activeButtonIcon from '@/common/images/icon_check.png';
// import inactiveButtonIcon from '@/common/images/icon_default.png';
// app.mixin({
//   data() {
//     return {
//       activeButtonIcon: activeButtonIcon,
//       inactiveButtonIcon: inactiveButtonIcon,
//     };
//   }
// });

postMessage(
  {
    api: 'getVersion'
  },
  (res: any) => {
    state.version = res.content.version
    console.log(res, 'version')
  }
)

// import Vconsole from 'vconsole'
// const vconsole = new Vconsole()
if (browser().isTeacher) {
  state.platformType = 'TEACHER'
} else if (browser().isStudent) {
  state.platformType = 'STUDENT'
} else {
  state.platformType = 'TEACHER'
}
if (state.platformType === 'TEACHER') {
  state.platformApi = '/api-teacher'
} else {
  state.platformApi = '/api-student'
}

dayjs.locale('zh-ch')
app.config.globalProperties.$dayjs = dayjs
app.config.globalProperties.$filters = vueFilter
app.use(router)

app.mount('#app')
