xgb 3 днів тому
батько
коміт
f86569e889

+ 27 - 0
src/api/live/liveSignRecord.js

@@ -0,0 +1,27 @@
+import request from '@/utils/request'
+
+// 查询直播签到记录列表
+export function listLiveSignRecord(query) {
+  return request({
+    url: '/his/liveSignRecord/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询直播签到记录详细
+export function getLiveSignRecord(id) {
+  return request({
+    url: '/his/liveSignRecord/' + id,
+    method: 'get'
+  })
+}
+
+// 导出直播签到记录
+export function exportLiveSignRecord(query) {
+  return request({
+    url: '/his/liveSignRecord/export',
+    method: 'post',
+    params: query
+  })
+}

+ 84 - 0
src/views/live/live/index.vue

@@ -349,6 +349,11 @@
               <el-dropdown-item @click.native="handleAudit(scope.row)">
                 <i class="el-icon-service"></i> 审核
               </el-dropdown-item>
+              <el-dropdown-item
+                v-if="scope.row.status != 2"
+                @click.native="handleRoomPassword(scope.row)">
+                <i class="el-icon-service"></i> 房间密码
+              </el-dropdown-item>
 <!--              <el-dropdown-item -->
 <!--                @click.native="handleExportComments(scope.row)"-->
 <!--                :disabled="exportingComments[scope.row.liveId]"-->
@@ -671,6 +676,38 @@
         <el-button @click="addTagCancel">取 消</el-button>
       </div>
     </el-dialog>
+
+    <!-- 设置房间密码对话框 -->
+    <el-dialog
+      title="设置房间密码"
+      :visible.sync="roomPasswordDialog.open"
+      width="500px"
+      append-to-body
+      class="simple-dialog"
+    >
+      <el-form ref="roomPasswordForm" :model="roomPasswordForm" :rules="roomPasswordRules" label-width="100px">
+        <el-form-item label="直播ID">
+          <el-input v-model="roomPasswordForm.liveId" disabled />
+        </el-form-item>
+        <el-form-item label="直播名称">
+          <el-input v-model="roomPasswordForm.liveName" disabled />
+        </el-form-item>
+        <el-form-item label="房间密码" prop="roomPassword">
+          <el-input
+            v-model="roomPasswordForm.roomPassword"
+            placeholder="请输入房间密码(留空表示无密码)"
+            clearable
+            maxlength="20"
+            show-word-limit
+          />
+          <div class="form-tip">提示:设置密码后,用户进入直播间需要输入密码</div>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitRoomPassword">确 定</el-button>
+        <el-button @click="roomPasswordDialog.open = false">取 消</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
@@ -822,6 +859,22 @@ export default {
       },
       // 导出评论状态:key为liveId,value为是否正在导出
       exportingComments: {},
+      // 房间密码弹窗
+      roomPasswordDialog: {
+        open: false
+      },
+      // 房间密码表单
+      roomPasswordForm: {
+        liveId: null,
+        liveName: null,
+        roomPassword: null
+      },
+      // 房间密码表单校验
+      roomPasswordRules: {
+        roomPassword: [
+          { max: 20, message: '密码长度不能超过20个字符', trigger: 'blur' }
+        ]
+      }
     };
   },
   created() {
@@ -1252,6 +1305,37 @@ export default {
     handleImgError(e) {
       e.target.src = this.defaultImg;
     },
+    // 设置房间密码
+    handleRoomPassword(row){
+      this.roomPasswordForm.liveId = row.liveId
+      this.roomPasswordForm.liveName = row.liveName
+      this.roomPasswordForm.roomPassword = row.roomPassword || ''
+      this.roomPasswordDialog.open = true
+    },
+    // 提交房间密码
+    submitRoomPassword() {
+      this.$refs['roomPasswordForm'].validate(valid => {
+        if (valid) {
+          const params = {
+            liveId: this.roomPasswordForm.liveId,
+            roomPassword: this.roomPasswordForm.roomPassword || ''
+          }
+
+          updateLive(params).then(response => {
+            if (response.code === 200) {
+              this.$message.success('房间密码设置成功')
+              this.roomPasswordDialog.open = false
+              this.getList()
+            } else {
+              this.$message.error(response.msg || '设置失败')
+            }
+          }).catch(error => {
+            console.error('设置房间密码失败:', error)
+            this.$message.error('设置失败,请稍后重试')
+          })
+        }
+      })
+    },
     handleAudit(row) {
       this.$alert("是否审核通过?", "审核", {
         confirmButtonText: "同意",

+ 19 - 0
src/views/live/liveConfig/task.vue

@@ -229,6 +229,9 @@
             <el-option v-for="i in goodsStatusOptions" :key="i.value" :label="i.label" :value="i.value"></el-option>
           </el-select>
         </el-form-item>
+        <el-form-item label="序号" prop="signNo" v-if="form.taskType == 7">
+          <el-input v-model="form.signNo" placeholder="请输入签到序号" />
+        </el-form-item>
         <el-form-item label="触发时间" prop="content">
           <el-time-picker
             default-value="2025-01-01 00:00:00"
@@ -297,6 +300,9 @@ export default {
         {
           value: 6,
           label: "定时商品上下架"
+        },{
+          value: 7,
+          label: "签到"
         }
       ],
       statusOptions:[{
@@ -668,6 +674,7 @@ export default {
         content: null,
         goodsId: null,
         goodsStatus: null,
+        signNo:null,
         status: 1,
         createdTime: null,
         updatedTime: null
@@ -731,6 +738,8 @@ export default {
         }else if(this.form.taskType == 6){
           this.form.goodsId = content.goodsId;
           this.form.goodsStatus = content.status;
+        }else if(this.form.taskType == 7){
+          this.form.signNo = content.signNo;
         }
         this.open = true;
         this.title = "修改直播间自动化任务配置";
@@ -754,6 +763,16 @@ export default {
         })
 
       }
+      if(this.form.taskType == 7){
+        if(this.form.signNo == null) {
+          this.msgError("必须填写签到序号");
+          return;
+        }
+        this.form.content = JSON.stringify({
+          signNo: this.form.signNo
+        })
+      }
+
       this.$refs["form"].validate(valid => {
         if (valid) {
           if (this.form.id != null) {

+ 173 - 0
src/views/live/liveSignRecord/index.vue

@@ -0,0 +1,173 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px">
+      <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="用户名称" prop="userName">
+        <el-input
+          v-model="queryParams.userName"
+          placeholder="请输入用户名称"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="用户ID" prop="userId">
+        <el-input
+          v-model="queryParams.userId"
+          placeholder="请输入用户ID"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="签到序号" prop="signNo">
+        <el-input
+          v-model="queryParams.signNo"
+          placeholder="请输入签到序号"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </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="warning"
+          plain
+          icon="el-icon-download"
+          size="mini"
+          :loading="exportLoading"
+          @click="handleExport"
+          v-hasPermi="['his:liveSignRecord:export']"
+        >导出</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table border v-loading="loading" :data="signRecordList">
+      <el-table-column label="序号" align="center" type="index" width="60" />
+      <el-table-column label="直播ID" align="center" prop="liveId" width="120" />
+      <el-table-column label="用户ID" align="center" prop="userId" width="120" />
+      <el-table-column label="用户名称" align="center" prop="userName" width="150" show-overflow-tooltip />
+      <el-table-column label="签到序号" align="center" prop="signNo" width="120">
+        <template slot-scope="scope">
+          <el-tag type="success">
+            第{{ scope.row.signNo }}次
+          </el-tag>
+        </template>
+      </el-table-column>
+      <el-table-column label="签到时间" align="center" prop="createTime" width="180">
+        <template slot-scope="scope">
+          <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+  </div>
+</template>
+
+<script>
+import { listLiveSignRecord, exportLiveSignRecord } from '@/api/live/liveSignRecord'
+
+export default {
+  name: 'LiveSignRecord',
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 导出遮罩层
+      exportLoading: false,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 直播签到记录表格数据
+      signRecordList: [],
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        liveId: null,
+        userId: null,
+        userName: null,
+        signNo: null
+      }
+    }
+  },
+  created() {
+    this.getList()
+  },
+  methods: {
+    /** 查询直播签到记录列表 */
+    getList() {
+      this.loading = true
+      listLiveSignRecord(this.queryParams).then(response => {
+        this.signRecordList = response.rows
+        this.total = response.total
+        this.loading = false
+      }).catch(error => {
+        console.error('获取签到记录失败:', error)
+        this.loading = false
+      })
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1
+      this.getList()
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm('queryForm')
+      this.handleQuery()
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      // 验证必须填写直播间ID
+      if (!this.queryParams.liveId) {
+        this.$message.warning('请先输入直播间ID再进行导出')
+        return
+      }
+      this.$confirm('是否确认导出所有签到记录数据项?', '警告', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        this.exportLoading = true
+        return exportLiveSignRecord(this.queryParams)
+      }).then(response => {
+        this.download(response.msg)
+        this.exportLoading = false
+      }).catch(() => {
+        this.exportLoading = false
+      })
+    }
+  }
+}
+</script>
+
+<style scoped>
+.app-container {
+  padding: 20px;
+}
+</style>