Browse Source

添加直播方案

lex 2 years ago
parent
commit
d142eca6ee
3 changed files with 153 additions and 104 deletions
  1. 8 0
      src/utils/vueFilter.js
  2. 96 77
      src/views/liveClassManager/index.vue
  3. 49 27
      src/views/liveClassManager/newLiveClass.vue

+ 8 - 0
src/utils/vueFilter.js

@@ -886,3 +886,11 @@ Vue.filter("liveState", value => {
   };
   return obj[value];
 });
+// 直播方案
+Vue.filter("serviceProvider", value => {
+  const obj = {
+    rongCloud: "融云",
+    tencentCloud: "腾讯云"
+  };
+  return obj[value];
+});

+ 96 - 77
src/views/liveClassManager/index.vue

@@ -25,8 +25,8 @@
           <el-input
             v-model.trim="searchForm.search"
             clearable
-              @keyup.enter.native="
-              (e) => {
+            @keyup.enter.native="
+              e => {
                 e.target.blur();
                 $refs.searchForm.save();
                 search();
@@ -56,6 +56,16 @@
             <el-option label="已结束" value="2"></el-option>
           </el-select>
         </el-form-item>
+        <el-form-item prop="liveState">
+          <el-select
+            placeholder="直播方案"
+            v-model="searchForm.serviceProvider"
+            clearable
+          >
+            <el-option label="融云" value="rongCloud"></el-option>
+            <el-option label="腾讯云" value="tencentCloud"></el-option>
+          </el-select>
+        </el-form-item>
         <el-form-item prop="timer">
           <el-date-picker
             v-model.trim="searchForm.timer"
@@ -65,7 +75,7 @@
             start-placeholder="直播开始日期"
             end-placeholder="直播结束日期"
             :picker-options="{
-              firstDayOfWeek: 1,
+              firstDayOfWeek: 1
             }"
           >
           </el-date-picker>
@@ -137,6 +147,13 @@
               </div>
             </template>
           </el-table-column>
+          <el-table-column align="center" prop="serviceProvider" label="直播方案">
+            <template slot-scope="scope">
+              <div>
+                {{ scope.row.serviceProvider | serviceProvider }}
+              </div>
+            </template>
+          </el-table-column>
           <el-table-column
             align="center"
             prop="createdByName"
@@ -159,92 +176,92 @@
           <el-table-column align="center" prop="studentId" label="操作">
             <template slot-scope="scope">
               <div>
-                <el-dropdown trigger="click" placement="bottom" :hide-on-click="false" >
+                <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" style="width:100px">
                     <el-dropdown-item
-                    style="width:100px"
-                      v-if="permission('/liveStudentList')&&scope.row.popularizeType!=='ALL'"
-                        @click.native="lookStudentDetail(scope.row)"
+                      style="width:100px"
+                      v-if="
+                        permission('/liveStudentList') &&
+                          scope.row.popularizeType !== 'ALL'
+                      "
+                      @click.native="lookStudentDetail(scope.row)"
                     >
-                      <el-button
-                        type="text"
-
-                        >观看学员</el-button
-                      >
+                      <el-button type="text">观看学员</el-button>
                     </el-dropdown-item>
                     <el-dropdown-item
                       v-if="
                         permission('imLiveBroadcastRoom/opsPopularize') &&
-                        scope.row.liveState != 2
+                          scope.row.liveState != 2
                       "
-                           @click.native="popularizeRoom(scope.row)"
+                      @click.native="popularizeRoom(scope.row)"
                     >
-                      <el-button
-                        type="text"
-
-                        >{{
-                          scope.row.popularize == 1 ? "取消推广" : "首页推广"
-                        }}</el-button
-                      >
+                      <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
+                          scope.row.liveState == 1
                       "
-                       @click.native="closeRoom(scope.row)"
+                      @click.native="closeRoom(scope.row)"
                     >
-                      <el-button type="text"
-                        >关闭直播</el-button
-                      >
+                      <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
+                      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 @click.native="gotoBuylist(scope.row)">
+                        <el-button type="text">订单详情</el-button>
                       </el-dropdown-item>
                     </auth>
-                    <el-dropdown-item v-if="permission('liveGoodsMapper/page')&&ishowCart(scope.row)"  @click.native="setShop(scope.row)">
-                      <el-button type="text"
-                        >商品设置</el-button
-                      >
+                    <el-dropdown-item
+                      v-if="
+                        permission('liveGoodsMapper/page') &&
+                          ishowCart(scope.row)
+                      "
+                      @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
+                        @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)"
+                      @click.native="shareLive(scope.row)"
                     >
-                      <el-button type="text"
-                        >分享</el-button
-                      >
+                      <el-button type="text">分享</el-button>
                     </el-dropdown-item>
 
                     <el-dropdown-item
                       v-if="
                         permission('imLiveBroadcastRoom/update') &&
-                        scope.row.liveState == 0
+                          scope.row.liveState == 0
                       "
                     >
-                      <el-button type="text"  @click.native="resetLive(scope.row)"
+                      <el-button
+                        type="text"
+                        @click.native="resetLive(scope.row)"
                         >修改</el-button
                       >
                     </el-dropdown-item>
@@ -254,7 +271,9 @@
                       v-if="scope.row.liveState == 0"
                     >
                       <el-dropdown-item>
-                        <el-button type="text"  @click.native="deteleLive(scope.row)"
+                        <el-button
+                          type="text"
+                          @click.native="deteleLive(scope.row)"
                           >删除</el-button
                         >
                       </el-dropdown-item>
@@ -366,7 +385,7 @@ import {
   getLiveBroadcastList,
   delLiveBroadcast,
   closeBroadcastRoomList,
-  opsPopularize,
+  opsPopularize
 } from "./api";
 export default {
   components: {
@@ -374,15 +393,16 @@ export default {
     shareDetail,
     popularizeRoom,
     reservationDetail,
-    sellShopList,
+    sellShopList
   },
   data() {
     return {
       searchForm: {
         search: null,
         timer: [],
+        serviceProvider: null,
         liveState: null,
-        popularize: null,
+        popularize: null
       },
 
       tableList: [],
@@ -392,10 +412,10 @@ export default {
         limit: 10, // 限制显示条数
         page: 1, // 当前页
         total: 0, // 总条数
-        page_size: [10, 20, 40, 50], // 选择限制显示条数
+        page_size: [10, 20, 40, 50] // 选择限制显示条数
       },
       shareVisible: false,
-      activeRow: null,
+      activeRow: null
     };
   },
   //生命周期 - 创建完成(可以访问当前this实例)
@@ -418,7 +438,7 @@ export default {
           ...rest,
           ...getTimes(timer, ["startTime", "endTime"]),
           rows: this.rules.limit,
-          page: this.rules.page,
+          page: this.rules.page
         });
         this.tableList = res.data.rows;
         this.rules.total = res.data.total;
@@ -436,9 +456,9 @@ export default {
     },
     newLiveClass() {
       let params = {
-        path: "/business/createLiveClass",
+        path: "/business/createLiveClass"
       };
-      this.$router.push(params, (route) => {
+      this.$router.push(params, route => {
         route.meta.title = "新建直播课";
       });
       this.$router.push("/business/createLiveClass");
@@ -447,7 +467,7 @@ export default {
     gotoDetail(row) {
       this.$router.push({
         path: "/business/liveClassDetail",
-        query: { roomUid: row.roomUid },
+        query: { roomUid: row.roomUid }
       });
       //
     },
@@ -458,10 +478,10 @@ export default {
     resetLive(row) {
       let params = {
         path: "/business/createLiveClass",
-       query: { id:row.id,roomUid:row.roomUid}
+        query: { id: row.id, roomUid: row.roomUid }
       };
       //  ,
-      this.$router.push(params, (route) => {
+      this.$router.push(params, route => {
         route.meta.title = "修改直播课";
       });
     },
@@ -469,7 +489,7 @@ export default {
       this.$confirm("您确定删除该直播间", "提示", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
-        type: "warning",
+        type: "warning"
       })
         .then(async () => {
           try {
@@ -485,8 +505,8 @@ export default {
     closeRoom(row) {
       this.$confirm("您确定关闭直播间", "提示", {
         confirmButtonText: "确定",
-        type: "warning",
-      }).then(async (res) => {
+        type: "warning"
+      }).then(async res => {
         try {
           const res = await closeBroadcastRoomList(row.id);
           this.$message.success("关闭成功");
@@ -507,13 +527,13 @@ export default {
       this.$confirm(`您是否${str}直播间"${row.roomTitle}"`, "提示", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
-        type: "warning",
+        type: "warning"
       })
         .then(async () => {
           try {
             const res = await opsPopularize({
               popularize,
-              id: row.id,
+              id: row.id
             });
             this.$message.success(`${str}成功`);
             this.getList();
@@ -526,7 +546,7 @@ export default {
     setShop(row) {
       this.$router.push({
         path: "/business/liveShopControl",
-        query: { roomUid: row.roomUid },
+        query: { roomUid: row.roomUid }
       });
       //
     },
@@ -536,7 +556,7 @@ export default {
     gotoBlacklist(row) {
       this.$router.push({
         path: "/business/liveBlackList",
-        query: { roomUid: row.roomUid, name: row.roomTitle },
+        query: { roomUid: row.roomUid, name: row.roomTitle }
       });
     },
     gotoBuylist(row) {
@@ -545,21 +565,21 @@ export default {
     lookStudentDetail(row) {
       this.$router.push({
         path: "/business/liveStudentList",
-        query: { roomUid: row.roomUid, name: row.roomTitle },
+        query: { roomUid: row.roomUid, name: row.roomTitle }
       });
     },
-    ishowCart(row){
-      let json = JSON.parse(row.roomConfig)
-      if(json.whether_view_shop_cart == 0) {
-         return true
-      }else{
-        return false
+    ishowCart(row) {
+      let json = JSON.parse(row.roomConfig);
+      if (json.whether_view_shop_cart == 0) {
+        return true;
+      } else {
+        return false;
       }
     }
-  },
+  }
 };
 </script>
-<style lang='scss' scoped>
+<style lang="scss" scoped>
 ::v-deep .el-dropdown-link {
   cursor: pointer;
   color: var(--color-primary);
@@ -568,4 +588,3 @@ export default {
   font-size: 12px;
 }
 </style>
-

+ 49 - 27
src/views/liveClassManager/newLiveClass.vue

@@ -80,6 +80,21 @@
         </el-row>
         <el-row class="row">
           <el-form-item
+            label="直播方案"
+            class="nomb"
+            prop="serviceProvider"
+            :rules="[{ required: true, message: '请选择直播方案' }]"
+          >
+            <el-select
+              placeholder="请选择直播方案"
+              v-model="form.serviceProvider"
+              clearable
+            >
+              <el-option label="融云" value="rongCloud"></el-option>
+              <el-option label="腾讯云" value="tencentCloud"></el-option>
+            </el-select>
+          </el-form-item>
+          <el-form-item
             label="直播课内容"
             prop="liveRemark"
             :rules="[{ required: true, message: '请输入直播课内容' }]"
@@ -171,7 +186,7 @@
             label-width="120px"
             :rules="[{ required: true, message: '请选择推广类型' }]"
           >
-            <el-radio-group v-model="form.os" >
+            <el-radio-group v-model="form.os">
               <el-radio label="pc">电脑</el-radio>
               <el-radio label="mobile">手机</el-radio>
             </el-radio-group>
@@ -201,8 +216,8 @@
           <el-form-item
             v-if="
               form.popularizeType == 'SCHOOL' ||
-              form.popularizeType == 'ORGAN' ||
-              form.popularizeType == 'TEAM'
+                form.popularizeType == 'ORGAN' ||
+                form.popularizeType == 'TEAM'
             "
             label="分部"
             prop="organIds"
@@ -369,7 +384,11 @@
 import preview from "./modals/preview.vue";
 import axios from "axios";
 import { getToken, getTenantId } from "@/utils/auth";
-import { createLiveBroadcast, resetLiveBroadcastRoomList ,getRoomInfo} from "./api";
+import {
+  createLiveBroadcast,
+  resetLiveBroadcastRoomList,
+  getRoomInfo
+} from "./api";
 import { queryByOrganId } from "@/api/systemManage";
 import { getTeamList } from "@/api/teamServer";
 export default {
@@ -388,29 +407,30 @@ export default {
         liveRemark: "",
         preTemplate: null,
         popularizeType: "ALL",
-        os:'pc',
+        os: "pc",
         roomConfig: {
           whether_like: 0,
           whether_chat: 0,
           whether_video: 0,
           whether_mic: 0,
-          whether_view_shop_cart: 0,
+          whether_view_shop_cart: 0
         },
         checkList: [],
+        serviceProvider: "rongCloud"
       },
       remoteLoading: false,
       teacherList: [],
       checkList: [],
       cooperationList: [],
       teamList: [],
-      isinit: true,
+      isinit: true
     };
   },
   mounted() {
     this.$store.dispatch("setBranchs");
     if (this.$route.query.id) {
       // this.name = "修改直播间";
-      this.getDetail()
+      this.getDetail();
       // console.log()
       // this.form = {
       //   ...this.$route.query,
@@ -449,9 +469,11 @@ export default {
       // this.checkList.push(this.form.preTemplate * 1);
       // this.isinit = false;
     }
+
+    console.log(this.form, "form");
   },
   methods: {
-        async getDetail() {
+    async getDetail() {
       try {
         const res = await getRoomInfo({ roomUid: this.$route.query.roomUid });
         this.name = "修改直播间";
@@ -462,13 +484,13 @@ export default {
           schoolIds: [],
           teamIds: [],
           catIds: [],
-          studentIds: [],
+          studentIds: []
         };
         this.form.roomConfig = JSON.parse(res.data.roomConfig);
         if (res.data.popularizeOrgIds) {
           this.form.organIds = res.data.popularizeOrgIds
             .split(",")
-            .map((item) => {
+            .map(item => {
               return item * 1;
             });
         }
@@ -476,7 +498,7 @@ export default {
         if (res.data.popularizeSchoolIds) {
           this.form.schoolIds = res.data.popularizeSchoolIds
             .split(",")
-            .map((item) => {
+            .map(item => {
               return item * 1;
             });
         }
@@ -501,14 +523,14 @@ export default {
       this.$router.push("/liveClassManager");
     },
     changeTeacher(val) {
-      this.teacherList.forEach((item) => {
+      this.teacherList.forEach(item => {
         if (val == item.id) {
           this.form.speakerName = item.realName;
         }
       });
     },
     preLook() {
-      this.$refs.form.validate((flag) => {
+      this.$refs.form.validate(flag => {
         if (flag) {
           this.preLookVisible = true;
           console.log("预览", this.form);
@@ -535,25 +557,25 @@ export default {
           method: "get",
           headers: {
             Authorization: getToken(),
-            tenantId: getTenantId(),
+            tenantId: getTenantId()
           },
           params: {
             rows: 9999,
             search: query,
-            lockFlag:0,
-            demissionFlag:false
+            lockFlag: 0,
+            demissionFlag: false
           },
-          url,
+          url
         };
         this.remoteLoading = true;
         // this.studentList = []
-        axios(options).then((res) => {
+        axios(options).then(res => {
           this.remoteLoading = false;
           let result = res.data;
           if (result.code == 200) {
             // Array.prototype.splice.apply(this.studentList, result.data.rows);
             if (result.data && result.data.rows.length > 0) {
-              result.data.rows.forEach((item) => {
+              result.data.rows.forEach(item => {
                 this.teacherList.unshift(item);
               });
               this.teacherList = this.deweight(this.teacherList, "phone");
@@ -572,9 +594,9 @@ export default {
     },
     deweight(arr, key) {
       let res = [];
-      arr.forEach((item) => {
+      arr.forEach(item => {
         let list = [];
-        res.forEach((resitem) => {
+        res.forEach(resitem => {
           list.push(resitem[key]);
         });
         if (list.indexOf(item[key]) === -1) {
@@ -593,7 +615,7 @@ export default {
       this.form.popularizeOrgIds = this.form.organIds.join(",");
       this.form.popularizeSchoolIds = this.form.schoolIds.join(",");
       this.form.popularizeTeamIds = this.form.teamIds.join(",");
-      this.$refs.form.validate(async (flag) => {
+      this.$refs.form.validate(async flag => {
         if (!flag) return;
         if (this.$route.query.id) {
           // 修改
@@ -632,7 +654,7 @@ export default {
       if (this.form.popularizeType == "SCHOOL" && val && val.length > 0) {
         let organId = val.join(",");
         try {
-          await queryByOrganId({ organId }).then((res) => {
+          await queryByOrganId({ organId }).then(res => {
             if (res.code == 200) {
               this.cooperationList = res.data;
             }
@@ -644,7 +666,7 @@ export default {
       if (this.form.popularizeType == "TEAM" && val && val.length > 0) {
         let organId = val.join(",");
         try {
-          await getTeamList({ organId, page: 1, rows: 9999 }).then((res) => {
+          await getTeamList({ organId, page: 1, rows: 9999 }).then(res => {
             if (res.code == 200) {
               this.teamList = res.data.rows;
             }
@@ -653,8 +675,8 @@ export default {
           console.log(e);
         }
       }
-    },
-  },
+    }
+  }
 };
 </script>
 <style lang="scss" scoped>