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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -31,7 +31,7 @@ @@ -31,7 +31,7 @@
>
<view class="btn active" wx:if="{{item.SignUpStatus==1}}">审核中</view>
<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>
</block>
<block wx:elif="{{item.SignUpStatus==3}}">

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

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

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

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

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

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

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

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

Loading…
Cancel
Save