|
@@ -17,8 +17,9 @@
|
|
|
:model="searchForm"
|
|
|
@submit="search"
|
|
|
@reset="onReSet"
|
|
|
+ ref="searchForm"
|
|
|
>
|
|
|
- <el-form-item>
|
|
|
+ <el-form-item prop="search">
|
|
|
<el-input
|
|
|
v-model.trim="searchForm.search"
|
|
|
clearable
|
|
@@ -26,14 +27,15 @@
|
|
|
placeholder="直播间编号/标题"
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
|
- <el-form-item prop="leaveVisitFlag">
|
|
|
+ <el-form-item prop="liveState">
|
|
|
<el-select
|
|
|
placeholder="直播状态"
|
|
|
- v-model="searchForm.leaveVisitFlag"
|
|
|
+ v-model="searchForm.liveState"
|
|
|
clearable
|
|
|
>
|
|
|
- <el-option label="是" value="1"></el-option>
|
|
|
- <el-option label="否" value="0"></el-option>
|
|
|
+ <el-option label="未开始" value="0"></el-option>
|
|
|
+ <el-option label="直播中" value="1"></el-option>
|
|
|
+ <el-option label="已结束" value="2"></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item prop="timer">
|
|
@@ -82,22 +84,18 @@
|
|
|
prop="liveStartTime"
|
|
|
label="直播开始时间"
|
|
|
>
|
|
|
- <template slot-scope="scope">
|
|
|
- <div>
|
|
|
- {{scope.row.liveStartTime|dateForMinFormat}}
|
|
|
- </div>
|
|
|
- </template>
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div>
|
|
|
+ {{ scope.row.liveStartTime | dateForMinFormat }}
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column
|
|
|
- align="center"
|
|
|
- prop="liveState"
|
|
|
- label="直播状态"
|
|
|
- >
|
|
|
- <template slot-scope="scope">
|
|
|
- <div>
|
|
|
- {{scope.row.liveState|liveState}}
|
|
|
- </div>
|
|
|
- </template>
|
|
|
+ <el-table-column align="center" prop="liveState" label="直播状态">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div>
|
|
|
+ {{ scope.row.liveState | liveState }}
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
align="center"
|
|
@@ -107,15 +105,27 @@
|
|
|
<el-table-column align="center" prop="studentId" label="操作">
|
|
|
<template slot-scope="scope">
|
|
|
<div>
|
|
|
- <el-button type="text">关闭直播</el-button>
|
|
|
+ <el-button type="text" v-if="scope.row.liveState != 2"
|
|
|
+ >关闭直播</el-button
|
|
|
+ >
|
|
|
<el-button type="text" @click="gotoDetail(scope.row)"
|
|
|
>直播详情</el-button
|
|
|
>
|
|
|
<el-button type="text" @click="shareLive(scope.row)"
|
|
|
>分享</el-button
|
|
|
>
|
|
|
- <el-button type="text">修改</el-button>
|
|
|
- <el-button type="text">删除</el-button>
|
|
|
+ <el-button
|
|
|
+ type="text"
|
|
|
+ v-if="scope.row.liveState == 0"
|
|
|
+ @click="resetLive(scope.row)"
|
|
|
+ >修改</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ type="text"
|
|
|
+ v-if="scope.row.liveState == 0"
|
|
|
+ @click="deteleLive(scope.row)"
|
|
|
+ >删除</el-button
|
|
|
+ >
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
@@ -137,7 +147,7 @@
|
|
|
:visible.sync="shareVisible"
|
|
|
v-if="shareVisible"
|
|
|
>
|
|
|
- <shareDetail :row="activeRow"/>
|
|
|
+ <shareDetail :row="activeRow" />
|
|
|
</el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -145,16 +155,19 @@
|
|
|
<script>
|
|
|
import axios from "axios";
|
|
|
import { getToken } from "@/utils/auth";
|
|
|
+import { getTimes } from "@/utils";
|
|
|
import pagination from "@/components/Pagination/index";
|
|
|
-import shareDetail from "./modals/shareDetail.vue"
|
|
|
+import shareDetail from "./modals/shareDetail.vue";
|
|
|
import load from "@/utils/loading";
|
|
|
-import {getLiveBroadcastList} from './api'
|
|
|
+import { getLiveBroadcastList,delLiveBroadcast } from "./api";
|
|
|
export default {
|
|
|
- components: { pagination,shareDetail },
|
|
|
+ components: { pagination, shareDetail },
|
|
|
data() {
|
|
|
return {
|
|
|
searchForm: {
|
|
|
search: null,
|
|
|
+ timer: [],
|
|
|
+ liveState: null,
|
|
|
},
|
|
|
|
|
|
tableList: [{}],
|
|
@@ -166,8 +179,8 @@ export default {
|
|
|
total: 0, // 总条数
|
|
|
page_size: [10, 20, 40, 50], // 选择限制显示条数
|
|
|
},
|
|
|
- shareVisible:false,
|
|
|
- activeRow:null
|
|
|
+ shareVisible: false,
|
|
|
+ activeRow: null,
|
|
|
};
|
|
|
},
|
|
|
//生命周期 - 创建完成(可以访问当前this实例)
|
|
@@ -180,34 +193,75 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
init() {
|
|
|
- this.getList()
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ async getList() {
|
|
|
+ const { timer, ...rest } = this.searchForm;
|
|
|
+ try {
|
|
|
+ const res = await getLiveBroadcastList({
|
|
|
+ ...rest,
|
|
|
+ ...getTimes(timer, ["startTime", "endTime"]),
|
|
|
+ rows: this.rules.limit,
|
|
|
+ page: this.rules.page,
|
|
|
+ });
|
|
|
+ this.tableList = res.data.rows;
|
|
|
+ this.rules.total = res.data.total;
|
|
|
+ } catch (e) {
|
|
|
+ console.log(e);
|
|
|
+ }
|
|
|
},
|
|
|
- async getList() {
|
|
|
- try{
|
|
|
- const res = await getLiveBroadcastList({...this.searchForm,rows:this.rules.limit,page:this.rules.page})
|
|
|
- this.tableList = res.data.rows;
|
|
|
- this.rules.total = res.data.total
|
|
|
- }catch(e){
|
|
|
- console.log(e)
|
|
|
- }
|
|
|
- },
|
|
|
search() {
|
|
|
this.rules.page = 1;
|
|
|
this.getList();
|
|
|
},
|
|
|
- onReSet() {},
|
|
|
+ onReSet() {
|
|
|
+ this.$refs.searchForm.resetFields();
|
|
|
+ this.search();
|
|
|
+ },
|
|
|
newLiveClass() {
|
|
|
+ let params = {
|
|
|
+ path: "/business/createLiveClass",
|
|
|
+ };
|
|
|
+ this.$router.push(params, (route) => {
|
|
|
+ route.meta.title = "新建直播课";
|
|
|
+ });
|
|
|
this.$router.push("/business/createLiveClass");
|
|
|
//liveClassDetail
|
|
|
},
|
|
|
gotoDetail(row) {
|
|
|
- this.$router.push("/business/liveClassDetail");
|
|
|
+ this.$router.push({path:"/business/liveClassDetail", query: { ...row },});
|
|
|
},
|
|
|
shareLive(row) {
|
|
|
this.activeRow = row;
|
|
|
- this.activeRow.preTemplate =1
|
|
|
+ this.activeRow.preTemplate = 1;
|
|
|
this.shareVisible = true;
|
|
|
},
|
|
|
+ resetLive(row) {
|
|
|
+ let params = {
|
|
|
+ path: "/business/createLiveClass",
|
|
|
+ query: { ...row },
|
|
|
+ };
|
|
|
+ this.$router.push(params, (route) => {
|
|
|
+ route.meta.title = "修改直播课";
|
|
|
+ });
|
|
|
+ },
|
|
|
+ deteleLive(row) {
|
|
|
+ this.$confirm("您确定删除该直播间", "提示", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
+ })
|
|
|
+ .then(async() => {
|
|
|
+ try{
|
|
|
+ const res = await delLiveBroadcast({id:row.id})
|
|
|
+ this.$message.success('删除成功')
|
|
|
+ this.getList()
|
|
|
+ }catch(e){
|
|
|
+ console.log(e)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|