Преглед на файлове

1、直播数据导出404问题
2、小米推送通知配置调整

yys преди 2 седмици
родител
ревизия
829024a8b6
променени са 2 файла, в които са добавени 58 реда и са изтрити 8 реда
  1. 54 7
      src/views/live/liveData/index.vue
  2. 4 1
      src/views/system/config/config.vue

+ 54 - 7
src/views/live/liveData/index.vue

@@ -134,14 +134,14 @@
       </el-form-item>
       <el-form-item label="完课状态" prop="completeStatus">
         <el-select v-model="queryParams.completeStatus" placeholder="请选择完课状态" clearable size="small" popper-append-to-body>
-          <el-option label="已完课" value="1"></el-option>
-          <el-option label="未完课" value="0"></el-option>
+          <el-option label="已完课" :value="1"></el-option>
+          <el-option label="未完课" :value="0"></el-option>
         </el-select>
       </el-form-item>
       <el-form-item label="付费状态" prop="payStatus">
         <el-select v-model="queryParams.payStatus" placeholder="请选择付费状态" clearable size="small" popper-append-to-body>
-          <el-option label="已付费" value="1"></el-option>
-          <el-option label="未付费" value="0"></el-option>
+          <el-option label="已付费" :value="1"></el-option>
+          <el-option label="未付费" :value="0"></el-option>
         </el-select>
       </el-form-item>
       <el-form-item label="观看时长" prop="watchDuration">
@@ -581,6 +581,8 @@
 </template>
 
 <script>
+import axios from "axios";
+import { getToken } from "@/utils/auth";
 import { listLiveData, exportLiveData, dashboardData, getLiveDataDetailBySql, getLiveUserDetailListBySql, exportLiveUserDetail } from "@/api/live/liveData";
 import { batchUpdateExternalContactNotes } from "@/api/qw/externalContact";
 import { addTag } from "@/api/qw/externalContact";
@@ -690,6 +692,16 @@ export default {
         this.queryParams.startTime = null;
         this.queryParams.endTime = null;
       }
+      // 空 liveId / 空字符串不传,避免后端条件异常
+      if (!this.queryParams.liveId) {
+        this.queryParams.liveId = null;
+      }
+      if (this.queryParams.liveName === '') {
+        this.queryParams.liveName = null;
+      }
+      if (this.queryParams.watchType === '') {
+        this.queryParams.watchType = null;
+      }
       listLiveData(this.queryParams).then(response => {
         if (response.code === 200) {
           this.statisticsData = response.data || {};
@@ -753,13 +765,46 @@ export default {
         return exportLiveData(this.queryParams);
       }).then(response => {
         if (response.code === 200) {
-          this.download(response.msg);
+          return this.downloadFileWithAuth(response.msg);
         }
+      }).then(() => {
         this.exportLoading = false;
       }).catch(() => {
         this.exportLoading = false;
       });
     },
+    /** 带鉴权下载,避免 /common/download 因无 token 返回 401 */
+    downloadFileWithAuth(fileName) {
+      if (!fileName) {
+        this.$message.error("导出失败,未获取到文件名");
+        return Promise.reject("empty fileName");
+      }
+      return axios({
+        method: "get",
+        url: process.env.VUE_APP_BASE_API + "/common/download",
+        params: { fileName: fileName, delete: false },
+        responseType: "blob",
+        headers: {
+          Authorization: "Bearer " + getToken(),
+          "X-Frontend-Type": "admin"
+        }
+      }).then(res => {
+        const disposition = res.headers["content-disposition"] || "";
+        let downloadName = fileName.indexOf("_") > -1 ? fileName.substring(fileName.indexOf("_") + 1) : fileName;
+        const match = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/.exec(disposition);
+        if (match && match[1]) {
+          downloadName = decodeURIComponent(match[1].replace(/['"]/g, ""));
+        }
+        const blob = new Blob([res.data]);
+        const link = document.createElement("a");
+        link.href = window.URL.createObjectURL(blob);
+        link.setAttribute("download", downloadName);
+        document.body.appendChild(link);
+        link.click();
+        document.body.removeChild(link);
+        window.URL.revokeObjectURL(link.href);
+      });
+    },
     /** 自动打标签 */
     // handleAutoTag() {
     //   if (this.multipleSelection.length === 0) {
@@ -961,9 +1006,11 @@ export default {
         return exportLiveUserDetail(this.currentLiveId);
       }).then(response => {
         if (response.code === 200) {
-          this.download(response.msg);
-          this.$message.success('导出成功');
+          return this.downloadFileWithAuth(response.msg).then(() => {
+            this.$message.success('导出成功');
+          });
         }
+      }).then(() => {
         this.userDetailExportLoading = false;
       }).catch(() => {
         this.userDetailExportLoading = false;

+ 4 - 1
src/views/system/config/config.vue

@@ -3048,6 +3048,9 @@
           <el-form-item label="离线推送 小米系统申请channel_id">
             <el-input v-model="form34.xm_channel_id" style="width: 200px"></el-input>
           </el-form-item>
+          <el-form-item label="离线推送 小米私信模板template_id">
+            <el-input v-model="form34.xm_template_id" style="width: 200px" placeholder="如官方模板 M12378"></el-input>
+          </el-form-item>
           <el-form-item label="离线推送 华为系统申请channel_id">
             <el-input v-model="form34.hw_channel_id" style="width: 200px"></el-input>
           </el-form-item>
@@ -4044,7 +4047,7 @@ export default {
           console.log("----------"+response.data)
           this.configId = response.data.configId
           this.configKey = response.data.configKey
-          this.formim =JSON.parse(response.data.configValue);
+          this.form34 = {...this.form34, ...JSON.parse(response.data.configValue)};
         }
         if(key == 'living.config'){
           if(!!response.data){