feedback.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <template>
  2. <view>
  3. <!-- 评价表单-->
  4. <view class="content bg-white">
  5. <!-- 标签 -->
  6. <view class="flex flex-wrap" style="padding: 16rpx;">
  7. <view class="tag-item" :class="{ 'tat-active': item.selected }" @tap="changeTag(index)"
  8. v-for="(item,index) in tagList" :key="index">{{ item.title }}</view>
  9. </view>
  10. <view class="uni-textarea">
  11. <textarea auto-height @input="textareaFun" :placeholder="placeholder"/>
  12. </view>
  13. </view>
  14. <view class="footer" @click="submitDafenFun">
  15. <view class="white text-center footer-text">
  16. 提交
  17. </view>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. import {
  23. mapGetters,
  24. mapActions
  25. } from 'vuex'
  26. import {
  27. getTagList,
  28. postSuggest
  29. } from '@/api/app';
  30. const app = getApp()
  31. export default {
  32. data() {
  33. return {
  34. reviewer: 0,
  35. targetId: null,
  36. target: null,
  37. content: '',
  38. tagList: [],
  39. activeTag: 0,
  40. placehoder:''
  41. };
  42. },
  43. onLoad(o) {
  44. this.getTagFun();
  45. },
  46. onShow() {
  47. this.getUser();
  48. },
  49. methods: {
  50. ...mapActions(['getUser']),
  51. textareaFun(e, index) {
  52. this.content = e.detail.value
  53. },
  54. changeTag(index) {
  55. this.tagList[index].selected = !this.tagList[index].selected
  56. let placehoder = '#';
  57. this.tagList.forEach((item, index) => {
  58. if (item.selected) {
  59. placehoder += item.title + '#';
  60. }
  61. })
  62. this.placeholder = placehoder;
  63. this.$forceUpdate();
  64. },
  65. async submitDafenFun() {
  66. if (!this.content) {
  67. this.$toast({
  68. title: '请输入内容'
  69. })
  70. return;
  71. }
  72. const {
  73. status,
  74. data,
  75. msg
  76. } = await postSuggest({
  77. title: this.placehoder,//标签
  78. content: this.content
  79. });
  80. if (status == 1) {
  81. this.$toast({
  82. title: msg
  83. }, {
  84. tab: 3,
  85. url: 1
  86. })
  87. }
  88. },
  89. async getTagFun() {
  90. const {
  91. status,
  92. data
  93. } = await getTagList({});
  94. if (status == 1) {
  95. this.tagList = data
  96. }
  97. },
  98. },
  99. computed: {
  100. ...mapGetters(['uid', 'userInfo'])
  101. }
  102. };
  103. </script>
  104. <style lang="scss">
  105. .content {
  106. margin: 24rpx;
  107. padding: 24rpx;
  108. box-shadow: 0rpx 8rpx 16rpx 2rpx rgba(0, 0, 0, 0.03);
  109. border-radius: 18rpx 18rpx 18rpx 18rpx;
  110. }
  111. .tag-item {
  112. margin: 8rpx;
  113. padding: 10rpx 28rpx;
  114. border-radius: 28rpx 28rpx 28rpx 28rpx;
  115. border: 2rpx solid #B8B8B8;
  116. }
  117. .tat-active {
  118. border: 2rpx solid #F37171;
  119. font-weight: 400;
  120. color: #F37171;
  121. }
  122. .uni-textarea {
  123. padding: 20rpx;
  124. height: 300rpx;
  125. background: #F7F7F7;
  126. border-radius: 5rpx;
  127. margin-bottom: 20rpx;
  128. textarea {
  129. width: 100%;
  130. height: 260rpx !important;
  131. min-height: 260rpx;
  132. max-height: 260rpx;
  133. overflow-y: hidden;
  134. font-size: 28rpx;
  135. }
  136. }
  137. .footer {
  138. margin-top: 40rpx;
  139. box-sizing: content-box;
  140. padding: 0 30rpx;
  141. .footer-text {
  142. height: 88rpx;
  143. line-height: 88rpx;
  144. background-color: $-color-primary;
  145. box-shadow: 0rpx 6rpx 12rpx 2rpx rgba(221, 66, 80, 0.23);
  146. border-radius: 18rpx 18rpx 18rpx 18rpx;
  147. font-size: 32rpx;
  148. font-family: PingFang SC-Medium, PingFang SC;
  149. font-weight: 500;
  150. }
  151. }
  152. .grade-form {
  153. //padding-bottom: calc(120rpx + env(safe-area-inset-bottom));
  154. }
  155. .user-content {
  156. padding: 30rpx;
  157. background-size: 100% auto;
  158. background-repeat: no-repeat;
  159. .user-img {
  160. width: 88rpx;
  161. height: 88rpx;
  162. overflow: hidden;
  163. border-radius: 50%;
  164. image {
  165. width: 100%;
  166. }
  167. }
  168. .user-text {}
  169. }
  170. </style>