完善意见反馈接口、图片上传接口

master
chen 2022-04-06 11:24:55 +08:00
parent d99bdbb3d0
commit 9d5406c1f1
9 changed files with 111 additions and 117 deletions

View File

@ -196,7 +196,7 @@ uni-radio .uni-radio-input {border: 1rpx solid #444444;}
background-color: #FFFFFF;
}
.solution-title {
bottom: 6rpx;
bottom: 0rpx;
left: -40rpx;
right: -40rpx;
padding: 6rpx;

View File

@ -123,21 +123,21 @@ const uploadFile = (url, options) => {
return new Promise((resolve, reject) => {
uni.uploadFile({
url: `${hostapi}${url}`,
filePath: tempData.form,
name: 'image',
filePath: tempData.path,
name: 'file',
fileType:'image',
formData: tempData,
// sslVerify:false,//验证 ssl 证书 仅App安卓端支持
// withCredentials:true,//跨域请求时是否携带凭证cookies仅H5支持
header: {
'Content-Type': 'multipart/form-data;charset=UTF-8',
'Authorization': 'Bearer '+uni.getStorageSync('token') || '',
'token':uni.getStorageSync('token') || ''
// 'Content-Type': 'multipart/form-data;charset=UTF-8',
// 'Authorization': 'Bearer '+uni.getStorageSync('token') || '',
token:uni.getStorageSync('token') || ''
},
success: res => {
if (res.statusCode == 200) {
let temp = JSON.parse(res.data)
if (temp.code == 0) {
if (temp.code == 1) {
resolve(temp)
}
}

View File

@ -83,6 +83,22 @@ const tools = {
// 手机号中间四位用"****"带替
hideMPhone(phone){
return `${phone.substr(0, 3)}****${phone.substr(7)}`
},
// 手机号中间加字符
phoneAddChat(phone,startNum=3,endNum=7,character=' '){
let phoneStr = phone;
phoneStr = phoneStr.replace(/\s*/g, "");
var phoneArr = [];
for(var i = 0; i < phoneStr.length; i++){
if (i==startNum||i==endNum){
phoneArr.push(`${character}` + phoneStr.charAt(i));
console.log(phoneArr);
} else {
phoneArr.push(phoneStr.charAt(i));
}
}
phone = phoneArr.join("");
return phone;
},
// 昵称从第一个字开始,后面的都用"*"代替
hideName(name,num){

View File

@ -28,14 +28,15 @@
<image class="icon" src="/static/iocn/tel.png" mode=""></image>
<view class="feedback-tel-con">
<view class="text">服务监督电话</view>
<view class="tel bold">156 1566 0510</view>
<!-- <view class="tel bold">156 1566 0510</view> -->
<view class="tel bold">{{feedbackPhone}}</view>
</view>
</view>
<view class="feedback-con">
<image class="icon" src="/static/iocn/date.png" mode=""></image>
<view class="feedback-tel-con">
<view class="text">反馈受理时间</view>
<view class="tel bold">9:00 - 18:00</view>
<view class="tel bold">{{feedbackTime}}</view>
</view>
</view>
</view>
@ -50,6 +51,7 @@
import statusNav from '../../components/status-nav.vue';
import footTabOne from "../../components/foot-tabs/foot-tab-one.vue"
import containerSubgroupTwo from '@/components/containers/container-subgroup-two.vue';
import { uploadImg } from '@/jsFile/public-api.js';
const app = getApp();
export default {
components: {
@ -60,37 +62,17 @@
data() {
return {
isReturn: false,
typeData: [{
title: "未解决问题",
state: false
},
{
title: "处理不及时",
state: false
},
{
title: "软件问题",
state: false
},
{
title: "报修问题",
state: false
},
{
title: "服务投诉",
state: false
},
{
title: "其他问题反馈",
state: false
},
],
//
typeData: [],
typeNum: 0,
opinion: '',
name: '',
phone: '',
imgSrc: '',
flag: true
flag: true,
feedbackPhone:'',//
feedbackTime:'',//
type_id:''//id
}
},
onLoad() {
@ -103,20 +85,23 @@
if (this.flag) {
this.flag = false;
let params = {
a: this.typeData[this.typeNum].title,
b: this.opinion,
c: this.name,
d: this.phone,
e: this.imgSrc
type_id: this.type_id,
picture: this.imgSrc,
contact_name: this.name,
contact_phone: this.phone,
content: this.opinion
}
console.log(params, 107);
// this.$requst.post('',params).then(res=>{
// if(res.code) {
// uni.navigateBack({delta:1})
// } else {
// this.flag = true;
// }
// })
this.$requst.post('/universal/api.feedback/feedback',params).then(res=>{
if(res.code) {
this.$toolAll.tools.showToast('反馈成功');
this.imgSrc = '';
this.name = '';
this.phone = '';
this.opinion = '';
} else {
this.flag = true;
}
})
}
}
},
@ -139,23 +124,13 @@
console.log( uni.getStorageSync("token"))
uni.chooseImage({
success: (chooseImageRes) => {
const tempFilePaths = chooseImageRes.tempFilePaths;
this.imgSrc = chooseImageRes.tempFilePaths[0]
uni.uploadFile({
url: app.globalData.hostapi+'/universal/api.upload/upload', //
filePath: tempFilePaths[0],
name: 'image',
header:{
token: uni.getStorageSync("token")
},
formData: {
dir:"images"
},
success: (uploadFileRes) => {
console.log(uploadFileRes)
const tempFilePaths = chooseImageRes.tempFilePaths[0];
this.imgSrc = tempFilePaths;
uploadImg({path:tempFilePaths}).then(res=>{
if(res.code) {
this.$toolAll.tools.showToast('上传成功');
}
});
})
}
});
@ -164,17 +139,32 @@
checkFeedback() {
this.$requst.get('/universal/api.feedback/feedback_type', {
page: 1,
list_rows: 20
list_rows: 200
}).then(res => {
let newData = res.data;
if(res.code){
this.typeData = [];
//
this.feedbackTime = `${newData.start_time} - ${newData.end_time}`;
//
this.feedbackPhone = this.$toolAll.tools.phoneAddChat(newData.phone);
if(newData.type_list.length) {
newData.type_list.forEach(item=>{
let obj = {
title:item.name,
id:item.type_id
}
this.typeData.push(obj);
})
// id
this.type_id = this.typeData[0].id;
}
}
})
},
opinionType(index) {
this.typeNum = index;
// for (var i = 0; i < this.typeData.length; i++) {
// this.typeData[i].state = false
// }
// this.typeData[index].state = true
this.type_id = this.typeData[index].id;
}
}
}
@ -230,7 +220,7 @@
font-size: 30rpx;
border-radius: 10rpx;
background-color: #FFFFFF;
color: #9f9898;
color: #000000;
display: flex;
margin-bottom: 16rpx;
align-items: center;

View File

@ -195,7 +195,7 @@
<scroll-view scroll-x>
<view :class="solutionList.length == 4 ? 'disjbac' : 'disac'">
<view @tap="goDetail(0,item.id)" class="posir flexs" v-for="(item,index) in solutionList" :key="index" style="width: 23%;height: 214rpx;" :style="{marginRight: solutionList.length != 4 ? '20rpx' : ''}">
<image style="width: 100%;height: 214rpx;" class="radius10 " :src="item.imgsrc" mode="widthFix"></image>
<image style="width: 100%;height: 214rpx;" class="radius10 " :src="item.imgsrc" mode="aspectFill"></image>
<view class="posia solution-title clips1">{{item.title}}</view>
</view>
</view>
@ -363,9 +363,10 @@
},
//
getPlanType(){
this.$requst.post('/universal/api.solution/solution_type').then(res=>{
this.$requst.get('/universal/api.solution/solution',{page:1,list_rows:20}).then(res=>{
if(res.code) {
res.data.forEach(item=>{
this.solutionList = [];
res.data.data.forEach(item=>{
let obj = {
id:item.id,
title:item.name,
@ -373,7 +374,7 @@
}
this.solutionList.push(obj);
})
console.log(this.solutionList,340);
// console.log(this.solutionList,340);
}
})
},
@ -427,8 +428,11 @@
},
//
goDetail(index,id) {
// uni.navigateTo({
// url:`/pagesB/plan-fault-product-detail/detail?index=${index}&id=${id}`
// })
uni.navigateTo({
url:`/pagesB/plan-fault-product-detail/detail?index=${index}&id=${id}`
url:`/pagesB/plan-fault/plan-fault?index=${index}&type_id=${id}`
})
},
//

View File

@ -33,7 +33,7 @@
methods: {
//
getMessageList(){
this.$requst.get('/universal/api.message/message_list').then(res=>{
this.$requst.get('/universal/api.message/message_list',{page: 1,list_rows: 200}).then(res=>{
})
}

View File

@ -106,11 +106,9 @@
},
methods: {
//
getData(){
this.$requst.get('/universal/api.user/user_info').then(res => {
if (res.code == 1 && res.data.length != 1) {
console.log(res.data)
this.nickname=res.data.nickname
this.full_name=res.data.name
if(res.data.sex==0){
@ -121,12 +119,9 @@
this.contact_number=res.data.phone
this.e_mail=res.data.email
this.id_card_no=res.data.idcard
}
})
},
//
sumbmitData(){
if(this.checkEmpty()){
@ -199,27 +194,13 @@
count:1,
sourceType:['album'],
success: (res) => {
let tempImg = res.tempFilePaths;
this.imgList[index] = tempImg[0];
let params = {
token: uni.getStorageSync('token'),
dir: 'images',
from:tempImg[0]
let tempImg = res.tempFilePaths[0];
this.imgList[index] = tempImg;
uploadImg({path:tempImg}).then(res=>{
if(res.code) {
this.$toolAll.tools.showToast('上传成功');
}
console.log(params,104);
uploadImg(params).then(res=>{
console.log(res);
})
// this.$requst.upload('file/upload/image',{file:tempImg[i]}).then(res=>{
// if(this.imgArr.length!=9){
// // this.imgArr.push(this.$http + res.data.src);
// }
// if(num==tempImg.length){
// this.$toolAll.tools.showToast('(*^^*)')
// } else {
// this.$toolAll.tools.showToast('...')
// }
// },error=>{})
}
})
},

View File

@ -24,6 +24,7 @@
</view>
</view>
</container-subgroup>
<nothing-page v-if="dataList.length==0" content="暂无更多列表数据"></nothing-page>
</view>
</template>
@ -42,12 +43,14 @@
size:10,
page:1,
total:0,
type_id:'',//id
dataList:[]
}
},
onLoad(op) {
this.ifPlanFault = `${['解决方案','常见故障'][op.index*1]}`;
this.current = op.index*1;
if(op.type_id!=undefined) this.type_id = op.type_id;
this.getPlanFault();
},
methods: {
@ -65,7 +68,7 @@
];
let params = [
{
type_id:1,
type_id:this.type_id,
list_rows:this.size,
page:this.page
},

View File

@ -116,7 +116,7 @@
//
getSettings(){
this.$requst.post('/universal/api.settings/settings').then(res=>{
if(res.code==1){
if(res.code){
// uni.navigateBack({delta:1})