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

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; background-color: #FFFFFF;
} }
.solution-title { .solution-title {
bottom: 6rpx; bottom: 0rpx;
left: -40rpx; left: -40rpx;
right: -40rpx; right: -40rpx;
padding: 6rpx; padding: 6rpx;

View File

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

View File

@ -83,6 +83,22 @@ const tools = {
// 手机号中间四位用"****"带替 // 手机号中间四位用"****"带替
hideMPhone(phone){ hideMPhone(phone){
return `${phone.substr(0, 3)}****${phone.substr(7)}` 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){ hideName(name,num){

View File

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

View File

@ -195,7 +195,7 @@
<scroll-view scroll-x> <scroll-view scroll-x>
<view :class="solutionList.length == 4 ? 'disjbac' : 'disac'"> <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' : ''}"> <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 class="posia solution-title clips1">{{item.title}}</view>
</view> </view>
</view> </view>
@ -363,9 +363,10 @@
}, },
// //
getPlanType(){ 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) { if(res.code) {
res.data.forEach(item=>{ this.solutionList = [];
res.data.data.forEach(item=>{
let obj = { let obj = {
id:item.id, id:item.id,
title:item.name, title:item.name,
@ -373,7 +374,7 @@
} }
this.solutionList.push(obj); this.solutionList.push(obj);
}) })
console.log(this.solutionList,340); // console.log(this.solutionList,340);
} }
}) })
}, },
@ -427,8 +428,11 @@
}, },
// //
goDetail(index,id) { goDetail(index,id) {
// uni.navigateTo({
// url:`/pagesB/plan-fault-product-detail/detail?index=${index}&id=${id}`
// })
uni.navigateTo({ 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: { methods: {
// //
getMessageList(){ 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: { methods: {
// //
getData(){ getData(){
this.$requst.get('/universal/api.user/user_info').then(res => { this.$requst.get('/universal/api.user/user_info').then(res => {
if (res.code == 1 && res.data.length != 1) { if (res.code == 1 && res.data.length != 1) {
console.log(res.data)
this.nickname=res.data.nickname this.nickname=res.data.nickname
this.full_name=res.data.name this.full_name=res.data.name
if(res.data.sex==0){ if(res.data.sex==0){
@ -121,12 +119,9 @@
this.contact_number=res.data.phone this.contact_number=res.data.phone
this.e_mail=res.data.email this.e_mail=res.data.email
this.id_card_no=res.data.idcard this.id_card_no=res.data.idcard
} }
}) })
}, },
// //
sumbmitData(){ sumbmitData(){
if(this.checkEmpty()){ if(this.checkEmpty()){
@ -199,27 +194,13 @@
count:1, count:1,
sourceType:['album'], sourceType:['album'],
success: (res) => { success: (res) => {
let tempImg = res.tempFilePaths; let tempImg = res.tempFilePaths[0];
this.imgList[index] = tempImg[0]; this.imgList[index] = tempImg;
let params = { uploadImg({path:tempImg}).then(res=>{
token: uni.getStorageSync('token'), if(res.code) {
dir: 'images', this.$toolAll.tools.showToast('上传成功');
from:tempImg[0]
} }
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>
</view> </view>
</container-subgroup> </container-subgroup>
<nothing-page v-if="dataList.length==0" content="暂无更多列表数据"></nothing-page>
</view> </view>
</template> </template>
@ -42,12 +43,14 @@
size:10, size:10,
page:1, page:1,
total:0, total:0,
type_id:'',//id
dataList:[] dataList:[]
} }
}, },
onLoad(op) { onLoad(op) {
this.ifPlanFault = `${['解决方案','常见故障'][op.index*1]}`; this.ifPlanFault = `${['解决方案','常见故障'][op.index*1]}`;
this.current = op.index*1; this.current = op.index*1;
if(op.type_id!=undefined) this.type_id = op.type_id;
this.getPlanFault(); this.getPlanFault();
}, },
methods: { methods: {
@ -65,7 +68,7 @@
]; ];
let params = [ let params = [
{ {
type_id:1, type_id:this.type_id,
list_rows:this.size, list_rows:this.size,
page:this.page page:this.page
}, },

View File

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