zhengjinyi 4 年 前
コミット
4a77c28bb6

+ 1 - 0
src/main/resources/static/js/common/locallhostAjax.service.js

@@ -17,6 +17,7 @@ var LocakkHost = {
             $.ajax({
                 url: option.url,
                 data: option.data,
+                responseType:'blob',
                 xhrFields: {//此处为跨域后台保持session一致,切勿删除!!!
                     withCredentials: true
                 },

+ 1 - 1
src/main/resources/static/js/common/serviceapi/document.service.js

@@ -47,7 +47,7 @@ var DocumentApi = {
             });
         },
         GetDocumentDownloadLink: function (params, callback) {//资料库获取详情
-            LocakkHost.AjaxService({ url:'/document/downFile', type:'GET', data:params, json:false})
+            LocakkHost.AjaxService({ url:'/document/downFileAll', type:'GET', data:params, json:false})
             .then(function(res){
                 callback(res);
             });

+ 1 - 2
src/main/resources/static/js/document/details.js

@@ -41,11 +41,10 @@ var documentList = new Vue({
         },
         download:function() {
             var _self = this;
-            // window.open('/document/downFile?pdfId='+_self.pdfId);
             if(_self.is_Wechat_bowcr){
                 _self.isWechatShowToest = true
             }else{
-                // var BLOB = new Blob(['/7qBjQ4SKBd.txt']);
+                // var BLOB = new Blob([data]);
                 // var url = window.URL.createObjectURL(BLOB);
                 var DownloadLink = document.createElement('a');
                 DownloadLink.style.display = 'none';

+ 3 - 3
src/main/resources/static/js/document/list.js

@@ -75,7 +75,7 @@ var documentList = new Vue({
         showPdfList:function(item){
             item.isShowDowns = !item.isShowDowns;
         },
-        download:function(pdfId) {
+        download:function(pdf) {
             var _self = this;
             if(_self.is_Wechat_bowcr){
                 _self.isWechatShowToest = true
@@ -84,8 +84,8 @@ var documentList = new Vue({
                 // var url = window.URL.createObjectURL(BLOB);
                 var DownloadLink = document.createElement('a');
                 DownloadLink.style.display = 'none';
-                DownloadLink.href = 'https://static.caimei365.com/app/caimei-activity-h5/image/2021/01/01.jpg';
-                DownloadLink.setAttribute('download', '01.jpg');
+                DownloadLink.href = pdf.url;
+                DownloadLink.setAttribute('download', pdf.name);
                 document.body.appendChild(DownloadLink);
                 DownloadLink.click();
                 document.body.removeChild(DownloadLink);

+ 3 - 3
src/main/resources/static/js/document/more-content.js

@@ -36,7 +36,7 @@ var documentList = new Vue({
         goPathList:function(){
             location.href = '/document/list.html';
         },
-        download:function(pdfId) {
+        download:function(pdf) {
             var _self = this;
             if(_self.is_Wechat_bowcr){
                 _self.isWechatShowToest = true
@@ -45,8 +45,8 @@ var documentList = new Vue({
                 // var url = window.URL.createObjectURL(BLOB);
                 var DownloadLink = document.createElement('a');
                 DownloadLink.style.display = 'none';
-                DownloadLink.href = '/7qBjQ4SKBd.txt';
-                DownloadLink.setAttribute('download', '7qBjQ4SKBd.txt');
+                DownloadLink.href = pdf.url;
+                DownloadLink.setAttribute('download', pdf.name);
                 document.body.appendChild(DownloadLink);
                 DownloadLink.click();
                 document.body.removeChild(DownloadLink);

+ 1 - 1
src/main/resources/templates/document/list.html

@@ -45,7 +45,7 @@
                             <img v-if="isPC" class="img" src="/img/document/pdf.png" alt="">
                             <img v-else class="img" src="/img/document/icon-pdfh5.png" alt="">
                             <p class="name" @click="PdfDetails(pdf.id)">{{ pdf.name }}</p>
-                            <p class="down" @click="download(pdf.id)"><a>下载</a></p>
+                            <p class="down" @click="download(pdf)"><a>下载</a></p>
                             <p class="time">{{ pdf.uploadTime }}</p>
                         </div>
                     </div>

+ 1 - 1
src/main/resources/templates/document/more-content.html

@@ -43,7 +43,7 @@
                             <img v-if="isPC" class="img" src="/img/document/pdf.png" alt="">
                             <img v-else class="img" src="/img/document/icon-pdfh5.png" alt="">
                             <p class="name" @click="PdfDetails(pdf.id)">{{ pdf.name }}</p>
-                            <p class="down"><a @click="download(pdf.id)">下载</a></p>
+                            <p class="down"><a @click="download(pdf)">下载</a></p>
                             <p class="time">{{ pdf.uploadTime }}</p>
                         </div>
                     </div>