diff --git a/src/assets/img/yes.png b/src/assets/img/yes.png
new file mode 100644
index 0000000..6b9df11
Binary files /dev/null and b/src/assets/img/yes.png differ
diff --git a/src/components/codemirror.vue b/src/components/codemirror.vue
index 95790ce..e7fb26a 100644
--- a/src/components/codemirror.vue
+++ b/src/components/codemirror.vue
@@ -28,19 +28,11 @@
-
+
运行成功
第{{errLine}}行出现错误
-
提示
-
-
-
-
-
-
-
@@ -89,19 +81,17 @@ import "codemirror/theme/monokai.css";
import "codemirror/theme/base16-light.css";
import { Loading } from 'element-ui';
export default {
- props: ['code', 'codeId', 'projectId', 'retResult'],
+ props: ['code', 'codeId', 'projectId', 'retResult', 'readOnly'],
data() {
return {
- showTips: false, // 显示隐藏提示按钮
- answer: '', // 正确答案
codeVal: this.code,
runResult: '', // 运行结果
isError: false, // 运行正确与否
errLine: '', // 错误代码的位置
- tipsVisible: false, // 答案提示弹框显示标识
picSrcList: [],
loadIns: null, // loading实例
cmOption: {
+ readOnly: this.readOnly,
scrollbarStyle: "native",
tabSize: 2, // tab
styleActiveLine: true, // 高亮选中行
@@ -139,7 +129,6 @@ export default {
mounted() {
},
-
methods: {
// 页面加载完后重置编辑框大小
ready() {
@@ -159,22 +148,12 @@ export default {
type: "warning"
})
} else {
- const bcId = this.judgmentId
- const cid = this.courseId
- const projectId = this.projectId
this.loadIns = Loading.service({
background: 'transparent'
})
- // 如果代码有savefig(python里的保存图片的方法),则要把savefig里的图片名字加上个时间戳,防止后台保存图片到服务器的时候图片名字重复导致覆盖
- code = code.replace(/\.savefig\(([\u4e00-\u9fa5\w]*?['"])/mg, str => {
- return str + Date.now()
- })
// 把代码传给后端,在后端运行Python代码
this.$post(this.api.runPythonCode, {
- code,
- bcId,
- cid,
- projectId
+ code
}).then(res => {
const data = res.code
const photo = data.photoUrl
@@ -183,9 +162,6 @@ export default {
this.loadIns.close()
this.picSrcList = []
if (photo) this.picSrcList = photo.split(',')
- this.$emit('update:codeId', res.codeId) // 更新coddeId
- this.$emit('update:answer', result) // 更新运行结果
- this.$emit('update:retResult', data.retResult) // 更新返回结果
let imgList = ''
let firtImg = ''
try {
@@ -222,15 +198,6 @@ export default {
// 下载图片
downloadPic(i) {
this.$refs['picLink' + i][0].click()
- },
- // 获取正式答案
- getTips() {
- this.tipsVisible = true
- this.$get(this.api.queryBcJudgmentByBcId, {
- bcId: this.judgmentId
- }).then(res => {
- this.answer = res.experimentCode
- }).catch(err => {})
}
}
};
@@ -322,8 +289,9 @@ export default {
left: 20px;
right: 20px;
display: flex;
+ align-items: center;
bottom: 10px;
- padding: 0 10px;
+ padding: 5px 10px;
img {
width: 40px;
height: 40px;
diff --git a/src/utils/api.js b/src/utils/api.js
index 37ed966..691bcfc 100644
--- a/src/utils/api.js
+++ b/src/utils/api.js
@@ -103,6 +103,13 @@ export default {
categorySave: `${host}/nakadai/model/category/save`,
sourceModelClassification: `${host}/nakadai/model/category/sourceModelClassification`,
+ bulkDisable: `${host}/nakadai/model/demo/bulkDisable`,
+ deleteSysModelDemo: `${host}/nakadai/model/demo/deleteSysModelDemo`,
+ modelFindById: `${host}/nakadai/model/demo/findById`,
+ saveSysModelDemo: `${host}/nakadai/model/demo/saveSysModelDemo`,
+ sysModelDemoList: `${host}/nakadai/model/demo/sysModelDemoList`,
+ updateSysModelDemo: `${host}/nakadai/model/demo/updateSysModelDemo`,
+ runPythonCode: `${host}/nakadai/model/demo/runPythonCode`,
// 课程管理三级联查
courseDiscipline: `${host}/nakadai/nakadai/subject/courseDiscipline`, //课程学科类别
diff --git a/src/views/serve/addModel.vue b/src/views/serve/addModel.vue
index 8575563..4d997df 100644
--- a/src/views/serve/addModel.vue
+++ b/src/views/serve/addModel.vue
@@ -5,19 +5,25 @@
返回
-
+
+
+
+ 发布
+ 草稿
- 确定
-
+
@@ -31,20 +37,54 @@ export default {
components:{ codemirror },
data() {
return {
- customerId : this.$route.query.id,
+ categoryId : Number(this.$route.query.categoryId),
+ id : Number(this.$route.query.id),
+ postStatus : Number(this.$route.query.postStatus),
isDetail : Boolean(this.$route.query.show),
form: {
-
- }
+ modelName: '',
+ modelDemo: ''
+ },
+ codeKey: 1
};
},
mounted() {
-
+ this.id && this.getData()
},
methods: {
+ // 获取详情
+ getData() {
+ this.$post(`${this.api.modelFindById}?id=${this.id}`).then(res => {
+ const { data } = res
+ this.form.modelName = data.modelName
+ this.form.modelDemo = data.modelDemo
+ this.codeKey++
+ }).catch(res => {})
+ },
// 保存
- submit(){
-
+ submit(postStatus){
+ const { modelName, modelDemo } = this.form
+ const id = this.id
+ if (!modelName) return this.$message.error('请输入模型名称')
+ if (!modelDemo) return this.$message.error('请输入模型代码')
+ const data = {
+ categoryId: this.categoryId,
+ modelName,
+ modelDemo,
+ postStatus
+ }
+ if (id) {
+ data.id = id
+ this.$post(this.api.updateSysModelDemo, data).then(res => {
+ this.$message.success('编辑成功')
+ this.$router.back()
+ }).catch(res => {})
+ } else {
+ this.$post(this.api.saveSysModelDemo, data).then(res => {
+ this.$message.success('新增成功')
+ this.$router.back()
+ }).catch(res => {})
+ }
},
}
};
diff --git a/src/views/serve/backstage/index.vue b/src/views/serve/backstage/index.vue
index ba05a4f..fdf1fa2 100644
--- a/src/views/serve/backstage/index.vue
+++ b/src/views/serve/backstage/index.vue
@@ -15,7 +15,7 @@ import sourceModel from "./sourceModel";
export default {
data() {
return {
- active: "model",
+ active: this.$route.query.type || 'model',
tabs: {
model: "模型列表管理",
sourceModel: "源模型管理"
@@ -32,7 +32,14 @@ export default {
created() {},
methods: {
tabChange(index) {
- this.active = index;
+ this.active = index
+ this.$router.push({
+ path: 'backstage',
+ query: {
+ ...this.$route.query,
+ type: index
+ }
+ })
}
}
};
diff --git a/src/views/serve/backstage/model.vue b/src/views/serve/backstage/model.vue
index 1ad4912..62400b2 100644
--- a/src/views/serve/backstage/model.vue
+++ b/src/views/serve/backstage/model.vue
@@ -1,7 +1,7 @@
-
+
@@ -13,8 +13,8 @@
- 导入模型
- 批量移除
+ 导入模型
+ 批量移除
@@ -27,7 +27,7 @@
查看
- 移除
+ 移除
@@ -36,186 +36,84 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
-
-
-
-
-
- 模板下载
-
-
- 上传文件
-
-
部分数据导入失败,查看失败原因
-
-