export default {
    data() {
        return {
            // 静态资源路径
            staticUrl: 'https://static.caimei365.com/app/mini-hehe/icon/'
        }
    },
    methods: {
        jumpAction(data) {
            const { jumpType, jumpLink, jumpProductId, jumpImage } = data
            if (jumpType === 1 && !jumpLink) return
            if (jumpType === 2 && !jumpProductId) return
            if (jumpType === 3 && !jumpImage) return
            // jumpType 跳转类型：1链接，2商品，3图片
            const jumpMap = {
                1: `others/web-view?websit=${encodeURIComponent(jumpLink)}`,
                2: `goods/goods-detail?productId=${jumpProductId}&jumpState=0`,
                3: `others/image-view?imageUrl=${encodeURIComponent(jumpImage)}`
            }
            this.$router.navigateTo(jumpMap[jumpType])
        },
        initSetSystemInfo() {
            let self = this
            uni.getSystemInfo({
                success: function(e) {
                    let modelmes = e.model
                    console.log(e)
                    if (modelmes.search('iPhone 11') !== -1 || modelmes.search('iPhone 11 Pro Max') !==
                		-1 || modelmes.search('iPhone X') != -1) { //XS,XR,XS MAX均可以适配
                        self.$store.dispatch('setVariableFun', true)
                    } else {
                        self.$store.dispatch('setVariableFun', false)
                    }
                    // #ifndef MP
                    Vue.prototype.StatusBar = e.statusBarHeight
                    if (e.platform == 'android') {
                        Vue.prototype.CustomBar = e.statusBarHeight + 50
                        Vue.prototype.platformClass = true
                    } else {
                        Vue.prototype.CustomBar = e.statusBarHeight + 45
                        Vue.prototype.platformClass = false
                    };
                    // #endif
                    // #ifdef MP-WEIXIN || MP-QQ
                    console.log(e.platform)
                    if (e.platform == 'android') {
                        Vue.prototype.platformClass = 'left'
                        self.$store.dispatch('setVariableFun', false)
                    } else {
                        Vue.prototype.platformClass = 'center'
                        self.$store.dispatch('setIsIphoneFun', true)
                    }
                    Vue.prototype.StatusBar = e.statusBarHeight
                    Vue.prototype.fontSizeSetting = e.fontSizeSetting
                    Vue.prototype.screenWidth = e.screenWidth
                    let capsule = wx.getMenuButtonBoundingClientRect()
                    Vue.prototype.capsule = capsule
                    if (capsule) {
                        Vue.prototype.Custom = capsule
                        Vue.prototype.CustomBar = capsule.bottom + capsule.top - e.statusBarHeight
                    } else {
                        Vue.prototype.CustomBar = e.statusBarHeight + 50
                    }
                    // #endif		
                    // #ifdef MP-ALIPAY
                    Vue.prototype.StatusBar = e.statusBarHeight
                    Vue.prototype.CustomBar = e.statusBarHeight + e.titleBarHeight
                    // #endif
                }
            })
        }
    }
}
