component-shipinlv 1.1.7 → 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.
Files changed (49) hide show
  1. package/dist/UI/DialogDrawer.css.js +1 -1
  2. package/dist/UI/LayoutContent.js +2 -2
  3. package/dist/UI/LayoutContent.less +3 -3
  4. package/dist/VideoPublish/account-manage/home.js +3 -1
  5. package/dist/VideoPublish/account-manage/list.js +19 -44
  6. package/dist/VideoPublish/account-manage/list.less +0 -72
  7. package/dist/VideoPublish/create-task/base/index.js +1 -0
  8. package/dist/VideoPublish/create-task/index.js +6 -4
  9. package/dist/VideoPublish/index.d.ts +1 -1
  10. package/dist/VideoPublish/index.js +16 -4
  11. package/dist/VideoPublish/log/index.d.ts +1 -1
  12. package/dist/VideoPublish/log/index.js +2 -2
  13. package/dist/VideoPublish/proxy/create.d.ts +8 -0
  14. package/dist/VideoPublish/proxy/create.js +154 -0
  15. package/dist/VideoPublish/proxy/list.d.ts +9 -0
  16. package/dist/VideoPublish/proxy/list.js +245 -0
  17. package/dist/VideoPublish/proxy/list.less +3 -0
  18. package/dist/VideoPublish/proxy/query.d.ts +9 -0
  19. package/dist/VideoPublish/proxy/query.js +75 -0
  20. package/dist/VideoPublish/proxy/query.less +10 -0
  21. package/dist/VideoPublish/publish-task-plan/index.d.ts +1 -1
  22. package/dist/VideoPublish/publish-task-plan/index.js +2 -2
  23. package/dist/VideoPublish/publish-task-plan/tool.d.ts +2 -2
  24. package/dist/VideoPublish/publish-task-plan/tool.js +3 -3
  25. package/dist/VideoPublish/task-list/index.js +1 -1
  26. package/dist/VideoPublish/task-list/plan/list.js +4 -6
  27. package/dist/VideoPublish/task-list/plan/list.less +73 -0
  28. package/dist/VideoPublish/video-account/base-info.d.ts +12 -0
  29. package/dist/VideoPublish/video-account/base-info.js +69 -0
  30. package/dist/VideoPublish/video-account/base-info.less +92 -0
  31. package/dist/VideoPublish/video-account/index.js +40 -8
  32. package/dist/VideoPublish/video-account/index.less +10 -0
  33. package/dist/component/{media-show.d.ts → media-show/index.d.ts} +4 -4
  34. package/dist/component/{media-show.js → media-show/index.js} +10 -35
  35. package/dist/component/media-show/index.less +0 -0
  36. package/dist/component/media-show/render.d.ts +10 -0
  37. package/dist/component/media-show/render.js +111 -0
  38. package/dist/component/{media-show.less → media-show/render.less} +2 -1
  39. package/dist/lib/Tool.js +4 -2
  40. package/dist/lib/request.js +105 -77
  41. package/dist/service/api/VideoPublishVideoAccountProxyController.d.ts +11 -0
  42. package/dist/service/api/VideoPublishVideoAccountProxyController.js +105 -0
  43. package/dist/types/VideoPublishTaskPlan.d.ts +1 -0
  44. package/dist/types/VideoPublishVideoAccount.d.ts +11 -0
  45. package/dist/types/VideoPublishVideoAccountProxy.d.ts +32 -0
  46. package/dist/types/VideoPublishVideoAccountProxy.js +0 -0
  47. package/dist/typings/VideoPublishVideoAccount.d.ts +4 -2
  48. package/dist/window.d.ts +2 -0
  49. package/package.json +1 -1
@@ -0,0 +1,92 @@
1
+ .videoAccountBaseInfo{
2
+ position: relative;
3
+ display: flex;
4
+ flex-direction: row;
5
+ cursor: pointer;
6
+ .index{
7
+ position: absolute;
8
+ top: 10px;
9
+ right: 4px;
10
+ font-size: 12px;
11
+ font-style: normal;
12
+ opacity: 0.3;
13
+ }
14
+ .del{
15
+ position: absolute;
16
+ bottom: 7px;
17
+ right: 4px;
18
+ padding: 3px;
19
+ font-size: 12px;
20
+ color: #FFF;
21
+ border-radius: 3px;
22
+ background-color: #C00;
23
+ line-height: 1em;
24
+ display: none;
25
+ }
26
+ &.valid{
27
+ .isLoginValid{
28
+ background-color: #00bc00;
29
+ }
30
+ .shopName{
31
+ color: #005a00;
32
+ }
33
+ }
34
+ &.invalid{
35
+ background-color: #e1e1e1;
36
+ .isLoginValid{
37
+ background-color: red;
38
+ }
39
+ .shopName{
40
+ color: #999;
41
+ font-weight: 300;
42
+ }
43
+ .avatarUrl{
44
+ opacity: 0.5;
45
+ filter: grayscale(100%);
46
+ }
47
+ }
48
+ .avatar{
49
+ position: relative;
50
+ width: 40px;
51
+ //box-shadow: 0 0 5px #EEE;
52
+ .avatarUrl{
53
+ border-radius: 100px;
54
+ box-shadow: 0 0 5px #EEE;
55
+ }
56
+ .isLoginValid{
57
+ position: absolute;
58
+ left: 35px;
59
+ top: 35px;
60
+ width: 8px;
61
+ height: 8px;
62
+ border-radius: 100px;
63
+ }
64
+ }
65
+ .shopName{
66
+ max-width: 150px;
67
+ color: #666;
68
+ display: inline-block;
69
+ text-overflow: ellipsis;
70
+ //line-height: 30px;
71
+ font-size: 12px;
72
+ padding: 1px 0 0 12px;
73
+ line-height: 1.1em;
74
+ word-break: keep-all;
75
+ white-space: nowrap;
76
+ overflow: hidden;
77
+ }
78
+ .nicknameRemark{
79
+ max-width: 150px;
80
+ color: #666;
81
+ text-overflow: ellipsis;
82
+ overflow: hidden;
83
+ //background-color: #F6F6F6;
84
+ padding: 2px 0 1px;
85
+ font-weight: 300;
86
+ }
87
+ .uniqueId{
88
+ padding: 1px 0 0;
89
+ font-size: 12px;
90
+ opacity: 0.6;
91
+ }
92
+ }
@@ -5,7 +5,7 @@ import "./index.less";
5
5
  import PageContentWarp from "../../UI/PageContentWarp";
6
6
  import { useRequest } from "@umijs/hooks";
7
7
  import * as VideoPublishController from "../../service/api/VideoPublishController";
8
- import { Avatar, Button, Divider, Table, Tag } from "antd";
8
+ import { Avatar, Button, Divider, Space, Table, Tag } from "antd";
9
9
  import VideoPublishVideoAccountListQuery from "./query";
10
10
  import VideoPlatform from "../../component/video-platform/logo";
11
11
  import Money from "../../UI/Money";
@@ -106,6 +106,27 @@ var VideoPublishVideoAccount = function VideoPublishVideoAccount(_ref) {
106
106
  })]
107
107
  });
108
108
  }
109
+ }, {
110
+ title: '网络代理',
111
+ dataIndex: 'proxyInfo',
112
+ key: 'proxyInfo',
113
+ render: function render(proxyInfo, record) {
114
+ return /*#__PURE__*/_jsxs("div", {
115
+ className: "proxyInfo",
116
+ children: [/*#__PURE__*/_jsx("div", {
117
+ children: proxyInfo.title
118
+ }), /*#__PURE__*/_jsxs("div", {
119
+ children: [proxyInfo.ip, proxyInfo.area && /*#__PURE__*/_jsxs(_Fragment, {
120
+ children: [/*#__PURE__*/_jsx(Divider, {
121
+ type: "vertical"
122
+ }), /*#__PURE__*/_jsx("span", {
123
+ className: "area",
124
+ children: proxyInfo.area
125
+ })]
126
+ })]
127
+ })]
128
+ });
129
+ }
109
130
  }, {
110
131
  title: /*#__PURE__*/_jsx(_Fragment, {
111
132
  children: "\u662F\u5426\u767B\u5F55"
@@ -144,13 +165,23 @@ var VideoPublishVideoAccount = function VideoPublishVideoAccount(_ref) {
144
165
  dataIndex: 'id',
145
166
  key: 'id',
146
167
  render: function render(id, record) {
147
- return /*#__PURE__*/_jsx(Button, {
148
- type: "link",
149
- size: "small",
150
- onClick: function onClick() {
151
- return onCreate(id);
152
- },
153
- children: "\u7F16\u8F91"
168
+ return /*#__PURE__*/_jsxs(Space, {
169
+ children: [/*#__PURE__*/_jsx(Button, {
170
+ type: "link",
171
+ size: "small",
172
+ onClick: function onClick() {
173
+ return onCreate(id);
174
+ },
175
+ children: "\u7F16\u8F91"
176
+ }), /*#__PURE__*/_jsx(Button, {
177
+ type: "link",
178
+ size: "small",
179
+ disabled: true,
180
+ onClick: function onClick() {
181
+ return onProxyEdit(id);
182
+ },
183
+ children: "\u4EE3\u7406"
184
+ })]
154
185
  });
155
186
  }
156
187
  }];
@@ -176,6 +207,7 @@ var VideoPublishVideoAccount = function VideoPublishVideoAccount(_ref) {
176
207
  setQuery(_objectSpread({}, query));
177
208
  runVideoAccount(query);
178
209
  };
210
+ var onProxyEdit = function onProxyEdit(id) {};
179
211
  var onCreateGroup = function onCreateGroup() {
180
212
  var groupId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
181
213
  var dialog = Tool.drawer({
@@ -41,4 +41,14 @@
41
41
  }
42
42
  }
43
43
 
44
+ .proxyInfo{
45
+ font-size: 12px;
46
+ .area{
47
+ padding: 2px 3px;
48
+ background-color: #F2F2F2;
49
+ border-radius: 3px;
50
+ font-weight: 300;
51
+ }
52
+ }
53
+
44
54
  }
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import './media-show.less';
2
+ import './index.less';
3
3
  interface Prop {
4
4
  title?: string;
5
5
  className?: string;
@@ -8,6 +8,6 @@ interface Prop {
8
8
  height: number;
9
9
  }
10
10
  type TypeKind = 'video' | "image" | "font" | 'audio';
11
- export declare const onMediaShowView: (title: string, url: string, typeKind: '' | TypeKind) => void;
12
- declare const MediaShow: React.FC<Prop>;
13
- export default MediaShow;
11
+ export declare const onMediaShowView: (title: string, url: string, typeKind: TypeKind | '') => void;
12
+ declare const Index: React.FC<Prop>;
13
+ export default Index;
@@ -1,49 +1,24 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
2
  import React, { useState } from "react";
3
- import "./media-show.less";
4
- import Tool from "../lib/Tool";
3
+ import "./index.less";
4
+ import Tool from "../../lib/Tool";
5
5
  import { PlayCircleOutlined, SoundOutlined } from "@ant-design/icons";
6
- import { GetMineTypeByUrl } from "./media-kind";
7
- import getVideoUrl from "../lib/component/getVideoUrl";
6
+ import { GetMineTypeByUrl } from "../media-kind";
7
+ import MediaShowRender from "./render";
8
8
  import { jsx as _jsx } from "react/jsx-runtime";
9
9
  import { jsxs as _jsxs } from "react/jsx-runtime";
10
10
  export var onMediaShowView = function onMediaShowView(title, url, typeKind) {
11
- var mediaUrl = getVideoUrl(url);
12
11
  Tool.drawer({
13
12
  title: title,
14
- content: /*#__PURE__*/_jsxs("div", {
15
- className: "mediaShow",
16
- children: [["image", "font"].includes(typeKind) && /*#__PURE__*/_jsx("div", {
17
- className: "image",
18
- style: {
19
- backgroundImage: "url(\"".concat(mediaUrl, "\")")
20
- }
21
- }), typeKind === "audio" && /*#__PURE__*/_jsx("div", {
22
- className: "audio",
23
- children: /*#__PURE__*/_jsx("audio", {
24
- controls: true,
25
- autoPlay: true,
26
- children: /*#__PURE__*/_jsx("source", {
27
- src: mediaUrl
28
- })
29
- })
30
- }), typeKind === "video" && /*#__PURE__*/_jsx("div", {
31
- className: "video",
32
- children: /*#__PURE__*/_jsx("video", {
33
- width: "100%",
34
- height: "100%",
35
- controls: true,
36
- autoPlay: true,
37
- children: /*#__PURE__*/_jsx("source", {
38
- src: mediaUrl
39
- })
40
- })
41
- })]
13
+ content: /*#__PURE__*/_jsx(MediaShowRender, {
14
+ title: title,
15
+ url: url,
16
+ typeKind: typeKind
42
17
  }),
43
18
  width: 580
44
19
  });
45
20
  };
46
- var MediaShow = function MediaShow(_ref) {
21
+ var Index = function Index(_ref) {
47
22
  var _ref$title = _ref.title,
48
23
  title = _ref$title === void 0 ? '' : _ref$title,
49
24
  className = _ref.className,
@@ -81,4 +56,4 @@ var MediaShow = function MediaShow(_ref) {
81
56
  })]
82
57
  });
83
58
  };
84
- export default MediaShow;
59
+ export default Index;
File without changes
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import './render.less';
3
+ type TypeKind = 'video' | "image" | "font" | 'audio';
4
+ interface Props {
5
+ title: string;
6
+ url: string;
7
+ typeKind: '' | TypeKind;
8
+ }
9
+ export declare const MediaShowRender: React.FC<Props>;
10
+ export default MediaShowRender;
@@ -0,0 +1,111 @@
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 "./render.less";
6
+ import Tool from "../../lib/Tool";
7
+ import getVideoUrl from "../../lib/component/getVideoUrl";
8
+ import { jsx as _jsx } from "react/jsx-runtime";
9
+ import { Fragment as _Fragment } from "react/jsx-runtime";
10
+ import { jsxs as _jsxs } from "react/jsx-runtime";
11
+ export var MediaShowRender = function MediaShowRender(_ref) {
12
+ var title = _ref.title,
13
+ url = _ref.url,
14
+ typeKind = _ref.typeKind;
15
+ var _useState = useState(''),
16
+ _useState2 = _slicedToArray(_useState, 2),
17
+ pathLink = _useState2[0],
18
+ setPathLink = _useState2[1];
19
+ var fetchVideoAsBlob = /*#__PURE__*/function () {
20
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
21
+ var response, blob, _pathLink;
22
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
23
+ while (1) switch (_context.prev = _context.next) {
24
+ case 0:
25
+ if (!/^https?:/i.test(url)) {
26
+ _context.next = 3;
27
+ break;
28
+ }
29
+ setPathLink(url);
30
+ return _context.abrupt("return");
31
+ case 3:
32
+ _context.prev = 3;
33
+ _context.next = 6;
34
+ return fetch(getVideoUrl(url)).catch(function (err) {
35
+ Tool.toastError('获取视频失败');
36
+ });
37
+ case 6:
38
+ response = _context.sent;
39
+ if (response) {
40
+ _context.next = 9;
41
+ break;
42
+ }
43
+ return _context.abrupt("return");
44
+ case 9:
45
+ _context.next = 11;
46
+ return response.blob().catch(function (err) {
47
+ Tool.toastError('获取视频失败 2:' + (err === null || err === void 0 ? void 0 : err.message));
48
+ });
49
+ case 11:
50
+ blob = _context.sent;
51
+ if (blob) {
52
+ _context.next = 14;
53
+ break;
54
+ }
55
+ return _context.abrupt("return");
56
+ case 14:
57
+ _pathLink = URL.createObjectURL(blob);
58
+ setPathLink(_pathLink);
59
+ // const mediaUrl = getVideoUrl( url );
60
+ _context.next = 21;
61
+ break;
62
+ case 18:
63
+ _context.prev = 18;
64
+ _context.t0 = _context["catch"](3);
65
+ console.error('There has been a problem with your fetch operation:', _context.t0);
66
+ case 21:
67
+ case "end":
68
+ return _context.stop();
69
+ }
70
+ }, _callee, null, [[3, 18]]);
71
+ }));
72
+ return function fetchVideoAsBlob() {
73
+ return _ref2.apply(this, arguments);
74
+ };
75
+ }();
76
+ useEffect(function () {
77
+ fetchVideoAsBlob();
78
+ }, []);
79
+ return /*#__PURE__*/_jsx("div", {
80
+ className: "mediaShow",
81
+ children: pathLink ? /*#__PURE__*/_jsxs(_Fragment, {
82
+ children: [["image", "font"].includes(typeKind) && /*#__PURE__*/_jsx("div", {
83
+ className: "image",
84
+ style: {
85
+ backgroundImage: "url(\"".concat(pathLink, "\")")
86
+ }
87
+ }), typeKind === "audio" && /*#__PURE__*/_jsx("div", {
88
+ className: "audio",
89
+ children: /*#__PURE__*/_jsx("audio", {
90
+ controls: true,
91
+ autoPlay: true,
92
+ children: /*#__PURE__*/_jsx("source", {
93
+ src: pathLink
94
+ })
95
+ })
96
+ }), typeKind === "video" && /*#__PURE__*/_jsx("div", {
97
+ className: "video",
98
+ children: /*#__PURE__*/_jsx("video", {
99
+ width: "100%",
100
+ height: "100%",
101
+ controls: true,
102
+ autoPlay: true,
103
+ children: /*#__PURE__*/_jsx("source", {
104
+ src: pathLink
105
+ })
106
+ })
107
+ })]
108
+ }) : '...'
109
+ });
110
+ };
111
+ export default MediaShowRender;
@@ -38,7 +38,8 @@
38
38
  position: relative;
39
39
  display: flex;
40
40
  flex-direction: column;
41
- height: 100%;
41
+ height: 90vh;
42
+ overflow: hidden;
42
43
  justify-content: center;
43
44
  text-align: center;
44
45
  background-color: #000;
package/dist/lib/Tool.js CHANGED
@@ -13,7 +13,7 @@ if (!window.__events) {
13
13
 
14
14
  // import { history } from 'umi';
15
15
 
16
- import ReactDOM from 'react-dom';
16
+ import ReactDOM from 'react-dom/client';
17
17
  import { useRequest } from '@umijs/hooks';
18
18
  import moment from 'moment';
19
19
  import DialogDrawer from "../UI/DialogDrawer";
@@ -947,7 +947,9 @@ var Tool = _objectSpread(_objectSpread({
947
947
  drawer.id = id;
948
948
  query.id = id;
949
949
  document.body.appendChild(drawer);
950
- ReactDOM.render( /*#__PURE__*/_jsx(DialogDrawer, _objectSpread({}, query)), document.getElementById(id));
950
+ // ReactDOM.render(<DialogDrawer {...query} />, document.getElementById(id));
951
+
952
+ ReactDOM.createRoot(drawer).render( /*#__PURE__*/_jsx(DialogDrawer, _objectSpread({}, query)));
951
953
  var outData = {
952
954
  // onClose(){
953
955
  //
@@ -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 requestApi() {
9
- var _window$getBridge, _window, _window$getBridge$cal, _window$getBridge$cal2;
10
- var api = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
11
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
12
- // 要请求的 url
13
- var url = getApiUrl(api, options === null || options === void 0 ? void 0 : options.env);
14
- console.log('makeAjax int 20 111 url:', url, options);
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
- // const params = options.method === 'GET' ? options.data : {};
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
- var userInfo = Tool.getLocalUserInfo();
19
- var token = userInfo.sid;
20
- var postUrl = url + (url.indexOf('?') === -1 ? '?' : '&') + '_token_=' + token;
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
- }).catch(function (err) {
68
- var _err, _err2;
69
- console.log('ajax error:', err.name, err.message, err);
70
- if (!err) {
71
- err = new Error();
72
- }
73
- console.log('request component shipinlv:', JSON.stringify(err), url);
74
- if (!((_err = err) !== null && _err !== void 0 && _err.response) && url.indexOf("http://127.0.0.1:".concat(getMainPort())) === 0) {
75
- err.name = "shipinlv-client-not-run";
76
- err.message = "\u8FDE\u63A5\u672C\u5730\u670D\u52A1\u5931\u8D25\uFF0C\u8BF7\u5C1D\u8BD5\u91CD\u542F\u8F6F\u4EF6";
77
- reject(err);
78
- return;
79
- }
80
- if (['Failed to fetch', 'http error'].includes((_err2 = err) === null || _err2 === void 0 ? void 0 : _err2.message)) {
81
- err.message = '发生了一些问题,请稍后重试';
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
- Tool.toastError(err.message);
84
- onError(pageUrl, url, err.message, JSON.stringify(err), options === null || options === void 0 ? void 0 : options.silent);
85
- reject(err);
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] : '';
@@ -0,0 +1,11 @@
1
+ export declare function detail(body?: {
2
+ id: number;
3
+ }, options?: ServicesApi.RequestOptions): Promise<VideoPublishVideoAccountProxy.List>;
4
+ export declare function list(body?: {
5
+ current: number;
6
+ pageSize: number;
7
+ }, options?: ServicesApi.RequestOptions): Promise<VideoPublishVideoAccountProxy.ListResult>;
8
+ export declare function create(body: VideoPublishVideoAccountProxy.CreateQuery, options?: ServicesApi.RequestOptions): Promise<boolean>;
9
+ export declare function del(body: {
10
+ id: number;
11
+ }, options?: ServicesApi.RequestOptions): Promise<boolean>;