Files
lilishop-uniapp/pages/mine/set/feedBack.vue
pikachu1995@126.com dc2bef455a refactor: 移动端升级 Vue3 + uView Plus
将 lilishop-uniapp 从 Vue2/uView 1.6 迁移到 Vue3/uview-plus,优先支持 H5/微商城与微信小程序;移除 vendored uview-ui,改用 npm 依赖、Vuex4 与迁移脚本/补丁,并补充 VUE3_MIGRATION.md 回归清单。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-30 18:50:38 +08:00

165 lines
3.9 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="feedBack">
<div class="feedBack-box">
<h4>猜你想问</h4>
<div class="feedBack-item" :class="{'active':feedBack.type == item.value }" @click="handleClick(index)" v-for="(item,index) in list" :key="index">
{{item.text}}
</div>
</div>
<div class="feedBack-box">
<h4>问题反馈 <span style="margin-left:10rpx;" v-if="feedBack.type">@{{ list.find(item=>{return item.value == feedBack.type }).text }}</span></h4>
<u-input class="field-input" height="500" border="none" v-model="feedBack.context" type="textarea" placeholder="请输入反馈信息">
</u-input>
</div>
<!-- 上传凭证 -->
<div class="feedBack-box">
<view class="opt-view">
<view class="img-title">上传凭证最多2张</view>
<view class="images-view">
<u-upload :file-list="uploadFileList" :auto-upload="false" width="150" @afterRead="onUploadAfterRead" :max-count="2"></u-upload>
</view>
</view>
</div>
<div class="feedBack-box">
<h4>手机号</h4>
<u-input border="none" v-model="feedBack.mobile" placeholder="请输入您的手机号">
</u-input>
</div>
<div class="submit" @click="submit()">提交</div>
</div>
</template>
<script>
import storage from "@/utils/storage.js";
import config from "@/config/config";
import { feedBack } from "@/api/members.js";
import { handleUploadAfterRead } from "@/utils/uploadHelper.js";
export default {
data() {
return {
storage,
config,
feedBack: {
type: "FUNCTION", //默认反馈问题为 '功能相关'
},
uploadFileList: [],
list: [
{ text: "功能相关", value: "FUNCTION" },
{ text: "优化反馈", value: "OPTIMIZE" },
{ text: "其他", value: "OTHER" },
],
};
},
methods: {
// 点击反馈内容
handleClick(index) {
this.feedBack["type"] = this.list[index].value;
},
onUploadAfterRead(event) {
handleUploadAfterRead(event, this.uploadFileList, (urls) => {
this.feedBack.images = urls.join(",");
});
},
/**
* 提交意见反馈
*/
submit() {
if (!this.feedBack.type) {
uni.showToast({
title: "请填写反馈类型",
duration: 2000,
icon: "none",
});
return false;
}
if (!this.feedBack.context) {
uni.showToast({
title: "请填写反馈信息",
duration: 2000,
icon: "none",
});
return false;
}
if (this.feedBack.mobile && !this.$u.test.mobile(this.feedBack.mobile)) {
uni.showToast({
title: "请填写您的正确手机号",
duration: 2000,
icon: "none",
});
return false;
}
/** 提交 */
feedBack(this.feedBack).then((res) => {
if (res.data.success) {
uni.showToast({
title: "提交成功!",
duration: 2000,
icon: "none",
});
setTimeout(() => {
uni.navigateBack({
delta: 1,
});
}, 500);
}
});
},
},
};
</script>
<style lang="scss" scoped>
.submit {
text-align: center;
background: $light-color;
height: 70rpx;
line-height: 70rpx;
color: #fff;
width: 92%;
margin-bottom: 100rpx;
margin: 0 auto;
border-radius: 100px;
}
.active{
color: $light-color !important;
font-weight: bold;
}
.feedBack {
padding-bottom: 100rpx;
}
.feedBack-box {
background: #fff;
border-radius: 20rpx;
padding: 32rpx;
margin-bottom: 40rpx;
}
::v-deep .u-input__textarea {
padding: 12px;
}
.feedBack-box:nth-of-type(1) {
border-top-left-radius: 0;
border-top-right-radius: 0;
}
.feedBack-item {
margin: 20rpx 0;
font-size: 24rpx;
color: #666;
}
h4 {
font-size: 30rpx;
}
.field-input {
margin: 20rpx 0;
padding: 20rpx 0;
background: #fafafa;
border-radius: 0.6em;
}
</style>