123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- import { createApp } from 'vue'
- import App from './App.vue'
- import dayjs from 'dayjs'
- import 'dayjs/locale/zh-cn'
- import router from '../router/index-student'
- import vueFilter from '@/helpers/vueFilter'
- import { listenerMessage, postMessage, promisefiyPostMessage } from '@/helpers/native-message'
- import 'normalize.css'
- import '../styles/index.less'
- import { state } from '@/state'
- import { browser, setAuth } from '@/helpers/utils'
- const app = createApp(App)
- // import Vconsole from 'vconsole'
- // const vconsole = new Vconsole()
- postMessage(
- {
- api: 'getVersion'
- },
- (res: any) => {
- state.version = res.content.version
- }
- )
- // 判断是否是管乐团学生端,用来获取基础数据
- if (browser().isOrchestraStudent) {
- // await promisefiyPostMessage({
- // api: 'setCache',
- // content: {
- // key: 'h5-colexiu-token',
- // value: ''
- // }
- // })
- // 获取管乐团token
- promisefiyPostMessage({ api: 'getUserAccount' }).then((res: any) => {
- const content = res.content
- state.orchestraInfo.token = content.token
- state.orchestraInfo.phone = content.phone
- state.orchestraInfo.nickname = content.nickname
- state.orchestraInfo.avatar = content.avatar
- state.orchestraInfo.unionId = content.unionId || 0
- })
- // 从缓存里面获取token
- promisefiyPostMessage({ api: 'getCache', content: { key: 'h5-colexiu-token' } }).then((res: any) => {
- const content = res.content
- if (content.value) {
- setAuth(content.value)
- }
- })
- }
- if (browser().isTeacher) {
- state.platformType = 'TEACHER'
- } else if (browser().isStudent) {
- state.platformType = 'STUDENT'
- } else {
- state.platformType = 'STUDENT'
- }
- 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')
|