component-shipinlv 1.0.18 → 1.0.20

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ interface Props {
4
+ productType: string;
5
+ versionReal: number;
6
+ awaitSecond?: number;
7
+ env?: Global.Env;
8
+ onOpenUrl: (url: string) => void;
9
+ }
10
+ declare const ClientUpdate: React.FC<Props>;
11
+ export default ClientUpdate;
@@ -0,0 +1,92 @@
1
+ import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
2
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
3
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4
+ import React, { useEffect, useState } from 'react';
5
+ import "./index.less";
6
+ import { CaretRightOutlined } from '@ant-design/icons';
7
+ import Tool from "../../lib/Tool";
8
+ import { useRequest } from "@umijs/hooks";
9
+ import * as ClientVersionController from "../../service/api/ClientVersionController";
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
+ import { jsxs as _jsxs } from "react/jsx-runtime";
12
+ var ClientUpdate = function ClientUpdate(_ref) {
13
+ var productType = _ref.productType,
14
+ _ref$versionReal = _ref.versionReal,
15
+ versionReal = _ref$versionReal === void 0 ? 0 : _ref$versionReal,
16
+ _ref$awaitSecond = _ref.awaitSecond,
17
+ awaitSecond = _ref$awaitSecond === void 0 ? 5e3 : _ref$awaitSecond,
18
+ env = _ref.env,
19
+ _ref$onOpenUrl = _ref.onOpenUrl,
20
+ onOpenUrl = _ref$onOpenUrl === void 0 ? function () {} : _ref$onOpenUrl;
21
+ var _useState = useState({
22
+ title: '',
23
+ content: '',
24
+ versionReal: 0,
25
+ version: '',
26
+ url: '',
27
+ needUpdate: false,
28
+ created: 0
29
+ }),
30
+ _useState2 = _slicedToArray(_useState, 2),
31
+ clientVersion = _useState2[0],
32
+ setClientVersion = _useState2[1];
33
+ var _useState3 = useState(''),
34
+ _useState4 = _slicedToArray(_useState3, 2),
35
+ upStatus = _useState4[0],
36
+ setUpStatus = _useState4[1];
37
+ var _useRequest = useRequest(function (data) {
38
+ return ClientVersionController.check(data, {
39
+ env: env
40
+ });
41
+ }, {
42
+ manual: true,
43
+ onSuccess: function onSuccess(result) {
44
+ setClientVersion(result);
45
+ if (result.needUpdate) {
46
+ setUpStatus('available');
47
+ }
48
+ }
49
+ }),
50
+ run = _useRequest.run;
51
+ var onGoDown = function onGoDown() {
52
+ var siteInfo = Tool.getLocalSiteInfo();
53
+ var domain = siteInfo.domain || document.location.hostname;
54
+ var url = "".concat(document.location.protocol, "//").concat(domain, "/product/").concat(productType);
55
+ onOpenUrl(url);
56
+ };
57
+ var onInit = /*#__PURE__*/function () {
58
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
59
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
60
+ while (1) switch (_context.prev = _context.next) {
61
+ case 0:
62
+ _context.next = 2;
63
+ return Tool.sleep(awaitSecond);
64
+ case 2:
65
+ run({
66
+ versionReal: versionReal,
67
+ domain: document.location.hostname,
68
+ osType: Tool.getOsName(),
69
+ productType: productType
70
+ });
71
+ case 3:
72
+ case "end":
73
+ return _context.stop();
74
+ }
75
+ }, _callee);
76
+ }));
77
+ return function onInit() {
78
+ return _ref2.apply(this, arguments);
79
+ };
80
+ }();
81
+ useEffect(function () {
82
+ onInit();
83
+ }, []);
84
+ return /*#__PURE__*/_jsx("div", {
85
+ className: "clientUpdate",
86
+ children: upStatus === 'available' && /*#__PURE__*/_jsxs("a", {
87
+ onClick: onGoDown,
88
+ children: [/*#__PURE__*/_jsx(CaretRightOutlined, {}), " \u65B0\u7248\u672C"]
89
+ })
90
+ });
91
+ };
92
+ export default ClientUpdate;
@@ -0,0 +1,23 @@
1
+ .clientUpdate{
2
+ a{
3
+ cursor: pointer;
4
+ background-color: #F60;
5
+ color: #FFF;
6
+ padding: 1px 5px;
7
+ line-height: 1em;
8
+ border-radius: 3px;
9
+ animation: icon-change 3s ease-in-out infinite;
10
+ }
11
+ }
12
+
13
+ @keyframes icon-change {
14
+ 0%{
15
+ background-color: #F60;
16
+ }
17
+ 50%{
18
+ background-color: #333;
19
+ }
20
+ 100%{
21
+ background-color: #F60;
22
+ }
23
+ }
@@ -18,7 +18,9 @@ var DialogDrawer = function DialogDrawer(props) {
18
18
  width: 400,
19
19
  maskClosable: false,
20
20
  onClose: function onClose() {},
21
- bgTheme: '' // 'light' , "",
21
+ bgTheme: '',
22
+ // 'light' , "",
23
+ destroyOnClose: true
22
24
  }, props);
23
25
 
24
26
  // 宽度
package/dist/index.d.ts CHANGED
@@ -7,6 +7,7 @@ export { default as Auth } from './Auth';
7
7
  export { default as Product } from './Product';
8
8
  export { default as JoinClient } from './join-client';
9
9
  export { default as renewalVip } from './renewal-vip';
10
+ export { default as ClientUpdate } from './Client/ClientUpdate';
10
11
  export { default as VipList } from './VipList';
11
12
  export { default as VideoPublish } from './VideoPublish';
12
13
  export { default as VideoPublishCreateTask } from './VideoPublish/creat-task';
package/dist/index.js CHANGED
@@ -9,6 +9,7 @@ export { default as Auth } from "./Auth";
9
9
  export { default as Product } from "./Product";
10
10
  export { default as JoinClient } from "./join-client";
11
11
  export { default as renewalVip } from "./renewal-vip";
12
+ export { default as ClientUpdate } from "./Client/ClientUpdate";
12
13
  export { default as VipList } from "./VipList";
13
14
  export { default as VideoPublish } from "./VideoPublish";
14
15
  export { default as VideoPublishCreateTask } from "./VideoPublish/creat-task";
@@ -157,11 +157,11 @@ declare const Tool: {
157
157
  getTimeOffset(): any;
158
158
  setTimeOffset(serverTime: number): void;
159
159
  getTime(): number;
160
- getOsName(): "windows" | "darwin" | "ios" | "android" | "linux" | "Unknown OS";
160
+ getOsName(): Global.OsName;
161
161
  OsPathSeparator(): string;
162
162
  getTitleByPath(path: string): string;
163
163
  h5Pay(query: Pay.H5PayQuery): void;
164
- notification(type: "error" | "info" | "success" | "warning", message: string, description?: import("react").ReactNode, options?: NotificationOptions): void;
164
+ notification(type: "success" | "info" | "warning" | "error", message: string, description?: import("react").ReactNode, options?: NotificationOptions): void;
165
165
  notificationSuccess(message: string, description?: import("react").ReactNode, options?: NotificationOptions): void;
166
166
  notificationError(message: string, description?: import("react").ReactNode, options?: NotificationOptions): void;
167
167
  notificationWarning(message: string, description?: import("react").ReactNode, options?: NotificationOptions): void;
package/dist/lib/Tool.js CHANGED
@@ -1124,7 +1124,7 @@ var Tool = _objectSpread(_objectSpread({
1124
1124
  }
1125
1125
 
1126
1126
  // 未知操作系统
1127
- return "Unknown OS";
1127
+ return "other";
1128
1128
  },
1129
1129
  OsPathSeparator: function OsPathSeparator() {
1130
1130
  if (this.getOsName() === 'windows') {
@@ -0,0 +1 @@
1
+ export declare function check(body: ClientVersion.UpdateQuery, options?: Global.RequestOptions): Promise<ClientVersion.UpdateData>;
@@ -0,0 +1,27 @@
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 check(_x, _x2) {
6
+ return _check.apply(this, arguments);
7
+ }
8
+ function _check() {
9
+ _check = _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("client/version/check", _objectSpread({
14
+ method: 'GET',
15
+ headers: {
16
+ 'Content-Type': 'application/json'
17
+ },
18
+ params: body
19
+ }, options || {})));
20
+ case 1:
21
+ case "end":
22
+ return _context.stop();
23
+ }
24
+ }, _callee);
25
+ }));
26
+ return _check.apply(this, arguments);
27
+ }
@@ -0,0 +1,3 @@
1
+ declare namespace ClientUpdate {
2
+ type UpStatus = '' | 'available' | 'down-progress' | 'down-success' | 'error';
3
+ }
File without changes
@@ -0,0 +1,17 @@
1
+ declare namespace ClientVersion {
2
+ interface UpdateQuery {
3
+ versionReal: string | number;
4
+ domain: string;
5
+ osType: Global.OsName;
6
+ productType: string;
7
+ }
8
+ interface UpdateData {
9
+ title: string;
10
+ content: string;
11
+ versionReal: number;
12
+ version: string;
13
+ url: string;
14
+ needUpdate: boolean;
15
+ created: number;
16
+ }
17
+ }
File without changes
package/dist/typings.d.ts CHANGED
@@ -2,6 +2,8 @@ declare namespace Global {
2
2
  export type Env = 'local' | 'pre' | 'prod';
3
3
  type AuthClientLoginType = 'wechat' | 'account-login' | 'account-reg' | 'alipay';
4
4
  export type ProductKind = 'vip' | 'vip-card' | string;
5
+ type OsName = '' | 'darwin' | 'windows' | 'linux' | 'other';
6
+
5
7
  type VideoPlatformKind = string;
6
8
  interface RequestResult{
7
9
  code: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "component-shipinlv",
3
- "version": "1.0.18",
3
+ "version": "1.0.20",
4
4
  "description": "",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",