feedback.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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" cloudUpload></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. console.log(curProblem.value);
  93. if (!state.detail) {
  94. return uni.showToast({
  95. title: '请输入问题描述',
  96. icon: 'none'
  97. })
  98. }
  99. const images = state.photoList.map(item => item.name).join(',')
  100. addAdvice({
  101. type: curProblem.value,
  102. content: state.detail,
  103. images
  104. }).then(res => {
  105. uni.showToast({
  106. icon: 'none',
  107. title: '提交成功'
  108. })
  109. setTimeout(function() {
  110. uni.navigateBack()
  111. }, 1500)
  112. })
  113. }
  114. </script>
  115. <style>
  116. page{
  117. height: 100%;
  118. }
  119. </style>
  120. <style lang="scss" scoped>
  121. .main{
  122. background-color: white;
  123. }
  124. .textarea-box {
  125. width: 100%;
  126. height: 240rpx;
  127. background: #fff;
  128. box-sizing: border-box;
  129. position: relative;
  130. }
  131. .input-num {
  132. position: absolute;
  133. right: 30rpx;
  134. bottom: 20rpx;
  135. color: #AAAAAA;
  136. font-size: 30rpx;
  137. z-index: 10;
  138. }
  139. .title-hd{
  140. margin: 0rpx 30rpx;
  141. }
  142. .list-bd{
  143. background-color: #F2F2F2;
  144. border-radius: 8rpx;
  145. padding: 10rpx 10rpx 40rpx 10rpx;
  146. margin: 0 30rpx;
  147. }
  148. .list-color{
  149. color: #858585;
  150. background-color: #F0F0F0;
  151. }
  152. </style>