1
xuxueyang
2024-07-08 137ee9dd563598a3064ae27d7e671632fac6ca1e
1
已修改1个文件
256 ■■■■ 文件已修改
App.vue 256 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
App.vue
@@ -1,127 +1,131 @@
<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/supplier-home'
                        })
                    }
                }, 200);
            } else {
            }
            // #endif
            // #ifdef H5
            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/supplier-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';
    /* uni.scss */
    // @import "@/uni_modules/uview-plus/index.scss";
    @import "uview-ui/index.scss";
    /* #ifndef APP-NVUE */
    @import '@/static/customicons.css';
    // 设置整个项目的背景色
    page {
        background-color: #f5f5f5;
    }
    @import '@/common/self.scss';
    @import '@/common/icons.scss';
    @import '@/common/global.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;
    }
<script>
    // 合伙人: "appid" : "wx6d0ecc4e18710458",
    // 花农: "appid" : "wx3203fd935a6ffe09",
    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/supplier-home'
                        })
                    }
                }, 200);
            } else {
            }
            // #endif
            // #ifdef H5
            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/supplier-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';
    /* uni.scss */
    // @import "@/uni_modules/uview-plus/index.scss";
    @import "uview-ui/index.scss";
    /* #ifndef APP-NVUE */
    @import '@/static/customicons.css';
    // 设置整个项目的背景色
    page {
        background-color: #f5f5f5;
    }
    @import '@/common/self.scss';
    @import '@/common/icons.scss';
    @import '@/common/global.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>