123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550 |
- <!-- -->
- <template>
- <div class="m-container">
- <h2>
- <div class="squrt"></div>
- 直播课管理
- </h2>
- <div class="m-core">
- <auth auths="imLiveBroadcastRoom/add">
- <el-button
- @click="newLiveClass"
- type="primary"
- style="margin-bottom: 20px"
- >新建直播课</el-button
- >
- </auth>
- <save-form
- :inline="true"
- :model="searchForm"
- @submit="search"
- @reset="onReSet"
- ref="searchForm"
- >
- <el-form-item prop="search">
- <el-input
- v-model.trim="searchForm.search"
- clearable
- @keyup.enter.native="search"
- placeholder="直播间编号/标题"
- ></el-input>
- </el-form-item>
- <el-form-item prop="popularize">
- <el-select
- placeholder="是否推广"
- v-model="searchForm.popularize"
- clearable
- >
- <el-option label="否" value="0"></el-option>
- <el-option label="是" value="1"></el-option>
- </el-select>
- </el-form-item>
- <el-form-item prop="liveState">
- <el-select
- placeholder="直播状态"
- v-model="searchForm.liveState"
- clearable
- >
- <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">
- <el-date-picker
- v-model.trim="searchForm.timer"
- type="daterange"
- value-format="yyyy-MM-dd"
- range-separator="至"
- start-placeholder="直播开始日期"
- end-placeholder="直播结束日期"
- :picker-options="{
- firstDayOfWeek: 1,
- }"
- >
- </el-date-picker>
- </el-form-item>
- <el-form-item>
- <el-button native-type="submit" type="primary">搜索</el-button>
- <el-button native-type="reset" type="danger">重置</el-button>
- </el-form-item>
- </save-form>
- <div class="tableWrap">
- <el-table
- style="width: 100%"
- :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
- :data="tableList"
- >
- <el-table-column
- align="center"
- prop="id"
- label="直播间编号"
- ></el-table-column>
- <el-table-column
- align="center"
- prop="roomTitle"
- label="直播课标题"
- ></el-table-column>
- <el-table-column
- align="center"
- prop="speakerName"
- label="主讲人"
- ></el-table-column>
- <el-table-column
- align="center"
- prop="liveStartTime"
- label="直播开始时间"
- >
- <template slot-scope="scope">
- <div>
- {{ scope.row.liveStartTime | dateForMinFormat }}
- </div>
- </template>
- </el-table-column>
- <el-table-column align="center" prop="popularize" label="观看权限">
- <template slot-scope="scope">
- <div>
- {{ scope.row.popularizeType=='ALL'? "全员" : "部分" }}
- </div>
- </template>
- </el-table-column>
- <el-table-column align="center" prop="popularize" label="是否推广">
- <template slot-scope="scope">
- <div>
- {{ scope.row.popularize == 1 ? "是" : "否" }}
- </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>
- <el-table-column
- align="center"
- prop="createdByName"
- label="创建人"
- ></el-table-column>
- <el-table-column align="center" prop="createdByName" label="预约人数">
- <template slot-scope="scope">
- <div>
- <auth auths="imLiveBroadcastRoom/query/roomUser">
- <el-button
- type="text"
- @click="lookReservationDetail(scope.row)"
- >
- {{ scope.row.roomReservationNum }}</el-button
- >
- </auth>
- </div>
- </template>
- </el-table-column>
- <el-table-column align="center" prop="studentId" label="操作">
- <template slot-scope="scope">
- <div>
- <el-dropdown trigger="click" placement="bottom" :hide-on-click="false">
- <span class="el-dropdown-link">
- 操作<i class="el-icon-arrow-down el-icon--right"></i>
- </span>
- <el-dropdown-menu slot="dropdown">
- <el-dropdown-item
- v-if="permission('/liveStudentList')&&scope.row.popularizeType!=='ALL'"
- @click.native="lookStudentDetail(scope.row)"
- >
- <el-button
- type="text"
- >观看学员</el-button
- >
- </el-dropdown-item>
- <el-dropdown-item
- v-if="
- permission('imLiveBroadcastRoom/opsPopularize') &&
- scope.row.liveState != 2
- "
- @click.native="popularizeRoom(scope.row)"
- >
- <el-button
- type="text"
- >{{
- scope.row.popularize == 1 ? "取消推广" : "首页推广"
- }}</el-button
- >
- </el-dropdown-item>
- <el-dropdown-item
- v-if="
- permission('imLiveBroadcastRoom/roomDestroy') &&
- scope.row.liveState == 1
- "
- @click.native="closeRoom(scope.row)"
- >
- <el-button type="text"
- >关闭直播</el-button
- >
- </el-dropdown-item>
- <el-dropdown-item v-if="scope.row.liveState == 2" @click.native="gotoDetail(scope.row)">
- <el-button type="text"
- >直播详情</el-button
- >
- </el-dropdown-item>
- <auth auths="/liveBlackList">
- <el-dropdown-item @click.native="gotoBuylist(scope.row)">
- <el-button type="text"
- >订单详情</el-button
- >
- </el-dropdown-item>
- </auth>
- <el-dropdown-item v-if="permission('liveGoodsMapper/page')" @click.native="setShop(scope.row)">
- <el-button type="text"
- >商品设置</el-button
- >
- </el-dropdown-item>
- <auth
- auths="imLiveBroadcastRoom/queryLiveRoomGoodsOrderList"
- >
- <el-dropdown-item @click.native="gotoBlacklist(scope.row)">
- <el-button type="text"
- >黑名单</el-button
- >
- </el-dropdown-item>
- </auth>
- <el-dropdown-item
- v-if="permission('imLiveBroadcastRoom/shareGroup')"
- @click.native="shareLive(scope.row)"
- >
- <el-button type="text"
- >分享</el-button
- >
- </el-dropdown-item>
- <el-dropdown-item
- v-if="
- permission('imLiveBroadcastRoom/update') &&
- scope.row.liveState == 0
- "
- >
- <el-button type="text" @click.native="resetLive(scope.row)"
- >修改</el-button
- >
- </el-dropdown-item>
- <auth
- auths="imLiveBroadcastRoom/delete"
- v-if="scope.row.liveState == 0"
- >
- <el-dropdown-item>
- <el-button type="text" @click.native="deteleLive(scope.row)"
- >删除</el-button
- >
- </el-dropdown-item>
- </auth>
- </el-dropdown-menu>
- </el-dropdown>
- <!-- <auth
- auths="imLiveBroadcastRoom/opsPopularize"
- v-if="scope.row.liveState != 2"
- >
- <el-button type="text" @click="popularizeRoom(scope.row)">{{
- scope.row.popularize == 1 ? "取消推广" : "首页推广"
- }}</el-button>
- </auth>
- <auth auths="imLiveBroadcastRoom/roomDestroy">
- <el-button
- type="text"
- v-if="scope.row.liveState == 1"
- @click="closeRoom(scope.row)"
- >关闭直播</el-button
- >
- </auth>
- <el-button
- type="text"
- v-if="scope.row.liveState == 2"
- @click="gotoDetail(scope.row)"
- >直播详情</el-button
- >
- <auth auths="liveGoodsMapper/page">
- <el-button type="text" @click="setShop(scope.row)"
- >商品设置</el-button
- >
- </auth>
- <auth auths="imLiveBroadcastRoom/shareGroup">
- <el-button type="text" @click="shareLive(scope.row)"
- >分享</el-button
- >
- </auth>
- <auth auths="imLiveBroadcastRoom/update">
- <el-button
- type="text"
- v-if="scope.row.liveState == 0"
- @click="resetLive(scope.row)"
- >修改</el-button
- >
- </auth>
- <auth auths="imLiveBroadcastRoom/delete">
- <el-button
- type="text"
- v-if="scope.row.liveState == 0"
- @click="deteleLive(scope.row)"
- >删除</el-button
- >
- </auth>
- <auth auths="imLiveBroadcastRoom/queryLiveRoomGoodsOrderList">
- <el-button type="text" @click="gotoBlacklist(scope.row)"
- >黑名单</el-button
- >
- </auth>
- <auth auths="/liveBlackList">
- <el-button type="text" @click="gotoBuylist(scope.row)"
- >订单详情</el-button
- >
- </auth> -->
- </div>
- </template>
- </el-table-column>
- </el-table>
- <pagination
- sync
- :total.sync="rules.total"
- :page.sync="rules.page"
- :limit.sync="rules.limit"
- :page-sizes="rules.page_size"
- @pagination="getList"
- />
- </div>
- </div>
- <el-dialog
- title="分享"
- width="510px"
- append-to-body
- :visible.sync="shareVisible"
- v-if="shareVisible"
- >
- <shareDetail @close="shareVisible = false" :row="activeRow" />
- </el-dialog>
- <popularizeRoom @getList="getList" ref="popularizeRoom" />
- <reservationDetail ref="reservationDetail" />
- <sellShopList ref="sellShopList" />
- </div>
- </template>
- <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 load from "@/utils/loading";
- import popularizeRoom from "./modals/popularizeRoom.vue";
- import reservationDetail from "./modals/reservationDetail.vue";
- import sellShopList from "./modals/sellShopList";
- import { permission } from "@/utils/directivePage";
- import {
- getLiveBroadcastList,
- delLiveBroadcast,
- closeBroadcastRoomList,
- opsPopularize,
- } from "./api";
- export default {
- components: {
- pagination,
- shareDetail,
- popularizeRoom,
- reservationDetail,
- sellShopList,
- },
- data() {
- return {
- searchForm: {
- search: null,
- timer: [],
- liveState: null,
- popularize: null,
- },
- tableList: [],
- organList: [],
- rules: {
- // 分页规则
- limit: 10, // 限制显示条数
- page: 1, // 当前页
- total: 0, // 总条数
- page_size: [10, 20, 40, 50], // 选择限制显示条数
- },
- shareVisible: false,
- activeRow: null,
- };
- },
- //生命周期 - 创建完成(可以访问当前this实例)
- created() {},
- //生命周期 - 挂载完成(可以访问DOM元素)
- mounted() {
- // 获取分部
- this.init();
- },
- methods: {
- permission,
- init() {
- 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);
- }
- },
- search() {
- this.rules.page = 1;
- this.getList();
- },
- 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({
- path: "/business/liveClassDetail",
- query: { roomUid: row.roomUid },
- });
- //
- },
- shareLive(row) {
- console.log('触发')
- this.activeRow = row;
- this.shareVisible = true;
- },
- resetLive(row) {
- let params = {
- path: "/business/createLiveClass",
- query: { ...row },
- };
- // query: { id:row.id,roomUid:row.roomUid},
- 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(() => {});
- },
- closeRoom(row) {
- this.$confirm("您确定关闭直播间", "提示", {
- confirmButtonText: "确定",
- type: "warning",
- }).then(async (res) => {
- try {
- const res = await closeBroadcastRoomList(row.id);
- this.$message.success("关闭成功");
- this.getList();
- } catch (e) {}
- });
- },
- async popularizeRoom(row) {
- let popularize, str;
- if (row.popularize) {
- popularize = 0;
- str = "取消推广";
- } else {
- popularize = 1;
- str = "推广";
- // this.$refs.popularizeRoom.openDioag(row);
- }
- this.$confirm(`您是否${str}直播间"${row.roomTitle}"`, "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(async () => {
- try {
- const res = await opsPopularize({
- popularize,
- id: row.id,
- });
- this.$message.success(`${str}成功`);
- this.getList();
- } catch (e) {
- console.log(e);
- }
- })
- .catch(() => {});
- },
- setShop(row) {
- this.$router.push({
- path: "/business/liveShopControl",
- query: { roomUid: row.roomUid },
- });
- //
- },
- lookReservationDetail(row) {
- this.$refs.reservationDetail.openDioag(row);
- },
- gotoBlacklist(row) {
- this.$router.push({
- path: "/business/liveBlackList",
- query: { roomUid: row.roomUid, name: row.roomTitle },
- });
- },
- gotoBuylist(row) {
- this.$refs.sellShopList.openDioag(row);
- },
- lookStudentDetail(row) {
- this.$router.push({
- path: "/business/liveStudentList",
- query: { roomUid: row.roomUid,name:row.roomTitle },
- });
- },
- },
- };
- </script>
- <style lang='scss' scoped>
- /deep/.el-dropdown-link {
- cursor: pointer;
- color: var(--color-primary);
- }
- /deep/.el-icon-arrow-down {
- font-size: 12px;
- }
- </style>
|