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