| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- 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()
- // 设置是否显示导航栏 0 显示 1 不显示
- postMessage({ api: 'setBarStatus', content: { status: 0 } })
- postMessage({
- api: 'backIconChange',
- content: { backIconHide: true }
- })
- 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.split(' ')[1]
- 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')
|