lin
2026-04-27 e649747b2c454f0d2cb18edc9c8e1b41363e0d65
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<script>
    export default {
        onShow: function() {
            // #ifdef APP-PLUS
            var args= plus.runtime.arguments;
            if(args){
                // 处理args参数,如直达到某新页面等
                console.log('args', args)
                if(args.indexOf('gyq-app') >= 0) {
                    args = args.replace("gyq-app://", "/")
                    return uni.redirectTo({
                        url: args
                    })
                }
            }
            // #endif
        },
        onLaunch: function(options) {
            let t = this
            t.$util.post('Index/getConfig').then(res => {
                console.log('getConfig', res.data)
                if(res.code == 1){
                    try {
                        const token = uni.getStorageSync('pig-token');
                        if (!token) {
                            /*
                            uni.redirectTo({
                                url: '/pages/login/login'
                            })
                            return false
                            */
                        }
                    } catch (e) {
                            uni.redirectTo({
                                url: '/pages/login/login'
                            })
                            return false
                        
                    }
                    uni.setStorageSync('Config', JSON.stringify(res.data))
                    
                    // #ifdef APP-PLUS
                    //机型
                    let platform = uni.getSystemInfoSync().platform.toLocaleLowerCase()
                    //console.log('platform', uni.getSystemInfoSync())
                    plus.runtime.getProperty(plus.runtime.appid, widgetInfo => {
                        //下载地址
                        let downUrl = res.data.downUrl
                        //更新标志
                        let updateFlag = false
                        //更新内容
                        let updesc = ''
                        if(platform == 'ios' && parseInt(widgetInfo.versionCode) != parseInt(res.data.ios.code)){
                            updateFlag = !updateFlag
                            updesc = res.data.ios.desc
                        }
                        if(platform == 'android' && parseInt(widgetInfo.versionCode) != parseInt(res.data.android.code)){
                            updateFlag = !updateFlag
                            updesc = res.data.android.desc
                        }
                        if (downUrl && updateFlag) {
                            uni.showModal({
                                showCancel: false,
                                confirmText: '立即更新',
                                title: '温馨提示!',
                                content: updesc || '有最新版本,请更新APP!',
                                success: res => {
                                    if (res.confirm) {
                                        plus.runtime.openURL(downUrl)
                                    }
                                }
                            })
                        }
                    })
                    // #endif
                }
            })
        },
        onHide: function() {
        }
    }
</script>
 
<style>
    /*每个页面公共css */
    .startBar {
        width: 100%;
        height: var(--status-bar-height);
    }
    .noData{
        width: 100%;
        font-size: 28upx;
    }
    .noData image{
        width: 120upx;
        height: 100upx;
        display: block;
        margin: 100upx auto 30upx;
    }
    .noData view{
        width: 100%;
        text-align: center;
        color: #666666;
    }
    .noDataBtn{
        width: 240upx !important;
        margin: 50upx auto;
        background-color: #4766FE;
        color: #ffffff !important;
        letter-spacing: 10upx;
        height: 70upx;
        line-height: 70upx;
        border-radius: 50upx;
    }
</style>