Compare commits

..

No commits in common. "4ba0cbcccbf08cbc19d84c387e05f08621429276" and "3a13f8feefe89b0b8e0897328c00b74d4fd6d469" have entirely different histories.

6 changed files with 82 additions and 244 deletions

View File

@ -1,7 +1,4 @@
import request from './requst.js'; import request from './requst.js';
export function uploadImg(data) { export function uploadImg(data) {
return request.upload("file/upload/image", data); return request.upload("/universal/api.upload/upload", data);
}
export function uploadFile(data) {
return request.upload("file/upload/file", data,'file');
} }

View 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) {
if(flag) { switch (Number(e.data.code)) {
flag = false; case 500:
switch (Number(e.data.code)) { // 接口错误
case 500: console.log('500接口错误');
// 接口错误 case 4003:
console.log('500接口错误'); // 参数错误
case 4003: console.log('4003参数错误');
// 参数错误 break;
console.log('4003参数错误'); case 4004:
break; // 记录不存在
case 4004: console.log('4004记录不存在');
// 记录不存在 break;
console.log('4004记录不存在'); case 5001:
break; // xxx错误
case 5001: console.log('5001xxx错误');
// xxx错误 break;
console.log('5001xxx错误'); case 5050:
break; // 服务器错误,请稍后重试
case 5050: console.log('5050服务器错误请稍后重试');
// 服务器错误,请稍后重试 // 调用到登录页
console.log('5050服务器错误请稍后重试'); goLogin();
// 调用到登录页 break;
goLogin(); case 5051:
break; // 未知错误
case 5051: console.log('5051未知错误');
// 未知错误 break;
console.log('5051未知错误'); case 6001:
break; // token验证失败或已失效
case 6001: console.log('6001token验证失败或已失效');
// token验证失败或已失效 if(flag) {
console.log('6001token验证失败或已失效'); flag = false;
// 调用刷新token事件并跳转到当前页面 // 调用刷新token事件并跳转到当前页面
refreshTokenPage(); refreshTokenPage();
break;
} }
} break;
}
} }
} }
} }
@ -116,10 +116,6 @@ 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 {
@ -139,15 +135,14 @@ const request = (method, url, options) => {
}) })
} }
// 上传文件 封装请求 // 上传文件 封装请求
const uploadFile = (url, options, type) => { const uploadFile = (url, options) => {
let tempData = options || {} let tempData = options || {}
console.log(type,7777);
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: type, name: 'image',
// fileType:type,//支付宝小程序必传 fileType:'image',
formData: tempData, formData: tempData,
header: { header: {
'Content-Type': 'multipart/form-data;charset=UTF-8', 'Content-Type': 'multipart/form-data;charset=UTF-8',
@ -179,7 +174,7 @@ export default {
return request('postForm', url, options) return request('postForm', url, options)
}, },
// 上传 // 上传
upload: (url, options, type='image') => { upload: (url, options) => {
return uploadFile(url, options, type) return uploadFile(url, options)
} }
} }

View File

@ -11,9 +11,6 @@ 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({

View File

@ -24,7 +24,6 @@
userInfo:'', userInfo:'',
ifFlag:true ifFlag:true
} }
}, },
methods: { methods: {
// //
@ -60,7 +59,7 @@
} }
this.$requst.post('user/login',params).then(res => { this.$requst.post('user/login',params).then(res => {
uni.hideToast(); uni.hideToast();
if(res.data.nickname!=''){ if(res.data.token!=''){
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);

View File

@ -6,73 +6,46 @@
<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 dataList" :key="index"> <view class="mar-s20 radius20 fon24 bacf posir" v-for="(item,index) in 50" :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">{{item.coding}}</view> <view class="fon30">LH20220729130234</view>
<view class="">用户名{{item.u_name || '匿名提交'}}</view> <view class="">用户名匿名提交</view>
<view class="">{{item.community.name}}{{item.village.name}}</view> <view class="">金牛社区A村</view>
<view class="">反馈问题{{item.description}}</view> <view class="">反馈问题我就是想问下我们村的路多久能修好</view>
</view> </view>
<view class="dis fon30"> <view class="dis fon30">
<view @tap="goDetail(item.id)" class="width50 pad-sx30 disjcac border-r"> <view @tap="goDetail(0)" 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" @tap="returnEv(item.id,index)" class="width50 pad-sx30 disjcac"> <view v-if="switchIndex==0" 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(item.id)" v-if="switchIndex==1" class="width50 pad-sx30 disjcac"> <view @tap="goFeedback(0)" 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: {
@ -80,39 +53,6 @@
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(){

View File

@ -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.u_name" type="text" maxlength="16" placeholder="请输入姓名"> <input class="fon30 col9 tright width100" v-model="form.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.u_phone" type="number" maxlength="11" placeholder="请填写手机号码"> <input class="fon30 col9 tright width100" v-model="form.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" @tap="preVedio(index,0)"></image> <image :src="item" mode="aspectFill" class="width155 radius30"></image>
<view @tap="imgArr.splice(index,1),tempImg.splice(index,1)" class="posia disjcac del-btn"> <view @tap="imgArr.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,11 +48,8 @@
<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 class="width155 radius30" style="overflow: hidden;" @tap="preVedio(index,1)"> <view @tap="vedioArr.splice(index,1)" class="posia disjcac del-btn">
<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>
@ -64,8 +61,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.description" type="text" placeholder="请输入描述文案"> --> <!-- <input class="fon30 col9 tright" style="max-width: 90%;" v-model="form.content" type="text" placeholder="请输入描述文案"> -->
<textarea auto-height v-model="form.description" class="fon30 col9 tright" style="max-width: 70%;" placeholder="请输入描述文案"></textarea> <textarea auto-height v-model="form.content" 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>
@ -100,7 +97,6 @@
<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;
@ -108,16 +104,13 @@
data() { data() {
return { return {
form:{ form:{
u_name:'',// name:'',//
u_phone:'',// phone:'',//
description:''// content:''//
}, },
imgArr:[],// imgArr:[],//
tempImg:[],
vedioArr:[],// vedioArr:[],//
tempVedio:[],
audioText:'',// audioText:'',//
tempAudio:'',
communityList:[],// communityList:[],//
communityIndex:0,// communityIndex:0,//
communityId:'',//id communityId:'',//id
@ -129,18 +122,16 @@
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){
} }
}) })
}, },
@ -150,80 +141,24 @@
}) })
}, },
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(){
if(this.flag && this.checkEmpty()){ let params = {
this.$toolAll.tools.showToast('正在提交...','none',10000); ...this.form,
this.flag = false; a:this.communityId,//id
let params = { b:this.villageId,//ID
...this.form, c:this.imgArr.join(','),//
community_id:this.communityId,//id d:this.vedioArr.join(','),//
village_id:this.villageId,//ID e:this.audioText,//
images:this.tempImg.join(','),// f:this.typeId,//
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; // })
if(!this.ifAnonymous){ // uni.reLaunch({
if(!this.form.u_name){ // url:'/pagesA/my-opinion-list/my-opinion-list'
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){
@ -267,9 +202,9 @@
}, },
// //
getTypeList(){ getTypeList(){
this.$requst.get('common/opinionTypes').then(res=>{ this.$requst.get('common/villageList').then(res=>{
if(res.code==0){ if(res.code==0){
this.typeList = res.data; this.typeList = res.data.list;
} }
}) })
}, },
@ -278,12 +213,7 @@
uni.chooseImage({ uni.chooseImage({
count:1, count:1,
success: (tempFile) => { success: (tempFile) => {
this.$toolAll.tools.showToast('正在上传图片...','none',100000); this.imgArr = [...this.imgArr,...tempFile.tempFilePaths]
uploadImg({path:tempFile.tempFilePaths[0]}).then(res=>{
this.imgArr.push(tempFile.tempFilePaths[0]);
this.tempImg.push(this.$imghost + res.data.src);
uni.hideToast();
})
} }
}) })
}, },
@ -292,12 +222,7 @@
uni.chooseVideo({ uni.chooseVideo({
sourceType:['album','camera'], sourceType:['album','camera'],
success: (tempFile) => { success: (tempFile) => {
this.$toolAll.tools.showToast('正在上传视频...','none',100000); this.vedioArr.push(tempFile.tempFilePath);
uploadFile({path:tempFile.tempFilePath}).then(res=>{
this.vedioArr.push(tempFile.tempFilePath);
this.tempVedio.push(this.$imghost + res.data.src);
uni.hideToast();
})
} }
}) })
}, },
@ -315,27 +240,13 @@
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();
}, },
@ -349,7 +260,6 @@
// //
clearAudio(){ clearAudio(){
this.audioText = ''; this.audioText = '';
this.tempAudio = '';
recorderManager.stop(); recorderManager.stop();
} }
} }