index.js 973 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. const config = require('../../config/config')
  2. const util = require('../../utils/util')
  3. const download = require('../../utils/download')
  4. Component({
  5. properties: {
  6. // 是否同意协议
  7. read: {
  8. type: Boolean,
  9. value: false
  10. },
  11. // 是否显示气泡
  12. show: {
  13. type: Boolean,
  14. value: false
  15. }
  16. },
  17. data: {},
  18. lifetimes: {
  19. // 在组件实例进入页面节点树时执行
  20. attached: function() {},
  21. // 在组件实例被从页面节点树移除时执行
  22. detached: function() {}
  23. },
  24. methods: {
  25. toggleRead({ detail }) {
  26. if (detail) this.triggerEvent('hidePopover')
  27. this.triggerEvent('toggleRead', detail)
  28. },
  29. showAgreement({ currentTarget }) {
  30. const { type } = currentTarget.dataset
  31. const url = type == 'user' ? config.userAgreement : config.privacyPolicy
  32. util.showLoad('加载中')
  33. download.openAgreement(url).then(() => util.hideLoad()).catch(() => util.hideLoad())
  34. }
  35. }
  36. })