QuestionJudge.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  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-show="!isShowDesc"
  20. ref="question-pending"
  21. :is-submitted="isSubmitted"
  22. @submit="onSubmit"
  23. />
  24. <AnswerDesc
  25. v-show="isShowDesc"
  26. />
  27. <button
  28. v-show="!isSubmitted && (questionInfo?.questionType === '多选题' || questionInfo.questionType === '连线题')"
  29. class="submit"
  30. @click="onSubmit"
  31. >
  32. 提交答案
  33. </button>
  34. <div
  35. v-show="!isShowDesc && isSubmitted && $refs['question-pending']?.isCorrect"
  36. class="button-wrapper-correct"
  37. >
  38. <button
  39. class="watch-desc"
  40. @click="onClickWatchDesc"
  41. >
  42. 答案解析
  43. </button>
  44. <button class="next">
  45. 下一题(2)
  46. </button>
  47. </div>
  48. <div
  49. v-show="!isShowDesc && isSubmitted && !$refs['question-pending']?.isCorrect"
  50. class="button-wrapper-wrong"
  51. >
  52. <button class="next">
  53. 下一题(2)
  54. </button>
  55. <button
  56. class="retry"
  57. @click="onClickRetry"
  58. >
  59. 重新答题
  60. </button>
  61. <button
  62. class="watch-desc"
  63. @click="onClickWatchDesc"
  64. >
  65. 答案解析
  66. </button>
  67. </div>
  68. <button
  69. v-show="isShowDesc"
  70. class="return-question"
  71. @click="isShowDesc = false"
  72. >
  73. 返回题目
  74. </button>
  75. </div>
  76. </template>
  77. <script>
  78. // import browser from "@/utils/browser";
  79. import QuestionPending from "@/views/QuestionPending.vue"
  80. import AnswerDesc from "@/views/AnswerDesc.vue"
  81. export default {
  82. components: {
  83. QuestionPending,
  84. AnswerDesc,
  85. },
  86. data() {
  87. return {
  88. isSubmitted: false,
  89. isShowDesc: false,
  90. }
  91. },
  92. computed: {
  93. ...globalMapState([
  94. 'questionInfo',
  95. ])
  96. },
  97. watch: {
  98. },
  99. async mounted() {
  100. },
  101. methods: {
  102. onClickClose() {
  103. window.parent.document.getElementById('closepop').click()
  104. },
  105. onSubmit() {
  106. if (this.$refs['question-pending'].canSubmit > 0) {
  107. this.isSubmitted = true
  108. console.log('submit!')
  109. }
  110. },
  111. onClickWatchDesc() {
  112. this.isShowDesc = true
  113. },
  114. onClickRetry() {
  115. this.isSubmitted = false
  116. this.isShowDesc = false
  117. this.$refs['question-pending'].selectedIdxList = []
  118. }
  119. }
  120. }
  121. </script>
  122. <style lang="less" scoped>
  123. .question-judge {
  124. position: absolute;
  125. left: 50%;
  126. top: 50%;
  127. transform: translate(-50%, -50%);
  128. width: 800px;
  129. height: 520px;
  130. background-image: url(@/assets/images/bg-short.png);
  131. background-size: contain;
  132. background-repeat: no-repeat;
  133. background-position: center center;
  134. display: flex;
  135. flex-direction: column;
  136. align-items: center;
  137. > button.close {
  138. position: absolute;
  139. top: 40px;
  140. right: 45px;
  141. width: 32px;
  142. height: 34px;
  143. > img {
  144. width: 100%;
  145. height: 100%;
  146. }
  147. }
  148. > .title-wrapper {
  149. flex: 0 0 auto;
  150. text-align: center;
  151. margin-top: 45px;
  152. width: 250px;
  153. height: 55px;
  154. background-image: url(@/assets/images/title-bottom-line-thin.png);
  155. background-size: contain;
  156. background-repeat: no-repeat;
  157. background-position: center center;
  158. > h1 {
  159. font-size: 36px;
  160. font-family: LiSu-Regular, LiSu;
  161. font-weight: 400;
  162. line-height: 42px;
  163. color: #9A2D0A;
  164. background: linear-gradient(177deg, #9A2D0A 0%, #D1672B 100%);
  165. background-clip: text;
  166. -webkit-text-fill-color: transparent;
  167. }
  168. }
  169. > button.submit {
  170. margin-top: 10px;
  171. margin-bottom: 70px;
  172. width: 150px;
  173. height: 40px;
  174. background-image: url(@/assets/images/btn-main-bg.png);
  175. background-size: contain;
  176. background-repeat: no-repeat;
  177. background-position: center center;
  178. font-size: 20px;
  179. font-family: LiSu-Regular, LiSu;
  180. font-weight: 400;
  181. color: #FFFFFF;
  182. }
  183. > .button-wrapper-correct {
  184. margin-top: 10px;
  185. margin-bottom: 70px;
  186. > button {
  187. width: 149px;
  188. height: 40px;
  189. &.watch-desc {
  190. background-image: url(@/assets/images/btn-normal-bg.png);
  191. background-size: contain;
  192. background-repeat: no-repeat;
  193. background-position: center center;
  194. margin-right: 15px;
  195. }
  196. &.next {
  197. background-image: url(@/assets/images/btn-main-bg.png);
  198. background-size: contain;
  199. background-repeat: no-repeat;
  200. background-position: center center;
  201. }
  202. }
  203. }
  204. > .button-wrapper-wrong {
  205. margin-top: 10px;
  206. margin-bottom: 70px;
  207. > button.next {
  208. display: block;
  209. width: 313px;
  210. height: 40px;
  211. background-image: url(@/assets/images/btn-main-long-bg.png);
  212. background-size: 100% 100%;
  213. background-repeat: no-repeat;
  214. background-position: center center;
  215. font-size: 20px;
  216. font-family: LiSu-Regular, LiSu;
  217. font-weight: 400;
  218. color: #FFFFFF;
  219. line-height: 32px;
  220. margin-bottom: 8px;
  221. }
  222. > button.retry {
  223. width: 149px;
  224. height: 40px;
  225. background-image: url(@/assets/images/btn-normal-bg.png);
  226. background-size: contain;
  227. background-repeat: no-repeat;
  228. background-position: center center;
  229. font-size: 20px;
  230. font-family: LiSu-Regular, LiSu;
  231. font-weight: 400;
  232. color: #8F4831;
  233. margin-right: 15px;
  234. }
  235. > button.watch-desc {
  236. width: 149px;
  237. height: 40px;
  238. background-image: url(@/assets/images/btn-normal-bg.png);
  239. background-size: contain;
  240. background-repeat: no-repeat;
  241. background-position: center center;
  242. font-size: 20px;
  243. font-family: LiSu-Regular, LiSu;
  244. font-weight: 400;
  245. color: #8F4831;
  246. }
  247. }
  248. > button.return-question {
  249. margin-top: 10px;
  250. margin-bottom: 70px;
  251. display: block;
  252. width: 313px;
  253. height: 40px;
  254. background-image: url(@/assets/images/btn-main-long-bg.png);
  255. background-size: 100% 100%;
  256. background-repeat: no-repeat;
  257. background-position: center center;
  258. font-size: 20px;
  259. font-family: LiSu-Regular, LiSu;
  260. font-weight: 400;
  261. color: #FFFFFF;
  262. line-height: 32px;
  263. }
  264. }
  265. </style>