From 779f654e0993552e422c81514185fbf200728a34 Mon Sep 17 00:00:00 2001 From: chen <2659004835@qq.com> Date: Mon, 28 Mar 2022 18:40:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9F=9F=E5=90=8D=E9=85=8D=E7=BD=AE=E6=9B=BF?= =?UTF-8?q?=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 12 +- jsFile/requst.js | 15 +- jsFile/tools.js | 2 +- pages/feedback/feedback.vue | 154 +++++++++++--------- pages/tabbar/pagehome/pagehome.vue | 4 +- pagesB/i-want-evaluate/i-want-evaluate.vue | 36 ++++- pagesB/plan-fault-product-detail/detail.vue | 2 +- pagesB/plan-fault/plan-fault.vue | 2 +- pagesB/service-range/service-range.vue | 4 +- 9 files changed, 141 insertions(+), 90 deletions(-) diff --git a/App.vue b/App.vue index 933c09e..28f5a91 100644 --- a/App.vue +++ b/App.vue @@ -3,19 +3,23 @@ globalData:{ projectname:'', // 项目名称 lat:'', // 公司地址维度 - lng:'' // 公司地址经度 + lng:'' ,// 公司地址经度 + hostapi:'' // 域名配置 }, // 优先于show方法 onLaunch: function() { // 配置全局域名 // #ifdef APP-PLUS - uni.setStorageSync('hostapi','http://maintain.7and5.cn'); + // uni.setStorageSync('hostapi','http://maintain.7and5.cn'); + getApp().globalData.hostapi = 'http://maintain.7and5.cn'; // #endif // #ifdef MP-WEIXIN - uni.setStorageSync('hostapi','http://maintain.7and5.cn'); + // uni.setStorageSync('hostapi','http://maintain.7and5.cn'); + getApp().globalData.hostapi = 'http://maintain.7and5.cn'; // #endif // #ifdef H5 - uni.setStorageSync('hostapi','/web'); + // uni.setStorageSync('hostapi','/web'); + getApp().globalData.hostapi = '/web'; // #endif }, onShow: function() { diff --git a/jsFile/requst.js b/jsFile/requst.js index 5a3f313..d3811bb 100644 --- a/jsFile/requst.js +++ b/jsFile/requst.js @@ -1,7 +1,16 @@ // 判断当前环境 const ENV = process.env.NODE_ENV; console.log(ENV,'当前环境'); // development:开发环境 test:测试环境 production:生产环境 - +// 配置全局域名 +// #ifdef APP-PLUS + const hostapi = 'http://maintain.7and5.cn'; +// #endif +// #ifdef MP-WEIXIN + const hostapi = 'http://maintain.7and5.cn'; +// #endif +// #ifdef H5 + const hostapi = '/web'; +// #endif // 清理所有缓存并前往授权页 const goLogin = () => { uni.clearStorageSync(); @@ -77,7 +86,7 @@ const request = (method, url, options) => { params.token = uni.getStorageSync('token'); return new Promise((resolve, reject) => { uni.request({ - url: `${uni.getStorageSync('hostapi')}${url}`, + url: `${hostapi}${url}`, method: methods, data: params, header: headers, @@ -108,7 +117,7 @@ const uploadFile = (url, options) => { console.log(tempData,108); return new Promise((resolve, reject) => { uni.uploadFile({ - url: `${uni.getStorageSync('hostapi')}${url}`, + url: `${hostapi}${url}`, filePath: tempData.file, name: 'image', fileType:'image', diff --git a/jsFile/tools.js b/jsFile/tools.js index 531362d..d9bbd38 100644 --- a/jsFile/tools.js +++ b/jsFile/tools.js @@ -405,7 +405,7 @@ const tools = { if (res.code) { var params = {code:res.code} uni.request({ - url: `${uni.getStorageSync('hostapi')}/api/user/login`, + url: `${getApp().globalData.hostapi}/api/user/login`, method: 'post', data: params, header: { diff --git a/pages/feedback/feedback.vue b/pages/feedback/feedback.vue index e18e78a..50348aa 100644 --- a/pages/feedback/feedback.vue +++ b/pages/feedback/feedback.vue @@ -3,64 +3,41 @@ - - 意见类型 - - + 意见类型 - - {{item.title}} - + {{item.title}} - - @@ -78,37 +55,73 @@ data() { return { isReturn:false, - typeData: [{ - title: "未解决问题", - state: false - }, - { - title: "处理不及时", - state: false - }, - { - title: "软件问题", - state: false - }, - { - title: "报修问题", - state: true - }, - { - title: "服务投诉", - state: false - }, - { - title: "其他问题反馈", - state: false - }, - ] + typeData: [ + {title: "未解决问题",state: false}, + {title: "处理不及时",state: false}, + {title: "软件问题",state: false}, + {title: "报修问题",state: false}, + {title: "服务投诉",state: false}, + {title: "其他问题反馈",state: false}, + ], + typeNum:0, + opinion:'', + name:'', + phone:'', + imgSrc:'', + flag:true } }, onLoad() { this.checkFeedback(); }, methods: { + // 提交反馈事件 + submitData(){ + if(this.checkEmpty()) { + 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 + } + console.log(params,107); + // this.$requst.post('',params).then(res=>{ + // if(res.code) { + // uni.navigateBack({delta:1}) + // } else { + // this.flag = true; + // } + // }) + } + } + }, + // 判空事件 + checkEmpty() { + let result = false; + if(!this.opinion) { + this.$toolAll.tools.showToast('请输入意见或建议'); + } else if(!this.name) { + this.$toolAll.tools.showToast('请输入联系人姓名'); + } else if(this.$toolAll.tools.isPhone(this.phone)) { + this.$toolAll.tools.showToast('请正确输入联系人电话'); + } else { + result = true; + } + return result; + }, + // 图片选择事件 + chooseImg(){ + uni.chooseImage({ + count:1, + sourceType:['album','camera'], + success: (res) => { + this.imgSrc = res.tempFilePaths[0] + } + }) + }, // 查询意见反馈类型 checkFeedback(){ this.$requst.get('/universal/api.feedback/feedback_type',{page:1,list_rows:20}).then(res=>{ @@ -116,10 +129,11 @@ }) }, opinionType(index) { - for (var i = 0; i < this.typeData.length; i++) { - this.typeData[i].state = false - } - this.typeData[index].state = true + this.typeNum = index; + // for (var i = 0; i < this.typeData.length; i++) { + // this.typeData[i].state = false + // } + // this.typeData[index].state = true } } } diff --git a/pages/tabbar/pagehome/pagehome.vue b/pages/tabbar/pagehome/pagehome.vue index 6d3b011..d48d84b 100644 --- a/pages/tabbar/pagehome/pagehome.vue +++ b/pages/tabbar/pagehome/pagehome.vue @@ -372,7 +372,7 @@ let obj = { id:item.id, title:item.name, - imgsrc: uni.getStorageSync('hostapi') + '/' + item.cover_img, + imgsrc: getApp().globalData.hostapi + '/' + item.cover_img, } this.solutionList.push(obj); }) @@ -402,7 +402,7 @@ let obj = { id:item.id, title:item.title, - imgsrc: uni.getStorageSync('hostapi') + '/' + item.cover_img, + imgsrc: getApp().globalData.hostapi + '/' + item.cover_img, content:item.summary, views:item.reading } diff --git a/pagesB/i-want-evaluate/i-want-evaluate.vue b/pagesB/i-want-evaluate/i-want-evaluate.vue index ed0c72e..836b44a 100644 --- a/pagesB/i-want-evaluate/i-want-evaluate.vue +++ b/pagesB/i-want-evaluate/i-want-evaluate.vue @@ -5,10 +5,10 @@ - 长沙XXXXXXXXX项目名称 - GD20220108-1002 + {{project_name}} + {{project_number}} - 服务时间:2022-01-11 15 : 27 + 服务时间:{{project_time}}