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
106 lines
2.1 KiB
2 years ago
|
// 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 () {
|
||
|
|
||
|
}
|
||
|
})
|