easy3wui 1.5.14 → 1.5.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -125,9 +125,8 @@ var Easy3wDownLoad = function (_Component) {
125
125
  _this.setState({ imageViewURL: '' });
126
126
  };
127
127
 
128
- _this.onPreview = function (file) {
128
+ _this.onPreview = function (file, url) {
129
129
  var uid = file.uid,
130
- url = file.url,
131
130
  name = file.name;
132
131
 
133
132
  var fileNameArr = name.toLowerCase().split('.');
@@ -136,17 +135,34 @@ var Easy3wDownLoad = function (_Component) {
136
135
  var src = _this.urlDeal(previewFileUrl, uid);
137
136
  window.open(src, '_blank');
138
137
  } else {
139
- window.open(url);
138
+ // window.open(url);
139
+ var _a = document.createElement('a');
140
+ _a.setAttribute('href', url);
141
+ _a.setAttribute('target', '_blank');
142
+ _a.setAttribute('id', 'downReportFile');
143
+ document.body.appendChild(_a);
144
+ if (!document.getElementById('downReportFile')) {
145
+ document.body.appendChild(_a);
146
+ }
147
+ _a.click();
140
148
  }
141
149
  };
142
150
 
143
- _this.touchDownload = function (file) {
151
+ _this.touchDownload = function (file, url) {
144
152
  var uid = file.uid,
145
- url = file.url,
146
153
  name = file.name;
147
154
  // const src = this.urlDeal(previewFileUrl, uid);
148
-
149
- window.open(url);
155
+ // window.open(url);
156
+
157
+ var a = document.createElement('a');
158
+ a.setAttribute('href', url);
159
+ a.setAttribute('target', '_blank');
160
+ a.setAttribute('id', 'downReportFile');
161
+ document.body.appendChild(a);
162
+ if (!document.getElementById('downReportFile')) {
163
+ document.body.appendChild(a);
164
+ }
165
+ a.click();
150
166
  };
151
167
 
152
168
  _this.state = {
@@ -196,13 +212,13 @@ var Easy3wDownLoad = function (_Component) {
196
212
  _react2['default'].createElement(
197
213
  'a',
198
214
  { onClick: function onClick() {
199
- return _this2.onPreview(obj);
215
+ return _this2.onPreview(obj, url);
200
216
  }, style: { overflow: 'hidden', whiteSpace: 'nowrap', textOverflow: 'ellipsis' } },
201
217
  name
202
218
  )
203
219
  ),
204
220
  _react2['default'].createElement(_icon2['default'], { type: 'download', onClick: function onClick() {
205
- return _this2.touchDownload(obj);
221
+ return _this2.touchDownload(obj, url);
206
222
  }, style: { float: 'right', lineHeight: '100%' } })
207
223
  );
208
224
  } else if (previwPdfFlag && fileType.indexOf('pdf') >= 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easy3wui",
3
- "version": "1.5.14",
3
+ "version": "1.5.15",
4
4
  "description": "easy3wui components for react",
5
5
  "keywords": [
6
6
  "react",