mirror of
https://gitee.com/qingqing-coconut-tea/RcKtFezyRAZX
synced 2026-07-21 10:32:32 +08:00
init
This commit is contained in:
109
wechat/pages/feedback/feedback.js
Normal file
109
wechat/pages/feedback/feedback.js
Normal file
@@ -0,0 +1,109 @@
|
||||
// pages/feedback/feedback.js
|
||||
// 意见反馈逻辑处理
|
||||
|
||||
const app = getApp()
|
||||
const api = require('../../services/api')
|
||||
|
||||
Page({
|
||||
data: {
|
||||
typeIndex: 0,
|
||||
typeList: ['功能建议', 'Bug反馈', '体验问题', '其他'],
|
||||
type: '功能建议',
|
||||
content: '',
|
||||
contact: '',
|
||||
images: [],
|
||||
loading: false
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
if (options.type) {
|
||||
const index = this.data.typeList.findIndex(item => item === options.type)
|
||||
if (index !== -1) {
|
||||
this.setData({ typeIndex: index, type: options.type })
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
onTypeChange(e) {
|
||||
const index = e.detail.value
|
||||
this.setData({
|
||||
typeIndex: index,
|
||||
type: this.data.typeList[index]
|
||||
})
|
||||
},
|
||||
|
||||
onContentInput(e) {
|
||||
this.setData({ content: e.detail.value })
|
||||
},
|
||||
|
||||
onContactInput(e) {
|
||||
this.setData({ contact: e.detail.value })
|
||||
},
|
||||
|
||||
onChooseImage() {
|
||||
const count = 3 - this.data.images.length
|
||||
if (count <= 0) {
|
||||
wx.showToast({ title: '最多上传3张图片', icon: 'none' })
|
||||
return
|
||||
}
|
||||
|
||||
wx.chooseImage({
|
||||
count: count,
|
||||
sizeType: ['compressed'],
|
||||
sourceType: ['album', 'camera'],
|
||||
success: res => {
|
||||
const images = this.data.images.concat(res.tempFilePaths)
|
||||
this.setData({ images })
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
onRemoveImage(e) {
|
||||
const index = e.currentTarget.dataset.index
|
||||
const images = this.data.images
|
||||
images.splice(index, 1)
|
||||
this.setData({ images })
|
||||
},
|
||||
|
||||
submitFeedback() {
|
||||
const { type, content, contact, images } = this.data
|
||||
|
||||
if (!content.trim()) {
|
||||
wx.showToast({ title: '请输入反馈内容', icon: 'none' })
|
||||
return
|
||||
}
|
||||
|
||||
if (content.trim().length < 10) {
|
||||
wx.showToast({ title: '反馈内容至少10个字', icon: 'none' })
|
||||
return
|
||||
}
|
||||
|
||||
this.setData({ loading: true })
|
||||
|
||||
api.submitFeedback({
|
||||
type,
|
||||
content: content.trim(),
|
||||
contact: contact.trim(),
|
||||
images: images.join(',')
|
||||
}).then(res => {
|
||||
this.setData({ loading: false })
|
||||
if (res.code === 200) {
|
||||
wx.showToast({ title: '提交成功', icon: 'success' })
|
||||
setTimeout(() => {
|
||||
wx.navigateBack()
|
||||
}, 1500)
|
||||
} else {
|
||||
wx.showToast({ title: res.message || '提交失败', icon: 'none' })
|
||||
}
|
||||
}).catch(() => {
|
||||
this.setData({ loading: false })
|
||||
wx.showToast({ title: '提交失败', icon: 'none' })
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
/**
|
||||
* @联系作者:16768118056
|
||||
* @描述:(此项目非免费分享)源码百分百可用,搞定毕设不发愁,支持远程调试安装、二次开发、定制、讲解、文档类。
|
||||
* @访问:https://www.notmaker.com/detail/8326a897119d4542896c863a69d7bbe7/gtt20260415,查看完整运行演示。
|
||||
*/
|
||||
10
wechat/pages/feedback/feedback.json
Normal file
10
wechat/pages/feedback/feedback.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"usingComponents": {},
|
||||
"navigationBarTitleText": "意见反馈"
|
||||
}
|
||||
|
||||
/**
|
||||
* @联系作者:16768118056
|
||||
* @描述:(此项目非免费分享)源码百分百可用,搞定毕设不发愁,支持远程调试安装、二次开发、定制、讲解、文档类。
|
||||
* @访问:https://www.notmaker.com/detail/8326a897119d4542896c863a69d7bbe7/gtt20260415,查看完整运行演示。
|
||||
*/
|
||||
70
wechat/pages/feedback/feedback.wxml
Normal file
70
wechat/pages/feedback/feedback.wxml
Normal file
@@ -0,0 +1,70 @@
|
||||
<!-- pages/feedback/feedback.wxml -->
|
||||
<!-- 意见反馈视图 -->
|
||||
|
||||
<view class="feedback-container">
|
||||
<!-- 反馈类型 -->
|
||||
<view class="form-section">
|
||||
<view class="form-item">
|
||||
<text class="form-label">反馈类型</text>
|
||||
<picker mode="selector" range="{{typeList}}" value="{{typeIndex}}" bindchange="onTypeChange">
|
||||
<view class="picker-value">
|
||||
{{typeList[typeIndex]}}
|
||||
<text class="iconfont icon-arrow-down"></text>
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 反馈内容 -->
|
||||
<view class="form-section">
|
||||
<view class="section-title">反馈内容</view>
|
||||
<textarea
|
||||
class="content-input"
|
||||
placeholder="请详细描述您的问题或建议(至少10个字)"
|
||||
bindinput="onContentInput"
|
||||
value="{{content}}"
|
||||
maxlength="500"
|
||||
/>
|
||||
<view class="word-count">{{content.length}}/500</view>
|
||||
</view>
|
||||
|
||||
<!-- 上传图片 -->
|
||||
<view class="form-section">
|
||||
<view class="section-title">上传图片(可选,最多3张)</view>
|
||||
<view class="image-list">
|
||||
<view class="image-item" wx:for="{{images}}" wx:key="index">
|
||||
<image src="{{item}}" mode="aspectFill" />
|
||||
<view class="remove-btn" bindtap="onRemoveImage" data-index="{{index}}">
|
||||
<text class="iconfont icon-close"></text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="add-btn" wx:if="{{images.length < 3}}" bindtap="onChooseImage">
|
||||
<text class="iconfont icon-camera"></text>
|
||||
<text class="add-text">添加图片</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 联系方式 -->
|
||||
<view class="form-section">
|
||||
<view class="form-item">
|
||||
<text class="form-label">联系方式</text>
|
||||
<input
|
||||
class="form-input"
|
||||
type="text"
|
||||
placeholder="请输入手机号或邮箱(选填)"
|
||||
bindinput="onContactInput"
|
||||
value="{{contact}}"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 提交按钮 -->
|
||||
<button class="submit-btn" bindtap="submitFeedback" loading="{{loading}}">提交反馈</button>
|
||||
</view>
|
||||
|
||||
/**
|
||||
* @联系作者:16768118056
|
||||
* @描述:(此项目非免费分享)源码百分百可用,搞定毕设不发愁,支持远程调试安装、二次开发、定制、讲解、文档类。
|
||||
* @访问:https://www.notmaker.com/detail/8326a897119d4542896c863a69d7bbe7/gtt20260415,查看完整运行演示。
|
||||
*/
|
||||
137
wechat/pages/feedback/feedback.wxss
Normal file
137
wechat/pages/feedback/feedback.wxss
Normal file
@@ -0,0 +1,137 @@
|
||||
/* pages/feedback/feedback.wxss */
|
||||
/* 意见反馈样式 */
|
||||
|
||||
.feedback-container {
|
||||
min-height: 100vh;
|
||||
background-color: #f5f5f5;
|
||||
padding: 20rpx 30rpx;
|
||||
}
|
||||
|
||||
.form-section {
|
||||
background-color: #fff;
|
||||
border-radius: 16rpx;
|
||||
padding: 24rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.form-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.form-label {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.picker-value,
|
||||
.form-input {
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.picker-value .iconfont {
|
||||
margin-left: 12rpx;
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
font-size: 28rpx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.content-input {
|
||||
width: 100%;
|
||||
height: 240rpx;
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
line-height: 1.6;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.word-count {
|
||||
text-align: right;
|
||||
font-size: 22rpx;
|
||||
color: #999;
|
||||
margin-top: 12rpx;
|
||||
}
|
||||
|
||||
.image-list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 20rpx;
|
||||
}
|
||||
|
||||
.image-item {
|
||||
position: relative;
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
}
|
||||
|
||||
.image-item image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
|
||||
.remove-btn {
|
||||
position: absolute;
|
||||
top: -16rpx;
|
||||
right: -16rpx;
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
border-radius: 20rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.remove-btn .iconfont {
|
||||
font-size: 24rpx;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.add-btn {
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
background-color: #f5f5f5;
|
||||
border-radius: 12rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.add-btn .iconfont {
|
||||
font-size: 60rpx;
|
||||
color: #999;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
|
||||
.add-text {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.submit-btn {
|
||||
margin-top: 40rpx;
|
||||
height: 88rpx;
|
||||
line-height: 88rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
color: #fff;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
border-radius: 44rpx;
|
||||
}
|
||||
|
||||
/**
|
||||
* @联系作者:16768118056
|
||||
* @描述:(此项目非免费分享)源码百分百可用,搞定毕设不发愁,支持远程调试安装、二次开发、定制、讲解、文档类。
|
||||
* @访问:https://www.notmaker.com/detail/8326a897119d4542896c863a69d7bbe7/gtt20260415,查看完整运行演示。
|
||||
*/
|
||||
Reference in New Issue
Block a user