agreement.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // pages/login/modules/agreement.js
  2. Component({
  3. /**
  4. * 组件的属性列表
  5. */
  6. properties: {
  7. isAgree: {
  8. type: Boolean
  9. },
  10. callBack: {
  11. type: Function
  12. }
  13. },
  14. /**
  15. * 组件的方法列表
  16. */
  17. methods: {
  18. /* 修改授权 */
  19. isAgreeChange() {
  20. let isAgree = !this.data.isAgree
  21. this.setData({
  22. isAgree
  23. })
  24. this.triggerEvent("callBack", isAgree)
  25. wx.setStorageSync('isAgree', isAgree);
  26. },
  27. checkTheAgreement() {
  28. wx.showLoading({
  29. title: '加载中...',
  30. })
  31. wx.downloadFile({
  32. url: 'https://ccyosg20230413.obs.cn-east-3.myhuaweicloud.com/system/%E6%A5%9A%E6%A5%9A%E9%9A%90%E7%A7%81%E5%8D%8F%E8%AE%AE.docx',
  33. success: (res) => {
  34. wx.openDocument({
  35. filePath: res.tempFilePath,
  36. success: (s) => {
  37. wx.hideLoading();
  38. },
  39. fail: (err) => {
  40. wx.hideLoading();
  41. wx.showToast({
  42. title: '读取失败,请稍后再试',
  43. icon: "none"
  44. })
  45. }
  46. })
  47. },
  48. fail: (err) => {
  49. wx.hideLoading();
  50. wx.showToast({
  51. title: '读取失败,请稍后再试',
  52. icon: "none"
  53. })
  54. }
  55. })
  56. }
  57. }
  58. })