check.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  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" v-if="!back">
  8. <el-breadcrumb-item
  9. :to="{
  10. path:
  11. '/test?userid=' +
  12. userid +
  13. '&oid=' +
  14. oid +
  15. '&org=' +
  16. org +
  17. '&role=' +
  18. role,
  19. }"
  20. >表单管理</el-breadcrumb-item
  21. >
  22. <el-breadcrumb-item
  23. v-if="type == 3"
  24. :to="{
  25. path:
  26. '/checkToTest2?uid=' +
  27. userid2 +
  28. '&userid=' +
  29. userid +
  30. '&oid=' +
  31. oid +
  32. '&org=' +
  33. org +
  34. '&role=' +
  35. role,
  36. }"
  37. >
  38. 查看表单
  39. </el-breadcrumb-item>
  40. <el-breadcrumb-item
  41. v-else
  42. :to="{
  43. path:
  44. '/checkToTest?cid=' +
  45. cid +
  46. '&userid=' +
  47. userid +
  48. '&oid=' +
  49. oid +
  50. '&org=' +
  51. org +
  52. '&role=' +
  53. role,
  54. }"
  55. >
  56. 查看表单
  57. </el-breadcrumb-item>
  58. <el-breadcrumb-item>
  59. <span style="color: rgb(15, 126, 255)">{{ name }}</span>
  60. </el-breadcrumb-item>
  61. </el-breadcrumb>
  62. </div>
  63. <div class="r_pub_button_retrun" @click="retrunCourse">返回</div>
  64. </div>
  65. <div class="step_box">
  66. <div class="edit_top">
  67. <div class="op_btn">
  68. <el-button type="primary" size="small" @click="publish">确定批改</el-button>
  69. </div>
  70. </div>
  71. <topicVue :cJson="cJson" :title="title" :brief="brief" :checktype="2" :see="see" :isTeacher="1" :name="name" ref="topicVue"></topicVue>
  72. </div>
  73. </div>
  74. </div>
  75. </div>
  76. </template>
  77. <script>
  78. import topicVue from "../../testStudent/view/component/topic.vue";
  79. export default {
  80. components: {
  81. topicVue,
  82. },
  83. data() {
  84. return {
  85. back:this.$route.query.back,
  86. userid: this.$route.query.userid,
  87. userid2: this.$route.query.userid2,
  88. tid: this.$route.query.tid,
  89. oid: this.$route.query.oid,
  90. org: this.$route.query.org,
  91. role: this.$route.query.role,
  92. cid: this.$route.query.cid,
  93. type: this.$route.query.type,
  94. steps: 1,
  95. title: "",
  96. brief: "",
  97. id:"",
  98. testType: [],
  99. see: true,
  100. cJson: [],
  101. loading: false,
  102. look: "",
  103. name: "",
  104. };
  105. },
  106. methods: {
  107. retrunCourse() {
  108. if (this.back) return this.$router.go(-1)
  109. if(this.type == 3){
  110. this.goTo(
  111. "/checkToTest2?uid=" +
  112. this.userid2 +
  113. "&userid=" +
  114. this.userid +
  115. "&oid=" +
  116. this.oid +
  117. "&org=" +
  118. this.org +
  119. "&role=" +
  120. this.role
  121. );
  122. }else{
  123. this.goTo(
  124. "/checkToTest?cid=" +
  125. this.cid +
  126. "&userid=" +
  127. this.userid +
  128. "&oid=" +
  129. this.oid +
  130. "&org=" +
  131. this.org +
  132. "&role=" +
  133. this.role
  134. );
  135. }
  136. },
  137. goTo(path) {
  138. this.$router.push(path);
  139. },
  140. getData() {
  141. this.loading = true;
  142. let params = {
  143. cid: this.cid,
  144. tid: this.tid,
  145. };
  146. this.ajax
  147. .get(this.$store.state.api + "getTestWorks2", params)
  148. .then((res) => {
  149. // this.cJson = JSON.parse(res.data[0][0].chapters);
  150. this.$forceUpdate();
  151. this.title = res.data[0][0].title;
  152. this.brief = res.data[0][0].brief;
  153. this.testType = [];
  154. for (var i = 0; i < res.data[1].length; i++) {
  155. this.testType.push(res.data[1][i].typeid);
  156. }
  157. console.log(this.testType);
  158. this.look = res.data[0][0].look;
  159. this.id = res.data[2][0].id
  160. this.cJson = JSON.parse(res.data[2][0].courseJson);
  161. this.name = res.data[2][0].username;
  162. this.loading = false;
  163. })
  164. .catch((err) => {
  165. console.error(err);
  166. });
  167. },
  168. publish() {
  169. let cjson = this.$refs['topicVue'].checkArray
  170. let params = [
  171. {
  172. id: this.id,
  173. cjson: JSON.stringify(cjson),
  174. type: "3",
  175. uid:this.userid
  176. },
  177. ];
  178. this.ajax
  179. .post(this.$store.state.api + "addTestWorksTeacher", params)
  180. .then((res) => {
  181. this.$message.success("批改成功");
  182. this.retrunCourse();
  183. })
  184. .catch((err) => {
  185. this.$message.error("网络不佳");
  186. console.error(err);
  187. });
  188. },
  189. },
  190. mounted() {
  191. this.getData();
  192. },
  193. };
  194. </script>
  195. <style scoped>
  196. .pb_content {
  197. height: 100% !important;
  198. /* margin: 0 20px 0 20px; */
  199. }
  200. .pb_content_body {
  201. width: 100% !important;
  202. height: 100%;
  203. }
  204. .right {
  205. height: 100%;
  206. width: 100%;
  207. display: flex;
  208. overflow: hidden;
  209. flex-direction: column;
  210. }
  211. .basic_box {
  212. margin: 0 auto;
  213. position: relative;
  214. padding: 0 20px 0 20px;
  215. }
  216. .courseTop {
  217. display: flex;
  218. flex-direction: row;
  219. justify-content: space-between;
  220. align-items: center;
  221. width: calc(100% - 40px);
  222. margin: 0 auto;
  223. padding: 10px 0;
  224. }
  225. .stepsNav {
  226. display: flex;
  227. flex-direction: row;
  228. justify-content: flex-start;
  229. align-items: center;
  230. }
  231. .step_box {
  232. width: calc(100%);
  233. margin: 0 auto;
  234. height: calc(100% - 38px);
  235. }
  236. .edit_top {
  237. height: 50px;
  238. background: #fff;
  239. display: flex;
  240. align-items: center;
  241. justify-content: flex-end;
  242. position: relative;
  243. padding: 0 30px;
  244. border-top: 2px solid #eee;
  245. border-bottom: 2px solid #eee;
  246. width: 95%;
  247. margin: 0 auto;
  248. box-sizing: border-box;
  249. }
  250. </style>