Compare commits

...

5 Commits

  1. 28
      eslint.config.js
  2. 28
      eslint.config.mjs
  3. 8
      package.json
  4. 2596
      pnpm-lock.yaml
  5. 2
      project.private.config.json
  6. 48
      src/app.ts
  7. 11
      src/components/popup/index.scss
  8. 3
      src/components/popup/index.wxml
  9. BIN
      src/images/bg32.png
  10. BIN
      src/images/icon87.png
  11. BIN
      src/images/za-images/live-banner.png
  12. 2
      src/pages/d_patient/index.wxml
  13. 39
      src/pages/start/index.ts
  14. 2
      src/patient/pages/index/index.scss
  15. 45
      src/patient/pages/index/index.ts
  16. 15
      src/patient/pages/index/index.wxml
  17. 105
      src/patient/pages/liveDetail/index.ts
  18. 15
      src/patient/pages/liveDetail/index.wxml
  19. 19
      src/patient/pages/liveDetailVideo/index.scss
  20. 100
      src/patient/pages/liveDetailVideo/index.ts
  21. 32
      src/patient/pages/liveDetailVideo/index.wxml
  22. 18
      src/patient/pages/liveResult/index.ts
  23. 2
      src/patient/pages/liveResult/index.wxml
  24. 8
      src/patient/pages/personalInformation/index.scss
  25. 36
      src/patient/pages/personalInformation/index.ts
  26. 14
      src/patient/pages/personalInformation/index.wxml
  27. 2
      typings/index.d.ts

28
eslint.config.js

@ -0,0 +1,28 @@ @@ -0,0 +1,28 @@
import antfu from '@antfu/eslint-config'
export default antfu({
env: {
es6: true,
},
parserOptions: { project: ['./tsconfig.json'] },
globals: {
wx: true,
App: true,
Page: true,
getCurrentPages: true,
getApp: true,
Component: true,
requirePlugin: true,
requireMiniProgram: true,
},
rules: {
'eslint-comments/no-unlimited-disable': 'off',
'ts/no-require-imports': 'off',
eqeqeq: 'off',
},
formatters: {
css: 'prettier',
html: 'prettier',
markdown: 'prettier',
},
})

28
eslint.config.mjs

@ -1,28 +0,0 @@ @@ -1,28 +0,0 @@
// eslint.config.mjs
import antfu from '@antfu/eslint-config'
import prettierConfig from 'eslint-config-prettier'
export default antfu(
{
env: {
es6: true,
},
stylistic: false,
parserOptions: { project: ['./tsconfig.json'] },
globals: {
wx: true,
App: true,
Page: true,
getCurrentPages: true,
getApp: true,
Component: true,
requirePlugin: true,
requireMiniProgram: true,
},
rules: {
'eslint-comments/no-unlimited-disable': 'off',
'ts/no-require-imports': 'off',
},
},
prettierConfig,
)

8
package.json

@ -18,10 +18,10 @@ @@ -18,10 +18,10 @@
"typescript": "^5.3.3"
},
"devDependencies": {
"@antfu/eslint-config": "^3.7.3",
"eslint": "^9.12.0",
"eslint-config-prettier": "^9.1.0",
"miniprogram-api-typings": "^4.0.1",
"@antfu/eslint-config": "^6.2.0",
"eslint": "^9.38.0",
"eslint-plugin-format": "^1.0.2",
"miniprogram-api-typings": "^4.1.0",
"prettier": "3.3.3"
}
}

2596
pnpm-lock.yaml

File diff suppressed because it is too large Load Diff

2
project.private.config.json

@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
"projectname": "xinda-miniprogram",
"setting": {
"compileHotReLoad": true,
"urlCheck": true,
"urlCheck": false,
"coverView": false,
"lazyloadPlaceholderEnable": false,
"skylineRenderEnable": true,

48
src/app.ts

@ -1,10 +1,10 @@ @@ -1,10 +1,10 @@
import dayjs from 'dayjs'
import licia from 'miniprogram-licia'
import component from '@/utils/component'
import relativeTime from '@/utils/dayjs/relativeTime.js'
import page from '@/utils/page'
import { request } from '@/utils/request'
import { parseScene } from './utils/util'
const dayjs = require('dayjs')
const licia = require('miniprogram-licia')
require('/utils/dayjs/day-zh-cn.js')
@ -97,6 +97,11 @@ App<IAppOption>({ @@ -97,6 +97,11 @@ App<IAppOption>({
99: '取消',
100: '已删除',
},
liveSubscribe: {
sub: false,
tmplIds: [],
},
},
onLaunch() {
Page = page as WechatMiniprogram.Page.Constructor
@ -114,7 +119,8 @@ App<IAppOption>({ @@ -114,7 +119,8 @@ App<IAppOption>({
onShow(options) {
if (options.query.scene) {
this.globalData.scene = parseScene(options.query.scene)
} else if (options.query.proMethodId) {
}
else if (options.query.proMethodId) {
this.globalData.scene.proMethodId = options.query.proMethodId
}
},
@ -235,7 +241,7 @@ App<IAppOption>({ @@ -235,7 +241,7 @@ App<IAppOption>({
data: {},
}) as Promise<never>
},
mpBehavior(data: { doctor?: boolean; PageName: string }) {
mpBehavior(data: { doctor?: boolean, PageName: string }) {
let url = '?r=zd/mp-behavior/add'
if (data.doctor) {
url = '?r=zd/doctor/mp-behavior/add'
@ -267,9 +273,10 @@ App<IAppOption>({ @@ -267,9 +273,10 @@ App<IAppOption>({
})
},
// zd相关函数
zdMpBehavior(data: { PageName: string; doctor?: boolean }) {
zdMpBehavior(data: { PageName: string, doctor?: boolean }) {
const { loginType } = this.globalData
if (loginType === 0) return
if (loginType === 0)
return
let url = '?r=zd/mp-behavior/add'
if (data.doctor) {
url = '?r=zd/doctor/mp-behavior/add'
@ -296,13 +303,15 @@ App<IAppOption>({ @@ -296,13 +303,15 @@ App<IAppOption>({
if (this.zdVerifySys(pub)) {
if (this.globalData.loginType === 1) {
this.zdRegistrationVerification(() => resolve(), loginPage)
} else {
}
else {
resolve()
}
}
}
const unRegFun = (resolve) => {
if (!this.zdVerifySys(pub)) return
if (!this.zdVerifySys(pub))
return
resolve()
}
return new Promise((resolve: (value?) => void) => {
@ -360,11 +369,14 @@ App<IAppOption>({ @@ -360,11 +369,14 @@ App<IAppOption>({
let urlKey = ''
if (!PatientId) {
urlKey = 'enterInfo'
} else if (AuditStatus == 0) {
}
else if (AuditStatus == 0) {
urlKey = 'noCert'
} else if (AuditStatus == 1) {
}
else if (AuditStatus == 1) {
urlKey = isFollow ? 'nopending' : 'pending'
} else if (AuditStatus == 2) {
}
else if (AuditStatus == 2) {
urlKey = 'reject'
}
const navUrl = {
@ -415,7 +427,8 @@ App<IAppOption>({ @@ -415,7 +427,8 @@ App<IAppOption>({
})
return false
}
if (ignorePath.includes(url)) return true
if (ignorePath.includes(url))
return true
if (loginType === 1) {
if (url.includes('doctor/pages')) {
@ -423,14 +436,16 @@ App<IAppOption>({ @@ -423,14 +436,16 @@ App<IAppOption>({
url: '/pages/index/index',
})
return false
} else {
}
else {
return true
}
}
if (loginType === 2 && !pub) {
if (url.includes('doctor/pages')) {
return true
} else {
}
else {
const params = Object.entries(options)
.map(([key, value]) => `${key}=${value}`)
.join('&')
@ -455,7 +470,8 @@ App<IAppOption>({ @@ -455,7 +470,8 @@ App<IAppOption>({
url: '/patient/pages/login/index',
})
isReject = true
} else if (!isNewReg) {
}
else if (!isNewReg) {
wx.reLaunch({
url: '/patient/pages/enterInfo/index',
})
@ -464,7 +480,7 @@ App<IAppOption>({ @@ -464,7 +480,7 @@ App<IAppOption>({
}
if (isReject) {
that.globalData.backPage = backPage
reject(null)
reject(new Error('非登录用户拦截'))
return
}
resolve(null)

11
src/components/popup/index.scss

@ -129,10 +129,19 @@ @@ -129,10 +129,19 @@
.popup6 {
width: 590rpx;
height: 880rpx;
position: relative;
.p-img {
width: 100%;
height: 100%;
}
.code {
position: absolute;
top: 350rpx;
left: 50%;
transform: translateX(-50%);
width: 290rpx;
height: 290rpx;
}
}
.popup7 {
@ -187,7 +196,7 @@ @@ -187,7 +196,7 @@
width: 100%;
height: 100%;
}
.code{
.code {
position: absolute;
top: 372rpx;
left: 50%;

3
src/components/popup/index.wxml

@ -55,7 +55,8 @@ @@ -55,7 +55,8 @@
</view>
</view>
<view class="popup6" wx:if="{{type==='popup6'}}">
<image class="p-img" src="{{imageUrl}}bg20.png?t={{Timestamp}}" show-menu-by-longpress></image>
<image class="p-img" src="{{imageUrl}}bg32.png?t={{Timestamp}}"></image>
<image class="code" src="{{params.qrCode}}" show-menu-by-longpress></image>
</view>
<view class="popup7" wx:if="{{type==='popup7'}}">
<image class="badge" src="{{imageUrl}}icon78.png?t={{Timestamp}}"></image>

BIN
src/images/bg32.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 MiB

BIN
src/images/icon87.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 694 B

BIN
src/images/za-images/live-banner.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 634 KiB

After

Width:  |  Height:  |  Size: 696 KiB

2
src/pages/d_patient/index.wxml

@ -35,7 +35,7 @@ @@ -35,7 +35,7 @@
<view class="edc" wx:if="{{item.IsEDC==1}}">EDC患者</view>
</view>
</view>
<view class="replay-date">注册时间:{{item.BecomePatientTime}}</view>
<view class="replay-date">邀约时间:{{item.InviteTime}}</view>
</view>
<view class="send" catch:tap="handleSend" data-index="{{index}}">消息</view>
</view>

39
src/pages/start/index.ts

@ -1,47 +1,54 @@ @@ -1,47 +1,54 @@
const app = getApp<IAppOption>();
const app = getApp<IAppOption>()
Page({
data: {},
onLoad() {
app.waitLogin().then(() => {
const { isLogin, isNewReg, loginType } = app.globalData;
const { isLogin, isNewReg, loginType, scene } = app.globalData
if (isLogin === 0) {
// 未登录用户,扫医生邀请码,重定向到患者登录页
if (scene?.doctorId) {
wx.reLaunch({
url: '/patient/pages/login/index',
})
return
}
wx.reLaunch({
url: '/patient/pages/index/index',
});
return;
})
return
}
if (loginType === 0) {
wx.reLaunch({
url: '/patient/pages/index/index',
});
return;
})
return
}
if (loginType === 1) {
if (isNewReg === 1) {
wx.reLaunch({
url: '/patient/pages/index/index',
});
return;
})
return
}
wx.reLaunch({
url: '/patient/pages/enterInfo/index',
});
return;
})
return
}
if (loginType === 2) {
if (isNewReg === 1) {
wx.reLaunch({
url: '/pages/home/index',
});
return;
})
return
}
wx.reLaunch({
url: '/pages/login/index',
});
})
}
});
})
},
});
})
export {};
export {}

2
src/patient/pages/index/index.scss

@ -282,7 +282,7 @@ page { @@ -282,7 +282,7 @@ page {
}
.labels {
margin-top: 16rpx;
max-width: 56vw;
max-width: 64vw;
font-size: 28rpx;
color: rgba(173, 172, 178, 1);
white-space: nowrap;

45
src/patient/pages/index/index.ts

@ -1,4 +1,5 @@ @@ -1,4 +1,5 @@
import dayjs from 'dayjs'
const app = getApp<IAppOption>()
const licia = require('miniprogram-licia')
@ -307,7 +308,8 @@ Page({ @@ -307,7 +308,8 @@ Page({
},
routerTo(e) {
let { url, active, code } = e.currentTarget.dataset
if (!url) return
if (!url)
return
if (code === 'doctor') {
app.mpBehavior({ PageName: 'BTN_PatientHomeDoctorCard' })
}
@ -399,7 +401,8 @@ Page({ @@ -399,7 +401,8 @@ Page({
wx.navigateTo({
url: '/patient/pages/vipLogin/index',
})
} else if (MedicineAuditSwitch === '1') {
}
else if (MedicineAuditSwitch === '1') {
const pendPath = {
0: '/patient/pages/vipPending/index',
1: '/patient/pages/vipStartPending/index',
@ -411,7 +414,8 @@ Page({ @@ -411,7 +414,8 @@ Page({
wx.navigateTo({
url: url || '/patient/pages/vipCert/index',
})
} else {
}
else {
wx.showToast({
icon: 'none',
title: '工程师正在努力建设中,敬请期待!',
@ -423,26 +427,31 @@ Page({ @@ -423,26 +427,31 @@ Page({
if (toastType === 'vipScan') {
this.routerVipTo()
this.handleToastCancel()
} else if (toastType === 'aldAlert') {
}
else if (toastType === 'aldAlert') {
wx.navigateTo({
url: '/patient/pages/adl/index',
})
this.handleToastCancel()
} else if (toastType === 'healthCare') {
}
else if (toastType === 'healthCare') {
this.setPopupInfo()
this.handleNRDL()
this.handleToastCancel()
} else if (toastType === 'ndrlAldAlert') {
}
else if (toastType === 'ndrlAldAlert') {
wx.navigateTo({
url: '/patient/pages/adl/index?nrdl=1',
})
this.handleToastCancel()
} else if (toastType === 'doubleStandards') {
}
else if (toastType === 'doubleStandards') {
wx.navigateTo({
url: '/patient/pages/adl/index',
})
this.handleToastCancel()
} else if (toastType === 'dedicatedDoctor') {
}
else if (toastType === 'dedicatedDoctor') {
wx.ajax({
method: 'POST',
url: '?r=zd/popup/close-popup',
@ -455,7 +464,8 @@ Page({ @@ -455,7 +464,8 @@ Page({
})
})
this.handleToastCancel(null, false)
} else if (toastType === 'referral-toast') {
}
else if (toastType === 'referral-toast') {
this.setData({
referralFromShow: true,
})
@ -465,14 +475,15 @@ Page({ @@ -465,14 +475,15 @@ Page({
data: {},
})
this.handleToastCancel(null, false)
} else if (toastType === 'drug-guide') {
}
else if (toastType === 'drug-guide') {
wx.ajax({
method: 'POST',
url: '?r=zd/popup/add-record',
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)
@ -488,7 +499,8 @@ Page({ @@ -488,7 +499,8 @@ Page({
Type: 5,
},
})
} else if (toastType === 'dedicatedDoctor' && sure) {
}
else if (toastType === 'dedicatedDoctor' && sure) {
wx.ajax({
method: 'POST',
url: '?r=zd/popup/close-popup',
@ -496,13 +508,15 @@ Page({ @@ -496,13 +508,15 @@ Page({
Type: 6,
},
})
} else if (toastType === 'referral-toast') {
}
else if (toastType === 'referral-toast') {
wx.ajax({
method: 'POST',
url: '?r=zd/re-visit/update-popup-show-status',
data: {},
})
} else if (toastType === 'drug-guide' && sure) {
}
else if (toastType === 'drug-guide' && sure) {
wx.ajax({
method: 'POST',
url: '?r=zd/popup/add-record',
@ -570,7 +584,8 @@ Page({ @@ -570,7 +584,8 @@ Page({
infoList: list,
})
})
} else {
}
else {
wx.ajax({
method: 'POST',
url: '?r=zd/pic-text/collection',

15
src/patient/pages/index/index.wxml

@ -99,10 +99,21 @@ @@ -99,10 +99,21 @@
<view
class="l-banner"
bind:tap="routerTo"
data-url="/patient/pages/live/index?index=0"
data-url="{{card.configLinkUrl || '/patient/pages/live/index?index=0'}}"
data-code="{{card.code}}"
>
<image class="live-img" mode="aspectFill" src="{{imageUrl}}za-images/live-banner.png?t={{Timestamp}}"></image>
<image
wx:if="{{card.configImg}}"
class="live-img"
mode="aspectFill"
src="{{card.configImg}}"
></image>
<image
wx:else
class="live-img"
mode="aspectFill"
src="{{imageUrl}}za-images/live-banner.png?t={{Timestamp}}"
></image>
</view>
<view class="list" wx:if="{{liveList.length}}">
<view

105
src/patient/pages/liveDetail/index.ts

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
/* eslint-disable eqeqeq */
import dayjs from 'dayjs'
import { parseScene } from '../../../utils/util'
const app = getApp<IAppOption>()
let live_time: null | number = null
@ -39,7 +39,8 @@ Page({ @@ -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({ @@ -129,7 +130,8 @@ Page({
wx.setNavigationBarTitle({
title: '会议详情',
})
} else {
}
else {
wx.setNavigationBarTitle({
title: '活动详情',
})
@ -218,25 +220,11 @@ Page({ @@ -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({ @@ -244,7 +232,6 @@ Page({
Id: this.data.id,
PreUserIdentity: UserType,
promotionMethodId: optionsScene.proMethodId,
subscribe: [...res],
},
}).then((res) => {
app
@ -255,10 +242,44 @@ Page({ @@ -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({ @@ -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',
@ -387,12 +412,22 @@ Page({ @@ -387,12 +412,22 @@ Page({
})
},
handleOffice() {
this.setData({
popupShow: true,
popupType: 'popup6',
popupParams: {
close: true,
wx.ajax({
method: 'GET',
url: '?r=zd/common/get-channel-wx-code',
data: {
ChannelType: this.data.detail.Type == 1 ? '1' : '11',
Id: this.data.id,
},
}).then((res) => {
this.setData({
popupShow: true,
popupType: 'popup6',
popupParams: {
qrCode: res,
close: true,
},
})
})
},
handlePopupCancel() {
@ -413,12 +448,12 @@ Page({ @@ -413,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}`,
})

15
src/patient/pages/liveDetail/index.wxml

@ -107,7 +107,11 @@ @@ -107,7 +107,11 @@
<view class="c-title">详情介绍</view>
<image class="c-img" mode="widthFix" src="{{item.url}}" wx:for="{{detail.DetailJson}}" wx:key="name"></image>
</view>
<view class="public" wx:if="{{detail.Status==3}}" style="background: url('{{imageUrl}}bg24.png?t={{Timestamp}}') no-repeat center/100%">
<view
class="public"
wx:if="{{detail.Status==3}}"
style="background: url('{{imageUrl}}bg24.png?t={{Timestamp}}') no-repeat center/100%"
>
<image class="p-code" src="{{detail.subscribe_img}}" show-menu-by-longpress></image>
</view>
</view>
@ -175,12 +179,9 @@ @@ -175,12 +179,9 @@
</video>
</view>
<image
class="fixed-share"
wx:if="{{detail.PosterUrl}}"
src="{{imageUrl}}icon67.png?t={{Timestamp}}"
bind:tap="handleShare"
></image>
<button open-type="share" wx:if="{{detail.PosterUrl}}" class="fixed-share">
<image class="fixed-share" src="{{imageUrl}}icon67.png?t={{Timestamp}}"></image>
</button>
<van-popup show="{{shareShow}}" custom-class="custom-popup" bind:click-overlay="handleShareClose">
<view class="p-share">

19
src/patient/pages/liveDetailVideo/index.scss

@ -7,9 +7,26 @@ @@ -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;

100
src/patient/pages/liveDetailVideo/index.ts

@ -1,5 +1,7 @@ @@ -1,5 +1,7 @@
import dayjs from 'dayjs'
const licia = require('miniprogram-licia')
const app = getApp<IAppOption>()
// 组件说明文档 https://github.com/wechat-miniprogram/miniprogram-component-plus/blob/master/docs/video-swiper.md
@ -20,6 +22,8 @@ Page({ @@ -20,6 +22,8 @@ Page({
starShow: false,
index: 0,
offsetTop: 310,
},
onLoad(options) {
this.setData({
@ -78,11 +82,37 @@ Page({ @@ -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({ @@ -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({ @@ -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({ @@ -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()
},
})

32
src/patient/pages/liveDetailVideo/index.wxml

@ -11,19 +11,31 @@ @@ -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}}"
></video>
<view
wx:if="{{item.offsetTop}}"
class="full-screen"
style="top:{{item.offsetTop}}px"
catch:tap="handelFullScreen"
data-id="video-{{item.attachmentId}}"
>
<image class="icon" src="{{imageUrl}}icon87.png?t={{Timestamp}}"></image>
全屏观看
</view>
<image
wx:if="{{!item.play}}"
class="play"
@ -33,7 +45,7 @@ @@ -33,7 +45,7 @@
data-index="{{index}}"
></image>
<view class="swiper-item-footer">
<view class="title">{{item.Title}}</view>
<view class="title">{{item.title}}</view>
<view class="progress">
<van-slider
value="{{item.progress}}"
@ -51,7 +63,7 @@ @@ -51,7 +63,7 @@
<view class="container">
<view class="user">
<image class="avatar" src="{{imageUrl}}logo1.png?t={{Timestamp}}"></image>
<view class="name">基因知识库</view>
<view class="name">TED关爱小助手</view>
</view>
<view class="options">
<button class="o-item" open-type="share">
@ -59,11 +71,11 @@ @@ -59,11 +71,11 @@
<image wx:else class="icon" src="{{imageUrl}}icon85.png?t={{Timestamp}}"></image>
<view class="num {{item.IsShare && 'active'}}">{{item.ShareTimes}}</view>
</button>
<view class="o-item" bind:tap="handleLike" data-index="{{index}}">
<image wx:if="{{item.IsLike}}" class="icon" src="{{imageUrl}}icon84.png?t={{Timestamp}}"></image>
<image wx:else class="icon" src="{{imageUrl}}icon86.png?t={{Timestamp}}"></image>
<view class="num {{item.IsLike && 'active'}}">{{item.LikeTimes}}</view>
</view>
<!-- <view class="o-item" bind:tap="handleLike" data-index="{{index}}"> -->
<!-- <image wx:if="{{item.IsLike}}" class="icon" src="{{imageUrl}}icon84.png?t={{Timestamp}}"></image> -->
<!-- <image wx:else class="icon" src="{{imageUrl}}icon86.png?t={{Timestamp}}"></image> -->
<!-- <view class="num {{item.IsLike && 'active'}}">{{item.LikeTimes}}</view> -->
<!-- </view> -->
</view>
</view>
</view>

18
src/patient/pages/liveResult/index.ts

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
const app = getApp<IAppOption>()
import dayjs from 'dayjs'
const app = getApp<IAppOption>()
let live_time: null | number = null
Page({
@ -11,6 +11,7 @@ Page({ @@ -11,6 +11,7 @@ Page({
codeUrl: '',
dateValue: '' as string | number,
rewardScore: 0 as number | undefined,
qrCode: '',
},
onLoad(options) {
this.setData({
@ -47,6 +48,21 @@ Page({ @@ -47,6 +48,21 @@ Page({
this.setData({
detail: res,
})
this.getQrCode()
})
},
getQrCode() {
wx.ajax({
method: 'GET',
url: '?r=zd/common/get-channel-wx-code',
data: {
ChannelType: this.data.detail.Type == 1 ? '1' : '11',
Id: this.data.id,
},
}).then((res) => {
this.setData({
qrCode: res,
})
})
},
getLiveDetail() {

2
src/patient/pages/liveResult/index.wxml

@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
<view class="tip">欢迎您参与此次活动</view>
<view class="office">
<view class="o-title">关注公众号,活动提醒不错过</view>
<image class="code" src="{{imageUrl}}code1.png?t={{Timestamp}}" show-menu-by-longpress></image>
<image class="code" src="{{qrCode}}" show-menu-by-longpress></image>
<view class="btn">长按识别二维码</view>
</view>
<view class="container">

8
src/patient/pages/personalInformation/index.scss

@ -39,7 +39,7 @@ page { @@ -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 { @@ -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 { @@ -275,10 +275,6 @@ page {
line-height: 96rpx;
font-size: 32rpx;
color: #c394ff;
&:last-of-type {
margin-top: 0;
border: none;
}
}
.picker {

36
src/patient/pages/personalInformation/index.ts

@ -1,10 +1,12 @@ @@ -1,10 +1,12 @@
import dayjs from 'dayjs'
const app = getApp<IAppOption>()
const licia = require('miniprogram-licia')
Page({
data: {
scrollBottom: '',
submit: '',
isEdit: false,
area: [] as string[][],
city: [] as string[][],
@ -65,6 +67,7 @@ Page({ @@ -65,6 +67,7 @@ Page({
if (options.bottom) {
this.setData({
scrollBottom: options.bottom,
submit: options.submit,
})
}
},
@ -105,7 +108,7 @@ Page({ @@ -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({ @@ -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({ @@ -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({ @@ -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({ @@ -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({ @@ -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({ @@ -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({ @@ -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({ @@ -290,8 +296,8 @@ Page({
},
handlePopupOk() {
this.setData({
popupShow: false,
popupType: '',
'popupShow': false,
'popupType': '',
'zdUserInfo.prescriptionImg': '',
})
this.updateUserInfo()

14
src/patient/pages/personalInformation/index.wxml

@ -179,7 +179,12 @@ @@ -179,7 +179,12 @@
<view class="del" catchtap="handleDelData" wx:if="{{zdUserInfo.DrugsAuditStatus==2}}">
<image class="d-icon" src="{{imageUrl}}icon77.png?t={{Timestamp}}"></image>
</view>
<image class="img" src="{{zdUserInfo.PrescriptionImg}}" mode="aspectFill" catch:tap="handlePreview"></image>
<image
class="img"
src="{{zdUserInfo.PrescriptionImg}}"
mode="aspectFill"
catch:tap="handlePreview"
></image>
<view class="check" wx:if="{{zdUserInfo.DrugsAuditStatus==1}}">
<image class="check-icon" src="{{imageUrl}}icon81.png?t={{Timestamp}}"></image>
审核中...
@ -197,8 +202,11 @@ @@ -197,8 +202,11 @@
</block>
</view>
</view>
<view class="cancellation" bind:tap="routerTo" data-url="/pages/login/index?back=1">切换医生端</view>
<view wx:if="{{zdUserInfo.IsRootUser==1}}" class="cancellation" bind:tap="handleLogout">注销账号</view>
<view wx:if="{{submit}}" class="cancellation" bind:tap="routerTo" data-url="/patient/pages/my/index">提交</view>
<block wx:else>
<view class="cancellation" bind:tap="routerTo" data-url="/pages/login/index?back=1">切换医生端</view>
<view wx:if="{{zdUserInfo.IsRootUser==1}}" class="cancellation" bind:tap="handleLogout">注销账号</view>
</block>
</view>
<van-popup

2
typings/index.d.ts vendored

@ -1,3 +1,5 @@ @@ -1,3 +1,5 @@
declare module 'miniprogram-licia';
type pageType = 0 | 1 | 2
interface IAppOption {
globalData: {

Loading…
Cancel
Save