qa-prevention-xgf-app/pages/mine/feedback/feedback.vue

189 lines
4.8 KiB
Vue
Raw Normal View History

2023-11-07 10:24:08 +08:00
<template>
<view class="">
<view class="feedback">
<u--input v-model="form.FEEDBACK_TITLE" placeholder="请输入标题" border="bottom" clearable></u--input>
<view class="feedback-type">
<view class="item" v-for="(item, index) in feedbackType" :key="index"
:class="{active:item.value === form.FEEDBACK_TYPE}" @click="form.FEEDBACK_TYPE = item.value">
2024-08-27 15:04:44 +08:00
<u--image :src="item.img" width="40rpx" height="38rpx"
style="margin-left: 70rpx; margin-top: 20rpx;"></u--image>
<view style="margin-top: -40rpx;">{{item.label}}</view>
2023-11-07 10:24:08 +08:00
</view>
</view>
<view class="title">我要反馈</view>
<u--textarea v-model="form.FEEDBACK_CONTENT" maxlength="255" height="100" count confirmType="done"
placeholder="请输入问题描述"></u--textarea>
<view class="title">
<text>请提供相关问题的截图或照片</text>
</view>
<u-upload ref="aaa" capture="album" uploadIcon="plus" :fileList="form.fileList" @afterRead="afterRead"
@delete="deletePic" name="1" multiple :maxCount="4"></u-upload>
<u-button type="primary" text="提交" @click="$u.debounce(submitFeedback, 1000, true)"></u-button>
</view>
<u-toast ref="uToast"></u-toast>
</view>
</template>
<script>
import {setFeedbackAdd, setFeedbackUpload} from "../../../api";
export default {
data() {
return {
form: {
FEEDBACK_TITLE: '',
FEEDBACK_TYPE: '其他',
FEEDBACK_CONTENT: '',
fileList: [],
urlList: [],
},
feedbackType: [{
label: '系统错误',
value: '1',
img: require('../../../static/images/fico1.png'),
},
{
label: '界面优化',
value: '2',
img: require('../../../static/images/fico2.png'),
},
{
label: '设计缺陷',
value: '3',
img: require('../../../static/images/fico3.png'),
},
{
label: '性能问题',
value: '4',
img: require('../../../static/images/fico4.png'),
},
{
label: '其他问题',
value: '9',
img: require('../../../static/images/fico5.png'),
},
]
}
},
methods: {
// 新增图片
afterRead(event) {
this.form.fileList = [...this.form.fileList, ...event.file]
},
// 删除图片
deletePic(event) {
this.form.fileList = this.form.fileList.filter(item => item.url !== event.file.url)
},
// 提交反馈
submitFeedback() {
if (!this.form.FEEDBACK_TITLE) {
this.$refs.uToast.warning('为了更加方便我们排查,请输入标题')
return
}
if (!this.form.FEEDBACK_CONTENT) {
this.$refs.uToast.warning('为了更加方便我们排查,请输入问题描述')
return
}
if (this.form.fileList.length === 0) {
this.$refs.uToast.warning('为了更加方便我们排查,请上传问题截图或照片')
return
}
let PromiseArr = [];
for (let i = 0; i < this.form.fileList.length; i++) {
PromiseArr.push(this.fnSetFeedbackUpload(this.form.fileList[i].url))
}
Promise.all(PromiseArr).then(async () => {
await setFeedbackAdd({
...this.form,
USER_ID: this.$store.getters.getUserInfo.USER_ID,
FEEDBACK_IMG: this.form.urlList.join(';')
})
this.$refs.uToast.show({
message: '反馈成功',
type: 'success',
complete: () => {
uni.switchTab({
url: '/pages/mine/index/index'
})
}
})
}).catch(() => {
this.$refs.uToast.show({
message: '反馈失败',
type: 'error',
})
})
},
async fnSetFeedbackUpload(filePath){
let resData = await setFeedbackUpload({
name: 'FFILE',
filePath,
})
this.form.urlList.push(resData.imgPath)
return resData
}
},
}
</script>
<style lang="scss" scoped>
.feedback {
2024-08-27 15:04:44 +08:00
padding: 40rpx;
2023-11-07 10:24:08 +08:00
background-color: #fff;
.title {
font-weight: bold;
2024-08-27 15:04:44 +08:00
margin-top: 20rpx;
margin-bottom: 20rpx;
2023-11-07 10:24:08 +08:00
color: $uni-text-color-placeholder;
2024-08-27 15:04:44 +08:00
font-size: 30rpx;
2023-11-07 10:24:08 +08:00
2024-08-27 15:04:44 +08:00
&:first-child {
2023-11-07 10:24:08 +08:00
margin-top: 0;
}
}
.feedback-type {
display: flex;
flex-wrap: wrap;
2024-08-27 15:04:44 +08:00
margin-bottom: 20rpx;
margin-top: 20rpx;
2023-11-07 10:24:08 +08:00
.item {
2024-08-27 15:04:44 +08:00
padding: 10rpx;
border-radius: 10rpx;
margin-top: 10rpx;
margin-right: 10rpx;
margin-bottom: 10rpx;
2023-11-07 10:24:08 +08:00
background-color: #f6f7fb;
text-align: center;
2024-08-27 15:04:44 +08:00
font-size: 30rpx;
2023-11-07 10:24:08 +08:00
color: #9fa7bc;
2024-08-27 15:04:44 +08:00
width: 207rpx;
height: 143rpx;
2023-11-07 10:24:08 +08:00
box-sizing: border-box;
2024-08-27 15:04:44 +08:00
line-height: 143rpx;
2023-11-07 10:24:08 +08:00
text-align: center;
&.active {
background-color: #3c9cff;
color: #fff;
}
}
}
::v-deep {
.u-upload__wrap__preview__image {
2024-08-27 15:04:44 +08:00
width: 146rpx !important;
height: 146rpx !important;
2023-11-07 10:24:08 +08:00
}
}
}
.title {
2024-08-27 15:04:44 +08:00
font-size: 32rpx;
2023-11-07 10:24:08 +08:00
color: #333;
}
</style>