check.vue 5.6 KB

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