| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223 |
- <template>
- <view class="feedback-page">
- <view class="header">
- <text class="title">意见反馈</text>
- </view>
-
- <view class="form-section">
- <textarea class="feedback-input"
- v-model="content"
- placeholder="请输入您的宝贵意见,我们会认真查看并及时处理..."
- :maxlength="500"
- ></textarea>
- <view class="word-count">{{content.length}}/500</view>
-
- <view class="image-upload">
- <view class="title">图片上传(选填)</view>
- <view class="image-list">
- <view class="image-item" v-for="(item, index) in images" :key="index">
- <image :src="item" mode="aspectFill"></image>
- <view class="delete-btn" @tap="deleteImage(index)">×</view>
- </view>
- <view class="upload-btn" @tap="chooseImage" v-if="images.length < 4">
- <text class="iconfont"></text>
- <text>上传图片</text>
- </view>
- </view>
- </view>
-
- <view class="contact-input">
- <input type="text" v-model="contact" placeholder="请留下您的联系方式(选填)" />
- </view>
-
- <button class="submit-btn" @tap="handleSubmit">提交反馈</button>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- content: '',
- images: [],
- contact: ''
- }
- },
- methods: {
- // 选择图片
- chooseImage() {
- uni.chooseImage({
- count: 4 - this.images.length,
- success: (res) => {
- this.images = [...this.images, ...res.tempFilePaths];
- }
- });
- },
-
- // 删除图片
- deleteImage(index) {
- this.images.splice(index, 1);
- },
-
- // 提交反馈
- handleSubmit() {
- if (!this.content) {
- uni.showToast({
- title: '请输入反馈内容',
- icon: 'none'
- });
- return;
- }
-
- uni.showLoading({
- title: '提交中...'
- });
-
- // TODO: 调用提交反馈接口
- setTimeout(() => {
- uni.hideLoading();
- uni.showToast({
- title: '提交成功',
- icon: 'success'
- });
-
- setTimeout(() => {
- uni.navigateBack();
- }, 1500);
- }, 1000);
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .feedback-page {
- min-height: 100vh;
- background: #f5f5f5;
- }
- .header {
- background: #fff;
- padding: 20rpx 30rpx;
-
- .title {
- font-size: 32rpx;
- font-weight: bold;
- color: #333;
- }
- }
- .form-section {
- margin-top: 20rpx;
- padding: 30rpx;
- background: #fff;
-
- .feedback-input {
- width: 100%;
- height: 300rpx;
- padding: 20rpx;
- font-size: 28rpx;
- color: #333;
- background: #f8f8f8;
- border-radius: 12rpx;
- }
-
- .word-count {
- text-align: right;
- font-size: 24rpx;
- color: #999;
- margin-top: 10rpx;
- }
-
- .image-upload {
- margin-top: 40rpx;
-
- .title {
- font-size: 28rpx;
- color: #333;
- margin-bottom: 20rpx;
- }
-
- .image-list {
- display: flex;
- flex-wrap: wrap;
-
- .image-item {
- position: relative;
- width: 160rpx;
- height: 160rpx;
- margin-right: 20rpx;
- margin-bottom: 20rpx;
-
- image {
- width: 100%;
- height: 100%;
- border-radius: 8rpx;
- }
-
- .delete-btn {
- position: absolute;
- right: -10rpx;
- top: -10rpx;
- width: 40rpx;
- height: 40rpx;
- line-height: 40rpx;
- text-align: center;
- background: rgba(0, 0, 0, 0.5);
- color: #fff;
- border-radius: 50%;
- }
- }
-
- .upload-btn {
- width: 160rpx;
- height: 160rpx;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- background: #f8f8f8;
- border-radius: 8rpx;
-
- .iconfont {
- font-size: 48rpx;
- color: #999;
- margin-bottom: 10rpx;
- }
-
- text {
- font-size: 24rpx;
- color: #999;
- }
- }
- }
- }
-
- .contact-input {
- margin-top: 40rpx;
-
- input {
- width: 100%;
- height: 88rpx;
- padding: 0 20rpx;
- font-size: 28rpx;
- color: #333;
- background: #f8f8f8;
- border-radius: 12rpx;
- }
- }
-
- .submit-btn {
- width: 100%;
- height: 88rpx;
- line-height: 88rpx;
- text-align: center;
- background: #D93025;
- color: #fff;
- font-size: 32rpx;
- border-radius: 44rpx;
- margin-top: 60rpx;
- }
- }
- </style>
|