|
|
|
|
@ -1,4 +1,6 @@
@@ -1,4 +1,6 @@
|
|
|
|
|
/* eslint-disable eqeqeq */ |
|
|
|
|
import dayjs from 'dayjs' |
|
|
|
|
import { parseScene } from '../../../utils/util' |
|
|
|
|
const app = getApp<IAppOption>() |
|
|
|
|
let live_time: null | number = null |
|
|
|
|
|
|
|
|
|
@ -18,6 +20,7 @@ Page({
@@ -18,6 +20,7 @@ Page({
|
|
|
|
|
lightList: [], |
|
|
|
|
|
|
|
|
|
timeData: {}, |
|
|
|
|
optionsScene: {} as any, |
|
|
|
|
|
|
|
|
|
popupShow: false, |
|
|
|
|
popupType: 'popup6', // 登录失败弹窗
|
|
|
|
|
@ -27,10 +30,21 @@ Page({
@@ -27,10 +30,21 @@ Page({
|
|
|
|
|
}, |
|
|
|
|
videoContext: {} as WechatMiniprogram.VideoContext, |
|
|
|
|
onLoad(options) { |
|
|
|
|
const scene = app.globalData.scene |
|
|
|
|
this.setData({ |
|
|
|
|
id: options.id || scene.id, |
|
|
|
|
id: options.id, |
|
|
|
|
}) |
|
|
|
|
if (options.scene) { |
|
|
|
|
const optionsScene: any = parseScene(options.scene) |
|
|
|
|
this.setData({ |
|
|
|
|
optionsScene: optionsScene || {}, |
|
|
|
|
id: options.id || optionsScene?.id, |
|
|
|
|
}) |
|
|
|
|
} else if (options.proMethodId) { |
|
|
|
|
this.setData({ |
|
|
|
|
'optionsScene.proMethodId': options.proMethodId, |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (live_time) { |
|
|
|
|
clearInterval(live_time) |
|
|
|
|
} |
|
|
|
|
@ -45,7 +59,11 @@ Page({
@@ -45,7 +59,11 @@ Page({
|
|
|
|
|
}, |
|
|
|
|
onShow() { |
|
|
|
|
app.waitLogin({ type: [0, 1] }).then(() => { |
|
|
|
|
app.mpBehavior({ PageName: 'PG_PatientLiveDetails' }) |
|
|
|
|
app.mpBehavior({ |
|
|
|
|
PageName: 'PG_PatientLiveDetails', |
|
|
|
|
detailId: this.data.id, |
|
|
|
|
promotionMethodId: this.data.optionsScene.proMethodId, |
|
|
|
|
}) |
|
|
|
|
this.getDetail() |
|
|
|
|
this.setView() |
|
|
|
|
this.getLightList() |
|
|
|
|
@ -161,9 +179,7 @@ Page({
@@ -161,9 +179,7 @@ Page({
|
|
|
|
|
handleBanner() { |
|
|
|
|
const { detail, zdUserInfo, dateValue } = this.data |
|
|
|
|
if (detail.IsSignUp && zdUserInfo.AuditStatus) { |
|
|
|
|
// eslint-disable-next-line eqeqeq
|
|
|
|
|
if (zdUserInfo.AuditStatus == 1 || zdUserInfo.AuditStatus == 3 || zdUserInfo.AuditStatus == 4) { |
|
|
|
|
// eslint-disable-next-line eqeqeq
|
|
|
|
|
if (detail.SignUpStatus == 2) { |
|
|
|
|
if (detail.BeginTimeValue * 1 < dateValue * 1) { |
|
|
|
|
this.handleLive() |
|
|
|
|
@ -206,36 +222,47 @@ Page({
@@ -206,36 +222,47 @@ Page({
|
|
|
|
|
handleSignUp() { |
|
|
|
|
const { SubscribeTemplateList } = this.data.detail |
|
|
|
|
app.mpBehavior({ PageName: 'BTN_PatientLiveSign' }) |
|
|
|
|
const { Type } = this.data.detail |
|
|
|
|
const { UserType } = this.data.zdUserInfo |
|
|
|
|
|
|
|
|
|
wx.requestSubscribeMessage({ |
|
|
|
|
tmplIds: SubscribeTemplateList, |
|
|
|
|
complete: () => { |
|
|
|
|
wx.ajax({ |
|
|
|
|
method: 'POST', |
|
|
|
|
url: '?r=zd/activity/sign-up', |
|
|
|
|
data: { |
|
|
|
|
Id: this.data.id, |
|
|
|
|
PreUserIdentity: UserType, |
|
|
|
|
}, |
|
|
|
|
}).then((res) => { |
|
|
|
|
app |
|
|
|
|
.zdPermissionVerification( |
|
|
|
|
3, |
|
|
|
|
Type == 1 ? 1 : 10, |
|
|
|
|
`/patient/pages/liveResult/index?id=${this.data.id}&rewardScore=${res.rewardScore}`, |
|
|
|
|
this.data.id, |
|
|
|
|
) |
|
|
|
|
.then(() => { |
|
|
|
|
wx.navigateTo({ |
|
|
|
|
url: `/patient/pages/liveResult/index?id=${this.data.id}&rewardScore=${res.rewardScore}`, |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
success: (res) => { |
|
|
|
|
const subscribe = SubscribeTemplateList.map((item) => { |
|
|
|
|
return res[item] === 'accept' ? 1 : 2 |
|
|
|
|
}) |
|
|
|
|
this.handleSignUpCallback(subscribe) |
|
|
|
|
}, |
|
|
|
|
fail: () => { |
|
|
|
|
this.handleSignUpCallback([2, 2]) |
|
|
|
|
}, |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
handleSignUpCallback(res = [2, 2]) { |
|
|
|
|
const { Type } = this.data.detail |
|
|
|
|
const { UserType } = this.data.zdUserInfo |
|
|
|
|
const optionsScene = this.data.optionsScene |
|
|
|
|
wx.ajax({ |
|
|
|
|
method: 'POST', |
|
|
|
|
url: '?r=zd/activity/sign-up', |
|
|
|
|
data: { |
|
|
|
|
Id: this.data.id, |
|
|
|
|
PreUserIdentity: UserType, |
|
|
|
|
promotionMethodId: optionsScene.proMethodId, |
|
|
|
|
subscribe: [...res], |
|
|
|
|
}, |
|
|
|
|
}).then((res) => { |
|
|
|
|
app |
|
|
|
|
.zdPermissionVerification( |
|
|
|
|
3, |
|
|
|
|
Type == 1 ? 1 : 10, |
|
|
|
|
`/patient/pages/liveResult/index?id=${this.data.id}&rewardScore=${res.rewardScore}`, |
|
|
|
|
this.data.id, |
|
|
|
|
) |
|
|
|
|
.then(() => { |
|
|
|
|
wx.navigateTo({ |
|
|
|
|
url: `/patient/pages/liveResult/index?id=${this.data.id}&rewardScore=${res.rewardScore}`, |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
handleShare() { |
|
|
|
|
this.setData({ |
|
|
|
|
shareShow: true, |
|
|
|
|
|