main
YXQ 1 year ago
parent ec7b52efb7
commit 9463a158aa
  1. 2
      app.js
  2. 44
      pages/feedback/feedback.js
  3. 2
      pages/feedback/feedback.wxml
  4. 1
      pages/login/login.js

@ -16,7 +16,7 @@ App({
globalData: { globalData: {
// 本地环境 // 本地环境
baseUrl:'http://192.168.51.200:8201/mall-portal', baseUrl:'http://192.168.51.22:8201/mall-portal',
// 线上环境 // 线上环境
// baseUrl:'https://portal-api.macrozheng.com', // baseUrl:'https://portal-api.macrozheng.com',
token: '', token: '',

@ -8,7 +8,7 @@ Page({
*/ */
data: { data: {
array: ['请选择', 'bug问题', '业务问题', '功能使用问题', '其他'], array: ['请选择', 'bug问题', '业务问题', '功能使用问题', '其他'],
objectArray: [{ problemArray: [{
id: 0, id: 0,
name: '请选择' name: '请选择'
}, },
@ -29,16 +29,16 @@ Page({
name: '其他' name: '其他'
} }
], ],
index: 0, index: 0, //问题下标
srxI: '', problemStr:'',
//图片数组 //图片数组
addImgBtn: { addImgBtn: {
isBtn: true, isBtn: true,
text: "+", text: "+",
func: "addImage" func: "addImage"
}, },
imageArr: [] imageArr: [], //显示图片列表
upImageArr: [], //需要上传的图片路径
}, },
bindPickerChange(e) { bindPickerChange(e) {
@ -49,15 +49,24 @@ Page({
//提交数据 //提交数据
goMyorder() { goMyorder() {
if(this.data.index === 0){ if (this.data.index === 0) {
wx.showToast({ wx.showToast({
title: '请选择问题类型', title: '请选择问题类型',
}); });
return; return;
} }
var problem = objectArray[this.data.index]; //问题类型 var problem = this.data.problemArray[this.data.index]; //问题类型
request.post(`/feedBack/push?type=${this.data.index}&describe=${problem}`).then(res=>{ var data = {
'type': this.data.index,
'describe': this.data.problemStr,
'imgs':this.data.upImageArr.toString
}
console.log(JSON.stringify(data))
request.post(`/feedBack/push`, data).then(res => {
wx.showToast({
title: 'title',
})
console.log(JSON.stringify(res.data))
}); });
// wx.switchTab({ // wx.switchTab({
// url: '../about/about', // url: '../about/about',
@ -77,7 +86,7 @@ Page({
count: 1, count: 1,
mediaType: ['image'], mediaType: ['image'],
sourceType: ['album'], sourceType: ['album'],
sizeType:['compressed'], sizeType: ['compressed'],
success: res => { success: res => {
var imgSrc = res.tempFiles[0].tempFilePath; var imgSrc = res.tempFiles[0].tempFilePath;
_this.addCallBackImage(imgSrc); _this.addCallBackImage(imgSrc);
@ -88,7 +97,6 @@ Page({
//显示回调图片 //显示回调图片
addCallBackImage(imageSrc) { addCallBackImage(imageSrc) {
console.log("imgSrc=" + imageSrc);
var temp = { var temp = {
isBtn: false, isBtn: false,
imgUrl: imageSrc, imgUrl: imageSrc,
@ -105,18 +113,20 @@ Page({
upImg(imageSrc) { upImg(imageSrc) {
request.upImgFile(`/feedBack/upload`, imageSrc).then(res => { request.upImgFile(`/feedBack/upload`, imageSrc).then(res => {
var resObj = JSON.parse(res.data); var resObj = JSON.parse(res.data);
if(resObj.code === 500){ if (resObj.code > 400) {
wx.showModal({ wx.showModal({
title: '提示', title: '提示',
content: resObj.message, content: resObj.message,
complete: (res) => { complete: (res) => {
if (res.cancel) { if (res.cancel) {}
} if (res.confirm) {}
if (res.confirm) { //上传失败后移除图片
}
//移除图片
} }
}) })
} else {
//保存图片路径到数组
this.data.upImageArr.push(resObj.data.url);
} }
}); });
}, },

@ -9,7 +9,7 @@
<text class="why">{{array[index]}}</text> <text class="why">{{array[index]}}</text>
</picker> </picker>
</view> </view>
<textarea class="textarea" placeholder="补充描述,有助于更好的处理问题。" placeholder-class="place"></textarea> <textarea class="textarea" placeholder="补充描述,有助于更好的处理问题。" placeholder-class="place" value="{{problemStr}}"></textarea>
</view> </view>
<view style="margin-top: 60rpx; font-size: 26rpx;"> <view style="margin-top: 60rpx; font-size: 26rpx;">

@ -23,7 +23,6 @@ Page({
}, },
//登录请求 //登录请求
login() { login() {
console.log('login run');
request.post(`/sso/login?username=${this.data.username}&password=${this.data.userpwd}`).then(res => { request.post(`/sso/login?username=${this.data.username}&password=${this.data.userpwd}`).then(res => {
console.log(res); console.log(res);
if (res.data.code == 200) { if (res.data.code == 200) {

Loading…
Cancel
Save