index.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. const App = getApp();
  2. Component({
  3. options: {
  4. addGlobalClass: true,
  5. },
  6. /**
  7. * 组件的对外属性,是属性名到属性设置的映射表
  8. */
  9. properties: {
  10. k: String,
  11. },
  12. /**
  13. * 组件的内部数据,和 properties 一同用于组件的模板渲染
  14. */
  15. data: {
  16. s: false
  17. },
  18. // 组件数据字段监听器,用于监听 properties 和 data 的变化
  19. observers: {
  20. },
  21. lifetimes: {
  22. attached: function () {
  23. if (!this.data.k) {
  24. this.setData({
  25. s: true
  26. })
  27. return
  28. }
  29. const agreeYxtk = wx.getStorageSync('agreeYxtk_' + this.data.k)
  30. if (!agreeYxtk) {
  31. this.setData({
  32. s: true
  33. })
  34. }
  35. },
  36. detached: function () {
  37. // 在组件实例被从页面节点树移除时执行
  38. },
  39. },
  40. /**
  41. * 组件的方法列表
  42. */
  43. methods: {
  44. aggree(){
  45. if (this.data.k) {
  46. wx.setStorageSync('agreeYxtk_' + this.data.k, true)
  47. }
  48. this.setData({
  49. s: false
  50. })
  51. },
  52. notagree(){
  53. wx.navigateTo({
  54. url: '/pages/notagree/index'
  55. })
  56. },
  57. goYstk(e){
  58. const k = e.currentTarget.dataset.k
  59. wx.navigateTo({
  60. url: '/pages/about/index?key=' + k,
  61. })
  62. },
  63. navBack: function () {
  64. wx.navigateBack({
  65. delta: 1
  66. })
  67. },
  68. //回主页
  69. toIndex: function () {
  70. wx.navigateTo({
  71. url: '/pages/admin/home/index/index'
  72. })
  73. },
  74. }
  75. })