QuestionJudge.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <template>
  2. <div
  3. class="question-judge"
  4. >
  5. <button
  6. class="close"
  7. @click="onClickClose"
  8. >
  9. <img
  10. src="@/assets/images/close.png"
  11. alt="关闭"
  12. draggable="false"
  13. >
  14. </button>
  15. <div class="title-wrapper">
  16. <h1>知识问答</h1>
  17. </div>
  18. <QuestionPending
  19. v-if="!isShowDesc"
  20. ref="question-pending"
  21. :is-submitted="isSubmitted"
  22. @submit="onSubmit"
  23. />
  24. <button
  25. v-if="!isSubmitted && (questionInfo?.questionType === '多选题' || questionInfo.questionType === '连线题')"
  26. class="submit"
  27. @click="onSubmit"
  28. >
  29. 提交答案
  30. </button>
  31. </div>
  32. </template>
  33. <script>
  34. // import browser from "@/utils/browser";
  35. import QuestionPending from "@/views/QuestionPending.vue"
  36. export default {
  37. components: {
  38. QuestionPending
  39. },
  40. data() {
  41. return {
  42. isSubmitted: false,
  43. isShowDesc: false,
  44. }
  45. },
  46. computed: {
  47. ...globalMapState([
  48. 'questionInfo',
  49. ])
  50. },
  51. watch: {
  52. },
  53. async mounted() {
  54. },
  55. methods: {
  56. onClickClose() {
  57. window.parent.document.getElementById('closepop').click()
  58. },
  59. onSubmit() {
  60. const selectedIdxList = this.$refs['question-pending'].selectedIdxList
  61. const selectedCount = selectedIdxList.reduce((accumulator, currentValue) => {
  62. return accumulator + currentValue
  63. })
  64. if (selectedCount > 0) {
  65. this.isSubmitted = true
  66. console.log('submit!')
  67. }
  68. }
  69. }
  70. }
  71. </script>
  72. <style lang="less" scoped>
  73. .question-judge {
  74. position: absolute;
  75. left: 50%;
  76. top: 50%;
  77. transform: translate(-50%, -50%);
  78. width: 800px;
  79. height: 520px;
  80. background-image: url(@/assets/images/bg-short.png);
  81. background-size: contain;
  82. background-repeat: no-repeat;
  83. background-position: center center;
  84. display: flex;
  85. flex-direction: column;
  86. align-items: center;
  87. > button.close {
  88. position: absolute;
  89. top: 40px;
  90. right: 45px;
  91. width: 32px;
  92. height: 34px;
  93. > img {
  94. width: 100%;
  95. height: 100%;
  96. }
  97. }
  98. > .title-wrapper {
  99. flex: 0 0 auto;
  100. text-align: center;
  101. margin-top: 45px;
  102. width: 250px;
  103. height: 55px;
  104. background-image: url(@/assets/images/title-bottom-line-thin.png);
  105. background-size: contain;
  106. background-repeat: no-repeat;
  107. background-position: center center;
  108. > h1 {
  109. font-size: 36px;
  110. font-family: LiSu-Regular, LiSu;
  111. font-weight: 400;
  112. line-height: 42px;
  113. color: #9A2D0A;
  114. background: linear-gradient(177deg, #9A2D0A 0%, #D1672B 100%);
  115. background-clip: text;
  116. -webkit-text-fill-color: transparent;
  117. }
  118. }
  119. > button.submit {
  120. margin-top: 10px;
  121. margin-bottom: 70px;
  122. width: 150px;
  123. height: 40px;
  124. background-image: url(@/assets/images/btn-main-bg.png);
  125. background-size: contain;
  126. background-repeat: no-repeat;
  127. background-position: center center;
  128. font-size: 20px;
  129. font-family: LiSu-Regular, LiSu;
  130. font-weight: 400;
  131. color: #FFFFFF;
  132. }
  133. }
  134. </style>