信达小程序
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.
 
 
 

85 lines
1.9 KiB

const app = getApp<IAppOption>()
Page({
data: {
list: [],
pagination: {
page: 1,
pages: 1,
count: 1,
},
zdUserInfo: {},
},
onLoad() {
const SystemInfo = app.globalSystemInfo
if (SystemInfo) {
const { bottom } = SystemInfo.capsulePosition
this.setData({
bottom,
})
}
},
onShow() {
app.zdWaitLogin().then((_res) => {
app.zdMpBehavior({ PageName: 'PG_PATIENTMYSTORIES' })
this.getList()
app.getZdUserInfo(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: `/patient/pages/storyDetail/index?id=${id}`,
})
},
routerTo(e) {
const { url } = e.currentTarget.dataset
if (url === '/patient/pages/storyGuide/index') {
app.zdMpBehavior({ PageName: 'BTN_PATIENTMYSTORIESCONTINUESUBMIT' })
}
wx.navigateTo({
url,
})
},
handleBack() {
wx.navigateBack({
fail() {
wx.reLaunch({
url: '/patient/pages/index/index',
})
},
})
},
})