city-casereport/pages/caseDetail/caseDetail.js
2023-12-07 15:45:23 +08:00

79 lines
1.7 KiB
JavaScript

const app = getApp()
// var QQMapWX = require('../../lib/qqmap-wx-jssdk.js');
var bmap = require('../../lib/bmap-wx.js');
// pages/caseDetail/caseDetail.js
Page({
/**
* 页面的初始数据
*/
data: {
requestUrl: app.requestUrl,
token: '',
caseId: '',
caseDetail: {},
longitude: '',
latitude: '',
markers: [],
imageList: [],
scrollHeight: 0,
},
// 获取详情
getDetail: function () {
var self = this
app.restAjax.get(app.restAjax.path('{reqesutUrl}app/reportcase/getreportcase/' + self.data.caseId, [app.requestUrl]), {}, {
headers: {
token: self.data.token
}
}, function (code, data) {
var imgArr, handleArr
imgArr = data.casePhotos.split(',')
handleArr = data.handlePhotos.split(',')
var arr = [{ longitude: data.caseLongitude, latitude: data.caseLatitude, iconPath: '../../images/marker_red.png', width: '25px', height: '30px', id: 0 }]
self.setData({
markers: arr
});
self.setData({
caseDetail: data,
longitude: data.caseLongitude,
latitude: data.caseLatitude,
imageList: imgArr,
handleList: handleArr
})
});
},
// 查看流程
goProcess: function () {
var self = this
wx.navigateTo({
url: '../process/process?id=' + self.data.caseId,
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
var self = this
this.setData({
caseId: options.id
})
wx.getStorage({
key: 'token',
success: function (res) {
self.setData({
token: res.data
})
self.getDetail()
}
})
var BMap = new bmap.BMapWX({
ak: 'Zk732rbyjd327q7Zj9EOtRjUn2ED1GWK'
});
let screenHeight = wx.getSystemInfoSync().windowHeight;
this.setData({
scrollHeight: screenHeight - 75
})
},
})