nnzzd.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. // pages/nnzzd/nnzzd.js
  2. import {
  3. imgUrl,
  4. request,
  5. request2
  6. } from "../api/request"
  7. import {
  8. cacheGet
  9. } from "../../utils/cacheUtil"
  10. Page({
  11. /**
  12. * 页面的初始数据
  13. */
  14. data: {
  15. dyrs:1000,
  16. imgUrl:imgUrl,
  17. eventDataList: [],
  18. dySign: true
  19. },
  20. /**
  21. * 生命周期函数--监听页面加载
  22. */
  23. onLoad(options) {
  24. let token = cacheGet('token');
  25. if (token != null && token != '') {
  26. let that = this
  27. wx.getSetting({
  28. withSubscriptions: true,
  29. success (res) {
  30. console.log(res.subscriptionsSetting)
  31. if(res.subscriptionsSetting.itemSettings['aGohosyMWmBOdzkjlD34qMRIsAPb2cVY6juinVIevgg','Zz1KCbvRe893kLn9YOH5JmTpNhBuPHoda-MCBpHyWyY','8JCTOvJtdQhfs0LFbYrF_Q2Djq6-WEozkWcv_4MEtgM'] == 'accept'){
  32. that.setData({
  33. dySign: false
  34. })
  35. }
  36. }
  37. })
  38. request({
  39. url: '/event/page?page=1&limit=4',
  40. method: 'GET'
  41. }).then(res => {
  42. let a = []
  43. res.data.forEach(element => {
  44. element.templateContent = JSON.parse(element.templateContent)
  45. element.createTime = element.createTime.split(' ')[0]
  46. a.push(element)
  47. });
  48. this.setData({
  49. eventDataList: a
  50. })
  51. })
  52. request({
  53. url: '/subscribe/getSubscribeNumber',
  54. method: 'GET'
  55. }).then(res => {
  56. this.setData({
  57. dyrs: res.data
  58. })
  59. })
  60. }else{
  61. wx.showModal({
  62. title: '掌新南岸欢迎您!',
  63. content: '登录,体验更完整!',
  64. confirmText: '登录',
  65. cancelText:"取消",
  66. success: function (res) {
  67. if (res.confirm) {
  68. wx.navigateTo({
  69. url: '/pages/login/login',
  70. });
  71. }if (res.cancel){
  72. wx.navigateTo({
  73. url: '/pages/index/index',
  74. })
  75. }
  76. },
  77. });
  78. }
  79. },
  80. /**
  81. * 生命周期函数--监听页面初次渲染完成
  82. */
  83. onReady() {
  84. },
  85. /**
  86. * 生命周期函数--监听页面显示
  87. */
  88. onShow() {
  89. },
  90. dy(){
  91. let that = this
  92. wx.requestSubscribeMessage({
  93. tmplIds: ['aGohosyMWmBOdzkjlD34qMRIsAPb2cVY6juinVIevgg','Zz1KCbvRe893kLn9YOH5JmTpNhBuPHoda-MCBpHyWyY','8JCTOvJtdQhfs0LFbYrF_Q2Djq6-WEozkWcv_4MEtgM'],
  94. success (res) {
  95. if(res['aGohosyMWmBOdzkjlD34qMRIsAPb2cVY6juinVIevgg','Zz1KCbvRe893kLn9YOH5JmTpNhBuPHoda-MCBpHyWyY','8JCTOvJtdQhfs0LFbYrF_Q2Djq6-WEozkWcv_4MEtgM']=='accept'){
  96. that.setData({
  97. dySign: false
  98. })
  99. }
  100. }
  101. })
  102. },
  103. /**
  104. * 生命周期函数--监听页面隐藏
  105. */
  106. onHide() {
  107. },
  108. /**
  109. * 生命周期函数--监听页面卸载
  110. */
  111. onUnload() {
  112. },
  113. /**
  114. * 页面相关事件处理函数--监听用户下拉动作
  115. */
  116. onPullDownRefresh() {
  117. },
  118. /**
  119. * 页面上拉触底事件的处理函数
  120. */
  121. onReachBottom() {
  122. },
  123. /**
  124. * 用户点击右上角分享
  125. */
  126. onShareAppMessage() {
  127. },
  128. tourl(e){
  129. console.log(e.currentTarget.dataset.item);
  130. wx.navigateTo({
  131. url: '/pages/web/web?url='+e.currentTarget.dataset.item,
  132. })
  133. }
  134. })