agreement.js 1.6 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. },
  26. checkTheAgreement() {
  27. wx.showLoading({
  28. title: '加载中...',
  29. })
  30. wx.downloadFile({
  31. 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',
  32. success: (res) => {
  33. wx.openDocument({
  34. filePath: res.tempFilePath,
  35. success:(s)=>{
  36. wx.hideLoading();
  37. },
  38. fail: (err) => {
  39. wx.hideLoading();
  40. wx.showToast({
  41. title: '读取失败,请稍后再试',
  42. icon: "none"
  43. })
  44. }
  45. })
  46. },
  47. fail: (err) => {
  48. wx.hideLoading();
  49. wx.showToast({
  50. title: '读取失败,请稍后再试',
  51. icon: "none"
  52. })
  53. }
  54. })
  55. }
  56. }
  57. })