123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- // pages/nnzzd/nnzzd.js
- import {
- imgUrl,
- request,
- request2
- } from "../api/request"
- import {
- cacheGet
- } from "../../utils/cacheUtil"
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- dyrs:1000,
- imgUrl:imgUrl,
- eventDataList: [],
- dySign: true
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options) {
- let token = cacheGet('token');
- if (token != null && token != '') {
- let that = this
- wx.getSetting({
- withSubscriptions: true,
- success (res) {
- console.log(res.subscriptionsSetting)
- if(res.subscriptionsSetting.itemSettings['aGohosyMWmBOdzkjlD34qMRIsAPb2cVY6juinVIevgg','Zz1KCbvRe893kLn9YOH5JmTpNhBuPHoda-MCBpHyWyY','8JCTOvJtdQhfs0LFbYrF_Q2Djq6-WEozkWcv_4MEtgM'] == 'accept'){
- that.setData({
- dySign: false
- })
- }
- }
- })
- request({
- url: '/event/page?page=1&limit=4',
- method: 'GET'
- }).then(res => {
- let a = []
- res.data.forEach(element => {
- element.templateContent = JSON.parse(element.templateContent)
- element.createTime = element.createTime.split(' ')[0]
- a.push(element)
- });
- this.setData({
- eventDataList: a
- })
- })
- request({
- url: '/subscribe/getSubscribeNumber',
- method: 'GET'
- }).then(res => {
- this.setData({
- dyrs: res.data
- })
- })
- }else{
- wx.showModal({
- title: '掌新南岸欢迎您!',
- content: '登录,体验更完整!',
- confirmText: '登录',
- cancelText:"取消",
- success: function (res) {
- if (res.confirm) {
- wx.navigateTo({
- url: '/pages/login/login',
- });
- }if (res.cancel){
- wx.navigateTo({
- url: '/pages/index/index',
- })
- }
- },
- });
- }
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow() {
- },
- dy(){
- let that = this
- wx.requestSubscribeMessage({
- tmplIds: ['aGohosyMWmBOdzkjlD34qMRIsAPb2cVY6juinVIevgg','Zz1KCbvRe893kLn9YOH5JmTpNhBuPHoda-MCBpHyWyY','8JCTOvJtdQhfs0LFbYrF_Q2Djq6-WEozkWcv_4MEtgM'],
- success (res) {
- if(res['aGohosyMWmBOdzkjlD34qMRIsAPb2cVY6juinVIevgg','Zz1KCbvRe893kLn9YOH5JmTpNhBuPHoda-MCBpHyWyY','8JCTOvJtdQhfs0LFbYrF_Q2Djq6-WEozkWcv_4MEtgM']=='accept'){
- that.setData({
- dySign: false
- })
- }
- }
- })
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh() {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage() {
- },
- tourl(e){
- console.log(e.currentTarget.dataset.item);
- wx.navigateTo({
- url: '/pages/web/web?url='+e.currentTarget.dataset.item,
- })
- }
- })
|