|
|
|
@ -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.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 {} |
|
|
|
|