1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- import { createApp } from 'vue';
- import App from './App';
- import dayjs from 'dayjs';
- import 'dayjs/locale/zh-cn';
- import { setupStore } from '@/stores';
- import 'vant/lib/index.css';
- import './component-ui/index.less';
- import './styles/index.less';
- import router from '@/router';
- import { promisefiyPostMessage, postMessage } from './helpers/native-message';
- import { browser, setAuth } from './helpers/utils';
- import { state } from './state';
- // 获取token
- promisefiyPostMessage({ api: 'getToken' }).then((res: any) => {
- const content = res.content;
- if (content?.accessToken) {
- setAuth(content.tokenType + ' ' + content.accessToken);
- }
- });
- // 设置是否显示导航栏 0 不显示 1 显示
- postMessage({ api: 'setBarStatus', content: { status: 0 } });
- // 导航栏高度
- postMessage({ api: 'getNavHeight' }, (res: any) => {
- const { content } = res;
- const dpi = content.dpi || 2;
- if (content.navHeight) {
- const navHeight = content.navHeight / dpi;
- console.log(navHeight, 'navHeight');
- state.navBarHeight = navHeight;
- }
- });
- const url = window.location.href;
- const urlIsTeacher =
- /mteaonline.dayaedu.com/.test(url) || /mteatest.dayaedu.com/.test(url) || /gym.lexiaoya.cn\/lessonPlayTeacher/.test(url) || /test.gym.lexiaoya.cn\/lessonPlayTeacher/.test(url)
- ? true
- : false;
- // const paymentType = (window as any).paymentType; // 浏览器设置
- // 判断是哪个环境
- if (urlIsTeacher || browser().isTeacher) {
- state.platformType = 'TEACHER';
- state.platformApi = '/api-teacher';
- } else {
- state.platformType = 'STUDENT';
- state.platformApi = '/api-student';
- }
- const app = createApp(App);
- dayjs.locale('zh-ch');
- setupStore(app);
- app.use(router);
- app.mount('#app');
|