component-shipinlv 1.0.8 → 1.0.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ interface Props {
3
+ onActive: () => void;
4
+ }
5
+ declare const UserProfileVipCard: React.FC<Props>;
6
+ export default UserProfileVipCard;
@@ -0,0 +1,73 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ import React from 'react';
3
+ import { Button, Form, Input } from 'antd';
4
+ import { CrownOutlined } from '@ant-design/icons';
5
+ import { useRequest } from '@umijs/hooks';
6
+ import * as VipCardController from "../service/api/VipCardController";
7
+ import updateUserInfo from "../lib/updateUserInfo";
8
+ import Tool from "../lib/Tool";
9
+ import { jsx as _jsx } from "react/jsx-runtime";
10
+ var UserProfileVipCard = function UserProfileVipCard(_ref) {
11
+ var onActive = _ref.onActive;
12
+ var _Form$useForm = Form.useForm(),
13
+ _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
14
+ form = _Form$useForm2[0];
15
+ var _useRequest = useRequest(function (vipCardCode) {
16
+ return VipCardController.activate({
17
+ vipCardCode: vipCardCode
18
+ });
19
+ }, {
20
+ manual: true,
21
+ onSuccess: function onSuccess(data) {
22
+ form.resetFields();
23
+ Tool.toast('已经激活');
24
+ updateUserInfo();
25
+ onActive === null || onActive === void 0 || onActive();
26
+ },
27
+ onError: function onError() {}
28
+ }),
29
+ run = _useRequest.run,
30
+ loading = _useRequest.loading,
31
+ error = _useRequest.error;
32
+ var onFinish = function onFinish(postData) {
33
+ var _postData$vipCardCode;
34
+ var vipCardCode = (_postData$vipCardCode = postData.vipCardCode) === null || _postData$vipCardCode === void 0 ? void 0 : _postData$vipCardCode.replace(/^\s*AI\d?-/i, '').replace(/\s+/g, '').toLocaleUpperCase();
35
+ if (!vipCardCode) {
36
+ return;
37
+ }
38
+ run(vipCardCode);
39
+ };
40
+ var onupdateUserInfo = function onupdateUserInfo() {
41
+ updateUserInfo();
42
+ };
43
+ return /*#__PURE__*/_jsx("div", {
44
+ children: /*#__PURE__*/_jsx(Form, {
45
+ form: form,
46
+ disabled: loading,
47
+ onFinish: onFinish,
48
+ children: /*#__PURE__*/_jsx(Form.Item, {
49
+ name: "vipCardCode",
50
+ rules: [{
51
+ required: true,
52
+ message: '请输入'
53
+ }, {
54
+ pattern: /^\s*(AI\d-)?[A-Z0-9-]{14,}\s*$/i,
55
+ message: '类似:AI-AAAA-BBBB-CCCC'
56
+ }],
57
+ children: /*#__PURE__*/_jsx(Input, {
58
+ addonAfter: /*#__PURE__*/_jsx(Button, {
59
+ htmlType: "submit",
60
+ type: "link",
61
+ icon: /*#__PURE__*/_jsx(CrownOutlined, {}),
62
+ size: "small",
63
+ loading: loading,
64
+ children: "\u6FC0\u6D3B"
65
+ }),
66
+ allowClear: true,
67
+ placeholder: "\u7C7B\u4F3C: AI-AAAA-BBBB-CCCC"
68
+ })
69
+ })
70
+ })
71
+ });
72
+ };
73
+ export default UserProfileVipCard;
package/dist/index.d.ts CHANGED
@@ -6,6 +6,7 @@ export { default as AuthClient } from './AuthClient';
6
6
  export { default as Auth } from './Auth';
7
7
  export { default as Product } from './Product';
8
8
  export { default as JoinClient } from './join-client';
9
+ export { default as renewalVip } from './renewal-vip';
9
10
  export { default as VipList } from './VipList';
10
11
  export { default as fileSelect } from './base/fileSelect';
11
12
  export { default as folderOpen } from './base/folderOpen';
package/dist/index.js CHANGED
@@ -8,6 +8,7 @@ export { default as AuthClient } from "./AuthClient";
8
8
  export { default as Auth } from "./Auth";
9
9
  export { default as Product } from "./Product";
10
10
  export { default as JoinClient } from "./join-client";
11
+ export { default as renewalVip } from "./renewal-vip";
11
12
  export { default as VipList } from "./VipList";
12
13
  export { default as fileSelect } from "./base/fileSelect";
13
14
  export { default as folderOpen } from "./base/folderOpen";
@@ -158,7 +158,7 @@ declare const Tool: {
158
158
  setTimeOffset(serverTime: number): void;
159
159
  getTime(): number;
160
160
  h5Pay(query: Pay.H5PayQuery): void;
161
- notification(type: "success" | "info" | "warning" | "error", message: string, description?: import("react").ReactNode, options?: NotificationOptions): void;
161
+ notification(type: "info" | "error" | "success" | "warning", message: string, description?: import("react").ReactNode, options?: NotificationOptions): void;
162
162
  notificationSuccess(message: string, description?: import("react").ReactNode, options?: NotificationOptions): void;
163
163
  notificationError(message: string, description?: import("react").ReactNode, options?: NotificationOptions): void;
164
164
  notificationWarning(message: string, description?: import("react").ReactNode, options?: NotificationOptions): void;
@@ -170,7 +170,7 @@ declare const Tool: {
170
170
  [name: string]: any;
171
171
  };
172
172
  data(key: string, value: any): any;
173
- getInviteUserId(): any;
173
+ getInviteUserId(): number;
174
174
  getLocalUserInfo(): UserAuth.UserInfo;
175
175
  setLocalUserInfo(data?: {}): {
176
176
  id: number;
package/dist/lib/Tool.js CHANGED
@@ -101,10 +101,11 @@ var Tool = _objectSpread(_objectSpread({
101
101
  dealerId: 1,
102
102
  weContactQrUrl: '',
103
103
  isIDealer: false,
104
- icp: '浙ICP备16011722号',
104
+ icp: '-',
105
105
  wechatAppId: '',
106
106
  domainTitle: '',
107
107
  webTitle: '',
108
+ disabledOnlineBuy: [],
108
109
  sitePause: {
109
110
  isPause: false,
110
111
  reason: ''
@@ -0,0 +1,2 @@
1
+ declare const updateUserInfo: () => Promise<void>;
2
+ export default updateUserInfo;
@@ -0,0 +1,40 @@
1
+ import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
2
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
4
+ import * as UserController from "../service/api/UserController";
5
+ import Tool from "../lib/Tool";
6
+ var updateUserInfo = /*#__PURE__*/function () {
7
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
8
+ var userInfo, result;
9
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
10
+ while (1) switch (_context.prev = _context.next) {
11
+ case 0:
12
+ userInfo = Tool.getLocalUserInfo();
13
+ if (userInfo.isLogin) {
14
+ _context.next = 4;
15
+ break;
16
+ }
17
+ console.log('updateUserInfo not login!');
18
+ return _context.abrupt("return");
19
+ case 4:
20
+ _context.next = 6;
21
+ return UserController.getInfo().catch(function (err) {});
22
+ case 6:
23
+ result = _context.sent;
24
+ if (result) {
25
+ Tool.setLocalUserInfo(_objectSpread(_objectSpread(_objectSpread({}, userInfo), result), {}, {
26
+ isLogin: true
27
+ }));
28
+ Tool.event.run('user-info');
29
+ }
30
+ case 8:
31
+ case "end":
32
+ return _context.stop();
33
+ }
34
+ }, _callee);
35
+ }));
36
+ return function updateUserInfo() {
37
+ return _ref.apply(this, arguments);
38
+ };
39
+ }();
40
+ export default updateUserInfo;
@@ -0,0 +1,2 @@
1
+ declare const renewalVip: (productName: string) => Promise<unknown>;
2
+ export default renewalVip;
@@ -0,0 +1,75 @@
1
+ import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
2
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
3
+ import Tool from "../lib/Tool";
4
+ import { VipList } from "./..";
5
+ import { getApiEnv } from "../lib/getApiUrl";
6
+ import UserProfileVipCard from "../active-code";
7
+ import { jsx as _jsx } from "react/jsx-runtime";
8
+ import { Fragment as _Fragment } from "react/jsx-runtime";
9
+ import { jsxs as _jsxs } from "react/jsx-runtime";
10
+ var renewalVip = /*#__PURE__*/function () {
11
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(productName) {
12
+ var _userInfo$userVip;
13
+ var siteInfo, userInfo, userVip, isVip, localSiteInfo;
14
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
15
+ while (1) switch (_context.prev = _context.next) {
16
+ case 0:
17
+ siteInfo = Tool.getLocalSiteInfo();
18
+ userInfo = Tool.getLocalUserInfo();
19
+ userVip = userInfo === null || userInfo === void 0 || (_userInfo$userVip = userInfo.userVip) === null || _userInfo$userVip === void 0 ? void 0 : _userInfo$userVip[productName];
20
+ isVip = !!(userVip !== null && userVip !== void 0 && userVip.isVip);
21
+ localSiteInfo = Tool.getLocalSiteInfo();
22
+ return _context.abrupt("return", new Promise(function (resolve, reject) {
23
+ if (siteInfo.disabledOnlineBuy.includes(productName)) {
24
+ // 激活码
25
+ var dialog = Tool.drawer({
26
+ title: /*#__PURE__*/_jsxs(_Fragment, {
27
+ children: ["\u6FC0\u6D3B\u7801 ", /*#__PURE__*/_jsx("small", {
28
+ style: {
29
+ fontWeight: 300
30
+ },
31
+ children: "\u6FC0\u6D3B\u4F1A\u5458"
32
+ })]
33
+ }),
34
+ content: /*#__PURE__*/_jsx(UserProfileVipCard, {
35
+ onActive: function onActive() {
36
+ resolve(true);
37
+ dialog.destroy();
38
+ }
39
+ }),
40
+ width: 520
41
+ });
42
+ return;
43
+ }
44
+ Tool.pageDialog({
45
+ title: '价格表',
46
+ content: /*#__PURE__*/_jsx(VipList, {
47
+ env: getApiEnv(),
48
+ tableScrollY: "60vh",
49
+ productType: productName,
50
+ applyDemoWechatUrl: localSiteInfo.domainUserWeContactQrUrl || localSiteInfo.dealerWeContactQrUrl || localSiteInfo.adminWechatQr,
51
+ onBuySuccess: function onBuySuccess() {
52
+ console.log('onBuySuccess!');
53
+ (top || window).window.document.location.reload();
54
+ // resolve( true );
55
+ }
56
+ }),
57
+
58
+ style: {
59
+ top: 30
60
+ },
61
+ zIndex: 1100,
62
+ width: 920
63
+ });
64
+ }));
65
+ case 6:
66
+ case "end":
67
+ return _context.stop();
68
+ }
69
+ }, _callee);
70
+ }));
71
+ return function renewalVip(_x) {
72
+ return _ref.apply(this, arguments);
73
+ };
74
+ }();
75
+ export default renewalVip;
@@ -0,0 +1,15 @@
1
+ export declare function list(body: {
2
+ targetTypeId: number;
3
+ keyword: string;
4
+ used: string;
5
+ current: number;
6
+ pageSize: number;
7
+ }, options?: Global.RequestOptions): Promise<VipCard.ListData>;
8
+ export declare function listKind(body?: {}, options?: Global.RequestOptions): Promise<VipCard.ListKind[]>;
9
+ export declare function activate(body: {
10
+ vipCardCode: string;
11
+ }, options?: Global.RequestOptions): Promise<VipCard.List[]>;
12
+ export declare function editRemark(body: {
13
+ id: number;
14
+ remark: string;
15
+ }, options?: Global.RequestOptions): Promise<VipCard.List>;
@@ -0,0 +1,115 @@
1
+ import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
2
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
4
+ import request from "../../lib/request";
5
+ export function list(_x, _x2) {
6
+ return _list.apply(this, arguments);
7
+ }
8
+ function _list() {
9
+ _list = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(body, options) {
10
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
11
+ while (1) switch (_context.prev = _context.next) {
12
+ case 0:
13
+ return _context.abrupt("return", request("user/vipCard/list", _objectSpread({
14
+ method: 'POST',
15
+ headers: {
16
+ 'Content-Type': 'application/json'
17
+ },
18
+ data: _objectSpread({}, body)
19
+ }, options || {})));
20
+ case 1:
21
+ case "end":
22
+ return _context.stop();
23
+ }
24
+ }, _callee);
25
+ }));
26
+ return _list.apply(this, arguments);
27
+ }
28
+ export function listKind(_x3, _x4) {
29
+ return _listKind.apply(this, arguments);
30
+ }
31
+ function _listKind() {
32
+ _listKind = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(body, options) {
33
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
34
+ while (1) switch (_context2.prev = _context2.next) {
35
+ case 0:
36
+ return _context2.abrupt("return", request("user/vipCard/kindList", _objectSpread({
37
+ method: 'POST',
38
+ headers: {
39
+ 'Content-Type': 'application/json'
40
+ },
41
+ data: _objectSpread({}, body)
42
+ }, options || {})));
43
+ case 1:
44
+ case "end":
45
+ return _context2.stop();
46
+ }
47
+ }, _callee2);
48
+ }));
49
+ return _listKind.apply(this, arguments);
50
+ }
51
+ export function activate(_x5, _x6) {
52
+ return _activate.apply(this, arguments);
53
+ }
54
+ function _activate() {
55
+ _activate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(body, options) {
56
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
57
+ while (1) switch (_context3.prev = _context3.next) {
58
+ case 0:
59
+ return _context3.abrupt("return", request("user/vipCard/activate", _objectSpread({
60
+ method: 'POST',
61
+ headers: {
62
+ 'Content-Type': 'application/json'
63
+ },
64
+ data: _objectSpread({}, body)
65
+ }, options || {})));
66
+ case 1:
67
+ case "end":
68
+ return _context3.stop();
69
+ }
70
+ }, _callee3);
71
+ }));
72
+ return _activate.apply(this, arguments);
73
+ }
74
+ export function editRemark(_x7, _x8) {
75
+ return _editRemark.apply(this, arguments);
76
+ }
77
+
78
+ // export async function createOrder(
79
+ // body: VipCard.CreateOrder,
80
+ // options?: Global.RequestOptions,
81
+ // ) {
82
+ // return request<VipOrder.ListData>(
83
+ // `user/vipCardOrder/CreateOrder`,
84
+ // {
85
+ // method: 'POST',
86
+ // headers: {
87
+ // 'Content-Type': 'application/json',
88
+ // },
89
+ // data: {
90
+ // ...body,
91
+ // },
92
+ // ...(options || {}),
93
+ // },
94
+ // );
95
+ // }
96
+ function _editRemark() {
97
+ _editRemark = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(body, options) {
98
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
99
+ while (1) switch (_context4.prev = _context4.next) {
100
+ case 0:
101
+ return _context4.abrupt("return", request("user/vipCard/editRemark", _objectSpread({
102
+ method: 'POST',
103
+ headers: {
104
+ 'Content-Type': 'application/json'
105
+ },
106
+ data: _objectSpread({}, body)
107
+ }, options || {})));
108
+ case 1:
109
+ case "end":
110
+ return _context4.stop();
111
+ }
112
+ }, _callee4);
113
+ }));
114
+ return _editRemark.apply(this, arguments);
115
+ }
@@ -0,0 +1,22 @@
1
+ declare namespace Site {
2
+ interface BaseInfo {
3
+ dealerId: number;
4
+ weContactQrUrl: string;
5
+ referrerWeQrUrl: '';
6
+ isIDealer: boolean;
7
+ domain: string;
8
+ wechatAppId: string;
9
+ domainUserWeContactQrUrl: string;
10
+ dealerWeContactQrUrl: string;
11
+ adminWechatQr: string;
12
+ loginType: string[];
13
+ disabledOnlineBuy: string[];
14
+ icp: string;
15
+ domainTitle: string;
16
+ webTitle: string;
17
+ sitePause: {
18
+ isPause: boolean;
19
+ reason: string;
20
+ };
21
+ }
22
+ }
File without changes
@@ -0,0 +1,28 @@
1
+ declare namespace VipCard {
2
+ interface ListData {
3
+ list: List[];
4
+ pagination: Global.Pagination;
5
+ }
6
+ interface CreateOrder {
7
+ vipId: number;
8
+ codeCount: number;
9
+ }
10
+ interface List {
11
+ id: number;
12
+ idKey: string;
13
+ productName: string;
14
+ used: number;
15
+ remark: string;
16
+ }
17
+ interface ListQuery {
18
+ used: '' | '1' | '0';
19
+ targetTypeId: number;
20
+ keyword: string;
21
+ }
22
+ interface ListKind {
23
+ targetTypeId: number;
24
+ productType: string;
25
+ productName: string;
26
+ vipMonthTitle: string;
27
+ }
28
+ }
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "component-shipinlv",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "description": "",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",