component-shipinlv 1.0.19 → 1.0.20
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Client/ClientUpdate/index.d.ts +11 -0
- package/dist/Client/ClientUpdate/index.js +92 -0
- package/dist/Client/ClientUpdate/index.less +23 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/lib/Tool.d.ts +2 -2
- package/dist/lib/Tool.js +1 -1
- package/dist/service/api/ClientVersionController.d.ts +1 -0
- package/dist/service/api/ClientVersionController.js +27 -0
- package/dist/types/ClientUpdate.d.ts +3 -0
- package/dist/types/ClientUpdate.js +0 -0
- package/dist/types/ClientVersion.d.ts +17 -0
- package/dist/types/ClientVersion.js +0 -0
- package/dist/typings.d.ts +2 -0
- package/package.json +1 -1
@@ -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
|
+
}
|
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";
|
package/dist/lib/Tool.d.ts
CHANGED
@@ -157,11 +157,11 @@ declare const Tool: {
|
|
157
157
|
getTimeOffset(): any;
|
158
158
|
setTimeOffset(serverTime: number): void;
|
159
159
|
getTime(): number;
|
160
|
-
getOsName():
|
160
|
+
getOsName(): Global.OsName;
|
161
161
|
OsPathSeparator(): string;
|
162
162
|
getTitleByPath(path: string): string;
|
163
163
|
h5Pay(query: Pay.H5PayQuery): void;
|
164
|
-
notification(type: "
|
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
@@ -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
|
+
}
|
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;
|