Browse Source

Squashed commit of the following:

commit 6603eb9490092692eee5c9d9128c8edd6095bb23
Author: liucf <liucf@zjlantone.com>
Date:   Tue Sep 17 15:07:17 2019 +0800

    2321,,216
liucf 5 years ago
parent
commit
724594b2ef
2 changed files with 17 additions and 9 deletions
  1. 2 1
      src/store/actions/mainSuit.js
  2. 15 8
      src/utils/tools.js

+ 2 - 1
src/store/actions/mainSuit.js

@@ -907,7 +907,8 @@ export function backspaceText(state,action){
     }else if(data[delIndex+1] && data[delIndex+1].tagType==8){
       data.splice(delIndex,1);
       res.saveText.splice(delIndex,1);
-    }else if(data[delIndex-1] && data[delIndex-1].tagType !=8){//最后一个文本标签
+    }
+    else if(!data[delIndex+1] && data[delIndex-1] && data[delIndex-1].tagType !=8){//最后一个文本标签
       console.log("删除最后一个啦")
     }
     else{

+ 15 - 8
src/utils/tools.js

@@ -1186,14 +1186,21 @@ function getCalendarDate(info) {
 function downloadExportedData(data, fileName) {
     // var blob = new Blob([data], {type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'}); //type表示xlsx类型
     var blob = new Blob([data], {type: 'application/vnd.ms-excel'}); //type表示xlsx类型
-    var downloadElement = document.createElement('a');
-    var href = window.URL.createObjectURL(blob); //创建下载的链接
-    downloadElement.href = href;
-    downloadElement.download = fileName; //下载后文件名
-    document.body.appendChild(downloadElement);
-    downloadElement.click(); //点击下载
-    document.body.removeChild(downloadElement); //下载完成移除元素
-    window.URL.revokeObjectURL(href);
+    var href = window.URL.createObjectURL(blob);//创建下载的链接
+    // 为兼容FF26 (不支持a标签的模拟点击事件)
+     if (navigator.userAgent.indexOf("Firefox") > -1){
+        //window.open(requestUrl);
+        window.location.href = href;
+     }else {
+        var downloadElement = document.createElement('a');
+        downloadElement.href = href;
+        downloadElement.download = fileName; //下载后文件名
+        document.body.appendChild(downloadElement);
+        downloadElement.click(); //点击下载
+        document.body.removeChild(downloadElement); //下载完成移除元素
+        window.URL.revokeObjectURL(href);
+     }
+    
 }
 
 function getStatusImg(type,val,status){