Browse Source

提交课程查询及详情保存

master
陈志鹏 2 years ago
parent
commit
600ec33461
  1. 251
      src/page/coures/coures-info.vue
  2. 34
      src/page/coures/coures.vue
  3. 13
      src/utils/api.js

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

@ -166,7 +166,7 @@ @@ -166,7 +166,7 @@
<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-button @click="close()">返回</el-button>
</el-col>
</el-row>
</div>
@ -203,7 +203,7 @@ @@ -203,7 +203,7 @@
<el-table-column prop="name" label="章节名称" align="center" width="200">
<template slot-scope="scope">
<el-input
v-if="scope.row.enabled"
v-if="!scope.row.enabled"
v-model="scope.row.name"
placeholder="Required"
/>
@ -219,13 +219,13 @@ @@ -219,13 +219,13 @@
<el-table-column prop="outPort" label="视频" align="center">
<template slot-scope="scope">
<el-upload
v-if="scope.row.enabled"
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"
:file-list="zjViedFileList"
list-type="picture">
<el-button size="small" type="primary">点击上传</el-button>
</el-upload>
@ -235,7 +235,7 @@ @@ -235,7 +235,7 @@
<el-table-column prop="enabled" label="课件" align="center">
<template slot-scope="scope">
<el-upload
v-if="scope.row.enabled"
v-if="!scope.row.enabled"
v-model="scope.row.videoUrl"
class="upload-demo"
action="https://jsonplaceholder.typicode.com/posts/"
@ -250,24 +250,26 @@ @@ -250,24 +250,26 @@
</el-table-column>
<el-table-column prop="enabled" label="随堂练习" align="center">
<template slot-scope="scope">
<span v-if="scope.row.enabled" v-text="scope.row.exerciseCollectionId"></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">
<template slot-scope="scope">
<el-button
v-if="scope.row.enabled"
size="mini"
type="text"
style="color: #2090c1"
@click="handleUpdate(scope.row)"
@click="handleSelect(scope.row)"
>查看
</el-button>
<el-button
v-if="!scope.row.enabled"
size="mini"
type="text"
style="color: #2090c1"
@click="handleAdd(scope.row)"
@click="handleUpdate(scope.row)"
>发布
</el-button>
<el-button
@ -288,28 +290,38 @@ @@ -288,28 +290,38 @@
<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">
<el-input
v-model="dataForm.name"
maxlength="25"
:rows="1"
placeholder="最多输入25个字"
show-word-limit
>
</el-input>
<el-date-picker
style="width: 30%"
v-model="dataExtForm1.day"
type="date"
placeholder="选择日期">
</el-date-picker>
<el-time-picker
style="width: 30%"
v-model="dataExtForm1.startTime"
placeholder="开始时间点">
</el-time-picker>
<el-time-picker
arrow-control
v-model="dataExtForm1.endTime"
placeholder="结束时间点">
</el-time-picker>
</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-select
style="width:100%"
clearable
v-model="dataForm.couresName"
v-model="dataExtForm1.expand1"
placeholder="请选择"
>
<el-option
@ -324,12 +336,12 @@ @@ -324,12 +336,12 @@
</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-input
v-model="dataForm.name"
v-model="dataExtForm1.expand3"
maxlength="25"
:rows="1"
placeholder="最多输入25个字"
@ -340,11 +352,12 @@ @@ -340,11 +352,12 @@
</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.name"
v-model="dataExtForm1.expand4"
maxlength="25"
:rows="1"
placeholder="最多输入25个字"
@ -355,7 +368,7 @@ @@ -355,7 +368,7 @@
</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">
@ -365,12 +378,19 @@ @@ -365,12 +378,19 @@
:on-preview="handlePreview"
:on-remove="handleRemove"
:file-list="fileList"
v-model="dataExtForm1.expand5"
list-type="picture">
<el-button size="small" type="primary">点击上传</el-button>
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件且不超过500kb</div>
</el-upload>
</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="createCourseExt1()">保存</el-button>
<el-button @click="close()">返回</el-button>
</el-col>
</el-row>
</div>
</div>
</div>
@ -379,11 +399,12 @@ @@ -379,11 +399,12 @@
<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">
<el-input
v-model="dataForm.name"
v-model="dataExtForm.expand1"
maxlength="25"
:rows="1"
placeholder="最多输入25个字"
@ -394,30 +415,40 @@ @@ -394,30 +415,40 @@
</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-input
v-model="dataForm.name"
maxlength="25"
:rows="1"
placeholder="最多输入25个字"
show-word-limit
>
</el-input>
<el-date-picker
style="width: 30%"
v-model="dataExtForm.day"
type="date"
placeholder="选择日期">
</el-date-picker>
<el-time-picker
style="width: 30%"
v-model="dataExtForm.startTime"
placeholder="开始时间点">
</el-time-picker>
<el-time-picker
arrow-control
v-model="dataExtForm.endTime"
placeholder="结束时间点">
</el-time-picker>
</el-col>
</el-row>
<el-row type="flex" align="top" :gutter="10" class="el-row">
<el-col :span="4" class="text-right">
<span class="text-title">直播间密码</span>
<span style="color: red">*</span>
<span class="text-title">备注</span>
</el-col>
<el-col :span="14" class="text-content">
<el-input
v-model="dataForm.name"
maxlength="25"
:rows="1"
placeholder="最多输入25个字"
type="textarea"
v-model="dataExtForm.expand3"
maxlength="100"
:rows="4"
placeholder="最多输入100个字"
show-word-limit
>
</el-input>
@ -425,12 +456,13 @@ @@ -425,12 +456,13 @@
</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
class="upload-demo"
v-model="dataExtForm.expand5"
action="https://jsonplaceholder.typicode.com/posts/"
:on-preview="handlePreview"
:on-remove="handleRemove"
@ -441,6 +473,12 @@ @@ -441,6 +473,12 @@
</el-upload>
</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="createCourseExt()">保存</el-button>
<el-button @click="close()">返回</el-button>
</el-col>
</el-row>
</div>
</div>
</div>
@ -450,13 +488,13 @@ @@ -450,13 +488,13 @@
<el-form :inline="true">
<el-form-item>
<el-button type="primary"
@click="addCourse()">导出
@click="daoChu()">导出
</el-button>
</el-form-item>
</el-form>
</div>
<div>
<el-table :data="dataList" border>
<el-table :data="dataList" border class="table">
<el-table-column label="序号" fixed
header-align="center" align="center" width="50">
<template slot-scope="scope">
@ -468,7 +506,7 @@ @@ -468,7 +506,7 @@
<el-table-column prop="name" label="学员姓名" fixed
header-align="center" align="center" width="160">
</el-table-column>
<el-table-column prop="type" label="学员手机号" fixed
<el-table-column prop="phone" label="学员手机号" fixed
header-align="center" align="center" width="150">
</el-table-column>
<el-table-column prop="intro" label="完成率" fixed
@ -484,13 +522,14 @@ @@ -484,13 +522,14 @@
</div>
</template>
<script>
import { getRequest, postRequest } from '../../utils/api'
import { getRequest, postRequest, deleteRequest } from '../../utils/api'
export default {
data() {
return {
activeName: 'first',
active: 1,
subjectList: [],
dataList: [],
typeList: [
{
id: '1',
@ -524,7 +563,28 @@ export default { @@ -524,7 +563,28 @@ export default {
},
internalIpList: [],
fileList:[],
zjViedFileList: [],
teacherList: [],
dataExtForm: {
expand1: '',
expand2: '',
expand3: '',
expand4: '',
expand5: '',
day: '',
startTime: '',
endTime: ''
},
dataExtForm1: {
expand1: '',
expand2: '',
expand3: '',
expand4: '',
expand5: '',
day: '',
startTime: '',
endTime: ''
},
dataForm: {
id: '',
imageUrl1: '',
@ -548,9 +608,13 @@ export default { @@ -548,9 +608,13 @@ export default {
if(this.$route.query.id !== ''){
this.getCouresId(this.$route.query.id)
this.getReverseShellList()
this.getCourseExpand()
}
},
methods: {
//
daoChu() {
},
//
getCouresId(id){
getRequest('/edu/v1/pc/course/'+id).then(resp=> {
@ -561,6 +625,19 @@ export default { @@ -561,6 +625,19 @@ export default {
}else{
this.dataForm.core1 = '2'
}
this.getCouresUserTj(id)
} else {
//
_this.$alert('');
}
}, resp=> {
});
},
getCouresUserTj(id){
postRequest('/edu/v1/pc/coursUserTj/'+id).then(resp=> {
if (resp.status === 200) {
console.log('111----', resp)
this.dataList = resp.data.data
} else {
//
_this.$alert('');
@ -570,19 +647,109 @@ export default { @@ -570,19 +647,109 @@ export default {
},
//
getReverseShellList() {
this.tableData = ''
getRequest('/edu/v1/pc/course/'+this.$route.query.id+'/episode').then(res=> {
this.tableData = res.data.data.list
})
},
//
getCourseExpand() {
this.tableData = ''
postRequest('/edu/v1/pc/courseExpand/'+this.$route.query.id).then(res=> {
if(res.data.data !== null) {
if (this.$route.query.couresName === '现场课') {
this.dataExtForm = res.data.data
} else {
this.dataExtForm1 = res.data.data
}
}
})
},
//
createCourseExt(){
this.dataExtForm.expand2 = this.dataExtForm.day + '-'+this.dataExtForm.startTime+'-'+this.dataExtForm.endTime
console.log(this.dataExtForm.expand2)
postRequest('/edu/v1/pc/courseExpand/'+this.$route.query.id+'/add', JSON.stringify(this.dataExtForm)).then(resp=> {
if (resp.status === 200) {
_this.$alert('保存成功');
this.$router.push({
path: "/coures",
query: {
}
});
} else {
//
_this.$alert('');
}
}, resp=> {
});
},
//
createCourseExt1(){
this.dataExtForm1.expand2 = this.dataExtForm1.day + '-'+this.dataExtForm1.startTime+'-'+this.dataExtForm1.endTime
console.log(this.dataExtForm1.expand2)
postRequest('/edu/v1/pc/courseExpand/'+this.$route.query.id+'/add', JSON.stringify(this.dataExtForm1)).then(resp=> {
if (resp.status === 200) {
_this.$alert('保存成功');
this.$router.push({
path: "/coures",
query: {
}
});
} else {
//
_this.$alert('');
}
}, resp=> {
});
},
//
handleAdd(row) {
var item={
id: '',
name:'',
enabled: false
}
this.tableData.push(item)
},
// Apply
handleUpdate(row) {
let hasVideo = false
if(row.videoUrl!== ''){
hasVideo = true
}
var dataFrom= {
newEpisode: {
name: row.name,
videoUrl: row.videoUrl,
index: '5',
hasVideo: hasVideo,
hasOfflineLecture: false
}
}
postRequest('/edu/v1/pc/course/'+this.$route.query.id+'/episode',JSON.stringify(dataFrom)).then(res=> {
console.log('111----', res)
this.$alert('保存成功','成功');
})
},
//
handleDelete(row) {
if(row.id !== ''){
deleteRequest('/edu/v1/pc/course/'+this.$route.query.id+'/episode/'+row.id).then(res=> {
console.log('111----', res)
this.getReverseShellList()
})
}else {
var tempList = []
for (let i = 0; i < this.tableData.length; i++) {
if (row.id !== this.tableData[i].id) {
tempList.push(this.tableData[i])
}
}
this.tableData = tempList
}
},
//
createCourse(){
if(this.dataForm.core1 === '1' ){
this.dataForm.core = true
@ -649,7 +816,7 @@ export default { @@ -649,7 +816,7 @@ export default {
handlePreview(file) {
console.log(file);
},
finde(){
close(){
//
this.$router.push({
path: "/coures",

34
src/page/coures/coures.vue

@ -198,14 +198,14 @@ @@ -198,14 +198,14 @@
<el-button type="text" size="mini"
@click="updateCourse(scope.row)">查看
</el-button>
<el-button type="text" size="mini" v-if="scope.row.status!=='DRAFT'"
@click="">下架
<el-button type="text" size="mini" v-if="scope.row.status==='UP'"
@click="updateRow(scope.row,'DOWN')">下架
</el-button>
<el-button type="text" size="mini" v-if="scope.row.status==='DRAFT'"
@click="">上架
<el-button type="text" size="mini" v-if="scope.row.status==='DRAFT' || scope.row.status==='DOWN'"
@click="updateRow(scope.row,'UP')">上架
</el-button>
<el-button type="text" size="mini"
@click="">删除
@click="deleteRow(scope.row)">删除
</el-button>
</template>
</el-table-column>
@ -223,7 +223,7 @@ @@ -223,7 +223,7 @@
</div>
</template>
<script>
import { postRequest,getRequest } from '../../utils/api'
import { postRequest,getRequest,deleteRequest,putRequest } from '../../utils/api'
export default {
data () {
return {
@ -296,15 +296,18 @@ export default { @@ -296,15 +296,18 @@ 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;
@ -322,6 +325,23 @@ export default { @@ -322,6 +325,23 @@ export default {
}, resp=> {
});
},
//
updateRow(row,status){
putRequest('/edu/v1/pc/updateCourse/'+row.id+'/'+status).then(res=> {
console.log('111----', res)
this.$alert('修改成功','修改');
this.submitClick()
})
},
//
deleteRow(row){
deleteRequest('/edu/v1/pc/course/'+row.id).then(res=> {
console.log('111----', res)
this.$alert('删除成功','删除');
this.submitClick()
})
},
//
submitClick: function () {
var _this = this;
this.loading = true;
@ -369,7 +389,7 @@ export default { @@ -369,7 +389,7 @@ export default {
this.subjectList = resp.data.data
} else {
//
_this.$alert('');
this.$alert('');
}
}, resp=> {
});

13
src/utils/api.js

@ -39,14 +39,21 @@ export const putRequest = (url, params) => { @@ -39,14 +39,21 @@ export const putRequest = (url, params) => {
return data
}],
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
'Content-Type': 'application/json;charset=UTF-8',
'X-Token': Vue.prototype.$global.token,
'X-DomainId': '100010'
},
});
}
export const deleteRequest = (url) => {
return axios({
method: 'delete',
url: `${base}${url}`
url: `${base}${url}`,
headers: {
'Content-Type': 'application/json;charset=UTF-8',
'X-Token': Vue.prototype.$global.token,
'X-DomainId': '100010'
},
});
}
export const getRequest = (url,params) => {

Loading…
Cancel
Save