You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
86 lines
1.9 KiB
86 lines
1.9 KiB
1 month ago
|
const app = getApp<IAppOption>()
|
||
|
|
||
|
Page({
|
||
|
data: {
|
||
|
list: [],
|
||
|
pagination: {
|
||
|
page: 1,
|
||
|
pages: 1,
|
||
|
count: 1,
|
||
|
},
|
||
|
userInfo: {},
|
||
|
},
|
||
|
onLoad() {
|
||
|
const SystemInfo = app.globalSystemInfo
|
||
|
if (SystemInfo) {
|
||
|
const { bottom } = SystemInfo.capsulePosition
|
||
|
this.setData({
|
||
|
bottom,
|
||
|
})
|
||
|
}
|
||
|
},
|
||
|
onShow() {
|
||
|
app.waitLogin().then((_res) => {
|
||
|
app.zdMpBehavior({ PageName: 'PG_PATIENTMYSTORIES' })
|
||
|
this.getList()
|
||
|
app.getUserInfo(this, true)
|
||
|
})
|
||
|
},
|
||
|
getList(newPage = 1) {
|
||
|
wx.ajax({
|
||
|
method: 'GET',
|
||
|
url: '?r=xd/story/submit-story-list',
|
||
|
data: {
|
||
|
page: newPage,
|
||
|
},
|
||
|
loading: true,
|
||
|
}).then((res) => {
|
||
|
res.list = res.list.map((item) => {
|
||
|
item.CreateTime = item.CreateTime.split(':').slice(0, 2).join(':')
|
||
|
item.StatusName = app.globalData.storyStatus[item.Status]
|
||
|
return item
|
||
|
})
|
||
|
const list = res.page == 1 ? res.list : [...this.data.list, ...res.list]
|
||
|
this.setData({
|
||
|
list,
|
||
|
pagination: {
|
||
|
page: res.page,
|
||
|
pages: res.pages,
|
||
|
count: res.count,
|
||
|
},
|
||
|
})
|
||
|
})
|
||
|
},
|
||
|
onReachBottom() {
|
||
|
const { page, pages } = this.data.pagination
|
||
|
if (pages > page) {
|
||
|
this.getList(page + 1)
|
||
|
}
|
||
|
},
|
||
|
handleDetail(e) {
|
||
|
app.zdMpBehavior({ PageName: 'BTN_PATIENTMYSTORIESLIST' })
|
||
|
const { id } = e.currentTarget.dataset
|
||
|
wx.navigateTo({
|
||
|
url: `/pages/storyDetail/index?id=${id}`,
|
||
|
})
|
||
|
},
|
||
|
routerTo(e) {
|
||
|
const { url } = e.currentTarget.dataset
|
||
|
if (url === '/pages/storyGuide/index') {
|
||
|
app.zdMpBehavior({ PageName: 'BTN_PATIENTMYSTORIESCONTINUESUBMIT' })
|
||
|
}
|
||
|
wx.navigateTo({
|
||
|
url,
|
||
|
})
|
||
|
},
|
||
|
handleBack() {
|
||
|
wx.navigateBack({
|
||
|
fail() {
|
||
|
wx.reLaunch({
|
||
|
url: '/pages/index/index',
|
||
|
})
|
||
|
},
|
||
|
})
|
||
|
},
|
||
|
})
|