xuxy
2024-06-25 8af3db52a632968206ca2bc7f9bd6b4662350232
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
import store from '../store/index.js'
import message from '../plugins/message.js'
 
exports.install = function(Vue, options) {
    Vue.prototype.isCurrent = function(current, arr) {
        if (!!arr) {
            for (let url of arr) {
                if (current == url) {
                    return true
                }
            }
        }
        return false
    };
    Vue.prototype.goto = function(current_path,url) {
        console.log('current_path:',current_path,'   url:',url)
        console.log('store')
        // console.log(store.state.hasLogin)
 
        if (current_path == url) {
            
        } else {
            //判断有没有登录
            // if(url.con)
            if(url.includes('/center')&&!store.state.hasLogin&&!store.state.isDebug){
                //跳转到不同页面
                console.log('goto no登录')
                // store.state.hasLogin = true
                // // #ifdef H5
                //     uni.navigateTo({
                //         url: '/views/pc/login'
                //     });
                // // #endif
                // // #ifndef H5
                //     uni.navigateTo({
                //         url: '/views/app/login'
                //     });
                // // #endif
                message.showToast('请先登录')
                // uni.navigateTo({
                //     url: '/views/home/home?select=self'
                // });
            }else{
                console.log('goto ok登录')
                uni.navigateTo({
                    url: url
                });
            }
 
        }
 
    };
};