PreviewPaper.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. <template>
  2. <div class="paper" v-loading="loading">
  3. <div class="center paper-top">
  4. <small class="paper-title">
  5. <el-button-group>
  6. <el-button size="small"
  7. ><span class="titlefont">课程代码:</span></el-button
  8. >
  9. <el-button size="small"
  10. ><span class="titlefont">{{ paper.course.code }}</span></el-button
  11. >
  12. </el-button-group>
  13. </small>
  14. <small class="paper-title">
  15. <el-button-group>
  16. <el-button size="small"
  17. ><span class="titlefont">课程名称:</span></el-button
  18. >
  19. <el-button size="small"
  20. ><span class="titlefont">{{ paper.course.name }}</span></el-button
  21. >
  22. </el-button-group>
  23. </small>
  24. <small class="paper-title">
  25. <el-button-group>
  26. <el-button size="small"
  27. ><span class="titlefont">试卷名称:</span></el-button
  28. >
  29. <input
  30. placeholder="试卷名称"
  31. class="paper-input"
  32. v-model="paper.name"
  33. />
  34. </el-button-group>
  35. </small>
  36. <small class="paper-title">
  37. <el-button-group>
  38. <el-button size="small" v-if="isBack"
  39. ><span class="titlefont" @click="back">返回</span></el-button
  40. >
  41. </el-button-group>
  42. </small>
  43. </div>
  44. <div class="center">
  45. <div>
  46. <br />
  47. <h3 class="text-center">{{ paper.course.name }}&nbsp;试卷</h3>
  48. <br />
  49. <h4 class="text-center">(课程代码&nbsp;{{ paper.course.code }})</h4>
  50. <br />
  51. <div v-if="paper.examRemark">
  52. <h1 class="text-left">考试说明:</h1>
  53. <div v-html="paper.examRemark"></div>
  54. </div>
  55. <h1 class="text-left">本试卷满分{{ paper.totalScore }}分。</h1>
  56. <br />
  57. </div>
  58. </div>
  59. <div>
  60. <div
  61. class="mainQues"
  62. v-for="(paperDetail, index) in paper.paperDetails"
  63. :key="index"
  64. >
  65. <div class="mainQuesTitle">
  66. <span>{{ paperDetail.cnNum }}</span> <span>.</span>
  67. <span>{{ paperDetail.name }}</span>
  68. <span
  69. >(本大题共{{ paperDetail.unitCount }}小题,满分{{
  70. paperDetail.score
  71. }}分)</span
  72. >
  73. </div>
  74. <div
  75. v-for="(paperDetailUnit, index) in paperDetail.paperDetailUnits"
  76. :key="index"
  77. >
  78. <div>
  79. <div class="quesBody">
  80. <span class="ques-title">{{ paperDetailUnit.number }}.</span>
  81. <span
  82. class="ques-body"
  83. v-question-audio
  84. :hasAudio="paperDetailUnit.question.hasAudio"
  85. :questionId="paperDetailUnit.question.id"
  86. v-html="paperDetailUnit.question.quesBody"
  87. ></span>
  88. <span>({{ paperDetailUnit.score }}分)</span>
  89. </div>
  90. <div
  91. class="quesOption"
  92. v-for="(quesOption, index) in paperDetailUnit.question
  93. .quesOptions"
  94. :key="index"
  95. >
  96. <span class="ques-title"
  97. >{{ index | optionOrderWordFilter }}.</span
  98. >
  99. <span
  100. class="ques-body"
  101. v-question-audio
  102. :hasAudio="paperDetailUnit.question.hasAudio"
  103. :questionId="paperDetailUnit.question.id"
  104. v-html="quesOption.optionBody"
  105. ></span>
  106. </div>
  107. </div>
  108. <br />
  109. <div
  110. class="subQues"
  111. v-for="(subQuestion, index) in paperDetailUnit.question
  112. .subQuestions"
  113. :key="index"
  114. >
  115. <div>
  116. <div class="quesBody">
  117. <span class="ques-title"
  118. >{{ subQuestion.quesParams.number }}.</span
  119. >
  120. <span v-html="subQuestion.quesBody"></span>
  121. <span>({{ paperDetailUnit.subScoreList[index] }}分)</span>
  122. </div>
  123. <div
  124. class="quesOption"
  125. v-for="(subQuesOption, index) in subQuestion.quesOptions"
  126. :key="index"
  127. >
  128. <span class="ques-title"
  129. >{{ index | optionOrderWordFilter }}.</span
  130. >
  131. <span v-html="subQuesOption.optionBody"></span>
  132. </div>
  133. </div>
  134. </div>
  135. </div>
  136. </div>
  137. </div>
  138. </div>
  139. </template>
  140. <script>
  141. import { QUESTION_API } from "@/constants/constants";
  142. import { mapState } from "vuex";
  143. export default {
  144. data() {
  145. return {
  146. paperId: "",
  147. paperDetailId: "",
  148. editPaperDetailUnit: "",
  149. quesDialog: false,
  150. paperDatailDialog: false,
  151. parentView: "",
  152. paper: {
  153. course: {
  154. code: "",
  155. name: ""
  156. }
  157. },
  158. questionType: "",
  159. reduplicateGroup: [],
  160. singleRightAnswer: "", //接收单选答案
  161. multipleRightAnswer: [], //接收多选答案
  162. options: ["正确", "错误"]
  163. };
  164. },
  165. methods: {
  166. //初始化试卷
  167. initPaper() {
  168. this.loading = true;
  169. this.$http.get(QUESTION_API + "/paper/" + this.paperId).then(response => {
  170. this.paper = response.data;
  171. this.loading = false;
  172. });
  173. },
  174. back() {
  175. debugger;
  176. console.log("返回");
  177. window.history.back();
  178. }
  179. },
  180. computed: {
  181. ...mapState({
  182. user: state => state.user
  183. }),
  184. isBack() {
  185. var params = window.location.href.split("?")[1];
  186. if (params && params.indexOf("isback") > -1) {
  187. return true;
  188. }
  189. return false;
  190. }
  191. },
  192. created() {
  193. this.paperId = this.$route.params.paperId;
  194. console.log("this.paperId:", this.paperId);
  195. this.initPaper();
  196. },
  197. mounted() {}
  198. };
  199. </script>
  200. <style scoped>
  201. .red {
  202. color: red;
  203. }
  204. .center {
  205. margin: 0 auto 0 auto;
  206. text-align: center;
  207. }
  208. h1 {
  209. font-size: 16px;
  210. font-family: "微软雅黑", serif;
  211. font-weight: bold;
  212. }
  213. h3 {
  214. font-size: 33px;
  215. font-family: "微软雅黑", serif;
  216. font-weight: bold;
  217. }
  218. h4 {
  219. font-size: 21px;
  220. font-family: "微软雅黑", serif;
  221. }
  222. span > p {
  223. font-size: 16px;
  224. font-family: "微软雅黑", serif;
  225. text-align: left;
  226. display: block;
  227. }
  228. .ques-title {
  229. margin-right: 10px;
  230. }
  231. .mainQues {
  232. margin-left: 3.5%;
  233. text-align: left;
  234. }
  235. .mainQuesTitle {
  236. font-size: 16px;
  237. font-family: "微软雅黑", serif;
  238. font-weight: bold;
  239. margin-bottom: 20px;
  240. }
  241. .ques {
  242. font-size: 16px;
  243. font-family: "微软雅黑", serif;
  244. text-align: left;
  245. margin-bottom: 10px;
  246. padding-left: 10px;
  247. position: relative;
  248. }
  249. .subQues {
  250. position: relative;
  251. margin-bottom: 10px;
  252. padding-left: 10px;
  253. }
  254. .ques.repeated {
  255. /*border: 1px solid red;*/
  256. }
  257. .quesBody {
  258. display: flex;
  259. }
  260. .quesOption {
  261. margin-top: 10px;
  262. display: flex;
  263. }
  264. .text-left {
  265. margin-left: 3.5%;
  266. text-align: left;
  267. }
  268. .paper-title {
  269. margin-right: 10px;
  270. margin-bottom: 10px;
  271. }
  272. .paper-top {
  273. margin-top: 10px;
  274. }
  275. small {
  276. font-size: 15px;
  277. font-weight: bold;
  278. margin-left: 10px;
  279. margin-top: 20px;
  280. }
  281. .titlefont {
  282. font-size: 14px;
  283. }
  284. .paper {
  285. margin: 0 auto;
  286. background-color: white;
  287. padding-left: 10%;
  288. padding-right: 10%;
  289. }
  290. .paper-input {
  291. font-size: 14px;
  292. margin-left: 7px;
  293. margin-top: 5px;
  294. width: 150px;
  295. border-bottom: 1px solid black; /* 下划线效果 */
  296. border-top: 0;
  297. border-left: 0;
  298. border-right: 0;
  299. background-color: transparent; /* 背景色透明 */
  300. outline: none;
  301. }
  302. .btnDiv {
  303. height: 30px;
  304. text-align: right;
  305. position: relative;
  306. right: 2px;
  307. top: 1px;
  308. visibility: hidden;
  309. }
  310. textarea {
  311. width: 200px;
  312. }
  313. #app {
  314. background-color: white !important;
  315. }
  316. </style>