city-casereport/pages/caseDetail/caseDetail.js
2021-03-20 10:59:52 +08:00

122 lines
2.3 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: []
},
// 获取详情
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
imgArr = data.casePhotos.split(',')
var arr = [{longitude: data.caseLongitude,latitude: data.caseLatitude,iconPath:'../../images/marker_red.png',width:'25px',height: '30px'}]
// varwxMarkerData = arr;
self.setData({
markers: arr
});
self.setData({
caseDetail: data,
longitude: data.caseLongitude,
latitude: data.caseLatitude,
imageList: imgArr
})
});
},
// 查看流程
goProcess: function () {
var self = this
wx.navigateTo({
url: '../process/process?id=' + self.data.caseId,
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
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'
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})