component-shipinlv 1.1.27 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. package/dist/VideoPublish/account-manage/home.js +25 -4
  2. package/dist/VideoPublish/account-manage/list.d.ts +1 -0
  3. package/dist/VideoPublish/account-manage/list.js +69 -24
  4. package/dist/VideoPublish/account-manage/setting/index.js +43 -4
  5. package/dist/VideoPublish/log/index.js +90 -44
  6. package/dist/VideoPublish/log/index.less +1 -1
  7. package/dist/VideoPublish/publish-task-plan/index.js +14 -2
  8. package/dist/VideoPublish/publish-task-plan/tool-bak.txt +219 -0
  9. package/dist/VideoPublish/publish-task-plan/tool.d.ts +14 -4
  10. package/dist/VideoPublish/publish-task-plan/tool.js +302 -83
  11. package/dist/VideoPublish/video-account/index.js +5 -2
  12. package/dist/base/folderCreate.d.ts +2 -0
  13. package/dist/base/folderCreate.js +56 -0
  14. package/dist/component/folder-select.d.ts +1 -0
  15. package/dist/component/folder-select.js +46 -12
  16. package/dist/component/param.d.ts +5 -0
  17. package/dist/component/param.js +9 -0
  18. package/dist/component/sse.d.ts +11 -0
  19. package/dist/component/sse.js +66 -0
  20. package/dist/component/video-platform/logo.js +4 -2
  21. package/dist/index.d.ts +1 -0
  22. package/dist/index.js +1 -0
  23. package/dist/lib/Tool.d.ts +1 -1
  24. package/dist/lib/Tool.js +3 -2
  25. package/dist/lib/event.js +2 -2
  26. package/dist/lib/getApiUrl.d.ts +1 -0
  27. package/dist/lib/getApiUrl.js +9 -1
  28. package/dist/lib/openChrome.d.ts +2 -0
  29. package/dist/lib/openChrome.js +141 -0
  30. package/dist/lib/request.js +1 -1
  31. package/dist/lib/user-agent.d.ts +2 -0
  32. package/dist/lib/user-agent.js +10 -0
  33. package/dist/lib/video-api/open-chrome.d.ts +2 -0
  34. package/dist/lib/video-api/open-chrome.js +49 -0
  35. package/dist/lib/video-api/quit-chrome.d.ts +2 -0
  36. package/dist/lib/video-api/quit-chrome.js +51 -0
  37. package/dist/service/local/FileController.d.ts +3 -0
  38. package/dist/service/local/FileController.js +59 -32
  39. package/dist/service/video-api/VideoApiOpenChromeController.d.ts +2 -0
  40. package/dist/service/video-api/VideoApiOpenChromeController.js +50 -0
  41. package/dist/types/ApiLocal.d.ts +19 -0
  42. package/dist/types/ApiLocal.js +0 -0
  43. package/dist/types/ChromeOperate.d.ts +22 -0
  44. package/dist/types/ChromeOperate.js +0 -0
  45. package/dist/types/PublishTaskPlan.d.ts +7 -1
  46. package/dist/types/PublishVideo.d.ts +11 -0
  47. package/dist/types/PublishVideo.js +0 -0
  48. package/dist/types/VideoPublishLog.d.ts +4 -1
  49. package/dist/typings/LocalFile.d.ts +3 -0
  50. package/dist/typings/VideoPublishAccountManageSetting.d.ts +1 -0
  51. package/dist/typings/VideoPublishVideoAccount.d.ts +3 -0
  52. package/dist/window.d.ts +1 -0
  53. package/package.json +1 -1
@@ -7,6 +7,8 @@ import HomePageAccountList from "./list";
7
7
  import Time from "../../UI/Time";
8
8
  import { IeOutlined } from "@ant-design/icons";
9
9
  import Tool from "../../lib/Tool";
10
+ import openChrome from "../../lib/openChrome";
11
+ import AccountManageSettingConfig from "../../lib/accountManageSettingConfig";
10
12
  import { jsx as _jsx } from "react/jsx-runtime";
11
13
  import { Fragment as _Fragment } from "react/jsx-runtime";
12
14
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -35,6 +37,7 @@ var VideoPublishAccountManageHomePage = function VideoPublishAccountManageHomePa
35
37
  videoCount: 0,
36
38
  created: 0,
37
39
  updated: 0,
40
+ chromeProfileName: '',
38
41
  proxyInfo: {}
39
42
  }),
40
43
  _useState2 = _slicedToArray(_useState, 2),
@@ -89,16 +92,33 @@ var VideoPublishAccountManageHomePage = function VideoPublishAccountManageHomePa
89
92
  openMenuItems = _useState4[0],
90
93
  setOpenMenuItems = _useState4[1];
91
94
  var onOpen = function onOpen(url) {
92
- var _window$getBridge;
93
- (_window$getBridge = window.getBridge()) === null || _window$getBridge === void 0 || _window$getBridge.openVideoAccountBrowser(accountDetail.platform, '', accountDetail.accountId, url, accountDetail.proxyInfo);
94
- Tool.toast('正在打开浏览器, 请稍等...', 8);
95
+ // window.getBridge()?.openVideoAccountBrowser(
96
+ // accountDetail.platform,
97
+ // '',
98
+ // accountDetail.accountId,
99
+ // url,
100
+ // accountDetail.proxyInfo,
101
+ // );
102
+ var settingConfig = AccountManageSettingConfig();
103
+ openChrome({
104
+ action: 'view',
105
+ platform: accountDetail.platform,
106
+ platformAccountId: accountDetail.accountId,
107
+ nickname: accountDetail.nickname,
108
+ chromeProfileName: accountDetail.chromeProfileName,
109
+ taskId: 0,
110
+ url: url,
111
+ proxyInfo: accountDetail.proxyInfo,
112
+ isOpen: true
113
+ }, false);
114
+ Tool.toast('正在打开浏览器, 请稍等...', 12);
95
115
  };
96
116
  var onOpenMenuItems = function onOpenMenuItems(platform) {
97
117
  switch (platform) {
98
118
  case 'douyin':
99
119
  setOpenMenuItems([{
100
120
  label: '创作者中心(发视频)',
101
- key: 'https://creator.douyin.com/creator-micro/home'
121
+ key: 'https://creator.douyin.com/'
102
122
  }]);
103
123
  break;
104
124
  case 'tiktok':
@@ -114,6 +134,7 @@ var VideoPublishAccountManageHomePage = function VideoPublishAccountManageHomePa
114
134
  children: [/*#__PURE__*/_jsx(HomePageAccountList, {
115
135
  apiUrl: apiUrl,
116
136
  env: env,
137
+ currentAccountDetail: accountDetail,
117
138
  onListData: function onListData(list) {
118
139
  // accountListDataRef.current = list;
119
140
  // setAccountListData( list )
@@ -3,6 +3,7 @@ import './list.less';
3
3
  interface Props {
4
4
  apiUrl: string;
5
5
  env?: Global.Env;
6
+ currentAccountDetail: VideoPublishVideoAccount.List;
6
7
  onMenu: (key: string) => void;
7
8
  onListData: (list: VideoPublishVideoAccount.List[]) => void;
8
9
  onCurrent: (detail: VideoPublishVideoAccount.List) => void;
@@ -15,7 +15,6 @@ import getLocalUserInfo from "../../lib/getLocalUserInfo";
15
15
  import event from "../../lib/event";
16
16
  import { VideoPlatformList } from "../../component/video-platform/logo";
17
17
  import toast from "../../lib/toast";
18
- import Notification from "../../lib/notification";
19
18
  import Money from "../../UI/Money";
20
19
  import AccountManageSettingConfig from "../../lib/accountManageSettingConfig";
21
20
  import VideoPlatform from "../../component/video-platform/logo";
@@ -23,6 +22,8 @@ import isInstalledChrome from "../../component/is-installed-chrome";
23
22
  import Tool from "../../lib/Tool";
24
23
  import VideoPublishVideoAccountBaseInfo from "../video-account/base-info";
25
24
  import VideoPublishVideoAccountProxySelect from "../proxy/select";
25
+ import notification from "../../lib/notification";
26
+ import openChrome from "../../lib/openChrome";
26
27
  import { jsx as _jsx } from "react/jsx-runtime";
27
28
  import { jsxs as _jsxs } from "react/jsx-runtime";
28
29
  import { Fragment as _Fragment } from "react/jsx-runtime";
@@ -33,6 +34,7 @@ var HomePageAccountList = function HomePageAccountList(_ref) {
33
34
  onMenu = _ref$onMenu === void 0 ? function () {} : _ref$onMenu,
34
35
  _ref$onListData = _ref.onListData,
35
36
  onListData = _ref$onListData === void 0 ? function () {} : _ref$onListData,
37
+ currentAccountDetail = _ref.currentAccountDetail,
36
38
  _ref$onCurrent = _ref.onCurrent,
37
39
  onCurrent = _ref$onCurrent === void 0 ? function () {} : _ref$onCurrent;
38
40
  var _useState = useState(getLocalUserInfo()),
@@ -136,6 +138,7 @@ var HomePageAccountList = function HomePageAccountList(_ref) {
136
138
  videoCount: 0,
137
139
  created: 0,
138
140
  updated: 0,
141
+ chromeProfileName: '',
139
142
  proxyInfo: {}
140
143
  });
141
144
  return;
@@ -167,8 +170,7 @@ var HomePageAccountList = function HomePageAccountList(_ref) {
167
170
  };
168
171
  var onAdd = /*#__PURE__*/function () {
169
172
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(platform) {
170
- var _window$getBridge, _window;
171
- var settingConfig, addAccountResult, postData;
173
+ var settingConfig, chromeProfileName;
172
174
  return _regeneratorRuntime().wrap(function _callee$(_context) {
173
175
  while (1) switch (_context.prev = _context.next) {
174
176
  case 0:
@@ -181,32 +183,75 @@ var HomePageAccountList = function HomePageAccountList(_ref) {
181
183
  return _context.abrupt("return");
182
184
  case 4:
183
185
  console.log('onAdd:', platform);
186
+ settingConfig = AccountManageSettingConfig();
187
+ if (settingConfig.chromeUserDataDir) {
188
+ _context.next = 10;
189
+ break;
190
+ }
191
+ notification.notificationError('请先设置:“谷歌浏览器 - 多开位置”', '选个稍微大点的盘存储,每个用户会有几百M的数据');
192
+ onMenu('setting');
193
+ return _context.abrupt("return");
194
+ case 10:
184
195
  toast('正在启动浏览器,请扫码登录', 12);
185
196
 
186
197
  // const platformName = platform ; // == 'kuaishou' ? 'kwai' : '';
187
198
  // const eventName = `amz-${ platform }-publish--add-account`;
188
199
  // console.log('eventName:', eventName );
189
200
  // window.bridge.ipcRenderer.sendMessage( eventName ); // 添加抖音账号
190
- settingConfig = AccountManageSettingConfig();
191
- _context.next = 9;
192
- return (_window$getBridge = (_window = window).getBridge) === null || _window$getBridge === void 0 || (_window$getBridge = _window$getBridge.call(_window)) === null || _window$getBridge === void 0 ? void 0 : _window$getBridge.ipcRenderer.invoke('shipinlv-video-account-add', platform, proxyInfo, settingConfig.isChromeOpen).catch(function (err) {
193
- Notification.notificationError('获取账号信息错误' + ((err === null || err === void 0 ? void 0 : err.message) || JSON.stringify(err)));
194
- });
195
- case 9:
196
- addAccountResult = _context.sent;
197
- if (addAccountResult) {
198
- _context.next = 12;
199
- break;
200
- }
201
- return _context.abrupt("return");
202
- case 12:
203
- console.log('addAccountResult:', addAccountResult, env);
204
- postData = {
205
- detail: addAccountResult,
206
- proxyId: proxyInfo.id || 0
207
- };
208
- runCreate(postData);
209
- case 15:
201
+
202
+ // 固定长度,必须 16位数
203
+ chromeProfileName = Date.now() + '-' + Tool.math.randWord(16);
204
+ openChrome({
205
+ action: 'add-account',
206
+ platform: platform,
207
+ platformAccountId: '',
208
+ nickname: '',
209
+ taskId: 0,
210
+ chromePath: settingConfig.chromePath,
211
+ chromeProfileName: chromeProfileName,
212
+ url: 'https://creator.douyin.com/',
213
+ proxyInfo: proxyInfo,
214
+ isOpen: true // settingConfig.isChromeOpen,
215
+ }, true);
216
+
217
+ // event.run('publish-video-account-add', {
218
+ // ...openChromeQuery,
219
+ // // onFinish( inChromeProfileName: string, accountDetail: PublishNpm.AccountResult ){
220
+ // // if( inChromeProfileName != chromeProfileName ){
221
+ // // return;
222
+ // // }
223
+ // // const postData: VideoPublishVideoAccount.CreateQuery = {
224
+ // // detail: accountDetail, // addAccountResult as PublishNpm.AccountResult,
225
+ // // proxyId: proxyInfo.id || 0,
226
+ // // };
227
+ // // runCreate(postData);
228
+ // // },
229
+ // // onFail( inChromeProfileName: string, err: Error ){
230
+ // // if( inChromeProfileName != chromeProfileName ){
231
+ // // return;
232
+ // // }
233
+ // // Notification.notificationError( '获取账号信息错误'+ ( err?.message || JSON.stringify( err ) ) );
234
+ // // }
235
+ // });
236
+
237
+ // const addAccountResult = await window.getBridge?.()?.ipcRenderer
238
+ // .invoke('shipinlv-video-account-add', platform, proxyInfo, settingConfig.isChromeOpen )
239
+ // .catch( ( err: Error ) => {
240
+ // Notification.notificationError( '获取账号信息错误'+ ( err?.message || JSON.stringify( err ) ) )
241
+ // });
242
+
243
+ // if( ! addAccountResult ){
244
+ // return;
245
+ // }
246
+
247
+ // console.log('addAccountResult:', addAccountResult, env );
248
+ //
249
+ // const postData: VideoPublishVideoAccount.CreateQuery = {
250
+ // detail: addAccountResult as PublishNpm.AccountResult,
251
+ // proxyId: proxyInfo.id || 0,
252
+ // };
253
+ // runCreate(postData);
254
+ case 13:
210
255
  case "end":
211
256
  return _context.stop();
212
257
  }
@@ -402,7 +447,7 @@ var HomePageAccountList = function HomePageAccountList(_ref) {
402
447
  onClick: function onClick() {
403
448
  return onCurrentId(item.id);
404
449
  }
405
- });
450
+ }, item.id);
406
451
  })
407
452
  }), listData.length == 0 && /*#__PURE__*/_jsxs("div", {
408
453
  className: "empty",
@@ -4,12 +4,13 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
4
4
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
5
5
  import _objectDestructuringEmpty from "@babel/runtime/helpers/esm/objectDestructuringEmpty";
6
6
  import React, { useEffect, useState } from 'react';
7
- import { ConfigProvider, Form, Switch } from 'antd';
7
+ import { ConfigProvider, Form, Modal, Switch, Tooltip } from 'antd';
8
8
  import "./index.less";
9
9
  import LayoutContent from "../../../UI/LayoutContent";
10
10
  import AccountManageSettingConfig from "../../../lib/accountManageSettingConfig";
11
11
  import FileSelect from "../../../component/file-select";
12
12
  import Tool from "../../../lib/Tool";
13
+ import FolderSelect from "../../../component/folder-select";
13
14
  import { jsx as _jsx } from "react/jsx-runtime";
14
15
  import { jsxs as _jsxs } from "react/jsx-runtime";
15
16
  var AccountManageSettingPage = function AccountManageSettingPage(_ref) {
@@ -27,6 +28,7 @@ var AccountManageSettingPage = function AccountManageSettingPage(_ref) {
27
28
  var _onFinish = function onFinish(data) {
28
29
  AccountManageSettingConfig(data);
29
30
  };
31
+ var x = function x() {};
30
32
  var onInit = /*#__PURE__*/function () {
31
33
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
32
34
  return _regeneratorRuntime().wrap(function _callee$(_context) {
@@ -98,9 +100,12 @@ var AccountManageSettingPage = function AccountManageSettingPage(_ref) {
98
100
  // name="disabledApplyTask"
99
101
  ,
100
102
  extra: /*#__PURE__*/_jsxs("div", {
101
- children: ["Chrome \u7248\u672C\u63A8\u8350 110 \u4EE5\u4E0A\uFF08\u6253\u5F00 \u8C37\u6B4C\u6D4F\u89C8\u5668\uFF0C\u8F93\u5165 ", /*#__PURE__*/_jsx("a", {
102
- children: "chrome://settings/help"
103
- }), " \u53EF\u67E5\u8BE2\u7248\u672C\uFF09"]
103
+ children: ["\u4E0B\u8F7D\u5730\u5740", /*#__PURE__*/_jsx(Tooltip, {
104
+ title: "https://google.cn/chrome/",
105
+ children: /*#__PURE__*/_jsx("a", {
106
+ children: " https://google.cn/chrome/"
107
+ })
108
+ })]
104
109
  }),
105
110
  children: /*#__PURE__*/_jsx(FileSelect, {
106
111
  path: formData.chromePath,
@@ -114,6 +119,40 @@ var AccountManageSettingPage = function AccountManageSettingPage(_ref) {
114
119
  _onFinish(formData);
115
120
  }
116
121
  })
122
+ }), /*#__PURE__*/_jsx(Form.Item, {
123
+ label: "\u8C37\u6B4C\u6D4F\u89C8\u5668 - \u591A\u5F00\u4F4D\u7F6E",
124
+ extra: /*#__PURE__*/_jsx("div", {}),
125
+ children: /*#__PURE__*/_jsx(FolderSelect, {
126
+ path: formData.chromeUserDataDir,
127
+ disabled: false,
128
+ placeholder: "\u8BF7\u9009\u62E9 Chrome \u6D4F\u89C8\u5668\u591A\u5F00\u7528\u6237\u6570\u636E\u7684\u4FDD\u5B58\u8DEF\u5F84\uFF0C\u6700\u597D\u653E\u5927\u4E00\u70B9\u7684\u76D8\uFF08\u9009\u597D\u540E\u4E0D\u8981\u4FEE\u6539\uFF09",
129
+ allowClear: false,
130
+ autoCreateDirName: "chrome-user-data",
131
+ onBeforeSelect: function onBeforeSelect() {
132
+ return new Promise(function (resolve, reject) {
133
+ if (!formData.chromeUserDataDir) {
134
+ return resolve(true);
135
+ }
136
+ Modal.confirm({
137
+ title: '郑重提醒',
138
+ content: '如果换文件夹,可能以前登录的账号全不会失效,需要全部重新登录',
139
+ okText: '我已清楚风险',
140
+ cancelText: '取消',
141
+ onCancel: function onCancel() {
142
+ resolve(false);
143
+ },
144
+ onOk: function onOk() {
145
+ resolve(true);
146
+ }
147
+ });
148
+ });
149
+ },
150
+ onFinish: function onFinish(chromeUserDataDir) {
151
+ formData.chromeUserDataDir = chromeUserDataDir;
152
+ setFormData(_objectSpread({}, formData));
153
+ _onFinish(formData);
154
+ }
155
+ })
117
156
  })]
118
157
  })
119
158
  });
@@ -1,20 +1,25 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
+ import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
3
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
2
4
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
5
  import React, { useState, useEffect, useRef } from "react";
4
6
  import "./index.less";
5
7
  import LayoutContent from "../../UI/LayoutContent";
6
8
  import dayjs from "dayjs";
7
9
  import Markdown from "../../component/markdown";
8
- import { Divider, Empty, Tooltip } from "antd";
10
+ import { Divider, Empty, Tag, Tooltip } from "antd";
9
11
  import event from "../../lib/event";
10
12
  import math from "../../lib/math";
11
13
  import Time from "../../UI/Time";
12
14
  import * as VideoPublishVideoAccountController from "../../service/api/VideoPublishVideoAccountController";
15
+ import notification from "../../lib/notification";
13
16
  import { jsx as _jsx } from "react/jsx-runtime";
17
+ import { Fragment as _Fragment } from "react/jsx-runtime";
14
18
  import { jsxs as _jsxs } from "react/jsx-runtime";
15
19
  var MaxLine = 10000;
16
20
  var VideoPublishLog = function VideoPublishLog(_ref) {
17
- var clientIdentity = _ref.clientIdentity,
21
+ var _ref$clientIdentity = _ref.clientIdentity,
22
+ clientIdentity = _ref$clientIdentity === void 0 ? '' : _ref$clientIdentity,
18
23
  env = _ref.env;
19
24
  var _useState = useState(0),
20
25
  _useState2 = _slicedToArray(_useState, 2),
@@ -39,6 +44,73 @@ var VideoPublishLog = function VideoPublishLog(_ref) {
39
44
  fail: '<CloseSquareFilled class="icon icon-fail" />',
40
45
  success: '<CheckCircleFilled class="icon icon-success" />'
41
46
  };
47
+ var onLogDo = function onLogDo(data) {
48
+ console.log('log data:', data);
49
+ (function () {
50
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(code) {
51
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
52
+ while (1) switch (_context.prev = _context.next) {
53
+ case 0:
54
+ _context.t0 = code;
55
+ _context.next = _context.t0 === 'not-login' ? 3 : 8;
56
+ break;
57
+ case 3:
58
+ _context.next = 5;
59
+ return VideoPublishVideoAccountController.saveLoginStatus({
60
+ clientIdentity: clientIdentity,
61
+ taskId: data.taskId,
62
+ platformVideoAccountId: data.platformAccountId,
63
+ platform: data.platform,
64
+ isLogin: false,
65
+ loginValidMessage: data.message
66
+ }, {
67
+ env: env
68
+ }).catch(function (err) {
69
+ console.log("上报登录失败", err === null || err === void 0 ? void 0 : err.message);
70
+ });
71
+ case 5:
72
+ event.run('video-publish-auth-change');
73
+ notification.notificationError('有账户未登录', /*#__PURE__*/_jsxs(_Fragment, {
74
+ children: ["\u8BF7\u68C0\u67E5 ", /*#__PURE__*/_jsx(Tag, {
75
+ children: data.nickname || ''
76
+ })]
77
+ }));
78
+ return _context.abrupt("break", 8);
79
+ case 8:
80
+ case "end":
81
+ return _context.stop();
82
+ }
83
+ }, _callee);
84
+ }));
85
+ return function (_x) {
86
+ return _ref2.apply(this, arguments);
87
+ };
88
+ })()(data === null || data === void 0 ? void 0 : data.code);
89
+ var logKey = data.logKey ? data.logKey : math.randWord(10);
90
+ var messageData = {
91
+ platform: data.platform,
92
+ platformAccountId: data.platformAccountId,
93
+ taskId: data.taskId,
94
+ id: logKey,
95
+ logStatus: data.status,
96
+ nickname: data.nickname,
97
+ content: data.message || '',
98
+ created: Date.now()
99
+ };
100
+ var index = findIndex(logKey);
101
+ if (index < 0) {
102
+ textRef.current.unshift(messageData);
103
+ } else {
104
+ // 不更新时间
105
+ textRef.current[index].content = messageData.content;
106
+ textRef.current[index].logStatus = messageData.logStatus;
107
+ }
108
+ if (textRef.current.length > MaxLine) {
109
+ // textRef.current = textRef.current.slice( textRef.current.length - MaxLine );
110
+ textRef.current = textRef.current.slice(0, MaxLine);
111
+ }
112
+ setTextList(_toConsumableArray(textRef.current));
113
+ };
42
114
  var onLog = function onLog() {
43
115
  event.on('task-apply', function () {
44
116
  setLogAmount(function (n) {
@@ -46,48 +118,18 @@ var VideoPublishLog = function VideoPublishLog(_ref) {
46
118
  });
47
119
  setLastTaskApplyTime(Math.floor(Date.now() * 0.001));
48
120
  });
49
- event.on('shipinlv-video-publish-log', function (data) {
50
- console.log('log data:', data);
51
- switch (data === null || data === void 0 ? void 0 : data.code) {
52
- case 'not-login':
53
- // 上报
54
- VideoPublishVideoAccountController.saveLoginStatus({
55
- clientIdentity: clientIdentity,
56
- platformVideoAccountId: data.platformAccountId,
57
- platform: data.platform,
58
- isLogin: false,
59
- loginValidMessage: data.message
60
- }, {
61
- env: env
62
- }).catch(function (err) {
63
- console.log("上报登录失败", err === null || err === void 0 ? void 0 : err.message);
64
- });
65
- event.run('video-publish-auth-change');
66
- break;
121
+ event.on('ws-message.publish-video-log-publish-video', function (query) {
122
+ console.log('ws-message publish-video -log-publish-video:', query);
123
+ if (query.dataType !== 'publish-video-log-publish-video') {
124
+ return;
67
125
  }
68
- var logKey = data.logKey ? data.logKey : math.randWord(10);
69
- var messageData = {
70
- platform: data.platform,
71
- platformAccountId: data.platformAccountId,
72
- taskId: data.taskId,
73
- id: logKey,
74
- logStatus: data.status,
75
- content: data.message || '',
76
- created: Date.now()
77
- };
78
- var index = findIndex(logKey);
79
- if (index < 0) {
80
- textRef.current.unshift(messageData);
81
- } else {
82
- // 不更新时间
83
- textRef.current[index].content = messageData.content;
84
- textRef.current[index].logStatus = messageData.logStatus;
85
- }
86
- if (textRef.current.length > MaxLine) {
87
- // textRef.current = textRef.current.slice( textRef.current.length - MaxLine );
88
- textRef.current = textRef.current.slice(0, MaxLine);
89
- }
90
- setTextList(_toConsumableArray(textRef.current));
126
+ onLogDo(query.data);
127
+ });
128
+ event.on('publish-video-log-publish-video', function (query) {
129
+ onLogDo(query);
130
+ });
131
+ event.on('shipinlv-video-publish-log', function (data) {
132
+ onLogDo(data);
91
133
  });
92
134
  };
93
135
  var findIndex = function findIndex(id) {
@@ -123,10 +165,14 @@ var VideoPublishLog = function VideoPublishLog(_ref) {
123
165
  children: [textList.map(function (items, i) {
124
166
  var logStatus = LogStatusDict[items.logStatus] || '';
125
167
  var time = dayjs(items.created).format('MM-DD HH:mm:ss');
168
+ var contentText = "<span class=\"created\">".concat(time, "</span> <VideoPlatform platform=\"").concat(items.platform, "\" /> <span>").concat(items.nickname, " </span> <Tooltip title='\u4EFB\u52A1\u7F16\u53F7'><Tag color='blue'> ").concat(items.taskId, "</Tag></Tooltip> ").concat(logStatus, " <span class=\"content\">").concat(items.content, "</span>");
169
+ if (items.content === '-----') {
170
+ contentText = '<Divider />';
171
+ }
126
172
  return /*#__PURE__*/_jsx("div", {
127
173
  className: "line ".concat('line-' + items.logStatus),
128
174
  children: /*#__PURE__*/_jsx(Markdown, {
129
- content: "<span class=\"created\">".concat(time, "</span> <VideoPlatform platform=\"").concat(items.platform, "\" /> <Tooltip title='\u4EFB\u52A1\u7F16\u53F7'><Tag color='blue'>").concat(items.taskId, "</Tag></Tooltip> <Tag>").concat(items.platformAccountId || '', "</Tag> ").concat(logStatus, " <span class=\"content\">").concat(items.content, "</span>")
175
+ content: contentText
130
176
  })
131
177
  }, "".concat(items.id, "-").concat(i));
132
178
  }), textList.length === 0 && /*#__PURE__*/_jsx(Empty, {
@@ -7,7 +7,7 @@
7
7
  font-weight: 300;
8
8
  //opacity: 0.7;
9
9
  font-size: 13px;
10
- min-width: 62px;
10
+ min-width: 95px;
11
11
  text-align: center;
12
12
  display: inline-block;
13
13
  line-height: 1em;
@@ -1,16 +1,28 @@
1
1
  import React, { useEffect } from 'react';
2
2
  import "./index.less";
3
3
  import PublishTaskPlanClass from "./tool";
4
+ import event from "../../lib/event";
4
5
  import { jsx as _jsx } from "react/jsx-runtime";
5
6
  var VideoPublishPublishVideoPlan = function VideoPublishPublishVideoPlan(_ref) {
6
7
  var disabled = _ref.disabled,
7
8
  env = _ref.env,
8
- clientIdentity = _ref.clientIdentity;
9
+ _ref$clientIdentity = _ref.clientIdentity,
10
+ clientIdentity = _ref$clientIdentity === void 0 ? '' : _ref$clientIdentity;
9
11
  useEffect(function () {
10
12
  if (disabled) {
11
13
  return;
12
14
  }
13
- var publishTaskPlan = new PublishTaskPlanClass(env, clientIdentity);
15
+ var publishTaskPlan = new PublishTaskPlanClass(env || '', clientIdentity, {
16
+ // onVideoPublish: ( proxyInfo, query ) => {
17
+ // console.log('on log:', proxyInfo, query );
18
+ // // 发送给 本地服务器 SSE
19
+ // return Promise.resolve( true );
20
+ // },
21
+ onLog: function onLog(query) {
22
+ console.log('on log:', query);
23
+ event.run('publish-video', query);
24
+ }
25
+ });
14
26
  publishTaskPlan.onInit();
15
27
  }, []);
16
28
  return /*#__PURE__*/_jsx("div", {