diff --git a/project.config.json b/project.config.json index 625d498..1d8faf4 100644 --- a/project.config.json +++ b/project.config.json @@ -71,5 +71,5 @@ } ] }, - "appid": "wxf9ce8010f1ad24aa" + "appid": "wx71ac9c27c3c3e3f4" } \ No newline at end of file diff --git a/project.private.config.json b/project.private.config.json index f298fdf..d57dea3 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -3,7 +3,7 @@ "projectname": "xinda-miniprogram", "setting": { "compileHotReLoad": true, - "urlCheck": true, + "urlCheck": false, "coverView": false, "lazyloadPlaceholderEnable": false, "skylineRenderEnable": true, diff --git a/src/app.ts b/src/app.ts index 27d0ba7..c48d9c2 100644 --- a/src/app.ts +++ b/src/app.ts @@ -16,15 +16,15 @@ App({ // 测试号 wx2b0bb13edf717c1d // dev // appid:wxf9ce8010f1ad24aa - url: 'https://m.xd.hbraas.com', - upFileUrl: 'https://m.xd.hbraas.com/', - imageUrl: 'https://m.xd.hbraas.com/xd/', + // url: 'https://m.xd.hbraas.com', + // upFileUrl: 'https://m.xd.hbraas.com/', + // imageUrl: 'https://m.xd.hbraas.com/xd/', // pro // appid:wx71ac9c27c3c3e3f4 - // url: 'https://m.xd.hbsaas.com', - // upFileUrl: 'https://m.xd.hbsaas.com/', - // imageUrl: 'https://m.xd.hbsaas.com/api/xd/', + url: 'https://m.xd.hbsaas.com', + upFileUrl: 'https://m.xd.hbsaas.com/', + imageUrl: 'https://m.xd.hbsaas.com/api/xd/', loginState: '', isLogin: 0, @@ -97,6 +97,11 @@ App({ 99: '取消', 100: '已删除', }, + + liveSubscribe: { + sub: false, + tmplIds: [], + }, }, onLaunch() { Page = page as WechatMiniprogram.Page.Constructor @@ -475,7 +480,7 @@ App({ } if (isReject) { that.globalData.backPage = backPage - reject(null) + reject(new Error('非登录用户拦截')) return } resolve(null) diff --git a/src/images/icon87.png b/src/images/icon87.png new file mode 100644 index 0000000..33115fd Binary files /dev/null and b/src/images/icon87.png differ diff --git a/src/images/za-images/live-banner.png b/src/images/za-images/live-banner.png index 5df7330..a38c7c5 100644 Binary files a/src/images/za-images/live-banner.png and b/src/images/za-images/live-banner.png differ diff --git a/src/patient/pages/index/index.ts b/src/patient/pages/index/index.ts index 9b6bef7..4765607 100644 --- a/src/patient/pages/index/index.ts +++ b/src/patient/pages/index/index.ts @@ -472,7 +472,7 @@ Page({ data: { type: 1 }, }).then(() => { wx.navigateTo({ - url: '/patient/pages/personalInformation/index?bottom=1', + url: '/patient/pages/personalInformation/index?bottom=1&submit=1', }) }) this.handleToastCancel(null, false) diff --git a/src/patient/pages/liveDetail/index.ts b/src/patient/pages/liveDetail/index.ts index b639a4e..a9dc71a 100644 --- a/src/patient/pages/liveDetail/index.ts +++ b/src/patient/pages/liveDetail/index.ts @@ -1,6 +1,6 @@ -/* eslint-disable eqeqeq */ import dayjs from 'dayjs' import { parseScene } from '../../../utils/util' + const app = getApp() let live_time: null | number = null @@ -39,7 +39,8 @@ Page({ optionsScene: optionsScene || {}, id: options.id || optionsScene?.id, }) - } else if (options.proMethodId) { + } + else if (options.proMethodId) { this.setData({ 'optionsScene.proMethodId': options.proMethodId, }) @@ -129,7 +130,8 @@ Page({ wx.setNavigationBarTitle({ title: '会议详情', }) - } else { + } + else { wx.setNavigationBarTitle({ title: '活动详情', }) @@ -218,25 +220,11 @@ 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 + const { SubscribeTemplateList } = this.data.detail wx.ajax({ method: 'POST', url: '?r=zd/activity/sign-up', @@ -244,7 +232,6 @@ Page({ Id: this.data.id, PreUserIdentity: UserType, promotionMethodId: optionsScene.proMethodId, - subscribe: [...res], }, }).then((res) => { app @@ -255,10 +242,44 @@ Page({ this.data.id, ) .then(() => { + this.handleSignUpCallback() wx.navigateTo({ url: `/patient/pages/liveResult/index?id=${this.data.id}&rewardScore=${res.rewardScore}`, }) }) + .catch(() => { + app.globalData.liveSubscribe = { + sub: true, + tmplIds: SubscribeTemplateList, + } + }) + }) + }, + handleSignUpCallback() { + const { SubscribeTemplateList } = this.data.detail + wx.requestSubscribeMessage({ + tmplIds: SubscribeTemplateList, + success: (res) => { + const subscribe = SubscribeTemplateList.map((item) => { + return res[item] === 'accept' ? 1 : 2 + }) + this.postSubscribe(subscribe) + }, + fail: () => { + const subscribe = Array.from({ length: SubscribeTemplateList.length }).fill(2) + this.postSubscribe(subscribe) + }, + }) + }, + postSubscribe(subscribe) { + wx.ajax({ + method: 'POST', + url: '?r=zd/activity/subscribe', + data: { + ActivityId: this.data.id, + subscribe, + }, + showMsg: false, }) }, handleShare() { @@ -300,33 +321,37 @@ Page({ wx.getSetting({ success(res) { if ( - res.authSetting['scope.writePhotosAlbum'] != undefined && - res.authSetting['scope.writePhotosAlbum'] == true + res.authSetting['scope.writePhotosAlbum'] != undefined + && res.authSetting['scope.writePhotosAlbum'] == true ) { that.saveImage() - } else if (res.authSetting['scope.writePhotosAlbum'] == undefined) { - //获取当前位置 + } + else if (res.authSetting['scope.writePhotosAlbum'] == undefined) { + // 获取当前位置 that.saveImage() - } else { + } + else { wx.showModal({ title: '请求授权相册权限', content: '需要保存海报到相册,请确认授权', confirmColor: '#8c75d0', success(res) { if (res.cancel) { - //取消授权 + // 取消授权 wx.showToast({ title: '拒绝授权', icon: 'none', duration: 1000, }) - } else if (res.confirm) { - //确定授权,通过wx.openSetting发起授权请求 + } + else if (res.confirm) { + // 确定授权,通过wx.openSetting发起授权请求 wx.openSetting({ success(res) { if (res.authSetting['scope.writePhotosAlbum'] == true) { that.saveImage() - } else { + } + else { wx.showToast({ title: '授权失败', icon: 'none', @@ -423,12 +448,12 @@ Page({ }, handleTimeFinish() { this.setData({ - dateValue: dayjs().valueOf(), + 'dateValue': dayjs().valueOf(), 'detail.LeftTime': 0, }) }, handleLightDetail(e) { - const {index} = e.currentTarget.dataset; + const { index } = e.currentTarget.dataset wx.navigateTo({ url: `/patient/pages/liveDetailVideo/index?id=${this.data.id}&index=${index}`, }) diff --git a/src/patient/pages/liveDetailVideo/index.scss b/src/patient/pages/liveDetailVideo/index.scss index 751137b..ff5fc85 100644 --- a/src/patient/pages/liveDetailVideo/index.scss +++ b/src/patient/pages/liveDetailVideo/index.scss @@ -7,9 +7,26 @@ position: relative; width: 100vw; height: 100vh; + display: flex; + flex-direction: column; + justify-content: center; .video { width: 100%; - height: 100%; + } + .full-screen { + position: absolute; + right: 0; + color: #fff; + padding: 32rpx; + display: flex; + align-items: center; + gap: 12rpx; + font-size: 28rpx; + color: rgba(255, 255, 255, 0.6); + .icon { + width: 40rpx; + height: 40rpx; + } } .play { position: absolute; diff --git a/src/patient/pages/liveDetailVideo/index.ts b/src/patient/pages/liveDetailVideo/index.ts index 25b583f..48e683e 100644 --- a/src/patient/pages/liveDetailVideo/index.ts +++ b/src/patient/pages/liveDetailVideo/index.ts @@ -1,5 +1,7 @@ import dayjs from 'dayjs' + const licia = require('miniprogram-licia') + const app = getApp() // 组件说明文档 https://github.com/wechat-miniprogram/miniprogram-component-plus/blob/master/docs/video-swiper.md @@ -20,6 +22,8 @@ Page({ starShow: false, index: 0, + + offsetTop: 310, }, onLoad(options) { this.setData({ @@ -78,11 +82,37 @@ Page({ item.drag = false if (index === current) { item.ctx.play() - } else { + } + else { item.ctx.pause() } }) }, + handleFullScreenChange(e) { + const { index } = e.currentTarget.dataset + const fullScreenKey = `videoList[${index}].fullScreen` + this.setData({ + [fullScreenKey]: e.detail.fullScreen, + }) + }, + handelFullScreen(e) { + const { id } = e.currentTarget.dataset + const context = wx.createVideoContext(id) + context.requestFullScreen({}) + }, + handleLoadedMetaData(e) { + const { index } = e.currentTarget.dataset + const offsetTopKey = `videoList[${index}].offsetTop` + const query = wx.createSelectorQuery() + query + .select(`#${e.target.id}`) + .boundingClientRect((rect) => { + this.setData({ + [offsetTopKey]: rect.height + e.target.offsetTop + 10, + }) + }) + .exec() + }, handlePlay(e: any) { const { index } = e.currentTarget.dataset const key = `videoList[${index}].play` @@ -100,7 +130,8 @@ Page({ handleTimeUpdate(e: any) { const { index } = e.currentTarget.dataset const { videoList } = this.data - if (videoList[index].drag) return + if (videoList[index].drag) + return const { currentTime, duration } = e.detail const progress = (currentTime / duration) * 100 const progressKey = `videoList[${index}].progress` @@ -115,7 +146,8 @@ Page({ const { videoList } = this.data if (videoList[index].play) { videoList[index].ctx.pause() - } else { + } + else { videoList[index].ctx.play() } }, @@ -138,60 +170,22 @@ Page({ [dragKey]: false, }) }, - _timer: null as any, - handleLike(e: any) { - const { index } = e.currentTarget.dataset - const { videoList } = this.data - const currentVideo = videoList[index] - const LikeTimes = Number(currentVideo.LikeTimes) + 1 - const key = `videoList[${index}].LikeTimes` - this.setData({ - LikeTimes: this.data.LikeTimes + 1, - [key]: LikeTimes, - [`videoList[${index}].IsLike`]: true, - starShow: true, - }) - const header = this.selectComponent('#animate') - header.start() - if (this._timer) { - clearInterval(this._timer) + onShareAppMessage() { + const { id, current, videoList } = this.data + return { + title: videoList[current].Title, + path: `/patient/pages/liveDetailVideo/index?id=${id}&index=${current}`, + imageUrl: videoList[current].imgUrl, } - this._timer = setTimeout(() => { - this.setData({ - starShow: false, - }) - }, 2000) - this.likePost() }, - likePost: licia.debounce(function (this: any) { - const { activeId, LikeTimes } = this.data - this.setData({ - LikeTimes: 0, - }) - wx.ajax({ - method: 'POST', - url: '?r=wtx/knowledge/like', - data: { - Id: activeId, - LikeTimes, + handleBack() { + wx.navigateBack({ + fail: () => { + wx.reLaunch({ + url: `/patient/pages/liveDetail/index?id=${this.data.id}`, + }) }, }) - }, 1000), - onShareAppMessage() { - const { current, videoList } = this.data - const currentVideo = videoList[current] - this.setData({ - [`videoList[${current}].ShareTimes`]: Number(currentVideo.ShareTimes) + 1, - [`videoList[${current}].IsShare`]: true, - }) - wx.ajax({ - method: 'POST', - url: '?r=wtx/knowledge/share', - data: { Id: this.data.activeId }, - }) - }, - handleBack() { - wx.navigateBack() }, }) diff --git a/src/patient/pages/liveDetailVideo/index.wxml b/src/patient/pages/liveDetailVideo/index.wxml index 9e7d519..0db1be5 100644 --- a/src/patient/pages/liveDetailVideo/index.wxml +++ b/src/patient/pages/liveDetailVideo/index.wxml @@ -11,19 +11,31 @@ src="{{item.videoUrl}}" poster="{{item.imgUrl}}" loop + title="{{item.title}}" object-fit="contain" enable-play-gesture enable-progress-gesture show-center-play-btn="{{false}}" - play-btn-position="center" - controls="{{false}}" + controls="{{item.fullScreen}}" + bindloadedmetadata="handleLoadedMetaData" bindprogress="handleProgress" bindplay="handlePlay" bindpause="handlePause" + bindfullscreenchange="handleFullScreenChange" bindtimeupdate="handleTimeUpdate" data-index="{{index}}" - bind:tap="handleTogglePlay" + data-full="{{item.fullScreen}}" > + + + 全屏观看 + - {{item.Title}} + {{item.title}} - 基因知识库 + TED关爱小助手 - - - - {{item.LikeTimes}} - + + + + + diff --git a/src/patient/pages/personalInformation/index.scss b/src/patient/pages/personalInformation/index.scss index 69625ce..1f8fae9 100644 --- a/src/patient/pages/personalInformation/index.scss +++ b/src/patient/pages/personalInformation/index.scss @@ -39,7 +39,7 @@ page { .row-sub { margin-top: 8rpx; font-size: 28rpx; - color: #ADACB2; + color: #adacb2; } .row-content { padding-top: 24rpx; @@ -267,7 +267,7 @@ page { } .cancellation { - margin: 32rpx 0 24rpx; + margin: 32rpx 0 0; height: 88rpx; background: #ffffff; border-radius: 156rpx 156rpx 156rpx 156rpx; @@ -275,10 +275,6 @@ page { line-height: 96rpx; font-size: 32rpx; color: #c394ff; - &:last-of-type { - margin-top: 0; - border: none; - } } .picker { diff --git a/src/patient/pages/personalInformation/index.ts b/src/patient/pages/personalInformation/index.ts index 85bab70..3a64962 100644 --- a/src/patient/pages/personalInformation/index.ts +++ b/src/patient/pages/personalInformation/index.ts @@ -1,10 +1,12 @@ import dayjs from 'dayjs' + const app = getApp() const licia = require('miniprogram-licia') Page({ data: { scrollBottom: '', + submit: '', isEdit: false, area: [] as string[][], city: [] as string[][], @@ -65,6 +67,7 @@ Page({ if (options.bottom) { this.setData({ scrollBottom: options.bottom, + submit: options.submit, }) } }, @@ -105,7 +108,7 @@ Page({ formatUserInfo(res) { this.formatBorn(res.Birth) this.handleChaneDiagnosisTime({ detail: { value: res.DiagnosisTime } }, false) - const diagnoseTypeValue = this.data.DTList.findIndex((item) => item.id == res.DiagnoseType) + const diagnoseTypeValue = this.data.DTList.findIndex(item => item.id == res.DiagnoseType) this.handleChangeDiagnoseType({ detail: { value: [diagnoseTypeValue] } }) this.handleDiagnoseTypeSave(false) // this.handleTapRT(); @@ -128,13 +131,15 @@ Page({ if (!Birth) { bron = `${Birth}年` age = '岁' - } else if (Birth && Birth.split('-').length > 1) { + } + else if (Birth && Birth.split('-').length > 1) { bron = `${Birth.split('-')[0]}年${Birth.split('-')[1]}月` - age = - month - Birth.split('-')[1] >= 0 + age + = month - Birth.split('-')[1] >= 0 ? `${year - Birth.split('-')[0]}岁${month - Birth.split('-')[1]}个月` : `${year - Birth.split('-')[0] - 1}岁${12 - Birth.split('-')[1] + month}个月` - } else { + } + else { bron = `${Birth}年` age = `${year - Birth}岁` } @@ -155,7 +160,7 @@ Page({ handleChaneDiagnosisTime(e, update = true) { const DiagnosisTime = e.detail.value this.setData({ - DiagnosisTime: dayjs(DiagnosisTime).format('YYYY年MM月'), + 'DiagnosisTime': dayjs(DiagnosisTime).format('YYYY年MM月'), 'zdUserInfo.DiagnosisTime': DiagnosisTime, }) this.updateUserInfo(update) @@ -171,7 +176,7 @@ Page({ const value = e.detail.value const id = this.data.RTList.filter((_item, index) => index == value)[0]?.id this.setData({ - rtValue: value, + 'rtValue': value, 'zdUserInfo.RelationType': id, }) this.updateUserInfo(update) @@ -180,7 +185,7 @@ Page({ const value = e.detail.value const id = this.data.GenderList.filter((_item, index) => index == value)[0]?.id this.setData({ - genderValue: value, + 'genderValue': value, 'zdUserInfo.Gender': id, }) this.updateUserInfo(update) @@ -189,7 +194,7 @@ Page({ const value = e.detail.value const id = this.data.dict.AgeRange.filter((_item, index) => index == value)[0]?.id this.setData({ - ageRangeValue: value, + 'ageRangeValue': value, 'zdUserInfo.AgeRange': id, }) this.updateUserInfo(update) @@ -198,7 +203,7 @@ Page({ const rangeIndex = this.data.selectDiagnoseTypeIndex const id = this.data.DTList.filter((_item, index) => index == rangeIndex)[0]?.id this.setData({ - diagnoseTypeValue: rangeIndex, + 'diagnoseTypeValue': rangeIndex, 'zdUserInfo.DiagnoseType': id, }) if (update) { @@ -233,9 +238,10 @@ Page({ this.updateUserInfo() }, updateUserInfo(update = true) { - if (!update) return - const { PatientName, RelationType, Gender, Birth, DiagnosisTime, DiagnoseType, ...zdUserInfo } = - this.data.zdUserInfo + if (!update) + return + const { PatientName, RelationType, Gender, Birth, DiagnosisTime, DiagnoseType, ...zdUserInfo } + = this.data.zdUserInfo wx.ajax({ method: 'POST', url: '?r=zd/account/update-info', @@ -290,8 +296,8 @@ Page({ }, handlePopupOk() { this.setData({ - popupShow: false, - popupType: '', + 'popupShow': false, + 'popupType': '', 'zdUserInfo.prescriptionImg': '', }) this.updateUserInfo() diff --git a/src/patient/pages/personalInformation/index.wxml b/src/patient/pages/personalInformation/index.wxml index 1b30c5b..bb125c7 100644 --- a/src/patient/pages/personalInformation/index.wxml +++ b/src/patient/pages/personalInformation/index.wxml @@ -179,7 +179,12 @@ - + 审核中... @@ -197,8 +202,11 @@ - 切换医生端 - 注销账号 + 提交 + + 切换医生端 + 注销账号 +