浏览代码

全景图上传和下载

James 4 年之前
父节点
当前提交
4afd0aef70
共有 1 个文件被更改,包括 23 次插入21 次删除
  1. 23 21
      src/pages/list/index.vue

+ 23 - 21
src/pages/list/index.vue

@@ -20,8 +20,9 @@
       </el-row>
       <!-- 生成大场景someData -->
       <el-row type="flex" class="addScene">
-        <el-button type="warning" style="margin-right: 20px" @click="logout">登出</el-button
-        >
+        <el-button type="primary">下载四维看看场景数据</el-button>
+          <el-button type="primary">下载大场景数据</el-button>
+        <el-button type="warning" style="margin-right: 20px" @click="logout">登出</el-button>
         <!-- <el-input placeholder="输入编码生成someData" v-model="url">
           <template slot="append">
             <a :href="'/getSomeData?url=https://my.matterportvr.cn/api/player/models/'+url+'/?format=json'" target="_block">生成</a>
@@ -32,6 +33,7 @@
     <!-- 表格 -->
     <el-table :data="scenes" style="width: 100%" @selection-change="handleSelectionChange">
       <el-table-column type="selection" width="50"></el-table-column>
+      <el-table-column type="index" width="50" label="序号"></el-table-column>
       <el-table-column prop="sceneTitle" width="200" label="场景名称">
       </el-table-column>
       <el-table-column prop="sceneCode" width="200" label="MP场景码">
@@ -59,10 +61,10 @@
       <el-table-column fixed="right" label="操作" width="200">
         <template slot-scope="scope">
           <a :href="scope.row.webSite" target="_blank">查看</a>
-          <a @click="handModelDownload(scope.row)">模型下载</a>
-          <a @click="handModelUpload(scope.row)">模型上传</a>
-          <a @click="handPanoramaDownload">全景图下载</a>
-          <a @click="handPanoramaUpload">全景图上传</a>
+          <a @click="handModelDownload(scope.row,'obj')">模型下载</a>
+          <a @click="handModelUpload(scope.row,'obj')">模型上传</a>
+          <a @click="handModelDownload(scope.row,'pano')">全景图下载</a>
+          <a @click="handModelUpload(scope.row,'pano')">全景图上传</a>
         </template>
       </el-table-column>
     </el-table>
@@ -126,7 +128,7 @@
 
     <!-- 文件上传 -->
     <el-dialog title="上传模型" :visible.sync="dialogFilesVisible">
-      <el-form ref="form1" label-width="80px" class="add-frome">
+      <el-form ref="form1" label-width="100px" class="add-frome">
         <el-form-item label="全景图文件">
           <el-upload
             class="upload-demo"
@@ -205,8 +207,8 @@ export default {
     },
   },
   methods: {
-    handleSelectionChange(val){
-      console.log('val',val)
+    handleSelectionChange(val) {
+      console.log("val", val);
     },
     handleRemove(file) {
       let index = this.fileList.findIndex((item) => {
@@ -252,17 +254,16 @@ export default {
       });
       this.fullscreenLoading = true;
       let res = await this.$http.post(
-        `/manage/scene/upload/obj/${this.targetObj.sceneCode}`,
+        `/manage/scene/upload/${this.targetObj.uploadType}/${this.targetObj.sceneCode}`,
         formData,
         {
           "Content-Type": "multipart/form-data",
         }
       );
+      this.fullscreenLoading = false;
       if (res["code"] === 0) {
-        this.fullscreenLoading = false;
         that.onSuccess(res);
       } else {
-        this.fullscreenLoading = false;
         that.onError(res);
       }
     },
@@ -311,19 +312,20 @@ export default {
       this.total = res.data.total;
       this.currentPage = res.data.pageNum;
     },
-    async handModelDownload(item) {
-      console.log("item", item);
+    //模型下载 全景下载
+    async handModelDownload(item,type) {
+      console.log("item", item,'type',type);
+      this.fullscreenLoading = true;
       let res = await this.$http.get(
-        `/manage/scene/download/obj/${item.sceneCode}`,
-        { params: { code: item.sceneCode } }
-      );
+        `/manage/scene/download/${type}/${item.sceneCode}`,{ params: { code: item.sceneCode } });
+      this.fullscreenLoading = false;
       if (res && res["code"] === 0) {
         window.open(`http://${res["data"]}`);
-      }
+      } else {}
     },
-    handModelUpload(item) {
+    handModelUpload(item,type) {
       this.dialogFilesVisible = true;
-      this.targetObj = item;
+      this.targetObj = {...item,uploadType:type};
       this.fileList = [];
     },
     handPanoramaDownload() {},
@@ -377,7 +379,7 @@ export default {
   margin-bottom: 0;
 }
 .addScene {
-  width: 80px;
+  width: 450px;
 }
 .p-con {
   text-align: center;