Browse Source

提交课程查询

master
陈志鹏 2 years ago
parent
commit
afe2728612
  1. 271
      src/page/coures/coures-info.vue
  2. 50
      src/page/coures/coures.vue

271
src/page/coures/coures-info.vue

@ -14,6 +14,7 @@
<div style="width: 60%;margin-left: 22%"> <div style="width: 60%;margin-left: 22%">
<el-row type="flex" align="top" :gutter="10" class="el-row"> <el-row type="flex" align="top" :gutter="10" class="el-row">
<el-col :span="4" class="text-right"> <el-col :span="4" class="text-right">
<span style="color: red">*</span>
<span class="text-title">课程名称</span> <span class="text-title">课程名称</span>
</el-col> </el-col>
<el-col :span="14" class="text-content"> <el-col :span="14" class="text-content">
@ -29,6 +30,7 @@
</el-row> </el-row>
<el-row type="flex" align="top" :gutter="10" class="el-row"> <el-row type="flex" align="top" :gutter="10" class="el-row">
<el-col :span="4" class="text-right"> <el-col :span="4" class="text-right">
<span style="color: red">*</span>
<span class="text-title">课程类型</span> <span class="text-title">课程类型</span>
</el-col> </el-col>
<el-col :span="14" class="text-content"> <el-col :span="14" class="text-content">
@ -51,14 +53,14 @@
</el-row> </el-row>
<el-row type="flex" align="middle" :gutter="10" class="el-row"> <el-row type="flex" align="middle" :gutter="10" class="el-row">
<el-col :span="4" class="text-right"> <el-col :span="4" class="text-right">
<span class="require-icon">*</span> <span style="color: red">*</span>
<span class="text-title">课程科目</span> <span class="text-title">课程科目</span>
</el-col> </el-col>
<el-col :span="14" class="text-content"> <el-col :span="14" class="text-content">
<el-select <el-select
style="width:100%" style="width:100%"
clearable clearable
v-model="dataForm.subject" v-model="dataForm.subjectId"
placeholder="请选择" placeholder="请选择"
> >
<el-option <el-option
@ -73,13 +75,14 @@
</el-row> </el-row>
<el-row type="flex" align="top" :gutter="10" class="el-row"> <el-row type="flex" align="top" :gutter="10" class="el-row">
<el-col :span="4" class="text-right"> <el-col :span="4" class="text-right">
<span style="color: red">*</span>
<span class="text-title">主讲老师</span> <span class="text-title">主讲老师</span>
</el-col> </el-col>
<el-col :span="14" class="text-content"> <el-col :span="14" class="text-content">
<el-select <el-select
style="width:100%" style="width:100%"
clearable clearable
v-model="dataForm.teacherName" v-model="dataForm.teacherId"
placeholder="请选择" placeholder="请选择"
> >
<el-option <el-option
@ -94,11 +97,12 @@
</el-row> </el-row>
<el-row type="flex" align="top" :gutter="10" class="el-row"> <el-row type="flex" align="top" :gutter="10" class="el-row">
<el-col :span="4" class="text-right"> <el-col :span="4" class="text-right">
<span class="require-icon">*</span> <span style="color: red">*</span>
<span class="text-title">上传封面</span> <span class="text-title">上传封面</span>
</el-col> </el-col>
<el-col :span="14" class="text-content"> <el-col :span="14" class="text-content">
<el-upload <el-upload
v-model="dataForm.imageUrl1"
class="upload-demo" class="upload-demo"
action="https://jsonplaceholder.typicode.com/posts/" action="https://jsonplaceholder.typicode.com/posts/"
:on-preview="handlePreview" :on-preview="handlePreview"
@ -112,11 +116,44 @@
</el-row> </el-row>
<el-row type="flex" align="top" :gutter="10" class="el-row"> <el-row type="flex" align="top" :gutter="10" class="el-row">
<el-col :span="4" class="text-right"> <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> <span class="text-title">课程说明</span>
</el-col> </el-col>
<el-col :span="14" class="text-content"> <el-col :span="14" class="text-content">
<el-input <el-input
v-model="dataForm.intro"
type="textarea" type="textarea"
maxlength="1000" maxlength="1000"
:rows="10" :rows="10"
@ -126,6 +163,12 @@
</el-input> </el-input>
</el-col> </el-col>
</el-row> </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> </div>
</div> </div>
@ -157,59 +200,58 @@
</span> </span>
</template> </template>
</el-table-column> </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"> <template slot-scope="scope">
<el-input <el-input
v-if="scope.row.isEdit" v-if="scope.row.enabled"
v-model="scope.row.inPort" v-model="scope.row.name"
maxlength="20"
placeholder="Required" placeholder="Required"
/> />
<span v-else v-text="scope.row.inIp"></span> <span v-else v-text="scope.row.name"></span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="inPort" label="状态" align="center"> <el-table-column prop="inPort" label="状态" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input <span v-if="scope.row.enabled">发布</span>
v-if="scope.row.isEdit" <span v-else>草稿</span>
v-model="scope.row.inPort"
maxlength="20"
placeholder="Required"
/>
<span v-else v-text="scope.row.inPort"></span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="outPort" label="视频" align="center"> <el-table-column prop="outPort" label="视频" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input <el-upload
v-if="scope.row.isEdit" v-if="scope.row.enabled"
v-model="scope.row.outPort" v-model="scope.row.videoUrl"
maxlength="20" class="upload-demo"
placeholder="Required" action="https://jsonplaceholder.typicode.com/posts/"
/> :on-preview="handlePreview"
<span v-else v-text="scope.row.outPort"></span> :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> </template>
</el-table-column> </el-table-column>
<el-table-column prop="enabled" label="课件" align="center"> <el-table-column prop="enabled" label="课件" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input <el-upload
v-if="scope.row.isEdit" v-if="scope.row.enabled"
v-model="scope.row.inPort" v-model="scope.row.videoUrl"
maxlength="20" class="upload-demo"
placeholder="Required" 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> <span v-else v-text="scope.row.inPort"></span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="enabled" label="随堂练习" align="center"> <el-table-column prop="enabled" label="随堂练习" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input <span v-if="scope.row.enabled" v-text="scope.row.exerciseCollectionId"></span>
v-if="scope.row.isEdit" <span v-else>0</span>
v-model="scope.row.inPort"
maxlength="20"
placeholder="Required"
/>
<span v-else v-text="scope.row.inPort"></span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
@ -442,7 +484,7 @@
</div> </div>
</template> </template>
<script> <script>
import { getRequest } from '../../utils/api' import { getRequest, postRequest } from '../../utils/api'
export default { export default {
data() { data() {
return { return {
@ -459,121 +501,110 @@ export default {
name: '腾讯' name: '腾讯'
} }
], ],
tableData: [ difficultyList: [
{ {
name: '123', id: 0,
inIp: '2222', name: '简单'
inPort: '21', },
outPort: '333', {
enabled: '555' id: 1,
name: '一般'
},
{
id: 2,
name: '难'
} }
], ],
tableData: [
],
CourseStatus: {
DRAFT: '草稿',
UP: '上架',
DOWN: '已下架'
},
internalIpList: [], internalIpList: [],
fileList:[], fileList:[],
teacherList: [],
dataForm: { dataForm: {
id: '',
imageUrl1: '',
subjectId: '',
teacherId: '',
intro: '',
name: '', name: '',
teacherName: '', teacherName: '',
type: this.$route.query.couresName, type: this.$route.query.couresName,
couresName: '', couresName: '',
status: '', status: 'DRAFT',
time: '', difficulty: '',
subjectIdList: [], core1: '1',
teacherList: [] core:''
} }
}; };
}, },
created () { created () {
this.getTypeList() this.getTypeList()
this.getTeacherList() this.getTeacherList()
if(this.$route.query.id !== ''){
this.getCouresId(this.$route.query.id)
this.getReverseShellList()
}
}, },
methods: { methods: {
// //
getReverseShellList() { getCouresId(id){
getShellList().then(res => { getRequest('/edu/v1/pc/course/'+id).then(resp=> {
if (res.code === 200) { if (resp.status === 200) {
if (res.data && res.data.length > 0) { this.dataForm = resp.data.data
// isEditfalse if(this.dataForm.core){
res.data.forEach(item => { this.dataForm.core1 = '1'
item['isEdit'] = false }else{
}) this.dataForm.core1 = '2'
} }
this.tableData = res.data } else {
// //
this.tableData.unshift({ _this.$alert('');
name: '',
inIp: '',
inPort: null,
outPort: null,
enabled: null,
isEdit: true
})
} }
}, resp=> {
});
},
//
getReverseShellList() {
getRequest('/edu/v1/pc/course/'+this.$route.query.id+'/episode').then(res=> {
this.tableData = res.data.data.list
}) })
}, },
// //
handleAdd(row) { 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 // Apply
handleUpdate(row) { 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) { handleDelete(row) {
// },
if (row.isEdit) { createCourse(){
this.getReverseShellList() if(this.dataForm.core1 === '1' ){
} else { this.dataForm.core = true
// }else{
this.$confirm('Are you sure to delete reverse shell?', 'warning', { this.dataForm.core = false
confirmButtonText: 'Sure',
cancelButtonText: 'Cancel',
type: 'warning'
}).then(() => {
deleteShell(row.name).then(res => {
if (res.code === 200) {
this.msgSuccess('Delete reverse shell successfully')
this.getReverseShellList()
} }
}) postRequest('/edu/v1/mp/course', JSON.stringify(this.dataForm)).then(resp=> {
}).catch(() => { _this.loading = false;
}) if (resp.status === 200) {
_this.$alert('保存成功');
this.$router.push({
path: "/coures",
query: {
} }
});
} else {
//
_this.$alert('');
}
}, resp=> {
});
}, },
getTeacherList: function () { getTeacherList: function () {
var _this = this; var _this = this;
this.loading = true; this.loading = true;

50
src/page/coures/coures.vue

@ -101,8 +101,8 @@
</el-form> </el-form>
</div> </div>
<div> <div>
<el-table :data="dataList" border> <el-table :data="dataList" max-height="800">
<el-table-column label="序号" fixed <el-table-column label="序号"
header-align="center" align="center" width="50"> header-align="center" align="center" width="50">
<template slot-scope="scope"> <template slot-scope="scope">
<span> <span>
@ -110,7 +110,7 @@
</span> </span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="name" label="课程名称" fixed <el-table-column prop="name" label="课程名称"
header-align="center" align="left" width="200"> header-align="center" align="left" width="200">
<template slot-scope="scope"> <template slot-scope="scope">
<div> <div>
@ -147,44 +147,44 @@
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="type" label="类型" fixed <el-table-column prop="type" label="类型"
header-align="center" align="center" width="150"> header-align="center" align="center" width="150">
<template slot-scope="scope"> <template slot-scope="scope">
<b>{{scope.row.type}}</b> <b>{{scope.row.type}}</b>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="teacherName" label="讲师" fixed <el-table-column prop="teacherName" label="讲师"
header-align="center" align="center" width="120"> header-align="center" align="center" width="120">
<template slot-scope="scope"> <template slot-scope="scope">
<b>{{scope.row.teacherName}}</b> <b>{{scope.row.teacherName}}</b>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="subscribedCount" label="报名人数" fixed <el-table-column prop="subscribedCount" label="报名人数"
header-align="center" align="center" width="120"> header-align="center" align="center" width="120">
<template slot-scope="scope"> <template slot-scope="scope">
<b v-if="scope.row.subscribedCount !== null">{{scope.row.subscribedCount}}</b> <b v-if="scope.row.subscribedCount !== null">{{scope.row.subscribedCount}}</b>
<b v-else>0</b> <b v-else>0</b>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="createdBy" label="创建人" fixed <el-table-column prop="createdBy" label="创建人"
header-align="center" align="center" width="150"> header-align="center" align="center" width="150">
<template slot-scope="scope"> <template slot-scope="scope">
<b>{{scope.row.createdBy}}</b> <b>{{scope.row.createdBy}}</b>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="creationTime" label="创建时间" fixed <el-table-column prop="creationTime" label="创建时间"
header-align="center" align="center" width="200"> header-align="center" align="center" width="200">
<template slot-scope="scope"> <template slot-scope="scope">
<b>{{scope.row.creationTime.toString().substr(0,10)}}</b> <b>{{scope.row.creationTime.toString().substr(0,10)}}</b>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="updateTime" label="上次更新时间" fixed <el-table-column prop="updateTime" label="上次更新时间"
header-align="center" align="center" width="200"> header-align="center" align="center" width="200">
<template slot-scope="scope"> <template slot-scope="scope">
<b>{{scope.row.updateTime.toString().substr(0,10)}}</b> <b>{{scope.row.updateTime.toString().substr(0,10)}}</b>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="status" label="状态" fixed <el-table-column prop="status" label="状态"
header-align="center" align="center" width="200"> header-align="center" align="center" width="200">
<template slot-scope="scope"> <template slot-scope="scope">
<b v-if="scope.row.status==='DRAFT'">草稿</b> <b v-if="scope.row.status==='DRAFT'">草稿</b>
@ -210,6 +210,14 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-pagination
:current-page="page"
layout="total, sizes, prev, pager, next, jumper"
:page-size="limit"
:page-sizes="pageSizes"
:total="total"
@current-change="pageCurrentChangeHandle"
@size-change="pageSizeChangeHandle"/>
</div> </div>
</el-card> </el-card>
</div> </div>
@ -219,6 +227,10 @@ import { postRequest,getRequest } from '../../utils/api'
export default { export default {
data () { data () {
return { return {
page: 1, //
limit: 10, //
total: 0, //
pageSizes: [10, 50, 100, 500, 1000], //
activeName: 'first', activeName: 'first',
dataForm: { dataForm: {
name: '', name: '',
@ -284,6 +296,15 @@ export default {
mounted () { mounted () {
}, },
methods: { methods: {
pageCurrentChangeHandle (val) {
this.page = val
this.submitClick()
},
pageSizeChangeHandle (val) {
this.page = 1
this.limit = val
this.submitClick()
},
submitClickType: function (item) { submitClickType: function (item) {
var _this = this; var _this = this;
this.loading = true; this.loading = true;
@ -320,12 +341,16 @@ export default {
startTime: startTime, startTime: startTime,
endTime: endTime endTime: endTime
}, },
pagination: {pageNo: 1,pageSize: 10} pagination: {
pageNo: this.page,
pageSize: this.limit
}
} }
postRequest('/edu/v1/pc/course3', JSON.stringify(filter)).then(resp=> { postRequest('/edu/v1/pc/course3', JSON.stringify(filter)).then(resp=> {
_this.loading = false; _this.loading = false;
if (resp.status === 200) { if (resp.status === 200) {
this.dataList = resp.data.data.list this.dataList = resp.data.data.list
this.total = resp.data.data.size
} else { } else {
// //
_this.$alert(''); _this.$alert('');
@ -381,7 +406,8 @@ export default {
this.$router.push({ this.$router.push({
path: "/coures-info", path: "/coures-info",
query: { query: {
couresName: row.type couresName: row.type,
id: row.id
} }
}); });
}, },

Loading…
Cancel
Save