feedback.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <template>
  2. <view class="feedback-container">
  3. <view class="feedback-title">意见反馈</view>
  4. <view class="feedback-form">
  5. <view class="form-row">
  6. <image src="/static/logo.png" class="form-icon" />
  7. <input class="form-input" v-model="content" placeholder="请输入您的宝贵意见..." />
  8. </view>
  9. <view class="form-row">
  10. <picker :range="typeList" :value="typeIdx" @change="onTypeChange">
  11. <view class="picker-box">反馈类型:{{ typeList[typeIdx] }}</view>
  12. </picker>
  13. </view>
  14. <button class="submit-btn" @click="submit">提交反馈</button>
  15. </view>
  16. <view class="history-title">历史反馈</view>
  17. <view v-if="history.length === 0" class="empty-history">暂无反馈记录</view>
  18. <view v-else class="history-list">
  19. <view class="history-item" v-for="item in history" :key="item.id">
  20. <view class="history-type">[{{ item.type }}]</view>
  21. <view class="history-content">{{ item.content }}</view>
  22. </view>
  23. </view>
  24. </view>
  25. </template>
  26. <script>
  27. export default {
  28. data() {
  29. return {
  30. content: '',
  31. typeList: ['功能建议', '内容问题', 'BUG反馈', '其他'],
  32. typeIdx: 0,
  33. history: []
  34. }
  35. },
  36. methods: {
  37. onTypeChange(e) {
  38. this.typeIdx = e.detail.value
  39. },
  40. submit() {
  41. if (!this.content) {
  42. uni.showToast({ title: '请填写反馈内容', icon: 'none' })
  43. return
  44. }
  45. this.history.unshift({
  46. id: Date.now(),
  47. type: this.typeList[this.typeIdx],
  48. content: this.content
  49. })
  50. this.content = ''
  51. uni.showToast({ title: '反馈已提交', icon: 'success' })
  52. }
  53. }
  54. }
  55. </script>
  56. <style lang="scss">
  57. .feedback-container {
  58. min-height: 100vh;
  59. background: #f7f8fa;
  60. padding-bottom: 120rpx;
  61. }
  62. .feedback-title {
  63. text-align: center;
  64. font-size: 36rpx;
  65. font-weight: bold;
  66. color: #222;
  67. padding: 48rpx 0 32rpx 0;
  68. }
  69. .feedback-form {
  70. background: #fff;
  71. border-radius: 20rpx;
  72. margin: 0 24rpx 32rpx 24rpx;
  73. box-shadow: 0 4rpx 16rpx rgba(0,0,0,0.04);
  74. padding: 32rpx 24rpx;
  75. }
  76. .form-row {
  77. display: flex;
  78. align-items: center;
  79. margin-bottom: 24rpx;
  80. }
  81. .form-icon {
  82. width: 48rpx;
  83. height: 48rpx;
  84. margin-right: 16rpx;
  85. }
  86. .form-input {
  87. flex: 1;
  88. border: none;
  89. font-size: 28rpx;
  90. background: #f7f8fa;
  91. border-radius: 8rpx;
  92. padding: 16rpx;
  93. }
  94. .picker-box {
  95. font-size: 28rpx;
  96. color: #409EFF;
  97. background: #f7f8fa;
  98. border-radius: 8rpx;
  99. padding: 16rpx 24rpx;
  100. }
  101. .submit-btn {
  102. width: 100%;
  103. background: #409EFF;
  104. color: #fff;
  105. border-radius: 12rpx;
  106. font-size: 32rpx;
  107. margin-top: 16rpx;
  108. }
  109. .history-title {
  110. font-size: 28rpx;
  111. color: #888;
  112. margin: 32rpx 0 16rpx 32rpx;
  113. }
  114. .empty-history {
  115. color: #bbb;
  116. font-size: 26rpx;
  117. text-align: center;
  118. margin-top: 32rpx;
  119. }
  120. .history-list {
  121. margin: 0 24rpx;
  122. }
  123. .history-item {
  124. background: #fff;
  125. border-radius: 12rpx;
  126. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.03);
  127. padding: 20rpx 24rpx;
  128. margin-bottom: 18rpx;
  129. display: flex;
  130. align-items: center;
  131. }
  132. .history-type {
  133. color: #409EFF;
  134. font-size: 24rpx;
  135. margin-right: 16rpx;
  136. }
  137. .history-content {
  138. font-size: 26rpx;
  139. color: #333;
  140. }
  141. </style>