diff --git a/package.json b/package.json
index 2e9575a..e4a0cd8 100644
--- a/package.json
+++ b/package.json
@@ -8,17 +8,19 @@
},
"author": "",
"dependencies": {
+ "@muguilin/xf-voice-dictation": "^1.0.1",
"@vant/weapp": "^1.11.4",
+ "crypto-js": "^3.3.0",
+ "echarts": "^5.2.2",
+ "log4node": "^0.1.6",
+ "md5": "^2.3.0",
+ "request": "^2.88.2",
+ "request-promise": "^4.2.5",
"tencentcloud-sdk-nodejs": "^4.0.962",
"ts-md5": "^1.3.1",
"uview-ui": "^2.0.36",
"vant": "^4.9.8",
- "vue-jsonp": "^2.0.0",
- "crypto-js": "^3.1.9-1",
- "log4node": "^0.1.6",
- "request": "^2.88.2",
- "request-promise": "^4.2.5",
- "echarts": "^5.2.2"
+ "vue-jsonp": "^2.0.0"
},
"license": "ISC",
"repository": {
diff --git a/subpages/demandCheck/pages/dissatisfied/demandCheck/demandCheck.vue b/subpages/demandCheck/pages/dissatisfied/demandCheck/demandCheck.vue
index 2f60d21..297c1ab 100644
--- a/subpages/demandCheck/pages/dissatisfied/demandCheck/demandCheck.vue
+++ b/subpages/demandCheck/pages/dissatisfied/demandCheck/demandCheck.vue
@@ -1,281 +1,3901 @@
-
-
-
-
-
- {{ resultDisplay }}
+
+
+
+
+
+
+
+
+ *
+ 所属组织
+
+
+
+
+
+
+
+ *
+ 诉求类型
+
+
+
+ 事件上报
+ 居民需求
+
+
+
+ {{ tabVal == 0 ? '事件上报' : tabVal == 1 ? '居民需求' : '城管事件' }}
+
+
+
+
+ *
+ 需求类型
+
+
+ {{ categoryName ? categoryName : '请选择' }}
+
+
+
+
+
+
+ *
+ 上报类型
+
+
+ {{ reportTypeName ? reportTypeName : '请选择' }}
+
+
+
+
+
+
+
+
+
+
+
+ *
+ {{ tabVal === '1' ? '需求描述' : '事件描述' }}
+
+
+
+
+
+
+
+
+
+
+ 您也可以语音输入描述
+
+
+
+
+
+
+ 上传图片
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ *
+ 事件分类
+
+
+
+
+
+
+
+ 重点问题标注
+
+
+
+ {{ keyProblemStr ? keyProblemStr : '请选择' }}
+
+
+
+
+
+
+
+ *
+ {{ tabVal === '1' ? '需求时间' : '发生时间' }}
+
+
+ {{ showTime ? showTime : '请选择' }}
+
+
+
+
+
+
+
+
+ *
+ 服务时间
+
+
+
+ {{ showWantServiceTimeTime ? showWantServiceTimeTime : '请选择' }}
+
+
+
+
+
+
+
+ *
+ 发生地点
+
+
+ {{ addressContent }}
+
+
+
+
+
+
+ *
+ 有无责任单位
+
+
+
+ 有
+
+ 无
+
+
+
+
+
+
+ *
+ {{ tabVal === '1' ? '需求人' : '责任人' }}
+
+
+
+ {{ resiName ? resiName : '请选择' }}
+
+
+
+
+
+
+ *
+ {{ tabVal === '0' ? '责任人电话' : '联系电话' }}
+
+
+
+
+
+
+
+
+
+
+
+ *
+ 是否已自处理
+
+
+
+ 是
+ 否
+
+
+
+
+
+
+ 满意度评价
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 处理进展
+
+
+
+ 【指派】
+ 【完成并回复】
+
+ 【{{ item.processName }}】
+ {{ item.formattedTime }}
+
+
+
+
+
+
+ 指派人:
+
+ {{ item.departmentName }}
+
+
+
+ 指派部门:
+
+ {{ item.agencyName }}
+
+
+
+ 转办意见:
+
+ {{ item.publicReply }}
+
+
+
+ 办结时限:
+
+ {{ item.limitTime }}
+
+
+
+
+
+
+ 回复人:
+
+ {{ item.departmentName }}
+
+
+
+ 回复内容:
+
+ {{ item.publicReply }}
+
+
+
+ 办结时限:
+
+ {{ item.limitTime }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 取消
+ {{ recordingTime }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 点击发布语音内容
+ 限10分钟内
+
+
+ if (this.tabVal === '1') {
+ this.optionsId ? this.updateMeasure() : this.submitMeasure();
+ } else {
+ this.optionsId ? this.updateEvent() : this.submitEven();
+ }
+ },
+
+ // 事件提交接口
+ submitEven() {
+ uni.showLoading({
+ title: '提交中...',
+ mask: true
+ });
+ this.setData({
+ submitDisabled: true
+ });
+ // 事件上报
+ if (this.tabVal == 0) {
+ this.setData({
+ 'fmData.demandType': 'report'
+ });
+ }
+ // 城管上报
+ if (this.tabVal == 2) {
+ this.setData({
+ 'fmData.demandType': 'chengguan'
+ });
+ }
+ if (this.ruTabVal == 'yes') {
+ this.setData({
+ 'fmData.responsibleUnit': 'yes'
+ });
+ } else {
+ this.setData({
+ 'fmData.responsibleUnit': 'no'
+ });
+ }
+ const parm = this.fmData;
+ parm.reportUserId = this.fmData.resiId;
+ parm.eventContent = this.fmData.content;
+ parm.sourceType = '4';
+ console.log(parm, '事件');
+ api.addEvent(parm)
+ .then((res) => {
+ if (res.code === 0) {
+ uni.showModal({
+ title: '提示',
+ content: `提交成功`,
+ confirmText: '确认',
+ showCancel: false,
+ success: (res) => {
+ this.setData({
+ submitDisabled: false,
+ uploadImageList: [],
+ uploadRecord: {
+ uploaded: true,
+ url: ''
+ },
+ agencyName: '',
+ showTime: '',
+ resiName: '',
+ resiMobile: '',
+ responsibleName: '',
+ responsibleMobile: '',
+ 'fmData.gridId': '',
+ 'fmData.attachmentList': [],
+ //图片
+ 'fmData.voiceList': [],
+ 'fmData.latitude': '',
+ 'fmData.longitude': '',
+ 'fmData.resiId': '',
+ 'fmData.happenTime': '',
+ 'fmData.content': '',
+ //内容
+ 'fmData.wantServiceTime': '',
+ // 'fmData.reportType': '',
+ // 'fmData.demandType': '',
+ // 'fmData.responsibleUnit': '',
+ 'fmData.responsibleName': '',
+ 'fmData.responsibleMobile': ''
+ });
+ uni.switchTab({
+ url: '/pages/work/work'
+ });
+ }
+ });
+ uni.removeStorageSync('resiDetail');
+ } else {
+ console.log('提交失败');
+ uni.showToast({
+ title: '提交失败,请重试~',
+ icon: 'none',
+ duration: 1500
+ });
+ this.setData({
+ submitDisabled: false
+ });
+ }
+ })
+ .catch((err) => {
+ console.log(err);
+ uni.showToast({
+ title: '提交失败,请重试~',
+ icon: 'none',
+ duration: 1500
+ });
+ this.setData({
+ submitDisabled: false
+ });
+ });
+ setTimeout(function() {
+ uni.navigateBack({
+ delta: 1
+ });
+ }, 1000);
+ },
+
+ // 个性服务提交
+ submitMeasure() {
+ uni.showLoading({
+ title: '提交中...',
+ mask: true
+ });
+ this.setData({
+ submitDisabled: true
+ });
+ let {
+ categoryCode,
+ content,
+ happenTime,
+ resiId,
+ gridId,
+ attachmentList,
+ voiceList,
+ wantServiceTime,
+ parentCode,
+ reportType
+ } = this.fmData;
+ const parm = {
+ categoryCode,
+ content,
+ reportUserName: this.reportUserName,
+ reportTime: happenTime,
+ reportUserMobile: this.reportUserMobile,
+ demandUserId: resiId,
+ gridId,
+ reportType,
+ // attachments:[...attachmentList],
+ voices: [...voiceList],
+ wantServiceTime,
+ parentCode: parentCode
+ };
+ console.log(parm, '服务');
+ api.addMeasure(parm)
+ .then((res) => {
+ if (res.data) {
+ uni.showModal({
+ title: '提示',
+ content: `提交成功`,
+ confirmText: '确认',
+ showCancel: false,
+ success: (res) => {
+ this.setData({
+ submitDisabled: false,
+ uploadImageList: [],
+ uploadRecord: {
+ uploaded: true,
+ url: ''
+ },
+ agencyName: '',
+ showTime: '',
+ resiName: '',
+ resiMobile: '',
+ categoryName: '',
+ reportTypeName: '',
+ showWantServiceTimeTime: '',
+ 'fmData.gridId': '',
+ 'fmData.attachmentList': [],
+ //图片
+ 'fmData.voiceList': [],
+ 'fmData.latitude': '',
+ 'fmData.longitude': '',
+ 'fmData.resiId': '',
+ 'fmData.happenTime': '',
+ 'fmData.content': '',
+ //内容
+ 'fmData.wantServiceTime': '',
+ 'fmData.reportType': ''
+ });
+ uni.switchTab({
+ url: '/pages/work/work'
+ });
+ }
+ });
+ uni.removeStorageSync('resiDetail');
+ } else {
+ uni.showToast({
+ title: '提交失败,请重试~',
+ icon: 'none',
+ duration: 1500
+ });
+ this.setData({
+ submitDisabled: false
+ });
+ }
+ })
+ .catch((err) => {
+ console.log(err);
+ uni.showToast({
+ title: '提交失败,请重试~',
+ icon: 'none',
+ duration: 1500
+ });
+ this.setData({
+ submitDisabled: false
+ });
+ });
+ setTimeout(function() {
+ uni.hideLoading();
+ }, 1000);
+ },
+
+ // 双向绑定 内容输入框
+ bindTextareaInput(e) {
+ this.setData({
+ 'fmData.content': e.detail.value
+ });
+ console.log(this.fmData);
+ },
+
+ bindResponsibleName(e) {
+ this.setData({
+ 'fmData.responsibleName': e.detail.value
+ });
+ console.log(this.fmData);
+ },
+
+ bindResponsibleMobile(e) {
+ this.setData({
+ 'fmData.responsibleMobile': e.detail.value
+ });
+ console.log(this.fmData);
+ },
+
+ // 点击空白,隐藏sheet
+ onHideSheet() {
+ this.setData({
+ showRecord: false
+ });
+ },
+
+ // 选择图片 上传弹窗 - 上传图片方式 - 选择图片 - 上传图片 - 回调赋值
+ chooseImage() {
+ if (this.uploadImageList.length > 3) {
+ uni.showToast({
+ title: '最多上传3张照片',
+ icon: 'none'
+ });
+ return;
+ }
+ this.showSheetBtn = true
+ },
+ selectSheetBtnClick(item) {
+ const _this = this;
+
+ function blobToFile(blob, fileName) {
+ return new File([blob], fileName, {
+ type: 'image/png'
+ })
+ }
+ if (item.index === 0) {
+ uni.chooseImage({
+ count: 1,
+ sizeType: ['original', 'compressed'],
+ sourceType: ['camera'],
+ success(res) {
+ const uploadImageList = [..._this.uploadImageList];
+ if (res.tempFiles[0].size <= 5242880) {
+ uploadImageList.push({
+ uploaded: false,
+ ossUrl: {
+ url: item.path
+ },
+ imgUrl: item.path,
+ imageId: ++_this.imageId,
+ type: item.name.substr(item.name.length - 3, 3),
+ format: 'image',
+ name: item.name
+ });
+ } else {
+ _this.showToast('图片上限5M,请压缩后重试~');
+ return false;
+ }
+ _this.setData({
+ uploadImageList
+ });
+ uni.uploadFile({
+ url: `${config.BASEURL()}oss/file/upload`,
+ file: blobToFile(res.tempFiles[0], res.tempFiles[0].name),
+ name: 'file',
+ header: {
+ Authorization: uni.getStorageSync('token')
+ },
+ success(fileRes) {
+ if (!JSON.parse(fileRes.data).data) {
+ _this.showToast('图片上传失败,请重试~');
+ // 删除
+ const index = _this.uploadImageList.findIndex((item) => item
+ .imageId === _this.imageId);
+ if (index > -1) {
+ _this.uploadImageList.splice(index, 1);
+ _this.setData({
+ uploadImageList: _this.uploadImageList
+ });
+ }
+ } else {
+ uploadImageList[uploadImageList.length - 1].uploaded = true;
+ uploadImageList[uploadImageList.length - 1].ossUrl = JSON.parse(
+ fileRes.data).data;
+ _this.setData({
+ uploadImageList
+ });
+ }
+ },
+ fail(fileRes) {
+ _this.setData({
+ uploadImageList: []
+ });
+ _this.showToast('图片上传失败,请重试~');
+ }
+ });
+ }
+ });
+ } else if (item.index === 1) {
+ uni.chooseImage({
+ count: 1,
+ type: 'image',
+ sourceType: ['album '],
+ success(res) {
+ console.log(res, '图片上传的res');
+ let deleteLength = _this.uploadImageList.length;
+ const uploadImageList = [];
+ const endIndex = _this.uploadImageList.length;
+ res.tempFiles.forEach((item, index) => {
+ if (item.size <= 5242880) {
+ uploadImageList.push({
+ uploaded: false,
+ ossUrl: {
+ url: item.path
+ },
+ imgUrl: item.path,
+ imageId: ++_this.imageId,
+ format: 'image',
+ type: item.name.substr(item.name.length - 3, 3),
+ originFileName: item.name
+ });
+ } else {
+ _this.showToast('图片上限5M,请压缩后重试~');
+ }
+ });
+ _this.setData({
+ uploadImageList: [..._this.uploadImageList, ...uploadImageList]
+ });
+ uploadImageList.forEach((item, index) => {
+
+ return (function(index) {
+ uni.uploadFile({
+ url: `${config.BASEURL()}oss/file/upload`,
+ file: blobToFile(res.tempFiles[index], res
+ .tempFiles[index].name),
+ name: 'file',
+ header: {
+ Authorization: uni.getStorageSync('token')
+ },
+ success(fileRes) {
+ if (!JSON.parse(fileRes.data).data) {
+ _this.showToast('图片上传失败,请重试~');
+ _this.uploadImageList.splice(deleteLength,
+ _this.uploadImageList.length -
+ deleteLength);
+ _this.setData({
+ uploadImageList: _this
+ .uploadImageList
+ });
+ } else {
+ uploadImageList[index].uploaded = true;
+ uploadImageList[index].ossUrl = JSON.parse(
+ fileRes.data).data;
+ _this.uploadImageList = _this
+ .uploadImageList.slice(0, endIndex);
+ _this.setData({
+ uploadImageList: [..._this
+ .uploadImageList, ...
+ uploadImageList
+ ]
+ });
+ }
+ },
+ fail(fileRes) {
+ _this.setData({
+ uploadImageList: []
+ });
+ _this.showToast('图片上传失败,请重试~');
+ }
+ });
+ })(index);
+ });
+ }
+ });
+ }
+ return true;
+ },
+ toMapAPP(lat, lon, cityName) {
+ var url = '';
+ if (plus.os.name == 'Android') {
+
+ var hasBaiduMap = plus.runtime.isApplicationExist({
+
+ pname: 'com.baidu.BaiduMap',
+
+ action: 'baidumap://'
+
+ });
+
+ var hasAmap = plus.runtime.isApplicationExist({
+
+ pname: 'com.autonavi.minimap',
+
+ action: 'androidamap://'
+
+ });
+
+ var urlBaiduMap = 'baidumap://map/marker?location=' + lat + ',' + lon + '&title=' + cityName +
+ '&src=婚梯';
+
+ var urlAmap = 'androidamap://viewMap?sourceApplication=婚梯&poiname=' + cityName + '&lat=' + lat +
+ '&lon=' + lon +
+
+ '&dev=0';
+
+ // if (hasAmap && hasBaiduMap) {
+
+ plus.nativeUI.actionSheet({
+
+ title: '选择地图应用',
+
+ cancel: '取消',
+
+ buttons: [{
+
+ title: '百度地图'
+
+ }, {
+
+ title: '高德地图'
+
+ }, {
+
+ title: '谷歌地图'
+
+ }]
+
+ }, function(e) {
+
+ switch (e.index) {
+
+ case 1:
+
+ plus.runtime.openURL(urlBaiduMap);
+
+ break;
+
+ case 2:
+
+ plus.runtime.openURL(urlAmap);
+
+ break;
+
+ case 3:
+
+ url = 'geo:' + lat + ',' + lon + '?q=' +
+ cityName; //如果是国外应用,应该优先使用这个,会启动google地图。这个接口不能统一坐标系,进入百度地图时会有偏差
+
+ plus.runtime.openURL(url);
+ break;
+ }
+
+ });
+
+ } else {
+
+
+ plus.nativeUI.actionSheet({
+
+ title: '选择地图应用',
+
+ cancel: '取消',
+
+ buttons: [{
+
+ title: 'Apple地图'
+
+ }, {
+
+ title: '高德地图'
+
+ }, {
+
+ title: '谷歌地图'
+
+ }]
+
+ }, function(e) {
+
+ console.log('e.index: ' + e.index);
+
+ switch (e.index) {
+
+ case 1:
+
+ url = 'http://maps.apple.com/?q=%e6%95%b0%e5%ad%97%e5%a4%a9%e5%a0%82&ll=' + lat +
+ ',' + lon +
+
+ '&spn=0.008766,0.019441';
+
+ break;
+
+ case 2:
+
+ url = 'baidumap://map/marker?location=' + lat + ',' + lon + '&title=' + cityName +
+ '&src=婚梯';
+
+ break;
+
+ case 3:
+
+ url = 'iosamap://viewMap?sourceApplication=婚梯&poiname=' + cityName + '&lat=' +
+ lat + '&lon=' + lon + '&dev=0';
+
+ break;
+ case 4:
+
+ url = 'geo:' + lat + ',' + lon + '?q=' +
+ cityName; //如果是国外应用,应该优先使用这个,会启动google地图。这个接口不能统一坐标系,进入百度地图时会有偏差
+
+ plus.runtime.openURL(url);
+ break;
+ default:
+
+ break;
+
+ }
+
+ if (url != '') {
+
+ plus.runtime.openURL(url, function(e) {
+
+ plus.nativeUI.alert('本机未安装指定的地图应用');
+
+ });
+
+ }
+
+ });
+
+ }
+
+ },
+ // 删除选中的图片
+ deleteImage(e) {
+ const index = this.uploadImageList.findIndex((item) => item.imageId === e.currentTarget.dataset.imageid);
+ if (index > -1) {
+ this.uploadImageList.splice(index, 1);
+ this.setData({
+ uploadImageList: this.uploadImageList
+ });
+ }
+ },
+ // 代码简化,弹窗统一封装
+ showToast(title) {
+ uni.showToast({
+ title: title,
+ icon: 'none',
+ duration: 2000
+ });
+ },
+
+ // 逆地址解析
+ reverseLocation() {
+
+ let url = 'https://apis.map.qq.com/ws/geocoder/v1/';
+ let data = {
+ location: this.fmData.latitude + "%2C" + this.fmData.longitude,
+ key: 'UDOBZ-KWRKZ-XCZXE-ZFSTS-QPNKV-VKBK7',
+ coord_type: 5,
+ output: 'jsonp',
+ get_poi: 0
+ };
+ this.$jsonp(url, data).then(data => {
+ console.log(data, '当前地址');
+ this.setData({
+ 'fmData.address': data.result.address,
+ 'fmData.longitude': data.result.location.lng,
+ 'fmData.latitude': data.result.location.lat,
+ addressContent: data.result.address
+ })
+ }).catch(err => {
+ console.log(err, '获取地理位置错误')
+ })
+ },
+
+ onConfirmDate(e) {
+ this.setData({
+ 'fmData.happenTime': formatTime(e.value),
+ visibleTime: false,
+ showTime: formatTime(e.value)
+ });
+ console.log(this.fmData.happenTime);
+
+ },
+
+ onConfirmWantServiceTime(e) {
+ this.setData({
+ 'fmData.wantServiceTime': formatTime(e.value),
+ visibleTimeWantServiceTime: false,
+ showWantServiceTimeTime: formatTime(e.value)
+ });
+ },
+
+ bindMobile(e) {
+ this.setData({
+ resiMobile: e.detail.value
+ });
+ },
+
+ getCurrentDateTime() {
+ return new Date().getTime();
+ },
+
+ showTimePicker(e) {
+ this.setData({
+ visibleTime: true,
+ maxDate: this.getCurrentDateTime(),
+ happenTime: this.getCurrentDateTime()
+ });
+ },
+
+ showTimePickerW(e) {
+ this.setData({
+ visibleTimeWantServiceTime: true,
+ maxDate: this.getCurrentDateTime(),
+ happenTime: this.getCurrentDateTime()
+ });
+ },
+
+ handleRecordDel() {
+ const {
+ hasStop,
+ isStart
+ } = this;
+ console.log('hasStop---', this.hasStop);
+ if (isStart && !hasStop) {
+ recorderManager.stop();
+ }
+ if (!hasStop && isStart) {
+ recorderManager.stop();
+ }
+ recorderManager.stop();
+ clearInterval(timer);
+ timer = null;
+ this.setData({
+ recordingTime: '00:00',
+ recordingLength: 0,
+ hasStart: false,
+ isStart: false,
+ hasStop: false,
+ url: '',
+ duration: 0
+ });
+ },
+ //开始拾取音频
+ handleRecord() {
+ if (this.hasStart) {
+ this.this.stopRecognition()
+ clearInterval(timer);
+ this.$refs.recorder.stop()
+ } else {
+ this.startRecognition()
+ this.$refs.recorder.start()
+ }
+ this.hasStart = !this.hasStart
+ },
+ recordingTimer() {
+ clearInterval(timer);
+ timer = null;
+ timer = setInterval(() => {
+ let time = this.recordingLength + 1;
+ this.setData({
+ recordingLength: time,
+ recordingTime: this.formatTime(time)
+ });
+ }, 1000);
+ },
+ handlerSuccess(res) {
+ this.setData({
+ mp3File: res.data,
+ mp3Duration: res.duration
+ })
+ },
+ handleOpenRecord() {
+ this.startRecognition();
+ this.setData({
+ isStart: true
+ });
+ this.recordingTimer()
+ if (this.hasStart) {
+ clearInterval(timer);
+ this.$refs.recorder.stop()
+ } else {
+ this.$refs.recorder.start()
+ }
+ this.hasStart = !this.hasStart
+ },
+
+ // 录音上传
+ uploadRecordFun() {
+ let than = this
+ function blobToFile(blob, fileName = 'recording.mpeg') {
+ const newFileName = fileName.replace(/\.mpeg$/, '.mp3'); // 修改文件名为 mp3
+ return new File([blob], newFileName, {
+ type: 'audio/mp3'
+ });
+ }
+ uni.uploadFile({
+ url: `${config.BASEURL()}oss/file/uploadvoice`,
+ file: blobToFile(than.mp3File, than.mp3File.name),
+ name: 'file',
+ header: {
+ Authorization: uni.getStorageSync('token'),
+ },
+ success: (fileRes) => {
+ uni.hideLoading();
+ console.log('ressss', fileRes);
+ if (!JSON.parse(fileRes.data).data) {
+ uni.showToast({
+ title: '录音上传失败,请重试~',
+ icon: 'none',
+ duration: 1500
+ });
+ this.setData({
+ 'uploadRecord.uploaded': true,
+ 'uploadRecord.url': '',
+ totalTime: '',
+ showRecord: false,
+ hasStart: false,
+ isStart: false,
+ recordingTime: '00:00'
+ });
+ } else {
+ // 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': url,
+ 'fmData.voiceList': [{
+ url: url,
+ format: null,
+ type: 'mp3',
+ duration: than.mp3Duration,
+ originFileName: fileName.toString()
+ }],
+ showRecord: false,
+ hasStart: false,
+ isStart: false,
+ recordingTime: '00:00'
+ });
+ this.downLoadAudio();
+ console.log(this.fmData.voiceList);
+ }
+ },
+ fail: (fileRes) => {
+ console.log(fileRes);
+ uni.showToast({
+ title: '录音上传失败,请重试~',
+ icon: 'none',
+ duration: 1500
+ });
+ this.setData({
+ 'uploadRecord.uploaded': true,
+ 'uploadRecord.url': '',
+ totalTime: ''
+ });
+ }
+ });
+ },
+ // 录音结束
+ recordStop() {
+ this.stopRecognition();
+ clearInterval(timer);
+ this.$refs.recorder.stop();
+ const {
+ mp3File,
+ mp3Duration,
+ hasStop
+ } = this;
+
+ if (!mp3File) {
+ console.log('mp3File 未定义,500 毫秒后重试...');
+ setTimeout(() => {
+ this.recordStop(); // 500 毫秒后再次调用
+ }, 500);
+ return; // 阻止后续代码执行,等待重试
+ }
+
+ this.setData({
+ hasStart: false
+ });
+ uni.showLoading({
+ title: '录音上传中...'
+ });
+
+ console.log(mp3File, mp3Duration, hasStop);
+
+ if (hasStop) {
+ this.uploadRecordFun();
+ console.log('hasStop', hasStop);
+ } else {
+ console.log('hasStopeee', hasStop);
+ clearInterval(timer);
+ timer = null;
+ this.uploadRecordFun();
+ this.setData({
+ recordingLength: 0,
+ totalTime: this.format(duration),
+ });
+ }
+ },
+
+
+
+ formatTime(num) {
+ let min = parseInt(num / 60);
+ let second = num % 60;
+ min = min >= 10 ? min : '0' + min;
+ second = second >= 10 ? second : '0' + second;
+ return min + ':' + second;
+ },
+
+ hancleCancle() {
+ this.setData({
+ showRecord: false
+ });
+ },
+
+ onConfirmReportType(e) {
+ this.setData({
+ reportTypeName: e.value[0],
+ 'fmData.reportType': this.measureList[e.indexs[0]].value,
+ reportTypeVisible: false
+ });
+ console.log(this.fmData, this.measureList);
+ },
+
+ // 需求分类
+ onConfirmMeasure(e) {
+ console.log(e);
+ this.setData({
+ 'fmData.categoryCode': this.measureList[e.indexs[0]].children[e.indexs[1]].value,
+ 'fmData.parentCode': this.measureList[e.indexs[0]].value,
+ categoryName: e.value.join(','),
+ measureVisible: false
+ });
+ },
+
+
+ showMeasurePicker() {
+ this.setData({
+ measureVisible: true
+ });
+ },
+
+
+ handleChangeType(e) {
+ this.setData({
+ tabVal: e.detail.value
+ });
+ },
+
+ handleChangeResponsibleUnit(e) {
+ this.setData({
+ ruTabVal: e.detail.value,
+ 'fmData.responsibleUnit': e.detail.value
+ });
+ },
+ handleChangeOneselfDispose(e) {
+ this.setData({
+ oneselfDispose: e.detail.value,
+ 'fmData.oneselfDispose': e.detail.value
+ });
+ },
+ format(num) {
+ let min = parseInt(num / 1000 / 60);
+ let second = parseInt(num / 1000) % 60;
+ min = min >= 10 ? min : '0' + min;
+ second = second >= 10 ? second : '0' + second;
+ return min + ':' + second;
+ },
+
+ process() {
+ uni.navigateTo({
+ url: `/subpages/myTroubleshootDemand/pages/event/event?id=${this.optionsId}&categoryIds=${this.categoryIds}`
+ });
+ },
+
+ clickSatisfy(e) {
+ const type = e.currentTarget.dataset.satisfy;
+ if (type === 'bad') {
+ this.setData({
+ selGood: false,
+ selPerfect: false,
+ selBad: true
+ });
+ } else if (type === 'good') {
+ this.setData({
+ selGood: true,
+ selPerfect: false,
+ selBad: false
+ });
+ } else if (type === 'perfect') {
+ this.setData({
+ selGood: false,
+ selPerfect: true,
+ selBad: false
+ });
+ }
+ },
+
+ previewImage(e) {
+ const currentUrl = e.currentTarget.dataset.url;
+ uni.previewImage({
+ current: currentUrl,
+ // 当前显示的图片链接
+ urls: [currentUrl] // 只预览当前点击的图片
+ });
+ },
+
+ downloadFile: function(event) {
+ const url = event.currentTarget.dataset.url;
+ uni.downloadFile({
+ url: url,
+ header: {
+ 'Access-Control-Allow-Origin': '*',
+ Authorization: uni.getStorageSync('token'),
+ },
+ success: function(res) {
+ if (res.statusCode === 200) {
+ uni.saveFile({
+ tempFilePath: res.tempFilePath,
+ success: function(res) {
+ uni.showToast({
+ title: '下载成功',
+ icon: 'success'
+ });
+ },
+ fail: function() {
+ uni.showToast({
+ title: '保存失败',
+ icon: 'none'
+ });
+ }
+ });
+ } else {
+ uni.showToast({
+ title: '下载失败',
+ icon: 'none'
+ });
+ }
+ },
+ fail: function() {
+ uni.showToast({
+ title: '下载失败',
+ icon: 'none'
+ });
+ }
+ });
+ },
+
+ changeMeasure(e) {
+ const {
+ columnIndex,
+ value,
+ values, // values为当前变化列的数组内容
+ index,
+ // 微信小程序无法将picker实例传出来,只能通过ref操作
+ picker = this.$refs.uPicker
+ } = e
+ if (columnIndex === 0) {
+ // picker为选择器this实例,变化第二列对应的选项
+ picker.setColumnValues(1, this.measureData[index])
+ }
+ },
+
+ getCategoryList() {
+ console.log('getCategoryList.......');
+ let params = {};
+ getCategoryTree(params).then((res) => {
+ this.setData({
+ casOptions: this.convertLabelToText1(res.data),
+ });
+ });
+ },
+
+ routePlanning() {
+ this.toMapAPP(this.fmData.latitude, this.fmData.longitude, this.fmData.name)
+ },
+
+ bindTextareaFocus() {
+ console.log('占位:函数 bindTextareaFocus 未声明');
+ },
+
+ onVisibleChange() {
+ console.log('占位:函数 onVisibleChange 未声明');
+ }
+ }
+ };
+
+
\ No newline at end of file