// pages/portal/portalLive/live.js
Component({
    options: {
        addGlobalClass: true
    },
    /**
     * 组件的属性列表
     */
    properties: {
        list: {
            type: Array
        },
        isShow: {
            type: Boolean,
            value: false
        }
    },

    /**
     * 组件的初始数据
     */
    data: {

    },

    /**
     * 组件的方法列表
     */
    methods: {
        toViewLive(e) {
            const {
                item
            } = e.currentTarget.dataset;
            if (item.fisneedauth == 1) {
                _Http.basic({
                    "accesstoken": wx.getStorageSync('userData').token,
                    "classname": "enterprise.live.live",
                    "method": "liveauthorization",
                    "content": {
                        "tliveid": item.tliveid
                    }
                }).then(res => {
                    if (res.data != '成功') return wx.showToast({
                        title: res.data,
                        icon: "none"
                    })
                    let str = res.msg;
                    const url = str.slice(0, 8) + '04de51d4c1.' + str.slice(8);
                    wx.navigateTo({
                        url: '/pages/webView/index?url=' + encodeURIComponent(url),
                    })
                })
            } else {
                let str = item.fliveshowurl;
                const url = str.slice(0, 8) + '04de51d4c1.' + str.slice(8)
                wx.navigateTo({
                    url: '/pages/webView/index?url=' + url,
                })
            }
        },
    }
})