浏览代码

销售直播代码 修改直播间 样式

yuhongqi 1 月之前
父节点
当前提交
57efbeff46

+ 17 - 0
src/api/live/live.js

@@ -81,3 +81,20 @@ export function verifyIdInfo(data) {
     data: data
   })
 }
+//上下架视频
+export function handleShelfOrUn(data) {
+  return request({
+    url: '/live/live/handleShelfOrUn',
+    method: 'post',
+    data: data
+  })
+}
+
+
+export function handleDeleteSelected(data) {
+  return request({
+    url: '/live/live/handleDeleteSelected',
+    method: 'post',
+    data: data
+  })
+}

+ 18 - 0
src/api/live/liveGoods.js

@@ -60,3 +60,21 @@ export function listStoreProduct(data) {
     params: data
   })
 }
+
+//上下架商品
+export function handleShelfOrUn(data) {
+  return request({
+    url: '/live/liveGoods/handleShelfOrUn',
+    method: 'post',
+    data: data
+  })
+}
+
+
+export function handleDeleteSelected(data) {
+  return request({
+    url: '/live/liveGoods/handleDeleteSelected',
+    method: 'post',
+    data: data
+  })
+}

+ 53 - 0
src/api/live/liveLotteryConf.js

@@ -0,0 +1,53 @@
+import request from '@/utils/request'
+
+// 查询直播抽奖配置列表
+export function listLiveLotteryConf(query) {
+  return request({
+    url: '/live/liveLotteryConf/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询直播抽奖配置详细
+export function getLiveLotteryConf(lotteryId) {
+  return request({
+    url: '/live/liveLotteryConf/' + lotteryId,
+    method: 'get'
+  })
+}
+
+// 新增直播抽奖配置
+export function addLiveLotteryConf(data) {
+  return request({
+    url: '/live/liveLotteryConf',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改直播抽奖配置
+export function updateLiveLotteryConf(data) {
+  return request({
+    url: '/live/liveLotteryConf',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除直播抽奖配置
+export function delLiveLotteryConf(lotteryId) {
+  return request({
+    url: '/live/liveLotteryConf/' + lotteryId,
+    method: 'delete'
+  })
+}
+
+// 导出直播抽奖配置
+export function exportLiveLotteryConf(query) {
+  return request({
+    url: '/live/liveLotteryConf/export',
+    method: 'get',
+    params: query
+  })
+}

+ 61 - 0
src/api/live/liveLotteryProductConf.js

@@ -0,0 +1,61 @@
+import request from '@/utils/request'
+
+// 查询直播抽奖记录列表
+export function listLiveLotteryProductConf(query) {
+  return request({
+    url: '/live/liveLotteryProductConf/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询直播抽奖记录详细
+export function getLiveLotteryProductConf(id) {
+  return request({
+    url: '/live/liveLotteryProductConf/' + id,
+    method: 'get'
+  })
+}
+
+//查询抽奖商品列表
+export function listStoreProduct(query) {
+  return request({
+    url: '/live/liveLotteryConf/getGoods/'+query,
+    method: 'get'
+  })
+}
+
+// 新增直播抽奖记录
+export function addLiveLotteryProductConf(data) {
+  return request({
+    url: '/live/liveLotteryProductConf',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改直播抽奖记录
+export function updateLiveLotteryProductConf(data) {
+  return request({
+    url: '/live/liveLotteryConf/product',
+    method: 'post',
+    data: data
+  })
+}
+
+// 删除直播抽奖记录
+export function delLiveLotteryProductConf(id) {
+  return request({
+    url: '/live/liveLotteryProductConf/' + id,
+    method: 'delete'
+  })
+}
+
+// 导出直播抽奖记录
+export function exportLiveLotteryProductConf(query) {
+  return request({
+    url: '/live/liveLotteryProductConf/export',
+    method: 'get',
+    params: query
+  })
+}

+ 53 - 0
src/api/live/liveRedConf.js

@@ -0,0 +1,53 @@
+import request from '@/utils/request'
+
+// 查询直播红包记录配置列表
+export function listLiveRedConf(query) {
+  return request({
+    url: '/live/liveRedConf/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询直播红包记录配置详细
+export function getLiveRedConf(redId) {
+  return request({
+    url: '/live/liveRedConf/' + redId,
+    method: 'get'
+  })
+}
+
+// 新增直播红包记录配置
+export function addLiveRedConf(data) {
+  return request({
+    url: '/live/liveRedConf',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改直播红包记录配置
+export function updateLiveRedConf(data) {
+  return request({
+    url: '/live/liveRedConf',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除直播红包记录配置
+export function delLiveRedConf(redId) {
+  return request({
+    url: '/live/liveRedConf/' + redId,
+    method: 'delete'
+  })
+}
+
+// 导出直播红包记录配置
+export function exportLiveRedConf(query) {
+  return request({
+    url: '/live/liveRedConf/export',
+    method: 'get',
+    params: query
+  })
+}

+ 14 - 0
src/router/index.js

@@ -255,6 +255,20 @@ export const constantRoutes = [
       }
     ]
   },
+  {
+    path: '/live-config',
+    component: () => import('@/views/live/liveConfig/index.vue'),
+    children: [
+      { path: 'watchReward', component: (resolve) => require(['@/views/live/liveConfig/watchReward.vue'], resolve), name: '观看奖励' },
+      { path: 'liveRedConf', component: (resolve) => require(['@/views/live/liveConfig/liveRedConf.vue'], resolve), name: '红包配置' },
+      { path: 'liveLotteryConf', component: (resolve) => require(['@/views/live/liveConfig/liveLotteryConf.vue'], resolve), name: '抽奖配置' },
+      // { path: 'answer', component: (resolve) => require(['@/views/live/liveConfig/answer.vue'], resolve), name: '答题' },
+      { path: 'goods', component: (resolve) => require(['@/views/live/liveConfig/goods.vue'], resolve), name: '直播商品' },
+      { path: 'watchScore', component: (resolve) => require(['@/views/live/liveConfig/watchScore.vue'], resolve), name: '观看积分' },
+      { path: 'idCard', component: (resolve) => require(['@/views/live/liveConfig/idCard.vue'], resolve), name: '身份认证' },
+      // 其他子路由可以根据需要添加
+    ]
+  },
 
 
 

+ 16 - 1
src/store/index.js

@@ -6,6 +6,7 @@ import tagsView from './modules/tagsView'
 import permission from './modules/permission'
 import settings from './modules/settings'
 import getters from './getters'
+import {LiveWS} from "@/utils/liveWS";
 
 Vue.use(Vuex)
 
@@ -17,7 +18,21 @@ const store = new Vuex.Store({
     permission,
     settings
   },
-  getters
+  getters,
+  state: {
+    liveWs: null
+  },
+  mutations: {
+    setLiveWs(state, ws) {
+      state.liveWs = ws
+    },
+  },
+  actions: {
+    initLiveWs({ commit }, { liveWsUrl, liveId, userId }) {
+      const ws = new LiveWS(liveWsUrl, liveId, userId)
+      commit('setLiveWs', ws)
+    }
+  }
 })
 
 export default store

+ 166 - 49
src/views/live/live/index.vue

@@ -1,5 +1,40 @@
 <template>
   <div class="app-container">
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          plain
+          icon="el-icon-plus"
+          size="mini"
+          @click="handleAdd"
+          v-hasPermi="['live:live:add']"
+        >新增</el-button>
+      </el-col>
+<!--      <el-col :span="1.5">-->
+<!--        <el-button-->
+<!--          type="success"-->
+<!--          plain-->
+<!--          icon="el-icon-edit"-->
+<!--          size="mini"-->
+<!--          :disabled="single"-->
+<!--          @click="handleUpdate"-->
+<!--          v-hasPermi="['live:live:edit']"-->
+<!--        >修改</el-button>-->
+<!--      </el-col>-->
+<!--      <el-col :span="1.5">-->
+<!--        <el-button-->
+<!--          type="warning"-->
+<!--          plain-->
+<!--          icon="el-icon-download"-->
+<!--          size="mini"-->
+<!--          :loading="exportLoading"-->
+<!--          @click="handleExport"-->
+<!--          v-hasPermi="['live:live:export']"-->
+<!--        >导出</el-button>-->
+<!--      </el-col>-->
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
     <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
       <el-form-item label="直播名称" prop="liveName">
         <el-input
@@ -12,47 +47,29 @@
       </el-form-item>
       <el-form-item>
         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
-        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+<!--        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>-->
+        <el-button icon="el-icon-download" size="mini" v-hasPermi="['live:live:export']" @click="handleExport">导出</el-button>
       </el-form-item>
     </el-form>
-
-    <el-row :gutter="10" class="mb8">
-      <el-col :span="1.5">
-        <el-button
-          type="primary"
-          plain
-          icon="el-icon-plus"
-          size="mini"
-          @click="handleAdd"
-          v-hasPermi="['live:live:add']"
-        >新增</el-button>
-      </el-col>
-      <el-col :span="1.5">
-        <el-button
-          type="success"
-          plain
-          icon="el-icon-edit"
-          size="mini"
-          :disabled="single"
-          @click="handleUpdate"
-          v-hasPermi="['live:live:edit']"
-        >修改</el-button>
-      </el-col>
-      <el-col :span="1.5">
-        <el-button
-          type="warning"
-          plain
-          icon="el-icon-download"
-          size="mini"
-          :loading="exportLoading"
-          @click="handleExport"
-          v-hasPermi="['live:live:export']"
-        >导出</el-button>
-      </el-col>
-      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
-    </el-row>
-
-    <el-table border v-loading="loading" :data="liveList">
+    <div class="selection-toolbar">
+      <el-checkbox :indeterminate="isIndeterminate" v-model="allChecked" @change="toggleSelectAll">
+        {{ multipleSelection.length > 0 ? `已选 ${multipleSelection.length} 条` : '选中本页' }}
+      </el-checkbox>
+      <el-button  plain size="mini" @click="handleShelf">上架</el-button>
+      <el-button  plain size="mini" @click="handleUnshelf">下架</el-button>
+      <el-button  plain size="mini" @click="handleDeleteSelected">删除</el-button>
+<!--      <el-dropdown>-->
+<!--        <el-button plain size="mini">-->
+<!--          更多操作<i class="el-icon-arrow-down el-icon&#45;&#45;right"></i>-->
+<!--        </el-button>-->
+<!--        <el-dropdown-menu slot="dropdown">-->
+<!--          <el-dropdown-item>操作一</el-dropdown-item>-->
+<!--          <el-dropdown-item>操作二</el-dropdown-item>-->
+<!--        </el-dropdown-menu>-->
+<!--      </el-dropdown>-->
+    </div>
+    <el-table ref="liveTable" v-loading="loading" :data="liveList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55"></el-table-column>
       <el-table-column label="直播封面" align="center" prop="liveImgUrl" width="180">
         <template slot-scope="scope">
           <el-image style="width: 180px;" :src="scope.row.liveImgUrl" mode="aspectFill" :preview-src-list="[scope.row.liveImgUrl]" />
@@ -109,14 +126,14 @@
             icon="el-icon-monitor"
             @click="handleConfig(scope.row)"
             v-hasPermi="['live:config:list']"
-          >配置</el-button>
+          >管理</el-button>
           <el-button
             size="mini"
             type="text"
             icon="el-icon-monitor"
             @click="handleManage(scope.row)"
             v-hasPermi="['live:console:list']"
-          >管理</el-button>
+          >进入直播间</el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -203,7 +220,7 @@
 </template>
 
 <script>
-import { listLive, getLive, delLive, addLive, updateLive, exportLive,selectCompanyTalent } from "@/api/live/live";
+import { listLive, getLive, delLive, addLive, updateLive, exportLive,selectCompanyTalent,handleShelfOrUn,handleDeleteSelected } from "@/api/live/live";
 import Editor from '@/components/Editor/wang';
 import user from '@/store/modules/user';
 
@@ -283,13 +300,100 @@ export default {
         talentId: [
           { required: true, message: "不能为空", trigger: "change" }
         ]
-      }
+      },
+      multipleSelection: [],
+      allChecked: false,
+      isIndeterminate: false,
     };
   },
   created() {
     this.getList();
   },
   methods: {
+    handleShelf(){
+      if (this.multipleSelection.length > 0) {
+        var liveList = []
+          this.multipleSelection.forEach(item => {
+            liveList.push(item.liveId);
+          })
+        handleShelfOrUn({"liveIds":liveList,"isShow":1}).then(res=>{
+          if (res.code == 200) {
+            this.getList();
+            this.$refs.liveTable.clearSelection();
+          } else {
+            this.$message.error(res.msg);
+          }
+        })
+      } else {
+        this.$message.info("请选择上架直播!")
+      }
+
+    },
+    handleUnshelf(){
+      if (this.multipleSelection.length > 0) {
+        var liveList = []
+        this.multipleSelection.forEach(item => {
+          console.log(typeof(item.liveId))
+          console.log(item.liveId)
+          liveList.push(item.liveId);
+        })
+        handleShelfOrUn({"liveIds":liveList,"isShow":2}).then(res=>{
+          if (res.code == 200) {
+            this.getList();
+            this.$refs.liveTable.clearSelection();
+          } else {
+            this.$message.error(res.msg);
+          }
+        })
+      } else {
+        this.$message.info("请选择下架直播!")
+      }
+    },
+    handleDeleteSelected(){
+      if (this.multipleSelection.length > 0) {
+        var liveList = []
+        this.multipleSelection.forEach(item => {
+          liveList.push(item.liveId);
+        })
+        handleDeleteSelected({"liveIds":liveList}).then(res=>{
+          if (res.code == 200) {
+            this.getList();
+            this.$refs.liveTable.clearSelection();
+          } else {
+            this.$message.error(res.msg);
+          }
+        })
+      } else {
+        this.$message.info("请选择被删除的直播!")
+      }
+    },
+    // 全选或取消全选
+    toggleSelectAll(val) {
+      this.checked = val; // 更新 checkbox 的状态
+      if (val) {
+        // 如果 checkbox 被选中,则全选
+        this.toggleSelection(this.liveList);
+      } else {
+        // 如果 checkbox 被取消选中,则取消全选
+        this.toggleSelection();
+      }
+    },
+    toggleSelection(rows) {
+      if (rows && !this.isIndeterminate) {
+        rows.forEach(row => {
+          this.$refs.liveTable.toggleRowSelection(row);
+        });
+      } else {
+        this.$refs.liveTable.clearSelection();
+      }
+    },
+    // 多选框选中数据
+    handleSelectionChange(val) {
+      this.multipleSelection = val;
+      // 根据选择项的数量更新 checkbox 的状态
+      this.allChecked = val.length === this.liveList.length;
+      this.isIndeterminate = val.length > 0 && val.length < this.liveList.length;
+    },
     /** 查询直播列表 */
     getList() {
       this.loading = true;
@@ -377,12 +481,7 @@ export default {
       this.resetForm("queryForm");
       this.handleQuery();
     },
-    // 多选框选中数据
-    handleSelectionChange(selection) {
-      this.ids = selection.map(item => item.liveId)
-      this.single = selection.length!==1
-      this.multiple = !selection.length
-    },
+
     /** 新增按钮操作 */
     handleAdd() {
       this.reset();
@@ -480,3 +579,21 @@ export default {
   }
 };
 </script>
+
+<style scoped>
+.selection-toolbar {
+  display: flex;
+  align-items: center;
+  margin-bottom: 10px;
+  padding-left: 10px;
+}
+
+.selection-toolbar .el-checkbox {
+  margin-right: 10px;
+}
+
+/* 调整 checkbox 内部输入框的对齐 */
+.selection-toolbar .el-checkbox .el-checkbox__inner {
+  top: 8px; /* 根据实际需求调整 */
+}
+</style>

+ 260 - 0
src/views/live/liveConfig/answer.vue

@@ -0,0 +1,260 @@
+<template>
+  <div class="container-md">
+    <div class="tip-box">
+      选择用于本节直播课程的题库试题,试题可用于直播间内发送
+      <el-link
+        type="primary"
+        style="margin-left: 5px;"
+        @click="handleToQuestionBank"
+      >配置题库试题 >></el-link>
+    </div>
+
+    <el-button type="primary" icon="el-icon-plus" style="margin: 20px 0;" @click="handleAddQuestion">添加试题</el-button>
+    <!-- 试题列表表格 -->
+    <el-table
+      :data="questionLiveList"
+      style="width: 100%"
+      v-loading="loading"
+    >
+      <!-- 题干列:显示试题的主要内容 -->
+      <el-table-column
+        prop="title"
+        label="题干"
+        show-overflow-tooltip
+      ></el-table-column>
+
+      <!-- 题型列:显示是单选还是多选 -->
+      <el-table-column
+        prop="type"
+        label="题型"
+      >
+        <template slot-scope="scope">
+          {{ scope.row.type === 1 ? '单选题' : '多选题' }}
+        </template>
+      </el-table-column>
+
+      <!-- 创建时间列:显示试题创建的时间 -->
+      <el-table-column
+        prop="createTime"
+        label="创建时间"
+      ></el-table-column>
+
+      <!-- 操作列:包含编辑和删除按钮 -->
+      <el-table-column
+        label="操作"
+        width="180"
+        fixed="right"
+      >
+        <template slot-scope="scope">
+          <!-- 删除按钮:用于移除试题 -->
+          <el-button
+            type="text"
+            size="small"
+            style="color: #F56C6C;"
+            @click="handleDelete(scope.row)"
+          >删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <!-- 分页组件:用于分页展示试题列表 -->
+    <pagination
+      v-show="questionTotal > 0"
+      :total="questionTotal"
+      :page.sync="questionParams.pageNum"
+      :limit.sync="questionParams.pageSize"
+      @pagination="getLiveQuestionLiveList"
+      style="margin-top: 20px;"
+    />
+
+    <!-- 添加试题弹窗 -->
+    <el-dialog
+      title="添加试题"
+      :visible.sync="questionDialogVisible"
+      width="800px"
+      :close-on-click-modal="false"
+      :close-on-press-escape="false"
+    >
+      <div class="dialog-content">
+        <div style="text-align: right; margin-bottom: 20px;">
+          <el-input
+            v-model="searchTitle"
+            placeholder="请输入搜索内容"
+            style="width: 300px;"
+            @input="handleQuestionSearch"
+          ></el-input>
+        </div>
+
+        <el-table
+          ref="questionTable"
+          :data="questionList"
+          style="width: 100%"
+          v-loading="questionLoading"
+          @selection-change="handleSelectionChange"
+          @row-click="handleRowClick"
+          row-key="id"
+        >
+          <!-- 复选框列:用于多选试题 -->
+          <el-table-column
+            type="selection"
+            width="55"
+          >
+          </el-table-column>
+          <!-- 题干列:显示试题的主要内容 -->
+          <el-table-column
+            prop="title"
+            label="题干"
+            class-name="clickable-column"
+          ></el-table-column>
+          <!-- 题型列:显示单选或多选 -->
+          <el-table-column
+            prop="type"
+            label="题型"
+            class-name="clickable-column"
+          >
+            <template slot-scope="scope">
+              {{ scope.row.type === 1 ? '单选题' : '多选题' }}
+            </template>
+          </el-table-column>
+          <!-- 创建人列 -->
+          <el-table-column
+            prop="createBy"
+            label="创建人"
+            class-name="clickable-column"
+          ></el-table-column>
+          <!-- 创建时间列 -->
+          <el-table-column
+            prop="createTime"
+            label="创建时间"
+            width="150"
+            class-name="clickable-column"
+          ></el-table-column>
+        </el-table>
+
+        <pagination
+          v-show="total > 0"
+          :total="total"
+          :page.sync="queryParams.pageNum"
+          :limit.sync="queryParams.pageSize"
+          @pagination="getQuestionList"
+          style="margin-top: 20px;"
+        />
+      </div>
+      <div slot="footer" class="dialog-footer">
+        <div style="display: flex; justify-content: space-between; align-items: center;">
+          <span class="selected-count">当前已选择 <span style="color: #00BFFF; font-style: italic;">{{ selectedQuestions.length }}</span> 题</span>
+          <div>
+            <el-button @click="questionDialogVisible = false">取 消</el-button>
+            <el-button type="primary" @click="confirmAddQuestion">确 定</el-button>
+          </div>
+        </div>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+
+import {addLiveQuestionLive, listLiveQuestionLive, listLiveQuestionOptionList} from "@/api/live/liveQuestionLive";
+
+export default {
+  data() {
+    return {
+      questionDialogVisible: false,
+      questionLoading: false,
+      questionTotal: 0,
+      selectedQuestions: [],
+      questionLiveList: [],
+      questionList: [],
+      loading: true,
+      searchTitle: '',
+      total: 0,
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        title: null,
+        liveId: null
+      },
+      questionParams: {
+        pageNum: 1,
+        pageSize: 10,
+        liveId: null
+      },
+    };
+  },
+  created() {
+    this.liveId = this.$route.params.liveId
+    this.queryParams.liveId = this.liveId
+    this.questionParams.liveId = this.liveId
+    this.getLiveQuestionLiveList()
+  },
+  methods: {
+    handleQuestionSearch() {
+      this.queryParams.pageNum = 1
+      this.queryParams.title = this.searchTitle
+      this.getQuestionList()
+    },
+    getLiveQuestionLiveList() {
+      this.loading = true
+      listLiveQuestionLive(this.questionParams).then(response => {
+        this.questionLiveList = response.rows
+        this.questionTotal = response.total
+        this.loading = false
+      })
+    },
+    handleToQuestionBank() {
+      this.$router.push('/live/liveQuestionBank')
+    },
+    handleAddQuestion() {
+      this.questionDialogVisible = true
+      this.getQuestionList()
+    },
+    getQuestionList() {
+      this.questionLoading = true
+      listLiveQuestionOptionList(this.queryParams).then(response => {
+        this.questionList = response.rows
+        this.total = response.total
+        this.questionLoading = false
+      })
+    },
+    handleSelectionChange(selection) {
+      this.selectedQuestions = selection
+    },
+    confirmAddQuestion() {
+      if (this.selectedQuestions.length === 0) {
+        this.$message({
+          message: '请选择要添加的试题',
+          type: 'warning'
+        })
+        return
+      }
+      // 调用添加直播间试题接口
+      addLiveQuestionLive({
+        liveId: this.liveId,
+        questionIds: this.selectedQuestions.map(item => item.id).join(',')
+      }).then(response => {
+        this.questionDialogVisible = false
+        this.getLiveQuestionLiveList()
+      })
+    },
+    handleRowClick(row, column) {
+      // 如果点击的是复选框列,不进行处理
+      if (column.type === 'selection') {
+        return
+      }
+
+      // 获取表格实例
+      const table = this.$refs.questionTable[0]
+      if (!table) {
+        return
+      }
+
+      // 判断当前行是否已经被选中
+      const isSelected = this.selectedQuestions.some(item => item.id === row.id)
+
+      // 切换选中状态
+      table.toggleRowSelection(row, !isSelected)
+    },
+  }
+};
+</script>

+ 369 - 0
src/views/live/liveConfig/goods.vue

@@ -0,0 +1,369 @@
+<template>
+  <div class="el-container-md">
+
+    <div class="selection-toolbar">
+      <el-checkbox :indeterminate="isIndeterminate" v-model="allChecked" @change="toggleSelectAll">
+        {{ multipleSelection.length > 0 ? `已选 ${multipleSelection.length} 条` : '选中本页' }}
+      </el-checkbox>
+      <el-button  plain size="mini" @click="handleShelf">上架</el-button>
+      <el-button  plain size="mini" @click="handleUnshelf">下架</el-button>
+      <el-button  plain size="mini" @click="handleDeleteSelected">删除</el-button>
+      <el-button  plain type="mini" icon="el-icon-plus" @click="handleAddLiveGoods">添加商品</el-button>
+    </div>
+    <el-table
+      ref="goodTable"
+      :data="goodsLiveList"
+      style="width: 100%"
+      v-loading="loading"
+      @selection-change="handleSelectionChange"
+    >
+      <el-table-column type="selection" width="55"></el-table-column>
+      <!-- 题干列:显示试题的主要内容 -->
+      <el-table-column
+        prop="goodsId"
+        label="商品id"
+        show-overflow-tooltip
+      ></el-table-column>
+
+      <el-table-column
+        label="商品图片"
+      >
+        <template slot-scope="scope">
+          <img
+            :src="scope.row.imgUrl"
+            style="display: block; max-width: 100%; width: 100px; height: 100px"
+          />
+        </template>
+
+      </el-table-column>
+
+      <el-table-column
+        prop="productName"
+        label="商品名称"
+      ></el-table-column>
+
+      <el-table-column
+        prop="price"
+        label="价格"
+      ></el-table-column>
+
+      <el-table-column
+        prop="stock"
+        label="库存"
+      ></el-table-column>
+
+      <el-table-column
+        prop="sales"
+        label="销量"
+      ></el-table-column>
+
+      <el-table-column
+        prop="status"
+        label="上下架"
+      >
+        <template slot-scope="scope">
+          <el-tag v-if="scope.row.status == 1">上架</el-tag>
+          <el-tag v-if="scope.row.status == 0">下架</el-tag>
+        </template>
+      </el-table-column>
+
+      <!-- 操作列:包含编辑和删除按钮 -->
+      <el-table-column
+        label="操作"
+        width="180"
+        fixed="right"
+      >
+        <template slot-scope="scope">
+          <el-button
+            type="text"
+            size="small"
+            style="color: #F56C6C;"
+            @click="handleGoodDelete(scope.row)"
+          >删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <!-- 分页组件:用于分页展示试题列表 -->
+    <pagination
+      v-show="goodsLiveTotal > 0"
+      :total="goodsLiveTotal"
+      :page.sync="goodsParams.pageNum"
+      :limit.sync="goodsParams.pageSize"
+      @pagination="getLiveGoodsList"
+      style="margin-top: 20px;"
+    />
+
+    <!-- 添加商品弹窗 -->
+    <el-dialog
+      title="添加商品"
+      :visible.sync="goodsDialogVisible"
+      width="800px"
+      :close-on-click-modal="false"
+      :close-on-press-escape="false"
+    >
+      <div class="dialog-content">
+        <div style="text-align: right; margin-bottom: 20px;">
+          <el-input
+            v-model="searchTitle"
+            placeholder="请输入产品名称"
+            style="width: 300px;"
+            @input="handleGoodsSearch"
+          ></el-input>
+        </div>
+
+        <el-table
+          :data="goodsList"
+          style="width: 100%"
+          v-loading="goodsLoading"
+          @selection-change="handleGoodsChange"
+          @row-click="handleGoodsRowClick"
+          row-key="id"
+        >
+          <el-table-column
+            type="selection"
+            width="55"
+          >
+          </el-table-column>
+          <el-table-column
+            prop="storeName"
+            label="商铺名称"
+            class-name="clickable-column"
+          ></el-table-column>
+          <el-table-column
+            prop="productName"
+            label="产品"
+            class-name="clickable-column"
+          ></el-table-column>
+          <el-table-column
+            prop="price"
+            label="价格"
+            class-name="clickable-column"
+          ></el-table-column>
+          <el-table-column
+            prop="stock"
+            label="库存"
+            class-name="clickable-column"
+          ></el-table-column>
+        </el-table>
+
+        <pagination
+          v-show="goodsTotal > 0"
+          :total="goodsTotal"
+          :page.sync="queryGoodParams.pageNum"
+          :limit.sync="queryGoodParams.pageSize"
+          @pagination="getStoreProductLists"
+          style="margin-top: 20px;"
+        />
+      </div>
+      <div slot="footer" class="dialog-footer">
+        <div style="display: flex; justify-content: space-between; align-items: center;">
+          <span class="selected-count">当前已选择 <span style="color: #00BFFF; font-style: italic;">{{ selectedGoods.length }}</span> 商品</span>
+          <div>
+            <el-button @click="goodsDialogVisible = false">取 消</el-button>
+            <el-button type="primary" @click="confirmAddGoods">确 定</el-button>
+          </div>
+        </div>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import {addLiveGoods, delLiveGoods, listLiveGoods, listStoreProduct, handleShelfOrUn, handleDeleteSelected} from "@/api/live/liveGoods";
+
+export default {
+
+  data() {
+    return {
+      liveId: '',
+      loading: true,
+      searchTitle: '',
+      queryGoodParams: {
+        pageNum: 1,
+        pageSize: 10,
+        productName: null,
+        liveId: null
+      },
+      goodsLiveList: [],
+      goodsLiveTotal: 0,
+      goodsParams: {
+        pageNum: 1,
+        pageSize: 10,
+        liveId: null
+      },
+      goodsList: [],
+      goodsTotal: 0,
+      selectedGoods: [],
+      goodsLoading: false,
+      goodsDialogVisible: false,
+      multipleSelection: [],
+      allChecked: false,
+      isIndeterminate: false,
+    };
+  },
+  created() {
+    this.liveId = this.$route.params.liveId
+    this.goodsParams.liveId = this.liveId
+    this.getLiveGoodsList();
+  },
+  methods: {
+    handleShelf(){
+      this.handleShelfOrUn(1)
+    },
+    handleUnshelf(){
+      this.handleShelfOrUn(0)
+    },
+    handleShelfOrUn(type){
+      if (this.multipleSelection.length > 0) {
+        const goodsList = this.getSelectedList();
+        handleShelfOrUn({"goodsIds":goodsList,"status":type}).then(res=>{
+          this.dealResult(res)
+        })
+      } else {
+        this.$message.info("请选择下架商品!")
+      }
+    },
+    handleDeleteSelected(){
+      if (this.multipleSelection.length > 0) {
+        const goodsList = this.getSelectedList();
+        handleDeleteSelected({"goodsIds":goodsList}).then(res=>{
+          this.dealResult(res)
+        })
+      } else {
+        this.$message.info("请选择被删除的商品!")
+      }
+    },
+    dealResult(res){
+      if (res.code == 200) {
+        this.getLiveGoodsList();
+        this.$refs.goodTable.clearSelection();
+      } else {
+        this.$message.error(res.msg);
+      }
+    },
+    getSelectedList(){
+      var goodsList = []
+      this.multipleSelection.forEach(item => {
+        goodsList.push(item.goodsId);
+      })
+      return goodsList;
+    },
+    // 全选或取消全选
+    toggleSelectAll(val) {
+      this.checked = val; // 更新 checkbox 的状态
+      if (val) {
+        // 如果 checkbox 被选中,则全选
+        this.toggleSelection(this.goodsLiveList);
+      } else {
+        // 如果 checkbox 被取消选中,则取消全选
+        this.toggleSelection();
+      }
+    },
+    toggleSelection(rows) {
+      if (rows && !this.isIndeterminate) {
+        rows.forEach(row => {
+          this.$refs.goodTable.toggleRowSelection(row);
+        });
+      } else {
+        this.$refs.goodTable.clearSelection();
+      }
+    },
+    // 多选框选中数据
+    handleSelectionChange(val) {
+      this.multipleSelection = val;
+      // 根据选择项的数量更新 checkbox 的状态
+      this.allChecked = val.length === this.goodsLiveList.length;
+      this.isIndeterminate = val.length > 0 && val.length < this.goodsLiveList.length;
+    },
+
+    getLiveGoodsList() {
+      this.loading = true
+      listLiveGoods(this.goodsParams).then(response => {
+        this.goodsLiveList = response.rows
+        this.goodsLiveTotal = response.total
+        this.loading = false
+      })
+    },
+    handleAddLiveGoods(){
+      this.goodsDialogVisible = true;
+      this.getStoreProductLists()
+    },
+    handleGoodsSearch(){
+      this.queryGoodParams.pageNum = 1
+      this.queryGoodParams.productName = this.searchTitle
+      this.getStoreProductLists()
+    },
+    handleGoodsChange(goods) {
+      this.selectedGoods = goods
+    },
+    confirmAddGoods(){
+      if (this.selectedGoods.length === 0) {
+        this.$message({
+          message: '请选择要添加的商品',
+          type: 'warning'
+        })
+        return
+      }
+      addLiveGoods({
+        liveId: this.liveId,
+        productsId: this.selectedGoods.map(item => item.productId).join(',')
+      }).then(response => {
+        this.goodsDialogVisible = false
+        this.getLiveGoodsList()
+      })
+    },
+    handleGoodDelete(row){
+      delLiveGoods(row.goodsId).then(response => {
+        this.getLiveGoodsList()
+      })
+    },
+    /** 处理行点击事件 */
+    handleGoodsRowClick(row, column) {
+      // 如果点击的是复选框列,不进行处理
+      if (column.type === 'selection') {
+        return
+      }
+
+      // 获取表格实例
+      const table = this.$refs.goodsTable[0]
+      if (!table) {
+        return
+      }
+
+      // 判断当前行是否已经被选中
+      const isSelected = this.selectedGoods.some(item => item.id === row.id)
+
+      // 切换选中状态
+      table.toggleRowSelection(row, !isSelected)
+    },
+    getStoreProductLists() {
+      this.queryGoodParams.liveId = this.liveId
+      listStoreProduct(this.queryGoodParams).then(response => {
+        this.goodsList = response.rows
+        this.goodsTotal = response.total
+        this.loading = false
+      })
+    }
+
+  }
+};
+</script>
+
+<style scoped>
+.selection-toolbar {
+  display: flex;
+  align-items: center;
+  margin-bottom: 10px;
+  padding-left: 10px;
+}
+
+.selection-toolbar .el-checkbox {
+  margin-right: 10px;
+}
+
+/* 调整 checkbox 内部输入框的对齐 */
+.selection-toolbar .el-checkbox .el-checkbox__inner {
+  top: 8px; /* 根据实际需求调整 */
+}
+</style>

+ 2 - 6
src/views/live/liveConfig/idCard.vue

@@ -15,19 +15,15 @@ import {verifyIdInfo, getLive} from '@/api/live/live'
 
 export default {
   components: { ImageUpload },
-  props: {
-    liveId: {
-      type: String,
-      default: "",
-    },
-  },
   data() {
     return {
       test: "1test",
       idCardUrl: "",
+      liveId: this.liveInfo.liveId,
     };
   },
   created() {
+    this.liveId = this.$route.params.liveId
     getLive(this.liveId).then(res => {
       this.idCardUrl = res.data.idCardUrl;
     })

+ 208 - 954
src/views/live/liveConfig/index.vue

@@ -1,1030 +1,284 @@
 <template>
   <div class="live-config-container">
-    <!-- 根tabs -->
-    <el-tabs v-model="rootActiveName" @tab-click="handleClick" class="white-bg-tabs">
-      <el-tab-pane v-for="item in rootTabs" :key="item.name" :label="item.label" :name="item.name">
-        <!-- 营销内容 start -->
-        <el-tabs v-if="item.name == 'market'" v-model="marketActiveName" type="card" @tab-click="handleTabClick">
-          <el-tab-pane v-for="marketItem in marketTabs" :key="marketItem.name" :label="marketItem.label" :name="marketItem.name" class="market-tab-pane">
-            <!-- 观看奖励 start -->
-            <template>
-              <div v-if="marketItem.name == 'watchReward'">
-                <!-- 提示信息 -->
-                <div class="tip-message">
-                  设置观看奖励,用户达到直播观看时长后可领取奖励
-                </div>
-
-                <!-- 开启观看奖励开关 -->
-                <div class="reward-switch">
-                  <span class="switch-label">开启观看奖励</span>
-                  <el-switch v-model="watchRewardForm.enabled"></el-switch>
-                </div>
-
-                <!-- 观看奖励设置 -->
-                <div v-if="watchRewardForm.enabled" class="section-block">
-                  <div class="section-title">观看奖励设置</div>
-
-                  <!-- 表单内容 -->
-                  <el-form
-                    :model="watchRewardForm"
-                    :rules="rules"
-                    ref="watchRewardForm"
-                    label-width="130px"
-                  >
-                    <!-- 参与条件 -->
-                    <el-form-item label="参与条件" prop="participateCondition">
-                      <el-radio v-model="watchRewardForm.participateCondition" label="1">
-                        达到指定观看时长
-                      </el-radio>
-                    </el-form-item>
-
-                    <!-- 观看时长 -->
-                    <el-form-item label="观看时长" prop="watchDuration">
-                      <el-input v-model="watchRewardForm.watchDuration" placeholder="请输入观看时长" class="duration-input">
-                        <template #append>分钟</template>
-                      </el-input>
-                    </el-form-item>
-
-                    <!-- 实施动作 -->
-                    <el-form-item label="实施动作" prop="action">
-                      <el-select v-model="watchRewardForm.action" placeholder="请选择实施动作" style="width: 300px;">
-                        <el-option
-                          v-for="item in actionOptions"
-                          :key="item.value"
-                          :label="item.label"
-                          :value="item.value"
-                        ></el-option>
-                      </el-select>
-                    </el-form-item>
-
-                    <!-- 领取提示语 -->
-                    <el-form-item label="领取提示语" prop="receivePrompt">
-                      <el-input v-model="watchRewardForm.receivePrompt" placeholder="请输入领取提示语"></el-input>
-                    </el-form-item>
-
-                    <!-- 红包设置 -->
-                    <div>
-                      <div class="section-title">红包设置</div>
-
-                      <!-- 根据实施动作类型显示不同的表单内容 -->
-                      <template v-if="watchRewardForm.action === '1'">
-                        <!-- 现金红包设置 -->
-                        <!-- 红包发放方式   1固定金额 2随机金额 -->
-                        <el-form-item label="红包发放方式" prop="redPacketType">
-                          <el-radio-group v-model="watchRewardForm.redPacketType">
-                            <el-radio label="1">固定金额</el-radio>
-                            <el-radio label="2">随机金额</el-radio>
-                          </el-radio-group>
-                        </el-form-item>
-
-                        <!-- 红包金额 -->
-                        <el-form-item label="红包金额" prop="redPacketAmount">
-                          <el-input v-model="watchRewardForm.redPacketAmount" placeholder="请输入红包金额"></el-input>
-                        </el-form-item>
-
-                        <!-- 红包发放数量 -->
-                        <el-form-item label="红包发放数量" prop="redPacketCount">
-                          <el-input v-model="watchRewardForm.redPacketCount" placeholder="红包数量+28888人数"></el-input>
-                        </el-form-item>
-
-                        <!-- 红包领取方式  1二维码核销 2微信提现 -->
-                        <el-form-item label="红包领取方式" prop="receiveMethod">
-                          <el-radio-group v-model="watchRewardForm.receiveMethod">
-                            <el-radio label="1">二维码领取</el-radio>
-                            <el-radio label="2">微信发放</el-radio>
-                          </el-radio-group>
-                        </el-form-item>
-                      </template>
-
-                      <template v-else>
-                        <!-- 积分红包设置 -->
-                        <!-- 积分值 -->
-                        <el-form-item label="积分值" prop="scoreAmount">
-                          <el-input
-                            v-model="watchRewardForm.scoreAmount"
-                            placeholder="请输入积分值"                style="width: 300px;"
-                          ></el-input>
-                        </el-form-item>
-
-                        <!-- 最大领取人数 -->
-                        <el-form-item label="最大领取人数" prop="maxReceivers">
-                          <el-input
-                            v-model="watchRewardForm.maxReceivers"
-                            placeholder="请输入最大领取人数"                style="width: 300px;"
-                          ></el-input>
-                        </el-form-item>
-                      </template>
-                    </div>
-
-                    <!-- 其他设置 -->
-                    <div >
-                      <div class="section-title">其他设置</div>
-
-                      <template v-if="watchRewardForm.action === '1'">
-                        <!-- 客服引导  1跟进企业微信 2不设置 -->
-                        <el-form-item label="客服引导" prop="showGuide">
-                          <el-radio-group v-model="watchRewardForm.showGuide">
-                            <el-radio label="1">跟进企业微信</el-radio>
-                            <el-radio label="2">不设置</el-radio>
-                          </el-radio-group>
-                        </el-form-item>
-
-                        <!-- 客服引导语 -->
-                        <el-form-item label="客服引导语" prop="guideText">
-                          <el-input
-                            v-model="watchRewardForm.guideText"
-                            placeholder="请输入客服引导语"                style="width: 300px;"
-                          ></el-input>
-                        </el-form-item>
-                      </template>
-
-                      <template v-else>
-                        <!-- 积分使用引导语 -->
-                        <el-form-item label="积分使用引导语" prop="scoreGuideText">
-                          <el-input
-                            v-model="watchRewardForm.scoreGuideText"
-                            placeholder="请输入积分使用引导语"                style="width: 300px;"
-                          ></el-input>
-                        </el-form-item>
-
-                        <!-- 积分使用引导链接 -->
-                        <el-form-item label="积分使用引导链接" prop="scoreGuideLink">
-                          <el-input
-                            v-model="watchRewardForm.scoreGuideLink"
-                            placeholder="请输入积分使用引导链接"                style="width: 300px;"
-                          ></el-input>
-                        </el-form-item>
-
-                        <!-- 引导语 -->
-                        <el-form-item label="引导语" prop="guideText">
-                          <el-input
-                            v-model="watchRewardForm.guideText"
-                            placeholder="请输入引导语"                style="width: 300px;"
-                          ></el-input>
-                        </el-form-item>
-                      </template>
-                    </div>
-
-                    <!-- 保存按钮 -->
-                    <div class="form-actions">
-                      <el-button type="primary" @click="saveWatchReward">保存</el-button>
-                    </div>
-                  </el-form>
-                </div>
-              </div>
-            </template>
-
-            <!-- 答题 start -->
-            <div v-if="marketItem.name == 'answer'">
-              <div class="tip-box">
-                选择用于本节直播课程的题库试题,试题可用于直播间内发送
-                <el-link
-                  type="primary"
-                  style="margin-left: 5px;"
-                  @click="handleToQuestionBank"
-                >配置题库试题 >></el-link>
-              </div>
-
-              <el-button type="primary" icon="el-icon-plus" style="margin: 20px 0;" @click="handleAddQuestion">添加试题</el-button>
-              <!-- 试题列表表格 -->
-              <el-table
-                :data="questionLiveList"
-                style="width: 100%"
-                v-loading="loading"
-              >
-                <!-- 题干列:显示试题的主要内容 -->
-                <el-table-column
-                  prop="title"
-                  label="题干"
-                  show-overflow-tooltip
-                ></el-table-column>
-
-                <!-- 题型列:显示是单选还是多选 -->
-                <el-table-column
-                  prop="type"
-                  label="题型"
-                >
-                  <template slot-scope="scope">
-                    {{ scope.row.type === 1 ? '单选题' : '多选题' }}
-                  </template>
-                </el-table-column>
-
-                <!-- 创建时间列:显示试题创建的时间 -->
-                <el-table-column
-                  prop="createTime"
-                  label="创建时间"
-                ></el-table-column>
-
-                <!-- 操作列:包含编辑和删除按钮 -->
-                <el-table-column
-                  label="操作"
-                  width="180"
-                  fixed="right"
-                >
-                  <template slot-scope="scope">
-                    <!-- 删除按钮:用于移除试题 -->
-                    <el-button
-                      type="text"
-                      size="small"
-                      style="color: #F56C6C;"
-                      @click="handleDelete(scope.row)"
-                    >删除</el-button>
-                  </template>
-                </el-table-column>
-              </el-table>
-
-              <!-- 分页组件:用于分页展示试题列表 -->
-              <pagination
-                v-show="questionTotal > 0"
-                :total="questionTotal"
-                :page.sync="questionParams.pageNum"
-                :limit.sync="questionParams.pageSize"
-                @pagination="getLiveQuestionLiveList"
-                style="margin-top: 20px;"
-              />
-
-              <!-- 添加试题弹窗 -->
-              <el-dialog
-                title="添加试题"
-                :visible.sync="questionDialogVisible"
-                width="800px"
-                :close-on-click-modal="false"
-                :close-on-press-escape="false"
-              >
-                <div class="dialog-content">
-                  <div style="text-align: right; margin-bottom: 20px;">
-                    <el-input
-                      v-model="searchTitle"
-                      placeholder="请输入搜索内容"
-                      style="width: 300px;"
-                      @input="handleQuestionSearch"
-                    ></el-input>
-                  </div>
-
-                  <el-table
-                    ref="questionTable"
-                    :data="questionList"
-                    style="width: 100%"
-                    v-loading="questionLoading"
-                    @selection-change="handleSelectionChange"
-                    @row-click="handleRowClick"
-                    row-key="id"
-                  >
-                    <!-- 复选框列:用于多选试题 -->
-                    <el-table-column
-                      type="selection"
-                      width="55"
-                    >
-                    </el-table-column>
-                    <!-- 题干列:显示试题的主要内容 -->
-                    <el-table-column
-                      prop="title"
-                      label="题干"
-                      class-name="clickable-column"
-                    ></el-table-column>
-                    <!-- 题型列:显示单选或多选 -->
-                    <el-table-column
-                      prop="type"
-                      label="题型"
-                      class-name="clickable-column"
-                    >
-                      <template slot-scope="scope">
-                        {{ scope.row.type === 1 ? '单选题' : '多选题' }}
-                      </template>
-                    </el-table-column>
-                    <!-- 创建人列 -->
-                    <el-table-column
-                      prop="createBy"
-                      label="创建人"
-                      class-name="clickable-column"
-                    ></el-table-column>
-                    <!-- 创建时间列 -->
-                    <el-table-column
-                      prop="createTime"
-                      label="创建时间"
-                      width="150"
-                      class-name="clickable-column"
-                    ></el-table-column>
-                  </el-table>
-
-                  <pagination
-                    v-show="total > 0"
-                    :total="total"
-                    :page.sync="queryParams.pageNum"
-                    :limit.sync="queryParams.pageSize"
-                    @pagination="getQuestionList"
-                    style="margin-top: 20px;"
-                  />
-                </div>
-                <div slot="footer" class="dialog-footer">
-                  <div style="display: flex; justify-content: space-between; align-items: center;">
-                    <span class="selected-count">当前已选择 <span style="color: #00BFFF; font-style: italic;">{{ selectedQuestions.length }}</span> 题</span>
-                    <div>
-                      <el-button @click="questionDialogVisible = false">取 消</el-button>
-                      <el-button type="primary" @click="confirmAddQuestion">确 定</el-button>
-                    </div>
-                  </div>
-                </div>
-              </el-dialog>
+    <el-card class="box-card live-config-header">
+      <div class="detail-header">
+        <div class="header-left-area">
+          <img :src="liveInfo.liveImgUrl" alt="直播封面">
+          <!-- 加载遮罩 -->
+          <div class="ss-loading-mask" style="display: none;">
+            <div class="ss-loading-spinner is-module-loading">
+              <div class="ss-loading-dot-flashing"></div>
             </div>
-            <!-- 答题 end -->
-
-            <!-- 直播商品start -->
-            <div v-if="marketItem.name == 'goods'">
-
-              <el-button type="primary" icon="el-icon-plus" style="margin: 20px 0;" @click="handleAddLiveGoods">添加商品</el-button>
-              <el-table
-                :data="goodsLiveList"
-                style="width: 100%"
-                v-loading="loading"
-              >
-                <!-- 题干列:显示试题的主要内容 -->
-                <el-table-column
-                  prop="goodsId"
-                  label="商品id"
-                  show-overflow-tooltip
-                ></el-table-column>
-
-                <el-table-column
-                  label="商品图片"
-                >
-                  <template slot-scope="scope">
-                    <img
-                      :src="scope.row.imgUrl"
-                      style="display: block; max-width: 100%; width: 100px; height: 100px"
-                    />
-                  </template>
-
-                </el-table-column>
-
-                <el-table-column
-                  prop="productName"
-                  label="商品名称"
-                ></el-table-column>
-
-                <el-table-column
-                  prop="price"
-                  label="价格"
-                ></el-table-column>
-
-                <el-table-column
-                  prop="stock"
-                  label="库存"
-                ></el-table-column>
-
-                <el-table-column
-                  prop="sales"
-                  label="销量"
-                ></el-table-column>
-
-                <!-- 操作列:包含编辑和删除按钮 -->
-                <el-table-column
-                  label="操作"
-                  width="180"
-                  fixed="right"
-                >
-                  <template slot-scope="scope">
-                    <el-button
-                      type="text"
-                      size="small"
-                      style="color: #F56C6C;"
-                      @click="handleGoodDelete(scope.row)"
-                    >删除</el-button>
-                  </template>
-                </el-table-column>
-              </el-table>
-
-              <!-- 分页组件:用于分页展示试题列表 -->
-              <pagination
-                v-show="goodsTotal > 0"
-                :total="goodsTotal"
-                :page.sync="goodsParams.pageNum"
-                :limit.sync="goodsParams.pageSize"
-                @pagination="getLiveGoodsList"
-                style="margin-top: 20px;"
-              />
-
-              <!-- 添加商品弹窗 -->
-              <el-dialog
-                title="添加商品"
-                :visible.sync="goodsDialogVisible"
-                width="800px"
-                :close-on-click-modal="false"
-                :close-on-press-escape="false"
-              >
-                <div class="dialog-content">
-                  <div style="text-align: right; margin-bottom: 20px;">
-                    <el-input
-                      v-model="searchTitle"
-                      placeholder="请输入搜索内容"
-                      style="width: 300px;"
-                      @input="handleGoodsSearch"
-                    ></el-input>
-                  </div>
-
-                  <el-table
-                    ref="goodsTable"
-                    :data="goodsList"
-                    style="width: 100%"
-                    v-loading="goodsLoading"
-                    @selection-change="handleGoodsChange"
-                    @row-click="handleGoodsRowClick"
-                    row-key="id"
-                  >
-                    <el-table-column
-                      type="selection"
-                      width="55"
-                    >
-                    </el-table-column>
-                    <el-table-column
-                      prop="storeName"
-                      label="商铺名称"
-                      class-name="clickable-column"
-                    ></el-table-column>
-                    <el-table-column
-                      prop="productName"
-                      label="产品"
-                      class-name="clickable-column"
-                    ></el-table-column>
-                    <el-table-column
-                      prop="price"
-                      label="价格"
-                      class-name="clickable-column"
-                    ></el-table-column>
-                    <el-table-column
-                      prop="stock"
-                      label="库存"
-                      class-name="clickable-column"
-                    ></el-table-column>
-                  </el-table>
-
-                  <pagination
-                    v-show="total > 0"
-                    :total="total"
-                    :page.sync="queryParams.pageNum"
-                    :limit.sync="queryParams.pageSize"
-                    @pagination="getStoreProductLists"
-                    style="margin-top: 20px;"
-                  />
-                </div>
-                <div slot="footer" class="dialog-footer">
-                  <div style="display: flex; justify-content: space-between; align-items: center;">
-                    <span class="selected-count">当前已选择 <span style="color: #00BFFF; font-style: italic;">{{ selectedGoods.length }}</span> 商品</span>
-                    <div>
-                      <el-button @click="goodsDialogVisible = false">取 消</el-button>
-                      <el-button type="primary" @click="confirmAddGoods">确 定</el-button>
-                    </div>
-                  </div>
-                </div>
-              </el-dialog>
-            </div>
-            <!-- 直播商品end -->
-
-
-            <div v-if="marketItem.name == 'idCard'">
-              <idCard :liveId="liveId" />
+          </div>
+        </div>
+
+        <div class="header-middle-area">
+          <div class="live-info-title">
+            <div class="title-text">{{ liveInfo.liveName }}</div>
+          </div>
+
+          <div class="live-info-desc">
+            <div class="live-type">{{ liveInfo.liveType == 1 ? '视频直播' : '录播' }}</div>
+            <div class="line"></div>
+            <div class="live-mode">{{ liveInfo.showType == 1 ? '横屏' : '竖屏' }}</div>
+            <div class="big-screen-info">
+              <div class="dataLarge">
+                <a class="dataLarge__screen ss-popover__reference" aria-describedby="ss-popover-7614" tabindex="0" data-auth-id="818">
+                  <span class="dataLarge__screen__icon"></span>
+                  <span class="dataLarge__screen__txt">实时大屏</span>
+                </a>
+              </div>
             </div>
+          </div>
+
+          <div class="live-info-state">
+            <div class="info-state-text live-time">直播时间:{{ liveInfo.startTime }} 至 {{ liveInfo.finishTime }}</div>
+            <div class="line"></div>
+            <div class="info-state-text live-state">{{ liveInfo.status == 3 ? '已结束' : liveInfo.status == 2 ? '直播中' : '未开始'}}</div>
+            <div class="line"></div>
+            <div class="info-state-text live-active-state">{{ liveInfo.isShow == 1 ? '上架' : '下架' }}</div>
+            <div class="line"></div>
+          </div>
+        </div>
+
+
+<!--        <div class="header-right-area">-->
+<!--          <div class="operation-wrapper">-->
+<!--            <div class="operation-item">-->
+<!--              <div class="operation-item-icon sales-icon"></div>-->
+<!--              <div class="operation-item-text">中控台</div>-->
+<!--            </div>-->
+<!--            <div class="line"></div>-->
+<!--            <div class="operation-item">-->
+<!--              <span class="operation-item-icon xe-iconfont"></span>-->
+<!--              <div class="operation-item-text">分享</div>-->
+<!--            </div>-->
+<!--            <div class="line"></div>-->
+<!--            <div class="operation-item" data-auth-id="975">-->
+<!--              <span class="operation-item-icon xe-iconfont"></span>-->
+<!--              <div class="operation-item-text">恢复直播</div>-->
+<!--            </div>-->
+<!--            <div class="line"></div>-->
+<!--            <div class="operation-item ss-popover__reference" aria-describedby="ss-popover-6482" tabindex="0">-->
+<!--              <span class="operation-item-icon xe-iconfont"></span>-->
+<!--              <div class="operation-item-text">更多</div>-->
+<!--            </div>-->
+<!--          </div>-->
+<!--        </div>-->
+      </div>
+    </el-card>
+    <el-card class="box-card live-config-left">
+      <div class="container">
+      <!-- 左边菜单 -->
+        <div class="left-menu">
+          <el-menu default-active="1" class="el-menu-vertical-demo" @select="handleSelect">
+            <el-menu-item :index="item.index" v-for="item in menuList" >
+              <span>{{item.name}}</span>
+            </el-menu-item>
+          </el-menu>
+        </div>
+        <!-- 右边信息 -->
+        <div class="right-info">
+          <!-- 动态组件 -->
+          <component :is="currentComponent" ></component>
+        </div>
+      </div>
+<!--      <el-tabs tab-position="left" style="height: 200px;">-->
+<!--        <el-tab-pane label="营销内容">营销内容</el-tab-pane>-->
+<!--        <el-tab-pane label="观看奖励">观看奖励</el-tab-pane>-->
+<!--        <el-tab-pane label="答题红包">答题红包</el-tab-pane>-->
+<!--        <el-tab-pane label="答题">答题</el-tab-pane>-->
+<!--        <el-tab-pane label="直播商品">直播商品</el-tab-pane>-->
+<!--        <el-tab-pane label="观看积分">观看积分</el-tab-pane>-->
+<!--        <el-tab-pane label="身份认证">-->
+<!--            <idCard :liveId="liveId" />-->
+<!--        </el-tab-pane>-->
+<!--      </el-tabs>-->
+    </el-card>
 
-
-
-          </el-tab-pane>
-        </el-tabs>
-        <!-- 营销内容 end -->
-      </el-tab-pane>
-    </el-tabs>
-    <!-- 根tabs end -->
   </div>
 </template>
-
 <script>
-import {
-  listLiveQuestionLive,
-  listLiveQuestionOptionList,
-  addLiveQuestionLive,
-  deleteLiveQuestionLive,
-  getConfig,
-  addConfig,
-  updateConfig
-} from '@/api/live/liveQuestionLive'
-import {listLiveGoods, delLiveGoods, listStoreProduct,addLiveGoods} from '@/api/live/liveGoods'
-import idCard from "./idCard";
+import WatchReward from './watchReward.vue';
+import Answer from './answer.vue';
+import Goods from './goods.vue';
+import WatchScore from './watchScore.vue';
+import IdCard from './idCard.vue';
+import LiveRedConf from './liveRedConf.vue'
+import LiveLotteryConf from './liveLotteryConf.vue'
+import { listLive, getLive, delLive, addLive, updateLive, exportLive,selectCompanyTalent,handleShelfOrUn,handleDeleteSelected } from "@/api/live/live";
+
 
 export default {
   name: 'LiveConfig',
-  components: { idCard },
+  components: {
+    WatchReward,
+    LiveRedConf,
+    LiveLotteryConf,
+    Answer,
+    Goods,
+    WatchScore,
+    IdCard
+  },
   data() {
     return {
+      activeTab: 'basicInfo',
       liveId: null,
-      loading: true,
-      rootActiveName: 'market',
-      rootTabs: [
-        {
-          label: '营销内容',
-          name: 'market'
-        }
+      liveInfo: {},
+      currentComponent: WatchReward,
+      menuList:[
+        { name: '观看奖励', label: '观看奖励', index: 'watchReward'},
+        { name: '红包配置', label: '红包配置', index: 'liveRedConf'},
+        { name: '抽奖配置', label: '抽奖配置', index: 'liveLotteryConf'},
+        // { name: '答题', label: '答题', index: 'answer'},
+        { name: '直播商品', label: '直播商品', index: 'goods'},
+        // { name: '观看积分', label: '观看积分', index: 'watchScore'},
+        { name: '身份认证', label: '身份认证', index: 'idCard'},
       ],
-      marketActiveName: 'watchReward',
-      marketTabs: [
-        {
-          label: '观看奖励',
-          name: 'watchReward'
-        },
-        {
-          label: '答题红包',
-          name: 'answerRedPacket'
-        },
-        {
-          label: '答题',
-          name: 'answer'
-        },
-        {
-          label: '直播商品',
-          name: 'goods'
-        },
-        {
-          label: '观看积分 ',
-          name: 'watchScore'
-        },
-        {
-          label: '身份认证',
-          name: 'idCard'
-        }
-      ],
-      questionDialogVisible: false,
-      goodsDialogVisible: false,
-      questionLoading: false,
-      goodsLoading: false,
-      searchTitle: '',
-      questionList: [],
-      selectedQuestions: [],
-      selectedGoods: [],
-      total: 0,
-      queryParams: {
-        pageNum: 1,
-        pageSize: 10,
-        title: null,
-        liveId: null
-      },
-      questionTotal: 0,
-      questionParams: {
-        pageNum: 1,
-        pageSize: 10,
-        liveId: null
-      },
-      goodsList: [],
-      goodsTotal: 0,
-      questionLiveList: [],
-      goodsLiveList: [],
-      goodsLiveTotal: 0,
-      goodsParams: {
-        pageNum: 1,
-        pageSize: 10,
-        liveId: null
-      },
-      queryGoodParams: {
-        pageNum: 1,
-        pageSize: 10,
-        title: null,
-        liveId: null
-      },
-      rules:{
-        participateCondition:[
-          { required: true, message: '请选择参与条件', trigger: 'blur'}
-        ],
-        watchDuration:[
-          { required: true, message: '请输入观看时长', trigger: 'blur'}
-        ],
-        action:[
-          { required: true, message: '请选择实施动作', trigger: 'blur'}
-        ],
-        receivePrompt:[
-          { required: true, message: '请输入领取提示语', trigger: 'blur'}
-        ],
-        redPacketType:[
-          { required: true, message: '请选择红包发放方式', trigger: 'blur'}
-        ],
-        redPacketAmount:[
-          { required: true, message: '请输入红包金额', trigger: 'blur'}
-        ],
-        receiveMethod:[
-          { required: true, message: '请选择红包领取方式', trigger: 'blur'}
-        ],
-        guideText:[
-          { required: true, message: '请输入客服引导语', trigger: 'blur'}
-        ],
-        showGuide:[
-          { required: true, message: '请选择是否显示客服引导', trigger: 'blur'}
-        ]
-      },
-      watchRewardForm: {
-        id: null,
-        liveId: null,
-        // 是否启用观看奖励
-        enabled: false,
-        // 参与条件
-        participateCondition: '1',
-        // 观看时长
-        watchDuration: '',
-        // 实施动作
-        action: '1',
-        // 领取提示语
-        receivePrompt: '',
-        // 红包发放方式(固定金额/随机金额)
-        redPacketType: '1',
-        // 红包金额
-        redPacketAmount: '',
-        // 红包发放数量
-        redPacketCount: '',
-        // 红包领取方式
-        receiveMethod: '1',
-        // 是否显示客服引导
-        showGuide: '1',
-        // 客服引导语
-        guideText: '',
-        // 积分值
-        scoreAmount: '',
-        // 最大领取人数
-        maxReceivers: '',
-        // 积分使用引导语
-        scoreGuideText: '',
-        // 积分使用引导链接
-        scoreGuideLink: ''
-      },
-      // 添加实施动作选项
-      actionOptions: [
-        {
-          label: '现金红包',
-          value: '1'
-        },
-        {
-          label: '积分红包',
-          value: '2'
-        }
-      ]
+
     }
   },
   created() {
     this.liveId = this.$route.params.liveId
-    this.queryParams.liveId = this.liveId
-    this.goodsParams.liveId = this.liveId
-    this.questionParams.liveId = this.liveId
-    this.watchRewardForm.liveId = this.liveId
-    // this.getLiveQuestionLiveList()
-    this.getLiveConfig();
+    this.getLiving()
   },
   methods: {
-    getLiveConfig(){
-      getConfig(this.liveId).then(response => {
-        if(response.code === 200){
-          this.watchRewardForm = JSON.parse(response.data)
-        }
-      })
-    },
-    handleClick(tab, event) {
-      console.info(tab, event)
-    },
-    handleToQuestionBank() {
-      this.$router.push('/live/liveQuestionBank')
-    },
-    handleTabClick(tab) {
-      if(tab.name === 'answer') {
-        // this.getLiveQuestionLiveList()
-      }
-      if(tab.name === 'goods'){
-        this.getLiveGoodsList();
-      }
-    },
-    getLiveGoodsList() {
-      this.loading = true
-      listLiveGoods({liveId: this.liveId}).then(response => {
-        this.goodsLiveList = response.rows
-        this.goodsLiveTotal = response.total
-        this.loading = false
-      })
-    },
-    getLiveQuestionLiveList() {
-      this.loading = true
-      listLiveQuestionLive(this.questionParams).then(response => {
-        this.questionLiveList = response.rows
-        this.questionTotal = response.total
-        this.loading = false
-      })
-    },
-    handleAddQuestion() {
-      this.questionDialogVisible = true
-      this.getQuestionList()
-    },
-    handleAddLiveGoods(){
-      this.goodsDialogVisible = true;
-      this.getStoreProductLists()
+    handleSelect(index){
+      this.currentComponent = index; // 切换当前显示的组件
     },
-    getQuestionList() {
-      this.questionLoading = true
-      listLiveQuestionOptionList(this.queryParams).then(response => {
-        this.questionList = response.rows
-        this.total = response.total
-        this.questionLoading = false
+    getLiving() {
+      getLive(this.liveId).then(res => {
+        this.liveInfo = res.data
       })
     },
-    handleQuestionSearch() {
-      this.queryParams.pageNum = 1
-      this.queryParams.title = this.searchTitle
-      this.getQuestionList()
-    },
-    handleGoodsSearch(){
-      this.queryParams.pageNum = 1
-      this.queryParams.title = this.searchTitle
-      this.getQuestionList()
-    },
-    handleSelectionChange(selection) {
-      this.selectedQuestions = selection
-    },
-    handleGoodsChange(goods) {
-      this.selectedGoods = goods
-    },
-    handleCurrentChange() {
-      this.getQuestionList()
-    },
-    confirmAddQuestion() {
-      if (this.selectedQuestions.length === 0) {
-        this.$message({
-          message: '请选择要添加的试题',
-          type: 'warning'
-        })
-        return
-      }
-      // 调用添加直播间试题接口
-      addLiveQuestionLive({
-        liveId: this.liveId,
-        questionIds: this.selectedQuestions.map(item => item.id).join(',')
-      }).then(response => {
-        this.questionDialogVisible = false
-        this.getLiveQuestionLiveList()
-      })
-    },
-    confirmAddGoods(){
-      if (this.selectedGoods.length === 0) {
-        this.$message({
-          message: '请选择要添加的商品',
-          type: 'warning'
-        })
-        return
-      }
-      addLiveGoods({
-        liveId: this.liveId,
-        productsId: this.selectedGoods.map(item => item.productId).join(',')
-      }).then(response => {
-        this.goodsDialogVisible = false
-        this.getLiveGoodsList()
-      })
-    },
-    handleDelete(row) {
-      // 调用删除直播间试题接口
-      deleteLiveQuestionLive({
-        liveId: this.liveId,
-        ids: row.id
-      }).then(response => {
-        this.getLiveQuestionLiveList()
-      })
-    },
-    handleGoodDelete(row){
-      delLiveGoods(row.goodsId).then(response => {
-        this.getLiveGoodsList()
-      })
-    },
-    /** 处理行点击事件 */
-    handleRowClick(row, column) {
-      // 如果点击的是复选框列,不进行处理
-      if (column.type === 'selection') {
-        return
-      }
-
-      // 获取表格实例
-      const table = this.$refs.questionTable[0]
-      if (!table) {
-        return
-      }
-
-      // 判断当前行是否已经被选中
-      const isSelected = this.selectedQuestions.some(item => item.id === row.id)
-
-      // 切换选中状态
-      table.toggleRowSelection(row, !isSelected)
-    },
-    /** 处理行点击事件 */
-    handleGoodsRowClick(row, column) {
-      // 如果点击的是复选框列,不进行处理
-      if (column.type === 'selection') {
-        return
-      }
-
-      // 获取表格实例
-      const table = this.$refs.goodsTable[0]
-      if (!table) {
-        return
-      }
-
-      // 判断当前行是否已经被选中
-      const isSelected = this.selectedGoods.some(item => item.id === row.id)
-
-      // 切换选中状态
-      table.toggleRowSelection(row, !isSelected)
-    },
-    saveWatchReward() {
-      this.$refs["watchRewardForm"][0].validate(valid => {
-        if (valid) {
-          if (this.watchRewardForm.id == null) {
-            // 调用保存观看奖励接口
-            // 实现保存逻辑
-            addConfig(this.watchRewardForm).then(res => {
-              if (res.code == 200) {
-                this.msgSuccess("修改成功");
-              }
-            })
-          } else {
-            updateConfig(this.watchRewardForm).then(response => {
-              this.msgSuccess("修改成功");
-            });
-          }
-        }
-      })
-
-    },
-    getStoreProductLists() {
-      listStoreProduct({liveId:this.liveId}).then(response => {
-        this.goodsList = response.rows
-        this.goodsTotal = response.total
-        this.loading = false
-      })
-    }
   }
 }
 </script>
 
+
 <style scoped>
-.live-config-container {
-  padding: 10px 20px;
-  height: calc(100vh - 84px); /* 减去头部导航的高度 */
-}
-.white-bg-tabs {
-  background-color: #fff;
-  padding: 10px 20px;
-  border-radius: 4px;
-  height: 100%;
+.el-tabs__header .is-top {
+  display: none !important;
 }
-
-.market-tab-pane {
-  height: 74vh;
-  overflow-y: auto;
+.live-config-header{
+  padding: 5px;
+  border: 1px solid #ebeef5;
 }
-.tip-box {
-  padding: 12px 16px;
-  background-color: #FFF6F2;
-  border-radius: 4px;
-  color: #666;
-  font-size: 14px;
-}
-
-/* 修改弹窗相关样式 */
-::v-deep .el-dialog {
-  height: 90%;
-  margin: 0 !important;
-  width: 900px !important;
+.detail-header {
+  display: flex;
+  padding: 20px;
+  border-bottom: 1px solid #ebeef5;
 }
 
-::v-deep .el-dialog__body {
-  padding: 20px;
-  height: calc(100% - 110px);  /* 减去header和footer的高度 */
-  overflow: hidden;
+.header-left-area {
+  flex: 0 0 120px;
+  position: relative;
 }
 
-.dialog-content {
-  height: 100%;
-  overflow-y: auto;
+.header-left-area img {
+  width: 100px;
+  height: 100px;
+  border-radius: 4px;
 }
 
-::v-deep .el-dialog__footer {
-  position: absolute;
-  bottom: 0;
-  width: 100%;
-  background: #fff;
-  z-index: 1;
-  border-top: 1px solid #e4e7ed;
-  padding: 15px 20px;
+.header-middle-area {
+  flex: 1;
+  padding: 0 20px;
 }
 
-::v-deep .el-dialog__header {
-  padding: 15px 20px;
-  border-bottom: 1px solid #e4e7ed;
+.header-right-area {
+  flex: 0 0 200px;
 }
 
-.selected-count {
-  color: #999;
-  font-size: 14px;
+.live-info-title .title-text {
+  font-size: 20px;
+  font-weight: 500;
+  color: #303133;
 }
 
-/* 可点击列的样式 */
-::v-deep .clickable-column {
-  cursor: pointer;
+.live-info-desc {
+  display: flex;
+  align-items: center;
+  margin-top: 10px;
 }
 
-/* 提示信息样式 */
-.tip-message {
-  padding: 12px 16px;
-  background-color: #FFF6F2;
-  border-radius: 4px;
-  color: #666;
-  font-size: 14px;
-  margin-bottom: 20px;
+.live-info-desc .line {
+  width: 1px;
+  height: 12px;
+  background: #c0c4cc;
+  margin: 0 10px;
 }
 
-/* 开关容器样式 */
-.reward-switch {
-  margin-left: 200px;
-  margin-bottom: 20px;
-  padding: 20px;
-  background-color: #fff;
-  border-radius: 4px;
+.live-info-state {
   display: flex;
   align-items: center;
+  margin-top: 10px;
 }
 
-/* 开关标签样式 */
-.reward-switch .switch-label {
-  margin-right: 10px;
-  font-size: 14px;
-  color: #333;
-  margin-left: 50px;
+.live-info-state .line {
+  width: 1px;
+  height: 12px;
+  background: #c0c4cc;
+  margin: 0 10px;
 }
 
-/* 表单区块样式 */
-.section-block {
-  width: 50%;
-  background-color: #fff;
-  padding: 20px;
-  border-radius: 4px;
-  margin-left: 50px;
-  margin-bottom: 20px;
+.live-state-dot {
+  width: 8px;
+  height: 8px;
+  border-radius: 50%;
 }
 
-/* 标题样式 */
-.section-block .section-title {
-  font-size: 14px;
-  color: #333;
-  margin-bottom: 20px;
-  border-left: 4px solid #409EFF;
-  padding-left: 10px;
-  line-height: 1;
+.live-state-dot-liveEnd {
+  background: #909399;
 }
 
-/* 表单样式 */
-.reward-form {
-  margin-top: 20px;
+.info-state-text {
+  font-size: 14px;
+  color: #606266;
 }
 
-/* 表单项样式 */
-.reward-form .el-form-item {
-  margin-bottom: 22px;
-  padding-left: 50px;
+.operation-wrapper {
+  display: flex;
+  align-items: center;
 }
 
-.reward-form .el-form-item:last-child {
-  margin-bottom: 0;
+.operation-item {
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  cursor: pointer;
 }
 
-/* 表单标签样式 */
-.reward-form .el-form-item .el-form-item__label {
+.operation-item-text {
+  font-size: 12px;
   color: #606266;
+  margin-top: 4px;
 }
 
-/* 输入框统一宽度 */
-.reward-form .el-form-item .el-input {
-  width: 300px;
+.operation-wrapper .line {
+  width: 1px;
+  height: 20px;
+  background: #c0c4cc;
+  margin: 0 10px;
 }
 
-/* 必填项星号样式 */
-.reward-form .el-form-item.is-required .el-form-item__label:before {
-  color: #F56C6C;
+.container {
+  display: flex;
+  height: 100%;
 }
-
-/* 观看时长输入框样式 */
-.reward-form .el-form-item .duration-input {
-  width: 300px;
+.left-menu {
+  width: 200px;
+  border-right: 1px solid #e4e7ed;
+  flex-shrink: 0; /* 不收缩 */
 }
 
-.reward-form .el-form-item .duration-input .el-input__inner {
-  text-align: left;
+.right-info {
+  flex: 1;
+  padding: 20px;
 }
 
-/* 保存按钮样式 */
-.form-actions {
-  width: 600px;
-  text-align: center;
-  margin-top: 30px;
+.right-tabs {
+  height: 100%;
 }
 
-.form-actions .el-button {
-  padding: 8px 20px;
-  font-size: 13px;
-}
 </style>

+ 798 - 0
src/views/live/liveConfig/liveLotteryConf.vue

@@ -0,0 +1,798 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="直播间ID" prop="liveId">
+        <el-input
+          v-model="queryParams.liveId"
+          placeholder="请输入直播间ID"
+          clearable
+          size="small"
+          :disabled="canLiveId"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="参与方式" prop="require">
+        <el-select v-model="queryParams.require" placeholder="请输入参与抽奖方式">
+          <el-option v-for="(item,index) in requireOptions" :key="item.dictValue+index" :label="item.dictLabel" :value="item.dictValue" />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="抽奖状态" prop="require">
+        <el-select v-model="queryParams.lottery_status" placeholder="请输入参与抽奖方式">
+          <el-option v-for="(item,index) in lotteryStatusOptions" :key="item.dictValue+index" :label="item.dictLabel" :value="item.dictValue" />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="抽奖标题" prop="desc">
+        <el-input
+          v-model="queryParams.desc"
+          placeholder="请输入描述"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="创建日期" prop="createTime">
+        <el-date-picker clearable size="small"
+          v-model="queryParams.createTime"
+          type="date"
+          value-format="yyyy-MM-dd"
+          placeholder="选择创建日期">
+        </el-date-picker>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          plain
+          icon="el-icon-plus"
+          size="mini"
+          @click="handleAdd"
+          v-hasPermi="['live:liveLotteryConf:add']"
+        >新增</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="success"
+          plain
+          icon="el-icon-edit"
+          size="mini"
+          :disabled="single"
+          @click="handleUpdate"
+          v-hasPermi="['live:liveLotteryConf:edit']"
+        >修改</el-button>
+      </el-col>
+<!--      <el-col :span="1.5">
+        <el-button
+          type="danger"
+          plain
+          icon="el-icon-delete"
+          size="mini"
+          :disabled="multiple"
+          @click="handleDelete"
+          v-hasPermi="['live:liveLotteryConf:remove']"
+        >删除</el-button>
+      </el-col>-->
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          plain
+          icon="el-icon-download"
+          size="mini"
+          :loading="exportLoading"
+          @click="handleExport"
+          v-hasPermi="['live:liveLotteryConf:export']"
+        >导出</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table border v-loading="loading" :data="liveLotteryConfList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="抽奖ID" align="center" prop="lotteryId" />
+      <el-table-column label="操作商品" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button v-if="scope.row.lotteryStatus+'' === '0'" @click="handleUpdateProduct(scope.row)">编辑商品</el-button>
+          <el-button v-else @click="handleDetailProduct(scope.row)">查看商品</el-button>
+        </template>
+      </el-table-column>
+      <el-table-column label="直播间ID" align="center" prop="liveId" />
+      <el-table-column label="参与方式" align="center" prop="require" :formatter="requireFormatter"/>
+      <el-table-column label="抽奖状态" align="center" prop="lotteryStatus" :formatter="lotteryStatusFormatter"/>
+      <el-table-column label="配置" align="center" prop="requireConf" />
+      <el-table-column label="持续时间" align="center" prop="duration" />
+      <el-table-column label="抽奖标题" align="center" prop="desc" />
+      <el-table-column label="创建日期" align="center" prop="createTime" width="180">
+        <template slot-scope="scope">
+          <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['live:liveLotteryConf:edit']"
+            style="margin-left: 10px"
+          >修改</el-button>
+          <!-- 开始 -->
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleStatusChange(scope.row,'1')"
+            v-hasPermi="['live:liveLotteryConf:edit']"
+          >开始</el-button>
+          <!-- 暂停 -->
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleStatusChange(scope.row,'3')"
+            v-hasPermi="['live:liveLotteryConf:edit']"
+          >暂停</el-button>
+          <!-- 结算 -->
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleStatusChange(scope.row,'2')"
+            v-hasPermi="['live:liveLotteryConf:edit']"
+          >结算</el-button>
+
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            v-hasPermi="['live:liveLotteryConf:edit']"
+          >删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 添加或修改直播抽奖配置对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="直播间ID" prop="liveId">
+          <el-input v-model="form.liveId" placeholder="请输入直播间ID"
+                    :disabled="canLiveId"/>
+        </el-form-item>
+        <el-form-item label="参与方式" prop="require">
+          <el-select v-model="form.require" placeholder="请输入参与抽奖方式">
+            <el-option v-for="(item,index) in requireOptions" :key="item.dictValue+index" :label="item.dictLabel" :value="item.dictValue" />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="方式配置" prop="requireConf">
+          <el-input v-model="form.requireConf" placeholder="请输入参与抽奖方式" />
+          <span style="font-size: 10px; font-family: Arial,serif">当参与方式选择为“送礼参与”或“下单参与”时,此处填写商品ID及数量</span>
+        </el-form-item>
+        <el-form-item label="持续时间" prop="duration">
+          <el-input v-model="form.duration" placeholder="请输入持续时间 单位:分" />
+        </el-form-item>
+        <el-form-item label="抽奖标题" prop="desc">
+          <el-input v-model="form.desc" placeholder="请输入描述" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+
+    <el-dialog :title="titleProduct" :visible.sync="openProduct" width="800px" append-to-body>
+      <el-form ref="form1" :model="form1" :rules="rules1" label-width="100px" :disabled="isDetail">
+        <!-- 基础信息 -->
+        <el-row :gutter="20">
+          <el-col :span="12">
+            <el-form-item label="抽奖ID" prop="lotteryId">
+              <el-input v-model="form1.lotteryId" placeholder="请输入抽奖ID" />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+<!--            <el-form-item label="直播间ID" prop="liveId">
+              <el-input v-model="form1.liveId" placeholder="请输入直播间ID" />
+            </el-form-item>-->
+          </el-col>
+        </el-row>
+
+        <!-- 动态奖品配置 -->
+        <el-divider content-position="left">奖品配置</el-divider>
+
+        <el-card v-for="(prize, index) in form1.prizes" :key="index" class="prize-card" shadow="hover">
+          <div slot="header" class="prize-header">
+            <span><b>奖品等级 :{{ prize.prizeLevel }}</b></span>
+            <el-button
+              v-if="form1.prizes.length > 1"
+              @click="removePrize(index)"
+              type="danger"
+              icon="el-icon-delete"
+              size="mini"
+              circle
+            ></el-button>
+          </div>
+
+          <el-row :gutter="20">
+            <el-col :span="12">
+              <el-form-item
+                label="商品ID"
+                :prop="'prizes.' + index + '.productId'"
+                :rules="[{ required: true, message: '请输入商品', trigger: 'blur' }]">
+<!--                <el-input v-model="prize.productId" placeholder="请输入商品ID" />-->
+                <el-select
+                  v-model="prize.productId"
+                  filterable
+                  clearable
+                  remote
+                reserve-keyword
+                placeholder="请输入关键字搜索"
+                :remote-method="fetchProducts"
+                :loading="loadingProducts"
+                size="small"
+                style="width: 180px"
+                >
+                <el-option
+                  v-for="product in productOptions"
+                  :key="product.goodsId"
+                  :label="product.productName"
+                  :value="product.goodsId"
+                />
+                <span style="float: left">{{ product.goodsId }}</span>
+                <span style="margin-left: 30px ;">{{product.productName}}</span>
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item
+                label="奖品等级"
+                :prop="'prizes.' + index + '.prizeLevel'"
+                :rules="[{ required: true, message: '请输入奖品等级', trigger: 'blur' }]">
+                <el-input v-model="prize.prizeLevel" placeholder="请输入奖品等级" />
+              </el-form-item>
+            </el-col>
+          </el-row>
+
+          <el-row :gutter="20">
+            <el-col :span="12">
+              <el-form-item
+                label="单奖数量"
+                :prop="'prizes.' + index + '.perLotteryNum'"
+                :rules="[
+                { required: true, message: '请输入单次中奖数量', trigger: 'blur' },
+                { type: 'number', message: '必须为数字值' }
+              ]">
+                <el-input-number
+                  v-model="prize.perLotteryNum"
+                  :min="1"
+                  :max="100"
+                  controls-position="right"
+                  placeholder="单次中奖数量" />
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item
+                label="奖励总份数"
+                :prop="'prizes.' + index + '.totalLots'"
+                :rules="[
+                { required: true, message: '请输入奖励总份数', trigger: 'blur' },
+                { type: 'number', message: '必须为数字值' }
+              ]">
+                <el-input-number
+                  v-model="prize.totalLots"
+                  :min="1"
+                  controls-position="right"
+                  placeholder="奖励总份数" />
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <el-row :gutter="20">
+            <el-col :span="12">
+              <el-form-item
+                label="实发份数"
+                :prop="'prizes.' + index + '.totalSend'"
+                >
+                <el-input-number
+                  v-model="prize.totalSend"
+                  :min="0"
+                  :max="prize.totalLots"
+                  controls-position="right"
+                  placeholder="实际发放份数"
+                  :disabled="true"/>
+              </el-form-item>
+            </el-col>
+          </el-row>
+        </el-card>
+
+        <div class="add-prize-btn">
+          <el-button
+            @click="addPrize"
+            type="primary"
+            icon="el-icon-plus"
+            plain
+            size="small">
+            添加奖品配置
+          </el-button>
+        </div>
+      </el-form>
+
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="cancel1">取 消</el-button>
+        <el-button type="primary" @click="submitForm1">确 定</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { listLiveLotteryConf, getLiveLotteryConf, delLiveLotteryConf, addLiveLotteryConf, updateLiveLotteryConf, exportLiveLotteryConf } from "@/api/live/liveLotteryConf";
+import LiveLotteryProductConf from '@/views/live/liveLotteryProductConf/index.vue'
+import {
+  listStoreProduct,
+  updateLiveLotteryProductConf
+} from '@/api/live/liveLotteryProductConf'
+import { listLiveGoods } from '@/api/live/liveGoods'
+
+export default {
+  name: "LiveLotteryConf",
+  components: { LiveLotteryProductConf },
+  data() {
+    return {
+      //字典
+      requireOptions: [],
+      // 抽奖状态
+      lotteryStatusOptions: [],
+      //加载商品
+      loadingProducts: false,
+      //
+      productOptions: [],
+      isDetail: false,
+      canLiveId:false,
+      //parentLiveId
+      parentLiveId : null,
+      liveId: null,
+      // 遮罩层
+      loading: true,
+      // 导出遮罩层
+      exportLoading: false,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 直播抽奖配置表格数据
+      liveLotteryConfList: [],
+      // 弹出层标题
+      title: "",
+      titleProduct: "编辑抽奖商品",
+      // 是否显示弹出层
+      open: false,
+      openProduct: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        liveId: null,
+        require: null,
+        desc: null,
+        createTime: null,
+        lottery_status: null
+      },
+      //商品信息列表
+      productList: [],
+      // 商品信息
+      product: {
+        productId: null,
+        prizeLevel: null,
+        perLotteryNum: null,
+        totalLots: null,
+        totalSend: null
+      },
+      // 表单参数
+      form:{
+        lotteryId: '',
+        liveId: '',
+        require: '',
+        requireConf: '',
+        duration: null,
+        desc: null
+      },
+      // 表单参数
+      form1: {
+        liveId: '',
+        lotteryId: '',
+        prizes: [this.getDefaultPrize()]
+      },
+      // 表单校验
+      rules: {
+        liveId: [
+          { required: true, message: "直播间ID不能为空", trigger: "blur" }
+        ],
+        require: [
+          { required: true, message: "参与抽奖方式", trigger: "blur" }
+        ],
+        //如果require为2或3,requireConf不能为空
+        requireConf: [
+          { validator: this.validRequireConf,message: "当参与方式选择为“送礼参与”或“下单参与”时,对应的配置:送礼数量/指定商品Id及数量不能为空", trigger: "blur" }
+        ],
+        duration: [
+          { required: true, message: "持续时间 单位:分不能为空", trigger: "blur" }
+        ],
+        desc: [
+          { required: true, message: "描述不能为空", trigger: "blur" }
+        ],
+      },
+      //抽奖商品表单
+      rules1: {
+        lotteryId: [
+          { required: true, message: '请输入抽奖ID', trigger: 'blur' }
+        ],
+        liveId: [
+          { required: true, message: '请输入直播间ID', trigger: 'blur' }
+        ]
+      }
+    };
+  },
+  created() {
+    this.getDicts("sys_live_lottery_require").then(response => {
+      this.requireOptions = response.data;
+    });
+    this.getDicts("sys_live_lottery_status").then(response => {
+      this.lotteryStatusOptions = response.data;
+    });
+    this.liveId = this.$route.query.liveId;
+    this.parentLiveId = this.liveId;
+    this.queryParams.liveId = this.parentLiveId;
+    if(this.queryParams.liveId){
+      this.form.liveId = this.parentLiveId;
+      //设置查询条件直播间ID不可修改
+      this.canLiveId = true;
+    }
+    this.getList();
+  },
+  mounted() {
+    this.$watch(
+      () => this.form.require,
+      (newVal) => {
+        this.$refs.form.validateField('requireConf');
+      }
+    );
+  },
+  methods: {
+    async fetchProducts(query) {
+      if (!query) {
+        this.productOptions = [];
+        return;
+      }
+      const queryParam = {
+        liveId : this.liveId,
+        keywords: query
+      }
+      this.loadingProducts = true;
+      try {
+        listLiveGoods(queryParam).then(response => {
+          this.productOptions = response.rows;
+        })
+      } catch (err) {
+        console.error('查询商品失败:', err);
+        this.productOptions = [];
+      } finally {
+        this.loadingProducts = false;
+      }
+    },
+    // 获取默认奖品配置
+    getDefaultPrize() {
+      return {
+        productId: '',
+        prizeLevel: '',
+        perLotteryNum: 1,
+        totalLots: 1,
+        totalSend: 0
+      }
+    },
+    // 添加奖品配置
+    addPrize() {
+      this.form1.prizes.push(this.getDefaultPrize())
+    },
+
+    // 删除奖品配置
+    removePrize(index) {
+      if (this.form1.prizes.length <= 1) {
+        this.$message.warning('至少需要保留一个奖品配置')
+        return
+      }
+      this.form1.prizes.splice(index, 1)
+    },
+
+    requireFormatter(row, column) {
+      return this.selectDictLabel(this.requireOptions, row.require);
+    },
+    lotteryStatusFormatter(row, column) {
+      return this.selectDictLabel(this.lotteryStatusOptions, row.lotteryStatus);
+    },
+    validRequireConf(rule, value, callback) {
+      if(this.form.require+"" === "2" || this.form.require+"" === "3"){
+        if(!value){
+          callback(new Error());
+          return false;
+        }
+      }
+      callback();
+      return true;
+    },
+    /** 查询直播抽奖配置列表 */
+    getList() {
+      this.loading = true;
+      listLiveLotteryConf(this.queryParams).then(response => {
+        this.liveLotteryConfList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 取消
+    cancel1() {
+      this.openProduct = false;
+    },
+
+    // 重置表单
+    resetForm1() {
+      this.form1 = {
+        lotteryId: '',
+        liveId: '',
+        prizes: [this.getDefaultPrize()]
+      }
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        lotteryId: null,
+        liveId: null,
+        require: null,
+        requireConf: null,
+        duration: null,
+        desc: null
+      };
+      this.resetForm("form");
+      this.checkParentLiveId();
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.checkParentLiveId();
+      this.handleQuery();
+    },
+    //判断父页面传入参数
+    checkParentLiveId(){
+      if(this.parentLiveId){
+        this.form.liveId = this.parentLiveId;
+        this.queryParams.liveId = this.parentLiveId;
+      }
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.lotteryId)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加直播抽奖配置";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const lotteryId = row.lotteryId || this.ids
+      //只能对未开始或暂停的抽奖进行修改
+      if(row.lotteryStatus+"" !== "0" && row.lotteryStatus+"" !== "3"){
+        this.msgError("只能对未开始或暂停的抽奖进行修改");
+        return;
+      }
+      getLiveLotteryConf(lotteryId).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改直播抽奖配置";
+      });
+    },
+    /** 修改按钮操作 */
+    handleUpdateProduct(row) {
+      this.form1.lotteryId = row.lotteryId;
+      //如果状态为已结束,则不能修改
+      if(row.lotteryStatus+"" === "2"){
+        this.msgError("已结束的抽奖不能修改");
+        return;
+      }
+      this.openProduct = true;
+      this.isDetail = false;
+      listStoreProduct(row.lotteryId).then(response => {
+        this.form1 = response.data;
+        if(this.form1.prizes.length === 0)
+          this.form1.prizes = [this.getDefaultPrize()]
+        this.form1.liveId = row.liveId;
+      });
+    },
+    /** 详情按钮操作 */
+    handleDetailProduct(row) {
+      this.form1.lotteryId = row.lotteryId;
+      //如果状态为已结束,则不能修改
+      if(row.status+"" === "2"){
+        this.msgError("已结束的抽奖不能修改");
+        return;
+      }
+      this.openProduct = true;
+      this.isDetail = true;
+      listStoreProduct(row.lotteryId).then(response => {
+        this.form1 = response.data;
+        this.form1.liveId = row.liveId;
+      });
+    },
+    /** 抽奖状态修改 */
+    handleStatusChange(row, status) {
+      if (this.$store.state.liveWs == null) {
+        this.msgError("请从直播间进行操作!");
+        return;
+      }
+      //结束的抽奖不能进行操作
+      if(row.lotteryStatus+"" === "2"){
+        this.msgError("已结束的抽奖不能进行操作");
+        return;
+      }
+      switch (status+"") {
+        case "1":
+          //只能对未开启的抽奖进行操作
+          if(row.lotteryStatus+"" !== "0" && row.lotteryStatus+"" !== "3"){
+            this.msgError("只能对未开启或暂停的抽奖进行开始操作");
+            return;
+          }
+          break;
+        case "2":
+          //只能对进行中或暂停的抽奖进行结算
+          if(row.lotteryStatus+"" !== "1" && row.lotteryStatus+"" !== "3"){
+            this.msgError("只能对进行中或暂停的抽奖进行结算");
+            return;
+          }
+          break;
+        case "3":
+          //只能对进行中的抽奖执行暂停操作
+          if(row.lotteryStatus+"" !== "1"){
+            this.msgError("只能对进行中的抽奖执行暂停操作");
+            return;
+          }
+          break;
+        default:
+          return;
+      }
+      const doLotteryParam = {
+        lotteryId: row.lotteryId,
+        lotteryStatus: status
+      };
+      updateLiveLotteryConf(doLotteryParam).then(response => {
+        if(response.code === 200){
+          this.$store.state.liveWs.sendWs("lottery",response.msg, row.lotteryId,this.liveId);
+          this.msgSuccess("修改成功");
+        }else{
+          this.msgError(response.msg);
+        }
+          this.open = false;
+          this.getList();
+        });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.lotteryId != null) {
+            updateLiveLotteryConf(this.form).then(response => {
+              this.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addLiveLotteryConf(this.form).then(response => {
+              this.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    submitForm1() {
+      this.$refs["form1"].validate(valid => {
+        if (valid) {
+          updateLiveLotteryProductConf(this.form1).then(response => {
+            //200 成功
+            this.msgSuccess("保存成功");
+            this.openProduct = false;
+            this.resetForm1();
+          });
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      //如果抽奖状态不为0,则不能删除
+      if(row.lotteryStatus+"" !== "0"){
+        this.msgError("只能删除未开始的抽奖配置");
+        return;
+      }
+      const lotteryIds = row.lotteryId || this.ids;
+      this.$confirm('是否确认删除直播抽奖配置编号为"' + lotteryIds + '"的数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return delLiveLotteryConf(lotteryIds);
+        }).then(() => {
+          this.getList();
+          this.msgSuccess("删除成功");
+        }).catch(() => {});
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出所有直播抽奖配置数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(() => {
+          this.exportLoading = true;
+          return exportLiveLotteryConf(queryParams);
+        }).then(response => {
+          this.download(response.msg);
+          this.exportLoading = false;
+        }).catch(() => {});
+    }
+  }
+};
+</script>
+<style scoped>
+.prize-card {
+  margin-bottom: 20px;
+}
+
+.prize-header {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+}
+
+.add-prize-btn {
+  margin-top: 10px;
+  text-align: center;
+}
+
+.dialog-footer {
+  text-align: right;
+}
+
+</style>

+ 481 - 0
src/views/live/liveConfig/liveRedConf.vue

@@ -0,0 +1,481 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="红包状态" prop="redStatus">
+        <el-select v-model="queryParams.redStatus" placeholder="请选择红包状态" clearable size="small">
+          <el-option v-for="(item,index) in redStatusOptions" :key="item.dictValue+index" :label="item.dictLabel" :value="item.dictValue" />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="红包类型" prop="redType">
+        <el-select v-model="queryParams.redType" placeholder="请选择红包类型" clearable size="small">
+          <el-option v-for="(item,index) in redTypeOptions" :key="item.dictValue+index" :label="item.dictLabel" :value="item.dictValue" />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="直播间ID" prop="liveId" >
+        <el-input
+          v-model="queryParams.liveId"
+          placeholder="请输入直播间ID"
+          clearable
+          size="small"
+          :disabled="canLiveId"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="红包标题" prop="desc">
+        <el-input
+          v-model="queryParams.desc"
+          placeholder="请输入描述"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="创建日期" prop="createTime">
+        <el-date-picker clearable size="small"
+          v-model="queryParams.createTime"
+          type="date"
+          value-format="yyyy-MM-dd"
+          placeholder="选择创建日期">
+        </el-date-picker>
+      </el-form-item>
+      <el-form-item label="修改日期" prop="updateTime">
+        <el-date-picker clearable size="small"
+          v-model="queryParams.updateTime"
+          type="date"
+          value-format="yyyy-MM-dd"
+          placeholder="选择修改日期">
+        </el-date-picker>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          plain
+          icon="el-icon-plus"
+          size="mini"
+          @click="handleAdd"
+          v-hasPermi="['live:liveRedConf:add']"
+        >新增</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="success"
+          plain
+          icon="el-icon-edit"
+          size="mini"
+          :disabled="single"
+          @click="handleUpdate"
+          v-hasPermi="['live:liveRedConf:edit']"
+        >修改</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          plain
+          icon="el-icon-download"
+          size="mini"
+          :loading="exportLoading"
+          @click="handleExport"
+          v-hasPermi="['live:liveRedConf:export']"
+        >导出</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table border v-loading="loading" :data="liveRedConfList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="红包ID" align="center" prop="redId" />
+      <el-table-column label="红包状态" align="center" prop="redStatus" :formatter="redStatusFormatter"/>
+      <el-table-column label="有效时间 单位:分" align="center" prop="duration" />
+      <el-table-column label="红包类型" align="center" prop="redType" :formatter="redTypeFormatter"/>
+      <el-table-column label="直播间ID" align="center" prop="liveId" />
+      <el-table-column label="芳华币数量" align="center" prop="redNum" />
+      <el-table-column label="可中奖份量" align="center" prop="totalLots" />
+      <el-table-column label="实际发放奖励份量" align="center" prop="totalSend" />
+      <el-table-column label="红包标题" align="center" prop="desc" />
+      <el-table-column label="创建日期" align="center" prop="createTime" width="120">
+        <template slot-scope="scope">
+          <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="修改日期" align="center" prop="updateTime" width="120">
+        <template slot-scope="scope">
+          <span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d}') }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['live:liveRedConf:edit']"
+            style="margin-left: 10px"
+          >修改</el-button>
+          <!-- 开始 -->
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleStatusChange(scope.row,'1')"
+            v-hasPermi="['live:liveRedConf:edit']"
+          >开始</el-button>
+          <!-- 暂停 -->
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleStatusChange(scope.row,'3')"
+            v-hasPermi="['live:liveRedConf:edit']"
+          >暂停</el-button>
+          <!-- 结算 -->
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleStatusChange(scope.row,'2')"
+            v-hasPermi="['live:liveRedConf:edit']"
+          >结算</el-button>
+
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            v-hasPermi="['live:liveRedConf:edit']"
+          >删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 添加或修改直播红包记录配置对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="持续时间" prop="duration">
+          <el-input v-model="form.duration" placeholder="请输入红包有效时间 单位:分" />
+        </el-form-item>
+<!--        <el-form-item label="红包类型" prop="redType">
+          <el-select v-model="form.redType" placeholder="请选择红包类型">
+            <el-option v-for="(item,index) in redTypeOptions" :key="item.dictValue+index" :label="item.dictLabel" :value="item.dictValue" />
+          </el-select>
+        </el-form-item>-->
+        <el-form-item label="直播间ID" prop="liveId">
+          <el-input v-model="form.liveId" placeholder="请输入直播间ID" :disabled="canLiveId"/>
+        </el-form-item>
+        <el-form-item label="芳华币数" prop="redNum">
+          <el-input v-model="form.redNum" placeholder="请输入芳华币数量" />
+        </el-form-item>
+        <el-form-item label="中奖份量" prop="totalLots">
+          <el-input v-model="form.totalLots" placeholder="请输入可中奖份量" />
+        </el-form-item>
+        <el-form-item label="红包标题" prop="desc">
+          <el-input v-model="form.desc" placeholder="请输入红包描述" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { listLiveRedConf, getLiveRedConf, delLiveRedConf, addLiveRedConf, updateLiveRedConf, exportLiveRedConf } from "@/api/live/liveRedConf";
+
+export default {
+  name: "LiveRedConf",
+  data() {
+    return {
+      //字典
+      redStatusOptions: [],
+      redTypeOptions: [],
+      canLiveId:false,
+      //parentLiveId
+      parentLiveId : null,
+      // 遮罩层
+      loading: true,
+      // 导出遮罩层
+      exportLoading: false,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 直播红包记录配置表格数据
+      liveRedConfList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        redStatus: null,
+        redType: null,
+        liveId: null,
+        desc: null,
+        createTime: null,
+        updateTime: null,
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+        duration: [
+          { required: true, message: "有效时间 单位:分不能为空", trigger: "blur" }
+        ],
+        /* redType: [
+          { required: true, message: "红包类型不能为空", trigger: "change" }
+        ], */
+        liveId: [
+          { required: true, message: "直播间ID不能为空", trigger: "blur" }
+        ],
+        redNum: [
+          { required: true, message: "芳华币数量不能为空", trigger: "blur" }
+        ],
+        totalLots: [
+          { required: true, message: "可中奖份量不能为空", trigger: "blur" }
+        ],
+        desc: [
+          { required: true, message: "描述不能为空", trigger: "blur" }
+        ],
+      }
+    };
+  },
+  created() {
+    this.getDicts("sys_live_red_status").then(response => {
+      this.redStatusOptions = response.data;
+    });
+    this.getDicts("sys_live_red_type").then(response => {
+      this.redTypeOptions = response.data;
+    });
+    this.parentLiveId = this.$route.params.liveId;
+    this.queryParams.liveId = this.parentLiveId;
+    if(this.queryParams.liveId){
+      this.form.liveId = this.parentLiveId;
+      //设置查询条件直播间ID不可修改
+      this.canLiveId = true;
+    }
+    this.getList();
+  },
+  computed: {
+    liveId() {
+      return this.$route.params.liveId;
+    }
+  },
+  methods: {
+    handleStatusChange(row, status) {
+      if (this.$store.state.liveWs == null) {
+        this.msgError("请从直播间进行操作!");
+        return;
+      }
+      //结束的抽奖不能进行操作
+      if(row.redStatus+"" === "2"){
+        this.msgError("已结束的红包不能进行操作");
+        return;
+      }
+      switch (status+"") {
+        case "1":
+          //只能对未开启的抽奖进行操作
+          if(row.redStatus+"" !== "0" && row.redStatus+"" !== "3"){
+            this.msgError("只能对未开启或暂停的红包进行开始操作");
+            return;
+          }
+          break;
+        case "2":
+          //只能对进行中或暂停的红包进行结算
+          if(row.redStatus+"" !== "1" && row.redStatus+"" !== "3"){
+            this.msgError("只能对进行中或暂停的红包进行结算");
+            return;
+          }
+          break;
+        case "3":
+          //只能对进行中的抽奖执行暂停操作
+          if(row.redStatus+"" !== "1"){
+            this.msgError("只能对进行中的红包执行暂停操作");
+            return;
+          }
+          break;
+        default:
+          return;
+      }
+      const doRedParam = {
+        redId: row.redId,
+        redStatus: status
+      };
+      updateLiveRedConf(doRedParam).then(response => {
+        if(response.code === 200){
+          this.$store.state.liveWs.sendWs("red",response.msg, row.redId,this.liveId);
+          this.msgSuccess("修改成功");
+        }else{
+          this.msgError(response.msg);
+        }
+        this.open = false;
+        this.getList();
+      });
+    },
+    redStatusFormatter(row, column) {
+      return this.selectDictLabel(this.redStatusOptions, row.redStatus);
+    },
+    redTypeFormatter(row, column) {
+      return this.selectDictLabel(this.redTypeOptions, row.redType);
+    },
+    /** 查询直播红包记录配置列表 */
+    getList() {
+      this.loading = true;
+      listLiveRedConf(this.queryParams).then(response => {
+        this.liveRedConfList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        redId: null,
+        redStatus: null,
+        duration: null,
+        //redType: null,
+        liveId: null,
+        redNum: null,
+        totalLots: null,
+        totalSend: null,
+        desc: null,
+        createTime: null,
+        updateTime: null,
+        createBy: null,
+        updateBy: null
+      };
+      this.resetForm("form");
+      this.checkParentLiveId();
+    },
+    //判断父页面传入参数
+    checkParentLiveId(){
+      if(this.parentLiveId){
+        this.form.liveId = this.parentLiveId;
+        this.queryParams.liveId = this.parentLiveId;
+      }
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.checkParentLiveId();
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.redId)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加直播红包记录配置";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      //只能对未开始或暂停的抽奖进行修改
+      if(row.redStatus+"" !== "0" && row.redStatus+"" !== "3"){
+        this.msgError("只能对未开始或暂停的红包进行修改");
+        return;
+      }
+      this.reset();
+      const redId = row.redId || this.ids
+      getLiveRedConf(redId).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改直播红包记录配置";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.redId != null) {
+            updateLiveRedConf(this.form).then(response => {
+              this.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            this.form.redType = 1;
+            addLiveRedConf(this.form).then(response => {
+              this.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      //如果状态不为0,则不能删除
+      if (row.redStatus+"" !== "0") {
+        this.msgError("只能删除未发放的红包");
+        return;
+      }
+      const redIds = row.redId || this.ids;
+      this.$confirm('是否确认删除直播红包记录配置编号为"' + redIds + '"的数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return delLiveRedConf(redIds);
+        }).then(() => {
+          this.getList();
+          this.msgSuccess("删除成功");
+        }).catch(() => {});
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出所有直播红包记录配置数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(() => {
+          this.exportLoading = true;
+          return exportLiveRedConf(queryParams);
+        }).then(response => {
+          this.download(response.msg);
+          this.exportLoading = false;
+        }).catch(() => {});
+    }
+  }
+};
+</script>

+ 391 - 0
src/views/live/liveConfig/watchReward.vue

@@ -0,0 +1,391 @@
+<template >
+  <div v-loading.fullscreen.lock="loading">
+    <!-- 提示信息 -->
+    <div class="tip-message" >
+      设置观看奖励,用户达到直播观看时长后可领取奖励
+    </div>
+
+    <!-- 开启观看奖励开关 -->
+    <div class="reward-switch">
+      <span class="switch-label">开启观看奖励</span>
+      <el-switch v-model="watchRewardForm.enabled"></el-switch>
+    </div>
+
+    <!-- 观看奖励设置 -->
+    <div v-if="watchRewardForm.enabled" class="section-block">
+      <div class="section-title">观看奖励设置</div>
+
+      <!-- 表单内容 -->
+      <el-form
+        :model="watchRewardForm"
+        :rules="rules"
+        ref="watchRewardForm"
+        label-width="130px"
+      >
+        <!-- 参与条件 -->
+        <el-form-item label="参与条件" prop="participateCondition">
+          <el-radio v-model="watchRewardForm.participateCondition" label="1">
+            达到指定观看时长
+          </el-radio>
+        </el-form-item>
+
+        <!-- 观看时长 -->
+        <el-form-item label="观看时长" prop="watchDuration">
+          <el-input v-model="watchRewardForm.watchDuration" placeholder="请输入观看时长" class="duration-input">
+            <template #append>分钟</template>
+          </el-input>
+        </el-form-item>
+
+        <!-- 实施动作 -->
+        <el-form-item label="实施动作" prop="action">
+          <el-select v-model="watchRewardForm.action" placeholder="请选择实施动作" style="width: 300px;">
+            <el-option
+              v-for="item in actionOptions"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+
+        <!-- 领取提示语 -->
+        <el-form-item label="领取提示语" prop="receivePrompt">
+          <el-input v-model="watchRewardForm.receivePrompt" placeholder="请输入领取提示语"></el-input>
+        </el-form-item>
+
+        <!-- 红包设置 -->
+        <div>
+          <div class="section-title">红包设置</div>
+
+          <!-- 根据实施动作类型显示不同的表单内容 -->
+          <template v-if="watchRewardForm.action === '1'">
+            <!-- 现金红包设置 -->
+            <!-- 红包发放方式   1固定金额 2随机金额 -->
+            <el-form-item label="红包发放方式" prop="redPacketType">
+              <el-radio-group v-model="watchRewardForm.redPacketType">
+                <el-radio label="1">固定金额</el-radio>
+                <el-radio label="2">随机金额</el-radio>
+              </el-radio-group>
+            </el-form-item>
+
+            <!-- 红包金额 -->
+            <el-form-item label="红包金额" prop="redPacketAmount">
+              <el-input v-model="watchRewardForm.redPacketAmount" placeholder="请输入红包金额"></el-input>
+            </el-form-item>
+
+            <!-- 红包发放数量 -->
+            <el-form-item label="红包发放数量" prop="redPacketCount">
+              <el-input v-model="watchRewardForm.redPacketCount" placeholder="红包数量+28888人数"></el-input>
+            </el-form-item>
+
+            <!-- 红包领取方式  1二维码核销 2微信提现 -->
+            <el-form-item label="红包领取方式" prop="receiveMethod">
+              <el-radio-group v-model="watchRewardForm.receiveMethod">
+                <el-radio label="1">二维码领取</el-radio>
+                <el-radio label="2">微信发放</el-radio>
+              </el-radio-group>
+            </el-form-item>
+          </template>
+
+          <template v-else>
+            <!-- 积分红包设置 -->
+            <!-- 积分值 -->
+            <el-form-item label="积分值" prop="scoreAmount">
+              <el-input
+                v-model="watchRewardForm.scoreAmount"
+                placeholder="请输入积分值"                style="width: 300px;"
+              ></el-input>
+            </el-form-item>
+
+            <!-- 最大领取人数 -->
+            <el-form-item label="最大领取人数" prop="maxReceivers">
+              <el-input
+                v-model="watchRewardForm.maxReceivers"
+                placeholder="请输入最大领取人数"                style="width: 300px;"
+              ></el-input>
+            </el-form-item>
+          </template>
+        </div>
+
+        <!-- 其他设置 -->
+        <div >
+          <div class="section-title">其他设置</div>
+
+          <template v-if="watchRewardForm.action === '1'">
+            <!-- 客服引导  1跟进企业微信 2不设置 -->
+            <el-form-item label="客服引导" prop="showGuide">
+              <el-radio-group v-model="watchRewardForm.showGuide">
+                <el-radio label="1">跟进企业微信</el-radio>
+                <el-radio label="2">不设置</el-radio>
+              </el-radio-group>
+            </el-form-item>
+
+            <!-- 客服引导语 -->
+            <el-form-item label="客服引导语" prop="guideText">
+              <el-input
+                v-model="watchRewardForm.guideText"
+                placeholder="请输入客服引导语"                style="width: 300px;"
+              ></el-input>
+            </el-form-item>
+          </template>
+
+          <template v-else>
+            <!-- 积分使用引导语 -->
+            <el-form-item label="积分使用引导语" prop="scoreGuideText">
+              <el-input
+                v-model="watchRewardForm.scoreGuideText"
+                placeholder="请输入积分使用引导语"                style="width: 300px;"
+              ></el-input>
+            </el-form-item>
+
+            <!-- 积分使用引导链接 -->
+            <el-form-item label="积分使用引导链接" prop="scoreGuideLink">
+              <el-input
+                v-model="watchRewardForm.scoreGuideLink"
+                placeholder="请输入积分使用引导链接"                style="width: 300px;"
+              ></el-input>
+            </el-form-item>
+
+            <!-- 引导语 -->
+            <el-form-item label="引导语" prop="guideText">
+              <el-input
+                v-model="watchRewardForm.guideText"
+                placeholder="请输入引导语"                style="width: 300px;"
+              ></el-input>
+            </el-form-item>
+          </template>
+        </div>
+
+        <!-- 保存按钮 -->
+        <div class="form-actions">
+          <el-button type="primary" @click="saveWatchReward">保存</el-button>
+        </div>
+      </el-form>
+    </div>
+  </div>
+</template>
+
+<script>
+import {addConfig, getConfig, updateConfig} from "@/api/live/liveQuestionLive";
+
+export default {
+  data() {
+    return {
+      loading: true,
+      liveId: null,
+      watchRewardForm: {
+        id: null,
+        liveId: null,
+        // 是否启用观看奖励
+        enabled: false,
+        // 参与条件
+        participateCondition: '1',
+        // 观看时长
+        watchDuration: '',
+        // 实施动作
+        action: '1',
+        // 领取提示语
+        receivePrompt: '',
+        // 红包发放方式(固定金额/随机金额)
+        redPacketType: '1',
+        // 红包金额
+        redPacketAmount: '',
+        // 红包发放数量
+        redPacketCount: '',
+        // 红包领取方式
+        receiveMethod: '1',
+        // 是否显示客服引导
+        showGuide: '1',
+        // 客服引导语
+        guideText: '',
+        // 积分值
+        scoreAmount: '',
+        // 最大领取人数
+        maxReceivers: '',
+        // 积分使用引导语
+        scoreGuideText: '',
+        // 积分使用引导链接
+        scoreGuideLink: ''
+      },
+      rules:{
+        participateCondition:[
+          { required: true, message: '请选择参与条件', trigger: 'blur'}
+        ],
+        watchDuration:[
+          { required: true, message: '请输入观看时长', trigger: 'blur'}
+        ],
+        action:[
+          { required: true, message: '请选择实施动作', trigger: 'blur'}
+        ],
+        receivePrompt:[
+          { required: true, message: '请输入领取提示语', trigger: 'blur'}
+        ],
+        redPacketType:[
+          { required: true, message: '请选择红包发放方式', trigger: 'blur'}
+        ],
+        redPacketAmount:[
+          { required: true, message: '请输入红包金额', trigger: 'blur'}
+        ],
+        receiveMethod:[
+          { required: true, message: '请选择红包领取方式', trigger: 'blur'}
+        ],
+        guideText:[
+          { required: true, message: '请输入客服引导语', trigger: 'blur'}
+        ],
+        showGuide:[
+          { required: true, message: '请选择是否显示客服引导', trigger: 'blur'}
+        ]
+      },
+      // 添加实施动作选项
+      actionOptions: [
+        {
+          label: '现金红包',
+          value: '1'
+        },
+        {
+          label: '积分红包',
+          value: '2'
+        }
+      ],
+
+    };
+  },
+  created() {
+    this.liveId = this.$route.params.liveId
+    this.getLiveConfig();
+  },
+  methods: {
+    getLiveConfig(){
+      getConfig(this.liveId).then(response => {
+        if(response.code === 200){
+          this.watchRewardForm = JSON.parse(response.data)
+          this.loading = false
+        }
+      })
+    },
+    saveWatchReward() {
+      this.$refs["watchRewardForm"].validate(valid => {
+        console.log(valid)
+        if (valid) {
+          if (this.watchRewardForm.id == null) {
+            // 调用保存观看奖励接口
+            // 实现保存逻辑
+            addConfig(this.watchRewardForm).then(res => {
+              if (res.code == 200) {
+                this.msgSuccess("修改成功");
+              }
+            })
+          } else {
+            updateConfig(this.watchRewardForm).then(response => {
+              this.msgSuccess("修改成功");
+            });
+          }
+        }
+      })
+    },
+  }
+};
+</script>
+
+<style scoped>
+/* 提示信息样式 */
+.tip-message {
+  padding: 12px 16px;
+  background-color: #FFF6F2;
+  border-radius: 4px;
+  color: #666;
+  font-size: 14px;
+  margin-bottom: 20px;
+}
+
+
+/* 开关容器样式 */
+.reward-switch {
+  margin-left: 200px;
+  margin-bottom: 20px;
+  padding: 20px;
+  background-color: #fff;
+  border-radius: 4px;
+  display: flex;
+  align-items: center;
+}
+
+/* 开关标签样式 */
+.reward-switch .switch-label {
+  margin-right: 10px;
+  font-size: 14px;
+  color: #333;
+  margin-left: 50px;
+}
+
+/* 表单区块样式 */
+.section-block {
+  width: 50%;
+  background-color: #fff;
+  padding: 20px;
+  border-radius: 4px;
+  margin-left: 50px;
+  margin-bottom: 20px;
+}
+
+/* 标题样式 */
+.section-block .section-title {
+  font-size: 14px;
+  color: #333;
+  margin-bottom: 20px;
+  border-left: 4px solid #409EFF;
+  padding-left: 10px;
+  line-height: 1;
+}
+
+/* 表单样式 */
+.reward-form {
+  margin-top: 20px;
+}
+
+/* 表单项样式 */
+.reward-form .el-form-item {
+  margin-bottom: 22px;
+  padding-left: 50px;
+}
+
+.reward-form .el-form-item:last-child {
+  margin-bottom: 0;
+}
+
+/* 表单标签样式 */
+.reward-form .el-form-item .el-form-item__label {
+  color: #606266;
+}
+
+/* 输入框统一宽度 */
+.reward-form .el-form-item .el-input {
+  width: 300px;
+}
+
+/* 必填项星号样式 */
+.reward-form .el-form-item.is-required .el-form-item__label:before {
+  color: #F56C6C;
+}
+
+/* 观看时长输入框样式 */
+.reward-form .el-form-item .duration-input {
+  width: 300px;
+}
+
+.reward-form .el-form-item .duration-input .el-input__inner {
+  text-align: left;
+}
+
+/* 保存按钮样式 */
+.form-actions {
+  width: 600px;
+  text-align: center;
+  margin-top: 30px;
+}
+
+.form-actions .el-button {
+  padding: 8px 20px;
+  font-size: 13px;
+}
+</style>

+ 48 - 0
src/views/live/liveConfig/watchScore.vue

@@ -0,0 +1,48 @@
+<template>
+  <el-form ref="form"  label-width="80px">
+    <el-form-item>
+      <el-form-item label="上传图片" prop="materialUrl">
+        <ImageUpload @input="handleUrl" type="image" :num="10" :width="150" :height="150" />
+      </el-form-item>
+      <el-button type="primary" size="mini" @click="submit">保存</el-button>
+    </el-form-item>
+  </el-form>
+</template>
+
+<script>
+import ImageUpload from "@/views/qw/material/ImageUpload.vue";
+import {verifyIdInfo, getLive} from '@/api/live/live'
+
+export default {
+  components: { ImageUpload },
+  props: {
+    liveInfo: {
+      type: Object,
+      default: () => ({}) // 默认值为一个空对象
+    },
+  },
+  data() {
+    return {
+      liveId: this.liveInfo.liveId,
+    };
+  },
+  created() {
+  },
+  methods: {
+    submit(){
+      verifyIdInfo({ liveId: this.liveId, idCardUrl: this.idCardUrl}).then(response => {
+        if (response.code == 200) {
+          this.$message.success("保存成功");
+        } else {
+          this.$message.success(response.msg);
+        }
+      })
+    },
+    handleUrl(data){
+      if (data.length > 0) {
+        this.idCardUrl = data;
+      }
+    }
+  }
+};
+</script>

+ 15 - 19
src/views/live/liveConsole/index.vue

@@ -181,7 +181,6 @@ import { changeUserStatus, watchUserList } from '@/api/live/liveWatchUser'
 import { getLiveVideoByLiveId } from '@/api/live/liveVideo'
 import { getLivingUrl } from '@/api/live/live'
 import { listLiveMsg } from '@/api/live/liveMsg'
-import { LiveWS } from '@/utils/liveWS'
 import Hls from 'hls.js';
 
 export default {
@@ -195,6 +194,8 @@ export default {
         activeName: "talk",
       },
       livingUrl:"",
+      loadMsgMaxPage: 2,
+      his: null,
       liveVideo: {},
       socket: null,
       liveWsUrl: process.env.VUE_APP_LIVE_WS_URL + '/app/webSocket',
@@ -272,20 +273,11 @@ export default {
       var isUrl = this.livingUrl === null || this.livingUrl.trim() === ''
       if (Hls.isSupported() && !isUrl) {
         const videoElement = this.$refs.videoPlayer
-        // ✅ 配置项在这里传入
-        const config = {
-          lowLatencyMode: true,        // 启用低延迟模式
-          liveSyncDuration: 1,         // 与直播流同步的时间(秒)
-          maxBufferLength: 1,          // 控制最大缓冲时间(秒)
-          backBufferLength: 30,        // 控制回放缓存大小(单位:秒)
-          maxBufferSize: 1 * 1024 * 1024, // 最大缓存大小(字节)
-          liveMaxLatencyDuration: 3,   // 最大延迟容忍值(秒)
-        };
-        const hls = new Hls(config);
-        hls.attachMedia(videoElement);
-        hls.on(Hls.Events.MEDIA_ATTACHED, () => {
-          hls.loadSource(this.livingUrl);
-          hls.on(Hls.Events.STREAM_LOADED, (event, data) => {
+        this.hls = new Hls(config);
+        this.hls.attachMedia(videoElement);
+        this.hls.on(Hls.Events.MEDIA_ATTACHED, () => {
+          this.hls.loadSource(this.livingUrl);
+          this.hls.on(Hls.Events.STREAM_LOADED, (event, data) => {
             videoElement.play();
           });
         });
@@ -375,7 +367,7 @@ export default {
             })
 
             // 没加载完继续加载
-            if (this.msgParams.pageNum < totalPage) {
+            if (this.msgParams.pageNum < this.loadMsgMaxPage) {
               this.msgParams.pageNum = parseInt(this.msgParams.pageNum) + 1;
               this.loadMsgList()
             }
@@ -425,9 +417,12 @@ export default {
       })
     },
     connectWebSocket() {
-      let socket = new LiveWS(this.liveWsUrl, this.liveId, this.userId);
-      socket.onmessage = (event) => this.handleWsMessage(event)
-      this.socket = socket
+      this.$store.dispatch('initLiveWs', {
+        liveWsUrl: this.liveWsUrl,
+        liveId: this.liveId,
+        userId: this.userId
+      })
+      this.socket.onmessage = (event) => this.handleWsMessage(event)
     },
     handleWsMessage(event) {
       let { code, data } = JSON.parse(event.data)
@@ -485,6 +480,7 @@ export default {
   },
   destroyed() {
     this.socket?.close()
+    this.hls?.destroy();
   }
 }
 </script>

+ 386 - 0
src/views/live/liveLotteryProductConf/index.vue

@@ -0,0 +1,386 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="抽奖ID" prop="lotteryId">
+        <el-input
+          v-model="queryParams.lotteryId"
+          placeholder="请输入抽奖ID"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="直播间ID" prop="liveId">
+        <el-input
+          v-model="queryParams.liveId"
+          placeholder="请输入直播间ID"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="商品ID" prop="productId">
+        <el-input
+          v-model="queryParams.productId"
+          placeholder="请输入商品ID"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="奖品等级" prop="prizeLevel">
+        <el-input
+          v-model="queryParams.prizeLevel"
+          placeholder="请输入奖品等级"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="单次中奖商品数量" prop="perLotteryNum">
+        <el-input
+          v-model="queryParams.perLotteryNum"
+          placeholder="请输入单次中奖商品数量"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="奖励总份数" prop="totalLots">
+        <el-input
+          v-model="queryParams.totalLots"
+          placeholder="请输入奖励总份数"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="实际发放奖励份数" prop="totalSend">
+        <el-input
+          v-model="queryParams.totalSend"
+          placeholder="请输入实际发放奖励份数"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="创建日期" prop="createTime">
+        <el-date-picker clearable size="small"
+          v-model="queryParams.createTime"
+          type="date"
+          value-format="yyyy-MM-dd"
+          placeholder="选择创建日期">
+        </el-date-picker>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          plain
+          icon="el-icon-plus"
+          size="mini"
+          @click="handleAdd"
+          v-hasPermi="['live:liveLotteryProductConf:add']"
+        >新增</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="success"
+          plain
+          icon="el-icon-edit"
+          size="mini"
+          :disabled="single"
+          @click="handleUpdate"
+          v-hasPermi="['live:liveLotteryProductConf:edit']"
+        >修改</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="danger"
+          plain
+          icon="el-icon-delete"
+          size="mini"
+          :disabled="multiple"
+          @click="handleDelete"
+          v-hasPermi="['live:liveLotteryProductConf:remove']"
+        >删除</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          plain
+          icon="el-icon-download"
+          size="mini"
+          :loading="exportLoading"
+          @click="handleExport"
+          v-hasPermi="['live:liveLotteryProductConf:export']"
+        >导出</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table border v-loading="loading" :data="liveLotteryProductConfList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="ID" align="center" prop="id" />
+      <el-table-column label="抽奖ID" align="center" prop="lotteryId" />
+      <el-table-column label="直播间ID" align="center" prop="liveId" />
+      <el-table-column label="商品ID" align="center" prop="productId" />
+      <el-table-column label="奖品等级" align="center" prop="prizeLevel" />
+      <el-table-column label="单次中奖商品数量" align="center" prop="perLotteryNum" />
+      <el-table-column label="奖励总份数" align="center" prop="totalLots" />
+      <el-table-column label="实际发放奖励份数" align="center" prop="totalSend" />
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['live:liveLotteryProductConf:edit']"
+          >修改</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            v-hasPermi="['live:liveLotteryProductConf:remove']"
+          >删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 添加或修改直播抽奖记录对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="抽奖ID" prop="lotteryId">
+          <el-input v-model="form.lotteryId" placeholder="请输入抽奖ID" />
+        </el-form-item>
+        <el-form-item label="直播间ID" prop="liveId">
+          <el-input v-model="form.liveId" placeholder="请输入直播间ID" />
+        </el-form-item>
+        <el-form-item label="商品ID" prop="productId">
+          <el-input v-model="form.productId" placeholder="请输入商品ID" />
+        </el-form-item>
+        <el-form-item label="奖品等级" prop="prizeLevel">
+          <el-input v-model="form.prizeLevel" placeholder="请输入奖品等级" />
+        </el-form-item>
+        <el-form-item label="单次中奖商品数量" prop="perLotteryNum">
+          <el-input v-model="form.perLotteryNum" placeholder="请输入单次中奖商品数量" />
+        </el-form-item>
+        <el-form-item label="奖励总份数" prop="totalLots">
+          <el-input v-model="form.totalLots" placeholder="请输入奖励总份数" />
+        </el-form-item>
+        <el-form-item label="实际发放奖励份数" prop="totalSend">
+          <el-input v-model="form.totalSend" placeholder="请输入实际发放奖励份数" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { listLiveLotteryProductConf, getLiveLotteryProductConf, delLiveLotteryProductConf, addLiveLotteryProductConf, updateLiveLotteryProductConf, exportLiveLotteryProductConf } from "@/api/live/liveLotteryProductConf";
+
+export default {
+  name: "LiveLotteryProductConf",
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 导出遮罩层
+      exportLoading: false,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 直播抽奖记录表格数据
+      liveLotteryProductConfList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        lotteryId: null,
+        liveId: null,
+        productId: null,
+        prizeLevel: null,
+        perLotteryNum: null,
+        totalLots: null,
+        totalSend: null,
+        createTime: null,
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+        lotteryId: [
+          { required: true, message: "抽奖ID不能为空", trigger: "blur" }
+        ],
+        liveId: [
+          { required: true, message: "直播间ID不能为空", trigger: "blur" }
+        ],
+        productId: [
+          { required: true, message: "商品ID不能为空", trigger: "blur" }
+        ],
+        prizeLevel: [
+          { required: true, message: "奖品等级不能为空", trigger: "blur" }
+        ],
+        perLotteryNum: [
+          { required: true, message: "单次中奖商品数量不能为空", trigger: "blur" }
+        ],
+        totalLots: [
+          { required: true, message: "奖励总份数不能为空", trigger: "blur" }
+        ],
+        totalSend: [
+          { required: true, message: "实际发放奖励份数不能为空", trigger: "blur" }
+        ],
+      }
+    };
+  },
+  created() {
+    this.getList();
+  },
+  methods: {
+    /** 查询直播抽奖记录列表 */
+    getList() {
+      this.loading = true;
+      listLiveLotteryProductConf(this.queryParams).then(response => {
+        this.liveLotteryProductConfList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        id: null,
+        lotteryId: null,
+        liveId: null,
+        productId: null,
+        prizeLevel: null,
+        perLotteryNum: null,
+        totalLots: null,
+        totalSend: null,
+        createTime: null,
+        updateTime: null,
+        createBy: null,
+        updateBy: null
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.id)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加直播抽奖记录";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const id = row.id || this.ids
+      getLiveLotteryProductConf(id).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改直播抽奖记录";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.id != null) {
+            updateLiveLotteryProductConf(this.form).then(response => {
+              this.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addLiveLotteryProductConf(this.form).then(response => {
+              this.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const ids = row.id || this.ids;
+      this.$confirm('是否确认删除直播抽奖记录编号为"' + ids + '"的数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return delLiveLotteryProductConf(ids);
+        }).then(() => {
+          this.getList();
+          this.msgSuccess("删除成功");
+        }).catch(() => {});
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出所有直播抽奖记录数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(() => {
+          this.exportLoading = true;
+          return exportLiveLotteryProductConf(queryParams);
+        }).then(response => {
+          this.download(response.msg);
+          this.exportLoading = false;
+        }).catch(() => {});
+    }
+  }
+};
+</script>

+ 2 - 1
src/views/live/talentLive/index.vue

@@ -256,7 +256,7 @@ export default {
     this.isLoading = false
   },
   mounted() {
-    this.checkUserNetwork();
+    // this.checkUserNetwork();
   },
   methods: {
     connectWebSocket() {
@@ -631,6 +631,7 @@ export default {
   },
   destroyed() {
     this.socket?.close()
+    this.hls?.destroy()
   }
 };
 </script>