This commit is contained in:
shilixia 2020-04-20 12:41:42 +08:00
parent d69c974eac
commit 0394028e34
3 changed files with 24 additions and 8 deletions

4
app.js
View File

@ -97,8 +97,8 @@ App({
perms:[], perms:[],
openid:null openid:null
}, },
//serverUrl: 'https://safeyun.ctcshe.com/', serverUrl: 'https://safeyun.ctcshe.com/',
serverUrl: 'http://127.0.0.1:8000/', // serverUrl: 'http://127.0.0.1:8000/',
//serverUrl: 'http://10.21.28.148:8000/', //serverUrl: 'http://10.21.28.148:8000/',
//serverUrl: 'http://192.168.0.103:8000/', //serverUrl: 'http://192.168.0.103:8000/',
//serverUrl:'http://10.0.11.195:8000/', //serverUrl:'http://10.0.11.195:8000/',

View File

@ -90,13 +90,18 @@ Page({
if (res.statusCode === 200) { if (res.statusCode === 200) {
var yhdata = res.data var yhdata = res.data
//格式化隐患信息 //格式化隐患信息
if(yhdata.yhtp!=null)
{
for (var i = 0; i < yhdata.yhtp.length; i++) { for (var i = 0; i < yhdata.yhtp.length; i++) {
yhdata.yhtp[i] = this.data.serverUrl + yhdata.yhtp[i]; yhdata.yhtp[i] = this.data.serverUrl + yhdata.yhtp[i];
} }
}
if(yhdata.yhtp!=null)
{
for (var i = 0; i < yhdata.zghtp.length; i++) { for (var i = 0; i < yhdata.zghtp.length; i++) {
yhdata.zghtp[i] = this.data.serverUrl + yhdata.zghtp[i]; yhdata.zghtp[i] = this.data.serverUrl + yhdata.zghtp[i];
} }
}
this.setData(yhdata) this.setData(yhdata)
} }
} }

View File

@ -87,17 +87,22 @@ Page({
filePath: that.data.yhtp1[x], filePath: that.data.yhtp1[x],
name: 'upfile', name: 'upfile',
success(res) { success(res) {
var obj = JSON.parse(res.data); var obj = JSON.parse(res.data);
that.data.yhtp1[x] = obj['filepath'] that.data.yhtp1[x] = obj['filepath']
x = x + 1 x = x + 1
if(x<y){ if(x<y){
that.upimg(x, y) that.upimg(x, y)
} }
else {
that.upimgs(0,that.data.zghtp1.length)
}
} }
}) })
} }
else {
that.upimgs(0,that.data.zghtp1.length)
}
}, },
deleteImages: function (e) { deleteImages: function (e) {
var that = this; var that = this;
@ -143,6 +148,7 @@ Page({
//上传图片 //上传图片
upimgs:function(x,y){ upimgs:function(x,y){
var that=this var that=this
console.log(y)
if(x<y){ if(x<y){
wx.uploadFile({ wx.uploadFile({
@ -157,14 +163,20 @@ Page({
var obj = JSON.parse(res.data); var obj = JSON.parse(res.data);
that.data.zghtp1[x] = obj['filepath'] that.data.zghtp1[x] = obj['filepath']
x = x + 1 x = x + 1
if(x<y){ if(x<y){
that.upimgs(x, y) that.upimgs(x, y)
} }
else {
that.addjob()
}
} }
}) })
} }
else {
that.addjob()
}
}, },
submit: function () { submit: function () {
@ -174,9 +186,8 @@ Page({
else { else {
this.upimg(0, this.data.yhtp1.length) this.upimg(0, this.data.yhtp1.length)
this.upimgs(0, this.data.zghtp1.length)
this.addjob()
} }
}, },
Tap1: function (x) { Tap1: function (x) {