forked from WanyueKJ/wanyue_online_education_uniapp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
64 lines (53 loc) · 1.21 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import Vue from 'vue'
import App from './App'
import store from './store/index.js'
Vue.prototype.$store = store
Vue.config.productionTip = false
// 引入全局组件
import divider from './components/common/divider.vue';
Vue.component('divider', divider);
import noThing from './components/common/no-thing.vue';
Vue.component('no-thing',noThing);
//引入配置文件
import configApi from './common/config.js';
Vue.prototype.configApi = configApi;
// 挂在助手函数
import utilJs from './common/util.js';
Vue.prototype.utilJs = utilJs;
// 引入请求库
import hRequire from './common/require.js';
Vue.prototype.hRequire = hRequire;
// 权限验证操作
Vue.prototype.checkAuth = (callback)=>{
// 权限验证
if(store.state.loginStatus){
uni.showToast({
title:'请先登录',
icon: 'none'
});
return uni.navigateTo({
url:'/pages/login/login'
});
}
callback()
}
// 权限验证跳转
Vue.prototype.navigate = (options)=>{
// 权限验证
if(store.state.loginStatus){
uni.showToast({
title:'请先登录',
icon: 'none'
});
return uni.navigateTo({
url:'/pages/login/login'
});
}
uni.navigateTo(options);
}
App.mpType = 'app'
const app = new Vue({
store,
...App
})
app.$mount()