Merge branch 'master' of http://git.scdxtc.com/chen/public-opinion
						commit
						2ea46c7862
					
				|  | @ -1,4 +1,7 @@ | |||
| import request from './requst.js'; | ||||
| export function uploadImg(data) { | ||||
|   return request.upload("/universal/api.upload/upload", data); | ||||
|   return request.upload("file/upload/image", data); | ||||
| } | ||||
| export function uploadFile(data) { | ||||
|   return request.upload("file/upload/file", data,'file'); | ||||
| } | ||||
|  | @ -35,42 +35,42 @@ const checkError = (e) => { | |||
|     // console.error("----接口错误----", e)
 | ||||
|     if (e.data) { | ||||
|         if (e.data.code) { | ||||
|             switch (Number(e.data.code)) { | ||||
| 				case 500: | ||||
| 				// 接口错误
 | ||||
| 				console.log('500接口错误'); | ||||
|                 case 4003: | ||||
| 				// 参数错误
 | ||||
| 				console.log('4003参数错误'); | ||||
|                     break; | ||||
| 				case 4004: | ||||
| 				// 记录不存在
 | ||||
| 				console.log('4004记录不存在'); | ||||
| 				    break; | ||||
| 				case 5001: | ||||
| 				// xxx错误
 | ||||
| 				console.log('5001xxx错误'); | ||||
| 				    break; | ||||
| 				case 5050: | ||||
| 				// 服务器错误,请稍后重试
 | ||||
| 				console.log('5050服务器错误,请稍后重试'); | ||||
| 				// 调用到登录页
 | ||||
| 				goLogin(); | ||||
| 				    break; | ||||
| 				case 5051: | ||||
| 				// 未知错误
 | ||||
| 				console.log('5051未知错误'); | ||||
| 				    break; | ||||
| 				case 6001: | ||||
| 				// token验证失败或已失效
 | ||||
| 				console.log('6001token验证失败或已失效'); | ||||
| 				if(flag) { | ||||
| 					flag = false; | ||||
| 			if(flag) { | ||||
| 				flag = false; | ||||
| 				switch (Number(e.data.code)) { | ||||
| 					case 500: | ||||
| 					// 接口错误
 | ||||
| 					console.log('500接口错误'); | ||||
| 					case 4003: | ||||
| 					// 参数错误
 | ||||
| 					console.log('4003参数错误'); | ||||
| 						break; | ||||
| 					case 4004: | ||||
| 					// 记录不存在
 | ||||
| 					console.log('4004记录不存在'); | ||||
| 						break; | ||||
| 					case 5001: | ||||
| 					// xxx错误
 | ||||
| 					console.log('5001xxx错误'); | ||||
| 						break; | ||||
| 					case 5050: | ||||
| 					// 服务器错误,请稍后重试
 | ||||
| 					console.log('5050服务器错误,请稍后重试'); | ||||
| 					// 调用到登录页
 | ||||
| 					goLogin(); | ||||
| 						break; | ||||
| 					case 5051: | ||||
| 					// 未知错误
 | ||||
| 					console.log('5051未知错误'); | ||||
| 						break; | ||||
| 					case 6001: | ||||
| 					// token验证失败或已失效
 | ||||
| 					console.log('6001token验证失败或已失效'); | ||||
| 					// 调用刷新token事件并跳转到当前页面
 | ||||
| 					refreshTokenPage(); | ||||
| 						break; | ||||
| 				} | ||||
| 				    break; | ||||
|             } | ||||
| 			} | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | @ -116,6 +116,10 @@ const request = (method, url, options) => { | |||
| 						resolve(res.data); | ||||
| 					} else { | ||||
| 						// 接口返回错误信息
 | ||||
| 						uni.showToast({ | ||||
| 							title:res.data.msg, | ||||
| 							icon:'none' | ||||
| 						}) | ||||
| 						checkError(res); | ||||
| 					} | ||||
| 				} else { | ||||
|  | @ -135,14 +139,14 @@ const request = (method, url, options) => { | |||
| 	}) | ||||
| } | ||||
| // 上传文件 封装请求
 | ||||
| const uploadFile = (url, options) => { | ||||
| const uploadFile = (url, options, type) => { | ||||
|     let tempData = options || {} | ||||
|     return new Promise((resolve, reject) => { | ||||
|         uni.uploadFile({ | ||||
|             url: `${getApp().globalData.hostapi}${url}`, | ||||
|             filePath: tempData.path, | ||||
|             name: 'image', | ||||
| 			fileType:'image', | ||||
|             name: type, | ||||
| 			// fileType:type,//支付宝小程序必传
 | ||||
|             formData: tempData, | ||||
| 			header: { | ||||
| 				'Content-Type': 'multipart/form-data;charset=UTF-8', | ||||
|  | @ -174,7 +178,7 @@ export default { | |||
|         return request('postForm', url, options) | ||||
|     }, | ||||
|     // 上传
 | ||||
|     upload: (url, options) => { | ||||
|         return uploadFile(url, options) | ||||
|     upload: (url, options, type='image') => { | ||||
|         return uploadFile(url, options, type) | ||||
|     } | ||||
| } | ||||
|  |  | |||
							
								
								
									
										3
									
								
								main.js
								
								
								
								
							
							
						
						
									
										3
									
								
								main.js
								
								
								
								
							|  | @ -11,6 +11,9 @@ Vue.prototype.$toolAll = tools; | |||
| import requst from '@/jsFile/requst.js'; | ||||
| Vue.prototype.$requst = requst; | ||||
| 
 | ||||
| // 图片域名
 | ||||
| Vue.prototype.$imghost = 'https://minyitong.scdxtc.cn'; | ||||
| 
 | ||||
| App.mpType = 'app'; | ||||
| 
 | ||||
| const app = new Vue({ | ||||
|  |  | |||
|  | @ -24,6 +24,7 @@ | |||
| 				userInfo:'', | ||||
| 				ifFlag:true | ||||
| 			} | ||||
| 			 | ||||
| 		}, | ||||
| 		methods: { | ||||
| 			// 前往登录页 | ||||
|  | @ -59,7 +60,7 @@ | |||
| 				} | ||||
| 				this.$requst.post('user/login',params).then(res => { | ||||
| 					uni.hideToast(); | ||||
| 					if(res.data.token!=''){ | ||||
| 					if(res.data.nickname!=''){ | ||||
| 						this.$toolAll.tools.showToast('已授权'); | ||||
| 						let dataObj = res.data; | ||||
| 						uni.setStorageSync('token',dataObj.token); | ||||
|  |  | |||
|  | @ -3,38 +3,40 @@ | |||
| 		<view class="pad-zy20 fon24"> | ||||
| 			<view class="disjbac fon30 bbot pad-sx30"> | ||||
| 				<view class="colb bold flexs">序号</view> | ||||
| 				<view class="col9">LH20220729130234</view> | ||||
| 				<view class="col9">{{detail.coding}}</view> | ||||
| 			</view> | ||||
| 			<view class="disjbac fon30 bbot pad-sx30"> | ||||
| 				<view class="colb bold flexs">审核状态</view> | ||||
| 				<view class="col9">待审核</view> | ||||
| 				<view class="col9">{{detail.state_text}}</view> | ||||
| 			</view> | ||||
| 			<view class="disjbac bbot pad-sx20"> | ||||
| 			<view class="disjbac bbot pad-sx20" v-if="detail.u_name"> | ||||
| 				<view class="fon30 colb bold flexs">真实姓名</view> | ||||
| 				<view class="col9">测试村</view> | ||||
| 				<view class="col9">{{detail.u_name}}</view> | ||||
| 			</view> | ||||
| 			<view class="disjbac bbot pad-sx20"> | ||||
| 			<view class="disjbac bbot pad-sx20" v-if="detail.u_name"> | ||||
| 				<view class="fon30 colb bold flexs">联系方式</view> | ||||
| 				<view class="col9">测试村</view> | ||||
| 				<view class="col9">{{detail.u_phone}}</view> | ||||
| 			</view> | ||||
| 			<view class="disjbac fon30 bbot pad-sx30"> | ||||
| 				<view class="colb bold flexs">社区</view> | ||||
| 				<view class="col9">新华社区</view> | ||||
| 				<view class="col9">{{detail.community.name}}</view> | ||||
| 			</view> | ||||
| 			<view class="disjbac fon30 bbot pad-sx30"> | ||||
| 				<view class="colb bold flexs">村</view> | ||||
| 				<view class="col9">测试村</view> | ||||
| 				<view class="col9">{{detail.village.name}}</view> | ||||
| 			</view> | ||||
| 			<view class="dis fon30 bbot pad-sx30"> | ||||
| 				<view class="colb bold flexs">图片</view> | ||||
| 				<view class="disac width100 fe"> | ||||
| 					<image src="" mode="aspectFill" class="width155 radius30 mar-z20"></image> | ||||
| 				<view class="disac width100 fe" v-if="detail.images"> | ||||
| 					<image :src="item" v-for="(item,index) in detail.images.split(',')" :key="index" @tap="preVedio(index,0)" mode="aspectFill" class="width155 radius30 mar-z20"></image> | ||||
| 				</view> | ||||
| 			</view> | ||||
| 			<view class="dis fon30 bbot pad-sx30"> | ||||
| 				<view class="colb bold flexs">视频</view> | ||||
| 				<view class="disac width100 fe"> | ||||
| 					<image src="" mode="aspectFill" class="width155 radius30 mar-z20"></image> | ||||
| 				<view class="disac width100 fe" v-if="detail.videos"> | ||||
| 					<view class="width155 radius30 mar-z20" v-for="(item,index) in detail.videos.split(',')" :key="index" style="overflow: hidden;" @tap="preVedio(index,1)"> | ||||
| 						<video :src="item" :controls="false" class="width155 radius30"></video> | ||||
| 					</view> | ||||
| 				</view> | ||||
| 			</view> | ||||
| 			<view class="disjb bbot pad-sx20"> | ||||
|  | @ -99,21 +101,38 @@ | |||
| 		data() { | ||||
| 			return { | ||||
| 				audioText:'', | ||||
| 				detail:{}, //工单详情 | ||||
| 				detail:'', //工单详情 | ||||
| 				ifManager:0, // 是否是管理员 | ||||
| 				id:0, //工单id | ||||
| 			} | ||||
| 		}, | ||||
| 		onLoad(op) { | ||||
| 			if(op.manager) this.ifManager = op.manager; | ||||
| 			if(op.id) this.id = op.id; | ||||
| 			// 查询详情 | ||||
| 			this.getDetailEv(); | ||||
| 			this.getDetailEv(op.id); | ||||
| 		}, | ||||
| 		onHide() { | ||||
| 			innerAudioContext.stop(); | ||||
| 		}, | ||||
| 		methods: { | ||||
| 			// 预览视频 | ||||
| 			preVedio(index,num){ | ||||
| 				let arr = []; | ||||
| 				let tempArr = [this.detail.images.split(','),this.detail.videos.split(',')][num]; | ||||
| 				if(tempArr.length){ | ||||
| 					tempArr.forEach(item=>{ | ||||
| 						let obj = { | ||||
| 							url:item, | ||||
| 							type:['image','video'][num] | ||||
| 						} | ||||
| 						arr.push(obj); | ||||
| 					}) | ||||
| 				} | ||||
| 				uni.previewMedia({ | ||||
| 					current:index, | ||||
| 					sources:arr | ||||
| 				}) | ||||
| 			}, | ||||
| 			// 播放录音 | ||||
| 			playVoice() { | ||||
| 				if (this.audioText) { | ||||
|  | @ -121,13 +140,11 @@ | |||
| 					innerAudioContext.play(); | ||||
| 				} | ||||
| 			}, | ||||
| 			 | ||||
| 			// 查询工单详情 | ||||
| 			getDetailEv(){ | ||||
| 				this.$requst.post('user/opinionInfo',{id:this.id}).then(res => { | ||||
| 			getDetailEv(id){ | ||||
| 				this.$requst.post('user/opinionInfo',{id}).then(res => { | ||||
| 					if(res.code==0){ | ||||
| 						console.log(res,'社区工单详情'); | ||||
| 						this.detail = res.data; | ||||
| 						this.detail = res.data.opinion; | ||||
| 					} else { | ||||
| 						this.$toolAll.tools.showToast(res.msg); | ||||
| 					} | ||||
|  |  | |||
|  | @ -6,46 +6,73 @@ | |||
| 					<view @tap="switchEv(0)" class="pad-sx20 disjcac radius20" :style="switchIndex==0?'background-color:#39d091;color:#FFFFFF;':''" style="width: 288rpx;">已发起</view> | ||||
| 					<view @tap="switchEv(1)" class="pad-sx20 disjcac radius20" :style="switchIndex==1?'background-color:#39d091;color:#FFFFFF;':''" style="width: 288rpx;">已办理</view> | ||||
| 				</view> | ||||
| 				<view class="mar-s20 radius20 fon24 bacf posir" v-for="(item,index) in 50" :key="index"> | ||||
| 				<view class="mar-s20 radius20 fon24 bacf posir" v-for="(item,index) in dataList" :key="index"> | ||||
| 					<view class="pad-sx20 pad-zy50 status-box">{{['待处理','已办理'][switchIndex]}}</view> | ||||
| 					<view class="pad20 bbot line-h46 pad-x40"> | ||||
| 						<view class="fon30">LH20220729130234</view> | ||||
| 						<view class="">用户名:匿名提交</view> | ||||
| 						<view class="">金牛社区A村</view> | ||||
| 						<view class="">反馈问题:我就是想问下我们村的路多久能修好?</view> | ||||
| 						<view class="fon30">{{item.coding}}</view> | ||||
| 						<view class="">用户名:{{item.u_name || '匿名提交'}}</view> | ||||
| 						<view class="">{{item.community.name}}{{item.village.name}}</view> | ||||
| 						<view class="">反馈问题:{{item.description}}</view> | ||||
| 					</view> | ||||
| 					<view class="dis fon30"> | ||||
| 						<view @tap="goDetail(0)" class="width50 pad-sx30 disjcac border-r"> | ||||
| 						<view @tap="goDetail(item.id)" class="width50 pad-sx30 disjcac border-r"> | ||||
| 							<image class="mar-y20" src="/static/icon/icon-check.png" mode="" style="width: 34rpx;height: 34rpx;"></image>查看 | ||||
| 						</view> | ||||
| 						<view v-if="switchIndex==0" class="width50 pad-sx30 disjcac"> | ||||
| 						<view v-if="switchIndex==0" @tap="returnEv(item.id,index)" class="width50 pad-sx30 disjcac"> | ||||
| 							<image class="mar-y20" src="/static/icon/icon-revoke.png" mode="" style="width: 34rpx;height: 34rpx;"></image> | ||||
| 							撤诉 | ||||
| 						</view> | ||||
| 						<view @tap="goFeedback(0)" v-if="switchIndex==1" class="width50 pad-sx30 disjcac"> | ||||
| 						<view @tap="goFeedback(item.id)" v-if="switchIndex==1" class="width50 pad-sx30 disjcac"> | ||||
| 							<image class="mar-y20" src="/static/icon/icon-feedback.png" mode="" style="width: 34rpx;height: 34rpx;"></image> | ||||
| 							反馈 | ||||
| 						</view> | ||||
| 					</view> | ||||
| 				</view> | ||||
| 				<view class="" v-if="total==dataList.length && total"> | ||||
| 					<pitera textStr="到底啦o(╥﹏╥)o"></pitera> | ||||
| 				</view> | ||||
| 				<view class="posixzy disjcac bacf pad-sx20" style="box-shadow: 0rpx -4rpx 30rpx rgba(0, 0, 0, .2);"> | ||||
| 					<view class="disjcac enter-btn" style="margin: 0;" @tap="goOpinionSubmit">民意提交</view> | ||||
| 				</view> | ||||
| 			</view> | ||||
| 		</statusContainer> | ||||
| 		<view class="" v-if="!total"> | ||||
| 			<nothing-page content="暂无数据"></nothing-page> | ||||
| 		</view> | ||||
| 	</view> | ||||
| </template> | ||||
| 
 | ||||
| <script> | ||||
| 	import statusContainer from '@/components/containers/status-container.vue'; | ||||
| 	import nothingPage from '@/components/nothing/nothing-page.vue'; | ||||
| 	import pitera from '@/components/nothing/pitera.vue'; | ||||
| 	export default { | ||||
| 		components:{ | ||||
| 			statusContainer | ||||
| 			statusContainer, | ||||
| 			nothingPage, | ||||
| 			pitera | ||||
| 		}, | ||||
| 		data() { | ||||
| 			return { | ||||
| 				switchIndex:0, | ||||
| 				newtop:uni.getSystemInfoSync().statusBarHeight | ||||
| 				newtop:uni.getSystemInfoSync().statusBarHeight, | ||||
| 				dataList:[], | ||||
| 				page:1, | ||||
| 				size:4, | ||||
| 				state:0, | ||||
| 				total:0 | ||||
| 			} | ||||
| 		}, | ||||
| 		onShow() { | ||||
| 			this.getList(); | ||||
| 		}, | ||||
| 		onLoad() { | ||||
| 			 | ||||
| 		}, | ||||
| 		onReachBottom() { | ||||
| 			if(this.total != this.dataList.length){ | ||||
| 				this.page++; | ||||
| 				this.getList(); | ||||
| 			} | ||||
| 		}, | ||||
| 		methods: { | ||||
|  | @ -53,6 +80,39 @@ | |||
| 			switchEv(index){ | ||||
| 				console.log(index); | ||||
| 				this.switchIndex = index; | ||||
| 				this.state = index; | ||||
| 				this.page = 1; | ||||
| 				this.dataList = []; | ||||
| 				this.getList(); | ||||
| 			}, | ||||
| 			// 我的民意列表 | ||||
| 			getList(){ | ||||
| 				let params = { | ||||
| 					page:this.page, | ||||
| 					size:this.size, | ||||
| 					state:this.state | ||||
| 				} | ||||
| 				this.$toolAll.tools.showToast('加载中...'); | ||||
| 				this.$requst.get('user/my-table',params).then(res=>{ | ||||
| 					if(res.code==0){ | ||||
| 						if(this.page==1){ | ||||
| 							this.dataList = []; | ||||
| 						} | ||||
| 						this.total = res.data.total; | ||||
| 						this.dataList = [...this.dataList,...res.data.list]; | ||||
| 						uni.hideToast(); | ||||
| 					} | ||||
| 				}) | ||||
| 			}, | ||||
| 			// 撤销民意 | ||||
| 			returnEv(id,index){ | ||||
| 				this.$toolAll.tools.showToast('正在撤销...'); | ||||
| 				this.$requst.post('user/revoke-opinion',{id}).then(res=>{ | ||||
| 					if(res.code==0){ | ||||
| 						this.$toolAll.tools.showToast('撤销成功'); | ||||
| 						this.dataList.splice(index,1); | ||||
| 					} | ||||
| 				}) | ||||
| 			}, | ||||
| 			// 前往提交页面 | ||||
| 			goOpinionSubmit(){ | ||||
|  |  | |||
|  | @ -4,11 +4,11 @@ | |||
| 			<view class="" v-if="!ifAnonymous"> | ||||
| 				<view class="disjbac bbot pad-sx20"> | ||||
| 					<view class="fon30 colb bold flexs">真实姓名</view> | ||||
| 					<input class="fon30 col9 tright width100" v-model="form.name" type="text" maxlength="16" placeholder="请输入姓名"> | ||||
| 					<input class="fon30 col9 tright width100" v-model="form.u_name" type="text" maxlength="16" placeholder="请输入姓名"> | ||||
| 				</view> | ||||
| 				<view class="disjbac bbot pad-sx20"> | ||||
| 					<view class="fon30 colb bold flexs">联系方式</view> | ||||
| 					<input class="fon30 col9 tright width100" v-model="form.phone" type="number" maxlength="11" placeholder="请填写手机号码"> | ||||
| 					<input class="fon30 col9 tright width100" v-model="form.u_phone" type="number" maxlength="11" placeholder="请填写手机号码"> | ||||
| 				</view> | ||||
| 			</view> | ||||
| 			<picker mode="selector" :range="communityList" :value="communityIndex" @change="changeCommunity" :range-key="'name'"> | ||||
|  | @ -33,8 +33,8 @@ | |||
| 				<view class="colb bold flexs">图片上传</view> | ||||
| 				<view class="disac col9 width100 fe fw"> | ||||
| 					<view v-for="(item,index) in imgArr" :key="index" class="col9 radius30 disjcac fc posir mar-y20 item-box width155"> | ||||
| 						<image :src="item" mode="aspectFill" class="width155 radius30"></image> | ||||
| 						<view @tap="imgArr.splice(index,1)" class="posia disjcac del-btn"> | ||||
| 						<image :src="item" mode="aspectFill" class="width155 radius30" @tap="preVedio(index,0)"></image> | ||||
| 						<view @tap="imgArr.splice(index,1),tempImg.splice(index,1)" class="posia disjcac del-btn"> | ||||
| 							<i class="icon icon-del-white fon24 colf" style="transform: scale(.8);"></i> | ||||
| 						</view> | ||||
| 					</view> | ||||
|  | @ -48,8 +48,11 @@ | |||
| 				<view class="colb bold flexs">视频上传</view> | ||||
| 				<view class="disac col9 width100 fe"> | ||||
| 					<view v-for="(item,index) in vedioArr" :key="index" class="col9 radius30 disjcac fc posir mar-y20 item-box width155"> | ||||
| 						<image :src="item" mode="aspectFill" class="width155 radius30"></image> | ||||
| 						<view @tap="vedioArr.splice(index,1)" class="posia disjcac del-btn"> | ||||
| 						<!-- <image :src="item" mode="aspectFill" class="width155 radius30"></image> --> | ||||
| 						<view class="width155 radius30" style="overflow: hidden;" @tap="preVedio(index,1)"> | ||||
| 							<video :src="item" :controls="false" class="width155 radius30"></video> | ||||
| 						</view> | ||||
| 						<view @tap="vedioArr.splice(index,1),tempVedio.splice(index,1)" class="posia disjcac del-btn"> | ||||
| 							<i class="icon icon-del-white fon24 colf" style="transform: scale(.8);"></i> | ||||
| 						</view> | ||||
| 					</view> | ||||
|  | @ -61,8 +64,8 @@ | |||
| 			</view> | ||||
| 			<view class="disjb bbot pad-sx20"> | ||||
| 				<view class="fon30 colb bold flexs">描述文案</view> | ||||
| 				<!-- <input class="fon30 col9 tright" style="max-width: 90%;" v-model="form.content" type="text" placeholder="请输入描述文案"> --> | ||||
| 				<textarea auto-height v-model="form.content" class="fon30 col9 tright" style="max-width: 70%;" placeholder="请输入描述文案"></textarea> | ||||
| 				<!-- <input class="fon30 col9 tright" style="max-width: 90%;" v-model="form.description" type="text" placeholder="请输入描述文案"> --> | ||||
| 				<textarea auto-height v-model="form.description" class="fon30 col9 tright" style="max-width: 70%;" placeholder="请输入描述文案"></textarea> | ||||
| 			</view> | ||||
| 			<view class="dis fon30 bbot pad-sx30"> | ||||
| 				<view class="colb bold flexs">语音上传</view> | ||||
|  | @ -97,6 +100,7 @@ | |||
| 
 | ||||
| <script> | ||||
| 	import { mapState } from 'vuex'; | ||||
| 	import { uploadImg,uploadFile } from "@/jsFile/public-api.js" | ||||
| 	const recorderManager = uni.getRecorderManager(); | ||||
| 	const innerAudioContext = uni.createInnerAudioContext(); | ||||
| 	innerAudioContext.autoplay = true; | ||||
|  | @ -104,13 +108,16 @@ | |||
| 		data() { | ||||
| 			return { | ||||
| 				form:{ | ||||
| 					name:'',//真实姓名 | ||||
| 					phone:'',//联系方式 | ||||
| 					content:''//描述方案 | ||||
| 					u_name:'',//真实姓名 | ||||
| 					u_phone:'',//联系方式 | ||||
| 					description:''//描述方案 | ||||
| 				}, | ||||
| 				imgArr:[],//图片 | ||||
| 				tempImg:[], | ||||
| 				vedioArr:[],//视频 | ||||
| 				tempVedio:[], | ||||
| 				audioText:'',//音频 | ||||
| 				tempAudio:'', | ||||
| 				communityList:[],//社区列表 | ||||
| 				communityIndex:0,//当前选中的社区 | ||||
| 				communityId:'',//社区id | ||||
|  | @ -122,16 +129,18 @@ | |||
| 				typeList:[],//类别列表 | ||||
| 				typeIndex:0,//当前选中的类别 | ||||
| 				typeText:'请选择类别', | ||||
| 				typeId:''//类别id | ||||
| 				typeId:'',//类别id | ||||
| 				flag:true | ||||
| 			} | ||||
| 		}, | ||||
| 		onLoad() { | ||||
| 			// 调用查询社区列表事件 | ||||
| 			this.getCommunityList(); | ||||
| 			// 调用类别查询事件 | ||||
| 			 | ||||
| 			this.getTypeList(); | ||||
| 			this.$requst.get('administrator/reviewedList').then(res=>{ | ||||
| 				if(res.code==0){ | ||||
| 					 | ||||
| 				} | ||||
| 			}) | ||||
| 		}, | ||||
|  | @ -141,24 +150,80 @@ | |||
| 			}) | ||||
| 		}, | ||||
| 		methods: { | ||||
| 			// 预览视频 | ||||
| 			preVedio(index,num){ | ||||
| 				let arr = []; | ||||
| 				let tempArr = [this.imgArr,this.vedioArr][num]; | ||||
| 				if(tempArr.length){ | ||||
| 					tempArr.forEach(item=>{ | ||||
| 						let obj = { | ||||
| 							url:item, | ||||
| 							type:['image','video'][num] | ||||
| 						} | ||||
| 						arr.push(obj); | ||||
| 					}) | ||||
| 				} | ||||
| 				uni.previewMedia({ | ||||
| 					current:index, | ||||
| 					sources:arr | ||||
| 				}) | ||||
| 			}, | ||||
| 			// 提交事件 | ||||
| 			submitEv(){ | ||||
| 				let params = { | ||||
| 					...this.form, | ||||
| 					a:this.communityId,//社区id | ||||
| 					b:this.villageId,//村ID | ||||
| 					c:this.imgArr.join(','),//图片 | ||||
| 					d:this.vedioArr.join(','),//视频 | ||||
| 					e:this.audioText,//语音 | ||||
| 					f:this.typeId,//类别 | ||||
| 				if(this.flag && this.checkEmpty()){ | ||||
| 					this.$toolAll.tools.showToast('正在提交...','none',10000); | ||||
| 					this.flag = false; | ||||
| 					let params = { | ||||
| 						...this.form, | ||||
| 						community_id:this.communityId,//社区id | ||||
| 						village_id:this.villageId,//村ID | ||||
| 						images:this.tempImg.join(','),//图片 | ||||
| 						videos:this.tempVedio.join(','),//视频 | ||||
| 						audios:this.tempAudio,//语音 | ||||
| 						opinion_type:this.typeId,//类别 | ||||
| 						is_anonymous:this.ifAnonymous?1:0 | ||||
| 					} | ||||
| 					this.$requst.post('opinion/createOpinion',params).then(res=>{ | ||||
| 						if(res.code==0){ | ||||
| 							this.$toolAll.tools.showToast('提交成功'); | ||||
| 							setTimeout(()=>{ | ||||
| 								uni.reLaunch({ | ||||
| 									url:'/pagesA/my-opinion-list/my-opinion-list' | ||||
| 								}) | ||||
| 							},500) | ||||
| 						} | ||||
| 					}) | ||||
| 				} | ||||
| 				console.log(params,77777); | ||||
| 				// this.$requst.post('',params).then(res=>{ | ||||
| 					 | ||||
| 				// }) | ||||
| 				// uni.reLaunch({ | ||||
| 				// 	url:'/pagesA/my-opinion-list/my-opinion-list' | ||||
| 				// }) | ||||
| 			}, | ||||
| 			// 检查空值 | ||||
| 			checkEmpty(){ | ||||
| 				let ifempty = false; | ||||
| 				if(!this.ifAnonymous){ | ||||
| 					if(!this.form.u_name){ | ||||
| 						this.$toolAll.tools.showToast('请填写真实姓名'); | ||||
| 					} else if(this.$toolAll.tools.isPhone(this.form.u_phone)){ | ||||
| 						this.$toolAll.tools.showToast('请正确输入手机号'); | ||||
| 					} else if(!this.communityId){ | ||||
| 						this.$toolAll.tools.showToast('请选择社区'); | ||||
| 					} else if(!this.villageId){ | ||||
| 						this.$toolAll.tools.showToast('请选择村'); | ||||
| 					} else if(!this.typeId){ | ||||
| 						this.$toolAll.tools.showToast('请选择类别'); | ||||
| 					} else { | ||||
| 						ifempty = true; | ||||
| 					} | ||||
| 				} else { | ||||
| 					if(!this.communityId){ | ||||
| 						this.$toolAll.tools.showToast('请选择社区'); | ||||
| 					} else if(!this.villageId){ | ||||
| 						this.$toolAll.tools.showToast('请选择村'); | ||||
| 					} else if(!this.typeId){ | ||||
| 						this.$toolAll.tools.showToast('请选择类别'); | ||||
| 					} else { | ||||
| 						ifempty = true; | ||||
| 					} | ||||
| 				}  | ||||
| 				return ifempty; | ||||
| 			}, | ||||
| 			// 选择社区 | ||||
| 			changeCommunity(e){ | ||||
|  | @ -202,9 +267,9 @@ | |||
| 			}, | ||||
| 			// 类别查询 | ||||
| 			getTypeList(){ | ||||
| 				this.$requst.get('common/villageList').then(res=>{ | ||||
| 				this.$requst.get('common/opinionTypes').then(res=>{ | ||||
| 					if(res.code==0){ | ||||
| 						this.typeList = res.data.list; | ||||
| 						this.typeList = res.data; | ||||
| 					} | ||||
| 				}) | ||||
| 			}, | ||||
|  | @ -213,7 +278,12 @@ | |||
| 				uni.chooseImage({ | ||||
| 					count:1, | ||||
| 					success: (tempFile) => { | ||||
| 						this.imgArr = [...this.imgArr,...tempFile.tempFilePaths] | ||||
| 						this.$toolAll.tools.showToast('正在上传图片...','none',100000); | ||||
| 						uploadImg({path:tempFile.tempFilePaths[0]}).then(res=>{ | ||||
| 							this.imgArr.push(tempFile.tempFilePaths[0]); | ||||
| 							this.tempImg.push(this.$imghost + res.data.src); | ||||
| 							uni.hideToast(); | ||||
| 						}) | ||||
| 					} | ||||
| 				}) | ||||
| 			}, | ||||
|  | @ -222,7 +292,12 @@ | |||
| 				uni.chooseVideo({ | ||||
| 					sourceType:['album','camera'], | ||||
| 					success: (tempFile) => { | ||||
| 						this.vedioArr.push(tempFile.tempFilePath); | ||||
| 						this.$toolAll.tools.showToast('正在上传视频...','none',100000); | ||||
| 						uploadFile({path:tempFile.tempFilePath}).then(res=>{ | ||||
| 							this.vedioArr.push(tempFile.tempFilePath); | ||||
| 							this.tempVedio.push(this.$imghost + res.data.src); | ||||
| 							uni.hideToast(); | ||||
| 						}) | ||||
| 					} | ||||
| 				}) | ||||
| 			}, | ||||
|  | @ -240,13 +315,27 @@ | |||
| 					icon:'none', | ||||
| 					duration:1000*120 | ||||
| 				}) | ||||
| 				// const options = { | ||||
| 				// 	duration:600000, | ||||
| 				// 	sampleRate:44100, | ||||
| 				// 	numberOfChannels:1, | ||||
| 				// 	encodeBitRate:192000, | ||||
| 				// 	format:'mp3', | ||||
| 				// 	frameSize:50 | ||||
| 				// } | ||||
| 				// recorderManager.start(options); | ||||
| 				recorderManager.start(); | ||||
| 			}, | ||||
| 			// 结束录音 | ||||
| 			endRecord() { | ||||
| 				recorderManager.stop(); | ||||
| 				recorderManager.onStop((res)=> { | ||||
| 					this.$toolAll.tools.showToast('正在上传录音...','none',100000); | ||||
| 					this.audioText = res.tempFilePath; | ||||
| 					uploadFile({path:this.audioText}).then(res=>{ | ||||
| 						this.tempAudio = this.$imghost + res.data.src; | ||||
| 						uni.hideToast(); | ||||
| 					}) | ||||
| 				}); | ||||
| 				uni.hideToast(); | ||||
| 			}, | ||||
|  | @ -260,6 +349,7 @@ | |||
| 			// 删除录音 | ||||
| 			clearAudio(){ | ||||
| 				this.audioText = ''; | ||||
| 				this.tempAudio = ''; | ||||
| 				recorderManager.stop(); | ||||
| 			} | ||||
| 		} | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue