|
|
@ -19,13 +19,16 @@ Page({ |
|
|
|
voiceList:[], |
|
|
|
latitude:"", |
|
|
|
longitude:"", |
|
|
|
resiId:"1698525635288653825", |
|
|
|
resiId:"", |
|
|
|
happenTime:"", |
|
|
|
content:"",//内容
|
|
|
|
address:""//地址
|
|
|
|
address:"",//地址
|
|
|
|
wantServiceTime:"", |
|
|
|
reportType:'' |
|
|
|
}, |
|
|
|
minDate: '2018-01-01 00:00:00', |
|
|
|
timeLabel: '', |
|
|
|
|
|
|
|
tabVal:"0", |
|
|
|
|
|
|
|
uploadImageList: [],//图片上传的数组
|
|
|
|
streetList: [], // 街道
|
|
|
@ -61,21 +64,25 @@ Page({ |
|
|
|
|
|
|
|
// defaultFieldNames: { label: 'agencyName', value: 'agencyId', children: 'subAgencyList' },
|
|
|
|
angencyVisible: false, |
|
|
|
angencyValue: [], |
|
|
|
|
|
|
|
measureList:[], |
|
|
|
measureValue:'', |
|
|
|
measureVisible:false, |
|
|
|
|
|
|
|
reportUserName:'', |
|
|
|
reportUserMobile:'', |
|
|
|
|
|
|
|
showWantServiceTimeTime:'', |
|
|
|
|
|
|
|
reportTypeList:[],//上报类型
|
|
|
|
reportTypeVisible:false |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
* 生命周期函数--监听页面加载 |
|
|
|
*/ |
|
|
|
onLoad(options) { |
|
|
|
console.log(options); |
|
|
|
if(options.resiId){ |
|
|
|
this.setData({ |
|
|
|
"fmData.resiId":options.resiId, |
|
|
|
resiName:options.resiName, |
|
|
|
resiMobile:options.mobile |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
this.data.qqMapWX = new QQMapWX({ |
|
|
|
key: 'CMJBZ-4DECI-JXGGN-5B4WU-QLV2H-B5BEJ' |
|
|
|
}) |
|
|
@ -84,9 +91,13 @@ Page({ |
|
|
|
}) |
|
|
|
this.setData({ |
|
|
|
'fmData.time': Date.now(), |
|
|
|
angencyId:app.globalData.user.agencyId |
|
|
|
angencyId:app.globalData.user.agencyId, |
|
|
|
reportUserName:app.globalData.user.realName, |
|
|
|
reportUserMobile:app.globalData.user.phone, |
|
|
|
}) |
|
|
|
this.getAgencygridtree() |
|
|
|
this.getDemandoption() |
|
|
|
this.getDictList() |
|
|
|
}, |
|
|
|
// 组织树
|
|
|
|
getAgencygridtree() { |
|
|
@ -103,15 +114,33 @@ Page({ |
|
|
|
console.log(err); |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
getDictList(){ |
|
|
|
api.getDictList('user_demand_report_type').then(res=>{ |
|
|
|
console.log(res); |
|
|
|
this.setData({ |
|
|
|
reportTypeList:res.data |
|
|
|
}) |
|
|
|
}).catch(err=>{ |
|
|
|
console.log(err); |
|
|
|
}) |
|
|
|
}, |
|
|
|
getDemandoption(){ |
|
|
|
api.getDemandoption().then(res=>{ |
|
|
|
console.log(res); |
|
|
|
this.setData({ |
|
|
|
measureList:res.data |
|
|
|
}) |
|
|
|
}).catch(err=>{ |
|
|
|
console.log(err); |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 触底函数
|
|
|
|
onReachBottom() { |
|
|
|
if (this.projectlist) { |
|
|
|
this.projectlist.onReachBottom() |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
//跳转地图选点
|
|
|
|
toughGetLocation() { |
|
|
|
this.getLocation(false); |
|
|
|
wx.chooseLocation({ |
|
|
@ -180,20 +209,82 @@ Page({ |
|
|
|
} |
|
|
|
if (this.data.uploadImageList.length > 0) { |
|
|
|
this.data.uploadImageList.forEach(item => { |
|
|
|
imagesList.push(item.ossUrl) |
|
|
|
imagesList.push({format:item.format,originFileName:item.originFileName,url:item.ossUrl.url,type:item.type}) |
|
|
|
}) |
|
|
|
} |
|
|
|
this.setData({ |
|
|
|
'fmData.attachmentList': imagesList, |
|
|
|
}) |
|
|
|
console.log(this.data.fmData); |
|
|
|
this.submitItem() |
|
|
|
console.log(this.data.tabVal); |
|
|
|
if(!this.data.fmData.gridId){ |
|
|
|
this.showToast('所属组织不能为空') |
|
|
|
return |
|
|
|
} |
|
|
|
if(this.data.tabVal === '1'){ |
|
|
|
if(!this.data.fmData.content){ |
|
|
|
this.showToast('需求描述不能为空') |
|
|
|
return |
|
|
|
} |
|
|
|
if(!this.data.fmData.content){ |
|
|
|
this.showToast('需求描述不能为空') |
|
|
|
return |
|
|
|
} |
|
|
|
if(!this.data.fmData.categoryCode){ |
|
|
|
this.showToast('需求类型不能为空') |
|
|
|
return |
|
|
|
} |
|
|
|
if(!this.data.fmData.reportType){ |
|
|
|
this.showToast('上报类型不能为空') |
|
|
|
return |
|
|
|
} |
|
|
|
if(!this.data.fmData.happenTime){ |
|
|
|
this.showToast('需求时间不能为空') |
|
|
|
return |
|
|
|
} |
|
|
|
if(!this.data.fmData.wantServiceTime){ |
|
|
|
this.showToast('服务时间不能为空') |
|
|
|
return |
|
|
|
} |
|
|
|
if(!this.data.fmData.resiId){ |
|
|
|
this.showToast('需求人不能为空') |
|
|
|
return |
|
|
|
} |
|
|
|
if(!this.data.resiMobile){ |
|
|
|
this.showToast('需求人电话不能为空') |
|
|
|
return |
|
|
|
} |
|
|
|
}else{ |
|
|
|
if(!this.data.fmData.content){ |
|
|
|
this.showToast('事件描述不能为空') |
|
|
|
return |
|
|
|
} |
|
|
|
if(!this.data.fmData.happenTime){ |
|
|
|
this.showToast('发生时间不能为空') |
|
|
|
return |
|
|
|
} |
|
|
|
if(!this.data.fmData.address){ |
|
|
|
this.showToast('发生地点不能为空') |
|
|
|
return |
|
|
|
} |
|
|
|
if(!this.data.fmData.resiId){ |
|
|
|
this.showToast('联系人不能为空') |
|
|
|
return |
|
|
|
} |
|
|
|
if(!this.data.resiMobile){ |
|
|
|
this.showToast('联系人电话不能为空') |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
if(this.data.tabVal ==='1'){ |
|
|
|
|
|
|
|
this.submitMeasure() |
|
|
|
}else{ |
|
|
|
this.submitEven() |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 提交接口
|
|
|
|
submitItem() { |
|
|
|
// 事件提交接口
|
|
|
|
submitEven() { |
|
|
|
wx.showLoading({ |
|
|
|
title: '提交中...', |
|
|
|
mask: true |
|
|
@ -202,35 +293,127 @@ Page({ |
|
|
|
submitDisabled: true |
|
|
|
}) |
|
|
|
const para = this.data.fmData |
|
|
|
para.resiId = '1501821695344775169' |
|
|
|
para.gridId = '9c55c566524a8b171df57a792d2933bd' |
|
|
|
para.happenTime = '2023-04-05 03:07:00' |
|
|
|
console.log(para,'事件'); |
|
|
|
api.addEvent(para).then(res => { |
|
|
|
wx.hideLoading() |
|
|
|
console.log(res); |
|
|
|
if (res.code === 0) { |
|
|
|
wx.showModal({ |
|
|
|
title: '提示', |
|
|
|
content: `您的诉求我们已经查收,正在快马加鞭办理,请您耐心等待`, |
|
|
|
confirmText: '确认', |
|
|
|
showCancel: false, |
|
|
|
success: res => { |
|
|
|
this.setData({ |
|
|
|
submitDisabled: false, |
|
|
|
uploadImageList: [], |
|
|
|
uploadRecord: { |
|
|
|
uploaded: true, |
|
|
|
url: "" |
|
|
|
}, |
|
|
|
agencyName:'', |
|
|
|
showTime:'', |
|
|
|
resiName:'', |
|
|
|
resiMobile:'', |
|
|
|
'fmData.time':'', |
|
|
|
'fmData.gridId':'', |
|
|
|
'fmData.attachmentList':[],//图片
|
|
|
|
'fmData.voiceList':[], |
|
|
|
'fmData.latitude':"", |
|
|
|
'fmData.longitude':"", |
|
|
|
'fmData.resiId':"", |
|
|
|
'fmData.happenTime':"", |
|
|
|
'fmData.content':"",//内容
|
|
|
|
'fmData.address':"",//地址
|
|
|
|
'fmData.wantServiceTime':"", |
|
|
|
'fmData.reportType':'' |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
wx.removeStorageSync('resiDetail') |
|
|
|
} else { |
|
|
|
wx.showToast({ |
|
|
|
title: "提交失败,请重试~", |
|
|
|
icon: "none", |
|
|
|
duration: 1500 |
|
|
|
}) |
|
|
|
this.setData({ |
|
|
|
submitDisabled: false |
|
|
|
}) |
|
|
|
} |
|
|
|
}).catch(err => { |
|
|
|
console.log(err) |
|
|
|
wx.hideLoading() |
|
|
|
this.setData({ |
|
|
|
submitDisabled: false |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 个性服务提交
|
|
|
|
submitMeasure(){ |
|
|
|
wx.showLoading({ |
|
|
|
title: '提交中...', |
|
|
|
mask: true |
|
|
|
}) |
|
|
|
|
|
|
|
this.setData({ |
|
|
|
submitDisabled: true |
|
|
|
}) |
|
|
|
let {categoryCode,content,happenTime,resiId,gridId,attachmentList,voiceList,wantServiceTime,parentCode,reportType} = this.data.fmData |
|
|
|
const para ={ |
|
|
|
categoryCode, |
|
|
|
content, |
|
|
|
reportUserName:this.data.reportUserName, |
|
|
|
reportTime:happenTime, |
|
|
|
reportUserMobile:this.data.reportUserMobile, |
|
|
|
demandUserId:resiId, |
|
|
|
gridId, |
|
|
|
reportType, |
|
|
|
attachmentList:[...attachmentList,...voiceList], |
|
|
|
wantServiceTime, |
|
|
|
parentCode:parentCode |
|
|
|
} |
|
|
|
console.log(para,'服务'); |
|
|
|
api.addMeasure(para).then(res => { |
|
|
|
wx.hideLoading() |
|
|
|
console.log(res); |
|
|
|
if (res.data) { |
|
|
|
wx.showModal({ |
|
|
|
title: '提示', |
|
|
|
content: `您的诉求我们已经查收,正在快马加鞭办理,请您耐心等待\r\n诉求编号为:${res.data}`, |
|
|
|
content: `您的需求我们已经查收,正在快马加鞭办理,请您耐心等待`, |
|
|
|
confirmText: '确认', |
|
|
|
showCancel: false, |
|
|
|
success: res => { |
|
|
|
this.setData({ |
|
|
|
submitDisabled: false, |
|
|
|
'personalInfo.nickname': '', |
|
|
|
'personalInfo.itemContent': '', |
|
|
|
'personalInfo.itemVoice': '', |
|
|
|
'personalInfo.duration': '', |
|
|
|
'personalInfo.images': [], |
|
|
|
uploadImageList: [], |
|
|
|
uploadRecord: { |
|
|
|
uploaded: true, |
|
|
|
url: "" |
|
|
|
}, |
|
|
|
agencyName:'', |
|
|
|
showTime:'', |
|
|
|
resiName:'', |
|
|
|
resiMobile:'', |
|
|
|
categoryName:'', |
|
|
|
reportTypeName:'', |
|
|
|
showWantServiceTimeTime:'', |
|
|
|
'fmData.time':'', |
|
|
|
'fmData.gridId':'', |
|
|
|
'fmData.attachmentList':[],//图片
|
|
|
|
'fmData.voiceList':[], |
|
|
|
'fmData.latitude':"", |
|
|
|
'fmData.longitude':"", |
|
|
|
'fmData.resiId':"", |
|
|
|
'fmData.happenTime':"", |
|
|
|
'fmData.content':"",//内容
|
|
|
|
'fmData.address':"",//地址
|
|
|
|
'fmData.wantServiceTime':"", |
|
|
|
'fmData.reportType':'' |
|
|
|
}) |
|
|
|
this.projectlist = this.selectComponent('#projectlist') |
|
|
|
} |
|
|
|
}) |
|
|
|
wx.removeStorageSync('resiDetail') |
|
|
|
} else { |
|
|
|
wx.showToast({ |
|
|
|
title: "提交失败,请重试~", |
|
|
@ -249,8 +432,6 @@ Page({ |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 双向绑定 内容输入框
|
|
|
|
bindTextareaInput(e) { |
|
|
|
this.setData({ |
|
|
@ -266,8 +447,6 @@ Page({ |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 录音end
|
|
|
|
// 选择图片 上传弹窗 - 上传图片方式 - 选择图片 - 上传图片 - 回调赋值
|
|
|
|
chooseImage() { |
|
|
|
if (this.data.uploadImageList.length > 3) { |
|
|
@ -281,24 +460,28 @@ Page({ |
|
|
|
$wuxActionSheet().showSheet({ |
|
|
|
buttons: [ |
|
|
|
{ text: '拍照' }, |
|
|
|
{ text: '从相册中获取' }, |
|
|
|
{ text: '从相册中获取',openType:null, }, |
|
|
|
], |
|
|
|
className: 'dialog-class', |
|
|
|
buttonClicked(index) { |
|
|
|
if (index === 0) { |
|
|
|
wx.chooseImage({ |
|
|
|
wx.chooseMedia({ |
|
|
|
count: 1, |
|
|
|
sizeType: ['original', 'compressed'], |
|
|
|
sourceType: ['camera'], |
|
|
|
success(res) { |
|
|
|
console.log(res); |
|
|
|
let deleteLength = _this.data.uploadImageList.length |
|
|
|
const uploadImageList = [..._this.data.uploadImageList] |
|
|
|
if (res.tempFiles[0].size <= 5 * 1024 * 1024) { |
|
|
|
uploadImageList.push({ |
|
|
|
uploaded: false, |
|
|
|
ossUrl: '', |
|
|
|
imgUrl: res.tempFiles[0].path, |
|
|
|
imageId: ++_this.data.imageId |
|
|
|
imgUrl: res.tempFiles[0].tempFilePath, |
|
|
|
imageId: ++_this.data.imageId, |
|
|
|
type:res.tempFiles[0].tempFilePath.substr(res.tempFiles[0].tempFilePath.length -3,3), |
|
|
|
format:"image", |
|
|
|
name:'wximage' |
|
|
|
}) |
|
|
|
} else { |
|
|
|
_this.showToast('图片上限5M,请压缩后重试~') |
|
|
@ -309,7 +492,7 @@ Page({ |
|
|
|
}) |
|
|
|
wx.uploadFile({ |
|
|
|
url: `${config.BASEURL()}oss/file/uploadvariedfile`, |
|
|
|
filePath: res.tempFilePaths[0], |
|
|
|
filePath: res.tempFiles[0].tempFilePath, |
|
|
|
name: 'file', |
|
|
|
header: { |
|
|
|
'Content-type': 'application/json;charset=UTF-8', |
|
|
@ -344,23 +527,25 @@ Page({ |
|
|
|
} |
|
|
|
}) |
|
|
|
} else if (index === 1) { |
|
|
|
wx.chooseImage({ |
|
|
|
wx.chooseMedia({ |
|
|
|
count: 1, |
|
|
|
sizeType: ['original', 'compressed'], |
|
|
|
type:'image', |
|
|
|
sourceType: ['album'], |
|
|
|
success(res) { |
|
|
|
console.log(res,'图片上传的res'); |
|
|
|
|
|
|
|
console.log(res,'图片上传的res'); |
|
|
|
let deleteLength = _this.data.uploadImageList.length |
|
|
|
const uploadImageList = [] |
|
|
|
const endIndex = _this.data.uploadImageList.length |
|
|
|
res.tempFiles.forEach(item => { |
|
|
|
res.tempFiles.forEach((item,index) => { |
|
|
|
if (item.size <= 5 * 1024 * 1024) { |
|
|
|
uploadImageList.push({ |
|
|
|
uploaded: false, |
|
|
|
ossUrl: '', |
|
|
|
imgUrl: item.path, |
|
|
|
imageId: ++_this.data.imageId |
|
|
|
imgUrl: item.tempFilePath, |
|
|
|
imageId: ++_this.data.imageId, |
|
|
|
format:"image", |
|
|
|
type:item.tempFilePath.substr(item.tempFilePath.length -3,3), |
|
|
|
originFileName:'image' + index + 1 |
|
|
|
}) |
|
|
|
} else { |
|
|
|
_this.showToast('图片上限5M,请压缩后重试~') |
|
|
@ -373,7 +558,7 @@ Page({ |
|
|
|
return (function (index) { |
|
|
|
wx.uploadFile({ |
|
|
|
url: `${config.BASEURL()}oss/file/uploadvariedfile`, |
|
|
|
filePath: res.tempFilePaths[index], |
|
|
|
filePath: res.tempFiles[index].tempFilePath, |
|
|
|
name: 'file', |
|
|
|
header: { |
|
|
|
'Content-type': 'application/json;charset=UTF-8', |
|
|
@ -394,7 +579,6 @@ Page({ |
|
|
|
uploadImageList: [..._this.data.uploadImageList, ...uploadImageList] |
|
|
|
}) |
|
|
|
} |
|
|
|
console.log(_this.data.uploadImageList.length, '图片上传长度'); |
|
|
|
}, |
|
|
|
fail(fileRes) { |
|
|
|
_this.setData({ |
|
|
@ -434,37 +618,6 @@ Page({ |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
// 街道社区
|
|
|
|
getDeptTree() { |
|
|
|
getDeptTree().then(res => { |
|
|
|
this.setData({ |
|
|
|
streetList: res.data[0].children |
|
|
|
}) |
|
|
|
if (this.data.personalInfo.streetId && this.data.personalInfo.communityId) { |
|
|
|
this.data.streetList.forEach(element => { |
|
|
|
if (element.value == this.data.personalInfo.streetId) { |
|
|
|
this.setData({ |
|
|
|
'personalInfo.street': element.label, |
|
|
|
communityList: element.children // 社区
|
|
|
|
}) |
|
|
|
// 循环社区
|
|
|
|
element.children.forEach(community => { |
|
|
|
if (community.value == this.data.personalInfo.communityId) { |
|
|
|
this.setData({ |
|
|
|
'personalInfo.community': community.label, |
|
|
|
gridList: community.children |
|
|
|
// 'personalInfo.grid': community.children[0].label, // 网格默认选择第一个
|
|
|
|
// 'personalInfo.gridId': community.children[0].value // 网格
|
|
|
|
}) |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}).catch(err => { |
|
|
|
console.log(err) |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 单选点击事件
|
|
|
|
inputSyncPicker(e) { |
|
|
|
let { |
|
|
@ -518,8 +671,6 @@ Page({ |
|
|
|
if (this.data.personalInfo.communityId == element.value) { |
|
|
|
this.setData({ |
|
|
|
gridList: element.children |
|
|
|
// 'personalInfo.grid': element.children[0].label, // 网格默认选择第一个
|
|
|
|
// 'personalInfo.gridId': element.children[0].value // 网格
|
|
|
|
}) |
|
|
|
} |
|
|
|
}); |
|
|
@ -532,12 +683,10 @@ Page({ |
|
|
|
success(res) { |
|
|
|
console.log(res); |
|
|
|
_this.setData({ |
|
|
|
fmData: { |
|
|
|
addressContent: res.result.address, |
|
|
|
address: res.result.address, |
|
|
|
longitude:res.result.location.lng, |
|
|
|
latitude:res.result.location.lat |
|
|
|
}, |
|
|
|
addressContent:res.result.address, |
|
|
|
'fmData.address': res.result.address, |
|
|
|
'fmData.longitude':res.result.location.lng, |
|
|
|
'fmData.latitude':res.result.location.lat, |
|
|
|
}) |
|
|
|
}, |
|
|
|
fail(err) { |
|
|
@ -547,32 +696,54 @@ Page({ |
|
|
|
}, |
|
|
|
|
|
|
|
onConfirmDate(e) { |
|
|
|
console.log(e); |
|
|
|
this.setData({ |
|
|
|
'fmData.happenTime': e.detail.label + ':00', |
|
|
|
timeLabel: e.detail.displayValue.join(' '), |
|
|
|
visibleTime: false |
|
|
|
visibleTime: false, |
|
|
|
showTime:e.detail.label + ':00' |
|
|
|
}) |
|
|
|
}, |
|
|
|
onConfirmWantServiceTime(e){ |
|
|
|
this.setData({ |
|
|
|
'fmData.wantServiceTime': e.detail.label + ':00', |
|
|
|
visibleTimeWantServiceTime: false, |
|
|
|
showWantServiceTimeTime:e.detail.label + ':00' |
|
|
|
}) |
|
|
|
}, |
|
|
|
onVisibleChange(e) { |
|
|
|
this.setData({ |
|
|
|
// timeLabel: e.detail.displayValue.join(' '),
|
|
|
|
}) |
|
|
|
//时间组件隐藏
|
|
|
|
onCancel(e) { |
|
|
|
this.setData({ |
|
|
|
visibleTime: false, |
|
|
|
visibleTimeWantServiceTime:false |
|
|
|
}) |
|
|
|
}, |
|
|
|
onCancel() { |
|
|
|
bindMobile(e){ |
|
|
|
this.setData({ |
|
|
|
visibleTime: false |
|
|
|
resiMobile:e.detail.value |
|
|
|
}) |
|
|
|
}, |
|
|
|
showTimePicker() { |
|
|
|
getCurrentDateTime() { |
|
|
|
const date = new Date(); |
|
|
|
const year = date.getFullYear(); |
|
|
|
const month = (1 + date.getMonth()).toString().padStart(2, '0'); // Months are zero-based.
|
|
|
|
const day = date.getDate().toString().padStart(2, '0'); |
|
|
|
const hours = date.getHours().toString().padStart(2, '0'); |
|
|
|
const minutes = date.getMinutes().toString().padStart(2, '0'); |
|
|
|
const seconds = date.getSeconds().toString().padStart(2, '0'); |
|
|
|
return year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds; |
|
|
|
}, |
|
|
|
showTimePicker(e) { |
|
|
|
this.setData({ |
|
|
|
visibleTime: true |
|
|
|
visibleTime: true, |
|
|
|
maxDate:this.getCurrentDateTime(), |
|
|
|
'fmData.happenTime':this.getCurrentDateTime(), |
|
|
|
}) |
|
|
|
}, |
|
|
|
onPageScroll: function (e) { |
|
|
|
if (this.projectlist) { |
|
|
|
this.projectlist.onPageScroll(e) |
|
|
|
} |
|
|
|
showTimePickerW(e) { |
|
|
|
this.setData({ |
|
|
|
visibleTimeWantServiceTime: true, |
|
|
|
maxDate:this.getCurrentDateTime(), |
|
|
|
'fmData.wantServiceTime':this.getCurrentDateTime(), |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
@ -586,21 +757,28 @@ Page({ |
|
|
|
* 生命周期函数--监听页面显示 |
|
|
|
*/ |
|
|
|
onShow() { |
|
|
|
|
|
|
|
let resiDetail = wx.getStorageSync('resiDetail') |
|
|
|
if(resiDetail){ |
|
|
|
this.setData({ |
|
|
|
"fmData.resiId":resiDetail.resiId, |
|
|
|
resiName:resiDetail.resiName, |
|
|
|
resiMobile:resiDetail.resiMobile |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
* 生命周期函数--监听页面隐藏 |
|
|
|
*/ |
|
|
|
onHide() { |
|
|
|
|
|
|
|
wx.removeStorageSync('resiDetail') |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
* 生命周期函数--监听页面卸载 |
|
|
|
*/ |
|
|
|
onUnload() { |
|
|
|
|
|
|
|
wx.removeStorageSync('resiDetail') |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
@ -616,9 +794,7 @@ Page({ |
|
|
|
*/ |
|
|
|
// /page/user?id=123
|
|
|
|
onShareAppMessage() { |
|
|
|
return { |
|
|
|
path: 'pages/peopleLivelihood/peopleLivelihood', |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
handleRecordDel() { |
|
|
|
const { hasStop, isStart } = this.data |
|
|
@ -700,20 +876,21 @@ Page({ |
|
|
|
recordingTime: '00:00' |
|
|
|
}) |
|
|
|
} else { |
|
|
|
let { recordingLength } = this.data |
|
|
|
if (duration - (recordingLength * 1000) > 1000 ) duration = recordingLength * 1000 |
|
|
|
// let { recordingLength } = this.data
|
|
|
|
// if (duration - (recordingLength * 1000) > 1000 ) duration = recordingLength * 1000
|
|
|
|
let url = JSON.parse(fileRes.data).data.url |
|
|
|
let fileName = Date.now()+ Math.floor(Math.random() * 1000) |
|
|
|
this.setData({ |
|
|
|
"uploadRecord.uploaded": true, |
|
|
|
"uploadRecord.url": JSON.parse(fileRes.data).data, |
|
|
|
'fmData.voiceList':[JSON.parse(fileRes.data).data], |
|
|
|
"uploadRecord.url": url, |
|
|
|
'fmData.voiceList':[{url:url,format:null,type:'mp3',duration,originFileName:fileName.toString()}], |
|
|
|
showRecord: false, |
|
|
|
hasStart: false, |
|
|
|
isStart: false, |
|
|
|
recordingTime: '00:00', |
|
|
|
duration |
|
|
|
}) |
|
|
|
this.downLoadAudio() |
|
|
|
console.log(this.data.uploadRecord); |
|
|
|
console.log(this.data.fmData.voiceList); |
|
|
|
} |
|
|
|
}, |
|
|
|
fail: (fileRes) => { |
|
|
@ -869,7 +1046,7 @@ Page({ |
|
|
|
showRecord: false |
|
|
|
}) |
|
|
|
}, |
|
|
|
hidePicker() { |
|
|
|
hidePickerAngency() { |
|
|
|
this.setData({ |
|
|
|
angencyVisible: false |
|
|
|
}) |
|
|
@ -880,18 +1057,25 @@ Page({ |
|
|
|
}) |
|
|
|
}, |
|
|
|
onConfirmAngecy(e) { |
|
|
|
console.log(e); |
|
|
|
this.setData({ |
|
|
|
agencyName: e.detail.label, |
|
|
|
'fmData.gridId': e.detail.value[e.detail.value.length - 1], |
|
|
|
angencyVisible: false |
|
|
|
}) |
|
|
|
console.log(this.data.fmData); |
|
|
|
}, |
|
|
|
onValueChange(e) { |
|
|
|
onConfirmReportType(e){ |
|
|
|
console.log(e); |
|
|
|
this.setData({ |
|
|
|
reportTypeName: e.detail.label, |
|
|
|
'fmData.reportType': e.detail.value[0], |
|
|
|
reportTypeVisible: false |
|
|
|
}) |
|
|
|
}, |
|
|
|
hidePickerReportType(){ |
|
|
|
this.setData({ |
|
|
|
reportTypeVisible: false |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
// 播放逻辑
|
|
|
|
initDuration() { |
|
|
|
var _a = this.data, duration = _a.duration; |
|
|
@ -905,7 +1089,7 @@ Page({ |
|
|
|
downLoadAudio() { |
|
|
|
var _this = this; |
|
|
|
wx.downloadFile({ |
|
|
|
url: this.data.uploadRecord.url.url, |
|
|
|
url: this.data.uploadRecord.url, |
|
|
|
success(res) { |
|
|
|
console.log(res); |
|
|
|
if (res.statusCode === 200) { |
|
|
@ -995,6 +1179,16 @@ Page({ |
|
|
|
}); |
|
|
|
console.log('innerAudioContext', innerAudioContext); |
|
|
|
}, |
|
|
|
// 需求分类
|
|
|
|
onConfirmMeasure(e){ |
|
|
|
console.log(e); |
|
|
|
this.setData({ |
|
|
|
'fmData.categoryCode':e.detail.selectedValue[1], |
|
|
|
'fmData.parentCode':e.detail.selectedValue[0], |
|
|
|
categoryName:e.detail.label, |
|
|
|
measureVisible:false |
|
|
|
}) |
|
|
|
}, |
|
|
|
slideChange(e) { |
|
|
|
this.audioPause(); |
|
|
|
var value = e.detail.value; |
|
|
@ -1017,6 +1211,27 @@ Page({ |
|
|
|
'fmData.voiceList':[] |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
showMeasurePicker(){ |
|
|
|
this.setData({ |
|
|
|
measureVisible:true |
|
|
|
}) |
|
|
|
}, |
|
|
|
showReportTypePicker(){ |
|
|
|
this.setData({ |
|
|
|
reportTypeVisible:true |
|
|
|
}) |
|
|
|
}, |
|
|
|
hidePickerMeasure(){ |
|
|
|
this.setData({ |
|
|
|
measureVisible:false |
|
|
|
}) |
|
|
|
}, |
|
|
|
handleChangeType(e){ |
|
|
|
this.setData({ |
|
|
|
tabVal:e.detail.value |
|
|
|
}) |
|
|
|
}, |
|
|
|
format(num) { |
|
|
|
let min = parseInt(num / 1000 / 60) |
|
|
|
let second = parseInt(num / 1000) % 60 |
|
|
|