From 4b48bacef8646cee8b66f5e10b0ed7124534e93e Mon Sep 17 00:00:00 2001
From: odc.xiaohui <xiaohui@Q1>
Date: 星期五, 12 五月 2023 17:10:47 +0800
Subject: [PATCH] 首页修改
---
miniprogram/pages/user/report/submitReport/index.ts | 100 ++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 81 insertions(+), 19 deletions(-)
diff --git a/miniprogram/pages/user/report/submitReport/index.ts b/miniprogram/pages/user/report/submitReport/index.ts
index 78ef684..5eb26a5 100644
--- a/miniprogram/pages/user/report/submitReport/index.ts
+++ b/miniprogram/pages/user/report/submitReport/index.ts
@@ -4,6 +4,7 @@
import { formatTime } from 'miniprogram/utils/util';
Page({
data: {
+ phoneDisab:true,
isInGroup:'',
remarks: '',
addFig:false,
@@ -38,6 +39,36 @@
],
sexId: 0
},
+ afterRadeDel(e){
+ console.log(e);
+ console.log(this.data.cardIdList);
+ let arr=this.data.cardIdList
+ arr.splice(e.detail.index,1)
+ this.setData({
+ cardIdList: arr
+ })
+ },
+ afterRadeDelFile(e){
+ let arr=this.data.fileImgList
+ arr.splice(e.detail.index,1)
+ this.setData({
+ fileImgList: arr
+ })
+ },
+ afterRadeDelTran(e){
+ let arr=this.data.transactionReceiptList
+ arr.splice(e.detail.index,1)
+ this.setData({
+ transactionReceiptList: arr
+ })
+ },
+ afterRadeDelOther(e){
+ let arr=this.data.otherList
+ arr.splice(e.detail.index,1)
+ this.setData({
+ otherList: arr
+ })
+ },
getrealName(e) {
this.setData({
realName: e.detail
@@ -51,6 +82,11 @@
getuserIdCard(e) {
this.setData({
userIdCard: e.detail
+ })
+ },
+ getuserPhone(e){
+ this.setData({
+ phone: e.detail
})
},
getLocation(e) {
@@ -89,14 +125,16 @@
formData: { user: 'test' },
success(res) {
// 涓婁紶瀹屾垚闇�瑕佹洿鏂� fileList
- const { fileImgList = [] } = that.data;
- const { transactionReceiptList = [] } = that.data;
- const { otherList = [] } = that.data;
- const { cardIdList = [] } = that.data;
+ const { fileImgList = [] } = that.data; //鍚堝悓
+ const { transactionReceiptList = [] } = that.data; // 浜ゆ槗鍑瘉
+ const { otherList = [] } = that.data; //鍏朵粬
+ const { cardIdList = [] } = that.data; //韬唤璇�
let result = JSON.parse(res.data)
if (that.data.beforList == 'a') {
cardIdList.push({ ...file, url: result.data });
that.setData({ cardIdList });
+ console.log(that.data.cardIdList);
+
} else if (that.data.beforList == 'b') {
fileImgList.push({ ...file, url: result.data });
that.setData({ fileImgList });
@@ -216,7 +254,7 @@
if (this.data.fileImgList.length != 0 || this.data.transactionReceiptList.length != 0 || this.data.otherList.length != 0) {
} else {
- Toast('鐩稿叧鍚堝悓锛屼氦鏄撳嚟璇侊紝鍏朵粬;蹇呭~涓�椤癸紒');
+ Toast('鐩稿叧鍚堝悓銆佷氦鏄撳嚟璇併�佸叾浠�;蹇呭~涓�椤癸紒');
return
}
this.data.materials = this.data.materials.substring(0, this.data.materials.length - 1);
@@ -230,10 +268,10 @@
this.data.reportDetail.reportMaterials = this.data.materials
this.data.reportDetail.userId = wx.getStorageSync('id')
this.data.reportDetail.cheatTime = this.data.cheatTime
- this.data.reportDetail.idCardMaterials = this.data.cardIdList.map(res => res.url).join(',')
- this.data.reportDetail.contractMaterials = this.data.fileImgList.map(res => res.url).join(',')
- this.data.reportDetail.transactionMaterials = this.data.transactionReceiptList.map(res => res.url).join(',')
- this.data.reportDetail.elseMaterials = this.data.otherList.map(res => res.url).join(',')
+ this.data.reportDetail.idCardMaterials =this.data.cardIdList.length>0? this.data.cardIdList.map(res => res.url).join(','):null
+ this.data.reportDetail.contractMaterials =this.data.fileImgList.length>0? this.data.fileImgList.map(res => res.url).join(','):null
+ this.data.reportDetail.transactionMaterials =this.data.transactionReceiptList.length>0? this.data.transactionReceiptList.map(res => res.url).join(','):null
+ this.data.reportDetail.elseMaterials =this.data.otherList.length>0? this.data.otherList.map(res => res.url).join(','):null;;
// if ( this.data.reportDetail.information==null|| this.data.reportDetail.reportDescription==null) {
// wx.showToast({
// icon: "none",
@@ -241,6 +279,22 @@
// })
// return
// }
+ if (wx.getStorageSync('role')==1) {
+ wx.request(
+ {
+ url: submitReport.globalData.url + "/wx/user/policeAddReport",
+ method: this.data.addFig?"PUT":"POST",
+ data: this.data.reportDetail,
+ header: {
+ 'token': wx.getStorageSync('token'),
+ 'content-type': 'application/json'
+ }, success: (res) => {
+ wx.reLaunch({
+ url: '../../report/index'
+ })
+ }
+ })
+ }else{
wx.request(
{
url: submitReport.globalData.url + "/wx/user/addReport",
@@ -255,12 +309,18 @@
})
}
})
+ }
+
},
onLoad:function(e) {
console.log(e);
-
let that = this
-
+ let role = wx.getStorageSync('role')
+ if (role==1) {
+ that.setData({
+ phoneDisab :false
+ })
+ }
let phone = wx.getStorageSync('phone')
that.setData({
phone: phone
@@ -356,39 +416,41 @@
sexId: arraySex.findIndex(val=>{return val.sex == form.sex}),
Location: form.location,
workingLocation: form.workingLocation,
- cardIdList: form.idCardMaterials.split(',').map(i => {
+ cardIdList:form.idCardMaterials? form.idCardMaterials.split(',').map(i => {
return {
thumb: that.imgComplete(i),
url: i,
type: "image",
size: 999999
}
- }),
- fileImgList: form.contractMaterials.split(',').map(i => {
+ }):[],
+ fileImgList:form.contractMaterials? form.contractMaterials.split(',').map(i => {
return {
thumb: that.imgComplete(i),
url: i,
type: "image",
size: 999999
}
- }),
- transactionReceiptList: form.transactionMaterials.split(',').map(i => {
+ }):[],
+ transactionReceiptList:form.transactionMaterials? form.transactionMaterials.split(',').map(i => {
return {
thumb: that.imgComplete(i),
url: i,
type: "image",
size: 999999
}
- }),
- otherList: form.elseMaterials.split(',').map(i => {
+ }):[],
+ otherList:form.elseMaterials? form.elseMaterials.split(',').map(i => {
return {
thumb: that.imgComplete(i),
url: i,
type: "image",
size: 999999
}
- })
+ }):[]
})
+ console.log(this.data.cardIdList);
+
}
})
--
Gitblit v1.8.0