component-shipinlv 2.2.11 → 2.2.13

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.
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ interface Props {
4
+ productType: string;
5
+ from: Ad.From;
6
+ position: string;
7
+ dealerId: number;
8
+ env?: Global.Env;
9
+ }
10
+ declare const Ad: React.FC<Props>;
11
+ export default Ad;
@@ -0,0 +1,141 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
3
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4
+ import { useRequest } from "@umijs/hooks";
5
+ import * as AdController from "../service/api/AdController";
6
+ import React, { useRef, useState } from 'react';
7
+ import { LoadingOutlined, WarningOutlined } from "@ant-design/icons";
8
+ import "./index.less";
9
+ import { Image } from "antd";
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
+ import { jsxs as _jsxs } from "react/jsx-runtime";
12
+ var Ad = function Ad(_ref) {
13
+ var productType = _ref.productType,
14
+ from = _ref.from,
15
+ position = _ref.position,
16
+ dealerId = _ref.dealerId,
17
+ env = _ref.env;
18
+ var listDataRef = useRef([]);
19
+ var currentIndexRef = useRef(0);
20
+ var _useState = useState({
21
+ id: 0,
22
+ title: '',
23
+ url: '',
24
+ thumbUrl: '',
25
+ openTarget: 'url',
26
+ enabled: true,
27
+ orderIndex: 0,
28
+ disabledUrlQuery: [],
29
+ created: 0
30
+ }),
31
+ _useState2 = _slicedToArray(_useState, 2),
32
+ currentItem = _useState2[0],
33
+ setCurrentItem = _useState2[1];
34
+ var _useState3 = useState(false),
35
+ _useState4 = _slicedToArray(_useState3, 2),
36
+ imageVisible = _useState4[0],
37
+ setImageVisible = _useState4[1];
38
+ var _useState5 = useState(''),
39
+ _useState6 = _slicedToArray(_useState5, 2),
40
+ imageUrl = _useState6[0],
41
+ setImageUrl = _useState6[1];
42
+ var timerRef = useRef(setTimeout(function () {}, 0));
43
+ var _useRequest = useRequest(function () {
44
+ return AdController.list({
45
+ productType: productType,
46
+ from: from,
47
+ position: position,
48
+ dealerId: dealerId
49
+ }, {
50
+ env: env
51
+ });
52
+ }, {
53
+ onSuccess: function onSuccess(result) {
54
+ listDataRef.current = _toConsumableArray(result);
55
+ if (result.length > 0) {
56
+ setCurrentItem(_objectSpread({}, result[0]));
57
+ onLoop();
58
+ }
59
+ }
60
+ }),
61
+ loading = _useRequest.loading,
62
+ run = _useRequest.run,
63
+ error = _useRequest.error;
64
+ var onLoop = function onLoop() {
65
+ timerRef.current = setTimeout(function () {
66
+ onNext();
67
+ }, 5000);
68
+ };
69
+ var onNext = function onNext() {
70
+ var i = 0;
71
+ if (currentIndexRef.current + 1 >= listDataRef.current.length) {
72
+ currentIndexRef.current = 0;
73
+ } else {
74
+ currentIndexRef.current++;
75
+ }
76
+ console.log('onNext i:', currentIndexRef.current, listDataRef);
77
+ setCurrentItem(_objectSpread({}, listDataRef.current[currentIndexRef.current]));
78
+ onLoop();
79
+ };
80
+ var onOpen = function onOpen(currentItem) {
81
+ var _window$getBridge, _window$getBridge$ope;
82
+ switch (currentItem.openTarget) {
83
+ case "url":
84
+ if (from === 'web') {
85
+ return true;
86
+ }
87
+ (_window$getBridge = window.getBridge()) === null || _window$getBridge === void 0 || (_window$getBridge$ope = _window$getBridge.openLocalBrowser) === null || _window$getBridge$ope === void 0 || _window$getBridge$ope.call(_window$getBridge, currentItem.url);
88
+ break;
89
+ case "image":
90
+ setImageUrl(currentItem.url);
91
+ setImageVisible(true);
92
+ break;
93
+ }
94
+ return false;
95
+ };
96
+ return /*#__PURE__*/_jsxs("div", {
97
+ className: "ad",
98
+ children: [error ? /*#__PURE__*/_jsxs("a", {
99
+ onClick: function onClick() {
100
+ return run();
101
+ },
102
+ children: [/*#__PURE__*/_jsx(WarningOutlined, {
103
+ className: "reload"
104
+ }), " \u91CD\u8BD5"]
105
+ }) : loading ? /*#__PURE__*/_jsx(LoadingOutlined, {}) : /*#__PURE__*/_jsx("div", {
106
+ className: "adList",
107
+ onMouseEnter: function onMouseEnter() {
108
+ return clearTimeout(timerRef.current);
109
+ },
110
+ onMouseLeave: function onMouseLeave() {
111
+ return onLoop();
112
+ },
113
+ children: /*#__PURE__*/_jsx("a", {
114
+ href: currentItem.url,
115
+ target: "_blank",
116
+ onClick: function onClick(e) {
117
+ if (!onOpen(currentItem)) {
118
+ e.preventDefault();
119
+ e.stopPropagation();
120
+ return false;
121
+ }
122
+ },
123
+ children: currentItem.title
124
+ })
125
+ }), /*#__PURE__*/_jsx(Image, {
126
+ style: {
127
+ display: 'none'
128
+ },
129
+ src: "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png?x-oss-process=image/blur,r_50,s_50/quality,q_1/resize,m_mfit,h_200,w_200",
130
+ preview: {
131
+ visible: imageVisible,
132
+ src: imageUrl,
133
+ // 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',
134
+ onVisibleChange: function onVisibleChange(value) {
135
+ setImageVisible(value);
136
+ }
137
+ }
138
+ })]
139
+ });
140
+ };
141
+ export default Ad;
@@ -0,0 +1,8 @@
1
+ .ad{
2
+ overflow: hidden;
3
+ word-break: keep-all;
4
+ word-wrap: anywhere;
5
+ .reload{
6
+ color: #C00;
7
+ }
8
+ }
@@ -7,6 +7,9 @@ interface Props {
7
7
  domain?: string;
8
8
  env?: Global.Env;
9
9
  roleType?: UserAuth.RoleType;
10
+ postData: {
11
+ [name: string]: any;
12
+ };
10
13
  onLoginSuccess: () => void;
11
14
  }
12
15
  declare const Auth: React.FC<Props>;
@@ -30,6 +30,7 @@ var Auth = function Auth(_ref) {
30
30
  clientUniqueKeyList = _ref.clientUniqueKeyList,
31
31
  loginTypeList = _ref.loginTypeList,
32
32
  env = _ref.env,
33
+ postData = _ref.postData,
33
34
  roleType = _ref.roleType,
34
35
  _ref$domain = _ref.domain,
35
36
  domain = _ref$domain === void 0 ? document.location.hostname : _ref$domain,
@@ -330,6 +331,7 @@ var Auth = function Auth(_ref) {
330
331
  env: env,
331
332
  apiUrl: apiUrl,
332
333
  roleType: roleType,
334
+ postData: postData,
333
335
  productType: productType,
334
336
  clientUniqueKeyList: clientUniqueKeyList,
335
337
  accountRegDisabled: !loginTypeList.includes('account-reg'),
@@ -7,6 +7,9 @@ interface Props {
7
7
  clientUniqueKeyList: string[];
8
8
  activeKeyDefault?: 'login' | 'reg' | string;
9
9
  accountRegDisabled?: boolean;
10
+ postData?: {
11
+ [name: string]: any;
12
+ };
10
13
  onSuccess: () => void;
11
14
  }
12
15
  declare const AuthLoginReg: React.FC<Props>;
@@ -12,6 +12,7 @@ var AuthLoginReg = function AuthLoginReg(_ref) {
12
12
  productType = _ref.productType,
13
13
  apiUrl = _ref.apiUrl,
14
14
  roleType = _ref.roleType,
15
+ postData = _ref.postData,
15
16
  clientUniqueKeyList = _ref.clientUniqueKeyList,
16
17
  _ref$activeKeyDefault = _ref.activeKeyDefault,
17
18
  activeKeyDefault = _ref$activeKeyDefault === void 0 ? 'reg' : _ref$activeKeyDefault,
@@ -51,6 +52,7 @@ var AuthLoginReg = function AuthLoginReg(_ref) {
51
52
  roleType: roleType,
52
53
  env: env,
53
54
  apiUrl: apiUrl,
55
+ postData: postData,
54
56
  productType: productType,
55
57
  clientUniqueKeyList: clientUniqueKeyList,
56
58
  onSuccess: function onSuccess() {
@@ -63,6 +65,7 @@ var AuthLoginReg = function AuthLoginReg(_ref) {
63
65
  env: env,
64
66
  roleType: roleType,
65
67
  productType: productType,
68
+ postData: postData,
66
69
  clientUniqueKeyList: clientUniqueKeyList,
67
70
  onSuccess: function onSuccess() {
68
71
  return _onSuccess();
@@ -2,6 +2,9 @@ import React from 'react';
2
2
  interface Props {
3
3
  env?: Global.Env;
4
4
  apiUrl?: string;
5
+ postData?: {
6
+ [name: string]: any;
7
+ };
5
8
  roleType?: UserAuth.RoleType;
6
9
  productType: string;
7
10
  clientUniqueKeyList: string[];
@@ -48,6 +48,7 @@ var AuthReg = function AuthReg(_ref) {
48
48
  apiUrl = _ref.apiUrl,
49
49
  roleType = _ref.roleType,
50
50
  productType = _ref.productType,
51
+ postData = _ref.postData,
51
52
  clientUniqueKeyList = _ref.clientUniqueKeyList,
52
53
  _ref$onSuccess = _ref.onSuccess,
53
54
  onSuccess = _ref$onSuccess === void 0 ? function () {} : _ref$onSuccess;
@@ -60,12 +61,13 @@ var AuthReg = function AuthReg(_ref) {
60
61
  form = _Form$useForm2[0];
61
62
  var _useRequest = useRequest(function (data) {
62
63
  var unbind = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
63
- return AuthController.login(_objectSpread(_objectSpread({
64
+ return AuthController.login(_objectSpread(_objectSpread(_objectSpread({
64
65
  productType: productType,
65
66
  clientUniqueKeyList: clientUniqueKeyList,
66
67
  from: "web"
67
68
  }, data), {}, {
68
- unbind: unbind,
69
+ unbind: unbind
70
+ }, postData), {}, {
69
71
  inviteUserId: Tool.getInviteUserId()
70
72
  }), {
71
73
  env: env,
@@ -3,6 +3,9 @@ interface Props {
3
3
  env?: Global.Env;
4
4
  roleType?: UserAuth.RoleType;
5
5
  productType: string;
6
+ postData?: {
7
+ [name: string]: any;
8
+ };
6
9
  clientUniqueKeyList: string[];
7
10
  onSuccess: () => void;
8
11
  }
@@ -44,6 +44,7 @@ var Reg = function Reg(_ref) {
44
44
  var env = _ref.env,
45
45
  roleType = _ref.roleType,
46
46
  productType = _ref.productType,
47
+ postData = _ref.postData,
47
48
  clientUniqueKeyList = _ref.clientUniqueKeyList,
48
49
  _ref$onSuccess = _ref.onSuccess,
49
50
  onSuccess = _ref$onSuccess === void 0 ? function () {} : _ref$onSuccess;
@@ -51,10 +52,10 @@ var Reg = function Reg(_ref) {
51
52
  _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
52
53
  form = _Form$useForm2[0];
53
54
  var _useRequest = useRequest(function (data) {
54
- return AuthController.reg(_objectSpread(_objectSpread({
55
+ return AuthController.reg(_objectSpread(_objectSpread(_objectSpread({
55
56
  productType: productType,
56
57
  clientUniqueKeyList: clientUniqueKeyList
57
- }, data), {}, {
58
+ }, data), postData), {}, {
58
59
  inviteUserId: Tool.getInviteUserId()
59
60
  }), {
60
61
  env: env
@@ -120,7 +120,7 @@ var VideoPublishLog = function VideoPublishLog(_ref) {
120
120
  setLastTaskApplyTime(Math.floor(Date.now() * 0.001));
121
121
  });
122
122
  event.on('ws-message.publish-video-log-publish-video', function (query) {
123
- console.log('ws-message publish-video -log-publish-video:', query);
123
+ // console.log('ws-message publish-video -log-publish-video:', query );
124
124
  if (query.dataType !== 'publish-video-log-publish-video') {
125
125
  return;
126
126
  }
package/dist/index.d.ts CHANGED
@@ -28,3 +28,4 @@ export { default as fileList } from './base/fileList';
28
28
  export { default as VideoStudy } from './video-study';
29
29
  export { default as HomePageAccountList } from './VideoPublish/account-manage/list';
30
30
  export { default as getWorkServerUploadToken } from './lib/getWorkServerUploadToken';
31
+ export { default as Ad } from './Ad';
package/dist/index.js CHANGED
@@ -31,4 +31,5 @@ export { default as fileListContent } from "./base/fileListContent";
31
31
  export { default as fileList } from "./base/fileList";
32
32
  export { default as VideoStudy } from "./video-study";
33
33
  export { default as HomePageAccountList } from "./VideoPublish/account-manage/list";
34
- export { default as getWorkServerUploadToken } from "./lib/getWorkServerUploadToken";
34
+ export { default as getWorkServerUploadToken } from "./lib/getWorkServerUploadToken";
35
+ export { default as Ad } from "./Ad";
@@ -0,0 +1,6 @@
1
+ export declare function list(body: {
2
+ productType: string;
3
+ from: 'web' | 'client';
4
+ position: string;
5
+ dealerId: number;
6
+ }, options?: Global.RequestOptions): Promise<Ad.List[]>;
@@ -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 list(_x, _x2) {
6
+ return _list.apply(this, arguments);
7
+ }
8
+ function _list() {
9
+ _list = _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("ad/list", _objectSpread({
14
+ method: 'POST',
15
+ headers: {
16
+ 'Content-Type': 'application/json'
17
+ },
18
+ data: body
19
+ }, options || {})));
20
+ case 1:
21
+ case "end":
22
+ return _context.stop();
23
+ }
24
+ }, _callee);
25
+ }));
26
+ return _list.apply(this, arguments);
27
+ }
@@ -0,0 +1,15 @@
1
+ declare namespace Ad {
2
+ type OpenTarget = 'url' | 'image';
3
+ type From = 'web' | 'client';
4
+ interface List {
5
+ id: number;
6
+ title: string;
7
+ url: string;
8
+ thumbUrl: string;
9
+ openTarget: OpenTarget;
10
+ enabled: true;
11
+ orderIndex: number;
12
+ disabledUrlQuery: string[];
13
+ created: number;
14
+ }
15
+ }
File without changes
package/dist/window.d.ts CHANGED
@@ -24,7 +24,7 @@ declare interface Window{
24
24
  fs: any;
25
25
  getIpc: any;
26
26
  openDir: ( dir: string ) => Promise<string>
27
-
27
+ openLocalBrowser: ( url: string, path: string = '' ) => {};
28
28
  openVideoAccountBrowser: ( platform: string, subPlatform: string, accountId: string, url: string , proxyInfo?: Global.ProxyInfo ) => void;
29
29
  };
30
30
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "component-shipinlv",
3
- "version": "2.2.11",
3
+ "version": "2.2.13",
4
4
  "description": "",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",