@fonixtree/magic-design 0.2.10 → 0.2.12
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.
|
@@ -128,6 +128,20 @@ function (_super) {
|
|
|
128
128
|
}
|
|
129
129
|
};
|
|
130
130
|
|
|
131
|
+
CountDown.prototype.componentDidMount = function () {
|
|
132
|
+
var _this = this;
|
|
133
|
+
|
|
134
|
+
this.setState({
|
|
135
|
+
nowTime: this.props.now
|
|
136
|
+
}, function () {
|
|
137
|
+
_this.clearTimer();
|
|
138
|
+
|
|
139
|
+
_this.calcLastTime();
|
|
140
|
+
|
|
141
|
+
_this.timer = setInterval(_this.calcLastTime, 1000);
|
|
142
|
+
});
|
|
143
|
+
};
|
|
144
|
+
|
|
131
145
|
CountDown.prototype.render = function () {
|
|
132
146
|
var _a = this.state,
|
|
133
147
|
hour = _a.hour,
|
package/es/utils/commonUtil.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.addZero = exports.addUrlQuery = void 0;
|
|
7
7
|
exports.asyncDataURLtoImage = asyncDataURLtoImage;
|
|
8
|
-
exports.checkFileName = exports.calcLastTime = exports.asyncNextTick = void 0;
|
|
8
|
+
exports.checkLogin = exports.checkFileName = exports.calcLastTime = exports.asyncNextTick = void 0;
|
|
9
9
|
exports.commonFetch = commonFetch;
|
|
10
10
|
exports.convertCount = exports.compatibleNewPageData = void 0;
|
|
11
11
|
exports.convertImageUrl = convertImageUrl;
|
|
@@ -16,7 +16,11 @@ exports.dragSource = exports.downloadBase64Image = void 0;
|
|
|
16
16
|
exports.ensure = ensure;
|
|
17
17
|
exports.getGAData = exports.getColorRgba = void 0;
|
|
18
18
|
exports.getPageDataMap = getPageDataMap;
|
|
19
|
-
exports.
|
|
19
|
+
exports.getUrlParams = void 0;
|
|
20
|
+
exports.goLogin = goLogin;
|
|
21
|
+
exports.importAsync = void 0;
|
|
22
|
+
exports.isLogin = isLogin;
|
|
23
|
+
exports.onListenTouch = exports.nextTick = exports.navigateTo = void 0;
|
|
20
24
|
exports.pushGA = pushGA;
|
|
21
25
|
exports.pxToRem = void 0;
|
|
22
26
|
exports.shareFacebook = shareFacebook;
|
|
@@ -33,6 +37,8 @@ var _uuid = require("uuid");
|
|
|
33
37
|
|
|
34
38
|
var _qs = _interopRequireDefault(require("qs"));
|
|
35
39
|
|
|
40
|
+
var _androidUtil = require("./androidUtil");
|
|
41
|
+
|
|
36
42
|
var _constants = require("../constants");
|
|
37
43
|
|
|
38
44
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
@@ -295,15 +301,75 @@ var navigateTo = function navigateTo(url) {
|
|
|
295
301
|
if (window.magicDesign.history && !window.magicDesign.navigatePreUrl) {
|
|
296
302
|
window.magicDesign.history.push(url);
|
|
297
303
|
} else {
|
|
298
|
-
window.location.href = "" + window.magicDesign.navigatePreUrl + url;
|
|
304
|
+
window.location.href = "" + (window.magicDesign.navigatePreUrl || '') + url;
|
|
299
305
|
}
|
|
300
306
|
} else {
|
|
301
307
|
window.location.href = url;
|
|
302
308
|
}
|
|
303
309
|
};
|
|
310
|
+
/** 判断是否登录状态 */
|
|
311
|
+
|
|
304
312
|
|
|
305
313
|
exports.navigateTo = navigateTo;
|
|
306
314
|
|
|
315
|
+
function isLogin() {
|
|
316
|
+
return localStorage.getItem('isLogin') === 'Y';
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* 跳转登陆页面
|
|
320
|
+
* SF打开的页面,需要跳转到手机验证码登陆页面
|
|
321
|
+
* @param {*} state
|
|
322
|
+
*/
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
function goLogin(state) {
|
|
326
|
+
if (state === void 0) {
|
|
327
|
+
state = {};
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
navigateTo('/password-sign-in', state);
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* 检查是否登录 未登录返回登录页
|
|
334
|
+
* @param {boolean?} isLead 是否引导登录
|
|
335
|
+
* @returns boolean
|
|
336
|
+
*/
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
var checkLogin = function checkLogin(isLead, redirectUrl) {
|
|
340
|
+
if (isLead === void 0) {
|
|
341
|
+
isLead = true;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
if (!isLogin()) {
|
|
345
|
+
if (isLead) {
|
|
346
|
+
if ((0, _androidUtil.browserVersion)().isAshitaApp) {
|
|
347
|
+
(0, _androidUtil.sendToApp)({
|
|
348
|
+
action: 'login',
|
|
349
|
+
params: {}
|
|
350
|
+
});
|
|
351
|
+
} else {
|
|
352
|
+
var _a = window.location,
|
|
353
|
+
pathname = _a.pathname,
|
|
354
|
+
search = _a.search,
|
|
355
|
+
hash = _a.hash;
|
|
356
|
+
|
|
357
|
+
var _redirectUrl = pathname + search + hash;
|
|
358
|
+
|
|
359
|
+
goLogin({
|
|
360
|
+
redirectUrl: redirectUrl || _redirectUrl
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
return false;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
return true;
|
|
369
|
+
};
|
|
370
|
+
|
|
371
|
+
exports.checkLogin = checkLogin;
|
|
372
|
+
|
|
307
373
|
var addUrlQuery = function addUrlQuery(url, queryObj) {
|
|
308
374
|
if (/\?/.test(url)) {
|
|
309
375
|
return url + '&' + _qs["default"].stringify(queryObj);
|
package/es/utils/coreUtil.js
CHANGED
|
@@ -312,8 +312,10 @@ var clickUrl = function clickUrl(url) {
|
|
|
312
312
|
}); // 领取优惠券
|
|
313
313
|
|
|
314
314
|
if (params.type === 'GET_COUPON') {
|
|
315
|
-
|
|
316
|
-
|
|
315
|
+
if ((0, _commonUtil.checkLogin)(true)) {
|
|
316
|
+
getCoupon(params.couponId);
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
317
319
|
}
|
|
318
320
|
|
|
319
321
|
if ((0, _androidUtil.browserVersion)().isAshitaApp) {
|
|
@@ -128,6 +128,20 @@ function (_super) {
|
|
|
128
128
|
}
|
|
129
129
|
};
|
|
130
130
|
|
|
131
|
+
CountDown.prototype.componentDidMount = function () {
|
|
132
|
+
var _this = this;
|
|
133
|
+
|
|
134
|
+
this.setState({
|
|
135
|
+
nowTime: this.props.now
|
|
136
|
+
}, function () {
|
|
137
|
+
_this.clearTimer();
|
|
138
|
+
|
|
139
|
+
_this.calcLastTime();
|
|
140
|
+
|
|
141
|
+
_this.timer = setInterval(_this.calcLastTime, 1000);
|
|
142
|
+
});
|
|
143
|
+
};
|
|
144
|
+
|
|
131
145
|
CountDown.prototype.render = function () {
|
|
132
146
|
var _a = this.state,
|
|
133
147
|
hour = _a.hour,
|
package/lib/utils/commonUtil.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.addZero = exports.addUrlQuery = void 0;
|
|
7
7
|
exports.asyncDataURLtoImage = asyncDataURLtoImage;
|
|
8
|
-
exports.checkFileName = exports.calcLastTime = exports.asyncNextTick = void 0;
|
|
8
|
+
exports.checkLogin = exports.checkFileName = exports.calcLastTime = exports.asyncNextTick = void 0;
|
|
9
9
|
exports.commonFetch = commonFetch;
|
|
10
10
|
exports.convertCount = exports.compatibleNewPageData = void 0;
|
|
11
11
|
exports.convertImageUrl = convertImageUrl;
|
|
@@ -16,7 +16,11 @@ exports.dragSource = exports.downloadBase64Image = void 0;
|
|
|
16
16
|
exports.ensure = ensure;
|
|
17
17
|
exports.getGAData = exports.getColorRgba = void 0;
|
|
18
18
|
exports.getPageDataMap = getPageDataMap;
|
|
19
|
-
exports.
|
|
19
|
+
exports.getUrlParams = void 0;
|
|
20
|
+
exports.goLogin = goLogin;
|
|
21
|
+
exports.importAsync = void 0;
|
|
22
|
+
exports.isLogin = isLogin;
|
|
23
|
+
exports.onListenTouch = exports.nextTick = exports.navigateTo = void 0;
|
|
20
24
|
exports.pushGA = pushGA;
|
|
21
25
|
exports.pxToRem = void 0;
|
|
22
26
|
exports.shareFacebook = shareFacebook;
|
|
@@ -33,6 +37,8 @@ var _uuid = require("uuid");
|
|
|
33
37
|
|
|
34
38
|
var _qs = _interopRequireDefault(require("qs"));
|
|
35
39
|
|
|
40
|
+
var _androidUtil = require("./androidUtil");
|
|
41
|
+
|
|
36
42
|
var _constants = require("../constants");
|
|
37
43
|
|
|
38
44
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
@@ -295,15 +301,75 @@ var navigateTo = function navigateTo(url) {
|
|
|
295
301
|
if (window.magicDesign.history && !window.magicDesign.navigatePreUrl) {
|
|
296
302
|
window.magicDesign.history.push(url);
|
|
297
303
|
} else {
|
|
298
|
-
window.location.href = "" + window.magicDesign.navigatePreUrl + url;
|
|
304
|
+
window.location.href = "" + (window.magicDesign.navigatePreUrl || '') + url;
|
|
299
305
|
}
|
|
300
306
|
} else {
|
|
301
307
|
window.location.href = url;
|
|
302
308
|
}
|
|
303
309
|
};
|
|
310
|
+
/** 判断是否登录状态 */
|
|
311
|
+
|
|
304
312
|
|
|
305
313
|
exports.navigateTo = navigateTo;
|
|
306
314
|
|
|
315
|
+
function isLogin() {
|
|
316
|
+
return localStorage.getItem('isLogin') === 'Y';
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* 跳转登陆页面
|
|
320
|
+
* SF打开的页面,需要跳转到手机验证码登陆页面
|
|
321
|
+
* @param {*} state
|
|
322
|
+
*/
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
function goLogin(state) {
|
|
326
|
+
if (state === void 0) {
|
|
327
|
+
state = {};
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
navigateTo('/password-sign-in', state);
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* 检查是否登录 未登录返回登录页
|
|
334
|
+
* @param {boolean?} isLead 是否引导登录
|
|
335
|
+
* @returns boolean
|
|
336
|
+
*/
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
var checkLogin = function checkLogin(isLead, redirectUrl) {
|
|
340
|
+
if (isLead === void 0) {
|
|
341
|
+
isLead = true;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
if (!isLogin()) {
|
|
345
|
+
if (isLead) {
|
|
346
|
+
if ((0, _androidUtil.browserVersion)().isAshitaApp) {
|
|
347
|
+
(0, _androidUtil.sendToApp)({
|
|
348
|
+
action: 'login',
|
|
349
|
+
params: {}
|
|
350
|
+
});
|
|
351
|
+
} else {
|
|
352
|
+
var _a = window.location,
|
|
353
|
+
pathname = _a.pathname,
|
|
354
|
+
search = _a.search,
|
|
355
|
+
hash = _a.hash;
|
|
356
|
+
|
|
357
|
+
var _redirectUrl = pathname + search + hash;
|
|
358
|
+
|
|
359
|
+
goLogin({
|
|
360
|
+
redirectUrl: redirectUrl || _redirectUrl
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
return false;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
return true;
|
|
369
|
+
};
|
|
370
|
+
|
|
371
|
+
exports.checkLogin = checkLogin;
|
|
372
|
+
|
|
307
373
|
var addUrlQuery = function addUrlQuery(url, queryObj) {
|
|
308
374
|
if (/\?/.test(url)) {
|
|
309
375
|
return url + '&' + _qs["default"].stringify(queryObj);
|
package/lib/utils/coreUtil.js
CHANGED
|
@@ -312,8 +312,10 @@ var clickUrl = function clickUrl(url) {
|
|
|
312
312
|
}); // 领取优惠券
|
|
313
313
|
|
|
314
314
|
if (params.type === 'GET_COUPON') {
|
|
315
|
-
|
|
316
|
-
|
|
315
|
+
if ((0, _commonUtil.checkLogin)(true)) {
|
|
316
|
+
getCoupon(params.couponId);
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
317
319
|
}
|
|
318
320
|
|
|
319
321
|
if ((0, _androidUtil.browserVersion)().isAshitaApp) {
|