Procházet zdrojové kódy

直播回放修改 直播查询条件

yuhongqi před 1 týdnem
rodič
revize
f0bf1f1b9b

+ 111 - 4
src/views/live/live/index.vue

@@ -42,12 +42,87 @@
           placeholder="请输入直播名称"
           clearable
           size="small"
-          @keyup.enter.native="handleQuery"
         />
       </el-form-item>
+      <el-form-item label="直播状态" prop="liveStatus">
+        <el-select
+          v-model="queryParams.status"
+          placeholder="请选择直播状态"
+          clearable
+          size="small"
+        >
+          <el-option label="待直播" value="1"></el-option>
+          <el-option label="直播中" value="2"></el-option>
+          <el-option label="已结束" value="3"></el-option>
+          <el-option label="直播回放中" value="4"></el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item label="公司名称" prop="companyName">
+        <el-input
+          v-model="queryParams.companyName"
+          placeholder="请输入公司名称"
+          clearable
+          size="small"
+        />
+      </el-form-item>
+      <el-form-item label="直播类型" prop="liveType">
+        <el-select
+          v-model="queryParams.liveType"
+          placeholder="请选择直播类型"
+          clearable
+          size="small"
+        >
+          <el-option label="直播" value="1"></el-option>
+          <el-option label="录播" value="2"></el-option>
+          <el-option label="直播回放" value="3"></el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item label="开始时间" prop="startTimeS">
+        <el-date-picker
+          v-model="queryParams.startTimeS"
+          type="datetime"
+          placeholder="选择起始时间"
+          value-format="yyyy-MM-dd HH:mm:ss"
+          size="small"
+        ></el-date-picker>
+      </el-form-item>
+      <!-- 开始时间-范围结束 -->
+      <el-form-item label="结束时间" prop="endTimeE">
+        <el-date-picker
+          v-model="queryParams.endTimeE"
+          type="datetime"
+          placeholder="选择结束时间"
+          value-format="yyyy-MM-dd HH:mm:ss"
+          size="small"
+          :disabled="!queryParams.startTimeS"
+        ></el-date-picker>
+      </el-form-item>
+      <el-form-item label="上下架" prop="isShow">
+        <el-select
+          v-model="queryParams.isShow"
+          placeholder="请选择上下架状态"
+          clearable
+          size="small"
+        >
+          <el-option label="上架" value="1"></el-option>
+          <el-option label="下架" value="2"></el-option>
+        </el-select>
+      </el-form-item>
+      <!-- 审核状态 -->
+      <el-form-item label="审核状态" prop="isAudit">
+        <el-select
+          v-model="queryParams.isAudit"
+          placeholder="请选择审核状态"
+          clearable
+          size="small"
+        >
+          <el-option label="审核未通过" value="0"></el-option>
+          <el-option label="审核通过" value="1"></el-option>
+        </el-select>
+      </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>
@@ -401,6 +476,8 @@ export default {
         anchorId: null,
         liveType: null,
         startTime: null,
+        startTimeS: null,
+        endTimeE: null,
         finishTime: null,
         liveImgUrl: null,
         liveConfig: null,
@@ -460,6 +537,35 @@ export default {
   created() {
     this.getList();
   },
+  watch: {
+    'form.startTime': {
+      handler(newVal) {
+        // 1. 若 startTime 为空,直接返回(避免无效处理)
+        if (!newVal) return;
+
+        // 2. 将字符串时间转为 Date 对象(处理 "yyyy-MM-dd HH:mm:ss" 格式)
+        const timeObj = new Date(newVal);
+        // 兼容时间解析失败的情况(如格式错误)
+        if (isNaN(timeObj.getTime())) return;
+
+        // 3. 强制将秒数设为 1 并补零(即 01 秒)
+        timeObj.setSeconds(1); // 固定秒数为 1
+        const formattedSeconds = this.pad(timeObj.getSeconds()); // 补零为 "01"
+
+        // 4. 重新拼接完整的时间字符串(保持原格式:yyyy-MM-dd HH:mm:ss)
+        const year = timeObj.getFullYear();
+        const month = this.pad(timeObj.getMonth() + 1); // 月份从 0 开始,需 +1
+        const day = this.pad(timeObj.getDate());
+        const hours = this.pad(timeObj.getHours());
+        const minutes = this.pad(timeObj.getMinutes());
+
+        // 5. 更新 form.startTime,完成格式强制修正
+        this.form.startTime = `${year}-${month}-${day} ${hours}:${minutes}:${formattedSeconds}`;
+      },
+      immediate: true, // 初始化时立即执行一次(确保初始值也符合格式)
+      deep: false // startTime 是字符串,无需深度监听
+    }
+  },
   methods: {
     beforeAvatarUpload(file) {
       const isLt1M = file.size / 1024 / 1024 < 1;
@@ -609,7 +715,6 @@ export default {
     timeChange(){
       if(!this.form.startTime) return;
       if(!this.form.duration) return;
-      console.info(this.form.startTime)
       const startDateTime = new Date(this.form.startTime);
       // 将视频时长(秒)加到开始时间
       const endDateTime = new Date(startDateTime.getTime() + this.form.duration * 1000); // 毫秒为单位
@@ -665,6 +770,7 @@ export default {
     /** 重置按钮操作 */
     resetQuery() {
       this.resetForm("queryForm");
+      this.queryParams.status = null;
       this.handleQuery();
     },
     /** 新增按钮操作 */
@@ -815,7 +921,8 @@ export default {
         cancelButtonText: "取消",
         type: "warning"
       }).then(() => {
-        copyLive({"liveId":row.liveId}).then(response=>{this.getList()})
+        this.loading = true;
+        copyLive({"liveId":row.liveId}).then(response=>{this.getList();this.loading = false;})
       }).catch(() => {});
     },
     /** 导出按钮操作 */

+ 1 - 0
src/views/live/liveConfig/liveReplay.vue

@@ -314,6 +314,7 @@ export default {
         liveId: this.liveId,
         startTime:this.liveInfo.startTime,
         finishTime:this.liveInfo.finishTime,
+        status: 4,
         liveConfig: JSON.stringify(this.replayForm)
       };
       updateLive(param).then(res => {