// pages/login/modules/agreement.js
Component({
    /**
     * 组件的属性列表
     */
    properties: {
        isAgree: {
            type: Boolean
        },
        callBack: {
            type: Function
        }
    },

    /**
     * 组件的方法列表
     */
    methods: {
        /* 修改授权 */
        isAgreeChange() {
            let isAgree = !this.data.isAgree
            this.setData({
                isAgree
            })
            this.triggerEvent("callBack", isAgree)
            wx.setStorageSync('isAgree', isAgree);
        },
        checkTheAgreement() {
            wx.showLoading({
                title: '加载中...',
            })
            wx.downloadFile({
                url: 'https://lsa79853.obs.cn-east-3.myhuaweicloud.com/system/%E6%9D%A5%E6%96%AF%E5%A5%A5E%E8%AE%A2%E5%8D%95.docx',
                success: (res) => {
                    wx.openDocument({
                        filePath: res.tempFilePath,
                        success:(s)=>{
                            wx.hideLoading();

                        },
                        fail: (err) => {
                            wx.hideLoading();
                            wx.showToast({
                                title: '读取失败,请稍后再试',
                                icon: "none"
                            })
                        }
                    })
                },
                fail: (err) => {
                    wx.hideLoading();
                    wx.showToast({
                        title: '读取失败,请稍后再试',
                        icon: "none"
                    })
                }
            })
        }
    }
})