component-shipinlv 1.1.8 → 1.1.9
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.
- package/dist/VideoPublish/index.d.ts +1 -1
- package/dist/VideoPublish/index.js +3 -3
- package/dist/VideoPublish/log/index.d.ts +1 -1
- package/dist/VideoPublish/log/index.js +2 -2
- package/dist/VideoPublish/publish-task-plan/index.d.ts +1 -1
- package/dist/VideoPublish/publish-task-plan/index.js +2 -2
- package/dist/VideoPublish/publish-task-plan/tool.d.ts +2 -2
- package/dist/VideoPublish/publish-task-plan/tool.js +3 -3
- package/dist/lib/request.js +105 -77
- package/dist/typings/VideoPublishVideoAccount.d.ts +1 -1
- package/dist/window.d.ts +2 -0
- package/package.json +1 -1
|
@@ -22,7 +22,7 @@ var VideoPublish = function VideoPublish(_ref) {
|
|
|
22
22
|
productType = _ref.productType,
|
|
23
23
|
apiUrl = _ref.apiUrl,
|
|
24
24
|
env = _ref.env,
|
|
25
|
-
|
|
25
|
+
clientIdentity = _ref.clientIdentity;
|
|
26
26
|
var _useState = useState([]),
|
|
27
27
|
_useState2 = _slicedToArray(_useState, 2),
|
|
28
28
|
menuList = _useState2[0],
|
|
@@ -100,7 +100,7 @@ var VideoPublish = function VideoPublish(_ref) {
|
|
|
100
100
|
forceRender: canPublish,
|
|
101
101
|
children: /*#__PURE__*/_jsx(VideoPublishLog, {
|
|
102
102
|
env: env,
|
|
103
|
-
|
|
103
|
+
clientIdentity: clientIdentity
|
|
104
104
|
})
|
|
105
105
|
}];
|
|
106
106
|
var _onMenu = function _onMenu(key) {
|
|
@@ -169,7 +169,7 @@ var VideoPublish = function VideoPublish(_ref) {
|
|
|
169
169
|
})]
|
|
170
170
|
}), /*#__PURE__*/_jsx(VideoPublishPublishVideoPlan, {
|
|
171
171
|
env: env,
|
|
172
|
-
|
|
172
|
+
clientIdentity: clientIdentity
|
|
173
173
|
})]
|
|
174
174
|
});
|
|
175
175
|
};
|
|
@@ -14,7 +14,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
14
14
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
15
|
var MaxLine = 10000;
|
|
16
16
|
var VideoPublishLog = function VideoPublishLog(_ref) {
|
|
17
|
-
var
|
|
17
|
+
var clientIdentity = _ref.clientIdentity,
|
|
18
18
|
env = _ref.env;
|
|
19
19
|
var _useState = useState(0),
|
|
20
20
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -52,7 +52,7 @@ var VideoPublishLog = function VideoPublishLog(_ref) {
|
|
|
52
52
|
case 'not-login':
|
|
53
53
|
// 上报
|
|
54
54
|
VideoPublishVideoAccountController.saveLoginStatus({
|
|
55
|
-
|
|
55
|
+
clientIdentity: clientIdentity,
|
|
56
56
|
platformVideoAccountId: data.platformAccountId,
|
|
57
57
|
platform: data.platform,
|
|
58
58
|
isLogin: false,
|
|
@@ -4,9 +4,9 @@ import PublishTaskPlanClass from "./tool";
|
|
|
4
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
5
|
var VideoPublishPublishVideoPlan = function VideoPublishPublishVideoPlan(_ref) {
|
|
6
6
|
var env = _ref.env,
|
|
7
|
-
|
|
7
|
+
clientIdentity = _ref.clientIdentity;
|
|
8
8
|
useEffect(function () {
|
|
9
|
-
var publishTaskPlan = new PublishTaskPlanClass(env,
|
|
9
|
+
var publishTaskPlan = new PublishTaskPlanClass(env, clientIdentity);
|
|
10
10
|
publishTaskPlan.onInit();
|
|
11
11
|
}, []);
|
|
12
12
|
return /*#__PURE__*/_jsx("div", {
|
|
@@ -2,8 +2,8 @@ declare class PublishTaskPlanClass {
|
|
|
2
2
|
timeLoopMillisecond: number;
|
|
3
3
|
isPublishing: boolean;
|
|
4
4
|
env: Global.Env | undefined;
|
|
5
|
-
|
|
6
|
-
constructor(env?: Global.Env,
|
|
5
|
+
clientIdentity: string;
|
|
6
|
+
constructor(env?: Global.Env, clientIdentity?: string);
|
|
7
7
|
onInit(): void;
|
|
8
8
|
getWork(): Promise<void>;
|
|
9
9
|
doWork(taskDetail: PublishTaskPlan.TaskDetail): Promise<void>;
|
|
@@ -10,14 +10,14 @@ import event from "../../lib/event";
|
|
|
10
10
|
import AccountManageSettingConfig from "../../lib/accountManageSettingConfig";
|
|
11
11
|
var PublishTaskPlanClass = /*#__PURE__*/function () {
|
|
12
12
|
function PublishTaskPlanClass(env) {
|
|
13
|
-
var
|
|
13
|
+
var clientIdentity = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
14
14
|
_classCallCheck(this, PublishTaskPlanClass);
|
|
15
15
|
_defineProperty(this, "timeLoopMillisecond", 15 * 1e3);
|
|
16
16
|
_defineProperty(this, "isPublishing", false);
|
|
17
17
|
_defineProperty(this, "env", '');
|
|
18
|
-
_defineProperty(this, "
|
|
18
|
+
_defineProperty(this, "clientIdentity", '');
|
|
19
19
|
this.env = env;
|
|
20
|
-
this.
|
|
20
|
+
this.clientIdentity = clientIdentity;
|
|
21
21
|
}
|
|
22
22
|
_createClass(PublishTaskPlanClass, [{
|
|
23
23
|
key: "onInit",
|
package/dist/lib/request.js
CHANGED
|
@@ -1,91 +1,119 @@
|
|
|
1
|
+
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
1
2
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
4
|
// 二次封装 hooks request ;
|
|
3
5
|
// 参数详见:https://github.com/umijs/umi-request/blob/master/README_zh-CN.md
|
|
4
6
|
import request from 'umi-request';
|
|
5
7
|
import getApiUrl, { getApiEnv, getMainPort } from "./getApiUrl";
|
|
6
8
|
import goAuth from "./goAuth";
|
|
7
9
|
import Tool from "./Tool";
|
|
8
|
-
var requestApi = function
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
var requestApi = /*#__PURE__*/function () {
|
|
11
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
12
|
+
var _window$getClientIden, _window;
|
|
13
|
+
var api,
|
|
14
|
+
options,
|
|
15
|
+
url,
|
|
16
|
+
userInfo,
|
|
17
|
+
token,
|
|
18
|
+
postUrl,
|
|
19
|
+
clientIdentity,
|
|
20
|
+
env,
|
|
21
|
+
pageUrl,
|
|
22
|
+
_args = arguments;
|
|
23
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
24
|
+
while (1) switch (_context.prev = _context.next) {
|
|
25
|
+
case 0:
|
|
26
|
+
api = _args.length > 0 && _args[0] !== undefined ? _args[0] : '';
|
|
27
|
+
options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
|
|
28
|
+
// 要请求的 url
|
|
29
|
+
url = getApiUrl(api, options === null || options === void 0 ? void 0 : options.env);
|
|
30
|
+
console.log('makeAjax int 20 111 url:', url, options);
|
|
15
31
|
|
|
16
|
-
|
|
32
|
+
// const params = options.method === 'GET' ? options.data : {};
|
|
33
|
+
userInfo = Tool.getLocalUserInfo();
|
|
34
|
+
token = userInfo.sid;
|
|
35
|
+
postUrl = url + (url.indexOf('?') === -1 ? '?' : '&') + '_token_=' + token; // clientId
|
|
36
|
+
_context.next = 9;
|
|
37
|
+
return (_window$getClientIden = (_window = window).getClientIdentity) === null || _window$getClientIden === void 0 ? void 0 : _window$getClientIden.call(_window).catch(function (err) {
|
|
38
|
+
return '';
|
|
39
|
+
});
|
|
40
|
+
case 9:
|
|
41
|
+
clientIdentity = _context.sent;
|
|
42
|
+
postUrl += "&clientIdentity=".concat(clientIdentity);
|
|
17
43
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
// clientId
|
|
23
|
-
postUrl += "&clientUniqueKey=".concat(((_window$getBridge = (_window = window).getBridge) === null || _window$getBridge === void 0 || (_window$getBridge$cal = (_window$getBridge$cal2 = _window$getBridge.call(_window)).getClientUniqueKey) === null || _window$getBridge$cal === void 0 ? void 0 : _window$getBridge$cal.call(_window$getBridge$cal2)) || '');
|
|
24
|
-
|
|
25
|
-
// 追加环境参数
|
|
26
|
-
var env = getApiEnv(options === null || options === void 0 ? void 0 : options.env);
|
|
27
|
-
if (env !== 'prod') {
|
|
28
|
-
postUrl += "&_env=".concat(env);
|
|
29
|
-
}
|
|
30
|
-
var pageUrl = document.location.href;
|
|
31
|
-
return new Promise(function (resolve, reject) {
|
|
32
|
-
var requestData = request(postUrl, _objectSpread(_objectSpread({}, options), {}, {
|
|
33
|
-
timeout: options.timeout || 15e3
|
|
34
|
-
// requestType: options.payload === false ? 'form' : 'json',
|
|
35
|
-
// onSuccess( data: ApiResult ){
|
|
36
|
-
// console.log('ajax 1:', data );
|
|
37
|
-
// if( ! data?.success ){
|
|
38
|
-
// const error = new Error( data.message || '发生了一些问题' );
|
|
39
|
-
// error.name = 'api-not-success';
|
|
40
|
-
// throw error;
|
|
41
|
-
// }
|
|
42
|
-
// options.onSuccess( data );
|
|
43
|
-
// },
|
|
44
|
-
}));
|
|
45
|
-
|
|
46
|
-
requestData.then(function () {
|
|
47
|
-
var result = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
48
|
-
console.log('ajax requestData then:', result);
|
|
49
|
-
if (result.success) {
|
|
50
|
-
resolve(result.data || true);
|
|
51
|
-
} else {
|
|
52
|
-
var error = new Error((result === null || result === void 0 ? void 0 : result.message) || '发生了一些问题,请稍后重试');
|
|
53
|
-
error.name = result.code;
|
|
54
|
-
error.stack = result.data;
|
|
55
|
-
if (['staff-not-login', 'not-login'].includes((result === null || result === void 0 ? void 0 : result.code) || '')) {
|
|
56
|
-
// 未登录,跳走;
|
|
57
|
-
goAuth(result.authType);
|
|
58
|
-
reject(error);
|
|
59
|
-
} else {
|
|
60
|
-
onError(pageUrl, url, error.message, JSON.stringify(error), options === null || options === void 0 ? void 0 : options.silent);
|
|
61
|
-
reject(error);
|
|
62
|
-
if (!(options !== null && options !== void 0 && options.silent)) {
|
|
63
|
-
Tool.toastError(result.message);
|
|
44
|
+
// 追加环境参数
|
|
45
|
+
env = getApiEnv(options === null || options === void 0 ? void 0 : options.env);
|
|
46
|
+
if (env !== 'prod') {
|
|
47
|
+
postUrl += "&_env=".concat(env);
|
|
64
48
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
49
|
+
pageUrl = document.location.href;
|
|
50
|
+
return _context.abrupt("return", new Promise(function (resolve, reject) {
|
|
51
|
+
var requestData = request(postUrl, _objectSpread(_objectSpread({}, options), {}, {
|
|
52
|
+
timeout: options.timeout || 15e3
|
|
53
|
+
// requestType: options.payload === false ? 'form' : 'json',
|
|
54
|
+
// onSuccess( data: ApiResult ){
|
|
55
|
+
// console.log('ajax 1:', data );
|
|
56
|
+
// if( ! data?.success ){
|
|
57
|
+
// const error = new Error( data.message || '发生了一些问题' );
|
|
58
|
+
// error.name = 'api-not-success';
|
|
59
|
+
// throw error;
|
|
60
|
+
// }
|
|
61
|
+
// options.onSuccess( data );
|
|
62
|
+
// },
|
|
63
|
+
}));
|
|
64
|
+
|
|
65
|
+
requestData.then(function () {
|
|
66
|
+
var result = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
67
|
+
console.log('ajax requestData then:', result);
|
|
68
|
+
if (result.success) {
|
|
69
|
+
resolve(result.data || true);
|
|
70
|
+
} else {
|
|
71
|
+
var error = new Error((result === null || result === void 0 ? void 0 : result.message) || '发生了一些问题,请稍后重试');
|
|
72
|
+
error.name = result.code;
|
|
73
|
+
error.stack = result.data;
|
|
74
|
+
if (['staff-not-login', 'not-login'].includes((result === null || result === void 0 ? void 0 : result.code) || '')) {
|
|
75
|
+
// 未登录,跳走;
|
|
76
|
+
goAuth(result.authType);
|
|
77
|
+
reject(error);
|
|
78
|
+
} else {
|
|
79
|
+
onError(pageUrl, url, error.message, JSON.stringify(error), options === null || options === void 0 ? void 0 : options.silent);
|
|
80
|
+
reject(error);
|
|
81
|
+
if (!(options !== null && options !== void 0 && options.silent)) {
|
|
82
|
+
Tool.toastError(result.message);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}).catch(function (err) {
|
|
87
|
+
var _err, _err2;
|
|
88
|
+
console.log('ajax error:', err.name, err.message, err);
|
|
89
|
+
if (!err) {
|
|
90
|
+
err = new Error();
|
|
91
|
+
}
|
|
92
|
+
console.log('request component shipinlv:', JSON.stringify(err), url);
|
|
93
|
+
if (!((_err = err) !== null && _err !== void 0 && _err.response) && url.indexOf("http://127.0.0.1:".concat(getMainPort())) === 0) {
|
|
94
|
+
err.name = "shipinlv-client-not-run";
|
|
95
|
+
err.message = "\u8FDE\u63A5\u672C\u5730\u670D\u52A1\u5931\u8D25\uFF0C\u8BF7\u5C1D\u8BD5\u91CD\u542F\u8F6F\u4EF6";
|
|
96
|
+
reject(err);
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
if (['Failed to fetch', 'http error'].includes((_err2 = err) === null || _err2 === void 0 ? void 0 : _err2.message)) {
|
|
100
|
+
err.message = '发生了一些问题,请稍后重试';
|
|
101
|
+
}
|
|
102
|
+
Tool.toastError(err.message);
|
|
103
|
+
onError(pageUrl, url, err.message, JSON.stringify(err), options === null || options === void 0 ? void 0 : options.silent);
|
|
104
|
+
reject(err);
|
|
105
|
+
});
|
|
106
|
+
}));
|
|
107
|
+
case 15:
|
|
108
|
+
case "end":
|
|
109
|
+
return _context.stop();
|
|
82
110
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
};
|
|
111
|
+
}, _callee);
|
|
112
|
+
}));
|
|
113
|
+
return function requestApi() {
|
|
114
|
+
return _ref.apply(this, arguments);
|
|
115
|
+
};
|
|
116
|
+
}();
|
|
89
117
|
var onError = function onError(pageUrl) {
|
|
90
118
|
var _window2;
|
|
91
119
|
var apiUrl = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
package/dist/window.d.ts
CHANGED