重构(参考银行系统的接口修改实验面板,未完成)

ui
jialong.yu 3 years ago
parent f747ec1131
commit d83a59643b
  1. 3982
      package-lock.json
  2. 28
      package.json
  3. 44
      src/components/TestPanel.vue
  4. 24
      src/components/codemirror.vue
  5. 3
      src/config/index.js
  6. 10
      src/utils/api.js
  7. 49
      src/utils/http.js
  8. 56
      src/views/Home.vue

3982
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -9,29 +9,29 @@
}, },
"dependencies": { "dependencies": {
"axios": "^0.19.2", "axios": "^0.19.2",
"core-js": "^3.6.5", "core-js": "^3.19.3",
"element-ui": "^2.13.2", "element-ui": "^2.15.6",
"jquery": "^3.5.1", "jquery": "^3.6.0",
"lib-flexible": "^0.3.2", "lib-flexible": "^0.3.2",
"postcss-px2rem": "^0.3.0", "postcss-px2rem": "^0.3.0",
"postcss-pxtorem": "^5.1.1", "postcss-pxtorem": "^5.1.1",
"px2rem-loader": "^0.1.9", "px2rem-loader": "^0.1.9",
"vue": "^2.6.12", "vue": "^2.6.14",
"vue-codemirror": "^4.0.6", "vue-codemirror": "^4.0.6",
"vue-draggable-resizable": "^2.2.0", "vue-draggable-resizable": "^2.3.0",
"vue-draggable-resizable-gorkys": "^2.4.4", "vue-draggable-resizable-gorkys": "^2.4.8",
"vue-router": "^3.4.7", "vue-router": "^3.5.3",
"vuescroll": "^4.16.1", "vuescroll": "^4.17.3",
"vuex": "^3.5.1" "vuex": "^3.6.2"
}, },
"devDependencies": { "devDependencies": {
"@vue/cli-plugin-babel": "^4.5.8", "@vue/cli-plugin-babel": "^4.5.15",
"@vue/cli-plugin-router": "^4.5.8", "@vue/cli-plugin-router": "^4.5.15",
"@vue/cli-plugin-vuex": "^4.5.8", "@vue/cli-plugin-vuex": "^4.5.15",
"@vue/cli-service": "^4.5.8", "@vue/cli-service": "^4.5.15",
"node-sass": "^4.14.1", "node-sass": "^4.14.1",
"sass-loader": "^8.0.2", "sass-loader": "^8.0.2",
"vue-template-compiler": "^2.6.12" "vue-template-compiler": "^2.6.14"
}, },
"browserslist": [ "browserslist": [
"> 1%", "> 1%",

@ -56,8 +56,8 @@
<p>实验目标</p> <p>实验目标</p>
</div> </div>
<div class="font_css"> <div class="font_css">
<div class="experimentalGoal"> <div class="experimentTarget">
<div class="break-all" v-html="experimentalGoal"></div> <div class="break-all" v-html="experimentTarget"></div>
</div> </div>
</div> </div>
</div> </div>
@ -98,21 +98,21 @@
<el-main> <el-main>
<el-tabs v-model="activeName" type="card"> <el-tabs v-model="activeName" type="card">
<el-tab-pane label="案例" name="first"> <el-tab-pane label="案例" name="first">
<div class="break-all" v-html="caseDescription"></div> <div class="break-all" v-html="experimentDescription"></div>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="实验要求" name="second"> <el-tab-pane label="实验要求" name="second">
<el-collapse v-model="activeNames"> <el-collapse v-model="activeNames">
<el-collapse-item v-for="(loop, index) in points" :key="index"> <el-collapse-item v-for="(loop, index) in points" :key="index">
<template slot="title"> <template slot="title">
<i class="el-icon-s-ticket"></i> <i class="el-icon-s-ticket"></i>
<span style="font-size:16px">{{loop.judgmentPointsName}}</span> <span style="font-size:16px">{{loop.experimentalRequirements}}</span>
</template> </template>
<div class="break-all" v-html="loop.experimentalRequirements"></div> <div class="break-all" v-html="loop.experimentalRequirements"></div>
</el-collapse-item> </el-collapse-item>
</el-collapse> </el-collapse>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="实验提示" name="fifth" v-if="isstartexperimentSuggests"> <el-tab-pane label="实验提示" name="fifth" v-if="isstartexperimentSuggests">
<div class="break-all" v-html="experimentSuggests"></div> <div class="break-all" v-html="experimentHint"></div>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
</el-main> </el-main>
@ -183,9 +183,9 @@ export default {
actEndTime: "", // actEndTime: "", //
value1: "", // value1: "", //
value: [], value: [],
experimentalGoal: "", // experimentTarget: "", //
caseDescription: "", // experimentDescription: "", //
experimentSuggests: "", // experimentHint: "", //
judgmentPointsName: "", // judgmentPointsName: "", //
points: [], points: [],
activeNames: [], activeNames: [],
@ -267,7 +267,7 @@ export default {
this.userId = this.getCookie("userId"); this.userId = this.getCookie("userId");
this.studentId = this.getCookie("studentId"); this.studentId = this.getCookie("studentId");
this.projectId = this.getCookie("projectId"); this.projectId = this.getCookie("projectId");
// this.courseId = this.getCookie("courseId"); this.courseId = this.getCookie("courseId");
this.startTime = this.getCookie("startTime") ? new Date(this.getCookie("startTime")).getTime() : '' this.startTime = this.getCookie("startTime") ? new Date(this.getCookie("startTime")).getTime() : ''
this.stopTime = this.getCookie("stopTime") ? new Date(this.getCookie("stopTime")).getTime() : '' this.stopTime = this.getCookie("stopTime") ? new Date(this.getCookie("stopTime")).getTime() : ''
@ -459,33 +459,30 @@ export default {
this.projectId = type == 2 ? project[0].projectId : this.projectId this.projectId = type == 2 ? project[0].projectId : this.projectId
if(type == 2) this.getQueryProject(0,1) if(type == 2) this.getQueryProject(0,1)
this.projectPermissions = type == 1 ? project[0].projectPermissions : this.projectPermissions this.projectPermissions = type == 1 ? project[0].projectPermissions : this.projectPermissions
this.$emit("tell", this.value1, this.projectPermissions,this.isRecovery ? this.workbenchCus : []); this.experimentTarget = project[0].experimentTarget;
this.experimentalGoal = project[0].experimentalGoal; this.experimentDescription = project[0].experimentDescription;
this.caseDescription = project[0].caseDescription; this.experimentHint = project[0].experimentHint;
this.experimentSuggests = project[0].experimentSuggests;
this.actEndTime = project[0].endTime; this.actEndTime = project[0].endTime;
this.isRecovery = false this.isRecovery = false
}, },
getQueryProject(projectId,type) { getQueryProject(projectId,type) {
//++++ //++++
this.$get(this.api.QueryProject, { this.$get(this.api.QueryProject, {
studentId: this.studentId, projectId: projectId ? projectId : this.projectId
projectId: projectId ? projectId : this.projectId,
assessmentId: this.assessmentId
}) })
.then(res => { .then(res => {
if(!type){ if(!type){
this.handleData(res.message.project,1) this.handleData(res.projectManage,1)
this.projectId = res.message.project[0].projectId this.projectId = res.projectManage[0].projectId
} }
this.points = res.message.points; this.points = res.projectJudgmentVos;
this.$emit("tell", this.value1, this.projectPermissions, this.points);
// - // -
if (this.points.length) { if (this.points.length) {
this.$parent.workbench1 = '0'; this.$parent.workbench1 = '0';
} }
this.tableData = res.message.points; this.tableData = res.message.projectJudgmentVos;
let arr1 = this.tableData; let arr1 = this.tableData;
let result1 = arr1.map(e => e.judgmentPointsId); let result1 = arr1.map(e => e.judgmentPointsId);
this.judgmentPointsIds = this.judgmentPointsIds.concat(result1) this.judgmentPointsIds = this.judgmentPointsIds.concat(result1)
@ -541,10 +538,11 @@ export default {
getProjects(){ getProjects(){
let data = { let data = {
systemId: 1, systemId: 1,
schoolId: '' cId: this.courseId,
permissions: 0
} }
this.$get(`${this.api.queryTestProject}`,data).then(res => { this.$get(`${this.api.queryTestProject}`,data).then(res => {
this.handleData(res.message,2) this.handleData(res.projects,2)
}).catch(res => {}); }).catch(res => {});
}, },
selectProject(){ selectProject(){

@ -275,9 +275,10 @@ export default {
},1000) },1000)
axios.post(this.api.UpdateCode,{ axios.post(this.api.UpdateCode,{
code: this.sourceCode, code: this.exampleData,
codeId: this.codeId, bcId: 1,
submit: this.submit cid: 1,
projectId: 1
},{ },{
cancelToken: new CANCEL_TOKEN(c => { // cancelToken: new CANCEL_TOKEN(c => { //
this.requestList.push(c) this.requestList.push(c)
@ -341,9 +342,10 @@ export default {
if(!isWhile) this.modifys = '' if(!isWhile) this.modifys = ''
this.$post(this.api.UpdateCode, { this.$post(this.api.UpdateCode, {
code: sourceCode, code: this.exampleData,
codeId: this.codeId, bcId: 1,
submit: this.submit cid: 1,
projectId: 1
}).then(res => { }).then(res => {
let result = res.message.result let result = res.message.result
if(result.includes('File ')){ if(result.includes('File ')){
@ -372,8 +374,9 @@ export default {
//() //()
this.$post(this.api.UpdateCode, { this.$post(this.api.UpdateCode, {
code: this.exampleData, code: this.exampleData,
codeId: this.codeId, bcId: 1,
submit: this.submit //(0,1) cid: 1,
projectId: 1
}) })
.then(res => { .then(res => {
this.loadIns.close() this.loadIns.close()
@ -449,8 +452,9 @@ export default {
//() //()
this.$post(this.api.UpdateCode, { this.$post(this.api.UpdateCode, {
code: this.exampleData, code: this.exampleData,
codeId: this.codeId, bcId: 1,
submit: this.submit //(0,1) cid: 1,
projectId: 1
}) })
.then(res => { .then(res => {

@ -6,7 +6,8 @@ let host = "";
if(isHh) { if(isHh) {
host = "http://10.196.131.73/"; host = "http://10.196.131.73/";
} else if(isBeta) { } else if(isBeta) {
host = "http://120.78.198.231:8081/"; host = "http://39.108.250.202:9000/";
// host = "http://192.168.31.151:9000/";
} else if(isPro) { } else if(isPro) {
host = "http://www.occupationlab.com/"; host = "http://www.occupationlab.com/";
} else { } else {

@ -1,17 +1,17 @@
import config from '@/config' import config from '@/config'
let host = `${config.host}python` let host = `${config.host}`
export default { export default {
QueryProject: `${host}/python/queryProject`, //项目选择下拉框+项目信息+判分点信息展示 QueryProject: `${host}occupationlab/projectManage/getProjectDetail`, //项目选择下拉框+项目信息+判分点信息展示
ProjectId: `${host}/python/projectId`, //判分点下拉框信息展示 ProjectId: `${host}/python/projectId`, //判分点下拉框信息展示
Submit: `${host}/python/submit`, //提交代码与判分点进行判断 Submit: `${host}/python/submit`, //提交代码与判分点进行判断
AddCode: `${host}/python/addCode`, //新增代码编译器 AddCode: `${host}python/addCode`, //新增代码编译器
UpdateCode: `${host}/python/updateCode`, //实时更新编辑器代码(修改代码) UpdateCode: `${host}python/python/runPythonCode`, //实时更新编辑器代码(修改代码)
QueryAnswer: `${host}/python/queryAnswer`, //提示答案 QueryAnswer: `${host}/python/queryAnswer`, //提示答案
DeleteCodes: `${host}/python/deleteCodes`, //重新开始 DeleteCodes: `${host}/python/deleteCodes`, //重新开始
QueryAllProject: `${host}/python/queryAllProject`, //项目选择下拉框 QueryAllProject: `${host}/python/queryAllProject`, //项目选择下拉框
ChangeCode: `${host}/python/changeCode`, //input交互 ChangeCode: `${host}/python/changeCode`, //input交互
queryTestProject: `${host}/python/queryTestProject`, //input交互 queryTestProject: `${host}occupationlab/projectManage/getProjectBySystemId`, //input交互
qualifications: `${host}/python/qualifications`, //input交互 qualifications: `${host}/python/qualifications`, //input交互
saveEvaluation: `${host}/python/saveEvaluation` //中途退出实验并保存实验数据(虚拟仿真实验) saveEvaluation: `${host}/python/saveEvaluation` //中途退出实验并保存实验数据(虚拟仿真实验)
} }

@ -21,22 +21,41 @@ axios.defaults.timeout = 30000;
// post请求头 // post请求头
axios.defaults.headers.post['Content-Type'] = 'application/json;charset=UTF-8'; axios.defaults.headers.post['Content-Type'] = 'application/json;charset=UTF-8';
function getCookie (cookie_name) {
//获取cookie中指定key的value
var allcookies = document.cookie; //索引长度,开始索引的位置
var cookie_pos = allcookies.indexOf(cookie_name); // 如果找到了索引,就代表cookie存在,否则不存在
if (cookie_pos != -1) {
// 把cookie_pos放在值的开始,只要给值加1即可
//计算取cookie值得开始索引,加的1为“=”
cookie_pos = cookie_pos + cookie_name.length + 1; //计算取cookie值得结束索引
var cookie_end = allcookies.indexOf(";", cookie_pos);
if (cookie_end == -1) {
cookie_end = allcookies.length;
} //得到想要的cookie的值
var value = unescape(allcookies.substring(cookie_pos, cookie_end));
}
return value;
}
// 请求拦截器 // 请求拦截器
// axios.interceptors.request.use(config => { axios.interceptors.request.use(config => {
// if (sessionStorage.getItem('token')) { const token = getCookie('admin-token')
// // 存在将token写入 request header if (token) {
// config.headers.Authorization = `${sessionStorage.getItem('token')}`; // 存在将token写入 request header
// } config.headers.token = token
// return config; }
// }, err => { return config;
// Message.error({ }, err => {
// message: '退出登陆', Message.error({
// onClose: function () { message: '退出登陆',
// router.push({name: 'login'}); onClose: function () {
// } router.push({name: 'login'});
// }) }
// return Promise.reject(err); })
// }) return Promise.reject(err);
})
// 响应拦截器 // 响应拦截器
// axios.interceptors.response.use( // axios.interceptors.response.use(

@ -25,9 +25,9 @@
<codemirror <codemirror
:key="codeKey" :key="codeKey"
:projectId.sync="projectId" :projectId.sync="projectId"
:code.sync="item.code.code" :code.sync="item.code"
:workbench1="item.judgmentPointsId" :workbench1="item.judgmentPointsId"
:codeid.sync="item.code.codeId" :codeid.sync="item.codeId"
></codemirror> ></codemirror>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
@ -208,31 +208,33 @@ export default {
this.projectId = value1; this.projectId = value1;
this.projectPermissions = projectPermissions; this.projectPermissions = projectPermissions;
this.studentId = this.getCookie("studentId"); this.studentId = this.getCookie("studentId");
this.$get(this.api.ProjectId, { this.codeId = 1
projectId: this.projectId, // debugger
studentId: this.studentId this.workbench = workBench
// studentId: 54 // this.$get(this.api.ProjectId, {
}) // projectId: this.projectId,
.then(res => { // studentId: this.studentId
if(workBench.length){ // })
this.workbench = workBench // .then(res => {
}else{ // if(workBench.length){
this.workbench = res.message; // this.workbench = workBench
this.workbench.map(item => { // }else{
if (item.code.codeId == 0) { // this.workbench = res.message;
item.code.codeId = ""; // this.workbench.map(item => {
} // if (item.code.codeId == 0) {
if (this.projectPermissions == "0") { // item.code.codeId = "";
item.code.codeId = ""; // }
item.code.code = ""; // if (this.projectPermissions == "0") {
} // item.code.codeId = "";
}); // item.code.code = "";
} // }
this.assessmentId && (this.codeId = this.workbench[0].code.codeId) // });
}) // }
.catch(err => { // this.assessmentId && (this.codeId = this.workbench[0].code.codeId)
console.log(err); // })
}); // .catch(err => {
// console.log(err);
// });
}, },
getCookie(cookie_name) { getCookie(cookie_name) {

Loading…
Cancel
Save