From c53b0185969151fb6af4918323ac371a39c3e339 Mon Sep 17 00:00:00 2001
From: yujialong <479214531@qq.com>
Date: Fri, 2 Jun 2023 20:49:14 +0800
Subject: [PATCH] =?UTF-8?q?=E6=A8=A1=E5=9E=8B=E7=AD=89?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/index.html | 15 +-
src/api/index.js | 3 +
src/components/TestPanel.vue | 239 +++++----
src/components/codemirror.vue | 295 +++++-----
src/config/index.js | 6 +-
src/views/Data.vue | 977 +++++++++++++++++++---------------
src/views/Home.vue | 49 +-
7 files changed, 911 insertions(+), 673 deletions(-)
diff --git a/public/index.html b/public/index.html
index 4123528..f9e4405 100644
--- a/public/index.html
+++ b/public/index.html
@@ -1,15 +1,20 @@
-
-
-
-
+
+
+
+
+
<%= htmlWebpackPlugin.options.title %>
diff --git a/src/api/index.js b/src/api/index.js
index 3349918..6d075fa 100644
--- a/src/api/index.js
+++ b/src/api/index.js
@@ -21,6 +21,7 @@ export default {
getDetailById: 'occupationlab/occupationlab/assessment/getDetailById',
pageStuAssessment: 'occupationlab/occupationlab/assessment/pageStuAssessment',
modelClassList: `nakadai/nakadai/model/reference/modelClassList`,
+ studentModelList: `nakadai/nakadai/model/student/studentModelList`,
referenceDemoList: `nakadai/nakadai/model/reference/demo/referenceDemoList`,
referenceFindById: `nakadai/nakadai/model/reference/demo/findById`,
checkIsShowBySystemId: `nakadai/nakadai/model/reference/checkIsShowBySystemId`,
@@ -34,4 +35,6 @@ export default {
exportLabReport: `occupationlab/occupationlab/achievement/exportLabReport`,
reportDetail: `occupationlab/occupationlab/achievement/reportDetail`,
getCompetition: `competition/competition/management/getCompetition`,
+ whetherCanPaste: `nakadai/nakadai/model/demo/whetherCanPaste`,
+ displayListOrNotByStudent: `nakadai/nakadai/model/demo/displayListOrNotByStudent`,
}
\ No newline at end of file
diff --git a/src/components/TestPanel.vue b/src/components/TestPanel.vue
index 3144fb7..3717328 100644
--- a/src/components/TestPanel.vue
+++ b/src/components/TestPanel.vue
@@ -1,29 +1,30 @@
-
-
-
+
+
+
@@ -56,7 +64,8 @@
实验目标
@@ -145,7 +179,7 @@ import 'quill/dist/quill.core.css';
import 'quill/dist/quill.snow.css';
import 'quill/dist/quill.bubble.css';
export default {
- data() {
+ data () {
return {
token: Cookie.get('admin-token'),
systemId: Cookie.get('admin-systemId') || 1,
@@ -189,13 +223,13 @@ export default {
reportId: ''
};
},
- mounted() {
+ mounted () {
// 2:竞赛,1:考核,0:练习
this.projectPermissions = this.assessmentId ?
1 :
this.competitionId ?
2 :
- 0
+ 0
if (this.assessmentId) { // 考核(考核才会从外面带进来assessmentId,练习是默认显示第一个项目,竞赛会带进来competitionId)
this.getAssList()
} else { // 练习
@@ -208,7 +242,7 @@ export default {
} else {
this.getCache()
}
- }).catch(res => {})
+ }).catch(res => { })
if (this.competitionId) {
clearInterval(this.statusTimer)
this.statusTimer = setInterval(_ => {
@@ -220,14 +254,14 @@ export default {
},
methods: {
// 获取项目列表
- getList(){
+ getList () {
let data = {
systemId: this.systemId,
cId: this.courseId, // 课程id
permissions: this.projectPermissions // 练习/考核/竞赛
}
return new Promise((resolve, reject) => {
- this.$get(`${this.api.queryTestProject}`,data).then(res => {
+ this.$get(`${this.api.queryTestProject}`, data).then(res => {
const list = res.projects
this.projectList = list
if (!this.projectPermissions && !this.projectId) this.projectId = list ? list[0].projectId : 0 // 默认取第一个项目
@@ -242,7 +276,7 @@ export default {
})
},
// 获取项目详情
- getProDetail() {
+ getProDetail () {
const projectId = this.projectId
return new Promise((resolve, reject) => {
this.$get(this.api.getProjectDetail, {
@@ -251,6 +285,7 @@ export default {
}).then(res => {
const points = res.projectJudgmentVos
const project = res.projectManage
+ const mg = res.projectManage
const curReq = []
// 跳转银行
if (project.systemId == 11) {
@@ -264,8 +299,8 @@ export default {
points.map((e, i) => {
e.code = '' // 后端返回的字段没有code,要手动加上以存储运行的代码
e.codeId = '' // 代码通过接口传给后端运行后,接口会返回一个codeId,提交的时候需要传这个codeId
- e.answer = '' // 代码运行结果
- e.retResult = '' // 返回结果(1为正确 0为错误)
+ e.answer = '' // 代码运行结果
+ e.retResult = '' // 返回结果(1为正确 0为错误)
curReq.push(e.judgmentId)
})
if (this.projectPermissions) {
@@ -284,7 +319,7 @@ export default {
this.experimentTarget = project.experimentTarget
this.experimentDescription = project.experimentDescription
this.experimentHint = project.experimentHint
- this.hintOpen = !res.projectManage.hintOpen // 0显示,1不显示
+ this.hintOpen = mg.founder ? !mg.hintOpenBySchool : !mg.hintOpen // 0显示,1不显示
this.$emit('tell', projectId, systemId, this.points)
const isPrac = this.projectPermissions == 0 // 是否是练习
this.text = isPrac ? '已用' : '剩余'
@@ -300,12 +335,12 @@ export default {
})
},
// 关闭父页面的loading,并置加载完成状态为true
- closeLoad() {
+ closeLoad () {
this.$parent.loadIns.close()
this.$parent.loaded = true
},
// 获取考核列表来查询该考核是否已经考过
- getAssList(){
+ getAssList () {
this.$post(`${this.api.pageStuAssessment}`, {
pageNum: 1,
pageSize: 10000
@@ -314,7 +349,7 @@ export default {
const assessmentId = this.assessmentId
let done = false
const classId = this.classId
- // 匹配到该考核,并且已经提交过(有reportId则说明有实验记录),并且classId跟当前用户的classId相同,就提示提交了考核然后返回上一页
+ // 匹配到该考核,并且已经提交过(有reportId则说明有实验记录),并且classId跟当前用户的classId相同,就提示提交了考核然后返回上一页
if (list.find(e => e.assessmentId == assessmentId && e.reportId && e.classId == classId)) {
done = true
this.isSubmit = true
@@ -328,16 +363,16 @@ export default {
if (!done) {
this.getList().then(() => {
this.getCache()
- }).catch(res => {})
+ }).catch(res => { })
// 查询考核状态定时器
this.statusTimer = setInterval(_ => {
this.getAssStatus()
}, 1000)
}
- }).catch(res => {})
+ }).catch(res => { })
},
// 获取上次缓存记录
- getCache(cache) {
+ getCache (cache) {
const pId = cache ? cache.projectId : ''
const projectId = Number(pId || this.projectId)
const cid = this.courseId
@@ -373,7 +408,7 @@ export default {
let hasCache = 0 // 是否有缓存
points.map((e, i) => {
const judgmentId = e.judgmentId
- promiseList.push(new Promise((resolve,reject) => {
+ promiseList.push(new Promise((resolve, reject) => {
this.$post(this.api.getLastCache, {
assessmentId: assessmentId ? Number(assessmentId) : '',
bcId: judgmentId,
@@ -413,7 +448,7 @@ export default {
})
this.$emit('tell', projectId, this.curSystemId, this.points)
this.$emit('recoveryCode', newJudgmentId + '') // 切换为缓存的判分点,tab索引值要为字符串
- }).catch(res => {})
+ }).catch(res => { })
} else {
this.points.map(e => {
const item = points.find(n => n.judgmentId === e.judgmentId)
@@ -432,14 +467,14 @@ export default {
bcId: e.judgmentId,
projectId,
cid
- }).then(res => {}).catch(() => {})
+ }).then(res => { }).catch(() => { })
})
})
})
}
},
// 定时查询考核状态(查到考核如果结束后,直接提交考核)
- getAssStatus() {
+ getAssStatus () {
// 未提交才需要查询状态
this.isSubmit || this.$get(this.api.getDetailById, {
id: this.assessmentId
@@ -453,10 +488,10 @@ export default {
})
this.submit()
}
- }).catch(res => {})
+ }).catch(res => { })
},
// 定时查询竞赛状态(查到竞赛如果结束后,直接提交竞赛)
- getCompetitionStatus() {
+ getCompetitionStatus () {
// 未提交才需要查询状态
this.isSubmit || this.$post(`${this.api.getCompetition}?competitionId=${this.competitionId}`).then(({ competition }) => {
const stages = competition.competitionStage
@@ -475,14 +510,14 @@ export default {
this.counter((endTime - now) / 1000)
}
}
- }).catch(res => {})
+ }).catch(res => { })
},
// 项目选择回调
- selectProject(){
+ selectProject () {
this.isSelected = true
this.getProDetail().then(() => {
this.getCache()
- }).catch(res => {})
+ }).catch(res => { })
this.isSubmit = false
this.countVal = 0
this.grade = '00'
@@ -491,11 +526,11 @@ export default {
newmain.$emit('isSubmit', this.isSubmit) // 选择项目后把提交状态重置为未提交
},
// 查看实验报告
- toReport() {
+ toReport () {
this.$router.push(`/report?reportId=${this.reportId}`)
},
//重新开始
- reload() {
+ reload () {
this.reloadCount()
this.grade = '00'
localStorage.removeItem('codeCache')
@@ -514,10 +549,10 @@ export default {
this.startCount()
},
// 提交询问
- confirmSubmit() {
+ confirmSubmit () {
const pointList = this.$parent.workbench
let msg = '此操作将视为结束考试,是否继续?'
- if(pointList.find(e => !e.codeId && e.code)) msg = '有代码没有运行,该代码将不得分,确定提交?'
+ if (pointList.find(e => !e.codeId && e.code)) msg = '有代码没有运行,该代码将不得分,确定提交?'
this.$confirm(msg, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
@@ -534,14 +569,14 @@ export default {
}).then(({ codeId }) => {
this.$parent.workbench[0].codeId = codeId
this.submit()
- }).catch(err => {})
+ }).catch(err => { })
} else {
this.submit()
}
- }).catch(() => {})
+ }).catch(() => { })
},
// 提交
- submit() {
+ submit () {
if (this.isSubmit) return false
const pointList = this.$parent.workbench
const date = new Date()
@@ -612,10 +647,10 @@ export default {
this.$parent.back()
}
})
- }).catch(err => {})
+ }).catch(err => { })
},
// 编辑实验报告
- editReport(reportId) {
+ editReport (reportId) {
const data = []
const ans = []
const promises = []
@@ -647,20 +682,20 @@ export default {
this.$post(this.api.editExperimentalData, {
reportId,
data: JSON.stringify(data)
- }).then(res => {}).catch(err => {})
+ }).then(res => { }).catch(err => { })
})
},
// 实验面板显示隐藏
- togglePannel() {
+ togglePannel () {
document.querySelector('#panel').style.left = 0
this.pannelVisible = !this.pannelVisible
},
// 倒计时
- timeFormat(param) {
+ timeFormat (param) {
return param < 10 ? '0' + param : param
},
// 清除时间
- reloadCount() {
+ reloadCount () {
clearInterval(this.counterTimer)
this.countVal = ''
this.day = '00'
@@ -669,7 +704,7 @@ export default {
this.hour = '00'
},
// 计时器(考核是倒计时,练习是计时)
- counter(counterTime) {
+ counter (counterTime) {
let leave1 = counterTime % (24 * 3600) //计算天数后剩余的毫秒数
let leave2 = leave1 % 3600 //计算小时数后剩余的毫秒数
let leave3 = leave2 % 60 //计算分钟数后剩余的毫秒数
@@ -687,25 +722,24 @@ export default {
this.seconds = seconds
},
// 启动倒计时
- startCount() {
+ startCount () {
clearInterval(this.counterTimer)
this.counterTimer = setInterval(() => {
this.counter(this.projectPermissions ? this.countVal-- : this.countVal++)
}, 1000)
},
// 拖拽面板
- drag() {
+ drag () {
const el = document.querySelector('#panel')
let gap = 10 // 缝隙:小于缝隙时,则吸附
let parent = document.body
- el.onmousedown = e => {
+ document.querySelector('#header').onmousedown = e => {
var x = e.clientX - el.offsetLeft
var y = e.clientY - el.offsetTop
var left = 0
var top = 0
-
- var boxer = document.querySelector(".boxer")
- document.onmousemove = function(eve) {
+
+ document.onmousemove = function (eve) {
left = eve.clientX - x
top = eve.clientY - y
// 左
@@ -786,7 +820,7 @@ export default {
}
/deep/.des {
font-size: 16px;
- font-family: "Microsoft YaHei";
+ font-family: 'Microsoft YaHei';
img {
max-width: 100%;
}
@@ -836,8 +870,8 @@ export default {
color: #333;
background-color: #fff;
}
-.el-aside /deep/[class*=" el-icon-"],
-[class^="el-icon-"] {
+.el-aside /deep/[class*=' el-icon-'],
+[class^='el-icon-'] {
line-height: 40px;
font-size: 16px;
}
@@ -856,10 +890,13 @@ export default {
&.system4 {
background-size: 100% 58px;
}
- &.system5, &.system7, &.system9 {
+ &.system5,
+ &.system7,
+ &.system9 {
background-size: 100% 40px;
}
- &.system8, &.system6 {
+ &.system8,
+ &.system6 {
background-size: 100% 61px;
}
&.system10 {
@@ -902,7 +939,7 @@ export default {
}
/deep/.select {
.el-select__caret:before {
- content: "\e78f";
+ content: '\e78f';
padding: 3px;
font-size: 16px;
color: #fff;
@@ -971,7 +1008,7 @@ export default {
color: #bfbfbf;
cursor: pointer;
&:hover {
- opacity: .9;
+ opacity: 0.9;
}
}
\ No newline at end of file
diff --git a/src/components/codemirror.vue b/src/components/codemirror.vue
index 81e917f..88fa4be 100644
--- a/src/components/codemirror.vue
+++ b/src/components/codemirror.vue
@@ -1,83 +1,101 @@
-
-
+
+
-
- 导入模型
- 运行
+
+ 导入模型
+ 运行
{{ runResult }}
-
-
-
+
-
-
运行成功
-
导出结果
+
+
运行成功
+
导出结果
-
-
+
+
第{{errLine}}行出现错误
-
提示
-
+ 提示
+
-
+
-
+
-
+
-
+
-
@@ -133,7 +151,7 @@ import config from '@/config'
const CANCEL_TOKEN = axios.CancelToken // 用于input中中断请求
export default {
props: ['judgmentId', 'code', 'codeId', 'projectId', 'systemId', 'retResult', 'modelIsShow'],
- data() {
+ data () {
return {
token: Cookie.get('admin-token'),
assessmentId: Cookie.get('admin-assessmentId'), // 考核id
@@ -189,11 +207,11 @@ export default {
codemirror
},
watch: {
- codeVal(val) {
+ codeVal (val) {
this.$emit("update:code", val)
}
},
- mounted() {
+ mounted () {
if (!this.assessmentId) this.showTips = true
//兄弟组件传值
newmain.$on("isSubmit", isSubmit => {
@@ -204,16 +222,24 @@ export default {
methods: {
// 页面加载完后重置编辑框大小
- ready() {
+ ready () {
const code = this.$refs.codemirror.codemirror
code.setSize("auto", "calc(100vh - 167px)");
- code.on('keypress', function() {
+
+ // 查询粘贴状态
+ this.$post(`${this.api.whetherCanPaste}?systemId=${this.systemId}`).then(res => {
+ // 监听改变前的钩子,禁止粘贴(从学生端进入,并且老师端禁用了粘贴功能)
+ res.data == 'false' && !this.fromManager && code.on('beforeChange', (istance, change) => {
+ change.origin === 'paste' && change.cancel()
+ })
+ }).catch(err => { })
+ code.on('keypress', function () {
// 显示智能提示
code.showHint()
});
},
// 清屏
- clearCode() {
+ clearCode () {
this.codeVal = ''
this.isError = ''
this.runResult = ''
@@ -222,46 +248,47 @@ export default {
this.$emit('update:retResult', '') // 更新返回结果
},
// 导入模型
- importModel() {
+ importModel () {
this.modelLoading = true
this.modelVisible = true
// 查询源模型分类
- this.$post(`${this.api.modelClassList}?systemId=${this.systemId}`).then(res => {
- const { data } = res
+ this.$post(`${this.api.modelClassList}?systemId=${this.systemId}&founder=1`).then(({ data }) => {
const promises = []
const addType = list => {
- list.map(e => {
- e.disabled = true
- // 用promise储存以添加完后更新数据
- promises.push(new Promise((resolve,reject) => {
- this.$post(this.api.referenceDemoList, {
- pageNum: 1,
- pageSize: 10000,
- categoryId: e.id
- }).then(res => {
- let { records } = res.data
- records = records.filter(e => !e.isOpen) // 禁用的不显示
- records.map(n => {
- n.categoryName = n.modelName
- })
- e.children = [...e.children, ...records]
- resolve()
- }).catch(res => {
- reject()
+ list.map(e => {
+ e.disabled = true
+ // 用promise储存以添加完后更新数据
+ promises.push(new Promise((resolve, reject) => {
+ this.$post(this.api.studentModelList, {
+ categoryId: e.id,
+ pageNum: 1,
+ pageSize: 10000,
+ systemId: +this.systemId,
+ founder: 1
+ }).then(({ data }) => {
+ let { records } = data
+ records = records.filter(e => !e.isOpen) // 禁用的不显示
+ records.map(n => {
+ n.categoryName = n.modelName
})
- }))
- e.children && e.children.length && addType(e.children)
- })
- }
- addType(data)
- Promise.all(promises).then(_ => {
- this.modelData = data
- this.modelLoading = false
- }).catch(res => {})
- }).catch(res => {})
+ e.children = [...e.children, ...records]
+ resolve()
+ }).catch(res => {
+ reject()
+ })
+ }))
+ e.children && e.children.length && addType(e.children)
+ })
+ }
+ addType(data)
+ Promise.all(promises).then(_ => {
+ this.modelData = data
+ this.modelLoading = false
+ }).catch(res => { })
+ }).catch(res => { })
},
// 多选框选择回调
- treeCheckChange(data, checked, indeterminate) {
+ treeCheckChange (data, checked, indeterminate) {
const checkKey = this.$refs.tree.getCheckedKeys()
// 这里要求单选,所以把多选框改成单选,选择了一个节点后把之前选的都给取消选择,再选中刚勾选的
if (checkKey.length > 1 && checked) {
@@ -270,7 +297,7 @@ export default {
}
},
// 导入模型提交
- submit() {
+ submit () {
if (this.modelImporting) return false
const id = this.$refs.tree.getCheckedKeys()
if (!id.length) return this.$message.error('请选择模型!')
@@ -286,7 +313,7 @@ export default {
this.modelImporting = false
}, 2000)
})
- }).catch(res => {})
+ }).catch(res => { })
},
/**
* python代码里如果有input函数的话,是做了单独的处理的,原理是先把所有input函数都替换成exit函数,再在exit函数里加上特定标识,再通过接口传给后端去执行
@@ -294,7 +321,7 @@ export default {
* 然后就可以通过这个返回的值来提示给用户,让用户继续输入
* 下面这个函数就是递归执行这个input输入过程的函数
*/
- confirmInput(msg){
+ confirmInput (msg) {
const receiveResult = msg.replace('validing:', '')
this.runResult += receiveResult
this.$prompt(receiveResult, '提示', {
@@ -302,14 +329,14 @@ export default {
}).then(({ value }) => {
this.runResult += `${value}\n`
// 把exit函数替换成用户输入的值
- this.sourceCode = this.sourceCode.replace(`exit('validing:${receiveResult.replace(/[\r\n]*/g,'')}')`, _ => {
+ this.sourceCode = this.sourceCode.replace(`exit('validing:${receiveResult.replace(/[\r\n]*/g, '')}')`, _ => {
return `'${value}'`
})
- this.sourceCode = this.sourceCode.replace(`exit("validing:${receiveResult.replace(/[\r\n]*/g,'')}")`, _ => {
+ this.sourceCode = this.sourceCode.replace(`exit("validing:${receiveResult.replace(/[\r\n]*/g, '')}")`, _ => {
return `'${value}'`
})
clearTimeout(this.requestTimer)
-
+
// 一秒钟后还没请求成功的话,就直接中断请求,因为一般是陷入死循环了才会需要这么长时间的,中断了后就再次执行AnswerTips(运行按钮的执行函数)函数,再次进入循环
this.requestTimer = setTimeout(() => {
this.requestList.map(n => n('interrupt'))
@@ -338,7 +365,7 @@ export default {
} else if (result.includes('validing:')) {
this.isError = 1
this.confirmInput(result)
- } else if(data.retResult) {
+ } else if (data.retResult) {
this.isError = 1
this.runResult += result
}
@@ -346,16 +373,16 @@ export default {
this.$emit('update:answer', this.runResult) // 更新运行结果
this.$emit('update:retResult', data.retResult) // 更新返回结果
}).catch(e => {
- if(e && e.message == 'interrupt'){
+ if (e && e.message == 'interrupt') {
this.runCode(true)
this.requestList = []
}
})
- }).catch(err => {})
+ }).catch(err => { })
},
// 运行代码
- runCode(isWhile) { // isWhile为true表示代码里有while循环,右边的运行结果需要拼接展示,而不是直接覆盖
+ runCode (isWhile) { // isWhile为true表示代码里有while循环,右边的运行结果需要拼接展示,而不是直接覆盖
if (!this.isSubmit) {
let code = this.codeVal
if (!code) {
@@ -372,17 +399,17 @@ export default {
// 该正则是验证代码里是否有input,如果有,就要另外做处理,而不是直接传给后端执行
if (inputTextReg.test(code)) {
code = code.replace(inputTextReg, val => {
- return val.replace(/\\n/g,"")
+ return val.replace(/\\n/g, "")
})
this.codeVal = code
// 把input函数替换成exit函数,加上"validing:"作为特定标识,好方便后面的识别
- code = code.replace(inputFuncReg,val => {
+ code = code.replace(inputFuncReg, val => {
return `exit(${val[val.length - 1]}validing:`
})
this.sourceCode = code
- if(!isWhile) this.runResult = ''
+ if (!isWhile) this.runResult = ''
this.$post(this.api.runPythonCode, {
code,
bcId,
@@ -391,7 +418,7 @@ export default {
}).then(res => {
const data = res.code
const result = data.runResult
- if(result.includes('File ')){
+ if (result.includes('File ')) {
if (isWhile) {
this.runResult += result
} else {
@@ -399,7 +426,7 @@ export default {
}
this.errLine = parseInt(result.substring(result.indexOf('line') + 4, result.length))
this.isError = data.retResult
- }else if(result.includes('validing:')){
+ } else if (result.includes('validing:')) {
this.isError = 1
this.confirmInput(result)
}
@@ -439,7 +466,7 @@ export default {
let firtImg = ''
try {
imgList = eval(result)
- } catch (error) {}
+ } catch (error) { }
if (imgList && imgList.length) firtImg = imgList[0]
// 如果是下载图片的代码,则要显示图片和运行结果,不用显示对错,换成显示下载图片
if (photo) {
@@ -453,8 +480,8 @@ export default {
* 这段是为要下载图片的项目案例写的,后端会返回图片名称的数组,前端负责循环这个数组,然后下载下来
* 只有该系统有这段代码,因为其他7个系统没有下载图片的项目,后续如果加了,直接把这段代码复制过去即可
*/
- imgList.map((n,i) => {
- util.downloadFile(`${i+1}.jpg`,n)
+ imgList.map((n, i) => {
+ util.downloadFile(`${i + 1}.jpg`, n)
})
this.isError = 0
this.runResult = '下载完成'
@@ -481,26 +508,26 @@ export default {
}
},
// 下载图片
- downloadPic(i) {
+ downloadPic (i) {
this.$refs['picLink' + i][0].click()
},
// 导出运行结果
- exportResult() {
+ exportResult () {
var FileSaver = require('file-saver');
- var blob = new Blob([this.runResult], {type: "text/plain;charset=utf-8"});
+ var blob = new Blob([this.runResult], { type: "text/plain;charset=utf-8" });
FileSaver.saveAs(blob, 'result.csv')
},
// 获取正式答案
- getTips() {
+ getTips () {
this.tipsVisible = true
this.$get(this.api.queryBcJudgmentByBcId, {
bcId: this.judgmentId
}).then(res => {
this.answer = res.experimentCode
- }).catch(err => {})
+ }).catch(err => { })
},
// 中间拖拽
- dragSide() {
+ dragSide () {
const left = document.querySelector('.left')
const line = document.querySelector('.line')
const right = document.querySelector('.code-right')
@@ -511,9 +538,9 @@ export default {
document.onmousemove = e => {
let x = e.clientX
// 移动区间的范围
- if(x >= width * .1 && x <= width * .9) {
+ if (x >= width * .1 && x <= width * .9) {
line.style.left = x + 'px'
- left.style.width = x +'px'
+ left.style.width = x + 'px'
right.style.width = document.querySelector('.code-wrap').clientWidth - (x + 5) + 'px'
}
}
@@ -531,7 +558,7 @@ export default {
.code-wrap {
position: relative;
}
-.left{
+.left {
position: relative;
width: 60%;
}
@@ -605,7 +632,7 @@ export default {
background-color: #f00;
cursor: pointer;
&:hover {
- opacity: .9;
+ opacity: 0.9;
}
}
/deep/.CodeMirror-wrap pre.CodeMirror-line,
@@ -693,7 +720,7 @@ export default {
margin: 0 auto 10px;
}
}
-.code-mask{
+.code-mask {
z-index: 2;
position: absolute;
top: 0;
@@ -702,28 +729,28 @@ export default {
right: 0;
}
.btns {
- z-index:99;
- position:absolute;
- right: 50px;
- bottom:15px;
+ z-index: 99;
+ position: absolute;
+ right: 50px;
+ bottom: 15px;
display: flex;
}
-.run{
- width:100px;
- color:#fff;
+.run {
+ width: 100px;
+ color: #fff;
}
-.download-btn{
- color:#fff;
+.download-btn {
+ color: #fff;
}
-/deep/.answer-wrap{
+/deep/.answer-wrap {
&.client {
user-select: none;
}
- pre{
+ pre {
width: 100%;
white-space: pre-wrap;
}
- img{
+ img {
max-width: 100%;
}
}
diff --git a/src/config/index.js b/src/config/index.js
index 041f532..ba0bfdc 100644
--- a/src/config/index.js
+++ b/src/config/index.js
@@ -10,9 +10,9 @@ let host = location.origin + '/'
let bankPath = `${location.origin}/banksystem` // 银行系统
// 121.37.12.51 | 192.168.31.151
if (isDev) {
- // host = 'http://192.168.31.51:9000/'
- // host = 'http://192.168.31.116:9000/'
- host = 'http://121.37.12.51:9000/'
+ host = 'http://192.168.31.152:9000/'
+ // host = 'http://192.168.31.53:9000/'
+ // host = 'http://121.37.12.51:9000/'
// host = 'https://occupationlab.com/'
bankPath = `http://${location.hostname}:8093`
} else if (isPro) {
diff --git a/src/views/Data.vue b/src/views/Data.vue
index b67bcdc..bdef6fb 100644
--- a/src/views/Data.vue
+++ b/src/views/Data.vue
@@ -1,131 +1,257 @@
-