question-jiucuo.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. <template>
  2. <view>
  3. <view class="questionBankAnswer-bottom-flex" @tap="jiucuo">
  4. <view class="iconfont icon-sousuo1" style="font-weight: bold;"></view>
  5. <view>纠错</view>
  6. </view>
  7. <uni-popup ref="popup" type="bottom" radius="12rpx" background-color="#8c8989" color="#5A5B5C" width="90%">
  8. <view class="jiucuo">
  9. <view class="popup-content">
  10. <text class="text">纠错反馈</text>
  11. <view class="iconfont icon-cuo1" @tap="hide"></view>
  12. </view>
  13. <view class="jiucuo-content">
  14. <text>为方便我们排查错误,请您详细描述错误,例如:</text>
  15. <view class="jiucuo-xuan">
  16. <checkbox-group @change="checkboxChange" class="jiucuo-checkbox">
  17. <label v-for='(item,index) in list' :key="index">
  18. <checkbox :value="item.value" color="#3c7bfc" :checked="item.checked"
  19. style="transform:scale(0.6)" />{{item.name}}
  20. </label>
  21. </checkbox-group>
  22. </view>
  23. <textarea :value="content" placeholder="其他错误,请详细描述您遇到的问题..." @input="setContent"
  24. class="popup-textarea" />
  25. <button type="primary" :loading="isSubmit" @tap="submit" class="popup-button">提交</button>
  26. </view>
  27. </view>
  28. </uni-popup>
  29. </view>
  30. </template>
  31. <script>
  32. export default {
  33. props: {
  34. current_timu: {
  35. type: Object,
  36. default: {},
  37. },
  38. },
  39. data() {
  40. return {
  41. isSubmit: false,
  42. arr: [],
  43. content: '',
  44. list: [{
  45. value: '1',
  46. name: '含有错别字'
  47. }, {
  48. value: '2',
  49. name: '答案不正确'
  50. }, {
  51. value: '3',
  52. name: '答案不完整'
  53. }, {
  54. value: '4',
  55. name: '解析不完整'
  56. }, ]
  57. }
  58. },
  59. methods: {
  60. async submit() {
  61. if (this.content == '' && this.arr.length == 0) return
  62. if (this.isSubmit) return
  63. this.isSubmit = true
  64. let res = await this.$myHttp.post({
  65. url: this.$myHttp.urlMap.jiucuo,
  66. data: {
  67. question_id: this.current_timu.id,
  68. type: this.arr.join(',') + (this.arr.length > 0 && this.content != '' ? ',' : '') +
  69. this.content
  70. },
  71. needLogin: true
  72. })
  73. if (res.code == 1) {
  74. this.isSubmit = false
  75. uni.showToast({
  76. title: '提交成功'
  77. })
  78. this.$refs.popup.close()
  79. } else {
  80. uni.showToast({
  81. title: res.msg,
  82. icon: 'none'
  83. })
  84. this.isSubmit = false
  85. }
  86. },
  87. show() {
  88. this.$refs.popup.open('bottom')
  89. this.arr = []
  90. this.content = ''
  91. var items = this.list;
  92. for (var i = 0, lenI = items.length; i < lenI; ++i) {
  93. const item = items[i]
  94. this.$set(item, 'checked', false)
  95. }
  96. },
  97. hide() {
  98. this.$refs.popup.close()
  99. },
  100. setContent(e) {
  101. this.content = e.detail.value
  102. },
  103. checkboxChange: function(e) {
  104. var items = this.list,
  105. values = e.detail.value;
  106. this.arr = []
  107. for (var i = 0, lenI = items.length; i < lenI; ++i) {
  108. const item = items[i]
  109. if (values.includes(item.value)) {
  110. this.$set(item, 'checked', true)
  111. this.arr.push(item.name)
  112. } else {
  113. this.$set(item, 'checked', false)
  114. }
  115. }
  116. },
  117. jiucuo() {
  118. if (this.current_timu.id != '' && this.current_timu.id != undefined) {
  119. this.show()
  120. }
  121. },
  122. }
  123. }
  124. </script>
  125. <style>
  126. .popup-content {
  127. position: relative;
  128. background: #fff;
  129. z-index: 111;
  130. width: 100%;
  131. border-radius: 12px 12px 0 0;
  132. height: 42px;
  133. border-bottom: solid 1px #f1f1f1;
  134. text-align: center;
  135. line-height: 42px;
  136. color: #313131;
  137. font-size: 15px;
  138. }
  139. .jiucuo {
  140. position: relative;
  141. background: #fff;
  142. border-radius: 12rpx 12rpx 0 0;
  143. max-height: 80vh;
  144. overflow-y: auto;
  145. }
  146. .jiucuo-content {
  147. font-size: 13px;
  148. padding: 9px 9px 0;
  149. }
  150. .jiucuo-xuan {
  151. background: #fff;
  152. padding: 7px 2px;
  153. margin: 12px 0;
  154. border-radius: 4px;
  155. }
  156. .jiucuo-checkbox {
  157. width: 100%;
  158. display: flex;
  159. flex-wrap: wrap;
  160. align-items: flex-start;
  161. }
  162. .jiucuo-checkbox label {
  163. flex: 0 0 30%;
  164. display: flex;
  165. align-items: center;
  166. }
  167. .popup-textarea {
  168. width: 92%;
  169. margin: 0;
  170. font-size: 13px;
  171. background: #fff;
  172. padding: 11px;
  173. height: 72px;
  174. margin-bottom: 12px;
  175. background: #f7f7f7;
  176. }
  177. .popup-button {
  178. background: #3c7bfc !important;
  179. color: #fff;
  180. padding: 2px;
  181. margin: 0 auto 11px;
  182. border-radius: 43px;
  183. font-size: 16px;
  184. display: block !important;
  185. width: 95%;
  186. }
  187. .icon-cuo1 {
  188. position: absolute;
  189. color: #ccc;
  190. top: 0;
  191. right: 12px;
  192. }
  193. </style>