preview.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. <template>
  2. <div class="pb_content" style="background: #F0F2F5;" v-loading="loading">
  3. <div class="pb_content_body" style="position: relative; margin: 0">
  4. <div class="right">
  5. <div class="courseTop">
  6. <div class="stepsNav">
  7. <el-breadcrumb separator-class="el-icon-arrow-right">
  8. <el-breadcrumb-item :to="{
  9. path:
  10. '/testStudent?userid=' +
  11. userid +
  12. '&oid=' +
  13. oid +
  14. '&org=' +
  15. org +
  16. '&role=' +
  17. role,
  18. }">评测中心</el-breadcrumb-item>
  19. <el-breadcrumb-item>
  20. <span style="color: rgb(15, 126, 255)">{{ title }}</span>
  21. </el-breadcrumb-item>
  22. </el-breadcrumb>
  23. </div>
  24. <div class="r_pub_button_retrun" @click="retrunCourse">返回</div>
  25. </div>
  26. <div class="step_box">
  27. <div class="edit_top">
  28. <div class="op_btn">
  29. <el-button type="primary" size="small" @click="save">保存</el-button>
  30. <el-button type="primary" size="small" @click="publish">提交</el-button>
  31. </div>
  32. </div>
  33. <topicVue :cJson="cJson" :title="title"></topicVue>
  34. </div>
  35. </div>
  36. </div>
  37. </div>
  38. </template>
  39. <script>
  40. import topicVue from './component/topic.vue';
  41. export default {
  42. components: {
  43. topicVue
  44. },
  45. data() {
  46. return {
  47. userid: this.$route.query.userid,
  48. oid: this.$route.query.oid,
  49. org: this.$route.query.org,
  50. role: this.$route.query.role,
  51. cid: this.$route.query.cid,
  52. steps: 1,
  53. title: "",
  54. testType: [],
  55. see: false,
  56. cJson: [],
  57. loading: false,
  58. look: "",
  59. }
  60. },
  61. methods: {
  62. retrunCourse() {
  63. this
  64. .$confirm("是否确认返回?", "提示", {
  65. confirmButtonText: "确认",
  66. cancelButtonText: "取消",
  67. distinguishCancelAndClose: true,
  68. type: "warning",
  69. })
  70. .then(() => {
  71. this.goTo(
  72. "/testStudent?userid=" +
  73. this.userid +
  74. "&oid=" +
  75. this.oid +
  76. "&org=" +
  77. this.org +
  78. "&role=" +
  79. this.role
  80. );
  81. })
  82. .catch((v) => {
  83. });
  84. },
  85. goTo(path) {
  86. this.$router.push(path);
  87. },
  88. getData() {
  89. this.loading = true
  90. let params = {
  91. cid: this.cid,
  92. };
  93. this.ajax
  94. .get(this.$store.state.api + "getTestCourseDetail", params)
  95. .then((res) => {
  96. this.cJson = JSON.parse(res.data[0][0].chapters);
  97. this.$forceUpdate();
  98. this.title = res.data[0][0].title;
  99. this.see = res.data[0][0].open == 1 ? true : false;
  100. this.testType = [];
  101. for (var i = 0; i < res.data[1].length; i++) {
  102. this.testType.push(res.data[1][i].typeid);
  103. }
  104. console.log(this.testType);
  105. this.look = res.data[0][0].look
  106. this.loading = false
  107. })
  108. .catch((err) => {
  109. console.error(err);
  110. });
  111. },
  112. save(){
  113. this.$message.success('保存成功')
  114. this.goTo(
  115. "/testStudent?userid=" +
  116. this.userid +
  117. "&oid=" +
  118. this.oid +
  119. "&org=" +
  120. this.org +
  121. "&role=" +
  122. this.role
  123. );
  124. },
  125. publish(){
  126. this.$message.success('提交成功')
  127. this.goTo(
  128. "/testStudent?userid=" +
  129. this.userid +
  130. "&oid=" +
  131. this.oid +
  132. "&org=" +
  133. this.org +
  134. "&role=" +
  135. this.role
  136. );
  137. },
  138. },
  139. mounted() {
  140. this.getData();
  141. },
  142. }
  143. </script>
  144. <style scoped>
  145. .pb_content {
  146. height: 100% !important;
  147. /* margin: 0 20px 0 20px; */
  148. }
  149. .pb_content_body {
  150. width: 100% !important;
  151. height: 100%;
  152. }
  153. .right {
  154. height: 100%;
  155. width: 100%;
  156. display: flex;
  157. overflow: hidden;
  158. flex-direction: column;
  159. }
  160. .basic_box {
  161. margin: 0 auto;
  162. position: relative;
  163. padding: 0 20px 0 20px;
  164. }
  165. .courseTop {
  166. display: flex;
  167. flex-direction: row;
  168. justify-content: space-between;
  169. align-items: center;
  170. width: calc(100% - 40px);
  171. margin: 0 auto;
  172. padding: 10px 0;
  173. }
  174. .stepsNav {
  175. display: flex;
  176. flex-direction: row;
  177. justify-content: flex-start;
  178. align-items: center;
  179. }
  180. .step_box {
  181. width: calc(100%);
  182. margin: 0 auto;
  183. height: calc(100% - 38px);
  184. }
  185. .edit_top {
  186. height: 50px;
  187. background: #fff;
  188. display: flex;
  189. align-items: center;
  190. justify-content: flex-end;
  191. position: relative;
  192. padding: 0 30px;
  193. border-top: 2px solid #eee;
  194. border-bottom: 2px solid #eee;
  195. }
  196. </style>