Browse Source

提交课程查询

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

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

@ -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) {
// isEditfalse
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;

50
src/page/coures/coures.vue

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

Loading…
Cancel
Save