// pages/progressQuery/progressQuery.js
|
const app = getApp();
|
var Validator = require("../../utils/validate.tools.js");
|
const verify = Validator.Validator;
|
Page({
|
|
/**
|
* 页面的初始数据
|
*/
|
data: {
|
array: ['请选择性别', '男', '女'],
|
nature: ['请选择举报性质', '涉黑涉恶违法犯罪行为', '涉黑涉恶违法犯罪保护伞', '其他'],
|
src: app.globalData.imgUrl + '/image/bg.jpg',
|
itemIcon: app.globalData.imgUrl + '/image/ceshi.jpg',
|
icon: app.globalData.imgUrl + '/image/fzl.svg',
|
user: app.globalData.imgUrl + '/image/user.svg',
|
yes: app.globalData.imgUrl + '/image/yes.svg',
|
add: app.globalData.imgUrl + '/image/add.svg',
|
del: app.globalData.imgUrl + '/image/del.svg',
|
banner: app.globalData.imgUrl + '/image/sgce_banner.png',
|
disabled: false,
|
disabled1: false,
|
id1: '',
|
id2: '',
|
evalList: {},
|
scanData: {},
|
peopleInfo: {},
|
ReplyLogs: [],
|
switch: true,
|
},
|
|
inputChange: function(e) {
|
var name = e.currentTarget.dataset.name;
|
if (name == "nature" || name == "content") {
|
this.setData({
|
scanData: {
|
...this.data.scanData,
|
[name]: e.detail.value
|
}
|
})
|
} else {
|
this.setData({
|
peopleInfo: {
|
...this.data.peopleInfo,
|
[name]: e.detail.value
|
}
|
})
|
}
|
},
|
|
selectChange: function(e) {
|
var name = e.currentTarget.dataset.name;
|
if (name === "nature") {
|
this.setData({
|
scanData: {
|
...this.data.scanData,
|
'showNature': e.detail.value, //举报性质,1:涉黑涉恶违法犯罪行为,2:涉黑涉恶违法犯罪保护伞,3:其他
|
[name]: Number(e.detail.value)
|
}
|
})
|
} else if (name === "userSex") {
|
this.setData({
|
peopleInfo: {
|
...this.data.peopleInfo,
|
"showUserSex": e.detail.value,
|
[name]: Number(e.detail.value)
|
}
|
})
|
} else if (name == 'userBirthday') {
|
this.setData({
|
peopleInfo: {
|
...this.data.peopleInfo,
|
[name]: e.detail.value
|
}
|
})
|
} else {
|
this.setData({
|
scanData: {
|
...this.data.scanData,
|
[name]: e.detail.value
|
}
|
})
|
}
|
|
},
|
|
//举报人按钮
|
switchChange: function(e) {
|
this.setData({
|
switch: e.detail.value,
|
})
|
},
|
onLoad: function(option) {
|
var openId = wx.getStorageSync("openId");
|
var userinfo = wx.getStorageSync("user");
|
var that = this;
|
this.setData({
|
id: option.id,
|
})
|
wx.request({
|
url: app.globalData.url + '/api/v1/crackdown/find?id=' + that.data.id + '&flag=WX',
|
success: function(res) {
|
if (res.data.code == 0) {
|
var data1 = res.data.data.crimeCrackdown;
|
var data2 = res.data.data.userInfo || {};
|
var data3 = res.data.data.ReplyLogs || [];
|
for (var i = 0; i < data3.length; i++) {
|
data3[i].createTime = app.formatDate(data3[i].createTime)
|
}
|
var status = data1.status;
|
var disabled = app.judgeDisable(status);
|
data1.createId = userinfo.id;
|
var evalList1017 = data1.attList || [];
|
var evalList1001 = data2.attList || [];
|
var evalList = {
|
evalList1001,
|
evalList1017
|
}
|
for (var i in evalList) {
|
evalList[i] = evalList[i].map(({
|
path: pic,
|
id: id
|
}) => ({
|
pic,
|
id
|
}))
|
}
|
data1.showNature = data1.nature;
|
data2.showUserSex = Number(data2.userSex);
|
data2.userBirthday = data2.userBirthday || '1985-01-01';
|
if (that.data.id != 'new') {
|
that.setData({
|
switch: data1.isRealName == 1 ? true : false,
|
})
|
}
|
that.setData({
|
scanData: data1,
|
peopleInfo: data2,
|
disabled: disabled,
|
id1: data1.id || '',
|
id2: data2.id || '',
|
showTime: app.formatDate(data1.createTime),
|
status,
|
evalList,
|
ReplyLogs: data3
|
})
|
} else {
|
wx.showModal({
|
title: '提示',
|
content: "初始化请求失败!"
|
})
|
}
|
}
|
})
|
},
|
|
submit: function(e) {
|
var scanData = this.data.scanData;
|
var status = e.currentTarget.dataset.type;
|
scanData.status = status;
|
var that = this;
|
var title = '';
|
if (status == "1") {
|
if (!scanData.nature) {
|
return app.showModal("请选择举报性质!");
|
}
|
if (!scanData.content) {
|
return app.showModal("请填写举报事项!");
|
}
|
|
const {
|
evalList1017,
|
evalList1001
|
} = this.data.evalList;
|
if (evalList1017.length == 0) {
|
return app.showModal("请上传相关材料/照片!");
|
}
|
debugger;
|
if (that.data.switch) {
|
scanData.isRealName = 1;
|
var peopleInfo = that.data.peopleInfo;
|
if (!(peopleInfo.userName && peopleInfo.mobile && peopleInfo.address && peopleInfo.cardNo && peopleInfo.userBirthday && evalList1001.length > 0)) {
|
if (!peopleInfo.userName) {
|
return app.showModal("请填写姓名!");
|
}
|
if (!peopleInfo.userSex) {
|
return app.showModal("请选择性别!");
|
}
|
if (!peopleInfo.mobile) {
|
return app.showModal("请填写联系方式!");
|
} else {
|
if (!verify.phone(peopleInfo.mobile)) {
|
return app.showModal("手机号码格式不正确!")
|
}
|
}
|
if (!peopleInfo.address) {
|
return app.showModal("请填写住所!");
|
}
|
if (!peopleInfo.cardNo) {
|
return app.showModal("请填写身份证号码!");
|
} else {
|
if (!verify.carIdNumber(peopleInfo.cardNo)) {
|
return app.showModal("身份证格式不正确!")
|
}
|
}
|
} else {
|
if (evalList1001.length < 2) {
|
return app.showModal("请至少上传两张身份证附件!")
|
}
|
}
|
} else {
|
scanData.isRealName = 0;
|
}
|
}
|
if (that.data.switch) {
|
scanData.isRealName = 1;
|
} else {
|
scanData.isRealName = 0;
|
}
|
var obj = {
|
crimeCrackdown: that.data.scanData,
|
userInfo: that.data.peopleInfo,
|
};
|
wx.request({
|
url: app.globalData.url + '/api/v1/crackdown/save',
|
data: obj,
|
method: 'POST',
|
header: {
|
"Content-Type": "application/json"
|
},
|
success: function(res) {
|
if (res.data.code == 0) {
|
if (status == 0) {
|
title = '保存草稿成功!';
|
} else {
|
title = '提交成功!';
|
}
|
wx.showToast({
|
title,
|
icon: 'success',
|
duration: 2000
|
})
|
setTimeout(function() {
|
wx.reLaunch({
|
url: '../index/index',
|
})
|
}, 2000)
|
} else {
|
wx.showModal({
|
title: '提示',
|
content: "提交失败!"
|
})
|
}
|
}
|
})
|
},
|
reply: function(e) {
|
var that = this;
|
var openId = wx.getStorageSync("openId")
|
var obj = {
|
openId: openId,
|
content: that.data.peopleInfo.replyContent,
|
busType: 26,
|
busId: that.data.id1
|
};
|
wx.request({
|
url: app.globalData.url + '/api/v1/crackdown/reply',
|
data: obj,
|
method: 'POST',
|
header: {
|
"Content-Type": "application/json"
|
},
|
success: function(res) {
|
if (res.data.code == 0) {
|
wx.showToast({
|
title: '提交回复成功',
|
icon: 'success',
|
duration: 2000
|
})
|
setTimeout(function() {
|
wx.navigateBack({
|
changed: true
|
}); //返回上一页
|
}, 2000)
|
} else {
|
wx.showModal({
|
title: '提示',
|
content: "提交失败!"
|
})
|
}
|
}
|
})
|
},
|
//添加图片
|
joinPicture1: function(e) {
|
var that = this;
|
app.joinPicture(e, that, e.currentTarget.dataset.associatetypeid, that.data.id1);
|
},
|
|
//添加图片
|
joinPicture2: function(e) {
|
var that = this;
|
app.joinPicture(e, that, e.currentTarget.dataset.associatetypeid, that.data.id2);
|
},
|
|
joinVideo: function(e) {
|
var that = this;
|
app.joinVideo(e, that);
|
},
|
|
// 删除图片
|
clearImg: function(e) {
|
var that = this;
|
app.clearImg(e, that);
|
},
|
|
//预览图片
|
previewImage: function(e) {
|
app.previewImage(e);
|
},
|
|
goback: function() {
|
wx.navigateBack({
|
changed: true
|
}); //返回上一页
|
},
|
|
// 跳转扫黑除恶举报须知页面
|
scanEvildoingInfo: function() {
|
wx.navigateTo({
|
url: '../scanEvildoingInfo/scanEvildoingInfo',
|
})
|
}
|
})
|