Browse Source

患者端埋点

dev
kola-web 2 weeks ago
parent
commit
11024bdfea
  1. 4
      src/patient/pages/enterInfo/index.ts
  2. 45
      src/patient/pages/index/index.ts
  3. 1
      src/patient/pages/index/index.wxml
  4. 4
      src/patient/pages/interactivePatient/index.ts
  5. 143
      src/patient/pages/live/index.ts
  6. 15
      src/patient/pages/liveDetail/index.ts
  7. 9
      src/patient/pages/login/index.ts
  8. 12
      src/patient/pages/my/index.ts
  9. 20
      src/patient/pages/myLive/index.ts
  10. 2
      src/patient/pages/myLive/index.wxml
  11. 1
      src/patient/pages/mySave/index.ts
  12. 9
      src/patient/pages/personalInformation/index.ts
  13. 213
      src/patient/pages/repository/index.ts
  14. 7
      src/patient/pages/repositoryDetail/index.ts

4
src/patient/pages/enterInfo/index.ts

@ -32,6 +32,7 @@ Page({
proces: options.proces, proces: options.proces,
}) })
app.waitLogin().then(() => { app.waitLogin().then(() => {
app.mpBehavior({ PageName: 'PG_PatientInfo' })
this.getDict() this.getDict()
app.getZdUserInfo(this, true, (zdUserInfo) => { app.getZdUserInfo(this, true, (zdUserInfo) => {
this.setData({ this.setData({
@ -41,7 +42,6 @@ Page({
ageRange: zdUserInfo.AgeRange, ageRange: zdUserInfo.AgeRange,
}) })
}) })
}) })
}, },
getDict() { getDict() {
@ -86,6 +86,7 @@ Page({
}) })
}, },
handleSubmit() { handleSubmit() {
app.mpBehavior({ PageName: 'BTN_PatientInfoComfirm' })
if (this.data.submiting) return if (this.data.submiting) return
const { name, gender, ageRange, relationType, IsGraves, HasTedSurgery } = this.data const { name, gender, ageRange, relationType, IsGraves, HasTedSurgery } = this.data
@ -148,6 +149,7 @@ Page({
}) })
}, },
handleVisitors() { handleVisitors() {
app.mpBehavior({ PageName: 'BTN_PatientInfoSkip' })
wx.ajax({ wx.ajax({
method: 'POST', method: 'POST',
url: '?r=zd/login/reg-logout', url: '?r=zd/login/reg-logout',

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

@ -70,6 +70,7 @@ Page({
}, },
onShow() { onShow() {
app.waitLogin({ type: [0, 1] }).then(() => { app.waitLogin({ type: [0, 1] }).then(() => {
app.mpBehavior({ PageName: 'PG_PatientHome' })
this.setData({ this.setData({
anyWhere: app.globalData.anyWhere, anyWhere: app.globalData.anyWhere,
@ -87,6 +88,9 @@ Page({
zdUserInfo, zdUserInfo,
publicCard: zdUserInfo.isShowFollowGuide == 1, publicCard: zdUserInfo.isShowFollowGuide == 1,
}) })
if (zdUserInfo.ExclusiveDoctorId) {
app.mpBehavior({ PageName: 'PG_PatientHomeDoctorCard' })
}
this.getPopup() this.getPopup()
this.getConfig(zdUserInfo) this.getConfig(zdUserInfo)
this.getSystemConfig() this.getSystemConfig()
@ -290,44 +294,14 @@ Page({
routerTo(e) { routerTo(e) {
let { url, active, code } = e.currentTarget.dataset let { url, active, code } = e.currentTarget.dataset
if (!url) return if (!url) return
if (code === 'adl') { if (code === 'doctor') {
app.mpBehavior({ PageName: 'BTN_PatientHomeDoctorCard' })
}
if (code === 'drugs') {
} }
if (code === 'story' && url === '/patient/pages/story/index') { if (code === 'activity2' && url.includes('/patient/pages/live/index')) {
app.mpBehavior({ PageName: 'BTN_PatientHomeLiveCard' })
}
if (code === 'story' && url.includes('/patient/pages/publishStoryDetail/index')) {
}
if (code === 'activity2' && url === '/patient/pages/live/index') {
}
if (code === 'activity2' && url === '/patient/pages/live/index?index=0') {
} }
if (code === 'activity2' && url.includes('/patient/pages/liveDetail/index')) { if (code === 'activity2' && url.includes('/patient/pages/liveDetail/index')) {
app.mpBehavior({ PageName: 'BTN_PatientHomeContentCard' })
}
if (code === 'activity1' && url === '/patient/pages/live/index') {
}
if (code === 'activity1' && url.includes('/patient/pages/liveDetail/index')) {
}
if (code === 'article' && url === '/patient/pages/repository/index') {
}
if (code === 'article' && url.includes('/patient/pages/repositoryDetail/index')) {
}
if (code === 'serviceConf') {
}
if (url === '/patient/pages/interactivePatient/index') {
} }
if (url === 'NRDL') { if (url === 'NRDL') {
@ -533,7 +507,6 @@ Page({
spread1: 'BTN_PATIENTHOMEBANNER1', spread1: 'BTN_PATIENTHOMEBANNER1',
spread2: 'BTN_PATIENTHOMEBANNER2', spread2: 'BTN_PATIENTHOMEBANNER2',
}[code] }[code]
}, },
handleRegClose() { handleRegClose() {
this.setData({ this.setData({

1
src/patient/pages/index/index.wxml

@ -10,6 +10,7 @@
class="doctor" class="doctor"
wx:if="{{zdUserInfo.ExclusiveDoctorId}}" wx:if="{{zdUserInfo.ExclusiveDoctorId}}"
bind:tap="routerTo" bind:tap="routerTo"
data-code="doctor"
style="background:#fff url({{imageUrl}}bg11.png?t={{Timestamp}}) no-repeat top center/100% 256rpx" style="background:#fff url({{imageUrl}}bg11.png?t={{Timestamp}}) no-repeat top center/100% 256rpx"
data-url="/patient/pages/interactivePatient/index" data-url="/patient/pages/interactivePatient/index"
> >

4
src/patient/pages/interactivePatient/index.ts

@ -54,7 +54,7 @@ Page({
useWebAudioImplement: true, useWebAudioImplement: true,
}) })
app.waitLogin({ type: [1] }).then(() => { app.waitLogin({ type: [1] }).then(() => {
app.mpBehavior({ PageName: 'PG_PatientImDetails' })
this.getDoctorDetail() this.getDoctorDetail()
this.getQuestionList() this.getQuestionList()
this.getMessageList() this.getMessageList()
@ -288,7 +288,7 @@ Page({
}) })
}, },
handleFooter() { handleFooter() {
app.mpBehavior({ PageName: 'BTN_PatientImAsk' })
this.setData({ this.setData({
expend: !this.data.expend, expend: !this.data.expend,
}) })

143
src/patient/pages/live/index.ts

@ -1,6 +1,6 @@
import dayjs from 'dayjs'; import dayjs from 'dayjs'
const app = getApp<IAppOption>(); const app = getApp<IAppOption>()
let live_time: null | number = null; let live_time: null | number = null
Page({ Page({
data: { data: {
@ -26,46 +26,44 @@ Page({
app.zdGetTheme().then((res) => { app.zdGetTheme().then((res) => {
this.setData({ this.setData({
theme: res, theme: res,
}); })
}); })
this.setData({ this.setData({
dateValue: dayjs().valueOf(), dateValue: dayjs().valueOf(),
}); })
if (live_time) { if (live_time) {
clearInterval(live_time); clearInterval(live_time)
} }
live_time = setInterval(() => { live_time = setInterval(() => {
this.setData({ this.setData({
dateValue: dayjs().valueOf(), dateValue: dayjs().valueOf(),
}); })
}, 1000); }, 1000)
}, },
onShow() { onShow() {
if (app.globalData.active) { if (app.globalData.active) {
this.setData({ this.setData({
active: Number(app.globalData.active), active: Number(app.globalData.active),
}); })
app.globalData.active = ''; app.globalData.active = ''
} }
app.waitLogin({ type: [0, 1] }).then(() => { app.waitLogin({ type: [0, 1] }).then(() => {
app.mpBehavior({ PageName: 'PG_PatientLiveList' })
this.getConfig(); this.getConfig()
app.getZdUserInfo(this, true); app.getZdUserInfo(this, true)
}); })
}, },
tabChange(e) { tabChange(e) {
this.setData({ this.setData({
active: e.detail.index, active: e.detail.index,
LNG: '', LNG: '',
LAT: '', LAT: '',
}); })
if (e.detail.index == 0) { if (e.detail.index == 0) {
} else if (e.detail.index == 1) { } else if (e.detail.index == 1) {
} }
this.getList(); this.getList()
}, },
getConfig() { getConfig() {
wx.ajax({ wx.ajax({
@ -73,18 +71,18 @@ Page({
url: '?r=zd/common/get-config', url: '?r=zd/common/get-config',
data: {}, data: {},
}).then((res) => { }).then((res) => {
let active = this.data.active; let active = this.data.active
if (res.online_open_status == 0) { if (res.online_open_status == 0) {
active = 1; active = 1
} }
this.setData({ this.setData({
online_open_status: res.online_open_status, online_open_status: res.online_open_status,
offline_open_status: res.offline_open_status, offline_open_status: res.offline_open_status,
active, active,
}); })
this.getList(); this.getList()
this.getCateList(); this.getCateList()
}); })
}, },
getCateList() { getCateList() {
wx.ajax({ wx.ajax({
@ -94,20 +92,20 @@ Page({
}).then((res) => { }).then((res) => {
this.setData({ this.setData({
cateList: res, cateList: res,
}); })
}); })
}, },
handleClear() { handleClear() {
this.setData({ this.setData({
Search: '', Search: '',
}); })
this.handleSearch(); this.handleSearch()
}, },
handleSearch() { handleSearch() {
this.getList(); this.getList()
}, },
handleToggleSite() { handleToggleSite() {
const that = this; const that = this
if (!this.data.LNG) { if (!this.data.LNG) {
wx.getSetting({ wx.getSetting({
success(res) { success(res) {
@ -116,10 +114,10 @@ Page({
res.authSetting['scope.userFuzzyLocation'] == true res.authSetting['scope.userFuzzyLocation'] == true
) { ) {
//获取当前位置 //获取当前位置
that.getFuzzyLocation(); that.getFuzzyLocation()
} else if (res.authSetting['scope.userFuzzyLocation'] == undefined) { } else if (res.authSetting['scope.userFuzzyLocation'] == undefined) {
//获取当前位置 //获取当前位置
that.getFuzzyLocation(); that.getFuzzyLocation()
} else { } else {
wx.showModal({ wx.showModal({
title: '请求授权当前位置', title: '请求授权当前位置',
@ -132,7 +130,7 @@ Page({
title: '拒绝授权', title: '拒绝授权',
icon: 'none', icon: 'none',
duration: 1000, duration: 1000,
}); })
} else if (res.confirm) { } else if (res.confirm) {
//确定授权,通过wx.openSetting发起授权请求 //确定授权,通过wx.openSetting发起授权请求
wx.openSetting({ wx.openSetting({
@ -144,7 +142,7 @@ Page({
// duration: 1000 // duration: 1000
// }) // })
//再次授权,调用wx.getLocation的API //再次授权,调用wx.getLocation的API
that.getFuzzyLocation(); that.getFuzzyLocation()
} else { } else {
// wx.showToast({ // wx.showToast({
// title: '授权失败', // title: '授权失败',
@ -153,46 +151,46 @@ Page({
// }) // })
} }
}, },
}); })
} }
}, },
}); })
} }
}, },
}); })
} else { } else {
that.setData({ that.setData({
LNG: '', LNG: '',
LAT: '', LAT: '',
}); })
that.getList(); that.getList()
} }
}, },
getFuzzyLocation() { getFuzzyLocation() {
const that = this; const that = this
wx.getFuzzyLocation({ wx.getFuzzyLocation({
success(res) { success(res) {
that.setData({ that.setData({
LNG: res.longitude, LNG: res.longitude,
LAT: res.latitude, LAT: res.latitude,
}); })
that.getList(); that.getList()
}, },
fail(err) { fail(err) {
console.log(err); console.log(err)
}, },
}); })
}, },
handleCate(e: WechatMiniprogram.CustomEvent) { handleCate(e: WechatMiniprogram.CustomEvent) {
const { id } = e.currentTarget.dataset; const { id } = e.currentTarget.dataset
this.setData({ this.setData({
CateId: id, CateId: id,
}); })
this.getList(); this.getList()
}, },
getList(newPage = 1) { getList(newPage = 1) {
const { active } = this.data; const { active } = this.data
const { CateId, Search, LNG, LAT } = this.data; const { CateId, Search, LNG, LAT } = this.data
wx.ajax({ wx.ajax({
method: 'GET', method: 'GET',
url: '?r=zd/activity/list', url: '?r=zd/activity/list',
@ -206,19 +204,19 @@ Page({
}, },
}).then((res) => { }).then((res) => {
res.list = res.list.map((item) => { res.list = res.list.map((item) => {
item.EndTimeValue = dayjs(item.EndTime).valueOf(); item.EndTimeValue = dayjs(item.EndTime).valueOf()
item.BeginTimeValue = dayjs(item.BeginTime).valueOf(); item.BeginTimeValue = dayjs(item.BeginTime).valueOf()
item.SignUpDeadlineValue = dayjs(item.SignUpDeadline).valueOf(); item.SignUpDeadlineValue = dayjs(item.SignUpDeadline).valueOf()
item.BeginDate = dayjs(item.BeginTime).format('YYYY-MM-DD'); item.BeginDate = dayjs(item.BeginTime).format('YYYY-MM-DD')
item.EndDate = dayjs(item.EndTime).format('YYYY-MM-DD'); item.EndDate = dayjs(item.EndTime).format('YYYY-MM-DD')
item.isDay = item.BeginDate == item.EndDate; item.isDay = item.BeginDate == item.EndDate
item.BeginHm = dayjs(item.BeginTime).format('HH:mm'); item.BeginHm = dayjs(item.BeginTime).format('HH:mm')
item.EndHm = dayjs(item.EndTime).format('HH:mm'); item.EndHm = dayjs(item.EndTime).format('HH:mm')
item.BeginTime = dayjs(item.BeginTime).format('YYYY-MM-DD HH:mm'); item.BeginTime = dayjs(item.BeginTime).format('YYYY-MM-DD HH:mm')
item.EndTime = dayjs(item.EndTime).format('YYYY-MM-DD HH:mm'); item.EndTime = dayjs(item.EndTime).format('YYYY-MM-DD HH:mm')
return item; return item
}); })
const list = res.page == 1 ? res.list : [...this.data.list, ...res.list]; const list = res.page == 1 ? res.list : [...this.data.list, ...res.list]
this.setData({ this.setData({
list, list,
pagination: { pagination: {
@ -226,30 +224,29 @@ Page({
pages: res.pages, pages: res.pages,
count: res.count, count: res.count,
}, },
}); })
}); })
}, },
handleDetail(e) { handleDetail(e) {
const { id } = e.currentTarget.dataset; app.mpBehavior({ PageName: 'BTN_PatientLiveList' })
const { id } = e.currentTarget.dataset
if (this.data.active == 0) { if (this.data.active == 0) {
} else if (this.data.active == 1) { } else if (this.data.active == 1) {
} }
wx.navigateTo({ wx.navigateTo({
url: `/patient/pages/liveDetail/index?id=${id}`, url: `/patient/pages/liveDetail/index?id=${id}`,
}); })
}, },
onReachBottom() { onReachBottom() {
const { page, pages } = this.data.pagination; const { page, pages } = this.data.pagination
if (pages > page) { if (pages > page) {
this.getList(page + 1); this.getList(page + 1)
} }
}, },
onShareAppMessage() { onShareAppMessage() {
return { return {
title: '周三大咖说', title: '周三大咖说',
path: 'pages/live/index', path: 'pages/live/index',
}; }
}, },
}); })

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

@ -31,7 +31,8 @@ Page({
}, 1000) }, 1000)
}, },
onShow() { onShow() {
app.zdWaitLogin({ isReg: false }).then(() => { app.waitLogin({ type: [0, 1] }).then(() => {
app.mpBehavior({ PageName: 'PG_PatientLiveDetails' })
this.getDetail() this.getDetail()
this.setView() this.setView()
app.getZdUserInfo(this, true, () => { app.getZdUserInfo(this, true, () => {
@ -80,12 +81,10 @@ Page({
this.videoContext = wx.createVideoContext('video') this.videoContext = wx.createVideoContext('video')
} }
if (res.Type == 1) { if (res.Type == 1) {
wx.setNavigationBarTitle({ wx.setNavigationBarTitle({
title: '会议详情', title: '会议详情',
}) })
} else { } else {
wx.setNavigationBarTitle({ wx.setNavigationBarTitle({
title: '活动详情', title: '活动详情',
}) })
@ -108,7 +107,7 @@ Page({
}) })
}, },
handleReplay() { handleReplay() {
app.mpBehavior({ PageName: 'BTN_PatientLiveReview' })
this.videoContext.requestFullScreen({}) this.videoContext.requestFullScreen({})
this.videoContext.seek(0) this.videoContext.seek(0)
this.videoContext.play() this.videoContext.play()
@ -118,6 +117,7 @@ Page({
}, },
handleLive() { handleLive() {
const { Type } = this.data.detail const { Type } = this.data.detail
app.mpBehavior({ PageName: 'BTN_PatientLiveEnter' })
app app
.zdPermissionVerification( .zdPermissionVerification(
3, 3,
@ -147,15 +147,10 @@ Page({
}) })
}, },
handleSignUp() { handleSignUp() {
app.mpBehavior({ PageName: 'BTN_PatientLiveSign' })
const { Type } = this.data.detail const { Type } = this.data.detail
const { UserType } = this.data.zdUserInfo const { UserType } = this.data.zdUserInfo
if (Type == 1) {
} else if (Type == 2) {
}
wx.ajax({ wx.ajax({
method: 'POST', method: 'POST',
url: '?r=zd/activity/sign-up', url: '?r=zd/activity/sign-up',

9
src/patient/pages/login/index.ts

@ -17,7 +17,7 @@ Page({
page: options.page, page: options.page,
}) })
app.waitLogin().then(() => { app.waitLogin().then(() => {
app.mpBehavior({ PageName: 'PG_PatientLogin' })
}) })
}, },
getCode() { getCode() {
@ -66,7 +66,6 @@ Page({
}) })
}, },
handleSubmit() { handleSubmit() {
const { mobile, code } = this.data const { mobile, code } = this.data
const { registrationSource, registChannel, regBusinessId } = app.globalData const { registrationSource, registChannel, regBusinessId } = app.globalData
wx.ajax({ wx.ajax({
@ -84,7 +83,7 @@ Page({
}) })
}, },
handleWxSubmit(e: WechatMiniprogram.CustomEvent) { handleWxSubmit(e: WechatMiniprogram.CustomEvent) {
app.mpBehavior({ PageName: 'BTN_PatientQuickLogin' })
const { iv, encryptedData } = e.detail const { iv, encryptedData } = e.detail
const { registrationSource, registChannel, regBusinessId } = app.globalData const { registrationSource, registChannel, regBusinessId } = app.globalData
if (iv && encryptedData) { if (iv && encryptedData) {
@ -104,6 +103,7 @@ Page({
} }
}, },
handleWxCheck() { handleWxCheck() {
app.mpBehavior({ PageName: 'BTN_PatientQuickLogin' })
wx.showToast({ wx.showToast({
icon: 'none', icon: 'none',
title: '请先同意隐私政策', title: '请先同意隐私政策',
@ -129,7 +129,7 @@ Page({
}) })
}, },
handleVisitors() { handleVisitors() {
app.mpBehavior({ PageName: 'BTN_PatientLookAround' })
wx.reLaunch({ wx.reLaunch({
url: '/patient/pages/index/index', url: '/patient/pages/index/index',
}) })
@ -146,6 +146,7 @@ Page({
}) })
}, },
handleCheck(e: any) { handleCheck(e: any) {
app.mpBehavior({ PageName: 'BTN_PatientPrivacyAgree' })
const { key } = e.currentTarget.dataset const { key } = e.currentTarget.dataset
this.setData({ this.setData({
[key]: !this.data[key], [key]: !this.data[key],

12
src/patient/pages/my/index.ts

@ -32,7 +32,7 @@ Page({
}, },
onShow() { onShow() {
app.zdWaitLogin().then(() => { app.zdWaitLogin().then(() => {
app.mpBehavior({ PageName: 'PG_PatientPersonalCenter' })
app.getZdUserInfo(this, true, () => {}) app.getZdUserInfo(this, true, () => {})
this.getScore() this.getScore()
}) })
@ -49,7 +49,6 @@ Page({
}) })
}, },
handleMyHealthRecord(e) { handleMyHealthRecord(e) {
const { url } = e.currentTarget.dataset const { url } = e.currentTarget.dataset
app.zdPermissionVerification(3, 0, url).then(() => { app.zdPermissionVerification(3, 0, url).then(() => {
wx.navigateTo({ wx.navigateTo({
@ -58,7 +57,6 @@ Page({
}) })
}, },
handleFamily(e) { handleFamily(e) {
const { url } = e.currentTarget.dataset const { url } = e.currentTarget.dataset
app.zdPermissionVerification(3, 0, url).then(() => { app.zdPermissionVerification(3, 0, url).then(() => {
wx.navigateTo({ wx.navigateTo({
@ -68,7 +66,6 @@ Page({
}, },
handleAdlChaneg(e) { handleAdlChaneg(e) {
if (!e.detail) { if (!e.detail) {
} }
wx.ajax({ wx.ajax({
method: 'POST', method: 'POST',
@ -89,16 +86,15 @@ Page({
}) })
} }
if (url === '/patient/pages/mySave/index') { if (url === '/patient/pages/mySave/index') {
app.mpBehavior({ PageName: 'BTN_PatientPersonalCenterFavorites' })
} }
if (url === '/patient/pages/myLive/index') { if (url === '/patient/pages/myLive/index') {
app.mpBehavior({ PageName: 'BTN_PatientPersonalCenterLives' })
} }
if (url === '/patient/pages/personalInformation/index') { if (url === '/patient/pages/personalInformation/index') {
app.mpBehavior({ PageName: 'BTN_PatientPersonalCenterInfo' })
} }
if (url === '/patient/pages/storyList/index') { if (url === '/patient/pages/storyList/index') {
} }
wx.navigateTo({ wx.navigateTo({
url, url,

20
src/patient/pages/myLive/index.ts

@ -30,6 +30,7 @@ Page({
}) })
}, 1000) }, 1000)
app.waitLogin({ type: [1] }).then(() => { app.waitLogin({ type: [1] }).then(() => {
app.mpBehavior({ PageName: 'PG_PatientPersonalLives' })
this.getConfig() this.getConfig()
app.getZdUserInfo(this, true) app.getZdUserInfo(this, true)
}) })
@ -54,15 +55,6 @@ Page({
}, },
getList(newPage = 1) { getList(newPage = 1) {
const { active } = this.data const { active } = this.data
if (newPage == 1 && active == 0) {
}
if (newPage == 1 && active == 1) {
}
if (newPage == 1 && active == 2) {
}
wx.ajax({ wx.ajax({
method: 'GET', method: 'GET',
url: '?r=zd/activity/sign-up-list', url: '?r=zd/activity/sign-up-list',
@ -102,17 +94,9 @@ Page({
this.getList() this.getList()
}, },
handleDetail(e) { handleDetail(e) {
app.mpBehavior({ PageName: 'BTN_PatientPersonalLives' })
const { id } = e.currentTarget.dataset const { id } = e.currentTarget.dataset
const { active } = this.data const { active } = this.data
if (active == 0) {
}
if (active == 1) {
}
if (active == 2) {
}
wx.navigateTo({ wx.navigateTo({
url: `/patient/pages/liveDetail/index?id=${id}`, url: `/patient/pages/liveDetail/index?id=${id}`,
}) })

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

@ -31,7 +31,7 @@
> >
<view class="btn active" wx:if="{{item.SignUpStatus==1}}">审核中</view> <view class="btn active" wx:if="{{item.SignUpStatus==1}}">审核中</view>
<block wx:elif="{{item.SignUpStatus==2}}"> <block wx:elif="{{item.SignUpStatus==2}}">
<view class="btn" wx:if="{{item.BeginTimeValue * 1 < dateValue * 1}}">参会</view> <view class="btn" wx:if="{{item.BeginTimeValue * 1 < dateValue * 1}}">点此参加</view>
<view class="btn active" wx:else>已报名</view> <view class="btn active" wx:else>已报名</view>
</block> </block>
<block wx:elif="{{item.SignUpStatus==3}}"> <block wx:elif="{{item.SignUpStatus==3}}">

1
src/patient/pages/mySave/index.ts

@ -18,6 +18,7 @@ Page({
}, },
onShow() { onShow() {
app.waitLogin({ type: [0, 1] }).then(() => { app.waitLogin({ type: [0, 1] }).then(() => {
app.mpBehavior({ PageName: 'PG_PatientPersonalFavorites' })
wx.ajax({ wx.ajax({
method: 'GET', method: 'GET',
url: '?r=zd/common/get-config', url: '?r=zd/common/get-config',

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

@ -66,7 +66,7 @@ Page({
}) })
app.waitLogin({ type: [1] }).then(() => { app.waitLogin({ type: [1] }).then(() => {
app.mpBehavior({ PageName: 'PG_PatientPersonalInfo' })
const that = this const that = this
app.getZdUserInfo(that, true, that.formatUserInfo.bind(that)) app.getZdUserInfo(that, true, that.formatUserInfo.bind(that))
this.getDict() this.getDict()
@ -247,7 +247,6 @@ Page({
}, },
handleChangeTel() { handleChangeTel() {
wx.navigateTo({ wx.navigateTo({
url: '/patient/pages/changePhone/index', url: '/patient/pages/changePhone/index',
}) })
@ -258,7 +257,7 @@ Page({
}) })
}, },
handleLogout() { handleLogout() {
app.mpBehavior({ PageName: 'BTN_PatientPersonalInfoCancel' })
wx.navigateTo({ wx.navigateTo({
url: '/patient/pages/cancellation/index', url: '/patient/pages/cancellation/index',
}) })
@ -268,8 +267,8 @@ Page({
}, },
routerTo(e) { routerTo(e) {
const { url } = e.currentTarget.dataset const { url } = e.currentTarget.dataset
if (url.includes('/doctor/patient/pages/d_login/index')) { if (url.includes('/pages/login/index')) {
app.mpBehavior({ PageName: 'BTN_PatientPersonalInfoChangeDoctor' })
} }
wx.navigateTo({ wx.navigateTo({
url, url,

213
src/patient/pages/repository/index.ts

@ -1,5 +1,5 @@
const app = getApp<IAppOption>(); const app = getApp<IAppOption>()
const licia = require('miniprogram-licia'); const licia = require('miniprogram-licia')
Page({ Page({
data: { data: {
@ -22,43 +22,42 @@ Page({
app.zdGetTheme().then((res) => { app.zdGetTheme().then((res) => {
this.setData({ this.setData({
theme: res, theme: res,
}); })
}); })
app.waitLogin({ type: [0,1] }).then(() => { app.waitLogin({ type: [0, 1] }).then(() => {
this.getConfig(options); app.mpBehavior({ PageName: 'PG_PatientContentList' })
this.getBanner(); this.getConfig(options)
app.getZdUserInfo(this, true); this.getBanner()
}); app.getZdUserInfo(this, true)
}, })
onShow() { },
onShow() {},
},
getConfig(options: any) { getConfig(options: any) {
wx.ajax({ wx.ajax({
method: 'GET', method: 'GET',
url: '?r=zd/common/get-config', url: '?r=zd/common/get-config',
data: {}, data: {},
}).then((res) => { }).then((res) => {
let active = Number(options.active) || 0; let active = Number(options.active) || 0
let search = options.title || ''; let search = options.title || ''
if (active == 1 && res.videoStatus == 0) { if (active == 1 && res.videoStatus == 0) {
active = 0; active = 0
search = ''; search = ''
} }
if (res.picTextStatus == 0) { if (res.picTextStatus == 0) {
active = 1; active = 1
search = ''; search = ''
} }
this.setData({ this.setData({
picTextStatus: res.picTextStatus, picTextStatus: res.picTextStatus,
videoStatus: res.videoStatus, videoStatus: res.videoStatus,
active, active,
Search: search, Search: search,
}); })
this.getList(); this.getList()
this.getInfoCateList(); this.getInfoCateList()
this.getVideoCateList(); this.getVideoCateList()
}); })
}, },
getBanner() { getBanner() {
wx.ajax({ wx.ajax({
@ -68,8 +67,8 @@ Page({
}).then((res) => { }).then((res) => {
this.setData({ this.setData({
banner: res, banner: res,
}); })
}); })
}, },
tabChange(e) { tabChange(e) {
this.setData({ this.setData({
@ -82,24 +81,24 @@ Page({
pages: 1, pages: 1,
count: 1, count: 1,
}, },
}); })
this.getList(); this.getList()
}, },
handleClear() { handleClear() {
this.setData({ this.setData({
Search: '', Search: '',
}); })
this.handleSearch(); this.handleSearch()
}, },
handleSearch() { handleSearch() {
this.getList(); this.getList()
}, },
getList() { getList() {
const { active } = this.data; const { active } = this.data
if (active == 0) { if (active == 0) {
this.getInfoList(); this.getInfoList()
} else { } else {
this.getVideoList(); this.getVideoList()
} }
}, },
getInfoCateList() { getInfoCateList() {
@ -110,8 +109,8 @@ Page({
}).then((res) => { }).then((res) => {
this.setData({ this.setData({
infoCateList: res, infoCateList: res,
}); })
}); })
}, },
getVideoCateList() { getVideoCateList() {
wx.ajax({ wx.ajax({
@ -121,11 +120,11 @@ Page({
}).then((res) => { }).then((res) => {
this.setData({ this.setData({
videoCateList: res, videoCateList: res,
}); })
}); })
}, },
getInfoList(newPage = 1) { getInfoList(newPage = 1) {
const { CateId, Search } = this.data; const { CateId, Search } = this.data
wx.ajax({ wx.ajax({
method: 'GET', method: 'GET',
url: '?r=zd/pic-text/list', url: '?r=zd/pic-text/list',
@ -137,9 +136,9 @@ Page({
loading: true, loading: true,
}).then((res) => { }).then((res) => {
res.list = res.list.map((item) => { res.list = res.list.map((item) => {
return item; return item
}); })
const list = res.page == 1 ? res.list : [...this.data.list, ...res.list]; const list = res.page == 1 ? res.list : [...this.data.list, ...res.list]
this.setData({ this.setData({
list, list,
pagination: { pagination: {
@ -147,11 +146,11 @@ Page({
pages: res.pages, pages: res.pages,
count: res.count, count: res.count,
}, },
}); })
}); })
}, },
getVideoList(newPage = 1) { getVideoList(newPage = 1) {
const { CateId, Search } = this.data; const { CateId, Search } = this.data
wx.ajax({ wx.ajax({
method: 'GET', method: 'GET',
url: '?r=zd/video/list', url: '?r=zd/video/list',
@ -163,9 +162,9 @@ Page({
loading: true, loading: true,
}).then((res) => { }).then((res) => {
res.list = res.list.map((item) => { res.list = res.list.map((item) => {
return item; return item
}); })
const list = res.page == 1 ? res.list : [...this.data.list, ...res.list]; const list = res.page == 1 ? res.list : [...this.data.list, ...res.list]
this.setData({ this.setData({
list, list,
pagination: { pagination: {
@ -173,11 +172,11 @@ Page({
pages: res.pages, pages: res.pages,
count: res.count, count: res.count,
}, },
}); })
}); })
}, },
handleStar(e) { handleStar(e) {
const { id, index } = e.currentTarget.dataset; const { id, index } = e.currentTarget.dataset
wx.ajax({ wx.ajax({
method: 'POST', method: 'POST',
url: '?r=zd/pic-text/compliment', url: '?r=zd/pic-text/compliment',
@ -189,11 +188,11 @@ Page({
this.setData({ this.setData({
[`list[${index}].IsCompliment`]: 1, [`list[${index}].IsCompliment`]: 1,
[`list[${index}].ComplimentNum`]: Number(this.data.list[index].ComplimentNum) + 1, [`list[${index}].ComplimentNum`]: Number(this.data.list[index].ComplimentNum) + 1,
}); })
}); })
}, },
handleVideoStar(e: WechatMiniprogram.CustomEvent) { handleVideoStar(e: WechatMiniprogram.CustomEvent) {
const { id, index } = e.currentTarget.dataset; const { id, index } = e.currentTarget.dataset
wx.ajax({ wx.ajax({
method: 'POST', method: 'POST',
url: '?r=zd/video/compliment', url: '?r=zd/video/compliment',
@ -204,24 +203,24 @@ Page({
this.setData({ this.setData({
[`list[${index}].ComplimentNum`]: Number(this.data.list[index].ComplimentNum) + 1, [`list[${index}].ComplimentNum`]: Number(this.data.list[index].ComplimentNum) + 1,
[`list[${index}].IsCompliment`]: 1, [`list[${index}].IsCompliment`]: 1,
}); })
}); })
}, },
handleVideoPlay(e: WechatMiniprogram.CustomEvent) { handleVideoPlay(e: WechatMiniprogram.CustomEvent) {
const { id, index } = e.currentTarget.dataset; const { id, index } = e.currentTarget.dataset
const { list } = this.data; const { list } = this.data
list.map((item: any, i) => { list.map((item: any, i) => {
if (item.play && i != index) { if (item.play && i != index) {
const ctx = wx.createVideoContext(`video${i}`); const ctx = wx.createVideoContext(`video${i}`)
ctx.pause(); ctx.pause()
this.setData({ this.setData({
[`list[${index}].play`]: false, [`list[${index}].play`]: false,
}); })
} }
}); })
this.setData({ this.setData({
[`list[${index}].play`]: true, [`list[${index}].play`]: true,
}); })
wx.ajax({ wx.ajax({
method: 'POST', method: 'POST',
url: '?r=zd/video/view', url: '?r=zd/video/view',
@ -231,13 +230,13 @@ Page({
}).then((res) => { }).then((res) => {
this.setData({ this.setData({
HistoryId: res.HistoryId, HistoryId: res.HistoryId,
}); })
}); })
}, },
handleVideo(e: WechatMiniprogram.CustomEvent) { handleVideo(e: WechatMiniprogram.CustomEvent) {
const { index } = e.currentTarget.dataset; const { index } = e.currentTarget.dataset
const context = wx.createVideoContext(`video${index}`); const context = wx.createVideoContext(`video${index}`)
context.play(); context.play()
}, },
handleVideoTime: licia.throttle(function (e: WechatMiniprogram.CustomEvent) { handleVideoTime: licia.throttle(function (e: WechatMiniprogram.CustomEvent) {
wx.ajax({ wx.ajax({
@ -248,30 +247,30 @@ Page({
WatchDuration: e.detail.currentTime, WatchDuration: e.detail.currentTime,
}, },
}).then((res) => { }).then((res) => {
console.log('res: ', res); console.log('res: ', res)
}); })
}, 5000), }, 5000),
handleVideoPause(e: WechatMiniprogram.CustomEvent) { handleVideoPause(e: WechatMiniprogram.CustomEvent) {
console.log(e); console.log(e)
}, },
handleCate(e: WechatMiniprogram.CustomEvent) { handleCate(e: WechatMiniprogram.CustomEvent) {
const { id } = e.currentTarget.dataset; const { id } = e.currentTarget.dataset
this.setData({ this.setData({
CateId: id, CateId: id,
}); })
this.getList(); this.getList()
}, },
handleDetail(e: WechatMiniprogram.CustomEvent) { handleDetail(e: WechatMiniprogram.CustomEvent) {
app.mpBehavior({ PageName: 'BTN_PatientContentList' })
const { id } = e.currentTarget.dataset; const { id } = e.currentTarget.dataset
wx.navigateTo({ wx.navigateTo({
url: `/patient/pages/repositoryDetail/index?id=${id}`, url: `/patient/pages/repositoryDetail/index?id=${id}`,
}); })
}, },
handleVideoToggleSave(e: WechatMiniprogram.CustomEvent) { handleVideoToggleSave(e: WechatMiniprogram.CustomEvent) {
const { id, collect, index } = e.currentTarget.dataset; const { id, collect, index } = e.currentTarget.dataset
const { list } = this.data; const { list } = this.data
const title = list[index].Title; const title = list[index].Title
app.zdPermissionVerification(3, 4, `/patient/pages/repository/index?active=1&title=${title}`, id).then(() => { app.zdPermissionVerification(3, 4, `/patient/pages/repository/index?active=1&title=${title}`, id).then(() => {
if (collect == 1) { if (collect == 1) {
wx.ajax({ wx.ajax({
@ -285,12 +284,12 @@ Page({
wx.showToast({ wx.showToast({
title: '取消收藏', title: '取消收藏',
icon: 'none', icon: 'none',
}); })
this.setData({ this.setData({
[`list[${index}].IsCollect`]: 0, [`list[${index}].IsCollect`]: 0,
[`list[${index}].CollectionPeopleNum`]: Number(this.data.list[index].CollectionPeopleNum) - 1, [`list[${index}].CollectionPeopleNum`]: Number(this.data.list[index].CollectionPeopleNum) - 1,
}); })
}); })
} else { } else {
wx.ajax({ wx.ajax({
method: 'POST', method: 'POST',
@ -303,43 +302,43 @@ Page({
wx.showToast({ wx.showToast({
title: '收藏成功', title: '收藏成功',
icon: 'none', icon: 'none',
}); })
this.setData({ this.setData({
[`list[${index}].IsCollect`]: 1, [`list[${index}].IsCollect`]: 1,
[`list[${index}].CollectionPeopleNum`]: Number(this.data.list[index].CollectionPeopleNum) + 1, [`list[${index}].CollectionPeopleNum`]: Number(this.data.list[index].CollectionPeopleNum) + 1,
}); })
}); })
} }
}); })
}, },
onReachBottom() { onReachBottom() {
const { page, pages } = this.data.pagination; const { page, pages } = this.data.pagination
const { active } = this.data; const { active } = this.data
if (pages > page) { if (pages > page) {
if (active == 0) { if (active == 0) {
this.getInfoList(page + 1); this.getInfoList(page + 1)
} else { } else {
this.getVideoList(page + 1); this.getVideoList(page + 1)
} }
} }
}, },
routerTo(e: any) { routerTo(e: any) {
const { path } = e.currentTarget.dataset; const { path } = e.currentTarget.dataset
if (!path) return; if (!path) return
wx.navigateTo({ wx.navigateTo({
url: path, url: path,
fail() { fail() {
wx.switchTab({ wx.switchTab({
url: path, url: path,
}); })
}, },
}); })
}, },
onShareAppMessage(e: any) { onShareAppMessage(e: any) {
if (e.from === 'button') { if (e.from === 'button') {
const { id, index, type } = e.target.dataset; const { id, index, type } = e.target.dataset
const { list } = this.data; const { list } = this.data
const { Title, TitlePicLink, ImageUrl } = list[index]; const { Title, TitlePicLink, ImageUrl } = list[index]
if (type == 'info') { if (type == 'info') {
wx.ajax({ wx.ajax({
method: 'POST', method: 'POST',
@ -348,13 +347,13 @@ Page({
}).then(() => { }).then(() => {
this.setData({ this.setData({
[`list[${index}].ShareNum`]: Number(this.data.list[index].ShareNum) + 1, [`list[${index}].ShareNum`]: Number(this.data.list[index].ShareNum) + 1,
}); })
}); })
return { return {
title: Title, title: Title,
path: `/patient/pages/repositoryDetail/index?id=${id}`, path: `/patient/pages/repositoryDetail/index?id=${id}`,
imageUrl: TitlePicLink, imageUrl: TitlePicLink,
}; }
} else { } else {
wx.ajax({ wx.ajax({
method: 'POST', method: 'POST',
@ -363,21 +362,21 @@ Page({
}).then(() => { }).then(() => {
this.setData({ this.setData({
[`list[${index}].ShareNum`]: Number(this.data.list[index].ShareNum) + 1, [`list[${index}].ShareNum`]: Number(this.data.list[index].ShareNum) + 1,
}); })
}); })
return { return {
title: Title, title: Title,
path: `/patient/pages/repository/index?id=${id}&active=1&title=${Title}`, path: `/patient/pages/repository/index?id=${id}&active=1&title=${Title}`,
imageUrl: ImageUrl, imageUrl: ImageUrl,
}; }
} }
} else { } else {
return { return {
title: '重症肌无力加油站,MG全知道', title: '重症肌无力加油站,MG全知道',
path: '/patient/pages/repository/index', path: '/patient/pages/repository/index',
}; }
} }
}, },
}); })
export {}; export {}

7
src/patient/pages/repositoryDetail/index.ts

@ -34,11 +34,11 @@ Page({
id, id,
}) })
app.waitLogin({ type: [0, 1] }).then(() => { app.waitLogin({ type: [0, 1] }).then(() => {
app.mpBehavior({ PageName: 'PG_PatientContentDetails' })
this.getDetail(true) this.getDetail(true)
}) })
}, },
onShow() { onShow() {
if (this.data.sendShare) { if (this.data.sendShare) {
this.setData({ this.setData({
sendShare: false, sendShare: false,
@ -148,7 +148,6 @@ Page({
this.getDetail(true) this.getDetail(true)
}, },
handleStar() { handleStar() {
this.setData({ this.setData({
starShow: true, starShow: true,
}) })
@ -180,7 +179,7 @@ Page({
}) })
}, },
handleToggleSave() { handleToggleSave() {
app.mpBehavior({ PageName: 'BTN_PatientContentFavorite' })
const { const {
id, id,
detail: { IsCollect }, detail: { IsCollect },
@ -297,7 +296,7 @@ Page({
} }
}, },
handleTapShare() { handleTapShare() {
app.mpBehavior({ PageName: 'BTN_PatientContentShare' })
}, },
}) })

Loading…
Cancel
Save