aqyj/pages/checkjob/yanshou.js

151 lines
2.9 KiB
JavaScript

var util = require('../../utils/util.js')
// pages/observe/observedetail.js
Page({
/**
* 页面的初始数据
*/
data: {
serverUrl: getApp().globalData.serverUrl
},
submit: function (e) {
wx.request({
url: getApp().globalData.serverUrl + 'api/checkproject?a=yanshou&id=' + this.data.ysid,
header: {
'content-type': 'application/x-www-form-urlencoded', //
'Cookie': getApp().globalData.sessionId,
},
method: 'get',
success: res => {
if (res.statusCode === 200) {
wx.hideLoading();
wx.navigateBack()
}
}
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.getGcdetail(options.id);
this.setData({
ysid: options.id
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
lookimgPreview: function (e) {
var current = e.target.dataset.src
wx.previewImage({
current: current,
urls: this.data.lookimg
})
},
getGcdetail: function (id) {
wx.showLoading({
title: '加载中',
}),
wx.request({
url: this.data.serverUrl + 'api/checkproject?a=checkjobdetail&id=' + id,
header: {
'content-type': 'application/json', // 默认值
'Cookie': getApp().globalData.sessionId,
},
data: {
},
success: res => {
wx.hideLoading();
console.log(res.data);
if (res.statusCode === 200) {
var yhdata = res.data
//格式化隐患信息
if(yhdata.yhtp){
for (var i = 0; i < yhdata.yhtp.length; i++) {
yhdata.yhtp[i] = this.data.serverUrl + yhdata.yhtp[i];
}
}
if(yhdata.zghtp){
for (var i = 0; i < yhdata.zghtp.length; i++) {
yhdata.zghtp[i] = this.data.serverUrl + yhdata.zghtp[i];
}
}
this.setData(yhdata)
}
}
});
},
yhtpPreview: function (e) {
var current = e.target.dataset.src
wx.previewImage({
current: current,
urls: this.data.yhtp
})
},
zghtpPreview: function (e) {
var current = e.target.dataset.src
wx.previewImage({
current: current,
urls: this.data.zghtp
})
}
})