|
|
|
|
@ -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 |
|
|
|
|
|
|
|
|
|
@ -6,12 +8,20 @@ Page({
@@ -6,12 +8,20 @@ Page({
|
|
|
|
|
data: { |
|
|
|
|
id: '', |
|
|
|
|
shareShow: false, |
|
|
|
|
dateValue: 0, |
|
|
|
|
detail: {} as any, |
|
|
|
|
zdUserInfo: {} as any, |
|
|
|
|
posterUrl: '', |
|
|
|
|
params: {}, |
|
|
|
|
play: false, |
|
|
|
|
|
|
|
|
|
currentVideoSrc: '', |
|
|
|
|
|
|
|
|
|
lightList: [], |
|
|
|
|
|
|
|
|
|
timeData: {}, |
|
|
|
|
optionsScene: {} as any, |
|
|
|
|
|
|
|
|
|
popupShow: false, |
|
|
|
|
popupType: 'popup6', // 登录失败弹窗
|
|
|
|
|
popupParams: { |
|
|
|
|
@ -20,10 +30,21 @@ Page({
@@ -20,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) |
|
|
|
|
} |
|
|
|
|
@ -38,9 +59,14 @@ Page({
@@ -38,9 +59,14 @@ 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() |
|
|
|
|
app.getZdUserInfo(this, true, () => { |
|
|
|
|
this.getPosterParams() |
|
|
|
|
}) |
|
|
|
|
@ -49,6 +75,21 @@ Page({
@@ -49,6 +75,21 @@ Page({
|
|
|
|
|
onReady() { |
|
|
|
|
this.videoContext = wx.createVideoContext('video') |
|
|
|
|
}, |
|
|
|
|
getLightList() { |
|
|
|
|
wx.ajax({ |
|
|
|
|
method: 'GET', |
|
|
|
|
url: '?r=zd/activity/get-high-light-list', |
|
|
|
|
data: { activityId: this.data.id }, |
|
|
|
|
}).then((res) => { |
|
|
|
|
res.map((item: any) => { |
|
|
|
|
item.duration = dayjs(item.duration * 1000).format('mm:ss') |
|
|
|
|
return item |
|
|
|
|
}) |
|
|
|
|
this.setData({ |
|
|
|
|
lightList: res, |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
getPosterParams() { |
|
|
|
|
wx.ajax({ |
|
|
|
|
method: 'POST', |
|
|
|
|
@ -109,11 +150,25 @@ Page({
@@ -109,11 +150,25 @@ Page({
|
|
|
|
|
}), |
|
|
|
|
BeginTime: dayjs(res.BeginTime).format('YYYY-MM-DD HH:mm'), |
|
|
|
|
}, |
|
|
|
|
currentVideoSrc: res.ReplayVideoUrl, |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
handleLightVideo(e) { |
|
|
|
|
const { url } = e.currentTarget.dataset |
|
|
|
|
|
|
|
|
|
this.setData({ |
|
|
|
|
currentVideoSrc: url, |
|
|
|
|
}) |
|
|
|
|
this.videoContext.requestFullScreen({}) |
|
|
|
|
this.videoContext.seek(0) |
|
|
|
|
this.videoContext.play() |
|
|
|
|
}, |
|
|
|
|
handleReplay() { |
|
|
|
|
app.mpBehavior({ PageName: 'BTN_PatientLiveReview' }) |
|
|
|
|
this.setData({ |
|
|
|
|
currentVideoSrc: this.data.detail.ReplayVideoUrl, |
|
|
|
|
}) |
|
|
|
|
this.videoContext.requestFullScreen({}) |
|
|
|
|
this.videoContext.seek(0) |
|
|
|
|
this.videoContext.play() |
|
|
|
|
@ -121,6 +176,18 @@ Page({
@@ -121,6 +176,18 @@ Page({
|
|
|
|
|
handleFullscreenExit() { |
|
|
|
|
this.videoContext.pause() |
|
|
|
|
}, |
|
|
|
|
handleBanner() { |
|
|
|
|
const { detail, zdUserInfo, dateValue } = this.data |
|
|
|
|
if (detail.IsSignUp && zdUserInfo.AuditStatus) { |
|
|
|
|
if (zdUserInfo.AuditStatus == 1 || zdUserInfo.AuditStatus == 3 || zdUserInfo.AuditStatus == 4) { |
|
|
|
|
if (detail.SignUpStatus == 2) { |
|
|
|
|
if (detail.BeginTimeValue * 1 < dateValue * 1) { |
|
|
|
|
this.handleLive() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
handleLive() { |
|
|
|
|
const { Type } = this.data.detail |
|
|
|
|
app.mpBehavior({ PageName: 'BTN_PatientLiveEnter' }) |
|
|
|
|
@ -153,16 +220,33 @@ Page({
@@ -153,16 +220,33 @@ Page({
|
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
handleSignUp() { |
|
|
|
|
const { SubscribeTemplateList } = this.data.detail |
|
|
|
|
app.mpBehavior({ PageName: 'BTN_PatientLiveSign' }) |
|
|
|
|
wx.requestSubscribeMessage({ |
|
|
|
|
tmplIds: SubscribeTemplateList, |
|
|
|
|
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 |
|
|
|
|
@ -323,8 +407,20 @@ Page({
@@ -323,8 +407,20 @@ Page({
|
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
handleAnswer() { |
|
|
|
|
const link = this.data.detail.QuestionnaireUrl |
|
|
|
|
wx.navigateTo({ |
|
|
|
|
url: `/pages/webview/index?url=${encodeURIComponent('https://shop.show.hbsaas.com/statics/#/?nId=bz56')}`, |
|
|
|
|
url: `/pages/webview/index?url=${encodeURIComponent(link)}`, |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
handleTimeChange(e) { |
|
|
|
|
this.setData({ |
|
|
|
|
timeData: e.detail, |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
handleTimeFinish() { |
|
|
|
|
this.setData({ |
|
|
|
|
dateValue: dayjs().valueOf(), |
|
|
|
|
'detail.LeftTime': 0, |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
onShareAppMessage() { |
|
|
|
|
|