feedback.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <template>
  2. <view class="container">
  3. <fs-tab :tabs="tabs" v-model="tabActive"></fs-tab>
  4. <view class="main" v-show="tabActive === 0">
  5. <fs-panel title="请选择您遇到的问题">
  6. <template #content>
  7. <fs-radio-group v-model="curProblem">
  8. <fs-radio-cell
  9. v-for="(item, index) in problemList"
  10. :key="index"
  11. :label="item.label"
  12. :value="item.label"
  13. ></fs-radio-cell>
  14. </fs-radio-group>
  15. <!-- <fs-cell
  16. border
  17. justify="right"
  18. :title="item.title"
  19. @click="selectProblem(index)"
  20. v-for="(item, index) in problemList">
  21. <template #value>
  22. <fs-icon type="icon-right" colorType="primary" v-show="curProblemIndex === index"></fs-icon>
  23. </template>
  24. </fs-cell> -->
  25. </template>
  26. </fs-panel>
  27. <fs-panel title="请补充详情问题和意见(必填)">
  28. <template #content>
  29. <view class="textarea-box">
  30. <fs-field type="textarea" height="200rpx" placeholder="请输入问题描述..." v-model="state.detail"></fs-field>
  31. <view class="input-num">{{ state.detail.length }}/140</view>
  32. </view>
  33. </template>
  34. </fs-panel>
  35. <fs-panel title="请上传相关问题图片">
  36. <template #content>
  37. <fs-upload v-model="state.photoList"></fs-upload>
  38. </template>
  39. </fs-panel>
  40. <fs-button block round @click="handleSubmit">提交</fs-button>
  41. <fs-gutter bgColor="#fff"></fs-gutter>
  42. </view>
  43. <view class="main" v-show="tabActive === 1">
  44. <div v-for="item in state.adviceList" :key="item.id">
  45. <div class="list-hd title-hd title-color">{{ item.type }}</div>
  46. <div class="list-bd list-color">回复:{{ item.replyContent }}</div>
  47. </div>
  48. <fs-empty v-if="!state.adviceList.length"></fs-empty>
  49. </view>
  50. </view>
  51. </template>
  52. <script setup>
  53. import { ref, reactive } from 'vue'
  54. import { addAdvice, getAdviceList } from '@/services/common'
  55. const tabs = [
  56. {
  57. name: '提建议'
  58. },
  59. {
  60. name: '反馈'
  61. }
  62. ]
  63. const tabActive = ref(0)
  64. const problemList = [
  65. {
  66. label: '功能异常:功能故障或不可用'
  67. },
  68. {
  69. label: '产品建议:用的不爽,我有建议'
  70. },
  71. {
  72. label: '安全问题:密码、隐私、欺诈等'
  73. },
  74. {
  75. label: '其他问题'
  76. }
  77. ]
  78. const curProblem = ref(problemList[0].label)
  79. const state = reactive({
  80. detail: '',
  81. photoList: [],
  82. adviceList: []
  83. })
  84. const fetchList = () => {
  85. getAdviceList().then(res => {
  86. console.log('feed', res)
  87. // state.adviceList = res.data
  88. })
  89. }
  90. // fetchList()
  91. const handleSubmit = () => {
  92. if (!state.detail) {
  93. return uni.showToast({
  94. title: '请输入问题描述',
  95. icon: 'none'
  96. })
  97. }
  98. const images = state.photoList.map(item => item.name).join(',')
  99. addAdvice({
  100. type: curProblem.value,
  101. content: state.detail,
  102. images
  103. }).then(res => {
  104. uni.showToast({
  105. icon: 'none',
  106. title: '提交成功'
  107. })
  108. setTimeout(function() {
  109. uni.navigateBack()
  110. }, 1500)
  111. })
  112. }
  113. </script>
  114. <style>
  115. page {
  116. height: 100%;
  117. }
  118. </style>
  119. <style lang="scss" scoped>
  120. .main {
  121. background-color: white;
  122. }
  123. .textarea-box {
  124. width: 100%;
  125. height: 240rpx;
  126. background: #fff;
  127. box-sizing: border-box;
  128. position: relative;
  129. }
  130. .input-num {
  131. position: absolute;
  132. right: 30rpx;
  133. bottom: 20rpx;
  134. color: #aaaaaa;
  135. font-size: 30rpx;
  136. z-index: 10;
  137. }
  138. .title-hd {
  139. margin: 0rpx 30rpx;
  140. }
  141. .list-bd {
  142. background-color: #f2f2f2;
  143. border-radius: 8rpx;
  144. padding: 10rpx 10rpx 40rpx 10rpx;
  145. margin: 0 30rpx;
  146. }
  147. .list-color {
  148. color: #858585;
  149. background-color: #f0f0f0;
  150. }
  151. </style>