question-jiucuo.vue 4.5 KB

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