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

ui
jialong.yu 3 years ago
parent f747ec1131
commit d83a59643b
  1. 3948
      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. 54
      src/views/Home.vue

3948
package-lock.json generated

File diff suppressed because it is too large Load Diff

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

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

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

@ -6,7 +6,8 @@ let host = "";
if(isHh) {
host = "http://10.196.131.73/";
} 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) {
host = "http://www.occupationlab.com/";
} else {

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

@ -21,22 +21,41 @@ axios.defaults.timeout = 30000;
// post请求头
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 => {
// if (sessionStorage.getItem('token')) {
// // 存在将token写入 request header
// config.headers.Authorization = `${sessionStorage.getItem('token')}`;
// }
// return config;
// }, err => {
// Message.error({
// message: '退出登陆',
// onClose: function () {
// router.push({name: 'login'});
// }
// })
// return Promise.reject(err);
// })
axios.interceptors.request.use(config => {
const token = getCookie('admin-token')
if (token) {
// 存在将token写入 request header
config.headers.token = token
}
return config;
}, err => {
Message.error({
message: '退出登陆',
onClose: function () {
router.push({name: 'login'});
}
})
return Promise.reject(err);
})
// 响应拦截器
// axios.interceptors.response.use(

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

Loading…
Cancel
Save