@titaui/pc 1.12.31 → 1.12.32
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.
|
@@ -27,7 +27,7 @@ var _selectLayer = _interopRequireDefault(require("../../select-layer"));
|
|
|
27
27
|
|
|
28
28
|
var _utils = require("../utils");
|
|
29
29
|
|
|
30
|
-
var
|
|
30
|
+
var _context3 = require("../context");
|
|
31
31
|
|
|
32
32
|
var _bsGlobal = require("../../../utils/bs-global");
|
|
33
33
|
|
|
@@ -140,11 +140,11 @@ var ExportMapModal = function ExportMapModal(props) {
|
|
|
140
140
|
}, [visible, mapInstance]);
|
|
141
141
|
|
|
142
142
|
var downloadImg = /*#__PURE__*/function () {
|
|
143
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
143
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
|
144
144
|
var okrMapRef, width, height, canvas, scale, opts;
|
|
145
|
-
return regeneratorRuntime.wrap(function
|
|
145
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
146
146
|
while (1) {
|
|
147
|
-
switch (
|
|
147
|
+
switch (_context2.prev = _context2.next) {
|
|
148
148
|
case 0:
|
|
149
149
|
okrMapRef = document.querySelector('.titaui-okr-flow__export') || document.createElement('div');
|
|
150
150
|
width = okrMapRef.clientWidth; // 获取dom 宽度
|
|
@@ -176,7 +176,7 @@ var ExportMapModal = function ExportMapModal(props) {
|
|
|
176
176
|
useCORS: true // 【重要】开启跨域配置
|
|
177
177
|
|
|
178
178
|
};
|
|
179
|
-
|
|
179
|
+
_context2.next = 12;
|
|
180
180
|
return (0, _html2canvas["default"])(okrMapRef, opts).then(function (result) {
|
|
181
181
|
var _window, _window$BSGlobal, _window$BSGlobal$logi, _window2, _window2$BSGlobal, _window2$BSGlobal$ten;
|
|
182
182
|
|
|
@@ -240,7 +240,13 @@ var ExportMapModal = function ExportMapModal(props) {
|
|
|
240
240
|
scope.setExtra('userMessage', userId + '租户:' + telentId + '我得到了图片大小为:' + size + ',路径为' + imgUrl);
|
|
241
241
|
});
|
|
242
242
|
(0, _requestApis.getBase64DownloadUrl)(imgUrl.split(',')[1]).then(function (url) {
|
|
243
|
-
|
|
243
|
+
var image = new Image(); // @ts-ignore
|
|
244
|
+
// window.titaTracker && window.titaTracker("action").record({
|
|
245
|
+
// actionName: userId+'租户:'+telentId+'我获得了地址'+url.Data.obj,
|
|
246
|
+
// actionGroup: 'okr地图接口',
|
|
247
|
+
// productName: 'okr地图导出',
|
|
248
|
+
// });
|
|
249
|
+
|
|
244
250
|
// @ts-ignore
|
|
245
251
|
// window.titaTracker && window.titaTracker("action").record({
|
|
246
252
|
// actionName: userId+'租户:'+telentId+'我获得了地址'+url.Data.obj,
|
|
@@ -251,46 +257,87 @@ var ExportMapModal = function ExportMapModal(props) {
|
|
|
251
257
|
scope.setTag('error-level', "P0");
|
|
252
258
|
scope.setTag('error-type', '地图导出-图片地址');
|
|
253
259
|
scope.setExtra('userMessage', userId + '租户:' + telentId + '我得到了图片大小为:' + size + ',路径为' + imgUrl);
|
|
254
|
-
});
|
|
255
|
-
var
|
|
256
|
-
|
|
257
|
-
x.
|
|
258
|
-
x.
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
x.
|
|
277
|
-
//
|
|
278
|
-
//
|
|
279
|
-
//
|
|
280
|
-
//
|
|
281
|
-
//
|
|
282
|
-
//
|
|
283
|
-
//
|
|
284
|
-
//
|
|
285
|
-
//
|
|
286
|
-
//
|
|
287
|
-
// Toast.Success('导出成功')
|
|
288
|
-
// setIsExport(false)
|
|
289
|
-
// if (onCloseHandler) {
|
|
290
|
-
// onCloseHandler()
|
|
291
|
-
// }
|
|
260
|
+
}); // var newUrl = url.Data.obj
|
|
261
|
+
// var x = new XMLHttpRequest();
|
|
262
|
+
// x.open("GET", newUrl, true);
|
|
263
|
+
// x.responseType = 'blob';
|
|
264
|
+
// x.onload=function(e) {
|
|
265
|
+
// var url = window.URL.createObjectURL(x.response)
|
|
266
|
+
// var a = document.createElement('a');
|
|
267
|
+
// a.href = url
|
|
268
|
+
// a.download = model.value===20?'高清图片':'标清图片';
|
|
269
|
+
// a.click()
|
|
270
|
+
// Toast.Success('导出成功')
|
|
271
|
+
// setIsExport(false)
|
|
272
|
+
// if (onCloseHandler) {
|
|
273
|
+
// onCloseHandler()
|
|
274
|
+
// }
|
|
275
|
+
// }
|
|
276
|
+
// x.send();
|
|
277
|
+
|
|
278
|
+
// var newUrl = url.Data.obj
|
|
279
|
+
// var x = new XMLHttpRequest();
|
|
280
|
+
// x.open("GET", newUrl, true);
|
|
281
|
+
// x.responseType = 'blob';
|
|
282
|
+
// x.onload=function(e) {
|
|
283
|
+
// var url = window.URL.createObjectURL(x.response)
|
|
284
|
+
// var a = document.createElement('a');
|
|
285
|
+
// a.href = url
|
|
286
|
+
// a.download = model.value===20?'高清图片':'标清图片';
|
|
287
|
+
// a.click()
|
|
288
|
+
// Toast.Success('导出成功')
|
|
289
|
+
// setIsExport(false)
|
|
290
|
+
// if (onCloseHandler) {
|
|
291
|
+
// onCloseHandler()
|
|
292
|
+
// }
|
|
292
293
|
// }
|
|
293
|
-
//
|
|
294
|
+
// x.send();
|
|
295
|
+
image.setAttribute('crossOrigin', 'anonymous');
|
|
296
|
+
image.onload = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
297
|
+
var a, event;
|
|
298
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
299
|
+
while (1) {
|
|
300
|
+
switch (_context.prev = _context.next) {
|
|
301
|
+
case 0:
|
|
302
|
+
if (!url.Data.obj) {
|
|
303
|
+
_toast["default"].Error('导出失败,请稍后重试', {
|
|
304
|
+
canClose: false
|
|
305
|
+
});
|
|
306
|
+
} // await downloadFile(url.Data.obj,model.value===20?'高清分享图片':'标准分享图片')
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
// await downloadFile(url.Data.obj,model.value===20?'高清分享图片':'标准分享图片')
|
|
310
|
+
a = document.createElement('a'); // 生成一个a元素
|
|
311
|
+
|
|
312
|
+
// 生成一个a元素
|
|
313
|
+
event = new MouseEvent('click'); // 创建一个单击事件
|
|
314
|
+
|
|
315
|
+
// 创建一个单击事件
|
|
316
|
+
a.download = '分享图片'; // 设置图片名称
|
|
317
|
+
|
|
318
|
+
// 设置图片名称
|
|
319
|
+
a.href = url.Data.obj; // 将生成的URL设置为a
|
|
320
|
+
|
|
321
|
+
// 将生成的URL设置为a
|
|
322
|
+
a.dispatchEvent(event); // 触发a的单击事件
|
|
323
|
+
|
|
324
|
+
// 触发a的单击事件
|
|
325
|
+
_toast["default"].Success('导出成功');
|
|
326
|
+
|
|
327
|
+
setIsExport(false);
|
|
328
|
+
|
|
329
|
+
if (onCloseHandler) {
|
|
330
|
+
onCloseHandler();
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
case 9:
|
|
334
|
+
case "end":
|
|
335
|
+
return _context.stop();
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}, _callee);
|
|
339
|
+
}));
|
|
340
|
+
image.src = imgUrl;
|
|
294
341
|
});
|
|
295
342
|
})["catch"](function (err) {
|
|
296
343
|
setIsExport(false);
|
|
@@ -302,10 +349,10 @@ var ExportMapModal = function ExportMapModal(props) {
|
|
|
302
349
|
|
|
303
350
|
case 12:
|
|
304
351
|
case "end":
|
|
305
|
-
return
|
|
352
|
+
return _context2.stop();
|
|
306
353
|
}
|
|
307
354
|
}
|
|
308
|
-
},
|
|
355
|
+
}, _callee2);
|
|
309
356
|
}));
|
|
310
357
|
|
|
311
358
|
return function downloadImg() {
|
|
@@ -398,7 +445,7 @@ var ExportMapModal = function ExportMapModal(props) {
|
|
|
398
445
|
className: "titaui-search-dropdown__text"
|
|
399
446
|
}, model.label), /*#__PURE__*/_react["default"].createElement("span", {
|
|
400
447
|
className: "tu-icon-sort-down"
|
|
401
|
-
})))), /*#__PURE__*/_react["default"].createElement("div", null, visible && /*#__PURE__*/_react["default"].createElement(
|
|
448
|
+
})))), /*#__PURE__*/_react["default"].createElement("div", null, visible && /*#__PURE__*/_react["default"].createElement(_context3.CommonContext.Provider, {
|
|
402
449
|
value: {
|
|
403
450
|
direction: direction,
|
|
404
451
|
showkr: showkr,
|