设备巡检异常必填图片或描述
This commit is contained in:
parent
2f2c1a0398
commit
2feb321ba8
|
@ -31,7 +31,6 @@ Page({
|
|||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
radioChange: function (e) {
|
||||
console.log('radio发生change事件,携带value值为:', e.detail.value);
|
||||
this.setData({
|
||||
state: e.detail.value,
|
||||
});
|
||||
|
@ -315,6 +314,15 @@ submit:function(){
|
|||
}
|
||||
let data2 = that.data.itemscheck
|
||||
for(var i=0;i<that.data.itemscheck.length;i++){
|
||||
if (that.data.itemscheck[i].state == '异常待处理'){
|
||||
if (!that.data.itemscheck[i].img||!that.data.itemscheck[i].desc){
|
||||
wx.showToast({
|
||||
title: '存在异常项目没有描述或图片!',
|
||||
icon:'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
}
|
||||
if (that.data.itemscheck[i].state == '异常待处理' || that.data.itemscheck[i].state == '异常已处理'){
|
||||
data1.state = 0
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
"uploadWithSourceMap": true,
|
||||
"compileHotReLoad": false,
|
||||
"useMultiFrameRuntime": false,
|
||||
"useApiHook": false,
|
||||
"useApiHook": true,
|
||||
"babelSetting": {
|
||||
"ignore": [],
|
||||
"disablePlugins": [],
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
function request(url, method, data) {
|
||||
let promise = new Promise((resolve, reject) => {
|
||||
wx.showNavigationBarLoading();
|
||||
wx.request({
|
||||
url: getApp().globalData.host + url,
|
||||
method: method,
|
||||
data: data,
|
||||
header: {
|
||||
'content-type': 'application/json', // 默认值
|
||||
'Cookie': getApp().globalData.sessionId,
|
||||
},
|
||||
success: (res => {
|
||||
if (res.data.code == 1) {
|
||||
resolve(res.data);
|
||||
}else if(res.data.code == -1){
|
||||
getApp().onLaunch()
|
||||
wx.switchTab({
|
||||
url: '/pages/main/main',
|
||||
})
|
||||
}
|
||||
else {
|
||||
var msg = ''
|
||||
if(res.data){
|
||||
msg = res.data
|
||||
}
|
||||
wx.showToast({
|
||||
title: msg,
|
||||
icon: 'none',
|
||||
duration: 1000
|
||||
})
|
||||
}
|
||||
|
||||
}),
|
||||
fail: (res => {
|
||||
wx.showToast({
|
||||
title: '请求出错',
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
console.log(res)
|
||||
reject('网络出错');
|
||||
}),
|
||||
complete: function () {
|
||||
wx.hideNavigationBarLoading();
|
||||
}
|
||||
|
||||
})
|
||||
})
|
||||
return promise;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
request: request
|
||||
}
|
Loading…
Reference in New Issue