127 lines
2.4 KiB
JavaScript
127 lines
2.4 KiB
JavaScript
// pages/caseList/caseList.js
|
|
const app = getApp()
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
page: {
|
|
page: 1,
|
|
rows: 1
|
|
},
|
|
baseUrl: app.baseUrls.caseUrl,
|
|
imgUrl: app.baseUrls.baseImgUrl,
|
|
caseList: []
|
|
},
|
|
getList: function () {
|
|
var self = this
|
|
app.restAjax.get(app.restAjax.path(app.apis.myCaseList, [app.baseUrls.caseTypeUrl]), self.data.page, {
|
|
headers: {
|
|
token: app.globalData.token
|
|
}
|
|
}, function (code, data) {
|
|
if (data.rows.length > 0) {
|
|
var arr = self.data.caseList
|
|
for (let i = 0; i < data.rows.length; i++) {
|
|
if (data.rows[i].reportPhotos) {
|
|
data.rows[i].reportPhotos = data.rows[i].reportPhotos.split(',')[0]
|
|
}
|
|
arr.push(data.rows[i])
|
|
}
|
|
|
|
self.setData({
|
|
caseList: arr
|
|
})
|
|
} else {
|
|
wx.showToast({
|
|
title: '暂无更多',
|
|
icon: 'none'
|
|
})
|
|
self.setData({
|
|
['page.page']: self.data.page.page - 1
|
|
})
|
|
}
|
|
|
|
console.log(data)
|
|
}, function (code, data) {
|
|
console.log(data)
|
|
})
|
|
},
|
|
goDetail: function (e) {
|
|
var id = e.currentTarget.dataset.id
|
|
wx.navigateTo({
|
|
url: '../caseHandle/caseHandle?reportId=' + id,
|
|
})
|
|
},
|
|
checkLog: function (e) {
|
|
var id = e.currentTarget.dataset.log
|
|
wx.navigateTo({
|
|
url: '../caseLog/caseLog?businessId=' + id,
|
|
})
|
|
},
|
|
doEvaluate: function (e) {
|
|
wx.navigateTo({
|
|
url: '../evaluate/evaluate?reportId=' + e.currentTarget.dataset.id,
|
|
})
|
|
},
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
this.getList()
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function () {
|
|
var self = this
|
|
this.setData({
|
|
['page.page']: self.data.page.page + 1
|
|
})
|
|
this.getList()
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage: function () {
|
|
|
|
}
|
|
}) |