Skip to content

Commit 0282447

Browse files
committed
update: 优化问题反馈页面逻辑
1 parent d86d240 commit 0282447

File tree

2 files changed

+70
-24
lines changed

2 files changed

+70
-24
lines changed

pages/tabBar/template/template.nvue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,10 @@
100100
url: 'global'
101101
},
102102
// #ifdef APP-PLUS
103-
{
104-
name: '问题反馈',
105-
url: '/platforms/app-plus/feedback/feedback'
106-
},
103+
// {
104+
// name: '问题反馈',
105+
// url: '/platforms/app-plus/feedback/feedback'
106+
// },
107107
{
108108
name: '打开外部应用',
109109
url: 'scheme'

platforms/app-plus/feedback/feedback.vue

Lines changed: 66 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<template>
2-
<view class="page">
3-
<view class='feedback-title'>
4-
<text>问题和意见</text>
5-
<text class="feedback-quick" @tap="chooseMsg">快速键入</text>
6-
</view>
7-
<view class="feedback-body">
8-
<textarea placeholder="请详细描述你的问题和意见..." v-model="sendDate.content" class="feedback-textare" />
9-
</view>
2+
<view class="page">
3+
<view class='feedback-title'>
4+
<text>问题和意见</text>
5+
<text class="feedback-quick" @tap="chooseMsg">快速键入</text>
6+
</view>
7+
<view class="feedback-body">
8+
<textarea placeholder="请详细描述你的问题和意见..." v-model="sendDate.content" class="feedback-textare"></textarea>
9+
</view>
1010
<view class='feedback-title'>
1111
<text>图片(选填,提供问题截图,总大小10M以下)</text>
1212
</view>
@@ -25,7 +25,7 @@
2525
</view>
2626
</block>
2727
<view class="uni-uploader__input-box" v-show="imageList.length < 8">
28-
<view class="uni-uploader__input" @tap="chooseImg"></view>
28+
<view class="uni-uploader__input" @tap="chooseImg"></view>
2929
</view>
3030
</view>
3131
</view>
@@ -40,7 +40,8 @@
4040
<view class='feedback-title feedback-star-view'>
4141
<text>应用评分</text>
4242
<view class="feedback-star-view">
43-
<text class="feedback-star" v-for="(value,key) in stars" :key="key" :class="key < sendDate.score ? 'active' : ''" @tap="chooseStar(value)"></text>
43+
<text class="feedback-star" v-for="(value,key) in stars" :key="key" :class="key < sendDate.score ? 'active' : ''"
44+
@tap="chooseStar(value)"></text>
4445
</view>
4546
</view>
4647
<button type="default" class="feedback-submit" @tap="send">提交</button>
@@ -78,8 +79,8 @@
7879
this.sendDate = Object.assign(deviceInfo, this.sendDate);
7980
},
8081
methods: {
81-
close(e){
82-
this.imageList.splice(e,1);
82+
close(e) {
83+
this.imageList.splice(e, 1);
8384
},
8485
chooseMsg() { //快速输入
8586
uni.showActionSheet({
@@ -105,11 +106,28 @@
105106
previewImage(index) { //预览图片
106107
uni.previewImage({
107108
urls: this.imageList,
108-
current:this.imageList[index]
109+
current: this.imageList[index]
109110
});
110111
},
111112
send() { //发送反馈
112113
console.log(JSON.stringify(this.sendDate));
114+
if (this.imageList.length === 0) {
115+
uni.showModal({
116+
content: '至少选择一张图片',
117+
showCancel: false
118+
})
119+
return
120+
}
121+
if (this.sendDate.content.length === 0) {
122+
uni.showModal({
123+
content: '请输入问题和意见',
124+
showCancel: false
125+
})
126+
return
127+
}
128+
uni.showLoading({
129+
title: '上传中...'
130+
})
113131
let imgs = this.imageList.map((value, index) => {
114132
return {
115133
name: "image" + index,
@@ -121,20 +139,37 @@
121139
files: imgs,
122140
formData: this.sendDate,
123141
success: (res) => {
124-
if (res.statusCode === 200) {
125-
uni.showToast({
126-
title: "反馈成功!"
127-
});
142+
if (typeof res.data === 'string') {
143+
res.data = JSON.parse(res.data)
144+
}
145+
if (res.statusCode === 200 && res.data && res.data.ret === 0) {
146+
uni.showModal({
147+
content: '反馈成功',
148+
showCancel: false
149+
})
128150
this.imageList = [];
129151
this.sendDate = {
130152
score: 0,
131153
content: "",
132154
contact: ""
133155
}
156+
} else if (res.statusCode !== 200){
157+
uni.showModal({
158+
content: '反馈失败,错误码为:' + res.statusCode,
159+
showCancel: false
160+
})
161+
} else {
162+
uni.showModal({
163+
content: '反馈失败',
164+
showCancel: false
165+
})
134166
}
135167
},
136168
fail: (res) => {
137-
console.log(res)
169+
console.log(JSON.stringify(res))
170+
},
171+
complete() {
172+
uni.hideLoading()
138173
}
139174
});
140175
}
@@ -150,7 +185,18 @@
150185
.input-view {
151186
font-size: 28upx;
152187
}
153-
.close-view{
154-
text-align: center;line-height:14px;height: 16px;width: 16px;border-radius: 50%;background: #FF5053;color: #FFFFFF;position: absolute;top: -6px;right: -4px;font-size: 12px;
188+
189+
.close-view {
190+
text-align: center;
191+
line-height: 14px;
192+
height: 16px;
193+
width: 16px;
194+
border-radius: 50%;
195+
background: #FF5053;
196+
color: #FFFFFF;
197+
position: absolute;
198+
top: -6px;
199+
right: -4px;
200+
font-size: 12px;
155201
}
156202
</style>

0 commit comments

Comments
 (0)