信达小程序
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.

101 lines
2.3 KiB

6 months ago
const app = getApp<IAppOption>();
import dayjs from "dayjs";
let live_time: null | number = null;
Page({
data: {
id: "",
detail: {} as any,
liveDetail: {} as any,
6 months ago
zdUserInfo: {},
6 months ago
codeUrl: "",
dateValue: "" as string | number,
rewardScore: 0 as number | undefined,
},
onLoad(options) {
this.setData({
id: options.id,
rewardScore: options.rewardScore,
});
if (live_time) {
clearInterval(live_time);
}
this.setData({
dateValue: dayjs().valueOf(),
});
live_time = setInterval(() => {
this.setData({
dateValue: dayjs().valueOf(),
});
}, 1000);
6 months ago
app.zdWaitLogin().then((_res) => {
6 months ago
this.getLiveDetail();
this.getDetail();
this.getCode();
6 months ago
app.getZdUserInfo(this, true);
6 months ago
});
},
getDetail() {
wx.ajax({
method: "GET",
6 months ago
url: "?r=zd/activity/sign-up-detail",
6 months ago
data: {
Id: this.data.id,
},
}).then((res) => {
res.BeginTime = dayjs(res.BeginTime).format("YYYY-MM-DD HH:mm");
res.BeginTimeValue = dayjs(res.BeginTime).valueOf();
this.setData({
detail: res,
});
});
},
getLiveDetail() {
wx.ajax({
method: "GET",
6 months ago
url: "?r=zd/activity/detail",
6 months ago
data: {
Id: this.data.id,
},
}).then((res) => {
this.setData({
liveDetail: res,
});
});
},
handleLive() {
const { TencentMeetingCode } = this.data.detail;
wx.navigateToMiniProgram({
appId: "wx33fd6cdc62520063", // 要跳转的微信小程序appid
path: `pages/index/index?code=${TencentMeetingCode}`,
});
},
getCode() {
const { registChannel } = app.globalData;
wx.ajax({
method: "GET",
6 months ago
url: "?r=zd/common/get-channel-wx-code",
6 months ago
data: {
Id: this.data.id,
ChannelType: registChannel,
},
}).then((res) => {
this.setData({
codeUrl: res,
});
});
},
handleHome() {
wx.reLaunch({
6 months ago
url: "/patient/pages/index/index",
6 months ago
});
},
onShareAppMessage() {
return {
title: this.data.detail.ActivityName,
6 months ago
path: `/patient/pages/liveDetail/index?id=${this.data.detail.ActivityId}`,
6 months ago
imageUrl: `${this.data.liveDetail.IntroductionUrl}`,
};
},
});