Forráskód Böngészése

Merge remote-tracking branch 'origin/master'

yjwang 4 napja
szülő
commit
08014f8cf5

+ 30 - 0
src/api/course/courseWatchLog.js

@@ -115,3 +115,33 @@ export function watchLogStatistics(query) {
     params: query
   })
 }
+
+// 查询课程小结详情总体数据
+export function getCourseStatisticsDetail(videoId, periodId) {
+  return request({
+    url: '/course/courseWatchLog/courseStatisticsDetail',
+    method: 'get',
+    params: {
+      videoId: videoId,
+      periodId: periodId
+    }
+  })
+}
+
+// 查询课程小结用户详情列表(分页)
+export function getCourseStatisticsUserDetailList(params) {
+  return request({
+    url: '/course/courseWatchLog/courseStatisticsUserDetail',
+    method: 'get',
+    params: params
+  })
+}
+
+// 导出课程小结用户详情(按创建时间倒序,最多50000条)
+export function exportCourseStatisticsUserDetail(videoId, periodId) {
+  return request({
+    url: '/course/courseWatchLog/courseStatisticsUserDetailExport',
+    method: 'get',
+    params: { videoId, periodId }
+  })
+}

+ 1 - 1
src/utils/cos.js

@@ -48,7 +48,7 @@ export const uploadObject = async (file, onProgress, type, callBackUp) => {
     const strDate = date.getDate()
     const uploadDay = `${year}${month}${strDate}`
     const videoKey = `/userVideo/${uploadDay}/${upload_file_name}`
-    const courseKey = `/live/${uploadDay}/${upload_file_name}`
+    const courseKey = `/course/${uploadDay}/${upload_file_name}`
     let liveKey;
     console.log("LIVE_PATH value:", process.env.VUE_APP_LIVE_PATH);  // 添加这行查看实际值
     console.log("Type of LIVE_PATH:", typeof process.env.VUE_APP_LIVE_PATH);  // 查看类型

+ 632 - 0
src/views/course/userCoursePeriod/courseStatistics.vue

@@ -0,0 +1,632 @@
+<template>
+  <div class="course-statistics-container">
+    <!-- 筛选条件 -->
+    <el-form :inline="true" :model="queryParams" class="demo-form-inline" style="margin-bottom: 20px;">
+      <el-form-item label="小节名称">
+        <el-input
+          v-model="queryParams.videoName"
+          placeholder="请输入小节名称关键字"
+          clearable
+          size="small"
+          style="width: 300px;"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" size="small" @click="handleQuery">查询</el-button>
+        <el-button size="small" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+
+    <!-- 数据表格 -->
+    <el-table
+      v-loading="loading"
+      :data="list"
+      border
+      style="width: 100%"
+    >
+      <el-table-column label="课程名称" align="center" prop="courseName" width="200" />
+      <el-table-column label="小节" align="center" prop="videoName" width="210" />
+<!--      <el-table-column label="小节状态" align="center" prop="videoStatus" width="120">-->
+<!--        <template slot-scope="scope">-->
+<!--          <el-tag :type="scope.row.videoStatus === '已开课' ? 'success' : scope.row.videoStatus === '已结束' ? 'info' : 'warning'">-->
+<!--            {{ scope.row.videoStatus }}-->
+<!--          </el-tag>-->
+<!--        </template>-->
+<!--      </el-table-column>-->
+      <el-table-column label="开课状态" align="center" prop="openStatus" width="120">
+        <template slot-scope="scope">
+          <el-tag :type="scope.row.openStatus === '已开课' ? 'success' : scope.row.openStatus === '已结束' ? 'info' : 'warning'">
+            {{ scope.row.openStatus }}
+          </el-tag>
+        </template>
+      </el-table-column>
+      <el-table-column label="营期时间" align="center" prop="periodDate" width="120" />
+      <el-table-column label="开始时间" align="center" prop="startTime" width="180" />
+      <el-table-column label="结束时间" align="center" prop="endTime" width="180" />
+      <el-table-column label="操作" align="center"  fixed="right">
+        <template slot-scope="scope">
+          <el-button
+            type="text"
+            size="small"
+            @click="handleViewDetail(scope.row)"
+          >
+            查看详情
+          </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-drawer
+      title="课程小结详情"
+      :visible.sync="detailDialog.visible"
+      direction="rtl"
+      size="60%"
+      :close-on-click-modal="false"
+      append-to-body
+      class="course-detail-drawer"
+    >
+      <div v-loading="detailDialog.loading" style="padding: 20px;">
+        <!-- 第一块:总体数据 -->
+        <el-card class="detail-card" shadow="never">
+          <div slot="header" class="card-header">
+            <span>总体数据</span>
+            <el-button type="primary" size="small" @click="handleViewUserDetail">查看用户详情</el-button>
+          </div>
+          <el-row :gutter="20">
+            <el-col :span="6">
+              <div class="stat-item">
+                <div class="stat-label">视频时长</div>
+                <div class="stat-value">{{ formatDuration(detailDialog.data.videoDuration) }}</div>
+              </div>
+            </el-col>
+            <el-col :span="6">
+              <div class="stat-item">
+                <div class="stat-label">累计观看人数</div>
+                <div class="stat-value">{{ detailDialog.data.totalWatchCount || 0 }}</div>
+              </div>
+            </el-col>
+            <el-col :span="6">
+              <div class="stat-item">
+                <div class="stat-label">累计完课人数</div>
+                <div class="stat-value">{{ detailDialog.data.totalCompleteCount || 0 }}</div>
+              </div>
+            </el-col>
+            <el-col :span="6">
+              <div class="stat-item">
+                <div class="stat-label">到课完课率</div>
+                <div class="stat-value">{{ detailDialog.data.completeRate || '0%' }}</div>
+              </div>
+            </el-col>
+          </el-row>
+        </el-card>
+
+        <!-- 第二块:首次点播数据 -->
+        <el-card class="detail-card" shadow="never">
+          <div slot="header" class="card-header">
+            <span>首次点播数据</span>
+          </div>
+          <el-row :gutter="20">
+            <el-col :span="6">
+              <div class="stat-item">
+                <div class="stat-label">观看人数</div>
+                <div class="stat-value">{{ detailDialog.data.firstWatchCount || 0 }}</div>
+              </div>
+            </el-col>
+            <el-col :span="6">
+              <div class="stat-item">
+                <div class="stat-label">>=20分钟人数(首次)</div>
+                <div class="stat-value">{{ detailDialog.data.firstWatch20MinCount || 0 }}</div>
+              </div>
+            </el-col>
+            <el-col :span="6">
+              <div class="stat-item">
+                <div class="stat-label">>=30分钟人数(首次)</div>
+                <div class="stat-value">{{ detailDialog.data.firstWatch30MinCount || 0 }}</div>
+              </div>
+            </el-col>
+            <el-col :span="6">
+              <div class="stat-item">
+                <div class="stat-label">到课完课率首次(>=20分钟)</div>
+                <div class="stat-value">{{ detailDialog.data.firstCompleteRate20Min || '0%' }}</div>
+              </div>
+            </el-col>
+            <el-col :span="6">
+              <div class="stat-item">
+                <div class="stat-label">到课完课率首次(>=30分钟)</div>
+                <div class="stat-value">{{ detailDialog.data.firstCompleteRate30Min || '0%' }}</div>
+              </div>
+            </el-col>
+          </el-row>
+        </el-card>
+
+        <!-- 第三块:第2-n次观看数据 -->
+        <el-card class="detail-card" shadow="never">
+          <div slot="header" class="card-header">
+            <span>第2-n次观看数据</span>
+          </div>
+          <el-row :gutter="20">
+            <el-col :span="6">
+              <div class="stat-item">
+                <div class="stat-label">观看人数</div>
+                <div class="stat-value">{{ detailDialog.data.repeatWatchCount || 0 }}</div>
+              </div>
+            </el-col>
+            <el-col :span="6">
+              <div class="stat-item">
+                <div class="stat-label">>=20分钟人数</div>
+                <div class="stat-value">{{ detailDialog.data.repeatWatch20MinCount || 0 }}</div>
+              </div>
+            </el-col>
+            <el-col :span="6">
+              <div class="stat-item">
+                <div class="stat-label">>=30分钟人数</div>
+                <div class="stat-value">{{ detailDialog.data.repeatWatch30MinCount || 0 }}</div>
+              </div>
+            </el-col>
+            <el-col :span="6">
+              <div class="stat-item">
+                <div class="stat-label">到课完课率2-n次(>=20分钟)</div>
+                <div class="stat-value">{{ detailDialog.data.repeatCompleteRate20Min || '0%' }}</div>
+              </div>
+            </el-col>
+            <el-col :span="6">
+              <div class="stat-item">
+                <div class="stat-label">到课完课率2-n次(>=30分钟)</div>
+                <div class="stat-value">{{ detailDialog.data.repeatCompleteRate30Min || '0%' }}</div>
+              </div>
+            </el-col>
+          </el-row>
+        </el-card>
+
+        <!-- 第四块:订单数据 -->
+        <el-card class="detail-card" shadow="never">
+          <div slot="header" class="card-header">
+            <span>订单数据</span>
+          </div>
+          <el-row :gutter="20">
+            <el-col :span="6">
+              <div class="stat-item">
+                <div class="stat-label">GMV</div>
+                <div class="stat-value">¥{{ detailDialog.data.gmv || '0.00' }}</div>
+              </div>
+            </el-col>
+            <el-col :span="6">
+              <div class="stat-item">
+                <div class="stat-label">付费人数</div>
+                <div class="stat-value">{{ detailDialog.data.paidUserCount || 0 }}</div>
+              </div>
+            </el-col>
+            <el-col :span="6">
+              <div class="stat-item">
+                <div class="stat-label">付费单数</div>
+                <div class="stat-value">{{ detailDialog.data.paidOrderCount || 0 }}</div>
+              </div>
+            </el-col>
+            <el-col :span="6">
+              <div class="stat-item">
+                <div class="stat-label">总付费转换率</div>
+                <div class="stat-value">{{ detailDialog.data.totalPaidConversionRate || '0%' }}</div>
+              </div>
+            </el-col>
+            <el-col :span="6">
+              <div class="stat-item">
+                <div class="stat-label">20min付费转化率</div>
+                <div class="stat-value">{{ detailDialog.data.paidConversionRate20Min || '0%' }}</div>
+              </div>
+            </el-col>
+            <el-col :span="6">
+              <div class="stat-item">
+                <div class="stat-label">完课R值</div>
+                <div class="stat-value">{{ detailDialog.data.completeRValue || '0.00' }}</div>
+              </div>
+            </el-col>
+            <el-col :span="6">
+              <div class="stat-item">
+                <div class="stat-label">领红包人数</div>
+                <div class="stat-value">{{ detailDialog.data.redPacketUserCount || 0 }}</div>
+              </div>
+            </el-col>
+            <el-col :span="6">
+              <div class="stat-item">
+                <div class="stat-label">答题人数</div>
+                <div class="stat-value">{{ detailDialog.data.answerUserCount || 0 }}</div>
+              </div>
+            </el-col>
+          </el-row>
+        </el-card>
+
+        <!-- 第五块:单品销量统计 -->
+        <el-card class="detail-card" shadow="never">
+          <div slot="header" class="card-header">
+            <span>单品销量统计</span>
+          </div>
+          <el-table
+            :data="detailDialog.data.productList || []"
+            border
+            style="width: 100%"
+          >
+            <el-table-column label="商品名称" align="center" prop="productName" />
+            <el-table-column label="销量" align="center" prop="salesCount" />
+            <el-table-column label="销售额" align="center" prop="salesAmount">
+              <template slot-scope="scope">
+                ¥{{ scope.row.salesAmount || '0.00' }}
+              </template>
+            </el-table-column>
+          </el-table>
+        </el-card>
+      </div>
+    </el-drawer>
+
+    <!-- 用户详情抽屉 -->
+    <el-drawer
+      title="用户看课数据"
+      :visible.sync="userDetailDialog.visible"
+      direction="rtl"
+      size="60%"
+      :close-on-click-modal="false"
+      append-to-body
+    >
+      <div v-loading="userDetailDialog.loading" style="padding: 20px;">
+        <div style="margin-bottom: 20px; text-align: right;">
+          <el-button type="primary" size="small" @click="handleExportUserDetail">导出用户详情</el-button>
+        </div>
+        <el-table
+          :data="userDetailDialog.list"
+          border
+          style="width: 100%"
+        >
+          <el-table-column label="用户名称" align="center" prop="userName" width="150" />
+          <el-table-column label="观看时长" align="center" prop="watchDuration" width="120">
+            <template slot-scope="scope">
+              {{ formatDuration(scope.row.watchDuration) }}
+            </template>
+          </el-table-column>
+          <el-table-column label="第2-n次观看时长" align="center" prop="repeatWatchDuration" width="150">
+            <template slot-scope="scope">
+              {{ formatDuration(scope.row.repeatWatchDuration) }}
+            </template>
+          </el-table-column>
+          <el-table-column label="订单数" align="center" prop="orderCount" width="100" />
+          <el-table-column label="订单金额" align="center" prop="orderAmount" width="120">
+            <template slot-scope="scope">
+              ¥{{ scope.row.orderAmount || '0.00' }}
+            </template>
+          </el-table-column>
+          <el-table-column label="分公司名称" align="center" prop="companyName" width="150" />
+          <el-table-column label="销售名称" align="center" prop="salesName" />
+        </el-table>
+
+        <!-- 分页 -->
+        <pagination
+          v-show="userDetailDialog.total > 0"
+          :total="userDetailDialog.total"
+          :page.sync="userDetailDialog.queryParams.pageNum"
+          :limit.sync="userDetailDialog.queryParams.pageSize"
+          @pagination="getUserDetailList"
+        />
+      </div>
+    </el-drawer>
+  </div>
+</template>
+
+<script>
+import { getDays } from "@/api/course/userCoursePeriod";
+import { getCourseStatisticsDetail, getCourseStatisticsUserDetailList, exportCourseStatisticsUserDetail } from "@/api/course/courseWatchLog";
+import { download } from "@/utils/common";
+
+export default {
+  name: "CourseStatistics",
+  props: {
+    periodId: {
+      type: [String, Number],
+      default: null
+    },
+    active: {
+      type: Boolean,
+      default: false
+    }
+  },
+  data() {
+    return {
+      loading: false,
+      list: [],
+      total: 0,
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        videoName: null,
+        periodId: null
+      },
+      // 详情弹窗
+      detailDialog: {
+        visible: false,
+        loading: false,
+        data: {}
+      },
+      // 用户详情弹窗
+      userDetailDialog: {
+        visible: false,
+        loading: false,
+        list: [],
+        total: 0,
+        queryParams: {
+          pageNum: 1,
+          pageSize: 10,
+          videoId: null,
+          periodId: null
+        }
+      }
+    };
+  },
+  watch: {
+    active(newVal) {
+      if (newVal && this.periodId) {
+        this.queryParams.periodId = this.periodId;
+        this.getList();
+      }
+    },
+    periodId(newVal) {
+      if (newVal && this.active) {
+        this.queryParams.periodId = newVal;
+        this.getList();
+      }
+    }
+  },
+  mounted() {
+    if (this.active && this.periodId) {
+      this.queryParams.periodId = this.periodId;
+      this.getList();
+    }
+  },
+  methods: {
+    /** 查询列表 */
+    getList() {
+      if (!this.queryParams.periodId) {
+        this.loading = false;
+        return;
+      }
+      this.loading = true;
+      getDays(this.queryParams).then(response => {
+        if (response.code === 200) {
+          // 映射字段并格式化数据
+          this.list = (response.rows || []).map(item => {
+            return {
+              ...item,
+              // 映射字段
+              periodDate: item.dayDate,
+              startTime: item.startDateTime,
+              endTime: item.endDateTime,
+              // 格式化开课状态
+              openStatus: this.formatCourseStatus(item.status),
+              // 小节状态(可以根据需要设置,这里先使用开课状态)
+              videoStatus: this.formatCourseStatus(item.status)
+            };
+          });
+          this.total = response.total || 0;
+        } else {
+          this.$message.error(response.msg || '查询失败');
+          this.list = [];
+          this.total = 0;
+        }
+        this.loading = false;
+      }).catch(error => {
+        this.$message.error('查询失败:' + (error.message || '未知错误'));
+        this.loading = false;
+        this.list = [];
+        this.total = 0;
+      });
+    },
+    /** 格式化课程状态 */
+    formatCourseStatus(status) {
+      const statusMap = {
+        0: '未开始',
+        1: '已开课',
+        2: '已结束'
+      };
+      return statusMap[status] || '未知状态';
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.queryParams.videoName = null;
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 查看详情 */
+    handleViewDetail(row) {
+      this.detailDialog.visible = true;
+      this.detailDialog.loading = true;
+
+      // 调用API获取总体数据
+      const videoId = row.videoId || row.id;
+      const periodId = this.queryParams.periodId;
+
+      if (!videoId || !periodId) {
+        this.$message.error('视频ID或营期ID不能为空');
+        this.detailDialog.loading = false;
+        return;
+      }
+
+      getCourseStatisticsDetail(videoId, periodId).then(response => {
+        if (response.code === 200 && response.data) {
+          const data = response.data;
+          // 设置总体数据
+          this.detailDialog.data = {
+            videoDuration: data.videoDuration || 0,
+            totalWatchCount: data.totalWatchCount || 0,
+            totalCompleteCount: data.totalCompleteCount || 0,
+            completeRate: data.completeRate != null ? Number(data.completeRate).toFixed(2) + '%' : '0%',
+            // 首次点播数据(接口返回)
+            firstWatchCount: data.firstWatchCount ?? 0,
+            firstWatch20MinCount: data.firstWatch20MinCount ?? 0,
+            firstWatch30MinCount: data.firstWatch30MinCount ?? 0,
+            firstCompleteRate20Min: data.firstCompleteRate20Min != null ? Number(data.firstCompleteRate20Min).toFixed(2) + '%' : '0%',
+            firstCompleteRate30Min: data.firstCompleteRate30Min != null ? Number(data.firstCompleteRate30Min).toFixed(2) + '%' : '0%',
+            // 第2-n次观看数据(接口返回)
+            repeatWatchCount: data.repeatWatchCount ?? 0,
+            repeatWatch20MinCount: data.repeatWatch20MinCount ?? 0,
+            repeatWatch30MinCount: data.repeatWatch30MinCount ?? 0,
+            repeatCompleteRate20Min: data.repeatCompleteRate20Min != null ? Number(data.repeatCompleteRate20Min).toFixed(2) + '%' : '0%',
+            repeatCompleteRate30Min: data.repeatCompleteRate30Min != null ? Number(data.repeatCompleteRate30Min).toFixed(2) + '%' : '0%',
+            // 订单数据(接口返回)
+            gmv: data.gmv != null ? Number(data.gmv).toFixed(2) : '0.00',
+            paidUserCount: data.paidUserCount ?? 0,
+            paidOrderCount: data.paidOrderCount ?? 0,
+            totalPaidConversionRate: data.totalPaidConversionRate != null ? Number(data.totalPaidConversionRate).toFixed(2) + '%' : '0%',
+            paidConversionRate20Min: data.paidConversionRate20Min != null ? Number(data.paidConversionRate20Min).toFixed(2) + '%' : '0%',
+            completeRValue: data.completeRValue != null ? Number(data.completeRValue).toFixed(2) : '0.00',
+            redPacketUserCount: data.redPacketUserCount ?? 0,
+            answerUserCount: data.answerUserCount ?? 0,
+            productList: (data.productList || []).map(p => ({
+              productName: p.productName || '未知商品',
+              salesCount: p.salesCount ?? 0,
+              salesAmount: p.salesAmount != null ? Number(p.salesAmount).toFixed(2) : '0.00'
+            })),
+            videoId: videoId,
+            id: row.id
+          };
+        } else {
+          this.$message.error(response.msg || '获取数据失败');
+        }
+        this.detailDialog.loading = false;
+      }).catch(error => {
+        this.$message.error('获取数据失败:' + (error.message || '未知错误'));
+        this.detailDialog.loading = false;
+      });
+    },
+    /** 查看用户详情 */
+    handleViewUserDetail() {
+      this.userDetailDialog.visible = true;
+      this.userDetailDialog.queryParams.videoId = this.detailDialog.data.videoId || this.detailDialog.data.id;
+      this.userDetailDialog.queryParams.periodId = this.queryParams.periodId;
+      this.userDetailDialog.queryParams.pageNum = 1;
+      this.getUserDetailList();
+    },
+    /** 获取用户详情列表 */
+    getUserDetailList() {
+      const videoId = this.userDetailDialog.queryParams.videoId;
+      const periodId = this.userDetailDialog.queryParams.periodId;
+      if (!videoId || !periodId) {
+        this.$message.error('视频ID或营期ID不能为空');
+        this.userDetailDialog.loading = false;
+        return;
+      }
+      this.userDetailDialog.loading = true;
+      getCourseStatisticsUserDetailList(this.userDetailDialog.queryParams).then(response => {
+        if (response.code === 200 && response.data) {
+          const d = response.data;
+          this.userDetailDialog.list = d.list || d.rows || [];
+          this.userDetailDialog.total = d.total ?? 0;
+        } else {
+          this.userDetailDialog.list = [];
+          this.userDetailDialog.total = 0;
+        }
+        this.userDetailDialog.loading = false;
+      }).catch(() => {
+        this.userDetailDialog.list = [];
+        this.userDetailDialog.total = 0;
+        this.userDetailDialog.loading = false;
+      });
+    },
+    /** 导出用户详情(按创建时间倒序,最多50000条) */
+    handleExportUserDetail() {
+      const videoId = this.userDetailDialog.queryParams.videoId;
+      const periodId = this.userDetailDialog.queryParams.periodId;
+      if (!videoId || !periodId) {
+        this.$message.error('请先查看用户详情');
+        return;
+      }
+      this.$confirm('是否确认导出用户看课数据?(按创建时间倒序,最多50000条)', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        exportCourseStatisticsUserDetail(videoId, periodId).then(response => {
+          if (response.code === 200 && response.msg) {
+            download(response.msg);
+            this.$message.success('导出成功');
+          } else {
+            this.$message.error(response.msg || '导出失败');
+          }
+        }).catch(() => {
+          this.$message.error('导出失败');
+        });
+      }).catch(() => {});
+    },
+    /** 格式化时长 */
+    formatDuration(seconds) {
+      if (!seconds) return '0秒';
+      const hours = Math.floor(seconds / 3600);
+      const minutes = Math.floor((seconds % 3600) / 60);
+      const secs = seconds % 60;
+      if (hours > 0) {
+        return `${hours}小时${minutes}分钟${secs}秒`;
+      } else if (minutes > 0) {
+        return `${minutes}分钟${secs}秒`;
+      } else {
+        return `${secs}秒`;
+      }
+    }
+  }
+};
+</script>
+
+<style scoped lang="scss">
+.course-statistics-container {
+  padding: 20px;
+}
+
+.detail-card {
+  margin-bottom: 20px;
+
+  .card-header {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    font-weight: bold;
+    font-size: 16px;
+  }
+
+  .stat-item {
+    text-align: center;
+    padding: 20px;
+    border: 1px solid #EBEEF5;
+    border-radius: 4px;
+    background-color: #F5F7FA;
+    margin-top: 10px;
+
+    .stat-label {
+      font-size: 14px;
+      color: #606266;
+      margin-bottom: 10px;
+    }
+
+    .stat-value {
+      font-size: 24px;
+      font-weight: bold;
+      color: #303133;
+    }
+  }
+}
+
+.course-detail-drawer {
+  ::v-deep .el-drawer__body {
+    overflow-y: auto;
+  }
+}
+</style>

+ 88 - 24
src/views/course/userCoursePeriod/index.vue

@@ -478,15 +478,23 @@
       </div>
     </el-dialog>
 
-    <el-dialog title="修改营期时间" :visible.sync="updatePeriodDate.open" width="500px" append-to-body>
-      <el-form ref="courseUpdateForm" :model="updatePeriodDate.form" label-width="100px">
-        <el-form-item label="营期时间" prop="dayDate">
+    <el-dialog title="修改营期时间" :visible.sync="updatePeriodDate.open" width="550px" append-to-body>
+      <el-form ref="courseUpdateForm" :model="updatePeriodDate.form" label-width="120px">
+        <el-form-item v-if="updatePeriodDate.ids.length > 1" label="已选课程数">
+          <span>{{ updatePeriodDate.ids.length }} 个课程将统一修改</span>
+        </el-form-item>
+        <el-form-item label="营期时间" prop="timeRange">
           <el-date-picker
-            v-model="updatePeriodDate.form.dayDate"
-            :selectableRange="updatePeriodDate.form.dayDate"
-            value-format="yyyy-MM-dd"
-            type="date"
-            placeholder="选择日期">
+            v-model="updatePeriodDate.form.timeRange"
+            type="datetimerange"
+            range-separator="至"
+            start-placeholder="开始时间"
+            end-placeholder="结束时间"
+            value-format="yyyy-MM-dd HH:mm:ss"
+            format="yyyy-MM-dd HH:mm:ss"
+            :default-time="['00:00:00', '23:59:59']"
+            placeholder="选择时间范围"
+            style="width: 100%">
           </el-date-picker>
         </el-form-item>
       </el-form>
@@ -527,14 +535,14 @@
                 v-hasPermi="['course:period:addCourse']"
               >添加课程</el-button>
             </el-col>
-<!--            <el-col :span="1.5">-->
-<!--              <el-button-->
-<!--                type="primary"-->
-<!--                size="mini"-->
-<!--                :disabled="updateCourse.ids.length <= 0"-->
-<!--                @click="handleUpdatePeriodDate"-->
-<!--              >修改营期时间</el-button>-->
-<!--            </el-col>-->
+            <el-col :span="1.5">
+              <el-button
+                type="primary"
+                size="mini"
+                :disabled="updateCourse.ids.length <= 0"
+                @click="handleUpdatePeriodDate"
+              >修改营期时间</el-button>
+            </el-col>
             <el-col :span="1.5">
               <el-button
                 type="primary"
@@ -632,6 +640,13 @@
             :active="activeTab === 'statistics'"
           />
         </el-tab-pane>
+
+        <el-tab-pane label="课程数据" name="courseStatistics">
+          <course-statistics-data
+            :periodId="periodSettingsData.periodId"
+            :active="activeTab === 'courseStatistics'"
+          />
+        </el-tab-pane>
       </el-tabs>
     </div>
   </el-drawer>
@@ -653,6 +668,7 @@ import { courseList,videoList } from '@/api/course/courseRedPacketLog'
 import RedPacket from './redPacket.vue'
 import BatchRedPacket from './batchRedPacket.vue'
 import CourseStatistics from './statistics.vue'
+import CourseStatisticsData from './courseStatistics.vue'
 import Da from "element-ui/src/locale/lang/da";
 import { getConfigByKey } from '@/api/system/config'
 export default {
@@ -660,7 +676,8 @@ export default {
   components: {
     RedPacket,
     BatchRedPacket,
-    CourseStatistics
+    CourseStatistics,
+    CourseStatisticsData
   },
   data() {
     return {
@@ -727,9 +744,11 @@ export default {
       //修改营期时间参数
       updatePeriodDate: {
         open: false,
-        loading: true,
+        loading: false,
         ids: [],
-        form: {},
+        form: {
+          timeRange: null
+        },
       },
       joinTimeSwitch:true,
       updateCourse: {
@@ -1609,12 +1628,37 @@ export default {
       });
     },
     updatePeriodDateSubmit(){
-      updateCourseDate(this.updatePeriodDate.form).then(response => {
+      const form = this.updatePeriodDate.form;
+      if (!form.timeRange || !Array.isArray(form.timeRange) || form.timeRange.length !== 2) {
+        this.$message.warning('请选择完整的营期开始时间和结束时间');
+        return;
+      }
+      const [startDateTime, endDateTime] = form.timeRange;
+      if (startDateTime >= endDateTime) {
+        this.$message.warning('开始时间必须早于结束时间');
+        return;
+      }
+      const ids = this.updatePeriodDate.ids;
+      if (!ids || ids.length === 0) {
+        this.$message.warning('请选择要修改的课程');
+        return;
+      }
+      updateCourseDate({
+        ids: ids,
+        startDateTime: startDateTime,
+        endDateTime: endDateTime
+      }).then(response => {
+        if (response.code === 200) {
           this.$message.success('修改成功');
           this.updatePeriodDate.open = false;
-          // 重新加载课程列表
+          this.updatePeriodDate.form.timeRange = null;
           this.getCourseList();
-        });
+        } else {
+          this.$message.error(response.msg || '修改失败');
+        }
+      }).catch(() => {
+        this.$message.error('修改失败');
+      });
     },
     // saveCourseData(){
     //   updateListCourseData(this.course.list).then(response => {
@@ -1743,9 +1787,29 @@ export default {
       };
       return statusMap[row.status] || '未知状态';
     },
-    /** 营期状态格式化 */
+    /** 单行修改营期时间 */
     handleUpdateDate(row) {
-      this.updatePeriodDate.form = {id: row.id, dayDate: row.dayDate};
+      this.updatePeriodDate.ids = [row.id];
+      this.updatePeriodDate.form = {
+        timeRange: row.startDateTime && row.endDateTime ? [row.startDateTime, row.endDateTime] : null
+      };
+      this.updatePeriodDate.open = true;
+    },
+    /** 批量修改营期时间 */
+    handleUpdatePeriodDate() {
+      const ids = this.updateCourse.ids;
+      if (!ids || ids.length === 0) {
+        this.$message.warning('请先选择要修改的课程');
+        return;
+      }
+      this.updatePeriodDate.ids = [...ids];
+      // 取第一个选中行的开始和结束时间作为默认值
+      const firstRow = this.course.list.find(item => item.id === ids[0]);
+      this.updatePeriodDate.form = {
+        timeRange: firstRow && firstRow.startDateTime && firstRow.endDateTime
+          ? [firstRow.startDateTime, firstRow.endDateTime]
+          : null
+      };
       this.updatePeriodDate.open = true;
     },
     // disabledDate(time) {

+ 20 - 3
src/views/his/company/index.vue

@@ -756,6 +756,9 @@ export default {
   name: 'Company',
   data() {
     return {
+
+      projectFrom:process.env.VUE_APP_HSY_SPACE,
+
       signProjectName:"",
       redSubmit: false,
       //分账参数
@@ -934,9 +937,22 @@ export default {
         open: false,
         title: '批量修改小程序'
       },
+
     }
   },
   created() {
+
+    cateList().then((response) => {
+      if (this.projectFrom =='mengniu-2114522511'){
+
+        this.getDicts('store_product_package_cate').then(response => {
+          this.cateList = response.data
+        })
+      }else {
+        this.cateList = response.rows
+      }
+    })
+
     getSignProjectName()
     .then(res=>{
       this.signProjectName = res.signProjectName;
@@ -955,9 +971,10 @@ export default {
     getFollowDoctorList().then((response) => {
       this.followDoctorList = response.rows
     })
-    cateList().then((response) => {
-      this.cateList = response.rows
-    })
+    // cateList().then((response) => {
+    //   this.cateList = response.rows
+    // })
+
     listDept().then(response => {
       this.deptOptions = response.data
     })

+ 548 - 0
src/views/system/config/config.vue

@@ -1919,6 +1919,192 @@
               <video :src="form25.videoUrl" controls style="max-width: 400px; max-height: 400px;"></video>
             </div>
           </el-form-item>
+          <!-- 游戏配置卡片 - 增强版 -->
+          <el-card class="config-card" shadow="hover">
+            <div class="section-title">
+              <div class="title-icon icon-game">
+                <i class="el-icon-s-flag"></i>
+              </div>
+              <div class="title-text">
+                <h3>游戏配置</h3>
+                <p class="subtitle">配置APP内小游戏列表及相关参数</p>
+              </div>
+            </div>
+
+            <el-divider></el-divider>
+
+            <!-- 游戏获得积分 -->
+            <el-form-item label="游戏获得积分" prop="addIntegral">
+              <el-input-number
+                v-model="form25.addIntegral"
+                :min="-999999"
+                :max="999999"
+                :step="1"
+                :precision="0"
+                controls-position="right"
+                style="width: 320px;">
+              </el-input-number>
+              <el-tooltip content="玩一局游戏获得的积分(负数为扣减),默认100" placement="right">
+                <i class="el-icon-question help-icon"></i>
+              </el-tooltip>
+            </el-form-item>
+
+            <!-- 视频获得积分 -->
+            <el-form-item label="视频获得积分" prop="defaultRewardGold">
+              <el-input-number
+                v-model="form25.defaultRewardGold"
+                :min="-999999"
+                :max="999999"
+                :step="1"
+                :precision="0"
+                controls-position="right"
+                style="width: 320px;">
+              </el-input-number>
+              <el-tooltip content="观看视频获得的金币(负数为扣减),默认100" placement="right">
+                <i class="el-icon-question help-icon"></i>
+              </el-tooltip>
+            </el-form-item>
+
+            <!-- 游戏列表区域 -->
+            <el-form-item label="游戏列表" class="game-list-item">
+              <div class="game-list-header">
+                <el-button type="primary" size="small" @click="addGameConfig" icon="el-icon-plus">
+                  新增游戏
+                </el-button>
+                <span class="game-list-tip">最多可添加10个游戏</span>
+              </div>
+
+              <!-- 游戏列表表格 -->
+              <el-table
+                :data="form25.gameList"
+                border
+                style="width: 100%; margin-top: 15px;"
+                v-loading="gameListLoading"
+              >
+                <el-table-column label="序号" width="60" align="center">
+                  <template slot-scope="scope">
+                    <span>{{ scope.$index + 1 }}</span>
+                  </template>
+                </el-table-column>
+
+                <el-table-column label="游戏图片" width="200" align="center">
+                  <template slot-scope="scope">
+                    <div v-if="scope.row.editing">
+                      <ImageUpload
+                        v-model="scope.row.image"
+                        :limit="1"
+                        :file-type='["png", "jpg", "jpeg"]'
+                        :width="30"
+                        :height="30"
+                      />
+                    </div>
+                    <div v-else class="game-image-preview">
+                      <el-image
+                        v-if="scope.row.image"
+                        :src="scope.row.image"
+                        :preview-src-list="[scope.row.image]"
+                        style="width: 50px; height: 50px; border-radius: 4px;"
+                      >
+                        <div slot="error" class="image-slot">
+                          <i class="el-icon-picture-outline"></i>
+                        </div>
+                      </el-image>
+                      <span v-else class="no-image">暂无图片</span>
+                    </div>
+                  </template>
+                </el-table-column>
+
+                <el-table-column label="游戏名称" min-width="150">
+                  <template slot-scope="scope">
+                    <el-input
+                      v-if="scope.row.editing"
+                      v-model="scope.row.name"
+                      placeholder="请输入游戏名称"
+                      size="small"
+                    ></el-input>
+                    <span v-else>{{ scope.row.name || '-' }}</span>
+                  </template>
+                </el-table-column>
+
+                <el-table-column label="游戏链接" min-width="200">
+                  <template slot-scope="scope">
+                    <el-input
+                      v-if="scope.row.editing"
+                      v-model="scope.row.url"
+                      placeholder="请输入游戏链接"
+                      size="small"
+                    ></el-input>
+                    <span v-else class="game-link">{{ scope.row.url || '-' }}</span>
+                  </template>
+                </el-table-column>
+
+                <el-table-column label="排序" width="100" align="center">
+                  <template slot-scope="scope">
+                    <el-input-number
+                      v-if="scope.row.editing"
+                      v-model="scope.row.sort"
+                      :min="0"
+                      :max="999"
+                      size="small"
+                      controls-position="right"
+                      style="width: 80px;"
+                    ></el-input-number>
+                    <span v-else>{{ scope.row.sort || 0 }}</span>
+                  </template>
+                </el-table-column>
+
+                <el-table-column label="状态" width="80" align="center">
+                  <template slot-scope="scope">
+                    <el-switch
+                      v-if="scope.row.editing"
+                      v-model="scope.row.status"
+                      :active-value="1"
+                      :inactive-value="0"
+                      active-color="#13ce66"
+                      inactive-color="#ff4949"
+                    ></el-switch>
+                    <el-tag v-else :type="scope.row.status === 1 ? 'success' : 'info'" size="small">
+                      {{ scope.row.status === 1 ? '启用' : '禁用' }}
+                    </el-tag>
+                  </template>
+                </el-table-column>
+
+                <el-table-column label="操作" width="150" fixed="right" align="center">
+                  <template slot-scope="scope">
+                    <el-button
+                      v-if="!scope.row.editing"
+                      type="text"
+                      size="small"
+                      icon="el-icon-edit"
+                      @click="editGame(scope.$index)"
+                    >编辑</el-button>
+                    <el-button
+                      v-if="scope.row.editing"
+                      type="text"
+                      size="small"
+                      icon="el-icon-check"
+                      @click="saveGame(scope.$index)"
+                    >保存</el-button>
+                    <el-button
+                      v-if="!scope.row.editing"
+                      type="text"
+                      size="small"
+                      icon="el-icon-delete"
+                      class="delete-btn"
+                      @click="deleteGame(scope.$index)"
+                    >删除</el-button>
+                    <el-button
+                      v-if="scope.row.editing"
+                      type="text"
+                      size="small"
+                      icon="el-icon-close"
+                      @click="cancelEdit(scope.$index)"
+                    >取消</el-button>
+                  </template>
+                </el-table-column>
+              </el-table>
+            </el-form-item>
+          </el-card>
           <div class="footer">
             <el-button type="primary" @click="submitForm25">提 交</el-button>
           </div>
@@ -2669,6 +2855,7 @@ export default {
       form23: {},
       form24: {},
       form25: {},
+      gameListLoading: false,
       form26: {
         bloodGlucose: {
           fasting: { normal: '' },
@@ -2893,6 +3080,119 @@ export default {
         this.form18.smsDomain = selectedDict.dictLabel;
       }
     },
+    /**
+     * 新增游戏配置
+     */
+    addGameConfig() {
+      if (!this.form25.gameList) {
+        this.$set(this.form25, 'gameList', [])
+      }
+
+      // 限制最多10个游戏
+      if (this.form25.gameList.length >= 10) {
+        this.$message.warning('最多只能添加10个游戏')
+        return
+      }
+
+      // 添加新游戏配置
+      this.form25.gameList.push({
+        id: Date.now() + Math.random(), // 临时ID
+        image: '',
+        name: '',
+        url: '',
+        sort: this.form25.gameList.length,
+        status: 1, // 默认启用
+        editing: true // 新增时直接进入编辑状态
+      })
+
+      this.$forceUpdate()
+    },
+
+    /**
+     * 编辑游戏
+     */
+    editGame(index) {
+      // 如果已经有其他行在编辑,先保存或取消
+      const editingIndex = this.form25.gameList.findIndex(item => item.editing)
+      if (editingIndex !== -1 && editingIndex !== index) {
+        this.$confirm('当前有其他游戏正在编辑,是否继续?', '提示', {
+          confirmButtonText: '继续',
+          cancelButtonText: '取消',
+          type: 'warning'
+        }).then(() => {
+          // 取消其他行的编辑状态
+          this.form25.gameList[editingIndex].editing = false
+          // 设置当前行为编辑状态
+          this.$set(this.form25.gameList[index], 'editing', true)
+        }).catch(() => {})
+      } else {
+        this.$set(this.form25.gameList[index], 'editing', true)
+      }
+    },
+
+    /**
+     * 保存游戏
+     */
+    saveGame(index) {
+      const game = this.form25.gameList[index]
+
+      // 验证必填项
+      if (!game.name) {
+        this.$message.error('请输入游戏名称')
+        return
+      }
+      if (!game.url) {
+        this.$message.error('请输入游戏链接')
+        return
+      }
+      if (!game.image) {
+        this.$message.error('请上传游戏图片')
+        return
+      }
+
+      // 验证URL格式
+      const urlPattern = /^(http|https):\/\/[^\s]+$/
+      if (!urlPattern.test(game.url)) {
+        this.$message.error('请输入正确的游戏链接(以http://或https://开头)')
+        return
+      }
+
+      // 保存成功,退出编辑状态
+      this.$set(this.form25.gameList[index], 'editing', false)
+      this.$message.success('保存成功')
+    },
+
+    /**
+     * 取消编辑
+     */
+    cancelEdit(index) {
+      const game = this.form25.gameList[index]
+
+      // 如果是新增但未保存(没有id),直接删除
+      if (!game.id || game.id.toString().includes('.')) {
+        this.form25.gameList.splice(index, 1)
+      } else {
+        this.$set(this.form25.gameList[index], 'editing', false)
+      }
+    },
+
+    /**
+     * 删除游戏
+     */
+    deleteGame(index) {
+      this.$confirm('确定要删除这个游戏吗?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        this.form25.gameList.splice(index, 1)
+        // 重新排序
+        this.form25.gameList.forEach((item, idx) => {
+          item.sort = idx
+        })
+        this.$message.success('删除成功')
+      }).catch(() => {})
+    },
 
 
     // 处理开关配置
@@ -3902,4 +4202,252 @@ export default {
   display: flex;
   justify-content: flex-end;
 }
+
+.app-config-form {
+  padding: 10px;
+}
+
+.config-card {
+  margin-bottom: 24px;
+  border-radius: 12px;
+  border: none;
+  box-shadow: 0 2px 12px 0 rgba(0,0,0,0.05);
+}
+
+.config-card ::v-deep .el-card__body {
+  padding: 24px;
+}
+
+/* 章节标题样式 - 图标和文字在一起 */
+.section-title {
+  display: flex;
+  align-items: center;
+  margin-bottom: 8px;
+}
+
+.title-icon {
+  width: 40px;
+  height: 40px;
+  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
+  border-radius: 10px;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  margin-right: 12px;
+  flex-shrink: 0;
+}
+
+.title-icon i {
+  color: #fff;
+  font-size: 20px;
+}
+
+.icon-promotion {
+  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
+}
+
+.title-text h3 {
+  margin: 0;
+  font-size: 18px;
+  color: #303133;
+  font-weight: 600;
+  line-height: 1.4;
+}
+
+.subtitle {
+  margin: 4px 0 0 0;
+  font-size: 13px;
+  color: #909399;
+  line-height: 1.4;
+}
+
+/* 分割线 */
+.el-divider {
+  margin: 20px 0;
+  background-color: #ebeef5;
+}
+
+/* 表单项 */
+.app-config-form ::v-deep .el-form-item {
+  margin-bottom: 24px;
+}
+
+.app-config-form ::v-deep .el-form-item:last-child {
+  margin-bottom: 0;
+}
+
+.help-icon {
+  margin-left: 8px;
+  color: #c0c4cc;
+  cursor: help;
+  font-size: 16px;
+  transition: color 0.3s;
+}
+
+.help-icon:hover {
+  color: #409EFF;
+}
+
+/* 上传区域 */
+.upload-wrapper {
+  display: flex;
+  flex-direction: column;
+}
+
+.upload-tip {
+  margin-top: 8px;
+  color: #909399;
+  font-size: 12px;
+}
+
+/* 视频上传 */
+.video-upload-wrapper {
+  width: 100%;
+  max-width: 400px;
+}
+
+.video-uploader ::v-deep .el-upload {
+  width: 100%;
+}
+
+.video-uploader ::v-deep .el-upload-dragger {
+  width: 100%;
+  height: 160px;
+  background: #fafafa;
+  border: 2px dashed #dcdfe6;
+  border-radius: 8px;
+}
+
+.video-uploader ::v-deep .el-upload-dragger:hover {
+  border-color: #409EFF;
+}
+
+.preview-video {
+  width: 100%;
+  max-width: 400px;
+  max-height: 250px;
+  border-radius: 8px;
+  background: #000;
+}
+
+.video-preview {
+  position: relative;
+  display: inline-block;
+}
+
+.video-actions {
+  position: absolute;
+  top: 10px;
+  right: 10px;
+  opacity: 0;
+  transition: opacity 0.3s;
+}
+
+.video-preview:hover .video-actions {
+  opacity: 1;
+}
+
+/* 底部按钮 */
+.form-footer {
+  margin-top: 32px;
+  padding-left: 160px;
+}
+
+.form-footer .el-button {
+  min-width: 100px;
+  padding: 12px 24px;
+  border-radius: 6px;
+}
+
+/* 响应式 */
+@media screen and (max-width: 768px) {
+  .section-title {
+    margin-bottom: 16px;
+  }
+
+  .form-footer {
+    padding-left: 0;
+    text-align: center;
+  }
+
+  .config-card ::v-deep .el-card__body {
+    padding: 16px;
+  }
+}
+
+
+/* 游戏列表样式 */
+.game-list-item {
+  margin-top: 20px;
+}
+
+.game-list-header {
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  margin-bottom: 10px;
+}
+
+.game-list-tip {
+  font-size: 12px;
+  color: #909399;
+}
+
+.game-image-preview {
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  min-height: 50px;
+}
+
+.no-image {
+  font-size: 12px;
+  color: #909399;
+}
+
+.game-link {
+  display: inline-block;
+  max-width: 200px;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+  color: #409EFF;
+  cursor: pointer;
+}
+
+.delete-btn {
+  color: #f56c6c !important;
+}
+
+.delete-btn:hover {
+  color: #f78989 !important;
+}
+
+/* 表格样式优化 */
+::v-deep .el-table .cell {
+  padding-left: 8px;
+  padding-right: 8px;
+}
+
+::v-deep .el-table th {
+  background-color: #f5f7fa;
+  color: #606266;
+}
+
+::v-deep .el-table--border {
+  border-radius: 8px;
+  overflow: hidden;
+}
+
+/* 图片上传组件样式调整 */
+::v-deep .image-upload {
+  width: 60px;
+  height: 60px;
+}
+
+::v-deep .image-upload .el-upload--picture-card {
+  width: 60px;
+  height: 60px;
+  line-height: 64px;
+}
 </style>