agreement.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. Component({
  2. properties: {
  3. isAgree: {
  4. type: Boolean
  5. },
  6. callBack: {
  7. type: Function
  8. },
  9. language: {
  10. type: Object,
  11. value: {}
  12. }
  13. },
  14. methods: {
  15. /* 修改授权 */
  16. isAgreeChange() {
  17. let isAgree = !this.data.isAgree
  18. this.setData({
  19. isAgree
  20. })
  21. this.triggerEvent("callBack", isAgree);
  22. wx.setStorageSync('isAgree', isAgree);
  23. },
  24. checkTheAgreement() {
  25. wx.showLoading({
  26. title: '加载中...',
  27. })
  28. wx.downloadFile({
  29. 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',
  30. success: (res) => {
  31. wx.openDocument({
  32. filePath: res.tempFilePath,
  33. success: (s) => {
  34. wx.hideLoading();
  35. },
  36. fail: (err) => {
  37. wx.hideLoading();
  38. wx.showToast({
  39. title: '读取失败,请稍后再试',
  40. icon: "none"
  41. })
  42. }
  43. })
  44. },
  45. fail: (err) => {
  46. wx.hideLoading();
  47. wx.showToast({
  48. title: '读取失败,请稍后再试',
  49. icon: "none"
  50. })
  51. }
  52. })
  53. }
  54. }
  55. })