component-shipinlv 0.1.21 → 0.1.25

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  import PostMessage from "../lib/postMessage";
2
2
  var Login = function Login() {
3
- PostMessage('login');
3
+ PostMessage('need-login');
4
4
  };
5
5
  export default Login;
@@ -88,6 +88,7 @@ var VipList = function VipList(_ref) {
88
88
  var _useRequest = useRequest(function () {
89
89
  return VipPowerController.list({
90
90
  productType: productType,
91
+ domain: document.location.hostname,
91
92
  dealerId: Tool.getLocalSiteInfo().dealerId || 0
92
93
  }, {
93
94
  env: env
@@ -1,16 +1,11 @@
1
1
  /// <reference types="react" />
2
2
  import { useRequest } from '@umijs/hooks';
3
- interface EventItem {
4
- name: string;
5
- fn: (data?: any) => void;
6
- }
7
3
  declare const Tool: {
8
4
  event: {
9
5
  run(name: string, data?: any): void;
10
6
  on(name: string, fn: (data: any) => void, isGlobalOnly?: boolean): void;
11
7
  one(name: string, fn: (data: any) => void): void;
12
8
  off(name: string): void;
13
- events: EventItem[];
14
9
  };
15
10
  formatTime(time: number | string, format?: string): string;
16
11
  openWindow(url: string): Promise<void>;
@@ -163,7 +158,7 @@ declare const Tool: {
163
158
  setTimeOffset(serverTime: number): void;
164
159
  getTime(): number;
165
160
  h5Pay(query: Pay.H5PayQuery): void;
166
- 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;
167
162
  notificationSuccess(message: string, description?: import("react").ReactNode, options?: NotificationOptions): void;
168
163
  notificationError(message: string, description?: import("react").ReactNode, options?: NotificationOptions): void;
169
164
  notificationWarning(message: string, description?: import("react").ReactNode, options?: NotificationOptions): void;
package/dist/lib/Tool.js CHANGED
@@ -116,7 +116,7 @@ var Tool = _objectSpread(_objectSpread({
116
116
  if (!name) {
117
117
  return;
118
118
  }
119
- this.events.forEach(function (item) {
119
+ window.__events.forEach(function (item) {
120
120
  // 命中 子集事件
121
121
  if (item.name === name || "".concat(item.name, ".").indexOf(name) === 0) {
122
122
  item.fn(data);
@@ -130,12 +130,12 @@ var Tool = _objectSpread(_objectSpread({
130
130
  name: name,
131
131
  fn: fn
132
132
  };
133
- this.events.push(eventItem);
133
+ window.__events.push(eventItem);
134
134
  },
135
135
  // 只绑定一次,但会运行多次;
136
136
  one: function one(name, fn) {
137
137
  var isBind = false;
138
- this.events.forEach(function (items) {
138
+ window.__events.forEach(function (items) {
139
139
  if (items.name === name) {
140
140
  isBind = true;
141
141
  }
@@ -148,8 +148,7 @@ var Tool = _objectSpread(_objectSpread({
148
148
  },
149
149
  // 删除事件
150
150
  off: function off(name) {
151
- var _this = this;
152
- this.events.forEach(function (item, index) {
151
+ window.__events.forEach(function (item, index) {
153
152
  var isDel;
154
153
  // 匹配到子集事件
155
154
  if ("".concat(item.name, ".").indexOf(name) > -1) {
@@ -160,12 +159,11 @@ var Tool = _objectSpread(_objectSpread({
160
159
  }
161
160
  if (isDel) {
162
161
  item.fn = function () {};
163
- _this.events.splice(index, 1);
162
+ window.__events.splice(index, 1);
164
163
  }
165
164
  });
166
- },
167
- // 记录
168
- events: []
165
+ } // 记录
166
+ // events: [] as EventItem[],
169
167
  },
170
168
  formatTime: function formatTime(time) {
171
169
  var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'YYYY-MM-DD HH:mm:ss';
@@ -180,7 +178,7 @@ var Tool = _objectSpread(_objectSpread({
180
178
  return moment(time).format(format);
181
179
  },
182
180
  openWindow: function openWindow(url) {
183
- var _this2 = this;
181
+ var _this = this;
184
182
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
185
183
  var $link;
186
184
  return _regeneratorRuntime().wrap(function _callee$(_context) {
@@ -192,7 +190,7 @@ var Tool = _objectSpread(_objectSpread({
192
190
  document.body.append($link);
193
191
  $link.click();
194
192
  _context.next = 7;
195
- return _this2.sleep(500);
193
+ return _this.sleep(500);
196
194
  case 7:
197
195
  $link.remove();
198
196
  case 8:
@@ -1053,7 +1051,7 @@ var Tool = _objectSpread(_objectSpread({
1053
1051
  });
1054
1052
  },
1055
1053
  onLogin: function onLogin() {
1056
- return PostMessage('login');
1054
+ return PostMessage('need-login');
1057
1055
  },
1058
1056
  getObjectURL: function getObjectURL(file) {
1059
1057
  var _window5, _window6;
@@ -1104,15 +1102,14 @@ var Tool = _objectSpread(_objectSpread({
1104
1102
  });
1105
1103
 
1106
1104
  //
1107
- // if( window ){
1108
- // if ( !window?._GData) {
1109
- // window._GData = {};
1110
- // }
1111
- //
1112
- // Tool.GData = window._GData;
1113
- //
1114
- // window._Tool = Tool;
1115
- // }
1105
+ if (window) {
1106
+ // if ( !window?._GData) {
1107
+ // window._GData = {};
1108
+ // }
1109
+ //
1110
+ // Tool.GData = window._GData;
1116
1111
 
1112
+ window._Tool = Tool;
1113
+ }
1117
1114
  Tool.onWindowError();
1118
1115
  export default Tool;
@@ -2,7 +2,7 @@ import PostMessage from "./postMessage";
2
2
  export default function goAuth() {
3
3
  var authType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
4
4
  // Tool.go(`${ authType }/auth`);
5
- return PostMessage('login');
5
+ return PostMessage('need-login');
6
6
  // return;
7
7
  // if( window._openAuth_ ){
8
8
  // return Promise.reject( false );
@@ -1,3 +1,3 @@
1
- type PostMessage = 'login' | 'menu';
1
+ type PostMessage = 'need-login' | 'menu';
2
2
  declare const PostMessage: (type: PostMessage, data?: any) => void;
3
3
  export default PostMessage;
@@ -1,4 +1,5 @@
1
1
  export declare function list(body: {
2
2
  productType: string;
3
+ domain: string;
3
4
  dealerId: number;
4
5
  }, options?: ServicesApi.RequestOptions): Promise<VipPower.ListResult>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "component-shipinlv",
3
- "version": "0.1.21",
3
+ "version": "0.1.25",
4
4
  "description": "",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",