|
|
|
/*
|
|
|
|
* @Author: ch
|
|
|
|
* @Date: 2021-07-26 23:22:16
|
|
|
|
* @LastEditors: ch
|
|
|
|
* @LastEditTime: 2022-05-19 10:45:53
|
|
|
|
* @Description: file content
|
|
|
|
*/
|
|
|
|
import Vue from 'vue';
|
|
|
|
import App from './App';
|
|
|
|
|
|
|
|
import {router,RouterMount} from '@/common/router/index.js';
|
|
|
|
import uView from 'uview-ui';
|
|
|
|
import store from '@/common/store';
|
|
|
|
import Confirm from '@/components/mount/index';
|
|
|
|
import route from 'uview-ui/libs/util/route';
|
|
|
|
import {toSearchJson} from '@/common/utils';
|
|
|
|
import {ApiGetOpenId, ApiGetAuthUrl} from '@/common/api/wx';
|
|
|
|
import {MsbWebSkt, MsbWebSktInit, createUUID} from '@/common/utils';
|
|
|
|
import { MsbSktInit, MsbSktGetSessionList} from './common/utils/webSkt';
|
|
|
|
import { ApiSktSysGetSession, ApiSktSysHeart } from './common/api/im';
|
|
|
|
|
|
|
|
if (store.state.token) {
|
|
|
|
MsbSktInit().then(() => {
|
|
|
|
MsbSktGetSessionList({
|
|
|
|
traceType : 1,
|
|
|
|
content: { sysId : 1}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 微信打开需要授权
|
|
|
|
const ua = navigator ? navigator.userAgent.toLowerCase() : '';
|
|
|
|
if(ua.includes('micromessenger')) {
|
|
|
|
if(!store.state.openId){
|
|
|
|
let query = toSearchJson(window.location.search)
|
|
|
|
if(query.code){
|
|
|
|
ApiGetOpenId({
|
|
|
|
code : query.code
|
|
|
|
}).then(({error, result}) => {
|
|
|
|
if(error){
|
|
|
|
uni.$u.toast(error.message);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
store.commit('SET_OPEN_ID', result.openId);
|
|
|
|
})
|
|
|
|
}else{
|
|
|
|
ApiGetAuthUrl({
|
|
|
|
redirectUrl : window.location.href,
|
|
|
|
scope : 'snsapi_base'
|
|
|
|
}).then(({result, error}) => {
|
|
|
|
if(error){
|
|
|
|
uni.$u.toast(error.message);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
window.location.href = result;
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Vue.use(router);
|
|
|
|
Vue.use(uView);
|
|
|
|
Vue.use(Confirm);
|
|
|
|
Vue.prototype.$store = store;
|
|
|
|
|
|
|
|
Vue.config.productionTip = false;
|
|
|
|
|
|
|
|
App.mpType = 'app'
|
|
|
|
const app = new Vue({
|
|
|
|
...App
|
|
|
|
})
|
|
|
|
// #ifdef H5
|
|
|
|
RouterMount(app,router,'#app')
|
|
|
|
// #endif
|
|
|
|
|
|
|
|
// #ifndef H5
|
|
|
|
app.$mount(); //为了兼容小程序及app端必须这样写才有效果
|
|
|
|
// #endif
|