85 lines
1.9 KiB
JavaScript
85 lines
1.9 KiB
JavaScript
import App from './App'
|
|
import store from './store'
|
|
// import $api from './api/eduApp/api.js'
|
|
|
|
// #ifndef VUE3
|
|
import Vue from 'vue'
|
|
import config from './config.js'
|
|
|
|
import moment from 'moment'
|
|
moment.locale('zh-cn')
|
|
Vue.config.productionTip = false
|
|
// Vue.prototype.$api = $api
|
|
Vue.prototype.$store = store
|
|
Vue.prototype.$moment = moment
|
|
Vue.prototype.$adpid = '1111111111'
|
|
Vue.prototype.$backgroundAudioData = {
|
|
playing: false,
|
|
playTime: 0,
|
|
formatedPlayTime: '00:00:00'
|
|
}
|
|
|
|
import uView from '@/uni_modules/uview-ui'
|
|
Vue.use(uView)
|
|
// import Vconsole from 'vconsole'
|
|
|
|
// let vConsole = new Vconsole()
|
|
// Vue.use(vConsole)
|
|
// const vconsole = require('./api/vconsole.min')
|
|
// const vconsole = require('vconsole')
|
|
// Vue.prototype.$vconsole = new vconsole() // 使用vconsole
|
|
|
|
Vue.prototype.$verificationToken = function () {
|
|
console.log('验证Token-->')
|
|
uni.request({
|
|
url: config.bmwUrl + '/users/current',
|
|
method: 'get',
|
|
header: {
|
|
Authorization: uni.getStorageSync('access_token')
|
|
},
|
|
success: res => {
|
|
console.log('🚀 ~ res:', res)
|
|
let data = res.data
|
|
console.log('🚀 ~ res.data:', data)
|
|
if (data === '' || data === undefined) {
|
|
uni.showToast({
|
|
title: '已在其他设备登录,请重新登录',
|
|
icon: 'none'
|
|
})
|
|
uni.reLaunch({
|
|
url: '/pages/login'
|
|
})
|
|
}
|
|
},
|
|
fail: err => {
|
|
console.log('🚀 ~ err:', err)
|
|
}
|
|
})
|
|
}
|
|
|
|
App.mpType = 'app'
|
|
const app = new Vue({
|
|
store,
|
|
...App
|
|
})
|
|
app.$mount()
|
|
// #endif
|
|
|
|
// #ifdef VUE3
|
|
import { createSSRApp } from 'vue'
|
|
import { data } from 'uview-ui/libs/mixin/mixin'
|
|
export function createApp() {
|
|
const app = createSSRApp(App)
|
|
app.use(store)
|
|
app.config.globalProperties.$adpid = '1111111111'
|
|
app.config.globalProperties.$backgroundAudioData = {
|
|
playing: false,
|
|
playTime: 0,
|
|
formatedPlayTime: '00:00:00'
|
|
}
|
|
return {
|
|
app
|
|
}
|
|
}
|
|
// #endif
|