|
|
|
|
const app = getApp<IAppOption>();
|
|
|
|
|
import dayjs from "dayjs";
|
|
|
|
|
let live_time: null | number = null;
|
|
|
|
|
|
|
|
|
|
Page({
|
|
|
|
|
data: {
|
|
|
|
|
id: "",
|
|
|
|
|
detail: {} as any,
|
|
|
|
|
liveDetail: {} as any,
|
|
|
|
|
zdUserInfo: {},
|
|
|
|
|
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);
|
|
|
|
|
app.zdWaitLogin().then((_res) => {
|
|
|
|
|
this.getLiveDetail();
|
|
|
|
|
this.getDetail();
|
|
|
|
|
this.getCode();
|
|
|
|
|
app.getZdUserInfo(this, true);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
getDetail() {
|
|
|
|
|
wx.ajax({
|
|
|
|
|
method: "GET",
|
|
|
|
|
url: "?r=zd/activity/sign-up-detail",
|
|
|
|
|
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",
|
|
|
|
|
url: "?r=zd/activity/detail",
|
|
|
|
|
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",
|
|
|
|
|
url: "?r=zd/common/get-channel-wx-code",
|
|
|
|
|
data: {
|
|
|
|
|
Id: this.data.id,
|
|
|
|
|
ChannelType: registChannel,
|
|
|
|
|
},
|
|
|
|
|
}).then((res) => {
|
|
|
|
|
this.setData({
|
|
|
|
|
codeUrl: res,
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
handleHome() {
|
|
|
|
|
wx.reLaunch({
|
|
|
|
|
url: "/patient/pages/index/index",
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
onShareAppMessage() {
|
|
|
|
|
return {
|
|
|
|
|
title: this.data.detail.ActivityName,
|
|
|
|
|
path: `/patient/pages/liveDetail/index?id=${this.data.detail.ActivityId}`,
|
|
|
|
|
imageUrl: `${this.data.liveDetail.IntroductionUrl}`,
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
});
|