// index.ts
|
const submitReport =getApp()
|
Page({
|
data: {
|
items: { name: '日期时间选择', value: 'dateTime' },
|
mode: 'dateTime',
|
reportDetail: {},
|
causeList: [],
|
imagesFile: [],
|
images: [],
|
materials:"",
|
cheatTime:"",
|
},
|
|
uploadImage() {
|
wx.chooseMedia({
|
mediaType: ['image'],
|
success: res => {
|
this.setData({
|
imagesFile: res.tempFiles
|
})
|
for (let index = 0; index < this.data.imagesFile.length; index++) {
|
wx.uploadFile({
|
filePath: this.data.imagesFile[index].tempFilePath,
|
name: "file",
|
header: {
|
'token': wx.getStorageSync('token'),
|
'content-type': 'application/json'
|
},
|
url: submitReport.globalData.url+"/minio/upload",
|
success: res => {
|
const result = JSON.parse(res.data)
|
this.data.images.push({
|
url:submitReport.globalData.imageUrl+"/img/"+result.data
|
})
|
this.setData({
|
images:this.data.images
|
})
|
this.setData({
|
materials: this.data.materials+=result.data+","
|
})
|
console.log(this.data.materials);
|
}
|
})
|
}
|
}
|
})
|
|
},
|
//被骗时间
|
onPickerChange(e){
|
console.log(e)
|
this.data.cheatTime=e.detail.value
|
},
|
getMoney:function(e){
|
console.log(e.detail.value)
|
this.data.reportDetail.amountInvolved=e.detail.value
|
},
|
getDe:function(e){
|
console.log(e.detail.value)
|
this.data.reportDetail.reportDescription=e.detail.value
|
},
|
getInfor:function(e){
|
this.data.reportDetail.information=e.detail.value
|
console.log(e.detail.value)
|
},
|
//通过
|
cancel(){
|
wx.navigateBack({
|
delta:1
|
})
|
},
|
pass() {
|
this.data.materials=this.data.materials.substring(0,this.data.materials.length-1);
|
this.data.reportDetail.reportMaterials=this.data.materials
|
this.data.reportDetail.userId=wx.getStorageSync('id')
|
this.data.reportDetail.cheatTime=this.data.cheatTime
|
if ( this.data.reportDetail.information==null|| this.data.reportDetail.reportDescription==null) {
|
wx.showToast({
|
icon: "none",
|
title: '请完整填完表单!',
|
})
|
return
|
}
|
wx.request(
|
{
|
url: submitReport.globalData.url+"/wx/user/addReport",
|
method: "POST",
|
data: this.data.reportDetail,
|
header: {
|
'token': wx.getStorageSync('token'),
|
'content-type': 'application/json'
|
}, success: (res) => {
|
console.log(res)
|
wx.reLaunch({
|
url:'../../report/index'
|
})
|
}
|
})
|
|
|
},
|
onLoad(e) {
|
var date = new Date()
|
var month = date.getMonth() + 1
|
var day = date.getDate()
|
var hours=date.getHours()
|
var minutes=date.getMinutes()
|
var secends=date.getSeconds()
|
var time
|
if (month < 10) {
|
month = "0" + month
|
}
|
if (day < 10) {
|
day = "0" + day
|
}
|
if (minutes < 10) {
|
minutes = "0" + minutes
|
}
|
if (hours < 10) {
|
hours = "0" + hours
|
}
|
if (secends < 10) {
|
secends = "0" + secends
|
}
|
this.data.cheatTime = date.getFullYear() + "-" + month + "-" + day + " " + hours+":"+minutes+":"+secends
|
console.log( this.data.cheatTime)
|
}
|
})
|