info.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. <template>
  2. <div class="tab-container">
  3. <el-card class="box-card">
  4. <h1 style="text-align: center">基本信息填写</h1>
  5. <el-form
  6. :model="ruleForm"
  7. :rules="rules"
  8. ref="ruleForm"
  9. label-width="180px"
  10. class="demo-ruleForm"
  11. >
  12. <el-form-item label="方向" prop="direction">
  13. <el-checkbox-group v-model="ruleForm.direction">
  14. <el-checkbox label="前端" name="front">前端开发</el-checkbox>
  15. <el-checkbox label="后端" name="back">后端开发</el-checkbox>
  16. <el-checkbox label="数据库" name="data">数据库开发</el-checkbox>
  17. </el-checkbox-group>
  18. </el-form-item>
  19. <el-form-item label="学习过的知识点" prop="learned">
  20. <el-checkbox-group v-model="ruleForm.learned">
  21. <el-checkbox label="软件需求" name="SR">软件需求</el-checkbox>
  22. <el-checkbox label="软件设计" name="SD">软件设计</el-checkbox>
  23. <el-checkbox label="软件构造" name="SC">软件构造</el-checkbox>
  24. <el-checkbox label="软件测试" name="ST">软件测试</el-checkbox>
  25. <el-checkbox label="软件维护" name="SM">软件维护</el-checkbox>
  26. <el-checkbox label="软件配置管理" name="SCM"
  27. >软件配置管理</el-checkbox
  28. >
  29. <el-checkbox label="软件工程管理" name="SEM"
  30. >软件工程管理</el-checkbox
  31. >
  32. <el-checkbox label="软件工程过程" name="SEP"
  33. >软件工程过程</el-checkbox
  34. >
  35. <el-checkbox label="软件工程模型与方法" name="SEMM"
  36. >软件工程模型与方法</el-checkbox
  37. >
  38. <el-checkbox label="软件质量" name="SQ">软件质量</el-checkbox>
  39. <el-checkbox label="软件工程职业实践" name="SEPP"
  40. >软件工程职业实践</el-checkbox
  41. >
  42. <el-checkbox label="软件工程经济学" name="SEE"
  43. >软件工程经济学</el-checkbox
  44. >
  45. <el-checkbox label="计算基础" name="CF">计算基础</el-checkbox>
  46. <el-checkbox label="数学基础" name="MF">数学基础</el-checkbox>
  47. <el-checkbox label="工程基础" name="EF">工程基础</el-checkbox>
  48. </el-checkbox-group>
  49. </el-form-item>
  50. <el-form-item label="感兴趣的知识点" prop="interested">
  51. <el-checkbox-group v-model="ruleForm.interested">
  52. <el-checkbox label="软件需求" name="SR">软件需求</el-checkbox>
  53. <el-checkbox label="软件设计" name="SD">软件设计</el-checkbox>
  54. <el-checkbox label="软件构造" name="SC">软件构造</el-checkbox>
  55. <el-checkbox label="软件测试" name="ST">软件测试</el-checkbox>
  56. <el-checkbox label="软件维护" name="SM">软件维护</el-checkbox>
  57. <el-checkbox label="软件配置管理" name="SCM"
  58. >软件配置管理</el-checkbox
  59. >
  60. <el-checkbox label="软件工程管理" name="SEM"
  61. >软件工程管理</el-checkbox
  62. >
  63. <el-checkbox label="软件工程过程" name="SEP"
  64. >软件工程过程</el-checkbox
  65. >
  66. <el-checkbox label="软件工程模型与方法" name="SEMM"
  67. >软件工程模型与方法</el-checkbox
  68. >
  69. <el-checkbox label="软件质量" name="SQ">软件质量</el-checkbox>
  70. <el-checkbox label="软件工程职业实践" name="SEPP"
  71. >软件工程职业实践</el-checkbox
  72. >
  73. <el-checkbox label="软件工程经济学" name="SEE"
  74. >软件工程经济学</el-checkbox
  75. >
  76. <el-checkbox label="计算基础" name="CF">计算基础</el-checkbox>
  77. <el-checkbox label="数学基础" name="MF">数学基础</el-checkbox>
  78. <el-checkbox label="工程基础" name="EF">工程基础</el-checkbox>
  79. </el-checkbox-group>
  80. </el-form-item>
  81. <el-form-item>
  82. <el-button type="primary" @click="submitForm('ruleForm')"
  83. >提交</el-button
  84. >
  85. <el-button @click="resetForm('ruleForm')">重置</el-button>
  86. <el-button @click="goBack()">返回</el-button>
  87. </el-form-item>
  88. </el-form>
  89. </el-card>
  90. </div>
  91. </template>
  92. <style>
  93. .text {
  94. font-size: 14px;
  95. }
  96. .item {
  97. padding: 18px 0px;
  98. }
  99. .box-card {
  100. width: 100%;
  101. height: 80%;
  102. padding: 20px 20px;
  103. }
  104. .tab-container {
  105. padding: 20px 20px;
  106. }
  107. </style>
  108. <script>
  109. export default {
  110. data() {
  111. return {
  112. ruleForm: {
  113. learned: ["软件需求", "软件设计", "软件构造"],
  114. interested: ["计算基础", "数学基础", "工程基础"],
  115. direction: ["前端"],
  116. },
  117. rules: {
  118. learned: [
  119. {
  120. type: "array",
  121. required: true,
  122. message: "请至少选择一个课程",
  123. trigger: "change",
  124. },
  125. ],
  126. interested: [
  127. {
  128. type: "array",
  129. required: true,
  130. message: "请至少选择一个课程",
  131. trigger: "change",
  132. },
  133. ],
  134. },
  135. examId: "",
  136. questionScoreMap: {},
  137. redirect_uri: encodeURIComponent(
  138. "http://p.seec.seecoder.cn/rookie/basicResult"
  139. ),
  140. teacher_token: "",
  141. redirect_test_uri: encodeURIComponent(
  142. "http://localhost:3000/rookie/basicResult"
  143. ),
  144. };
  145. },
  146. methods: {
  147. submitForm(formName) {
  148. this.$refs[formName].validate((valid) => {
  149. if (valid) {
  150. let paramObj = this.ruleForm;
  151. localStorage.setItem("learned", JSON.stringify(paramObj.learned));
  152. localStorage.setItem(
  153. "interested",
  154. JSON.stringify(paramObj.interested)
  155. );
  156. alert("submit!");
  157. this.$api.post("/rookie/info", paramObj);
  158. //this.$api.get("/rookie/virtualTeacher").then((res) => {
  159. // console.log(res.data.content.token);
  160. // console.log(this.$store.state.token);
  161. // this.teacher_token = res.data.content.token;
  162. this.$api.post("/rookie/basicTest", paramObj).then((res) => {
  163. console.log(res.data.content);
  164. this.questionScoreMap = res.data.content;
  165. var date = new Date();
  166. var year = date.getFullYear(); //月份从0~11,所以加一
  167. var dateArr = [
  168. date.getMonth() + 1,
  169. date.getDate(),
  170. date.getHours(),
  171. date.getMinutes(),
  172. date.getSeconds(),
  173. ];
  174. var endDateArr=[
  175. date.getMonth() + 1,
  176. date.getDate(),
  177. date.getHours()+2,
  178. date.getMinutes()+1,
  179. date.getSeconds(),
  180. ];;
  181. for (var i = 0; i < dateArr.length; i++) {
  182. if (dateArr[i] >= 0 && dateArr[i] <= 9) {
  183. dateArr[i] = "0" + dateArr[i];
  184. }
  185. if(endDateArr[i]>=0 && endDateArr[i]<=9){
  186. endDateArr[i]="0"+endDateArr[i];
  187. }
  188. }
  189. var startTime =
  190. year +
  191. "-" +
  192. dateArr[0] +
  193. "-" +
  194. dateArr[1] +
  195. " " +
  196. dateArr[2] +
  197. ":" +
  198. dateArr[3] +
  199. ":" +
  200. dateArr[4];
  201. var endTime=year +
  202. "-" +
  203. endDateArr[0] +
  204. "-" +
  205. endDateArr[1] +
  206. " " +
  207. endDateArr[2] +
  208. ":" +
  209. endDateArr[3] +
  210. ":" +
  211. endDateArr[4];
  212. let examObj = {
  213. antiCheating: true,
  214. comment: "通关模式基础测试",
  215. difficulty: 1,
  216. endTime: endTime,
  217. examName: "通关模式基础测试",
  218. isPublic: true,
  219. position: "string",
  220. skills: [],
  221. startTime: startTime,
  222. };
  223. console.log(examObj)
  224. this.$apiss.post("/exam", examObj).then((res1) => {
  225. console.log(res1.data.result.examId);
  226. this.examId = res1.data.result.examId;
  227. localStorage.setItem("examId", res1.data.result.examId);
  228. console.log(this.questionScoreMap);
  229. let questionMap={
  230. questionScoreMap:this.questionScoreMap
  231. }
  232. console.log(questionMap)
  233. //window.location.href = 'http://localhost:8000/exam/935/exam-pane?redirect_uri='+this.redirect_test_uri
  234. this.$apiss
  235. .put("/exam/" + this.examId + "/questions/", questionMap)
  236. .then((res2) => {
  237. //window.location.href = 'http://localhost:8000/exam/935/exam-pane?redirect_uri=http%3A%2F%2Fwww.baidu.com'
  238. //window.location.href='http://testeval.seec.seecoder.cn/exam/'+this.examId+'/exam-pane?'+this.redirect_uri+'&id_token='+this.$store.state.token
  239. window.location.href =
  240. "http://eval.seec.seecoder.cn/exam/" +
  241. this.examId +
  242. "/exam-pane?redirect_uri=" +
  243. this.redirect_uri +
  244. "&id_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJwLnNlZWNvZGVyLmNuIiwic3ViIjoiMTc3NjE3MDgxODEiLCJhdWQiOiJzZWVjLW1vb2MiLCJhdXRoX3RpbWUiOjE2MjE1OTYxNjUsImlhdCI6MTYyMTU5NjE2NSwiZXhwIjoxNjIxNjgyNTY1LCJ1c2VyX2luZm8iOnsicGhvbmUiOiIxNzc2MTcwODE4MSIsImVtYWlsIjoiMTE1ODQ5NDMxOEBxcS5jb20iLCJpZCI6MTM3MiwibmFtZSI6ImxpaGUiLCJyb2xlIjoiU1RVREVOVCJ9fQ.QEsRq8uSJRxFUmEpaGBrsdp1sy5CMVdtLIY5g5RkYyQ"
  245. //+this.$store.state.token;
  246. });
  247. });
  248. });
  249. //});
  250. } else {
  251. console.log("error submit!!");
  252. return false;
  253. }
  254. });
  255. },
  256. resetForm(formName) {
  257. this.$refs[formName].resetFields();
  258. },
  259. goBack() {
  260. this.$router.push("/rookie");
  261. },
  262. },
  263. };
  264. </script>