YNUtdPlatform/main.js

85 lines
1.9 KiB
JavaScript
Raw Normal View History

2024-08-07 14:53:53 +08:00
import App from './App'
import store from './store'
2024-08-07 16:43:03 +08:00
// import $api from './api/eduApp/api.js'
2024-08-07 14:53:53 +08:00
// #ifndef VUE3
import Vue from 'vue'
2024-09-09 09:58:00 +08:00
import config from './config.js'
2024-10-15 17:01:47 +08:00
import moment from 'moment'
moment.locale('zh-cn')
2024-08-07 14:53:53 +08:00
Vue.config.productionTip = false
2024-08-07 16:43:03 +08:00
// Vue.prototype.$api = $api
2024-08-07 14:53:53 +08:00
Vue.prototype.$store = store
2024-10-15 17:01:47 +08:00
Vue.prototype.$moment = moment
2024-09-06 14:53:49 +08:00
Vue.prototype.$adpid = '1111111111'
2024-08-07 14:53:53 +08:00
Vue.prototype.$backgroundAudioData = {
2024-09-06 14:53:49 +08:00
playing: false,
playTime: 0,
formatedPlayTime: '00:00:00'
2024-08-07 14:53:53 +08:00
}
import uView from '@/uni_modules/uview-ui'
Vue.use(uView)
// import Vconsole from 'vconsole'
2024-08-07 16:43:03 +08:00
2024-08-07 14:53:53 +08:00
// let vConsole = new Vconsole()
// Vue.use(vConsole)
// const vconsole = require('./api/vconsole.min')
// const vconsole = require('vconsole')
// Vue.prototype.$vconsole = new vconsole() // 使用vconsole
2024-09-06 14:53:49 +08:00
Vue.prototype.$verificationToken = function () {
console.log('验证Token-->')
uni.request({
2024-09-09 09:58:00 +08:00
url: config.bmwUrl + '/users/current',
2024-09-06 14:53:49 +08:00
method: 'get',
header: {
Authorization: uni.getStorageSync('access_token')
},
2024-10-15 17:01:47 +08:00
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)
}
2024-09-06 14:53:49 +08:00
})
}
2024-08-07 14:53:53 +08:00
App.mpType = 'app'
const app = new Vue({
2024-09-06 14:53:49 +08:00
store,
...App
2024-08-07 14:53:53 +08:00
})
app.$mount()
// #endif
// #ifdef VUE3
2024-09-06 14:53:49 +08:00
import { createSSRApp } from 'vue'
2024-10-15 17:01:47 +08:00
import { data } from 'uview-ui/libs/mixin/mixin'
2024-08-07 14:53:53 +08:00
export function createApp() {
2024-09-06 14:53:49 +08:00
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
}
2024-08-07 14:53:53 +08:00
}
// #endif