Compare commits

...

2 Commits

6 changed files with 244 additions and 82 deletions

View File

@ -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');
} }

View File

@ -35,6 +35,8 @@ 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) {
flag = false;
switch (Number(e.data.code)) { switch (Number(e.data.code)) {
case 500: case 500:
// 接口错误 // 接口错误
@ -64,16 +66,14 @@ const checkError = (e) => {
case 6001: case 6001:
// token验证失败或已失效 // token验证失败或已失效
console.log('6001token验证失败或已失效'); console.log('6001token验证失败或已失效');
if(flag) {
flag = false;
// 调用刷新token事件并跳转到当前页面 // 调用刷新token事件并跳转到当前页面
refreshTokenPage(); refreshTokenPage();
}
break; break;
} }
} }
} }
} }
}
// 封装request的(GET、POST)请求 // 封装request的(GET、POST)请求
const request = (method, url, options) => { const request = (method, url, options) => {
@ -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,15 @@ const request = (method, url, options) => {
}) })
} }
// 上传文件 封装请求 // 上传文件 封装请求
const uploadFile = (url, options) => { const uploadFile = (url, options, type) => {
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: '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 +179,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)
} }
} }

View File

@ -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({

View File

@ -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);

View File

@ -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(){

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.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(){
if(this.flag && this.checkEmpty()){
this.$toolAll.tools.showToast('正在提交...','none',10000);
this.flag = false;
let params = { let params = {
...this.form, ...this.form,
a:this.communityId,//id community_id:this.communityId,//id
b:this.villageId,//ID village_id:this.villageId,//ID
c:this.imgArr.join(','),// images:this.tempImg.join(','),//
d:this.vedioArr.join(','),// videos:this.tempVedio.join(','),//
e:this.audioText,// audios:this.tempAudio,//
f:this.typeId,// opinion_type:this.typeId,//
is_anonymous:this.ifAnonymous?1:0
} }
console.log(params,77777); this.$requst.post('opinion/createOpinion',params).then(res=>{
// this.$requst.post('',params).then(res=>{ if(res.code==0){
this.$toolAll.tools.showToast('提交成功');
// }) setTimeout(()=>{
// uni.reLaunch({ uni.reLaunch({
// url:'/pagesA/my-opinion-list/my-opinion-list' url:'/pagesA/my-opinion-list/my-opinion-list'
// }) })
},500)
}
})
}
},
//
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){ 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.$toolAll.tools.showToast('正在上传视频...','none',100000);
uploadFile({path:tempFile.tempFilePath}).then(res=>{
this.vedioArr.push(tempFile.tempFilePath); 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();
} }
} }