@fonixtree/magic-design 1.0.99 → 1.0.100

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.
@@ -44,7 +44,8 @@ var __assign = void 0 && (void 0).__assign || function () {
44
44
  var setDesignConfig = function setDesignConfig(props) {
45
45
  var config = props.config,
46
46
  device = props.device,
47
- isPreview = props.isPreview;
47
+ isPreview = props.isPreview,
48
+ projectCode = props.projectCode;
48
49
  window.magicDesign = __assign(__assign({
49
50
  pageBackground: '#f2f2f2',
50
51
  mode: 'renderer',
@@ -52,6 +53,7 @@ var setDesignConfig = function setDesignConfig(props) {
52
53
  designMode: isPreview,
53
54
  navigatePreUrl: ''
54
55
  }, config), {
56
+ projectCode: projectCode,
55
57
  compSpacing: Number(config.compSpacing),
56
58
  compWidth: Number(config.compWidth)
57
59
  });
@@ -286,6 +286,22 @@ var getCoupon = function getCoupon(couponId) {
286
286
  });
287
287
  };
288
288
 
289
+ function isUrl(string) {
290
+ // var pattern = new RegExp('^(https?:\\/\\/)?' + // 协议
291
+ // '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' + // 域名
292
+ // '((\\d{1,3}\\.){3}\\d{1,3}))' + // 或者 IP (v4) 地址
293
+ // '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' + // 端口和路径
294
+ // '(\\?[;&a-z\\d%_.~+=-]*)?' + // 查询字符串
295
+ // '(\\#[-a-z\\d_]*)?$', 'i'); // fragment locator
296
+ // return !!pattern.test(string);
297
+ try {
298
+ new URL(string);
299
+ return true;
300
+ } catch (_) {
301
+ return false;
302
+ }
303
+ }
304
+
289
305
  var clickUrl = function clickUrl(url, state) {
290
306
  var _a;
291
307
 
@@ -356,9 +372,11 @@ var clickUrl = function clickUrl(url, state) {
356
372
  // 跳转外链 需要把token带上
357
373
  if (link.includes('?')) {
358
374
  var a = link + "&token=" + (localStorage.getItem('h5Token') || '');
375
+ console.log('wai lian: ', a);
359
376
  window.location.href = a;
360
377
  } else {
361
378
  var a = link + "?token=" + (localStorage.getItem('h5Token') || '');
379
+ console.log('wai lian: ', a);
362
380
  window.location.href = a;
363
381
  }
364
382
  } else {
@@ -44,7 +44,8 @@ var __assign = void 0 && (void 0).__assign || function () {
44
44
  var setDesignConfig = function setDesignConfig(props) {
45
45
  var config = props.config,
46
46
  device = props.device,
47
- isPreview = props.isPreview;
47
+ isPreview = props.isPreview,
48
+ projectCode = props.projectCode;
48
49
  window.magicDesign = __assign(__assign({
49
50
  pageBackground: '#f2f2f2',
50
51
  mode: 'renderer',
@@ -52,6 +53,7 @@ var setDesignConfig = function setDesignConfig(props) {
52
53
  designMode: isPreview,
53
54
  navigatePreUrl: ''
54
55
  }, config), {
56
+ projectCode: projectCode,
55
57
  compSpacing: Number(config.compSpacing),
56
58
  compWidth: Number(config.compWidth)
57
59
  });
@@ -286,6 +286,22 @@ var getCoupon = function getCoupon(couponId) {
286
286
  });
287
287
  };
288
288
 
289
+ function isUrl(string) {
290
+ // var pattern = new RegExp('^(https?:\\/\\/)?' + // 协议
291
+ // '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' + // 域名
292
+ // '((\\d{1,3}\\.){3}\\d{1,3}))' + // 或者 IP (v4) 地址
293
+ // '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' + // 端口和路径
294
+ // '(\\?[;&a-z\\d%_.~+=-]*)?' + // 查询字符串
295
+ // '(\\#[-a-z\\d_]*)?$', 'i'); // fragment locator
296
+ // return !!pattern.test(string);
297
+ try {
298
+ new URL(string);
299
+ return true;
300
+ } catch (_) {
301
+ return false;
302
+ }
303
+ }
304
+
289
305
  var clickUrl = function clickUrl(url, state) {
290
306
  var _a;
291
307
 
@@ -356,9 +372,11 @@ var clickUrl = function clickUrl(url, state) {
356
372
  // 跳转外链 需要把token带上
357
373
  if (link.includes('?')) {
358
374
  var a = link + "&token=" + (localStorage.getItem('h5Token') || '');
375
+ console.log('wai lian: ', a);
359
376
  window.location.href = a;
360
377
  } else {
361
378
  var a = link + "?token=" + (localStorage.getItem('h5Token') || '');
379
+ console.log('wai lian: ', a);
362
380
  window.location.href = a;
363
381
  }
364
382
  } else {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fonixtree/magic-design",
3
3
  "author": "Cylon Team",
4
- "version": "1.0.99",
4
+ "version": "1.0.100",
5
5
  "description": "Magic Design",
6
6
  "license": "MIT",
7
7
  "module": "es/index.js",