|
|
|
@ -14,6 +14,7 @@
@@ -14,6 +14,7 @@
|
|
|
|
|
<div style="width: 60%;margin-left: 22%"> |
|
|
|
|
<el-row type="flex" align="top" :gutter="10" class="el-row"> |
|
|
|
|
<el-col :span="4" class="text-right"> |
|
|
|
|
<span style="color: red">*</span> |
|
|
|
|
<span class="text-title">课程名称:</span> |
|
|
|
|
</el-col> |
|
|
|
|
<el-col :span="14" class="text-content"> |
|
|
|
@ -29,6 +30,7 @@
@@ -29,6 +30,7 @@
|
|
|
|
|
</el-row> |
|
|
|
|
<el-row type="flex" align="top" :gutter="10" class="el-row"> |
|
|
|
|
<el-col :span="4" class="text-right"> |
|
|
|
|
<span style="color: red">*</span> |
|
|
|
|
<span class="text-title">课程类型:</span> |
|
|
|
|
</el-col> |
|
|
|
|
<el-col :span="14" class="text-content"> |
|
|
|
@ -51,14 +53,14 @@
@@ -51,14 +53,14 @@
|
|
|
|
|
</el-row> |
|
|
|
|
<el-row type="flex" align="middle" :gutter="10" class="el-row"> |
|
|
|
|
<el-col :span="4" class="text-right"> |
|
|
|
|
<span class="require-icon">*</span> |
|
|
|
|
<span style="color: red">*</span> |
|
|
|
|
<span class="text-title">课程科目:</span> |
|
|
|
|
</el-col> |
|
|
|
|
<el-col :span="14" class="text-content"> |
|
|
|
|
<el-select |
|
|
|
|
style="width:100%" |
|
|
|
|
clearable |
|
|
|
|
v-model="dataForm.subject" |
|
|
|
|
v-model="dataForm.subjectId" |
|
|
|
|
placeholder="请选择" |
|
|
|
|
> |
|
|
|
|
<el-option |
|
|
|
@ -73,13 +75,14 @@
@@ -73,13 +75,14 @@
|
|
|
|
|
</el-row> |
|
|
|
|
<el-row type="flex" align="top" :gutter="10" class="el-row"> |
|
|
|
|
<el-col :span="4" class="text-right"> |
|
|
|
|
<span style="color: red">*</span> |
|
|
|
|
<span class="text-title">主讲老师:</span> |
|
|
|
|
</el-col> |
|
|
|
|
<el-col :span="14" class="text-content"> |
|
|
|
|
<el-select |
|
|
|
|
style="width:100%" |
|
|
|
|
clearable |
|
|
|
|
v-model="dataForm.teacherName" |
|
|
|
|
v-model="dataForm.teacherId" |
|
|
|
|
placeholder="请选择" |
|
|
|
|
> |
|
|
|
|
<el-option |
|
|
|
@ -94,11 +97,12 @@
@@ -94,11 +97,12 @@
|
|
|
|
|
</el-row> |
|
|
|
|
<el-row type="flex" align="top" :gutter="10" class="el-row"> |
|
|
|
|
<el-col :span="4" class="text-right"> |
|
|
|
|
<span class="require-icon">*</span> |
|
|
|
|
<span style="color: red">*</span> |
|
|
|
|
<span class="text-title">上传封面:</span> |
|
|
|
|
</el-col> |
|
|
|
|
<el-col :span="14" class="text-content"> |
|
|
|
|
<el-upload |
|
|
|
|
v-model="dataForm.imageUrl1" |
|
|
|
|
class="upload-demo" |
|
|
|
|
action="https://jsonplaceholder.typicode.com/posts/" |
|
|
|
|
:on-preview="handlePreview" |
|
|
|
@ -112,11 +116,44 @@
@@ -112,11 +116,44 @@
|
|
|
|
|
</el-row> |
|
|
|
|
<el-row type="flex" align="top" :gutter="10" class="el-row"> |
|
|
|
|
<el-col :span="4" class="text-right"> |
|
|
|
|
<span class="require-icon">*</span> |
|
|
|
|
<span style="color: red">*</span> |
|
|
|
|
<span class="text-title">难易程度:</span> |
|
|
|
|
</el-col> |
|
|
|
|
<el-col :span="14" class="text-content"> |
|
|
|
|
<el-select |
|
|
|
|
style="width:100%" |
|
|
|
|
clearable |
|
|
|
|
v-model="dataForm.difficulty" |
|
|
|
|
placeholder="请选择" |
|
|
|
|
> |
|
|
|
|
<el-option |
|
|
|
|
v-for="item in difficultyList" |
|
|
|
|
:key="item.id" |
|
|
|
|
:label="item.name" |
|
|
|
|
:value="item.id" |
|
|
|
|
> |
|
|
|
|
</el-option> |
|
|
|
|
</el-select> |
|
|
|
|
</el-col> |
|
|
|
|
</el-row> |
|
|
|
|
<el-row type="flex" align="top" :gutter="10" class="el-row"> |
|
|
|
|
<el-col :span="4" class="text-right"> |
|
|
|
|
<span style="color: red">*</span> |
|
|
|
|
<span class="text-title">是否核心课:</span> |
|
|
|
|
</el-col> |
|
|
|
|
<el-col :span="14" class="text-content"> |
|
|
|
|
<el-radio v-model="dataForm.core1" label="1">是</el-radio> |
|
|
|
|
<el-radio v-model="dataForm.core1" label="2">否</el-radio> |
|
|
|
|
</el-col> |
|
|
|
|
</el-row> |
|
|
|
|
<el-row type="flex" align="top" :gutter="10" class="el-row"> |
|
|
|
|
<el-col :span="4" class="text-right"> |
|
|
|
|
<span style="color: red">*</span> |
|
|
|
|
<span class="text-title">课程说明:</span> |
|
|
|
|
</el-col> |
|
|
|
|
<el-col :span="14" class="text-content"> |
|
|
|
|
<el-input |
|
|
|
|
v-model="dataForm.intro" |
|
|
|
|
type="textarea" |
|
|
|
|
maxlength="1000" |
|
|
|
|
:rows="10" |
|
|
|
@ -126,6 +163,12 @@
@@ -126,6 +163,12 @@
|
|
|
|
|
</el-input> |
|
|
|
|
</el-col> |
|
|
|
|
</el-row> |
|
|
|
|
<el-row type="flex" align="top" :gutter="10" class="el-row"> |
|
|
|
|
<el-col :span="22" class="text-content"> |
|
|
|
|
<el-button type="primary" @click="createCourse()">保存</el-button> |
|
|
|
|
<el-button>返回</el-button> |
|
|
|
|
</el-col> |
|
|
|
|
</el-row> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
@ -157,59 +200,58 @@
@@ -157,59 +200,58 @@
|
|
|
|
|
</span> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="inIp" label="章节名称" align="center"> |
|
|
|
|
<el-table-column prop="name" label="章节名称" align="center" width="200"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<el-input |
|
|
|
|
v-if="scope.row.isEdit" |
|
|
|
|
v-model="scope.row.inPort" |
|
|
|
|
maxlength="20" |
|
|
|
|
v-if="scope.row.enabled" |
|
|
|
|
v-model="scope.row.name" |
|
|
|
|
placeholder="Required" |
|
|
|
|
/> |
|
|
|
|
<span v-else v-text="scope.row.inIp"></span> |
|
|
|
|
<span v-else v-text="scope.row.name"></span> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="inPort" label="状态" align="center"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<el-input |
|
|
|
|
v-if="scope.row.isEdit" |
|
|
|
|
v-model="scope.row.inPort" |
|
|
|
|
maxlength="20" |
|
|
|
|
placeholder="Required" |
|
|
|
|
/> |
|
|
|
|
<span v-else v-text="scope.row.inPort"></span> |
|
|
|
|
<span v-if="scope.row.enabled">发布</span> |
|
|
|
|
<span v-else>草稿</span> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="outPort" label="视频" align="center"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<el-input |
|
|
|
|
v-if="scope.row.isEdit" |
|
|
|
|
v-model="scope.row.outPort" |
|
|
|
|
maxlength="20" |
|
|
|
|
placeholder="Required" |
|
|
|
|
/> |
|
|
|
|
<span v-else v-text="scope.row.outPort"></span> |
|
|
|
|
<el-upload |
|
|
|
|
v-if="scope.row.enabled" |
|
|
|
|
v-model="scope.row.videoUrl" |
|
|
|
|
class="upload-demo" |
|
|
|
|
action="https://jsonplaceholder.typicode.com/posts/" |
|
|
|
|
:on-preview="handlePreview" |
|
|
|
|
:on-remove="handleRemove" |
|
|
|
|
:file-list="fileList" |
|
|
|
|
list-type="picture"> |
|
|
|
|
<el-button size="small" type="primary">点击上传</el-button> |
|
|
|
|
</el-upload> |
|
|
|
|
<span v-else v-text="scope.row.videoUrl"></span> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="enabled" label="课件" align="center"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<el-input |
|
|
|
|
v-if="scope.row.isEdit" |
|
|
|
|
v-model="scope.row.inPort" |
|
|
|
|
maxlength="20" |
|
|
|
|
placeholder="Required" |
|
|
|
|
/> |
|
|
|
|
<el-upload |
|
|
|
|
v-if="scope.row.enabled" |
|
|
|
|
v-model="scope.row.videoUrl" |
|
|
|
|
class="upload-demo" |
|
|
|
|
action="https://jsonplaceholder.typicode.com/posts/" |
|
|
|
|
:on-preview="handlePreview" |
|
|
|
|
:on-remove="handleRemove" |
|
|
|
|
:file-list="fileList" |
|
|
|
|
list-type="picture"> |
|
|
|
|
<el-button size="small" type="primary">点击上传</el-button> |
|
|
|
|
</el-upload> |
|
|
|
|
<span v-else v-text="scope.row.inPort"></span> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="enabled" label="随堂练习" align="center"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<el-input |
|
|
|
|
v-if="scope.row.isEdit" |
|
|
|
|
v-model="scope.row.inPort" |
|
|
|
|
maxlength="20" |
|
|
|
|
placeholder="Required" |
|
|
|
|
/> |
|
|
|
|
<span v-else v-text="scope.row.inPort"></span> |
|
|
|
|
<span v-if="scope.row.enabled" v-text="scope.row.exerciseCollectionId"></span> |
|
|
|
|
<span v-else>0</span> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> |
|
|
|
@ -442,7 +484,7 @@
@@ -442,7 +484,7 @@
|
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
<script> |
|
|
|
|
import { getRequest } from '../../utils/api' |
|
|
|
|
import { getRequest, postRequest } from '../../utils/api' |
|
|
|
|
export default { |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
@ -459,121 +501,110 @@ export default {
@@ -459,121 +501,110 @@ export default {
|
|
|
|
|
name: '腾讯' |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
tableData: [ |
|
|
|
|
difficultyList: [ |
|
|
|
|
{ |
|
|
|
|
name: '123', |
|
|
|
|
inIp: '2222', |
|
|
|
|
inPort: '21', |
|
|
|
|
outPort: '333', |
|
|
|
|
enabled: '555' |
|
|
|
|
id: 0, |
|
|
|
|
name: '简单' |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
id: 1, |
|
|
|
|
name: '一般' |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
id: 2, |
|
|
|
|
name: '难' |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
tableData: [ |
|
|
|
|
], |
|
|
|
|
CourseStatus: { |
|
|
|
|
DRAFT: '草稿', |
|
|
|
|
UP: '上架', |
|
|
|
|
DOWN: '已下架' |
|
|
|
|
}, |
|
|
|
|
internalIpList: [], |
|
|
|
|
fileList:[], |
|
|
|
|
teacherList: [], |
|
|
|
|
dataForm: { |
|
|
|
|
id: '', |
|
|
|
|
imageUrl1: '', |
|
|
|
|
subjectId: '', |
|
|
|
|
teacherId: '', |
|
|
|
|
intro: '', |
|
|
|
|
name: '', |
|
|
|
|
teacherName: '', |
|
|
|
|
type: this.$route.query.couresName, |
|
|
|
|
couresName: '', |
|
|
|
|
status: '', |
|
|
|
|
time: '', |
|
|
|
|
subjectIdList: [], |
|
|
|
|
teacherList: [] |
|
|
|
|
status: 'DRAFT', |
|
|
|
|
difficulty: '', |
|
|
|
|
core1: '1', |
|
|
|
|
core:'' |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
created () { |
|
|
|
|
this.getTypeList() |
|
|
|
|
this.getTeacherList() |
|
|
|
|
if(this.$route.query.id !== ''){ |
|
|
|
|
this.getCouresId(this.$route.query.id) |
|
|
|
|
this.getReverseShellList() |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
// 获取列表 |
|
|
|
|
getReverseShellList() { |
|
|
|
|
getShellList().then(res => { |
|
|
|
|
if (res.code === 200) { |
|
|
|
|
if (res.data && res.data.length > 0) { |
|
|
|
|
// 获取到的数据加上 isEdit是false, 默认是文本 |
|
|
|
|
res.data.forEach(item => { |
|
|
|
|
item['isEdit'] = false |
|
|
|
|
}) |
|
|
|
|
//获取详情 |
|
|
|
|
getCouresId(id){ |
|
|
|
|
getRequest('/edu/v1/pc/course/'+id).then(resp=> { |
|
|
|
|
if (resp.status === 200) { |
|
|
|
|
this.dataForm = resp.data.data |
|
|
|
|
if(this.dataForm.core){ |
|
|
|
|
this.dataForm.core1 = '1' |
|
|
|
|
}else{ |
|
|
|
|
this.dataForm.core1 = '2' |
|
|
|
|
} |
|
|
|
|
this.tableData = res.data |
|
|
|
|
// 在表格列表前插入一行,用来新增数据 |
|
|
|
|
this.tableData.unshift({ |
|
|
|
|
name: '', |
|
|
|
|
inIp: '', |
|
|
|
|
inPort: null, |
|
|
|
|
outPort: null, |
|
|
|
|
enabled: null, |
|
|
|
|
isEdit: true |
|
|
|
|
}) |
|
|
|
|
} else { |
|
|
|
|
//失败 |
|
|
|
|
_this.$alert(''); |
|
|
|
|
} |
|
|
|
|
}, resp=> { |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
// 获取列表 |
|
|
|
|
getReverseShellList() { |
|
|
|
|
getRequest('/edu/v1/pc/course/'+this.$route.query.id+'/episode').then(res=> { |
|
|
|
|
this.tableData = res.data.data.list |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
// 新增按钮 |
|
|
|
|
handleAdd(row) { |
|
|
|
|
for (let key in row) { |
|
|
|
|
// 判断一行字段是否输入完整 |
|
|
|
|
if (row[key] === '' || row[key] === null || typeof row[key] === 'undefined') { |
|
|
|
|
this.msgError('Please complete the information') |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
const params = { |
|
|
|
|
name: row.name, |
|
|
|
|
inIp: row.inIp, |
|
|
|
|
inPort: parseInt(row.inPort), |
|
|
|
|
outPort: parseInt(row.outPort), |
|
|
|
|
enabled: row.enabled |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 编辑或者Apply按钮 |
|
|
|
|
handleUpdate(row) { |
|
|
|
|
// 点击Apply时 |
|
|
|
|
if (row.isEdit) { |
|
|
|
|
for (let key in row) { |
|
|
|
|
if (row[key] === '' || row[key] === null || typeof row[key] === 'undefined') { |
|
|
|
|
this.msgError('Please complete the information') |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
const params = { |
|
|
|
|
name: row.name, |
|
|
|
|
inIp: row.inIp, |
|
|
|
|
inPort: parseInt(row.inPort), |
|
|
|
|
outPort: parseInt(row.outPort), |
|
|
|
|
enabled: row.enabled |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
// 点击编辑时 |
|
|
|
|
row.isEdit = true |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 删除或取消按钮 |
|
|
|
|
handleDelete(row) { |
|
|
|
|
// 点击取消时 |
|
|
|
|
if (row.isEdit) { |
|
|
|
|
this.getReverseShellList() |
|
|
|
|
}, |
|
|
|
|
createCourse(){ |
|
|
|
|
if(this.dataForm.core1 === '1' ){ |
|
|
|
|
this.dataForm.core = true |
|
|
|
|
}else{ |
|
|
|
|
// 点击删除时 |
|
|
|
|
this.$confirm('Are you sure to delete reverse shell?', 'warning', { |
|
|
|
|
confirmButtonText: 'Sure', |
|
|
|
|
cancelButtonText: 'Cancel', |
|
|
|
|
type: 'warning' |
|
|
|
|
}).then(() => { |
|
|
|
|
deleteShell(row.name).then(res => { |
|
|
|
|
if (res.code === 200) { |
|
|
|
|
this.msgSuccess('Delete reverse shell successfully') |
|
|
|
|
this.getReverseShellList() |
|
|
|
|
this.dataForm.core = false |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}).catch(() => { |
|
|
|
|
}) |
|
|
|
|
postRequest('/edu/v1/mp/course', JSON.stringify(this.dataForm)).then(resp=> { |
|
|
|
|
_this.loading = false; |
|
|
|
|
if (resp.status === 200) { |
|
|
|
|
_this.$alert('保存成功'); |
|
|
|
|
this.$router.push({ |
|
|
|
|
path: "/coures", |
|
|
|
|
query: { |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
//失败 |
|
|
|
|
_this.$alert(''); |
|
|
|
|
} |
|
|
|
|
}, resp=> { |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getTeacherList: function () { |
|
|
|
|
var _this = this; |
|
|
|
|
this.loading = true; |
|
|
|
|