// 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://yossys80658.obs.cn-east-2.myhuaweicloud.com/system/E%E8%AE%A2%E5%8D%95%E9%9A%90%E7%A7%81%E4%BF%9D%E6%8A%A4.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" }) } }) } } })