diff --git a/app.json b/app.json index f73edce..c05617c 100644 --- a/app.json +++ b/app.json @@ -70,7 +70,8 @@ "root": "subpages/demandCheck", "name": "demandCheck", "pages": [ - "pages/dissatisfied/demandCheck/demandCheck" + "pages/dissatisfied/demandCheck/demandCheck", + "pages/dissatisfied/searchResi/searchResi" ] } diff --git a/pages/work/work.wxml b/pages/work/work.wxml index 13fa1d9..c778ccb 100644 --- a/pages/work/work.wxml +++ b/pages/work/work.wxml @@ -57,7 +57,7 @@ - + 满意度自查 diff --git a/project.private.config.json b/project.private.config.json index ad7f2a0..53d4e06 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -8,6 +8,13 @@ "condition": { "miniprogram": { "list": [ + { + "name": "选择居民", + "pathName": "subpages/demandCheck/pages/dissatisfied/searchResi/searchResi", + "query": "", + "launchMode": "default", + "scene": null + }, { "name": "诉求摸排", "pathName": "subpages/demandCheck/pages/dissatisfied/demandCheck/demandCheck", @@ -116,5 +123,5 @@ ] } }, - "libVersion": "3.0.2" + "libVersion": "3.1.0" } \ No newline at end of file diff --git a/subpages/demandCheck/images/bf.png b/subpages/demandCheck/images/bf.png new file mode 100644 index 0000000..a3fda15 Binary files /dev/null and b/subpages/demandCheck/images/bf.png differ diff --git a/subpages/demandCheck/images/dianji.png b/subpages/demandCheck/images/dianji.png deleted file mode 100644 index f9c8297..0000000 Binary files a/subpages/demandCheck/images/dianji.png and /dev/null differ diff --git a/subpages/demandCheck/images/ic_yitidingwei@2x.png b/subpages/demandCheck/images/ic_yitidingwei@2x.png deleted file mode 100644 index d4b80cd..0000000 Binary files a/subpages/demandCheck/images/ic_yitidingwei@2x.png and /dev/null differ diff --git a/subpages/demandCheck/images/sc.png b/subpages/demandCheck/images/sc.png new file mode 100644 index 0000000..f5bed10 Binary files /dev/null and b/subpages/demandCheck/images/sc.png differ diff --git a/subpages/demandCheck/images/selct.png b/subpages/demandCheck/images/selct.png new file mode 100644 index 0000000..581ac77 Binary files /dev/null and b/subpages/demandCheck/images/selct.png differ diff --git a/subpages/demandCheck/images/tupian.png b/subpages/demandCheck/images/tupian.png deleted file mode 100644 index a0544fc..0000000 Binary files a/subpages/demandCheck/images/tupian.png and /dev/null differ diff --git a/subpages/demandCheck/images/xiaobofang.png b/subpages/demandCheck/images/xiaobofang.png deleted file mode 100644 index 65fd3bf..0000000 Binary files a/subpages/demandCheck/images/xiaobofang.png and /dev/null differ diff --git a/subpages/demandCheck/images/xiaozanting.png b/subpages/demandCheck/images/xiaozanting.png deleted file mode 100644 index 6813144..0000000 Binary files a/subpages/demandCheck/images/xiaozanting.png and /dev/null differ diff --git a/subpages/demandCheck/images/yuyin.png b/subpages/demandCheck/images/yuyin.png deleted file mode 100644 index 6a000c3..0000000 Binary files a/subpages/demandCheck/images/yuyin.png and /dev/null differ diff --git a/subpages/demandCheck/images/zanting.png b/subpages/demandCheck/images/zanting.png deleted file mode 100644 index 7b6ae0b..0000000 Binary files a/subpages/demandCheck/images/zanting.png and /dev/null differ diff --git a/subpages/demandCheck/images/zt.png b/subpages/demandCheck/images/zt.png new file mode 100644 index 0000000..4c368f7 Binary files /dev/null and b/subpages/demandCheck/images/zt.png differ diff --git a/subpages/demandCheck/pages/dissatisfied/demandCheck/demandCheck.js b/subpages/demandCheck/pages/dissatisfied/demandCheck/demandCheck.js index 53a331f..bb78275 100644 --- a/subpages/demandCheck/pages/dissatisfied/demandCheck/demandCheck.js +++ b/subpages/demandCheck/pages/dissatisfied/demandCheck/demandCheck.js @@ -1,1012 +1,1027 @@ -var api = require('../../../../../utils/api') import { $wuxActionSheet } from '../../../../../components/dist/index' const QQMapWX = require('../../../../../utils/qqmap-wx-jssdk') const config = require('../../../../../utils/config') const app = getApp() var recorderManager = wx.getRecorderManager(); +var innerAudioContext = wx.createInnerAudioContext() +import api from "../../../../../utils/api" var timer; Page({ - /** - * 页面的初始数据 - */ - data: { - fmData: { - time:'', - grid:'' - }, - minDate:'2018-01-01 00:00:00', - timeLabel:'', - - placeholderShow: true, - uploadImageList: [], - streetList: [], // 街道 - imageId: 1, - addressContent: '', - address: '', - - - overDuration: 600000, - duration: 0, - url: '', - hasStop: false, - hasStart: false, // 录音开始 暂停 - isStart: false, // 是否开启录音 - recordingTime: '00:00', - recordingLength: 0, - setInter: null, - - recorderData: {}, // 录音文件数据 - recorderTimeMax: "", // 00:00 - recorderTimeCur: "", // 00:00 - showRecord: false, // 是否显示录音sheet - isRecord: 0, // 是否开始录音 0-未开始 1-正在录音 2-录音完成 - recordingTime: 0, // 计时器 - isPlayAudio: false, // 上传的音频播放状态 - audioTimeline: 0, // 当前播放值 - uploadRecord: { - uploaded: true, - url: "" - }, - recorderDuration: "", // 录音时长 - submitDisabled: false, - - // 时间组件 - visibleTime: false, - - angencyList:[{ - agencyName:'测试', - agencyId:'cnmmmm', - subAgencyList:[ - { - agencyName:'测试1', - agencyId:'cnmmmm1', - subAgencyList:[ - { - agencyId:'cnmmmm2', - agencyName:'测试2', - subAgencyList:null - } - ] - } - ] - }], - defaultFieldNames:{label:'agencyName',value:'agencyId',children:'subAgencyList'}, - angencyVisible:false, - angencyValue:[], - }, - - /** - * 生命周期函数--监听页面加载 - */ - onLoad(options) { - this.data.qqMapWX = new QQMapWX({ - key: 'CMJBZ-4DECI-JXGGN-5B4WU-QLV2H-B5BEJ' - }) - this.getLocation().then(() => { - this.reverseLocation() - }) - this.setData({ - 'fmData.time':Date.now(), - }) - this.getAgencygridtree() - }, - // 组织树 - getAgencygridtree(){ - api.getAgencygridtree().then(res=>{ - this.setData({ - angencyList:[res.data] - }) - console.log(this.data.angencyList); - }).catch(err=>{ - console.log(err); - }) - }, - - - // 触底函数 - onReachBottom() { - if (this.projectlist) { - this.projectlist.onReachBottom() - } - }, - - toughGetLocation() { - this.getLocation(false); - wx.chooseLocation({ - success: res => { - console.log('resadddres', res) - const { fmData } = this.data; - this.setData({ + /** + * 页面的初始数据 + */ + data: { fmData: { - ...fmData, - addressContent: res.address, - longitude: res.longitude, - latitude: res.latitude + time: '', + gridId: '', + attachmentList:[],//图片 + voiceList:[], + latitude:"", + longitude:"", + resiId:"1698525635288653825", + happenTime:"", + content:"",//内容 + address:""//地址 }, - }); - } - }) - }, - showRecordSheet () { - this.setData({ - showRecord: true, - recorderData: {}, - recorderTimeMax: "00:00", - recorderTimeCur: "00:00", - isRecord: 0, - recordingTime: 0, - uploadRecord: { - uploaded: true, - url: "" - } - }) -}, - // 获取经纬度 - getLocation() { - return new Promise((resolve, reject) => { - const _this = this - wx.getLocation({ - type: 'gcj02', - success(res) { - if (res.latitude && res.longitude) { - _this.setData({ - 'personalInfo.issueLatitude': res.latitude, - 'personalInfo.issueLongitude': res.longitude - }) - resolve(true) - } + minDate: '2018-01-01 00:00:00', + timeLabel: '', + + uploadImageList: [],//图片上传的数组 + streetList: [], // 街道 + imageId: 1, + addressContent: '', + + overDuration: 600000, + duration: 0, + url: '', + hasStop: false, + hasStart: false, // 录音开始 暂停 + isStart: false, // 是否开启录音 + recordingTime: '00:00', + recordingLength: 0, + setInter: null, + showRecord: false, // 是否显示录音sheet + uploadRecord: { + uploaded: true, + url: "" }, - fail(err) { - reject(err) - } - }) - }) - }, + totalTime: "00:00", // 录音时长 + submitDisabled: false, - - // 提交按钮 - submitPersonalInfo() { - if (!this.data.addressContent) { - return this.showToast('请选择事件位置') - } - if (!this.data.personalInfo.streetId) { - return this.showToast('请选择所属街道') - } - if (!this.data.personalInfo.communityId) { - return this.showToast('请选择所属社区') - } - if (!this.data.personalInfo.gridId) { - return this.showToast('请选择所属网格') - } - if (!this.data.personalInfo.contactName) { - return this.showToast('请填写联系人姓名') - } - - if (!this.data.personalInfo.mobile) { - return this.showToast('请填写手机号') - } - if (!this.data.personalInfo.itemContent) { - return this.showToast('请填写问题描述') - } - if (this.data.personalInfo.itemContent.length < 11) { - return this.showToast('问题描述不少于 10 字') - } - // 如果我上报时候没有提交“详细地址”,电脑pc端的位置就是应该显示事件位置 - if (!this.data.personalInfo.issueAddress || this.data.personalInfo.issueAddress.length == 0) { - this.setData({ - 'personalInfo.issueAddress': this.data.addressContent - }) - } else { - this.setData({ - 'personalInfo.issueAddress': this.data.addressContent + this.data.personalInfo.issueAddress - }) - } - const imagesList = [] - if (this.data.uploadImageList.length > 0) { - const isUploadDown = this.data.uploadImageList.some(item => !item.uploaded) - if (isUploadDown) { - wx.showToast({ - title: '请等待图片上传完成', - icon: 'none', - duration: 1000 - }) - return false - } - } - if (this.data.uploadImageList.length > 0) { - this.data.uploadImageList.forEach(item => { - imagesList.push(item.ossUrl) - }) - } - this.setData({ - 'personalInfo.images': imagesList, - 'personalInfo.itemVoice': this.data.uploadRecord.url, - 'personalInfo.duration': this.data.recorderDuration - }) - if (this.data.isNewUser) { // 新用户 - this.setData({ - formSub: true - }) - this.getTokenV3() // 通过gridId 拿到userId - } else { // 老用户 - console.log('直接调接口') - this.submitItem() - // this.submitPersonalInfoByWx() - } - }, + // 时间组件 + visibleTime: false, - - - // 提交接口 - submitItem() { - wx.showLoading({ - title: '提交中...', - mask: true - }) - this.setData({ - submitDisabled: true - }) - const para = this.data.personalInfo - submitItem(para).then(res => { - wx.hideLoading() - if (res.data) { - wx.showModal({ - title: '提示', - content: `您的诉求我们已经查收,正在快马加鞭办理,请您耐心等待\r\n诉求编号为:${res.data}`, - confirmText: '确认', - showCancel: false, - success: res => { + angencyList: [],//组织下拉数据 + angencyId:"", + totalMax: 0, + stepValue: 0, + hasPlay: false, + playUrl: "", + + // defaultFieldNames: { label: 'agencyName', value: 'agencyId', children: 'subAgencyList' }, + angencyVisible: false, + angencyValue: [], + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + console.log(options); + if(options.resiId){ this.setData({ - submitDisabled: false, - 'personalInfo.nickname': '', - 'personalInfo.itemContent': '', - 'personalInfo.itemVoice': '', - 'personalInfo.duration': '', - 'personalInfo.images': [], - 'personalInfo.contactName': '', - 'personalInfo.issueAddress': '', - uploadImageList: [], - recorderData: {}, - uploadRecord: { - uploaded: true, - url: "" - }, + "fmData.resiId":options.resiId, + resiName:options.resiName, + resiMobile:options.mobile }) - this.projectlist = this.selectComponent('#projectlist') - } + } + this.data.qqMapWX = new QQMapWX({ + key: 'CMJBZ-4DECI-JXGGN-5B4WU-QLV2H-B5BEJ' }) - } else { - wx.showToast({ - title: "提交失败,请重试~", - icon: "none", - duration: 1500 + this.getLocation().then(() => { + this.reverseLocation() }) this.setData({ - submitDisabled: false + 'fmData.time': Date.now(), + angencyId:app.globalData.user.agencyId }) - } - }).catch(err => { - console.log(err) - wx.hideLoading() - this.setData({ - submitDisabled: false - }) - }) - }, - // 我是居民/我是党员/我是企业 tab切换 - - // 详细地址 - bindIssueAddressInput(e) { - this.setData({ - 'personalInfo.issueAddress': e.detail.value - }) - }, - bindContactNameInput(e) { - this.setData({ - 'personalInfo.contactName': e.detail.value - }) - }, - // 手机号 双向绑定 - bindMobileInput(e) { - this.setData({ - 'personalInfo.mobile': e.detail.value - }) - }, - // 双向绑定 地址输入框 - bindAddressInput(e) { - this.setData({ - addressContent: e.detail.value - }) - }, - // 解决ios占位符遮挡问题 - bindTextareaFocus() { - this.setData({ - placeholderShow: false, - }) - }, - // 解决ios占位符遮挡问题 - bindTextareaBlur(e) { - this.setData({ - 'personalInfo.itemContent': e.detail.value - }) - if (this.data.personalInfo.itemContent.length == 0) { - this.setData({ - placeholderShow: true - }) - } - }, - // 双向绑定 内容输入框 - bindTextareaInput(e) { - this.setData({ - 'personalInfo.itemContent': e.detail.value - }) - }, - - - - - // 点击空白,隐藏sheet - onHideSheet() { - this.setData({ - showRecord: false - }) - }, - - // - countRecordTimeline() { - clearInterval(this.data.setInter) - this.data.setInter = setInterval(() => { - this.setData({ - recordingTime: this.data.recordingTime + 1 - }, () => { - if (this.data.recordingTime < 10) { - this.setData({ - recorderTimeCur: "00:0" + this.data.recordingTime - }) - } else { - this.setData({ - recorderTimeCur: "00:" + this.data.recordingTime - }) + this.getAgencygridtree() + }, + // 组织树 + getAgencygridtree() { + let parm ={ + agencyId:this.data.angencyId, + purpose:'query' } - if (!this.data.showRecord) { - let max = Math.ceil(this.data.recorderData.duration / 1000) - let value = parseFloat(this.data.recordingTime / max).toFixed(2) - this.setData({ - audioTimeline: value * 100 - }) + api.getGridoptionDict(parm).then(res => { + console.log(res); + this.setData({ + angencyList: res.data + }) + }).catch(err => { + console.log(err); + }) + }, + + + // 触底函数 + onReachBottom() { + if (this.projectlist) { + this.projectlist.onReachBottom() } - }) - }, 1000) - }, - - sliderchange() { - let max = Math.ceil(this.data.recorderData.duration / 1000) - let value = parseFloat(this.data.recordingTime / max).toFixed(2) - this.setData({ - audioTimeline: value * 100 - }) - }, - - handleTimeChange(e) { - let { personalInfo } = this.data - const { dateTimeArray, dateTime } = e.detail - personalInfo.reportTime = `${dateTimeArray[0][dateTime[0]]}-${dateTimeArray[1][dateTime[1]]}-${dateTimeArray[2][dateTime[2]]} ${dateTimeArray[3][dateTime[3]]}:${dateTimeArray[4][dateTime[4]]}:${dateTimeArray[5][dateTime[5]]}` - console.log('change', e.detail) - this.setData({ - personalInfo - }) - }, - - // 录音end - // 选择图片 上传弹窗 - 上传图片方式 - 选择图片 - 上传图片 - 回调赋值 - chooseImage() { - if (this.data.uploadImageList.length > 9) { - wx.showToast({ - title: "最多上传10张照片", - icon: "none" - }) - return - } - const _this = this - $wuxActionSheet().showSheet({ - buttons: [ - { text: '拍照' }, - { text: '从相册中获取' }, - ], - className: 'dialog-class', - buttonClicked(index) { - if (index === 0) { - wx.chooseImage({ - count: 1, - sizeType: ['original', 'compressed'], - sourceType: ['camera'], - success(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 + }, + + toughGetLocation() { + this.getLocation(false); + wx.chooseLocation({ + success: res => { + console.log('resadddres', res) + const { fmData } = this.data; + this.setData({ + fmData: { + ...fmData, + address:res.address, + longitude: res.longitude, + latitude: res.latitude + }, + }); + console.log(this.data.fmData); + } + }) + }, + showRecordSheet() { + this.setData({ + showRecord: true, + recorderData: {}, + recordingTime: "0:00", + uploadRecord: { + uploaded: true, + url: "" + } + }) + }, + // 获取经纬度 + getLocation() { + return new Promise((resolve, reject) => { + const _this = this + wx.getLocation({ + type: 'gcj02', + success(res) { + if (res.latitude && res.longitude) { + _this.setData({ + 'personalInfo.issueLatitude': res.latitude, + 'personalInfo.issueLongitude': res.longitude + }) + resolve(true) + } + }, + fail(err) { + reject(err) + } + }) + }) + }, + + + // 提交按钮 + submitPersonalInfo() { + const imagesList = [] + if (this.data.uploadImageList.length > 0) { + const isUploadDown = this.data.uploadImageList.some(item => !item.uploaded) + if (isUploadDown) { + wx.showToast({ + title: '请等待图片上传完成', + icon: 'none', + duration: 1000 }) - } else { - _this.showToast('图片上限5M,请压缩后重试~') return false - } - _this.setData({ - uploadImageList - }) - wx.uploadFile({ - url: `${config.BASEURL()}oss/file/uploadvariedfile`, - filePath: res.tempFilePaths[0], - name: 'file', - header: { - 'Content-type': 'application/json;charset=UTF-8', - 'Authorization': wx.getStorageSync('token') - }, - success(fileRes) { - if (!JSON.parse(fileRes.data).data) { - _this.showToast('图片上传失败,请重试~') - // 删除 - const index = _this.data.uploadImageList.findIndex(item => item.imageId === _this.data.imageId) - if (index > -1) { - _this.data.uploadImageList.splice(index, 1) - _this.setData({ - uploadImageList: _this.data.uploadImageList - }) + } + } + if (this.data.uploadImageList.length > 0) { + this.data.uploadImageList.forEach(item => { + imagesList.push(item.ossUrl) + }) + } + this.setData({ + 'fmData.attachmentList': imagesList, + }) + console.log(this.data.fmData); + this.submitItem() + }, + + + + // 提交接口 + submitItem() { + wx.showLoading({ + title: '提交中...', + mask: true + }) + this.setData({ + submitDisabled: true + }) + const para = this.data.fmData + para.resiId = '1501821695344775169' + para.gridId = '9c55c566524a8b171df57a792d2933bd' + para.happenTime = '2023-04-05 03:07:00' + api.addEvent(para).then(res => { + wx.hideLoading() + console.log(res); + if (res.data) { + wx.showModal({ + title: '提示', + content: `您的诉求我们已经查收,正在快马加鞭办理,请您耐心等待\r\n诉求编号为:${res.data}`, + confirmText: '确认', + showCancel: false, + success: res => { + this.setData({ + submitDisabled: false, + 'personalInfo.nickname': '', + 'personalInfo.itemContent': '', + 'personalInfo.itemVoice': '', + 'personalInfo.duration': '', + 'personalInfo.images': [], + uploadImageList: [], + uploadRecord: { + uploaded: true, + url: "" + }, + }) + this.projectlist = this.selectComponent('#projectlist') } - } else { - uploadImageList[uploadImageList.length - 1].uploaded = true - uploadImageList[uploadImageList.length - 1].ossUrl = JSON.parse(fileRes.data).data - _this.setData({ - uploadImageList + }) + } else { + wx.showToast({ + title: "提交失败,请重试~", + icon: "none", + duration: 1500 + }) + this.setData({ + submitDisabled: false + }) + } + }).catch(err => { + console.log(err) + wx.hideLoading() + this.setData({ + submitDisabled: false + }) + }) + }, + + + // 双向绑定 内容输入框 + bindTextareaInput(e) { + this.setData({ + 'fmData.content': e.detail.value + }) + console.log(this.data.fmData); + }, + + // 点击空白,隐藏sheet + onHideSheet() { + this.setData({ + showRecord: false + }) + }, + + + // 录音end + // 选择图片 上传弹窗 - 上传图片方式 - 选择图片 - 上传图片 - 回调赋值 + chooseImage() { + if (this.data.uploadImageList.length > 3) { + wx.showToast({ + title: "最多上传3张照片", + icon: "none" + }) + return + } + const _this = this + $wuxActionSheet().showSheet({ + buttons: [ + { text: '拍照' }, + { text: '从相册中获取' }, + ], + className: 'dialog-class', + buttonClicked(index) { + if (index === 0) { + wx.chooseImage({ + count: 1, + sizeType: ['original', 'compressed'], + sourceType: ['camera'], + success(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 + }) + } else { + _this.showToast('图片上限5M,请压缩后重试~') + return false + } + _this.setData({ + uploadImageList + }) + wx.uploadFile({ + url: `${config.BASEURL()}oss/file/uploadvariedfile`, + filePath: res.tempFilePaths[0], + name: 'file', + header: { + 'Content-type': 'application/json;charset=UTF-8', + 'Authorization': wx.getStorageSync('token') + }, + success(fileRes) { + if (!JSON.parse(fileRes.data).data) { + _this.showToast('图片上传失败,请重试~') + // 删除 + const index = _this.data.uploadImageList.findIndex(item => item.imageId === _this.data.imageId) + if (index > -1) { + _this.data.uploadImageList.splice(index, 1) + _this.setData({ + uploadImageList: _this.data.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 (index === 1) { + wx.chooseImage({ + count: 1, + sizeType: ['original', 'compressed'], + sourceType: ['album'], + success(res) { + console.log(res,'图片上传的res'); - }, - fail(fileRes) { - _this.setData({ - uploadImageList: [] - }) - _this.showToast('图片上传失败,请重试~') - } - }) - } - }) - } else if (index === 1) { - wx.chooseImage({ - count: 1, - sizeType: ['original', 'compressed'], - sourceType: ['album'], - success(res) { - let deleteLength = _this.data.uploadImageList.length - const uploadImageList = [] - const endIndex = _this.data.uploadImageList.length - res.tempFiles.forEach(item => { - if (item.size <= 5 * 1024 * 1024) { - uploadImageList.push({ - uploaded: false, - ossUrl: '', - imgUrl: item.path, - imageId: ++_this.data.imageId - }) - } else { - _this.showToast('图片上限5M,请压缩后重试~') + let deleteLength = _this.data.uploadImageList.length + const uploadImageList = [] + const endIndex = _this.data.uploadImageList.length + res.tempFiles.forEach(item => { + if (item.size <= 5 * 1024 * 1024) { + uploadImageList.push({ + uploaded: false, + ossUrl: '', + imgUrl: item.path, + imageId: ++_this.data.imageId + }) + } else { + _this.showToast('图片上限5M,请压缩后重试~') + } + }) + _this.setData({ + uploadImageList: [..._this.data.uploadImageList, ...uploadImageList] + }) + uploadImageList.forEach((item, index) => { + return (function (index) { + wx.uploadFile({ + url: `${config.BASEURL()}oss/file/uploadvariedfile`, + filePath: res.tempFilePaths[index], + name: 'file', + header: { + 'Content-type': 'application/json;charset=UTF-8', + 'Authorization': wx.getStorageSync('token') + }, + success(fileRes) { + if (!JSON.parse(fileRes.data).data) { + _this.showToast('图片上传失败,请重试~') + _this.data.uploadImageList.splice(deleteLength, _this.data.uploadImageList.length - deleteLength) + _this.setData({ + uploadImageList: _this.data.uploadImageList + }) + } else { + uploadImageList[index].uploaded = true + uploadImageList[index].ossUrl = JSON.parse(fileRes.data).data + _this.data.uploadImageList = _this.data.uploadImageList.slice(0, endIndex) + _this.setData({ + uploadImageList: [..._this.data.uploadImageList, ...uploadImageList] + }) + } + console.log(_this.data.uploadImageList.length, '图片上传长度'); + }, + fail(fileRes) { + _this.setData({ + uploadImageList: [] + }) + _this.showToast('图片上传失败,请重试~') + } + }) + })(index) + }) + } + }) } - }) - _this.setData({ - uploadImageList: [..._this.data.uploadImageList, ...uploadImageList] - }) - uploadImageList.forEach((item, index) => { - return (function (index) { - wx.uploadFile({ - url: `${config.BASEURL()}oss/file/uploadvariedfile`, - filePath: res.tempFilePaths[index], - name: 'file', - header: { - 'Content-type': 'application/json;charset=UTF-8', - 'Authorization': wx.getStorageSync('token') - }, - success(fileRes) { - if (!JSON.parse(fileRes.data).data) { - _this.showToast('图片上传失败,请重试~') - _this.data.uploadImageList.splice(deleteLength, _this.data.uploadImageList.length - deleteLength) - _this.setData({ - uploadImageList: _this.data.uploadImageList - }) - } else { - uploadImageList[index].uploaded = true - uploadImageList[index].ossUrl = JSON.parse(fileRes.data).data - _this.data.uploadImageList = _this.data.uploadImageList.slice(0, endIndex) - _this.setData({ - uploadImageList: [..._this.data.uploadImageList, ...uploadImageList] + return true + }, + cancelText: '取消', + cancel() { }, + destructiveButtonClicked() { }, + }) + }, + // 删除选中的图片 + deleteImage(e) { + const index = this.data.uploadImageList.findIndex(item => item.imageId === e.currentTarget.dataset.imageid) + if (index > -1) { + this.data.uploadImageList.splice(index, 1) + this.setData({ + uploadImageList: this.data.uploadImageList + }) + } + }, + // 代码简化,弹窗统一封装 + showToast(title) { + wx.showToast({ + title: title, + icon: 'none', + duration: 2000 + }) + }, + + // 街道社区 + 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 // 社区 }) - } - console.log(_this.data.uploadImageList.length, '图片上传长度'); - }, - fail(fileRes) { - _this.setData({ - uploadImageList: [] - }) - _this.showToast('图片上传失败,请重试~') + // 循环社区 + 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 // 网格 + }) + } + }); } - }) - })(index) - }) + }); } - }) + }).catch(err => { + console.log(err) + }) + }, + // 单选点击事件 + inputSyncPicker(e) { + let { + detail: { value }, + currentTarget: { + dataset: { idKey, nameKey, listName, subname, subindex }, + }, + } = e; + let item = this.data[listName][value]; + let { personalInfo } = this.data; + if (subname && subindex !== undefined) { + personalInfo[subname][subindex][idKey] = item.value; + personalInfo[subname][subindex][nameKey] = item.label; + } else { + personalInfo[idKey] = item.value; + personalInfo[nameKey] = item.label; } - return true - }, - cancelText: '取消', - cancel() { }, - destructiveButtonClicked() { }, - }) - }, - // 删除选中的图片 - deleteImage(e) { - const index = this.data.uploadImageList.findIndex(item => item.imageId === e.currentTarget.dataset.imageid) - if (index > -1) { - this.data.uploadImageList.splice(index, 1) - this.setData({ - uploadImageList: this.data.uploadImageList - }) - } - }, - // 代码简化,弹窗统一封装 - showToast(title) { - wx.showToast({ - title: title, - icon: 'none', - duration: 2000 - }) - }, - - // 街道社区 - 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 }); + + this.dataHandle(listName) + + }, + dataHandle(listName) { + if (listName == 'streetList') { this.setData({ - 'personalInfo.street': element.label, - communityList: element.children // 社区 + communityList: [], + gridList: [], + 'personalInfo.community': '', // 社区 + 'personalInfo.communityId': '', // 社区 + + }) + } else if (listName == 'communityList') { + this.setData({ + gridList: [], + 'personalInfo.grid': '', // 网格 + 'personalInfo.gridId': '' // 网格 }) - // 循环社区 - 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 { - detail: { value }, - currentTarget: { - dataset: { idKey, nameKey, listName, subname, subindex }, - }, - } = e; - let item = this.data[listName][value]; - let { personalInfo } = this.data; - if (subname && subindex !== undefined) { - personalInfo[subname][subindex][idKey] = item.value; - personalInfo[subname][subindex][nameKey] = item.label; - } else { - personalInfo[idKey] = item.value; - personalInfo[nameKey] = item.label; - } - - this.setData({ personalInfo }); - - this.dataHandle(listName) - - }, - dataHandle(listName) { - if (listName == 'streetList') { - this.setData({ - communityList: [], - gridList: [], - 'personalInfo.community': '', // 社区 - 'personalInfo.communityId': '', // 社区 - 'personalInfo.grid': '', // 网格 - 'personalInfo.gridId': '' // 网格 - }) - } else if (listName == 'communityList') { - this.setData({ - gridList: [], - 'personalInfo.grid': '', // 网格 - 'personalInfo.gridId': '' // 网格 - }) - } - if (this.data.personalInfo.streetId) { // 选择街道 - this.data.streetList.forEach((element, index) => { - if (this.data.personalInfo.streetId == element.value) { - this.setData({ - communityList: element.children - }) } - }); - } - if (this.data.personalInfo.communityId) { // 选择社区 - this.data.communityList.forEach((element, index) => { - if (this.data.personalInfo.communityId == element.value) { - this.setData({ - gridList: element.children - // 'personalInfo.grid': element.children[0].label, // 网格默认选择第一个 - // 'personalInfo.gridId': element.children[0].value // 网格 - }) + if (this.data.personalInfo.streetId) { // 选择街道 + this.data.streetList.forEach((element, index) => { + if (this.data.personalInfo.streetId == element.value) { + this.setData({ + communityList: element.children + }) + } + }); } - }); - } - }, - // 逆地址解析 - reverseLocation() { - const _this = this - this.data.qqMapWX.reverseGeocoder({ - location: { - latitude: _this.data.personalInfo.issueLatitude, - longitude: _this.data.personalInfo.issueLongitude - }, - success(res) { - _this.setData({ - fmData: { - addressContent: res.result.address, - address: res.result.address, - }, - }) - }, - fail(err) { - console.debug(err) - } - }) - }, - - onConfirmDate(e) { - console.log(e); - this.setData({ - 'fmData.time': e.detail.label, - timeLabel: e.detail.displayValue.join(' '), - visibleTime:false - }) - console.log(this.data.fmData.time) - }, - // onVisibleChange(e) { - // this.setData({ - // // timeLabel: e.detail.displayValue.join(' '), - // }) - // }, - onCancel(){ - this.setData({ - visibleTime:false - }) - }, - showTimePicker(){ - this.setData({ - visibleTime:true - }) - }, - onPageScroll: function (e) { - if (this.projectlist) { - this.projectlist.onPageScroll(e) - } - }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady() { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow() { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide() { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload() { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh() { - - }, - - - /** - * 用户点击右上角分享 - */ - // /page/user?id=123 - onShareAppMessage() { - return { - path: 'pages/peopleLivelihood/peopleLivelihood', - } - }, - handleRecordDel() { - const { hasStop, isStart } = this.data - console.log('hasStop---', this.data.hasStop) - if (isStart && !hasStop) { - recorderManager.stop() - } - // if (!hasStop && hasStart) 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() { - let { hasStart } = this.data - console.log(hasStart); - if (hasStart) this.recortPause() - else this.recortResume() - }, - handleOpenRecord() { - this.setData({ - isStart: true, - }); - console.log('opppppp') - this.recordStart() - }, - // 录音暂停 - recortPause() { - recorderManager.pause(); - this.setData({ - hasStart: false - }) - clearInterval(timer) - timer = null - }, - // 录音继续 - recortResume() { - this.recordingTimer() - recorderManager.resume(); - this.setData({ - hasStart: true - }) - - }, - - uploadRecord(file, duration) { - console.log(file,duration); - wx.uploadFile({ - url: `${config.BASEURL()}oss/file/uploadvoice`, - filePath: file, - name: "file", - header: { - "Content-type": "multipart/form-data", - 'Authorization': wx.getStorageSync('token') - }, - success: (fileRes) => { - wx.hideLoading() - console.log('ressss', fileRes) - if (!JSON.parse(fileRes.data).data) { - wx.showToast({ - title: "录音上传失败,请重试~", - icon: "none", - duration: 1500 - }) - this.setData({ - "uploadRecord.uploaded": true, - "uploadRecord.url": "", - recorderDuration: "", - recorderData: {} - }) - } else { - this.setData({ - "uploadRecord.uploaded": true, - "uploadRecord.url": JSON.parse(fileRes.data).data - }) - console.log(this.data.uploadRecord); + if (this.data.personalInfo.communityId) { // 选择社区 + this.data.communityList.forEach((element, index) => { + if (this.data.personalInfo.communityId == element.value) { + this.setData({ + gridList: element.children + // 'personalInfo.grid': element.children[0].label, // 网格默认选择第一个 + // 'personalInfo.gridId': element.children[0].value // 网格 + }) + } + }); } }, - fail: (fileRes) => { - console.log(fileRes); - wx.showToast({ - title: "录音上传失败,请重试~", - icon: "none", - duration: 1500 + // 逆地址解析 + reverseLocation() { + const _this = this + this.data.qqMapWX.reverseGeocoder({ + 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 + }, + }) + }, + fail(err) { + console.debug(err) + } }) + }, + + onConfirmDate(e) { + console.log(e); this.setData({ - "uploadRecord.uploaded": true, - "uploadRecord.url": "", - recorderDuration: "", - recorderData: {} + 'fmData.happenTime': e.detail.label + ':00', + timeLabel: e.detail.displayValue.join(' '), + visibleTime: false }) - } - }) - }, - // 录音开始 - recordStart() { - this.setData({ - hasStart: true, - }); - const options = { - duration: this.data.overDuration, - format: 'mp3', - type: 'voice' - }; - this.recordingTimer() - recorderManager.start(options); - recorderManager.onStart(res => { - console.log('recorder start', res); - }); - recorderManager.onPause(res => { - console.log('onPause', res) - }) - console.log(recorderManager); - recorderManager.onResume(res => { - console.log('onResume', res) - }) - recorderManager.onStop((res) => { - console.log('recorder stop', res); - const { tempFilePath, duration } = res; + }, + onVisibleChange(e) { this.setData({ - hasStop: true, - url: tempFilePath, - duration + // timeLabel: e.detail.displayValue.join(' '), }) - // - }); - recorderManager.onFrameRecorded(res => { - console.log('onFrameRecorded', res) - }) - recorderManager.onError((res) => { - console.log('recorder onError', res); - wx.showToast({ - title: res.errMsg, - icon: 'none', - duration: 1500 - }) - }); - }, - // 录音暂停 - recortPause() { - recorderManager.pause(); - this.setData({ - hasStart: false - }) - clearInterval(timer) - timer = null - }, - // 录音继续 - recortResume() { - this.recordingTimer() - recorderManager.resume(); - this.setData({ - hasStart: true - }) - - }, - // 录音结束 - recordStop() { - const { url, duration, hasStop } = this.data - this.setData({ - hasStart: false - }) - wx.showLoading({ - title: '录音上传中...' - }) - - console.log(url, duration, hasStop) - - if (hasStop) { - this.uploadRecord(url, 600000) - console.log('hasStop', hasStop) - } else { - console.log('hasStopeee', hasStop) - recorderManager.stop(); - clearInterval(timer) - timer = null - recorderManager.onStop((res) => { - console.log('recorder stop1111', res); - const { tempFilePath, duration } = res; - this.uploadRecord(tempFilePath, duration) - // - }); - } - - }, - - recordingTimer() { - clearInterval(timer) - timer = null - timer = setInterval(() => { - let { overDuration, recordingLength } = this.data - if (recordingLength * 1000 >= overDuration) { - wx.showToast({ - title: '录音已超时,已停止录音', - icon: 'none', - duration: 1500 + }, + onCancel() { + this.setData({ + visibleTime: false + }) + }, + showTimePicker() { + this.setData({ + visibleTime: true }) - console.log('lllllllll超时了') + }, + onPageScroll: function (e) { + if (this.projectlist) { + this.projectlist.onPageScroll(e) + } + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + + /** + * 用户点击右上角分享 + */ + // /page/user?id=123 + onShareAppMessage() { + return { + path: 'pages/peopleLivelihood/peopleLivelihood', + } + }, + handleRecordDel() { + const { hasStop, isStart } = this.data + console.log('hasStop---', this.data.hasStop) + if (isStart && !hasStop) { + recorderManager.stop() + } + if (!hasStop && isStart) recorderManager.stop(); recorderManager.stop(); clearInterval(timer) timer = null this.setData({ - hasStart: false + recordingTime: '00:00', + recordingLength: 0, + hasStart: false, + isStart: false, + hasStop: false, + url: '', + duration: 0 }) - return - } - let time = this.data.recordingLength + 1; - this.setData({ - recordingLength: time, - recordingTime: this.formatTime(time) - }); - console.log('timer,还在执行') - }, 1000); - }, - 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.handleRecordDel() - this.setData({ - showRecord:false - }) - }, - hidePicker(){ - this.setData({ - angencyVisible:false - }) - }, - showPicker(){ - this.setData({ - angencyVisible:true - }) - }, - onConfirmAngecy(e){ - console.log(e); - this.setData({ - agencyName:e.detail.label, - 'form.grid':e.detail.value[e.detail.value.length - 1], - angencyVisible:false - }) - console.log(this.form); - }, - onValueChange(e){ - console.log(e); - } + }, + handleRecord() { + let { hasStart } = this.data + console.log(hasStart); + if (hasStart) this.recortPause() + else this.recortResume() + }, + handleOpenRecord() { + this.setData({ + isStart: true, + }); + console.log('opppppp') + this.recordStart() + }, + // 录音暂停 + recortPause() { + recorderManager.pause(); + this.setData({ + hasStart: false + }) + clearInterval(timer) + timer = null + }, + // 录音继续 + recortResume() { + this.recordingTimer() + recorderManager.resume(); + this.setData({ + hasStart: true + }) + + }, + // 录音上传 + uploadRecord(file, duration) { + wx.uploadFile({ + url: `${config.BASEURL()}oss/file/uploadvoice`, + filePath: file, + name: "file", + header: { + "Content-type": "multipart/form-data", + 'Authorization': wx.getStorageSync('token') + }, + success: (fileRes) => { + wx.hideLoading() + console.log('ressss', fileRes) + if (!JSON.parse(fileRes.data).data) { + wx.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 + this.setData({ + "uploadRecord.uploaded": true, + "uploadRecord.url": JSON.parse(fileRes.data).data, + 'fmData.voiceList':[JSON.parse(fileRes.data).data], + showRecord: false, + hasStart: false, + isStart: false, + recordingTime: '00:00', + duration + }) + this.downLoadAudio() + console.log(this.data.uploadRecord); + } + }, + fail: (fileRes) => { + console.log(fileRes); + wx.showToast({ + title: "录音上传失败,请重试~", + icon: "none", + duration: 1500 + }) + this.setData({ + "uploadRecord.uploaded": true, + "uploadRecord.url": "", + totalTime: "", + }) + } + }) + }, + // 录音开始 + recordStart() { + this.setData({ + hasStart: true, + }); + const options = { + duration: this.data.overDuration, + format: 'mp3', + type: 'voice' + }; + this.recordingTimer() + recorderManager.start(options); + recorderManager.onStart(res => { + console.log('recorder start', res); + }); + recorderManager.onPause(res => { + console.log('onPause', res) + }) + console.log(recorderManager); + recorderManager.onResume(res => { + console.log('onResume', res) + }) + recorderManager.onStop((res) => { + console.log('recorder stop', res); + const { tempFilePath, duration } = res; + this.setData({ + hasStop: true, + url: tempFilePath, + duration + }) + // + }); + recorderManager.onFrameRecorded(res => { + console.log('onFrameRecorded', res) + }) + recorderManager.onError((res) => { + console.log('recorder onError', res); + wx.showToast({ + title: res.errMsg, + icon: 'none', + duration: 1500 + }) + }); + }, + // 录音暂停 + recortPause() { + recorderManager.pause(); + this.setData({ + hasStart: false + }) + clearInterval(timer) + timer = null + }, + // 录音继续 + recortResume() { + this.recordingTimer() + recorderManager.resume(); + this.setData({ + hasStart: true + }) + + }, + // 录音结束 + recordStop() { + const { url, recordingLength, hasStop } = this.data + this.setData({ + hasStart: false + }) + wx.showLoading({ + title: '录音上传中...' + }) + + console.log(url, recordingLength, hasStop) + + if (hasStop) { + this.uploadRecord(url, 600000) + console.log('hasStop', hasStop) + } else { + console.log('hasStopeee', hasStop) + recorderManager.stop(); + clearInterval(timer) + timer = null + recorderManager.onStop((res) => { + console.log('recorder stop1111', res); + const { tempFilePath, duration } = res; + this.uploadRecord(tempFilePath, duration) + // + console.log(duration,'上传结束的语音时间'); + this.setData({ + recordingLength: 0, + totalTime:this.format(duration) + }) + }); + } + + }, + + recordingTimer() { + clearInterval(timer) + timer = null + timer = setInterval(() => { + let { overDuration, recordingLength } = this.data + if (recordingLength * 1000 >= overDuration) { + wx.showToast({ + title: '录音已超时,已停止录音', + icon: 'none', + duration: 1500 + }) + console.log('lllllllll超时了') + recorderManager.stop(); + clearInterval(timer) + timer = null + this.setData({ + hasStart: false + }) + return + } + let time = this.data.recordingLength + 1; + this.setData({ + recordingLength: time, + recordingTime: this.formatTime(time) + }); + console.log('timer,还在执行',this.data.recordingLength) + }, 1000); + }, + 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.handleRecordDel() + this.setData({ + showRecord: false + }) + }, + hidePicker() { + this.setData({ + angencyVisible: false + }) + }, + showPicker() { + this.setData({ + angencyVisible: true + }) + }, + 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) { + console.log(e); + }, + + // 播放逻辑 + initDuration() { + var _a = this.data, duration = _a.duration; + if (duration) { + this.setData({ + totalMax: duration + }); + } + console.log('totalMax', this.data.totalMax); + }, + downLoadAudio() { + var _this = this; + wx.downloadFile({ + url: this.data.uploadRecord.url.url, + success(res) { + console.log(res); + if (res.statusCode === 200) { + console.log('res2222222', res); + _this.setData({ + playUrl: res.tempFilePath + }); + _this.initAudio(); + } + else { + wx.showToast({ + title: '音频加载失败', + icon: 'none', + duration: 1500 + }); + } + }, + fail(err) { + console.log(err); + wx.showToast({ + title: '音频加载失败', + icon: 'none', + duration: 1500 + }); + } + }); + }, + initAudio() { + var _this = this; + innerAudioContext.src = this.data.playUrl; + innerAudioContext.autoplay = false; + this.initDuration(); + console.log('ppppplllaaa', innerAudioContext); + innerAudioContext.onCanplay(() => { + console.log('初始化播放', innerAudioContext.duration); + }); + innerAudioContext.onPlay(() => { + console.log('开始播放', innerAudioContext.duration); + }); + innerAudioContext.onTimeUpdate(() => { + console.log("duration-onTimeUpdate", innerAudioContext.duration); + console.log("currentTime", innerAudioContext.currentTime); + if (innerAudioContext.duration) { + _this.setData({ + totalMax: (innerAudioContext.duration * 1000), + }); + } + _this.setData({ + stepValue: (innerAudioContext.currentTime * 1000), + }); + console.log('stepValue', _this.data.stepValue); + console.log('totalTime', _this.data.totalTime); + console.log('totalMax', _this.data.totalMax); + }); + innerAudioContext.onEnded(function () { + console.log("end"); + _this.setData({ + hasPlay: false + }); + }); + innerAudioContext.onError((res) => { + console.log("errMsg", res.errMsg); + wx.showToast({ + title: res.errMsg, + icon: 'none', + duration: 1500 + }); + }); + }, + handlePlay() { + var hasPlay = this.data.hasPlay; + if (hasPlay) + this.audioPause(); + else + this.audioPlay(); + }, + audioPause() { + innerAudioContext.pause(); + this.setData({ + hasPlay: false + }); + }, + audioPlay() { + innerAudioContext.play(); + this.setData({ + hasPlay: true + }); + console.log('innerAudioContext', innerAudioContext); + }, + slideChange(e) { + this.audioPause(); + var value = e.detail.value; + console.log('slidechange', value); + innerAudioContext.seek(value / 1000); + this.setData({ + stepValue: value, + }); + this.audioPlay(); + }, + handleSlideMove(e) { + this.audioPause(); + }, + handleAudioDel() { + innerAudioContext.stop(); + console.log('innerAudioContextdel', innerAudioContext); + + this.setData({ + totalTime:'00:00', + 'fmData.voiceList':[] + }) + }, + 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 + }, }) \ No newline at end of file diff --git a/subpages/demandCheck/pages/dissatisfied/demandCheck/demandCheck.json b/subpages/demandCheck/pages/dissatisfied/demandCheck/demandCheck.json index 417343b..e9d7637 100644 --- a/subpages/demandCheck/pages/dissatisfied/demandCheck/demandCheck.json +++ b/subpages/demandCheck/pages/dissatisfied/demandCheck/demandCheck.json @@ -7,5 +7,8 @@ "wux-picker": "../../../../../components/dist/picker/index" }, - "navigationBarTitleText": "诉求摸排" + "navigationBarTitleText": "诉求摸排", + "permissions": { + "scope.record": true + } } \ No newline at end of file diff --git a/subpages/demandCheck/pages/dissatisfied/demandCheck/demandCheck.wxml b/subpages/demandCheck/pages/dissatisfied/demandCheck/demandCheck.wxml index e2c619c..3d9f6bc 100644 --- a/subpages/demandCheck/pages/dissatisfied/demandCheck/demandCheck.wxml +++ b/subpages/demandCheck/pages/dissatisfied/demandCheck/demandCheck.wxml @@ -1,6 +1,5 @@ - @@ -10,18 +9,6 @@ 所属组织 - {{agencyName?agencyName:'请选择'}} @@ -50,12 +37,24 @@ 事件描述 - + + + + + + + {{totalTime}} + + + + 您也可以语音输入描述 + @@ -73,7 +72,7 @@ - + @@ -100,28 +99,24 @@ * - 联系人 - - - - + 联系人 + + + {{resiName?resiName:'请选择'}} + + + * 联系电话 - - - - + + + {{resiMobile?resiMobile:'请输入'}} + @@ -136,7 +131,7 @@ 取消 - + {{recordingTime}} @@ -164,7 +159,6 @@ - { + this.setData({ + loadMoreType: res.data.list.length === this.data.pageSize ? 'more' : 'none', + tableData: this.data.tableData.concat(res.data.list), + }) + if (this.data.tableData.length == 0) { + this.setData({ + loadMoreVisible: false, + nodata: true + }) + } + }).catch(err=>{ + this.setData({ + loadMoreVisible: false, + nodata: true, + }) + }) + }, + onScrollToLower(e){ + if (this.data.loadMoreType === 'more') { + this.setData({ + loadMoreVisible: true, + }) + this.data.pageNo += 1 + this.getTable() + } + }, + getQuartersOptions(){ + + api.getQuartersOptions().then(res=>{ + this.setData({ + villageList:res.data + }) + }).catch(err=>{ + console.log(err); + }) + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + }, + chosseTabBar(e){ + this.setData({ + selectVal:e.currentTarget.dataset.type + }) + }, + handelBlurKeyWord(e){ + this.setData({ + keyWord:e.detail.value + }) + }, + handelClickSearch(){ + this.setData({ + pageNo:1, + tableData:[] + }) + this.getTable() + }, + toAddResi(){ + wx.navigateTo({ + url: '/subpages/addResi/pages/addResi/addResi', + }) + }, + radioChange(e) { + console.log(e); + this.setData({ + selectedRadio: e.detail.value, + resiId:e.currentTarget.dataset.item.resiId, + resiName:e.currentTarget.dataset.item.name, + resiMobile:e.currentTarget.dataset.item.mobile, + }); + }, + bindPickerChangevillageId(e) { + const selectedIndex = e.detail.value; + const selectedVillage = this.data.villageList[selectedIndex]; + this.setData({ + villageName: selectedVillage.label, + "form.villageId": selectedVillage.value, + 'form.buildId':'', + 'form.unitId':'', + 'form.homeId':'', + buildingName:'', + buildingList:[], + unitName:'', + unitList:[], + houseName:'', + houseList:[], + }); + this.getBuildingoption(selectedVillage.value); + }, + + bindPickerChangebuilding(e){ + + const selectedIndex = e.detail.value; + const selectedVillage = this.data.buildingList[selectedIndex]; + this.setData({ + buildingName: selectedVillage.label, + "form.buildId": selectedVillage.value, + 'form.unitId':'', + 'form.homeId':'', + unitName:'', + unitList:[], + houseName:'', + houseList:[], + }); + this.getUnitoption(selectedVillage.value); + }, + bindPickerChangeUnit(e){ + + const selectedIndex = e.detail.value; + const selectedVillage = this.data.unitList[selectedIndex]; + this.setData({ + unitName: selectedVillage.label, + "form.unitId": selectedVillage.value, + 'form.homeId':'', + houseName:'', + houseList:[], + }); + this.getHouseoption(selectedVillage.value); + }, + bindPickerChangeHouse(e){ + const selectedIndex = e.detail.value; + console.log( this.data.houseList); + const selectedVillage = this.data.houseList[selectedIndex]; + this.setData({ + houseName: selectedVillage.label, + "form.homeId": selectedVillage.value + }); + this.getResidentBaseInfo() + }, + bindPickerChangeResi(e){ + const selectedIndex = e.detail.value; + const selectedVillage = this.data.resiList[selectedIndex]; + console.log(selectedVillage); + this.setData({ + resiName: selectedVillage.name, + resiMobile:selectedVillage.mobile, + resiId:selectedVillage.resiId, + }); + }, + // 获取楼栋列表 + getBuildingoption(villageId){ + api.getBuildingoption(villageId).then(res=>{ + this.setData({ + buildingList:res.data + }) + }).catch(err=>{ + console.log(err); + }) + }, + // 获取单元列表 + getUnitoption(buildingId){ + api.getUnitoption(buildingId).then(res=>{ + this.setData({ + unitList:res.data + }) + }).catch(err=>{ + console.log(err); + }) + }, + // 获取房屋列表 + getHouseoption(unitId){ + api.getHouseoption(unitId).then(res=>{ + this.setData({ + houseList:res.data + }) + }).catch(err=>{ + console.log(err); + }) + }, + getResidentBaseInfo(){ + let parm = { + pageNo:1, + pageSize:1000, + villageId:this.data.form.villageId, + buildId:this.data.form.buildId, + unitId:this.data.form.unitId, + homeId:this.data.form.homeId, + } + api.getResidentBaseInfoPage(parm).then(res=>{ + this.setData({ + resiList:res.data.list + }) + }).catch(err=>{ + console.log(err); + }) + }, + toDemandCheck(){ + console.log(111); + wx.navigateTo({ + url: '/subpages/demandCheck/pages/dissatisfied/demandCheck/demandCheck?resiId=' + this.data.resiId + '&mobile=' + this.data.resiMobile + "&resiName=" + this.data.resiName, + }) + } +}) \ No newline at end of file diff --git a/subpages/demandCheck/pages/dissatisfied/searchResi/searchResi.json b/subpages/demandCheck/pages/dissatisfied/searchResi/searchResi.json new file mode 100644 index 0000000..e2bba5f --- /dev/null +++ b/subpages/demandCheck/pages/dissatisfied/searchResi/searchResi.json @@ -0,0 +1,7 @@ +{ + "usingComponents": { + "load-more": "../../../../../components/loadMore/loadMore", + "no-data": "../../../../../components/noData/nodata" + }, + "navigationBarTitleText": "选择居民" +} \ No newline at end of file diff --git a/subpages/demandCheck/pages/dissatisfied/searchResi/searchResi.wxml b/subpages/demandCheck/pages/dissatisfied/searchResi/searchResi.wxml new file mode 100644 index 0000000..1504fe4 --- /dev/null +++ b/subpages/demandCheck/pages/dissatisfied/searchResi/searchResi.wxml @@ -0,0 +1,109 @@ + + + 查询居民 + 选择居民 + 身份证识别 + + + + + + 搜索 + + + + + + + + + + + + + + {{item.name}} {{item.mobile}} + 地址:{{item.homeName}} + + + + + + + {{loadMoreVisible?'如果找不到该居民的信息,您也可以先':'加载中...'}}新增居民 + + + + + + + 需求人所在小区 + + + + + {{villageName?villageName:'请选择'}} + + + + + + + + 所在楼栋 + + + + + {{buildingName?buildingName:'请选择'}} + + + + + + + + 所在单元 + + + + + {{unitName?unitName:'请选择'}} + + + + + + + + 门牌号 + + + + + {{houseName?houseName:'请选择'}} + + + + + + + + 居民姓名 + + + + + {{resiName?resiName:'请选择'}} + + + + + + + {{loadMoreVisible?'如果找不到该居民的信息,您也可以先':'加载中...'}}新增居民 + + + 身份证识别 + + diff --git a/subpages/demandCheck/pages/dissatisfied/searchResi/searchResi.wxss b/subpages/demandCheck/pages/dissatisfied/searchResi/searchResi.wxss new file mode 100644 index 0000000..0b39bb6 --- /dev/null +++ b/subpages/demandCheck/pages/dissatisfied/searchResi/searchResi.wxss @@ -0,0 +1,251 @@ +/* subpages/demandCheck/pages/dissatisfied/searchResi/searchResi.wxss */ +page{ + width: 100%; + height: 100%; + overflow: hidden; + background-color: #f7f7f7; +} +.white{ + color: white; +} +.header{ + min-height: 90rpx; + display: flex; + flex-direction: column; + background-color: #ffff; + padding: 0 20rpx; + box-sizing: border-box; + overflow: hidden; +} +.header .selectBar{ + display: flex; + justify-content: space-around; + position: relative; + align-items: center; +} +.header .selectBarImg{ + position: absolute; + bottom: -15rpx; + left: 0; + width: 140rpx; + height: 14rpx; + transition: left 0.5s ease; +} +.header .selectBar .search-select{ + left: 6%; + transition: left 0.5s ease; + color: #3A80E7; +} +.header .selectBar .filter-select{ + left: 38%; + transition: left 0.5s ease; + color: #3A80E7; +} +.header .selectBar .card-select{ + left: 72%; + transition: left 0.5s ease; + color: #3A80E7; +} +.header .inout_box { + position: relative; + margin: 40rpx 0 20rpx; +} +.header .inout_box input{ + width: auto; + background: #F5F5FA; + border-radius: 47rpx; + padding:0 100rpx 0 69rpx; + height: 76rpx; + font-size: 26rpx; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} +.header .inout_box image{ + position: absolute; + left: 21rpx; + top: 24rpx; + width: 30rpx; + height: 30rpx; +} +.header .inout_box .btn_box{ + width: 110rpx; + height: 50rpx; + position: absolute; + top: 15rpx; + right:-10rpx; + display: flex; + align-items: center; +} +.header .inout_box .btn_box text{ + width: 80rpx; + height: 30rpx; + line-height: 30rpx; + font-size: 28rpx; + box-sizing: border-box; + color:#3A80E7; + padding-left: 15rpx; + border-left:2rpx #3A80E7 solid ; +} +.scroll { + height: calc(100vh - 250rpx); + overflow-y: scroll; + margin-top: 20rpx; +} + .scroll .card{ + background-color: #fff; + border-radius: 20rpx; + padding: 0 30rpx; + box-sizing: border-box; +} +button{ + width: 360rpx; + height: 76rpx; + background: linear-gradient(87deg, #81B5FB 0%, #3E92FF 100%); + border-radius: 76rpx !important; + font-size: 32rpx; + font-weight: 400 !important; + font-family: PingFang SC; + color: #FFFFFF; + position: fixed; + bottom: 63rpx; + left: 50%; + transform: translateX(-180rpx); +} +.fixed_btn{ + position: fixed; + bottom: 30rpx; + left: 50%; + transform: translateX(-184rpx); +} + + .scroll .card{ + background-color: #fff; + border-radius: 0 0 20rpx 20rpx; + padding: 0 30rpx; + box-sizing: border-box; +} + .card .list_card{ + display: flex; + justify-content: space-around; + padding: 30rpx 0; + align-items: center; + color: #333333; + border-top: 1px solid #f7f7f7; +} + .card .list_card .left{ + flex: 1; + height: 100%; + display: flex; + flex-direction: column; + justify-content: space-between; + font-size: 32rpx; + font-family: PingFang SC; + font-weight: 500; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + .card .list_card .left :nth-child(1), + .card .list_card .left :nth-child(2){ + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + .card .list_card .left .address{ + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 500; + color: #999999; + margin-top: 29rpx; +} +.list_card .right image{ + width: 20rpx; + height: 20rpx; +} +.loadVisible{ + color: #c1c1c1; + font-size: 24rpx; + width: 100%; + text-align: center; + margin-top: 20rpx; +} + +.form_card { + background-color: #fff; + border-radius: 10rpx; + padding: 0 30rpx; + box-sizing: border-box; + height: auto; +} +.form_card > .title{ + height: 90rpx; + line-height: 90rpx; + font-size: 34rpx; + font-family: PingFang SC; + font-weight: bold; + color: #333333; + position: relative; +} +.form_card .title .tag{ + width: 10rpx; + height: 28rpx; + background: #3A80E7; + border-radius: 4rpx; + position: absolute; + left: -30rpx; + top: 50%; + transform: translateY(-14rpx); +} +.form_card .form_item{ + display: flex; + align-items: center; + border-top: 1px solid #EAEAEA; + height: 100rpx; +} +.form_card .form_house{ + height: 139rpx; + display: flex; + flex-direction: column; +} +.form_card .form_house .form_bottom{ + font-size: 24rpx; + color:#C1C1C1; + position: relative; + top: -10rpx; +} + +.form_card .form_item .label{ + width: 130rpx; + height: 100%; + line-height: 100rpx; + font-size: 32rpx; + font-family: PingFang SC; + font-weight: 500; + color: #666666; + position: relative; +} + +.form_card .form_item .input{ + flex: 1; + display: flex; + justify-content: space-around; + align-items: center; + margin-left: 51rpx; + overflow: hidden; + +} +.form_card .form_item .input .residentCategorySty{ + flex: 1; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} +.form_card .form_item .input picker, +.form_card .form_item .input input{ + flex: 1; +} +.form_card .form_item .input image{ + height: 22rpx; + width: 22rpx; +} \ No newline at end of file diff --git a/subpages/searchResult/pages/searchResult/searchResult.wxss b/subpages/searchResult/pages/searchResult/searchResult.wxss index 9200a80..b1895dd 100644 --- a/subpages/searchResult/pages/searchResult/searchResult.wxss +++ b/subpages/searchResult/pages/searchResult/searchResult.wxss @@ -60,27 +60,6 @@ page { padding: 0 30rpx; box-sizing: border-box; } -.content .content_header{ - height:162rpx; - background:linear-gradient(531deg, #cfe5f7 0%, #E8F2FF 66%, #F7F7F7 100%); - padding: 30rpx; - border-radius:20rpx 20rpx 0 0; -} - -.content .content_header .title{ - font-size: 30rpx; - font-family: PingFang SC; - font-weight: bold; - color: #333333; -} -.content .content_header .font{ - font-size: 30rpx; - font-family: PingFang SC; - font-weight: 400; - color: #666666; - margin: 30rpx 0; - -} .content .card .list_card{ display: flex; justify-content: space-around; @@ -119,6 +98,28 @@ page { width: 20rpx; height: 20rpx; } +.content .content_header{ + height:162rpx; + background:linear-gradient(531deg, #cfe5f7 0%, #E8F2FF 66%, #F7F7F7 100%); + padding: 30rpx; + border-radius:20rpx 20rpx 0 0; +} + +.content .content_header .title{ + font-size: 30rpx; + font-family: PingFang SC; + font-weight: bold; + color: #333333; +} +.content .content_header .font{ + font-size: 30rpx; + font-family: PingFang SC; + font-weight: 400; + color: #666666; + margin: 30rpx 0; + +} + button{ width: 360rpx; height: 76rpx; diff --git a/utils/api.js b/utils/api.js index 7ebd1ad..158d8fb 100644 --- a/utils/api.js +++ b/utils/api.js @@ -35,7 +35,9 @@ module.exports = { followUpSave, followUpDelete, logout, - getAgencygridtree + getAgencygridtree, + addEvent, + getResidentBaseInfoPage } // 消息列表 function getIntelligentMessage(param){ @@ -182,3 +184,11 @@ function followUpDelete (parm) { function getAgencygridtree () { return fly.post(`gov/org/customeragency/agencygridtree`,) } +// 上报诉求 +function addEvent (parm) { + return fly.post(`governance/icEvent/add-event-resi`,parm) +} +// 上报诉求 +function getResidentBaseInfoPage (parm) { + return fly.post(`actual/base/residentBaseInfo/page`,parm) +}