component-shipinlv 2.3.5 → 2.3.7
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/dist/Auth/index.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
2
2
|
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
3
3
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
4
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
4
5
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
5
6
|
import React, { useState, useEffect, useRef } from 'react';
|
6
7
|
import { WechatOutlined, RedoOutlined, UserOutlined } from '@ant-design/icons';
|
@@ -17,8 +18,8 @@ import QRCode from 'qrcode.react';
|
|
17
18
|
import h5WePublicLogin from "../AuthClient/qr/h5-we-public-login";
|
18
19
|
import Tool from "../lib/Tool";
|
19
20
|
import { jsx as _jsx } from "react/jsx-runtime";
|
20
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
21
21
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
22
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
22
23
|
var reTryMaxCount = 120;
|
23
24
|
var reTryTimeLoop = 1000; // ms
|
24
25
|
var FromWhere = 'web';
|
@@ -41,29 +42,33 @@ var Auth = function Auth(_ref) {
|
|
41
42
|
loading = _useState2[0],
|
42
43
|
setLoading = _useState2[1];
|
43
44
|
var qrWsRef = useRef();
|
44
|
-
var _useState3 = useState((loginTypeList
|
45
|
+
var _useState3 = useState(_toConsumableArray(loginTypeList)),
|
45
46
|
_useState4 = _slicedToArray(_useState3, 2),
|
46
|
-
|
47
|
-
|
48
|
-
var _useState5 = useState(
|
49
|
-
_useState6 = _slicedToArray(_useState5,
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
47
|
+
currentLoginTypeList = _useState4[0],
|
48
|
+
setCurrentLoginTypeList = _useState4[1];
|
49
|
+
var _useState5 = useState((currentLoginTypeList === null || currentLoginTypeList === void 0 ? void 0 : currentLoginTypeList[0]) || 'wechat'),
|
50
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
51
|
+
activeKey = _useState6[0],
|
52
|
+
setActiveKey = _useState6[1];
|
53
|
+
var _useState7 = useState("".concat(Tool.math.randWord(20))),
|
54
|
+
_useState8 = _slicedToArray(_useState7, 1),
|
55
|
+
loginId = _useState8[0];
|
56
|
+
var _useState9 = useState(''),
|
57
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
58
|
+
weQrUrl = _useState10[0],
|
59
|
+
setWeQrUrl = _useState10[1];
|
55
60
|
var isNextTryRef = useRef(activeKey === 'wechat');
|
56
61
|
|
57
62
|
// 要不要继续 try
|
58
|
-
var
|
59
|
-
_useState10 = _slicedToArray(_useState9, 2),
|
60
|
-
isNextTry = _useState10[0],
|
61
|
-
setNextTry = _useState10[1];
|
62
|
-
var reTryCountRef = useRef(0);
|
63
|
-
var _useState11 = useState(0),
|
63
|
+
var _useState11 = useState(isNextTryRef.current),
|
64
64
|
_useState12 = _slicedToArray(_useState11, 2),
|
65
|
-
|
66
|
-
|
65
|
+
isNextTry = _useState12[0],
|
66
|
+
setNextTry = _useState12[1];
|
67
|
+
var reTryCountRef = useRef(0);
|
68
|
+
var _useState13 = useState(0),
|
69
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
70
|
+
reTryCount = _useState14[0],
|
71
|
+
setReTryCount = _useState14[1];
|
67
72
|
var timer = useRef(setTimeout(function () {}, 1));
|
68
73
|
var eventSourceRef = useRef(null);
|
69
74
|
var onLoginCancel = function onLoginCancel() {
|
@@ -238,7 +243,7 @@ var Auth = function Auth(_ref) {
|
|
238
243
|
_context3.next = 10;
|
239
244
|
break;
|
240
245
|
case 7:
|
241
|
-
if (!
|
246
|
+
if (!currentLoginTypeList.includes('wechat')) {
|
242
247
|
_context3.next = 10;
|
243
248
|
break;
|
244
249
|
}
|
@@ -254,28 +259,36 @@ var Auth = function Auth(_ref) {
|
|
254
259
|
return _ref4.apply(this, arguments);
|
255
260
|
};
|
256
261
|
}();
|
262
|
+
var onCallWechat = function onCallWechat() {
|
263
|
+
currentLoginTypeList.push('wechat');
|
264
|
+
setCurrentLoginTypeList(_toConsumableArray(currentLoginTypeList));
|
265
|
+
};
|
266
|
+
var onCallAccount = function onCallAccount() {
|
267
|
+
currentLoginTypeList.push('account', 'account-reg', 'account-login');
|
268
|
+
setCurrentLoginTypeList(_toConsumableArray(currentLoginTypeList));
|
269
|
+
};
|
257
270
|
useEffect(function () {
|
258
271
|
onInit();
|
259
272
|
return function () {
|
260
273
|
clearTimeout(timer.current);
|
261
274
|
};
|
262
275
|
}, []);
|
263
|
-
return /*#__PURE__*/
|
264
|
-
children: /*#__PURE__*/_jsxs(styles.LoginForm, {
|
265
|
-
children: [/*#__PURE__*/
|
266
|
-
children: /*#__PURE__*/_jsx("span", {
|
276
|
+
return /*#__PURE__*/_jsxs(styles.AuthQrLogin, {
|
277
|
+
children: [/*#__PURE__*/_jsxs(styles.LoginForm, {
|
278
|
+
children: [/*#__PURE__*/_jsxs(styles.WebTitle, {
|
279
|
+
children: [/*#__PURE__*/_jsx("span", {
|
267
280
|
children: "\u767B\u5F55/\u6CE8\u518C"
|
268
|
-
})
|
281
|
+
}), JSON.stringify(currentLoginTypeList)]
|
269
282
|
}), /*#__PURE__*/_jsxs(Tabs, {
|
270
283
|
activeKey: activeKey,
|
271
284
|
onChange: function onChange(keyName) {
|
272
285
|
onTabChange(keyName);
|
273
286
|
},
|
274
|
-
children: [!((
|
287
|
+
children: [!((currentLoginTypeList === null || currentLoginTypeList === void 0 ? void 0 : currentLoginTypeList.length) > 0 && !currentLoginTypeList.includes('wechat')) && /*#__PURE__*/_jsx(Tabs.TabPane, {
|
275
288
|
tab: /*#__PURE__*/_jsxs(_Fragment, {
|
276
289
|
children: [/*#__PURE__*/_jsx(WechatOutlined, {}), " \u5FAE\u4FE1"]
|
277
290
|
}),
|
278
|
-
disabled: (
|
291
|
+
disabled: (currentLoginTypeList === null || currentLoginTypeList === void 0 ? void 0 : currentLoginTypeList.length) > 0 && !currentLoginTypeList.includes('wechat'),
|
279
292
|
children: /*#__PURE__*/_jsx(PageContentWarp, {
|
280
293
|
loading: loadingWeLoginQr || loading,
|
281
294
|
error: errorWeLoginQr,
|
@@ -326,7 +339,7 @@ var Auth = function Auth(_ref) {
|
|
326
339
|
className: "tab-icon",
|
327
340
|
children: [/*#__PURE__*/_jsx(UserOutlined, {}), " \u8D26\u6237"]
|
328
341
|
}),
|
329
|
-
disabled: !
|
342
|
+
disabled: !currentLoginTypeList.includes('account-login') && !currentLoginTypeList.includes('account'),
|
330
343
|
children: /*#__PURE__*/_jsx(AuthLoginReg, {
|
331
344
|
env: env,
|
332
345
|
apiUrl: apiUrl,
|
@@ -334,7 +347,7 @@ var Auth = function Auth(_ref) {
|
|
334
347
|
postData: postData,
|
335
348
|
productType: productType,
|
336
349
|
clientUniqueKeyList: clientUniqueKeyList,
|
337
|
-
accountRegDisabled: !
|
350
|
+
accountRegDisabled: !currentLoginTypeList.includes('account-reg'),
|
338
351
|
onSuccess: function onSuccess() {
|
339
352
|
return onLoginSuccess();
|
340
353
|
}
|
@@ -349,7 +362,13 @@ var Auth = function Auth(_ref) {
|
|
349
362
|
}
|
350
363
|
})
|
351
364
|
})]
|
352
|
-
})
|
365
|
+
}), /*#__PURE__*/_jsx("div", {
|
366
|
+
className: "callWechat",
|
367
|
+
onClick: onCallWechat
|
368
|
+
}), /*#__PURE__*/_jsx("div", {
|
369
|
+
className: "callAccount",
|
370
|
+
onClick: onCallAccount
|
371
|
+
})]
|
353
372
|
});
|
354
373
|
};
|
355
374
|
export default Auth;
|
@@ -2,7 +2,7 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLit
|
|
2
2
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
3
3
|
import styled from 'styled-components';
|
4
4
|
export default {
|
5
|
-
AuthQrLogin: styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .ant-tabs-tab-btn{\n .anticon{\n margin-right: 6px;\n }\n }\n .weQrUrl{\n position: absolute;\n left: 50%;\n transform: translateX(-50%);\n }\n .qr{\n position: relative;\n display: block;\n margin: 12px auto 0;\n width: 230px;\n height: 230px;\n background-repeat: no-repeat;\n background-size: cover;\n background-position: center;\n &.qrAlipay{\n border: 3px solid #1677ff;\n }\n .reTry{\n position: absolute;\n z-index: 100;\n left: 0;\n top: 0;\n width: 100%;\n font-size: 80px;\n background-color: rgba( 255, 255, 255, 0.95 );\n text-align: center;\n line-height: 210px;\n height: 100%;\n a{\n display: block;\n }\n }\n }\n .alt{\n padding: 10px 0 0;\n color: #999;\n text-align: center;\n }\n .altWeb{\n padding: 16px 0 0;\n max-width: 300px;\n margin: 0 auto;\n .titles{\n text-align: center;\n font-weight: bold;\n }\n ul{\n margin: 0 10px;\n }\n\n }\n .percent{\n width: 100%;\n position: absolute;\n overflow: hidden;\n left: 0;\n bottom: 0;\n .warp{\n height: 4px;\n background-color: #1677ff;\n transition: all 1.6s ease-in-out;\n -webkit-transition: all 1.6s ease-in-out;\n }\n }\n "]))),
|
5
|
+
AuthQrLogin: styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n .ant-tabs-tab-btn{\n .anticon{\n margin-right: 6px;\n }\n }\n .weQrUrl{\n position: absolute;\n left: 50%;\n transform: translateX(-50%);\n }\n .qr{\n position: relative;\n display: block;\n margin: 12px auto 0;\n width: 230px;\n height: 230px;\n background-repeat: no-repeat;\n background-size: cover;\n background-position: center;\n &.qrAlipay{\n border: 3px solid #1677ff;\n }\n .reTry{\n position: absolute;\n z-index: 100;\n left: 0;\n top: 0;\n width: 100%;\n font-size: 80px;\n background-color: rgba( 255, 255, 255, 0.95 );\n text-align: center;\n line-height: 210px;\n height: 100%;\n a{\n display: block;\n }\n }\n }\n .alt{\n padding: 10px 0 0;\n color: #999;\n text-align: center;\n }\n .altWeb{\n padding: 16px 0 0;\n max-width: 300px;\n margin: 0 auto;\n .titles{\n text-align: center;\n font-weight: bold;\n }\n ul{\n margin: 0 10px;\n }\n\n }\n .percent{\n width: 100%;\n position: absolute;\n overflow: hidden;\n left: 0;\n bottom: 0;\n .warp{\n height: 4px;\n background-color: #1677ff;\n transition: all 1.6s ease-in-out;\n -webkit-transition: all 1.6s ease-in-out;\n }\n }\n\n .callWechat{\n position: absolute;\n left: 0;\n bottom: 0;\n background: #F6F6F6;\n width: 4px;\n height: 4px;\n }\n .callAccount{\n position: absolute;\n right: 0;\n bottom: 0;\n background: #F6F6F6;\n width: 4px;\n height: 4px;\n }\n\n "]))),
|
6
6
|
LoginForm: styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n margin: 0 auto;\n padding: 0 0 5px 0 ;\n background-color: rgba(255, 255, 255, 0.75 );\n border-radius: 6px;\n "]))),
|
7
7
|
WebTitle: styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n font-weight: normal;\n font-size: 22px;\n text-align: center;\n padding: 0;\n margin: 6px 0 0 0;\n line-height: 1em;\n span{\n display: inline-block;\n padding-left: 5px;\n font-weight: lighter;\n font-size: 16px;\n }\n "]))),
|
8
8
|
WeQrUrlBox: styled.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n min-height: 240px !important;\n "])))
|
package/dist/lib/Tool.d.ts
CHANGED
@@ -162,7 +162,7 @@ declare const Tool: {
|
|
162
162
|
getTitleByPath(path: string): string;
|
163
163
|
getDirByPath(path: string): string;
|
164
164
|
h5Pay(query: Pay.H5PayQuery): void;
|
165
|
-
notification(type: "
|
165
|
+
notification(type: "success" | "info" | "warning" | "error", message: string, description?: import("react").ReactNode, options?: NotificationOptions): void;
|
166
166
|
notificationSuccess(message: string, description?: import("react").ReactNode, options?: NotificationOptions): void;
|
167
167
|
notificationError(message: string, description?: import("react").ReactNode, options?: NotificationOptions): void;
|
168
168
|
notificationWarning(message: string, description?: import("react").ReactNode, options?: NotificationOptions): void;
|
@@ -3,11 +3,13 @@ import store from "./store";
|
|
3
3
|
var AccountManageSettingConfigKey = 'account-manage-setting';
|
4
4
|
var AccountManageSettingConfig = function AccountManageSettingConfig(data) {
|
5
5
|
var _window$getBridge, _window, _window$getBridge$get;
|
6
|
+
var chromePath = ((_window$getBridge = (_window = window).getBridge) === null || _window$getBridge === void 0 || (_window$getBridge = _window$getBridge.call(_window)) === null || _window$getBridge === void 0 || (_window$getBridge$get = _window$getBridge.getChromiumPath) === null || _window$getBridge$get === void 0 ? void 0 : _window$getBridge$get.call(_window$getBridge)) || '';
|
6
7
|
if (data) {
|
7
|
-
store.set(AccountManageSettingConfigKey, _objectSpread({}, data)
|
8
|
+
store.set(AccountManageSettingConfigKey, _objectSpread(_objectSpread({}, data), {}, {
|
9
|
+
chromePath: chromePath
|
10
|
+
}));
|
8
11
|
return data;
|
9
12
|
}
|
10
|
-
var chromePath = ((_window$getBridge = (_window = window).getBridge) === null || _window$getBridge === void 0 || (_window$getBridge = _window$getBridge.call(_window)) === null || _window$getBridge === void 0 || (_window$getBridge$get = _window$getBridge.getChromiumPath) === null || _window$getBridge$get === void 0 ? void 0 : _window$getBridge$get.call(_window$getBridge)) || '';
|
11
13
|
var storeData = store.get(AccountManageSettingConfigKey);
|
12
14
|
var outData = _objectSpread(_objectSpread({
|
13
15
|
isChromeOpen: false,
|
package/dist/typings.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
declare namespace Global {
|
2
2
|
export type Env = 'local' | 'pre' | 'prod';
|
3
|
-
type AuthClientLoginType = 'wechat' | 'account-login' | 'account-reg' | 'alipay';
|
3
|
+
type AuthClientLoginType = 'wechat' | 'account' | 'account-login' | 'account-reg' | 'alipay';
|
4
4
|
export type ProductKind = 'vip' | 'vip-card' | string;
|
5
5
|
type OsName = '' | 'darwin' | 'windows' | 'linux' | 'other';
|
6
6
|
type MineTypeKind = 'video' | 'image' | 'sound' | '';
|