日照项目的居民端小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
2.1 KiB

// pages/index/subscribe.js
import { wxRequestGet } from "@utils/promise-wx-api";
const app = getApp();
Page({
/**
*
*/
data: {
iniLoaded: false,
routes: {
issue: '/pages/discussion/detail/index',
topic: '/pages/group/topic/topicDetail/topicDetail'
}
},
/**
* -- 3e4f2a227sd9w0s9w7eqwdaiojwdoiwe f309d4d35705402fb250d3255253a7c1
*/
onLoad: async function (options) {
await app.doAfterLogin()
this.initPage(options)
},
async initPage (options: Object) {
const {
data: {
data: { code, data },
},
msg,
} = await wxRequestGet(
'message/wxmpupdatesenddata/' + options.id,
{},
{
// isMock: true,
// isQuiet: true
}
);
if (msg === 'success' && code === 0) {
console.log('data', data)
if (data !== null) {
const { routes } = this.data
const { sourceType, sourceId, groupId } = data
const _id = sourceType === 'topic' ? 'tid' : 'issueId'
wx.reLaunch({
url: routes[sourceType] + `?${_id}=${sourceId}&gid=${groupId}`
})
} else {
wx.showToast({
title: '数据异常',
icon: 'none',
duration: 1500
})
}
}
},
/**
* --
*/
onReady: function () {
},
/**
* --
*/
onShow: function () {
},
/**
* --
*/
onHide: function () {
},
/**
* --
*/
onUnload: function () {
},
/**
* --
*/
onPullDownRefresh: function () {
},
/**
*
*/
onReachBottom: function () {
},
/**
*
*/
onShareAppMessage: function () {
}
})