component-shipinlv 2.3.0 → 2.3.1

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.
@@ -2,6 +2,7 @@ import React from "react";
2
2
  interface Props {
3
3
  disabled?: boolean;
4
4
  env?: Global.Env;
5
+ notVip: boolean;
5
6
  }
6
7
  declare const ActiveAccountMode: React.FC<Props>;
7
8
  export default ActiveAccountMode;
@@ -3,12 +3,14 @@ import ActiveAccountModeSetting from "./setting";
3
3
  import { jsx as _jsx } from "react/jsx-runtime";
4
4
  var ActiveAccountMode = function ActiveAccountMode(_ref) {
5
5
  var disabled = _ref.disabled,
6
- env = _ref.env;
6
+ env = _ref.env,
7
+ notVip = _ref.notVip;
7
8
  return /*#__PURE__*/_jsx(ActiveAccountModeSetting, {
8
9
  env: env
9
10
  // env="prod"
10
11
  ,
11
- disabled: disabled
12
+ disabled: disabled,
13
+ notVip: notVip
12
14
  });
13
15
  };
14
16
  export default ActiveAccountMode;
@@ -3,6 +3,7 @@ import './setting.less';
3
3
  interface Props {
4
4
  disabled?: boolean;
5
5
  env?: Global.Env;
6
+ notVip: boolean;
6
7
  }
7
8
  declare const ActiveAccountModeSetting: React.FC<Props>;
8
9
  export default ActiveAccountModeSetting;
@@ -3,7 +3,7 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
3
3
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
4
4
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
5
5
  import React, { useEffect, useState } from 'react';
6
- import { Button, ConfigProvider, Divider, Form, InputNumber, Radio, Switch } from 'antd';
6
+ import { Alert, Button, ConfigProvider, Divider, Form, InputNumber, Radio, Switch } from 'antd';
7
7
  import "./setting.less";
8
8
  import LayoutContent from "../UI/LayoutContent";
9
9
  import { useRequest } from "@umijs/hooks";
@@ -28,7 +28,8 @@ import { Fragment as _Fragment } from "react/jsx-runtime";
28
28
  import { jsxs as _jsxs } from "react/jsx-runtime";
29
29
  var ActiveAccountModeSetting = function ActiveAccountModeSetting(_ref) {
30
30
  var disabled = _ref.disabled,
31
- env = _ref.env;
31
+ env = _ref.env,
32
+ notVip = _ref.notVip;
32
33
  var _Form$useForm = Form.useForm(),
33
34
  _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
34
35
  form = _Form$useForm2[0];
@@ -107,7 +108,7 @@ var ActiveAccountModeSetting = function ActiveAccountModeSetting(_ref) {
107
108
  };
108
109
  }();
109
110
  useEffect(function () {
110
- var task = new ActiveAccountModeTask(env);
111
+ var task = new ActiveAccountModeTask(env, notVip);
111
112
  return function () {
112
113
  task.destroy();
113
114
  };
@@ -131,7 +132,13 @@ var ActiveAccountModeSetting = function ActiveAccountModeSetting(_ref) {
131
132
  autoComplete: "off",
132
133
  initialValues: _objectSpread({}, formData),
133
134
  onFinish: onFinish,
134
- children: [/*#__PURE__*/_jsx(Form.Item, {
135
+ children: [notVip && /*#__PURE__*/_jsx(Form.Item, {
136
+ label: "\u505C\u7528",
137
+ children: /*#__PURE__*/_jsx(Alert, {
138
+ type: "error",
139
+ message: "\u4E0D\u662F\u4F1A\u5458\uFF0C\u6B64\u529F\u80FD\u7981\u7528"
140
+ })
141
+ }), /*#__PURE__*/_jsx(Form.Item, {
135
142
  label: "\u542F\u7528",
136
143
  name: "enabled",
137
144
  children: /*#__PURE__*/_jsx(Switch, {
@@ -1,12 +1,13 @@
1
1
  declare class ActiveAccountModeTask {
2
2
  loopSecond: number;
3
+ notVip: boolean;
3
4
  modeSetting: ActiveAccountModeSetting.Detail;
4
5
  env: Global.Env | undefined;
5
6
  accountList: VideoPublishVideoAccount.List[];
6
7
  planDict: {
7
8
  [id: number]: PublishTaskPlanStatistic.List[];
8
9
  };
9
- constructor(env?: Global.Env);
10
+ constructor(env?: Global.Env, notVip?: boolean);
10
11
  destroy(): void;
11
12
  onLoop(): Promise<void>;
12
13
  loop(): Promise<void>;
@@ -15,10 +15,11 @@ import sleep from "../../lib/sleep";
15
15
  import { delFile, fsDirVideoList } from "../../lib/fs";
16
16
  import Tool from "../../lib/Tool";
17
17
  var ActiveAccountModeTask = /*#__PURE__*/function () {
18
- function ActiveAccountModeTask(env) {
18
+ function ActiveAccountModeTask(env, notVip) {
19
19
  var _this = this;
20
20
  _classCallCheck(this, ActiveAccountModeTask);
21
21
  _defineProperty(this, "loopSecond", 1 * 60);
22
+ _defineProperty(this, "notVip", false);
22
23
  _defineProperty(this, "modeSetting", {
23
24
  dayTimeHourList: [],
24
25
  dayPublishMaxAmount: 6,
@@ -37,6 +38,8 @@ var ActiveAccountModeTask = /*#__PURE__*/function () {
37
38
  if (env && env !== 'prod') {
38
39
  this.loopSecond = 50;
39
40
  }
41
+ this.notVip = !!notVip;
42
+
40
43
  // this.timer = setInterval(() => {
41
44
  // this.loop();
42
45
  // }, this.loopSecond * 1e3 )
@@ -100,31 +103,38 @@ var ActiveAccountModeTask = /*#__PURE__*/function () {
100
103
  this.onLoop();
101
104
  return _context2.abrupt("return");
102
105
  case 11:
103
- _context2.next = 13;
106
+ if (!this.notVip) {
107
+ _context2.next = 14;
108
+ break;
109
+ }
110
+ console.log('不是会员,禁用养号模式');
111
+ return _context2.abrupt("return");
112
+ case 14:
113
+ _context2.next = 16;
104
114
  return this.getAccountList().catch(function (err) {
105
115
  toastError('获取视频账户错误:' + (err === null || err === void 0 ? void 0 : err.message));
106
116
  });
107
- case 13:
117
+ case 16:
108
118
  accountList = _context2.sent;
109
119
  if (accountList) {
110
- _context2.next = 17;
120
+ _context2.next = 20;
111
121
  break;
112
122
  }
113
123
  this.onLoop();
114
124
  return _context2.abrupt("return");
115
- case 17:
125
+ case 20:
116
126
  this.accountList = accountList.list;
117
127
  if (!(this.accountList.length === 0)) {
118
- _context2.next = 21;
128
+ _context2.next = 24;
119
129
  break;
120
130
  }
121
131
  this.onLoop();
122
132
  return _context2.abrupt("return");
123
- case 21:
133
+ case 24:
124
134
  dayIndex = 0;
125
- case 22:
135
+ case 25:
126
136
  if (!(dayIndex < setting.publishMaxDay)) {
127
- _context2.next = 78;
137
+ _context2.next = 81;
128
138
  break;
129
139
  }
130
140
  console.log('publishMaxDay:', dayIndex);
@@ -134,21 +144,21 @@ var ActiveAccountModeTask = /*#__PURE__*/function () {
134
144
  console.log("startTime:", dayIndex, new Date(startTime * 1000), new Date(endTime * 1000));
135
145
 
136
146
  // 获取用户列表;
137
- _context2.next = 30;
147
+ _context2.next = 33;
138
148
  return this.getTaskPlanStatisticList(startTime, endTime).catch(function (err) {
139
149
  toastError('获取账户列表失败:' + (err === null || err === void 0 ? void 0 : err.message));
140
150
  });
141
- case 30:
151
+ case 33:
142
152
  list = _context2.sent;
143
153
  if (list) {
144
- _context2.next = 35;
154
+ _context2.next = 38;
145
155
  break;
146
156
  }
147
- _context2.next = 34;
157
+ _context2.next = 37;
148
158
  return sleep(20e3);
149
- case 34:
150
- return _context2.abrupt("continue", 75);
151
- case 35:
159
+ case 37:
160
+ return _context2.abrupt("continue", 78);
161
+ case 38:
152
162
  // 把发布过的,做一个字段
153
163
  this.planDict = {};
154
164
  _iterator = _createForOfIteratorHelper(list);
@@ -168,87 +178,87 @@ var ActiveAccountModeTask = /*#__PURE__*/function () {
168
178
  _iterator.f();
169
179
  }
170
180
  _iterator2 = _createForOfIteratorHelper(this.accountList);
171
- _context2.prev = 39;
181
+ _context2.prev = 42;
172
182
  _iterator2.s();
173
- case 41:
183
+ case 44:
174
184
  if ((_step2 = _iterator2.n()).done) {
175
- _context2.next = 67;
185
+ _context2.next = 70;
176
186
  break;
177
187
  }
178
188
  accountItem = _step2.value;
179
189
  if (accountItem.isLoginValid) {
180
- _context2.next = 46;
190
+ _context2.next = 49;
181
191
  break;
182
192
  }
183
193
  console.log('账号已掉线:', accountItem);
184
- return _context2.abrupt("continue", 65);
185
- case 46:
194
+ return _context2.abrupt("continue", 68);
195
+ case 49:
186
196
  if (!accountItem.isBan) {
187
- _context2.next = 49;
197
+ _context2.next = 52;
188
198
  break;
189
199
  }
190
200
  console.log('账号已封:', accountItem);
191
- return _context2.abrupt("continue", 65);
192
- case 49:
201
+ return _context2.abrupt("continue", 68);
202
+ case 52:
193
203
  if (accountItem.enabledActiveAccountMode) {
194
- _context2.next = 52;
204
+ _context2.next = 55;
195
205
  break;
196
206
  }
197
207
  console.log('账号禁止养号模式:', accountItem);
198
- return _context2.abrupt("continue", 65);
199
- case 52:
208
+ return _context2.abrupt("continue", 68);
209
+ case 55:
200
210
  count = ((_this$planDict$accoun = this.planDict[accountItem.id]) === null || _this$planDict$accoun === void 0 ? void 0 : _this$planDict$accoun.length) || 0; // 需要指定路径
201
211
  if (accountItem.videoFromFolder) {
202
- _context2.next = 56;
212
+ _context2.next = 59;
203
213
  break;
204
214
  }
205
215
  console.log('no videoFromFolder :', accountItem.id, accountItem.nickname);
206
- return _context2.abrupt("continue", 65);
207
- case 56:
216
+ return _context2.abrupt("continue", 68);
217
+ case 59:
208
218
  // 删除 此账户下面,所有已经发布的视频
209
219
  this.checkDelFile(accountItem.id, accountItem.videoFromFolder);
210
220
  if (!(count >= setting.dayPublishMaxAmount)) {
211
- _context2.next = 60;
221
+ _context2.next = 63;
212
222
  break;
213
223
  }
214
224
  console.log('count 2:', count, setting.dayPublishMaxAmount);
215
- return _context2.abrupt("continue", 65);
216
- case 60:
225
+ return _context2.abrupt("continue", 68);
226
+ case 63:
217
227
  console.log('makePublishTask in:', accountItem.id, setting.dayPublishMaxAmount - count, dayIndex);
218
228
 
219
229
  // 生成任务
220
- _context2.next = 63;
230
+ _context2.next = 66;
221
231
  return this.makePublishTask(accountItem.id, setting.dayPublishMaxAmount - count, dayIndex).catch(function (err) {
222
232
  console.log('makePublishTask err:', err);
223
233
  });
224
- case 63:
225
- _context2.next = 65;
234
+ case 66:
235
+ _context2.next = 68;
226
236
  return sleep(3e3);
227
- case 65:
228
- _context2.next = 41;
237
+ case 68:
238
+ _context2.next = 44;
229
239
  break;
230
- case 67:
231
- _context2.next = 72;
240
+ case 70:
241
+ _context2.next = 75;
232
242
  break;
233
- case 69:
234
- _context2.prev = 69;
235
- _context2.t0 = _context2["catch"](39);
236
- _iterator2.e(_context2.t0);
237
243
  case 72:
238
244
  _context2.prev = 72;
239
- _iterator2.f();
240
- return _context2.finish(72);
245
+ _context2.t0 = _context2["catch"](42);
246
+ _iterator2.e(_context2.t0);
241
247
  case 75:
248
+ _context2.prev = 75;
249
+ _iterator2.f();
250
+ return _context2.finish(75);
251
+ case 78:
242
252
  dayIndex++;
243
- _context2.next = 22;
253
+ _context2.next = 25;
244
254
  break;
245
- case 78:
255
+ case 81:
246
256
  this.onLoop();
247
- case 79:
257
+ case 82:
248
258
  case "end":
249
259
  return _context2.stop();
250
260
  }
251
- }, _callee2, this, [[39, 69, 72, 75]]);
261
+ }, _callee2, this, [[42, 72, 75, 78]]);
252
262
  }));
253
263
  function loop() {
254
264
  return _loop.apply(this, arguments);
@@ -3,6 +3,7 @@ import './home.less';
3
3
  interface Props {
4
4
  apiUrl: string;
5
5
  env?: Global.Env;
6
+ notVip: boolean;
6
7
  onMenu: (key: string) => void;
7
8
  canPublish?: boolean;
8
9
  }
@@ -15,6 +15,7 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
15
15
  var VideoPublishAccountManageHomePage = function VideoPublishAccountManageHomePage(_ref) {
16
16
  var apiUrl = _ref.apiUrl,
17
17
  env = _ref.env,
18
+ notVip = _ref.notVip,
18
19
  onMenu = _ref.onMenu,
19
20
  canPublish = _ref.canPublish;
20
21
  var _useState = useState({
@@ -152,6 +153,7 @@ var VideoPublishAccountManageHomePage = function VideoPublishAccountManageHomePa
152
153
  children: [/*#__PURE__*/_jsx(HomePageAccountList, {
153
154
  apiUrl: apiUrl,
154
155
  env: env,
156
+ notVip: notVip,
155
157
  currentAccountDetail: accountDetail,
156
158
  onListData: function onListData(list) {
157
159
  // accountListDataRef.current = list;
@@ -3,6 +3,7 @@ import './list.less';
3
3
  interface Props {
4
4
  apiUrl: string;
5
5
  env?: Global.Env;
6
+ notVip: boolean;
6
7
  currentAccountDetail: VideoPublishVideoAccount.List;
7
8
  onMenu: (key: string) => void;
8
9
  disabledDel?: boolean;
@@ -27,9 +27,11 @@ import openChrome from "../../lib/openChrome";
27
27
  import { jsx as _jsx } from "react/jsx-runtime";
28
28
  import { jsxs as _jsxs } from "react/jsx-runtime";
29
29
  import { Fragment as _Fragment } from "react/jsx-runtime";
30
+ var NotVipCanAddAccountCount = 10;
30
31
  var HomePageAccountList = function HomePageAccountList(_ref) {
31
32
  var apiUrl = _ref.apiUrl,
32
33
  env = _ref.env,
34
+ notVip = _ref.notVip,
33
35
  _ref$onMenu = _ref.onMenu,
34
36
  onMenu = _ref$onMenu === void 0 ? function () {} : _ref$onMenu,
35
37
  _ref$onListData = _ref.onListData,
@@ -182,31 +184,42 @@ var HomePageAccountList = function HomePageAccountList(_ref) {
182
184
  return _regeneratorRuntime().wrap(function _callee$(_context) {
183
185
  while (1) switch (_context.prev = _context.next) {
184
186
  case 0:
185
- if (isInstalledChrome()) {
187
+ if (!notVip) {
186
188
  _context.next = 4;
187
189
  break;
188
190
  }
191
+ if (!(listData.length >= NotVipCanAddAccountCount)) {
192
+ _context.next = 4;
193
+ break;
194
+ }
195
+ Tool.toast("\u4E0D\u662F\u4F1A\u5458\uFF0C\u53EA\u80FD\u6DFB\u52A0 ".concat(NotVipCanAddAccountCount, "\u4E2A\u8D26\u6237"));
196
+ return _context.abrupt("return");
197
+ case 4:
198
+ if (isInstalledChrome()) {
199
+ _context.next = 8;
200
+ break;
201
+ }
189
202
  Tool.toast('没有安装谷歌浏览器(Chrome),请安装');
190
203
  onMenu('setting');
191
204
  return _context.abrupt("return");
192
- case 4:
205
+ case 8:
193
206
  console.log('onAdd:', platform);
194
207
  settingConfig = AccountManageSettingConfig();
195
208
  if (settingConfig.chromeUserDataDir) {
196
- _context.next = 10;
209
+ _context.next = 14;
197
210
  break;
198
211
  }
199
212
  notification.notificationError('请先设置:“谷歌浏览器 - 多开位置”', '选个稍微大点的盘存储,每个用户会有几百M的数据');
200
213
  onMenu('setting');
201
214
  return _context.abrupt("return");
202
- case 10:
215
+ case 14:
203
216
  if (!(listData.length >= 200)) {
204
- _context.next = 13;
217
+ _context.next = 17;
205
218
  break;
206
219
  }
207
220
  notification.notificationError('这电脑绑定到上限了', '每台电脑最多绑定 200 个账号');
208
221
  return _context.abrupt("return");
209
- case 13:
222
+ case 17:
210
223
  toast('正在启动浏览器,请扫码登录', 12);
211
224
 
212
225
  // const platformName = platform ; // == 'kuaishou' ? 'kwai' : '';
@@ -218,12 +231,12 @@ var HomePageAccountList = function HomePageAccountList(_ref) {
218
231
  chromeProfileName = Date.now() + '-' + Tool.math.randWord(16);
219
232
  videoPlatformInfo = VideoPlatformDict[platform];
220
233
  if (videoPlatformInfo) {
221
- _context.next = 19;
234
+ _context.next = 23;
222
235
  break;
223
236
  }
224
237
  toast('请配置信息:' + platform);
225
238
  return _context.abrupt("return");
226
- case 19:
239
+ case 23:
227
240
  openChrome({
228
241
  action: 'add-account',
229
242
  platform: platform,
@@ -237,7 +250,7 @@ var HomePageAccountList = function HomePageAccountList(_ref) {
237
250
  proxyInfo: proxyInfo,
238
251
  isOpen: true // settingConfig.isChromeOpen,
239
252
  }, true, env);
240
- case 20:
253
+ case 24:
241
254
  case "end":
242
255
  return _context.stop();
243
256
  }
@@ -5,6 +5,7 @@ interface Props {
5
5
  productType: VideoPublish.ProductType;
6
6
  apiUrl: string;
7
7
  env?: Global.Env;
8
+ notVip: boolean;
8
9
  }
9
10
  declare const VideoPublishCreateTask: React.FC<Props>;
10
11
  export default VideoPublishCreateTask;
@@ -26,7 +26,8 @@ var VideoPublishCreateTask = function VideoPublishCreateTask(_ref) {
26
26
  var disabled = _ref.disabled,
27
27
  productType = _ref.productType,
28
28
  apiUrl = _ref.apiUrl,
29
- env = _ref.env;
29
+ env = _ref.env,
30
+ notVip = _ref.notVip;
30
31
  var _Form$useForm = Form.useForm(),
31
32
  _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
32
33
  form = _Form$useForm2[0];
@@ -252,8 +253,8 @@ var VideoPublishCreateTask = function VideoPublishCreateTask(_ref) {
252
253
  // error={errorAccountList}
253
254
  // onReload={runAccountList}
254
255
  , {
255
- children: [disabled && /*#__PURE__*/_jsx(Alert, {
256
- message: "\u529F\u80FD\u5347\u7EA7\u4E2D\uFF0C\u5373\u5C06\u5F00\u653E\uFF0C\u656C\u8BF7\u671F\u5F85",
256
+ children: [notVip && /*#__PURE__*/_jsx(Alert, {
257
+ message: "\u4E0D\u662F\u4F1A\u5458\uFF0C\u6682\u4E0D\u80FD\u4F7F\u7528\u6B64\u529F\u80FD",
257
258
  type: "warning",
258
259
  showIcon: true,
259
260
  style: {
@@ -3,6 +3,7 @@ import "./index.less";
3
3
  interface Props {
4
4
  disabled?: boolean;
5
5
  canPublish: boolean;
6
+ notVip: boolean;
6
7
  contentHeight?: number | string;
7
8
  productType: VideoPublish.ProductType;
8
9
  apiUrl: string;
@@ -24,6 +24,7 @@ var VideoPublish = function VideoPublish(_ref) {
24
24
  var disabled = _ref.disabled,
25
25
  _ref$canPublish = _ref.canPublish,
26
26
  canPublish = _ref$canPublish === void 0 ? false : _ref$canPublish,
27
+ notVip = _ref.notVip,
27
28
  contentHeight = _ref.contentHeight,
28
29
  productType = _ref.productType,
29
30
  apiUrl = _ref.apiUrl,
@@ -49,6 +50,7 @@ var VideoPublish = function VideoPublish(_ref) {
49
50
  children: /*#__PURE__*/_jsx(VideoPublishAccountManageHomePage, {
50
51
  apiUrl: apiUrl,
51
52
  env: env,
53
+ notVip: notVip,
52
54
  canPublish: canPublish,
53
55
  onMenu: function onMenu(key) {
54
56
  return _onMenu(key);
@@ -69,7 +71,8 @@ var VideoPublish = function VideoPublish(_ref) {
69
71
  forceRender: true,
70
72
  children: /*#__PURE__*/_jsx(ActiveAccountMode, {
71
73
  disabled: disabled,
72
- env: env
74
+ env: env,
75
+ notVip: notVip
73
76
  })
74
77
  }, {
75
78
  key: 'topic',
@@ -99,7 +102,8 @@ var VideoPublish = function VideoPublish(_ref) {
99
102
  disabled: disabled,
100
103
  productType: productType,
101
104
  apiUrl: apiUrl,
102
- env: env
105
+ env: env,
106
+ notVip: notVip
103
107
  })
104
108
  }, {
105
109
  key: 'task-list',
@@ -11,12 +11,15 @@
11
11
  //margin: 0 12px 0 0;
12
12
  padding: 0 10px 0 0;
13
13
  min-height: 100%;
14
+ height: 100%;
15
+
14
16
  border-right: 1px solid #E8E8E8;
15
17
 
16
18
  .menuWarp{
17
19
  position: fixed;
18
20
  width: 170px;
19
21
  margin: 0 12px 0 0;
22
+ overflow-y: auto;
20
23
  }
21
24
  .menu{
22
25
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "component-shipinlv",
3
- "version": "2.3.0",
3
+ "version": "2.3.1",
4
4
  "description": "",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",