| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- import { createApp } from 'vue'
- import App from './App'
- import router from '../router/index'
- import { postMessage, promisefiyPostMessage } from '@/helpers/native-message'
- import Vue3Lottie from 'vue3-lottie'
- import 'vue3-lottie/dist/style.css'
- import 'normalize.css'
- import 'vant/lib/index.css'
- import '../styles/index.less'
- import { state } from '@/state'
- import { browser, setAuth } from '@/helpers/utils'
- const app = createApp(App).use(Vue3Lottie)
- // 将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,
- // };
- // }
- // });
- // 获取token
- promisefiyPostMessage({ api: 'getToken' }).then((res: any) => {
- const content = res.content
- if (content?.accessToken) {
- setAuth(content.tokenType + ' ' + content.accessToken)
- }
- })
- postMessage(
- {
- api: 'getVersion'
- },
- (res: any) => {
- state.version = res.content.version
- console.log(res, 'version')
- }
- )
- // import Vconsole from 'vconsole'
- // const vconsole = new Vconsole()
- const paymentType = (window as any).paymentType // 浏览器设置
- if (browser().isTeacher || paymentType === 'TEACHER') {
- state.platformType = 'TEACHER'
- } else if (browser().isStudent || paymentType === 'STUDENT') {
- state.platformType = 'STUDENT'
- } else if (browser().isSchool || paymentType === 'SCHOOL') {
- state.platformType = 'SCHOOL'
- } else {
- state.platformType = 'TEACHER'
- }
- if (state.platformType === 'TEACHER') {
- state.platformApi = '/api-teacher'
- } else if (state.platformType === 'SCHOOL') {
- state.platformApi = '/api-school'
- } else {
- state.platformApi = '/api-student'
- }
- app.use(router)
- app.mount('#app')
|