component-sanzhizhou 1.2.5 → 1.2.8

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.
@@ -7,6 +7,7 @@ interface Props {
7
7
  accountRegDisabled?: boolean;
8
8
  onSuccess: () => void;
9
9
  showSubAccount?: boolean;
10
+ narrow?: boolean;
10
11
  }
11
12
  /** 账户登录 / 注册;找回密码通过抽屉弹出。 */
12
13
  declare const Account: React.FC<Props>;
@@ -15,7 +15,8 @@ var Account = function Account(_ref) {
15
15
  disabledFormItemLabel = _ref.disabledFormItemLabel,
16
16
  accountRegDisabled = _ref.accountRegDisabled,
17
17
  onSuccess = _ref.onSuccess,
18
- showSubAccount = _ref.showSubAccount;
18
+ showSubAccount = _ref.showSubAccount,
19
+ narrow = _ref.narrow;
19
20
  var _useState = useState('login'),
20
21
  _useState2 = _slicedToArray(_useState, 2),
21
22
  activeKey = _useState2[0],
@@ -44,6 +45,7 @@ var Account = function Account(_ref) {
44
45
  roleType: roleType,
45
46
  disabledFormItemLabel: disabledFormItemLabel,
46
47
  showSubAccount: showSubAccount,
48
+ narrow: narrow,
47
49
  onSuccess: onSuccess,
48
50
  onForgotPassword: function onForgotPassword() {
49
51
  return setForgotOpen(true);
@@ -53,6 +55,7 @@ var Account = function Account(_ref) {
53
55
  apiUrl: apiUrl,
54
56
  roleType: roleType,
55
57
  disabledFormItemLabel: disabledFormItemLabel,
58
+ narrow: narrow,
56
59
  onSuccess: onSuccess
57
60
  }), /*#__PURE__*/React.createElement(Drawer, {
58
61
  title: formatMessage('找回密码'),
@@ -66,6 +69,7 @@ var Account = function Account(_ref) {
66
69
  apiUrl: apiUrl,
67
70
  disabledFormItemLabel: disabledFormItemLabel,
68
71
  showSubAccount: showSubAccount,
72
+ narrow: narrow,
69
73
  onDone: function onDone() {
70
74
  return setForgotOpen(false);
71
75
  }
@@ -4,6 +4,7 @@ interface Props {
4
4
  apiUrl?: string;
5
5
  disabledFormItemLabel?: boolean;
6
6
  showSubAccount?: boolean;
7
+ narrow?: boolean;
7
8
  /** 重置成功后回调(切回登录)。 */
8
9
  onDone: () => void;
9
10
  }
@@ -15,6 +15,7 @@ var ForgotPassword = function ForgotPassword(_ref) {
15
15
  apiUrl = _ref.apiUrl,
16
16
  disabledFormItemLabel = _ref.disabledFormItemLabel,
17
17
  showSubAccount = _ref.showSubAccount,
18
+ narrow = _ref.narrow,
18
19
  onDone = _ref.onDone;
19
20
  var _Form$useForm = Form.useForm(),
20
21
  _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
@@ -50,11 +51,12 @@ var ForgotPassword = function ForgotPassword(_ref) {
50
51
  onFinish: onFinish,
51
52
  disabled: loading,
52
53
  autoComplete: "off",
53
- labelCol: {
54
+ layout: narrow ? 'vertical' : 'horizontal',
55
+ labelCol: narrow ? undefined : {
54
56
  span: FormSpan
55
57
  }
56
58
  }, showSubAccount && /*#__PURE__*/React.createElement(Form.Item, {
57
- wrapperCol: {
59
+ wrapperCol: narrow ? undefined : {
58
60
  offset: FormSpan
59
61
  }
60
62
  }, /*#__PURE__*/React.createElement(Segmented, {
@@ -90,7 +92,8 @@ var ForgotPassword = function ForgotPassword(_ref) {
90
92
  scene: "forgot",
91
93
  env: env,
92
94
  apiUrl: apiUrl,
93
- disabledFormItemLabel: disabledFormItemLabel
95
+ disabledFormItemLabel: disabledFormItemLabel,
96
+ narrow: narrow
94
97
  }), /*#__PURE__*/React.createElement(Form.Item, {
95
98
  label: disabledFormItemLabel ? undefined : formatMessage('新密码'),
96
99
  name: "password",
@@ -117,7 +120,7 @@ var ForgotPassword = function ForgotPassword(_ref) {
117
120
  return visible ? /*#__PURE__*/React.createElement(EyeTwoTone, null) : /*#__PURE__*/React.createElement(EyeInvisibleOutlined, null);
118
121
  }
119
122
  })), /*#__PURE__*/React.createElement(Form.Item, {
120
- wrapperCol: {
123
+ wrapperCol: narrow ? undefined : {
121
124
  offset: 6
122
125
  }
123
126
  }, /*#__PURE__*/React.createElement(Button, {
@@ -13,6 +13,8 @@ interface Props {
13
13
  };
14
14
  onLoginSuccess: () => void;
15
15
  showSubAccount?: boolean;
16
+ /** 窄模式:表单 label 改为上下结构(适配窄容器,如插件悬浮球)。 */
17
+ narrow?: boolean;
16
18
  }
17
19
  /**
18
20
  * 登录 / 注册(重构版)。
@@ -28,7 +28,8 @@ var AuthMain = function AuthMain(_ref) {
28
28
  domain = _ref$domain === void 0 ? document.location.hostname : _ref$domain,
29
29
  _ref$onLoginSuccess = _ref.onLoginSuccess,
30
30
  onLoginSuccess = _ref$onLoginSuccess === void 0 ? function () {} : _ref$onLoginSuccess,
31
- showSubAccount = _ref.showSubAccount;
31
+ showSubAccount = _ref.showSubAccount,
32
+ narrow = _ref.narrow;
32
33
  var _useState = useState(_toConsumableArray(loginTypeList)),
33
34
  _useState2 = _slicedToArray(_useState, 2),
34
35
  currentLoginTypeList = _useState2[0],
@@ -83,6 +84,7 @@ var AuthMain = function AuthMain(_ref) {
83
84
  disabledFormItemLabel: disabledFormItemLabel,
84
85
  accountRegDisabled: accountRegDisabled,
85
86
  showSubAccount: showSubAccount,
87
+ narrow: narrow,
86
88
  onSuccess: function onSuccess() {
87
89
  return onLoginSuccess();
88
90
  }
@@ -111,7 +111,7 @@
111
111
 
112
112
  .LoginForm {
113
113
  margin: 0 auto;
114
- padding: 12px 16px 6px 16px;
114
+ padding: 28px;
115
115
  background-color: rgba(255, 255, 255, 0.9);
116
116
  border-radius: 6px;
117
117
  }
@@ -4,6 +4,7 @@ interface Props extends AccountFormProps {
4
4
  roleType?: UserAuth.RoleType;
5
5
  disabledFormItemLabel?: boolean;
6
6
  showSubAccount?: boolean;
7
+ narrow?: boolean;
7
8
  onForgotPassword?: () => void;
8
9
  }
9
10
  /** 账户密码登录。 */
@@ -15,6 +15,7 @@ var Login = function Login(_ref) {
15
15
  roleType = _ref.roleType,
16
16
  disabledFormItemLabel = _ref.disabledFormItemLabel,
17
17
  showSubAccount = _ref.showSubAccount,
18
+ narrow = _ref.narrow,
18
19
  _onSuccess = _ref.onSuccess,
19
20
  onForgotPassword = _ref.onForgotPassword;
20
21
  var _Form$useForm = Form.useForm(),
@@ -46,7 +47,8 @@ var Login = function Login(_ref) {
46
47
  };
47
48
  var formSpan = 8;
48
49
  return /*#__PURE__*/React.createElement("section", null, /*#__PURE__*/React.createElement(Form, {
49
- labelCol: {
50
+ layout: narrow ? 'vertical' : 'horizontal',
51
+ labelCol: narrow ? undefined : {
50
52
  span: formSpan
51
53
  },
52
54
  form: form,
@@ -54,7 +56,7 @@ var Login = function Login(_ref) {
54
56
  disabled: loading
55
57
  // autoComplete="off"
56
58
  }, showSubAccount && /*#__PURE__*/React.createElement(Form.Item, {
57
- wrapperCol: {
59
+ wrapperCol: narrow ? undefined : {
58
60
  offset: formSpan
59
61
  }
60
62
  }, /*#__PURE__*/React.createElement(Segmented, {
@@ -117,7 +119,7 @@ var Login = function Login(_ref) {
117
119
  return visible ? /*#__PURE__*/React.createElement(EyeTwoTone, null) : /*#__PURE__*/React.createElement(EyeInvisibleOutlined, null);
118
120
  }
119
121
  })), /*#__PURE__*/React.createElement(Form.Item, {
120
- wrapperCol: {
122
+ wrapperCol: narrow ? undefined : {
121
123
  offset: formSpan
122
124
  }
123
125
  }, /*#__PURE__*/React.createElement(Button, {
@@ -7,6 +7,7 @@ interface Props {
7
7
  env?: Global.Env;
8
8
  apiUrl?: string;
9
9
  disabledFormItemLabel?: boolean;
10
+ narrow?: boolean;
10
11
  }
11
12
  /** 人机验证 + 手机验证码 + 发送按钮(含倒计时)。 */
12
13
  declare const PhoneCode: React.FC<Props>;
@@ -17,7 +17,8 @@ var PhoneCode = function PhoneCode(_ref) {
17
17
  scene = _ref.scene,
18
18
  env = _ref.env,
19
19
  apiUrl = _ref.apiUrl,
20
- disabledFormItemLabel = _ref.disabledFormItemLabel;
20
+ disabledFormItemLabel = _ref.disabledFormItemLabel,
21
+ narrow = _ref.narrow;
21
22
  var accountName = Form.useWatch('accountName', form);
22
23
  var phone = (accountName || '').replace(/\s+/g, '');
23
24
  var _useState = useState(0),
@@ -113,7 +114,7 @@ var PhoneCode = function PhoneCode(_ref) {
113
114
  };
114
115
  }();
115
116
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Form.Item, {
116
- wrapperCol: {
117
+ wrapperCol: narrow ? undefined : {
117
118
  offset: formSpan
118
119
  },
119
120
  className: styles.humanVerifyItem
@@ -126,7 +127,7 @@ var PhoneCode = function PhoneCode(_ref) {
126
127
  onVerified: onVerified
127
128
  })), /*#__PURE__*/React.createElement(Form.Item, {
128
129
  label: disabledFormItemLabel ? undefined : formatMessage('验证码'),
129
- labelCol: {
130
+ labelCol: narrow ? undefined : {
130
131
  span: formSpan
131
132
  }
132
133
  }, /*#__PURE__*/React.createElement(Space.Compact, {
@@ -3,6 +3,7 @@ import type { AccountFormProps } from './types';
3
3
  interface Props extends AccountFormProps {
4
4
  roleType?: UserAuth.RoleType;
5
5
  disabledFormItemLabel?: boolean;
6
+ narrow?: boolean;
6
7
  }
7
8
  /** 短信验证码注册。 */
8
9
  declare const Register: React.FC<Props>;
@@ -14,10 +14,17 @@ var Register = function Register(_ref) {
14
14
  apiUrl = _ref.apiUrl,
15
15
  roleType = _ref.roleType,
16
16
  disabledFormItemLabel = _ref.disabledFormItemLabel,
17
+ narrow = _ref.narrow,
17
18
  _onSuccess = _ref.onSuccess;
18
19
  var _Form$useForm = Form.useForm(),
19
20
  _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
20
21
  form = _Form$useForm2[0];
22
+ var labelCol = narrow ? undefined : {
23
+ span: 8
24
+ };
25
+ var wrapperCol = narrow ? undefined : {
26
+ offset: 8
27
+ };
21
28
  var _useRequest = useRequest(function (data) {
22
29
  return AuthController.accountReg({
23
30
  accountName: data.accountName,
@@ -46,12 +53,11 @@ var Register = function Register(_ref) {
46
53
  form: form,
47
54
  onFinish: onFinish,
48
55
  disabled: loading,
49
- autoComplete: "off"
56
+ autoComplete: "off",
57
+ layout: narrow ? 'vertical' : 'horizontal'
50
58
  }, /*#__PURE__*/React.createElement(Form.Item, {
51
59
  label: disabledFormItemLabel ? undefined : formatMessage('手机号码'),
52
- labelCol: {
53
- span: 8
54
- },
60
+ labelCol: labelCol,
55
61
  name: "accountName",
56
62
  rules: [{
57
63
  required: true,
@@ -71,12 +77,11 @@ var Register = function Register(_ref) {
71
77
  scene: "reg",
72
78
  env: env,
73
79
  apiUrl: apiUrl,
74
- disabledFormItemLabel: disabledFormItemLabel
80
+ disabledFormItemLabel: disabledFormItemLabel,
81
+ narrow: narrow
75
82
  }), /*#__PURE__*/React.createElement(Form.Item, {
76
83
  label: disabledFormItemLabel ? undefined : formatMessage('密码'),
77
- labelCol: {
78
- span: 8
79
- },
84
+ labelCol: labelCol,
80
85
  name: "password",
81
86
  rules: [{
82
87
  required: true,
@@ -102,9 +107,7 @@ var Register = function Register(_ref) {
102
107
  }
103
108
  })), /*#__PURE__*/React.createElement(Form.Item, {
104
109
  label: disabledFormItemLabel ? undefined : formatMessage('确认密码'),
105
- labelCol: {
106
- span: 8
107
- },
110
+ labelCol: labelCol,
108
111
  name: "confirmPassword",
109
112
  dependencies: ['password'],
110
113
  rules: [{
@@ -130,9 +133,7 @@ var Register = function Register(_ref) {
130
133
  return visible ? /*#__PURE__*/React.createElement(EyeTwoTone, null) : /*#__PURE__*/React.createElement(EyeInvisibleOutlined, null);
131
134
  }
132
135
  })), /*#__PURE__*/React.createElement(Form.Item, {
133
- wrapperCol: {
134
- offset: 8
135
- }
136
+ wrapperCol: wrapperCol
136
137
  }, /*#__PURE__*/React.createElement(Button, {
137
138
  type: "primary",
138
139
  loading: loading,
package/dist/index.d.ts CHANGED
@@ -20,3 +20,4 @@ export { default as PayQr } from './pay/qr';
20
20
  export { default as PayChannel } from './pay/pay-channel';
21
21
  export { default as IdTag } from './UI/id-tag';
22
22
  export { default as CollectConfigPrice } from './collect-price';
23
+ export { default as ProductDetailLink } from './lib/product-detail-link';
package/dist/index.js CHANGED
@@ -19,4 +19,5 @@ export { default as PayVip } from "./pay/vip";
19
19
  export { default as PayQr } from "./pay/qr";
20
20
  export { default as PayChannel } from "./pay/pay-channel";
21
21
  export { default as IdTag } from "./UI/id-tag";
22
- export { default as CollectConfigPrice } from "./collect-price";
22
+ export { default as CollectConfigPrice } from "./collect-price";
23
+ export { default as ProductDetailLink } from "./lib/product-detail-link";
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ interface Props {
3
+ commercePlatformId?: number;
4
+ skuId?: number;
5
+ children?: React.ReactNode;
6
+ options?: {};
7
+ }
8
+ export declare const getProductDetailUrl: (commercePlatformId?: number, skuId?: number, options?: {}) => string;
9
+ declare const ProductDetailLink: React.FC<Props>;
10
+ export default ProductDetailLink;
@@ -0,0 +1,34 @@
1
+ import React from 'react';
2
+ // 平台商品详情页地址:目前仅 OZON 支持,WB 待补充
3
+ export var getProductDetailUrl = function getProductDetailUrl(commercePlatformId, skuId) {
4
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
5
+ if (!skuId) {
6
+ return '';
7
+ }
8
+ switch (commercePlatformId) {
9
+ case 7:
10
+ // OZON
11
+ return "https://ozon.ru/product/".concat(skuId);
12
+ case 15:
13
+ // WB
14
+ return "https://www.wildberries.ru/catalog/".concat(skuId, "/detail.aspx");
15
+ default:
16
+ return '';
17
+ }
18
+ };
19
+ var ProductDetailLink = function ProductDetailLink(_ref) {
20
+ var commercePlatformId = _ref.commercePlatformId,
21
+ skuId = _ref.skuId,
22
+ children = _ref.children;
23
+ var href = getProductDetailUrl(commercePlatformId, skuId);
24
+ if (!href) {
25
+ return /*#__PURE__*/React.createElement(React.Fragment, null, children);
26
+ }
27
+ return /*#__PURE__*/React.createElement("a", {
28
+ href: href,
29
+ target: "_blank",
30
+ rel: "noreferrer"
31
+ // style={{ color: '#1677ff' }}
32
+ }, children);
33
+ };
34
+ export default ProductDetailLink;
@@ -56,5 +56,7 @@
56
56
  "2、请用微信扫码登录": "2. امسح رمز QR باستخدام WeChat لتسجيل الدخول",
57
57
  "3、把本页网址复制到微信里面打开": "3. انسخ رابط هذه الصفحة وافتحه في WeChat",
58
58
  "名称": "الاسم",
59
- "优惠券": "قسيمة"
59
+ "优惠券": "قسيمة",
60
+ "主账户": "الحساب الرئيسي",
61
+ "子账户": "الحساب الفرعي"
60
62
  }
@@ -56,5 +56,7 @@
56
56
  "2、请用微信扫码登录": "2. QR-Code mit WeChat scannen, um sich anzumelden",
57
57
  "3、把本页网址复制到微信里面打开": "3. URL dieser Seite kopieren und in WeChat öffnen",
58
58
  "名称": "Name",
59
- "优惠券": "Gutschein"
59
+ "优惠券": "Gutschein",
60
+ "主账户": "Hauptkonto",
61
+ "子账户": "Unterkonto"
60
62
  }
@@ -56,5 +56,7 @@
56
56
  "2、请用微信扫码登录": "2. Scan the QR code with WeChat to log in",
57
57
  "3、把本页网址复制到微信里面打开": "3. Copy this page URL and open it in WeChat",
58
58
  "名称": "Name",
59
- "优惠券": "Coupon"
59
+ "优惠券": "Coupon",
60
+ "主账户": "Main Account",
61
+ "子账户": "Sub-account"
60
62
  }
@@ -56,5 +56,7 @@
56
56
  "2、请用微信扫码登录": "2. Escanea el código QR con WeChat para iniciar sesión",
57
57
  "3、把本页网址复制到微信里面打开": "3. Copia la URL de esta página y ábrela en WeChat",
58
58
  "名称": "Nombre",
59
- "优惠券": "Cupón"
59
+ "优惠券": "Cupón",
60
+ "主账户": "Cuenta principal",
61
+ "子账户": "Subcuenta"
60
62
  }
@@ -56,5 +56,7 @@
56
56
  "2、请用微信扫码登录": "2. Scannez le QR code avec WeChat pour vous connecter",
57
57
  "3、把本页网址复制到微信里面打开": "3. Copiez l'URL de cette page et ouvrez-la dans WeChat",
58
58
  "名称": "Nom",
59
- "优惠券": "Coupon"
59
+ "优惠券": "Coupon",
60
+ "主账户": "Compte principal",
61
+ "子账户": "Sous-compte"
60
62
  }
@@ -56,5 +56,7 @@
56
56
  "2、请用微信扫码登录": "2. Scansiona il QR code con WeChat per accedere",
57
57
  "3、把本页网址复制到微信里面打开": "3. Copia l'URL di questa pagina e aprilo in WeChat",
58
58
  "名称": "Nome",
59
- "优惠券": "Coupon"
59
+ "优惠券": "Coupon",
60
+ "主账户": "Account principale",
61
+ "子账户": "Sottoaccount"
60
62
  }
@@ -56,5 +56,7 @@
56
56
  "2、请用微信扫码登录": "2、WeChatでQRコードをスキャンしてログイン",
57
57
  "3、把本页网址复制到微信里面打开": "3、このページのURLをコピーしてWeChatで開く",
58
58
  "名称": "名称",
59
- "优惠券": "クーポン"
59
+ "优惠券": "クーポン",
60
+ "主账户": "メインアカウント",
61
+ "子账户": "サブアカウント"
60
62
  }
@@ -56,5 +56,7 @@
56
56
  "2、请用微信扫码登录": "2. WeChat으로 QR 코드를 스캔해 로그인",
57
57
  "3、把本页网址复制到微信里面打开": "3. 이 페이지 URL을 복사해 WeChat에서 열기",
58
58
  "名称": "이름",
59
- "优惠券": "쿠폰"
59
+ "优惠券": "쿠폰",
60
+ "主账户": "메인 계정",
61
+ "子账户": "서브 계정"
60
62
  }
@@ -56,5 +56,7 @@
56
56
  "2、请用微信扫码登录": "2. Digitalize o QR code com o WeChat para iniciar sessão",
57
57
  "3、把本页网址复制到微信里面打开": "3. Copie o URL desta página e abra no WeChat",
58
58
  "名称": "Nome",
59
- "优惠券": "Cupão"
59
+ "优惠券": "Cupão",
60
+ "主账户": "Conta principal",
61
+ "子账户": "Subconta"
60
62
  }
@@ -56,5 +56,7 @@
56
56
  "2、请用微信扫码登录": "2. Отсканируйте QR-код в WeChat для входа",
57
57
  "3、把本页网址复制到微信里面打开": "3. Скопируйте URL страницы и откройте в WeChat",
58
58
  "名称": "Название",
59
- "优惠券": "Купон"
59
+ "优惠券": "Купон",
60
+ "主账户": "Основной аккаунт",
61
+ "子账户": "Дополнительный аккаунт"
60
62
  }
@@ -56,5 +56,7 @@
56
56
  "2、请用微信扫码登录": "2. สแกน QR โค้ดด้วย WeChat เพื่อเข้าสู่ระบบ",
57
57
  "3、把本页网址复制到微信里面打开": "3. คัดลอก URL ของหน้านี้แล้วเปิดใน WeChat",
58
58
  "名称": "ชื่อ",
59
- "优惠券": "คูปอง"
59
+ "优惠券": "คูปอง",
60
+ "主账户": "บัญชีหลัก",
61
+ "子账户": "บัญชีย่อย"
60
62
  }
@@ -56,5 +56,7 @@
56
56
  "2、请用微信扫码登录": "2. Quét mã QR bằng WeChat để đăng nhập",
57
57
  "3、把本页网址复制到微信里面打开": "3. Sao chép URL trang này và mở trong WeChat",
58
58
  "名称": "Tên",
59
- "优惠券": "Phiếu giảm giá"
59
+ "优惠券": "Phiếu giảm giá",
60
+ "主账户": "Tài khoản chính",
61
+ "子账户": "Tài khoản phụ"
60
62
  }
@@ -56,5 +56,7 @@
56
56
  "下面任选一个方法都可以登录:": "下面任选一个方法都可以登录:",
57
57
  "1、把本页网址复制到微信里面打开": "1、把本页网址复制到微信里面打开",
58
58
  "2、请用微信扫码登录": "2、请用微信扫码登录",
59
- "3、把本页网址复制到微信里面打开": "3、把本页网址复制到微信里面打开"
59
+ "3、把本页网址复制到微信里面打开": "3、把本页网址复制到微信里面打开",
60
+ "主账户": "主账户",
61
+ "子账户": "子账户"
60
62
  }
@@ -56,5 +56,7 @@
56
56
  "已经过期": "已經過期",
57
57
  "内容为空": "內容為空",
58
58
  "重试": "重試",
59
- "选择": "選擇"
59
+ "选择": "選擇",
60
+ "主账户": "主賬戶",
61
+ "子账户": "子賬戶"
60
62
  }
@@ -56,5 +56,7 @@
56
56
  "已经过期": "已過期",
57
57
  "内容为空": "內容空白",
58
58
  "重试": "重試",
59
- "选择": "選擇"
59
+ "选择": "選擇",
60
+ "主账户": "主帳戶",
61
+ "子账户": "子帳戶"
60
62
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "component-sanzhizhou",
3
- "version": "1.2.5",
3
+ "version": "1.2.8",
4
4
  "description": "",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",