648540858
2024-04-30 fa8ff09b426ac3fab3e3e715ffff15e60c20779c
新功能-云端录像列表支持下载
1个文件已修改
31 ■■■■ 已修改文件
web_src/src/components/CloudRecord.vue 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
web_src/src/components/CloudRecord.vue
@@ -74,6 +74,8 @@
        <template slot-scope="scope">
          <el-button size="medium" icon="el-icon-video-play" type="text" @click="play(scope.row)">播放
          </el-button>
          <el-button size="medium" icon="el-icon-download" type="text" @click="downloadFile(scope.row)">下载
          </el-button>
          <!--            <el-button size="medium" icon="el-icon-delete" type="text" style="color: #f56c6c"-->
          <!--                       @click="deleteRecord(scope.row)">删除-->
          <!--            </el-button>-->
@@ -234,14 +236,29 @@
        console.log(error);
      });
    },
      getFileBasePath(item) {
          let basePath = ""
          if (axios.defaults.baseURL.startsWith("http")) {
              basePath = `${axios.defaults.baseURL}/record_proxy/${item.mediaServerId}`
          }else {
              basePath = `${window.location.origin}${axios.defaults.baseURL}/record_proxy/${item.mediaServerId}`
    downloadFile(file){
      console.log(file)
      this.$axios({
        method: 'get',
        url: `/api/cloud/record/play/path`,
        params: {
          recordId: file.id,
          }
          return basePath;
      }).then((res) => {
        console.log(res)
        const link = document.createElement('a');
        link.target = "_blank";
        if (res.data.code === 0) {
          if (location.protocol === "https:") {
            link.href = res.data.data.httpsPath + "&save_name=" + file.fileName;
          }else {
            link.href = res.data.data.httpPath + "&save_name=" + file.fileName;
          }
          link.click();
        }
      }).catch((error) => {
        console.log(error);
      });
      },
    deleteRecord() {
      // TODO