@fonixtree/magic-design 1.0.97 → 1.0.99
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.
- package/es/utils/coreUtil.js +48 -17
- package/lib/utils/coreUtil.js +48 -17
- package/package.json +1 -1
package/es/utils/coreUtil.js
CHANGED
|
@@ -286,35 +286,45 @@ var getCoupon = function getCoupon(couponId) {
|
|
|
286
286
|
});
|
|
287
287
|
};
|
|
288
288
|
|
|
289
|
-
var clickUrl = function clickUrl(url) {
|
|
289
|
+
var clickUrl = function clickUrl(url, state) {
|
|
290
|
+
var _a;
|
|
291
|
+
|
|
290
292
|
if (url === void 0) {
|
|
291
293
|
url = '';
|
|
292
294
|
}
|
|
293
295
|
|
|
294
|
-
console.log('clickUrl...', url); // 只读模式,设计模式,url为空,邮箱模版
|
|
296
|
+
console.log('clickUrl...', url, state); // 只读模式,设计模式,url为空,邮箱模版
|
|
295
297
|
|
|
296
298
|
if (window.magicDesign.readOnly || window.magicDesign.mode !== 'renderer' || !url || window.magicDesign.outputType == 'html') {
|
|
297
299
|
return;
|
|
298
300
|
}
|
|
299
301
|
|
|
300
|
-
var
|
|
301
|
-
link =
|
|
302
|
-
data =
|
|
302
|
+
var _b = _typeof(url) === 'object' ? (0, _businessUtil.newParseUrl)(url) : (0, _businessUtil.parseUrl)(url),
|
|
303
|
+
link = _b.link,
|
|
304
|
+
data = _b.data;
|
|
303
305
|
|
|
304
|
-
var
|
|
305
|
-
params =
|
|
306
|
+
var _c = data.params,
|
|
307
|
+
params = _c === void 0 ? {} : _c; // console.log('clicked data:', data);
|
|
306
308
|
// console.log({ type: 'jumpBrowser', params: { url: params.link } });
|
|
307
309
|
|
|
310
|
+
/** 锚点跳转 */
|
|
311
|
+
|
|
312
|
+
if (params.type === 'ANCHOR') {
|
|
313
|
+
ensure(function () {
|
|
314
|
+
var nodeId = isPc() ? params.data.pcNodeId : params.data.mobileNodeId;
|
|
315
|
+
document.querySelector("#node-" + nodeId).scrollIntoView({
|
|
316
|
+
behavior: 'smooth'
|
|
317
|
+
});
|
|
318
|
+
});
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
|
|
308
322
|
if ((0, _androidUtil.browserVersion)().isAshitaApp) {
|
|
309
323
|
(0, _androidUtil.sendToApp)(data);
|
|
310
|
-
} else if ((0, _androidUtil.browserVersion)().
|
|
311
|
-
//
|
|
312
|
-
(
|
|
313
|
-
|
|
314
|
-
params: {
|
|
315
|
-
url: params.link
|
|
316
|
-
}
|
|
317
|
-
});
|
|
324
|
+
} else if ((0, _androidUtil.browserVersion)().isDitoApp && params.link && params.link.startsWith('http')) {
|
|
325
|
+
// pto 抽奖系统对接
|
|
326
|
+
var urlTemp = "" + params.link + (params.link.includes('?') ? '&' : '?') + "token=" + (localStorage.getItem('h5Token') || '');
|
|
327
|
+
window.location.href = urlTemp;
|
|
318
328
|
} else {
|
|
319
329
|
// 视频
|
|
320
330
|
if (params.type === 'VIDEO') {
|
|
@@ -336,9 +346,30 @@ var clickUrl = function clickUrl(url) {
|
|
|
336
346
|
}
|
|
337
347
|
|
|
338
348
|
return;
|
|
349
|
+
} // 判断是否是pto, pto跳外链需要带token
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
if (((_a = window === null || window === void 0 ? void 0 : window.magicDesign) === null || _a === void 0 ? void 0 : _a.projectCode) === 'pto') {
|
|
353
|
+
// 输入的是完整的跳转地址
|
|
354
|
+
if (isUrl(link)) {
|
|
355
|
+
if (!link.includes(window.location.host)) {
|
|
356
|
+
// 跳转外链 需要把token带上
|
|
357
|
+
if (link.includes('?')) {
|
|
358
|
+
var a = link + "&token=" + (localStorage.getItem('h5Token') || '');
|
|
359
|
+
window.location.href = a;
|
|
360
|
+
} else {
|
|
361
|
+
var a = link + "?token=" + (localStorage.getItem('h5Token') || '');
|
|
362
|
+
window.location.href = a;
|
|
363
|
+
}
|
|
364
|
+
} else {
|
|
365
|
+
window.open(link);
|
|
366
|
+
}
|
|
367
|
+
} else {
|
|
368
|
+
(0, _commonUtil.navigateTo)(link, state);
|
|
369
|
+
}
|
|
370
|
+
} else {
|
|
371
|
+
(0, _commonUtil.navigateTo)(link, state);
|
|
339
372
|
}
|
|
340
|
-
|
|
341
|
-
(0, _commonUtil.navigateTo)(link);
|
|
342
373
|
}
|
|
343
374
|
};
|
|
344
375
|
|
package/lib/utils/coreUtil.js
CHANGED
|
@@ -286,35 +286,45 @@ var getCoupon = function getCoupon(couponId) {
|
|
|
286
286
|
});
|
|
287
287
|
};
|
|
288
288
|
|
|
289
|
-
var clickUrl = function clickUrl(url) {
|
|
289
|
+
var clickUrl = function clickUrl(url, state) {
|
|
290
|
+
var _a;
|
|
291
|
+
|
|
290
292
|
if (url === void 0) {
|
|
291
293
|
url = '';
|
|
292
294
|
}
|
|
293
295
|
|
|
294
|
-
console.log('clickUrl...', url); // 只读模式,设计模式,url为空,邮箱模版
|
|
296
|
+
console.log('clickUrl...', url, state); // 只读模式,设计模式,url为空,邮箱模版
|
|
295
297
|
|
|
296
298
|
if (window.magicDesign.readOnly || window.magicDesign.mode !== 'renderer' || !url || window.magicDesign.outputType == 'html') {
|
|
297
299
|
return;
|
|
298
300
|
}
|
|
299
301
|
|
|
300
|
-
var
|
|
301
|
-
link =
|
|
302
|
-
data =
|
|
302
|
+
var _b = _typeof(url) === 'object' ? (0, _businessUtil.newParseUrl)(url) : (0, _businessUtil.parseUrl)(url),
|
|
303
|
+
link = _b.link,
|
|
304
|
+
data = _b.data;
|
|
303
305
|
|
|
304
|
-
var
|
|
305
|
-
params =
|
|
306
|
+
var _c = data.params,
|
|
307
|
+
params = _c === void 0 ? {} : _c; // console.log('clicked data:', data);
|
|
306
308
|
// console.log({ type: 'jumpBrowser', params: { url: params.link } });
|
|
307
309
|
|
|
310
|
+
/** 锚点跳转 */
|
|
311
|
+
|
|
312
|
+
if (params.type === 'ANCHOR') {
|
|
313
|
+
ensure(function () {
|
|
314
|
+
var nodeId = isPc() ? params.data.pcNodeId : params.data.mobileNodeId;
|
|
315
|
+
document.querySelector("#node-" + nodeId).scrollIntoView({
|
|
316
|
+
behavior: 'smooth'
|
|
317
|
+
});
|
|
318
|
+
});
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
|
|
308
322
|
if ((0, _androidUtil.browserVersion)().isAshitaApp) {
|
|
309
323
|
(0, _androidUtil.sendToApp)(data);
|
|
310
|
-
} else if ((0, _androidUtil.browserVersion)().
|
|
311
|
-
//
|
|
312
|
-
(
|
|
313
|
-
|
|
314
|
-
params: {
|
|
315
|
-
url: params.link
|
|
316
|
-
}
|
|
317
|
-
});
|
|
324
|
+
} else if ((0, _androidUtil.browserVersion)().isDitoApp && params.link && params.link.startsWith('http')) {
|
|
325
|
+
// pto 抽奖系统对接
|
|
326
|
+
var urlTemp = "" + params.link + (params.link.includes('?') ? '&' : '?') + "token=" + (localStorage.getItem('h5Token') || '');
|
|
327
|
+
window.location.href = urlTemp;
|
|
318
328
|
} else {
|
|
319
329
|
// 视频
|
|
320
330
|
if (params.type === 'VIDEO') {
|
|
@@ -336,9 +346,30 @@ var clickUrl = function clickUrl(url) {
|
|
|
336
346
|
}
|
|
337
347
|
|
|
338
348
|
return;
|
|
349
|
+
} // 判断是否是pto, pto跳外链需要带token
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
if (((_a = window === null || window === void 0 ? void 0 : window.magicDesign) === null || _a === void 0 ? void 0 : _a.projectCode) === 'pto') {
|
|
353
|
+
// 输入的是完整的跳转地址
|
|
354
|
+
if (isUrl(link)) {
|
|
355
|
+
if (!link.includes(window.location.host)) {
|
|
356
|
+
// 跳转外链 需要把token带上
|
|
357
|
+
if (link.includes('?')) {
|
|
358
|
+
var a = link + "&token=" + (localStorage.getItem('h5Token') || '');
|
|
359
|
+
window.location.href = a;
|
|
360
|
+
} else {
|
|
361
|
+
var a = link + "?token=" + (localStorage.getItem('h5Token') || '');
|
|
362
|
+
window.location.href = a;
|
|
363
|
+
}
|
|
364
|
+
} else {
|
|
365
|
+
window.open(link);
|
|
366
|
+
}
|
|
367
|
+
} else {
|
|
368
|
+
(0, _commonUtil.navigateTo)(link, state);
|
|
369
|
+
}
|
|
370
|
+
} else {
|
|
371
|
+
(0, _commonUtil.navigateTo)(link, state);
|
|
339
372
|
}
|
|
340
|
-
|
|
341
|
-
(0, _commonUtil.navigateTo)(link);
|
|
342
373
|
}
|
|
343
374
|
};
|
|
344
375
|
|