xuxy
2024-06-24 66a346cb7119e0cc08f108b71d2e7280f132dc4e
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
<script>
    import storage from '@/plugins/storage.js'
 
    export default {
        onLaunch: function(options) {
            
            // #ifdef MP
            // {
            //     if(decodeURIComponent(options.query.q))
            //     if (options.inviter) {
            //         //说明是邀请的,需要保存下来,
            //         this.$storage.setItem('inviter', options.inviter)
            //         //有效24小时
            //         this.$storage.setItem('inviterTime', new Date().getTime())
                
            //     }
            //     if (options.inviterName) {
            //         this.$storage.setItem('inviterName', options.inviterName)
            //         this.inviterName = options.inviterName
            //     }else{
            //         this.inviterName = this.$storage.getItem('inviterName') || ''
            //     }
            // }
            // #endif
            console.warn('当前组件仅支持 uni_modules 目录结构 ,请升级 HBuilderX 到 3.1.0 版本以上!')
            console.log('App Launch')
            uni.getSystemInfo({
                success: (e) => {
                    // this.globalData.StatusBar = e.statusBarHeight;
                    let custom = uni.getMenuButtonBoundingClientRect();
                    // this.globalData.Custom = custom;
                    // this.globalData.CustomBar = custom.bottom + custom.top - e.statusBarHeight;
                    uni.setStorageSync('StatusBar', e.statusBarHeight);
                    uni.setStorageSync('CustomBar', (custom.bottom + custom.top - e.statusBarHeight));
                }
            });
            // #ifdef MP
            if (true && storage.getItem('token')) {
                setTimeout(async () => {
                    const res = await this.$store.dispatch('getCurrentInfo');
                    // console.log('init info',res,this.currentInfo)
                    if (this.currentInfo && this.currentInfo.id && !this.currentInfo.openId) {
                        uni.reLaunch({
                            url: '/pages/home/farmer-home'
                        })
                    }
                }, 200);
            } else {
 
            }
            // #endif
        },
 
        onReady() {
            //做token判断
            // this.check_login()
        },
        onShow: function() {
            console.log('App Show')
        },
        onHide: function() {
            console.log('App Hide')
        },
 
    }
</script>
 
<style lang="scss">
    /*每个页面公共css */
    @import '@/uni_modules/uni-scss/index.scss';
    /* #ifndef APP-NVUE */
    @import '@/static/customicons.css';
 
    // 设置整个项目的背景色
    page {
        background-color: #f5f5f5;
    }
 
    @import '@/common/self.scss';
    @import '@/common/icons.scss';
 
    /* #endif */
    .example-info {
        font-size: 14px;
        color: #333;
        padding: 10px;
    }
    // uni-rich-text img{
    //     max-width: 100% !important;
    // }
    .rich /deep/ img{
        max-width: 600rpx !important;
    }
    .rich /deep/ image{
        max-width: 600rpx !important;
    }
    
    .rich2 /deep/ img{
        max-width: 400rpx !important;
    }
    .rich2 /deep/ image{
        max-width: 400rpx !important;
    }
</style>