yuanyiming 2 年 前
コミット
8f96ff3c91

+ 6 - 1
src/App.vue

@@ -543,5 +543,10 @@
         font-size: 16px !important;
       }
       
-
+  .showFileArea {      //在线查看文档内容居中
+    width: 100%;
+    height: 70vh;
+    display: flex;
+    justify-content: center;
+  }
 </style>

+ 12 - 11
src/components/tool/getExcel.js

@@ -4,29 +4,30 @@ let getBuffer = function(){
     return new Promise((resolve,reject)=>{
         const x = new XMLHttpRequest();
         x.open("GET", 'file/附件 5 :学校创客专项资金使用申请表.xlsx', true);
-        x.responseType = "blob";
+        x.responseType = "blob";       //
         x.send()
         x.onreadystatechange = function(){
             if(x.readyState==4 && x.status==200){
                 let reader = new FileReader();
-                reader.readAsArrayBuffer(x.response)
-                reader.onload = function(){
-                    resolve(reader.result)
+                console.log(x.response);
+                reader.readAsArrayBuffer(x.response)          //读取返回回来的文件内容
+                reader.onload = function(){                    //当读取操作成功完成时调用
+                    console.log(reader);
+                    resolve(reader.result)                       //reader.result返回文件内容
                 }
             }
         }
     })
-
 }
 
 
 
 
-export default async function getExcel(data){
-    console.log(data);
-    const content = await getBuffer();
+export default async function getExcel(data){     //async 申明 function 是异步的,而 await 等待某个操作完成。
+    // console.log(data);
+    const content = await getBuffer();       //等待getBuffer函数执行完成
     const workbook = new Excel.Workbook();
-    await workbook.xlsx.load(content);
+    await workbook.xlsx.load(content);      //从 buffer 加载
     //获取第一个worksheet
     let worksheet = workbook.getWorksheet(1);
 
@@ -34,7 +35,7 @@ export default async function getExcel(data){
     //项目类型
     // worksheet.getCell("G2").value='项目类型:创客空间 □     创客实践室 □     个人创客 □     创客活动 □   '
     //项目名称
-    worksheet.getCell('G3').value=`项目名称${data.PName}`;
+    worksheet.getCell('G3').value=`项目名称:${data.PName}`;
     //备注
     worksheet.getCell("G18").value=data.remarks;
     
@@ -256,7 +257,7 @@ export default async function getExcel(data){
 
     //下载excel文件
     let blob = new Blob([await workbook.xlsx.writeBuffer()], {type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8"});
-    let url = window.URL.createObjectURL(blob);
+    let url = window.URL.createObjectURL(blob);   // 字符内容转变成blob地址
     const link = document.createElement('a');
     link.style.display = 'none';
     link.href = url;

+ 6 - 25
src/views/firm.vue

@@ -151,13 +151,11 @@ export default {
   data() {
     return {
       accept: "*",
-      showFile: false,
-      showFileType: 0,
+      // showFileType: 0,
       dialogVisible1: false,
       delId:"",
       input:"",
       tableData: [],
-      showFileUrl: "",
       Page: {
         nowPage: 1,
         total: 0,
@@ -167,7 +165,9 @@ export default {
         value:50,
         show:false
       },
-      ProjectEndLookFile:{url:"",type:""},
+      // ProjectEndLookFile:{url:"",type:""},
+      showFile: false,
+      showFileUrl: "",
       Wordss:{type:"",name:""},
       canonical:{
           Image:/^https?:\/\/(.+\/)+.+(\.(gif|png|jpg|jpeg|webp|svg|psd|bmp|tif))$/i,
@@ -178,24 +178,8 @@ export default {
   methods: {
     //展示文件
     checkFileType(url) {
-    // console.log(url);
-      // if (url.split(".")[url.split(".").length - 1].toLocaleUpperCase() == "PDF") {
+    
     this.showFileUrl = url;
-      //     this.showFileType = 1;
-      //   }
-      // // else {
-      // //   this.showFileUrl =
-      // //     "https://view.officeapps.live.com/op/view.aspx?src=" + url;
-      // //     this.showFileType = 0;
-      // // }
-      // if (url.split(".")[url.split(".").length - 1].toLocaleUpperCase() == ('PNG' || 'JPG')) {
-      //   console.log(1111);
-      //     this.showFileUrl = url;
-      //     this.showFileType = 2;
-      // }else{
-      //     this.showFileUrl ="https://view.officeapps.live.com/op/view.aspx?src=" + url;
-      //     this.showFileType = 0;
-      // }
       this.showFile = true;
 
       if(typeof url=='undefined')return {type:"",name:""};
@@ -415,8 +399,5 @@ export default {
 //   display: flex;
 //   justify-content: flex-end;
 // }
-.showFileArea {
-  width: 100%;
-  height: 70vh;
-}
+
 </style>

+ 1 - 0
src/views/fundManage/makerfundDetails.vue

@@ -3,6 +3,7 @@
   <div class="makerfundApply">
     <div class="vfpHeader">
         <div class="titleOne">创客资金申请</div>
+        <div class="smallTitle" style="left: 150px;">创客资金申请详情</div>
         <el-button type="primary" @click="$router.back()">返回</el-button>
     </div>
     <hr>

+ 33 - 13
src/views/projectManage/ProjectManagement4.vue

@@ -85,8 +85,19 @@
       <div class="addDialogLogo">LOGO</div>
       <div class="showFileArea">
         <!-- <vpdf v-if="/^\s*$/g.test(showFileUrl)&&showFileUrl.split('.')[showFileUrl.split('.').length-1]=='pdf'" :pdfUrl="showFileUrl"></vpdf> -->
-        <vword v-if="showFileType == 0" :pdfUrl="showFileUrl"></vword>
-        <vpdf v-else :pdfUrl="showFileUrl"></vpdf>
+        <vword
+            style="width: 100%; height: 100%; overflow: auto"
+            class="fullStyle"
+            v-if="Wordss['type']!='pdf' && Wordss['name']!='图片'"
+            :pdfUrl="'https://view.officeapps.live.com/op/view.aspx?src='+showFileUrl"
+        ></vword>
+        <vpdf
+            style="width: 100%; height: 100%; overflow: auto"
+            class="fullStyle"
+            :pdfUrl="showFileUrl"
+            v-if="Wordss['type']=='pdf'"
+        ></vpdf>
+        <img :src="showFileUrl" alt="图片哦" v-if="Wordss['name']=='图片'" style="width: auto;height: auto;max-width: 100%;max-height: 100%;">
       </div>
     </el-dialog>
     <!-- 展示文档结束 -->
@@ -121,6 +132,11 @@
             showFile:false,
             showFileType: 0,
             showFileUrl: "",
+            Wordss:{type:"",name:""},
+            canonical:{
+                Image:/^https?:\/\/(.+\/)+.+(\.(gif|png|jpg|jpeg|webp|svg|psd|bmp|tif))$/i,
+                File:/^https?:\/\/(.+\/)+.+(\.(docx|xlsx|ppt|pdf))$/i
+            },
             tableData:[],
             progress:{
               value:0,
@@ -134,18 +150,22 @@
           },
           //展示文件
           checkFile(url) {
-            console.log(url);
-            if (
-              url.split(".")[url.split(".").length - 1].toLocaleUpperCase() == "PDF"
-            ) {
-              this.showFileUrl = url;
-              this.showFileType = 1;
-            } else {
-              this.showFileUrl =
-                "https://view.officeapps.live.com/op/view.aspx?src=" + url;
-              this.showFileType = 0;
-            }
+            this.showFileUrl = url;
             this.showFile = true;
+
+            if(typeof url=='undefined')return {type:"",name:""};
+                let urlSplit = url.split(".");
+                const type = urlSplit[urlSplit.length-1]
+                if(this.canonical.Image.test(url)){
+                
+                  this.Wordss={type:type,name:"图片"}
+                  return console.log(this.Wordss);
+                }
+                if(this.canonical.File.test(url)){
+                  this.Wordss={type:type,name:"文档"}
+                  return console.log(this.Wordss);
+                }
+                else return this.Wordss={type:type,name:type}
           },
           getFile(val) {    //上传文件
             this.file = val;

+ 34 - 14
src/views/projectManage/ProjectManagement5.vue

@@ -86,8 +86,19 @@
       <div class="addDialogLogo">LOGO</div>
       <div class="showFileArea">
         <!-- <vpdf v-if="/^\s*$/g.test(showFileUrl)&&showFileUrl.split('.')[showFileUrl.split('.').length-1]=='pdf'" :pdfUrl="showFileUrl"></vpdf> -->
-        <vword v-if="showFileType == 0" :pdfUrl="showFileUrl"></vword>
-        <vpdf v-else :pdfUrl="showFileUrl"></vpdf>
+        <vword
+            style="width: 100%; height: 100%; overflow: auto"
+            class="fullStyle"
+            v-if="Wordss['type']!='pdf' && Wordss['name']!='图片'"
+            :pdfUrl="'https://view.officeapps.live.com/op/view.aspx?src='+showFileUrl"
+        ></vword>
+        <vpdf
+            style="width: 100%; height: 100%; overflow: auto"
+            class="fullStyle"
+            :pdfUrl="showFileUrl"
+            v-if="Wordss['type']=='pdf'"
+        ></vpdf>
+        <img :src="showFileUrl" alt="图片哦" v-if="Wordss['name']=='图片'" style="width: auto;height: auto;max-width: 100%;max-height: 100%;">
       </div>
     </el-dialog>
       <!-- 分页 -->
@@ -122,6 +133,11 @@
             showFile:false,
             showFileType: 0,
             showFileUrl: "",
+            Wordss:{type:"",name:""},
+            canonical:{
+                Image:/^https?:\/\/(.+\/)+.+(\.(gif|png|jpg|jpeg|webp|svg|psd|bmp|tif))$/i,
+                File:/^https?:\/\/(.+\/)+.+(\.(docx|xlsx|ppt|pdf))$/i
+            },
             title:"",
             tableData:[],  //附件列表
             file:'',
@@ -137,18 +153,22 @@
           },
           //展示文件
           checkFile(url) {
-              console.log(url);
-              if (
-                url.split(".")[url.split(".").length - 1].toLocaleUpperCase() == "PDF"
-              ) {
-                this.showFileUrl = url;
-                this.showFileType = 1;
-              } else {
-                this.showFileUrl =
-                  "https://view.officeapps.live.com/op/view.aspx?src=" + url;
-                this.showFileType = 0;
-              }
-              this.showFile = true;
+            this.showFileUrl = url;
+      this.showFile = true;
+
+      if(typeof url=='undefined')return {type:"",name:""};
+          let urlSplit = url.split(".");
+          const type = urlSplit[urlSplit.length-1]
+          if(this.canonical.Image.test(url)){
+           
+             this.Wordss={type:type,name:"图片"}
+             return console.log(this.Wordss);
+          }
+          if(this.canonical.File.test(url)){
+             this.Wordss={type:type,name:"文档"}
+             return console.log(this.Wordss);
+          }
+          else return this.Wordss={type:type,name:type}
           },
           getFile(val) {    //上传文件
             this.file = val;

+ 38 - 17
src/views/projectSettlement/projectSettlement3.vue

@@ -83,9 +83,19 @@
           >
       <div class="addDialogLogo">LOGO</div>
       <div class="showFileArea">
-        <!-- <vpdf v-if="/^\s*$/g.test(showFileUrl)&&showFileUrl.split('.')[showFileUrl.split('.').length-1]=='pdf'" :pdfUrl="showFileUrl"></vpdf> -->
-        <vword v-if="showFileType == 0" :pdfUrl="showFileUrl"></vword>
-        <vpdf v-else :pdfUrl="showFileUrl"></vpdf>
+        <vword
+            style="width: 100%; height: 100%; overflow: auto"
+            class="fullStyle"
+            v-if="Wordss['type']!='pdf' && Wordss['name']!='图片'"
+            :pdfUrl="'https://view.officeapps.live.com/op/view.aspx?src='+showFileUrl"
+        ></vword>
+        <vpdf
+            style="width: 100%; height: 100%; overflow: auto"
+            class="fullStyle"
+            :pdfUrl="showFileUrl"
+            v-if="Wordss['type']=='pdf'"
+        ></vpdf>
+        <img :src="showFileUrl" alt="图片哦" v-if="Wordss['name']=='图片'" style="width: auto;height: auto;max-width: 100%;max-height: 100%;">
       </div>
     </el-dialog>
     <!-- 展示文档结束 -->
@@ -117,27 +127,38 @@
               packageSize:8,
               currentPage:1
             }, 
-            showFile:false,
+            // showFile:false,
             showFileType: 0,
-            showFileUrl: "",
+            // showFileUrl: "",
             tableData:[],
+            showFile: false,
+            showFileUrl: "",
+            Wordss:{type:"",name:""},
+            canonical:{
+                Image:/^https?:\/\/(.+\/)+.+(\.(gif|png|jpg|jpeg|webp|svg|psd|bmp|tif))$/i,
+                File:/^https?:\/\/(.+\/)+.+(\.(docx|xlsx|ppt|pdf))$/i
+            },
           }
         },
         methods:{
           //展示文件
           checkFile(url) {
-            console.log(url);
-            if (
-              url.split(".")[url.split(".").length - 1].toLocaleUpperCase() == "PDF"
-            ) {
-              this.showFileUrl = url;
-              this.showFileType = 1;
-            } else {
-              this.showFileUrl =
-                "https://view.officeapps.live.com/op/view.aspx?src=" + url;
-              this.showFileType = 0;
-            }
+            this.showFileUrl = url;
             this.showFile = true;
+
+            if(typeof url=='undefined')return {type:"",name:""};
+                let urlSplit = url.split(".");
+                const type = urlSplit[urlSplit.length-1]
+                if(this.canonical.Image.test(url)){
+                
+                  this.Wordss={type:type,name:"图片"}
+                  return console.log(this.Wordss);
+                }
+                if(this.canonical.File.test(url)){
+                  this.Wordss={type:type,name:"文档"}
+                  return console.log(this.Wordss);
+                }
+                else return this.Wordss={type:type,name:type}
           },
           getFile(val) {    //上传文件
             this.file = val;
@@ -314,5 +335,5 @@
     }
     
   }
-   
+
   </style>

+ 37 - 16
src/views/projectSettlement/projectSettlement4.vue

@@ -85,8 +85,19 @@
       <div class="addDialogLogo">LOGO</div>
       <div class="showFileArea">
         <!-- <vpdf v-if="/^\s*$/g.test(showFileUrl)&&showFileUrl.split('.')[showFileUrl.split('.').length-1]=='pdf'" :pdfUrl="showFileUrl"></vpdf> -->
-        <vword v-if="showFileType == 0" :pdfUrl="showFileUrl"></vword>
-        <vpdf v-else :pdfUrl="showFileUrl"></vpdf>
+        <vword
+            style="width: 100%; height: 100%; overflow: auto"
+            class="fullStyle"
+            v-if="Wordss['type']!='pdf' && Wordss['name']!='图片'"
+            :pdfUrl="'https://view.officeapps.live.com/op/view.aspx?src='+showFileUrl"
+        ></vword>
+        <vpdf
+            style="width: 100%; height: 100%; overflow: auto"
+            class="fullStyle"
+            :pdfUrl="showFileUrl"
+            v-if="Wordss['type']=='pdf'"
+        ></vpdf>
+        <img :src="showFileUrl" alt="图片哦" v-if="Wordss['name']=='图片'" style="width: auto;height: auto;max-width: 100%;max-height: 100%;">
       </div>
     </el-dialog>
     <!-- 展示文档结束 -->
@@ -120,27 +131,37 @@
             //   packageSize:8,
             //   currentPage:1
             // }, 
-            showFile:false,
             showFileType: 0,
-            showFileUrl: "",
             tableData:[],  //附件列表
-            file:''    //上传文件数据
+            file:'',    //上传文件数据
+            showFile: false,
+            showFileUrl: "",
+            Wordss:{type:"",name:""},
+            canonical:{
+                Image:/^https?:\/\/(.+\/)+.+(\.(gif|png|jpg|jpeg|webp|svg|psd|bmp|tif))$/i,
+                File:/^https?:\/\/(.+\/)+.+(\.(docx|xlsx|ppt|pdf))$/i
+            },
           }
         },
         methods:{
           //展示文件
           checkFile(url) {
-            if (
-              url.split(".")[url.split(".").length - 1].toLocaleUpperCase() == "PDF"
-            ) {
-              this.showFileUrl = url;
-              this.showFileType = 1;
-            } else {
-              this.showFileUrl =
-                "https://view.officeapps.live.com/op/view.aspx?src=" + url;
-              this.showFileType = 0;
-            }
+            this.showFileUrl = url;
             this.showFile = true;
+
+            if(typeof url=='undefined')return {type:"",name:""};
+                let urlSplit = url.split(".");
+                const type = urlSplit[urlSplit.length-1]
+                if(this.canonical.Image.test(url)){
+                
+                  this.Wordss={type:type,name:"图片"}
+                  return console.log(this.Wordss);
+                }
+                if(this.canonical.File.test(url)){
+                  this.Wordss={type:type,name:"文档"}
+                  return console.log(this.Wordss);
+                }
+                else return this.Wordss={type:type,name:type}
           },
           getFile(val) {    //上传文件
             this.file = val;
@@ -321,6 +342,6 @@
       }
     }
   }
-    
+
    
   </style>

+ 33 - 12
src/views/projectSettlement/projectSettlement5.vue

@@ -140,8 +140,19 @@
       <div class="addDialogLogo">LOGO</div>
       <div class="showFileArea">
         <!-- <vpdf v-if="/^\s*$/g.test(showFileUrl)&&showFileUrl.split('.')[showFileUrl.split('.').length-1]=='pdf'" :pdfUrl="showFileUrl"></vpdf> -->
-        <vword v-if="showFileType == 0" :pdfUrl="showFileUrl"></vword>
-        <vpdf v-else :pdfUrl="showFileUrl"></vpdf>
+        <vword
+            style="width: 100%; height: 100%; overflow: auto"
+            class="fullStyle"
+            v-if="Wordss['type']!='pdf' && Wordss['name']!='图片'"
+            :pdfUrl="'https://view.officeapps.live.com/op/view.aspx?src='+showFileUrl"
+        ></vword>
+        <vpdf
+            style="width: 100%; height: 100%; overflow: auto"
+            class="fullStyle"
+            :pdfUrl="showFileUrl"
+            v-if="Wordss['type']=='pdf'"
+        ></vpdf>
+        <img :src="showFileUrl" alt="图片哦" v-if="Wordss['name']=='图片'" style="width: auto;height: auto;max-width: 100%;max-height: 100%;">
       </div>
     </el-dialog>
 
@@ -161,6 +172,11 @@
             showFile:false,
             showFileType: 0,
             showFileUrl: "",
+            Wordss:{type:"",name:""},
+            canonical:{
+                Image:/^https?:\/\/(.+\/)+.+(\.(gif|png|jpg|jpeg|webp|svg|psd|bmp|tif))$/i,
+                File:/^https?:\/\/(.+\/)+.+(\.(docx|xlsx|ppt|pdf))$/i
+            },
             // tableData:[],
             file:[],
             progress:{     //进度条
@@ -181,17 +197,22 @@
           //展示文件
           checkFile(url) {
               // console.log(url);
-              if (
-                url.split(".")[url.split(".").length - 1].toLocaleUpperCase() == "PDF"
-              ) {
-                this.showFileUrl = url;
-                this.showFileType = 1;
-              } else {
-                this.showFileUrl =
-                  "https://view.officeapps.live.com/op/view.aspx?src=" + url;
-                this.showFileType = 0;
-              }
+              this.showFileUrl = url;
               this.showFile = true;
+
+              if(typeof url=='undefined')return {type:"",name:""};
+                  let urlSplit = url.split(".");
+                  const type = urlSplit[urlSplit.length-1]
+                  if(this.canonical.Image.test(url)){
+                  
+                    this.Wordss={type:type,name:"图片"}
+                    return console.log(this.Wordss);
+                  }
+                  if(this.canonical.File.test(url)){
+                    this.Wordss={type:type,name:"文档"}
+                    return console.log(this.Wordss);
+                  }
+                  else return this.Wordss={type:type,name:type}
           },
             confirmSubmit(){    //确定提交
                 let param={