question-jianda.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <template>
  2. <view>
  3. <view>
  4. <!--====sl修改开始====-->
  5. <view class="jdt_style" v-for="(item,index) in current_timu.right_answer_arr" :key="index">
  6. <textarea placeholder="请输入答案" :value="current_timu.my_answer_arr[index]"
  7. @input="post_answer($event, index)" auto-height />
  8. </view>
  9. <!--====sl修改结束====-->
  10. </view>
  11. <view class="tkt_button" :class="is_jianda_sub ? 'duoxuan_checked' : 'duoxuan' "
  12. v-if="current_timu.right_answer_arr.length > 0" @tap="post_answer_req()">确定</view>
  13. </view>
  14. </template>
  15. <script>
  16. export default {
  17. props: {
  18. current_timu: {
  19. type: Object,
  20. default: function() {
  21. return {}
  22. },
  23. },
  24. is_jianda_sub: {
  25. type: Boolean,
  26. default: false,
  27. },
  28. show_beiti: {
  29. type: Boolean,
  30. default: true,
  31. },
  32. copy_user_answer: {
  33. type: Array,
  34. default: function() {
  35. return [];
  36. },
  37. }
  38. },
  39. watch: {
  40. current_timu: {
  41. handler(newVal, oldVal) {},
  42. deep: true,
  43. immediate: true
  44. }
  45. },
  46. methods: {
  47. // 提交答案
  48. post_answer(item, index) {
  49. if (this.is_jianda_sub) {
  50. this.$emit('set_sub_button_style', 'is_jianda_sub', false)
  51. }
  52. let timu = this.current_timu,
  53. my_answer_arr = this.current_timu.my_answer_arr;
  54. this.$set(my_answer_arr, index, item.detail.value)
  55. this.$set(timu, index, 'my_answer_arr', my_answer_arr)
  56. this.$set(timu, 'show_right_answer', true)
  57. if (timu.my_answer_arr.length > 0) {
  58. this.$set(timu, 'my_answer', timu.my_answer_arr.join('|'))
  59. }
  60. this.$emit('set_current_timu', timu)
  61. let copy_user_answer_this = this.copy_user_answer;
  62. if (copy_user_answer_this[this.current_timu.id]) {
  63. copy_user_answer_this[this.current_timu.id] = timu.my_answer_arr
  64. }
  65. this.$emit('set_copy_user_answer', copy_user_answer_this)
  66. },
  67. post_answer_req() {
  68. this.$emit('post_answer_req', true)
  69. },
  70. }
  71. }
  72. </script>
  73. <style>
  74. </style>