@luck-design-biz/luckda 1.0.1-11gcjs → 1.0.1-11gcjs3

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.
@@ -8,9 +8,9 @@ import React, { forwardRef, useEffect, useImperativeHandle } from 'react';
8
8
  import { Button, Checkbox, Dropdown, Icon, Modal, Upload } from 'luck-design/antd';
9
9
  import { useSetState } from 'ahooks';
10
10
  import PropTypes from 'prop-types';
11
- import { canPreview, formatMessage, patchDownload, request, showPop } from '@luck-design-biz/base/utils';
12
- import { getDvaApp } from 'umi';
13
- import { last, lowerCase, split } from 'lodash';
11
+ import { canPreview, formatMessage, patchDownload, request, showPop, string2ASCII } from '@luck-design-biz/base/utils';
12
+ import { getDvaApp, history, getCreateHistoryOptions } from 'umi';
13
+ import { last, lowerCase, split, replace } from 'lodash';
14
14
  import { Box, Permission, PermissionGroup } from 'luck-design';
15
15
  import styles from "./index.less";
16
16
 
@@ -150,12 +150,22 @@ var FilesWall = /*#__PURE__*/forwardRef(function (props, ref) {
150
150
  });
151
151
  onUploadChange && onUploadChange(e);
152
152
  };
153
+ var headers = {};
154
+ var token = window.cookie.get(window.appConfig.authSaveKey);
155
+ if (token) headers.Authorization = "Bearer ".concat(token);
156
+ var ticket = history.location.query.ticket;
157
+ if (ticket) headers.ticket = string2ASCII(ticket);
158
+ if (window.__POWERED_BY_QIANKUN__) {
159
+ var pathname = replace(window.location.pathname, getCreateHistoryOptions().basename, '');
160
+ headers['Mf-Path'] = pathname.length > 0 ? pathname : '/';
161
+ headers['Sys-Code'] = getCreateHistoryOptions().basename.split('/')[1];
162
+ if (window.routeCode) headers['Menu-Code'] = window.routeCode;
163
+ }
164
+ ;
153
165
  var formItemProps = _objectSpread(_objectSpread({}, rest), {}, {
154
166
  action: getUrl('upload'),
155
167
  // 上传地址
156
- headers: {
157
- Authorization: "Bearer ".concat(window.cookie.get(window.appConfig.authSaveKey))
158
- },
168
+ headers: headers,
159
169
  // 请求头
160
170
  name: 'files',
161
171
  multiple: true,
@@ -4,15 +4,15 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4
4
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
5
5
  var _excluded = ["formId", "formRef", "showNote", "operates", "loading", "uploadUrl", "supportTypes", "forbiddenTypes", "beforeUpload", "formMode", "onUploadChange", "zipName", "resetActions", "getUrl", "wrapperRef"];
6
6
  import React, { useState, useRef, forwardRef } from 'react';
7
- import { getDvaApp } from 'umi';
7
+ import { getDvaApp, history, getCreateHistoryOptions } from 'umi';
8
8
  import { useMemoizedFn, useCreation } from 'ahooks';
9
9
  import { Button, Upload, Tooltip, Icon } from 'luck-design/antd';
10
10
  import moment from 'moment';
11
- import { last } from 'lodash';
11
+ import { last, replace } from 'lodash';
12
12
  import { BasicForm, BasicFormItem, PopWindow } from 'luck-design';
13
13
  import api from "@/services/ApiConfig";
14
14
  import { FormBtn, GridForm } from '@luck-design-biz/base/FormList';
15
- import { byteConvert, formatMessage, beforeUpload as _beforeUpload2, getSupportUploadTypes, patchDownloadZip, showPop, request, canPreview } from '@luck-design-biz/base/utils';
15
+ import { byteConvert, formatMessage, beforeUpload as _beforeUpload2, getSupportUploadTypes, patchDownloadZip, showPop, request, canPreview, string2ASCII } from '@luck-design-biz/base/utils';
16
16
  var columns = [{
17
17
  field: 'name',
18
18
  title: '附件名称'
@@ -198,12 +198,22 @@ var UploadGridForm = function UploadGridForm(_ref) {
198
198
  }
199
199
  });
200
200
  var renderUploadTopLeft = useMemoizedFn(function () {
201
+ var headers = {};
202
+ var token = window.cookie.get(window.appConfig.authSaveKey);
203
+ if (token) headers.Authorization = "Bearer ".concat(token);
204
+ var ticket = history.location.query.ticket;
205
+ if (ticket) headers.ticket = string2ASCII(ticket);
206
+ if (window.__POWERED_BY_QIANKUN__) {
207
+ var pathname = replace(window.location.pathname, getCreateHistoryOptions().basename, '');
208
+ headers['Mf-Path'] = pathname.length > 0 ? pathname : '/';
209
+ headers['Sys-Code'] = getCreateHistoryOptions().basename.split('/')[1];
210
+ if (window.routeCode) headers['Menu-Code'] = window.routeCode;
211
+ }
212
+ ;
201
213
  var formItemProps = {
202
214
  action: uploadUrl || getUrl('upload'),
203
215
  // 上传地址
204
- headers: {
205
- Authorization: "Bearer ".concat(window.cookie.get(window.appConfig.authSaveKey))
206
- },
216
+ headers: headers,
207
217
  // 请求头
208
218
  name: 'files',
209
219
  multiple: true,
@@ -3,8 +3,10 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
4
4
  var _excluded = ["uploadUrl", "moduleCode", "bucket", "tag", "note", "config", "supportTypes", "forbiddenTypes", "children", "dataFormat", "listType"];
5
5
  import React from 'react';
6
+ import { replace } from 'lodash';
6
7
  import { BasicFormItem } from 'luck-design';
7
- import { formatMessage, beforeUpload as _beforeUpload, getSupportUploadTypes } from '@luck-design-biz/base/utils';
8
+ import { history, getCreateHistoryOptions } from 'umi';
9
+ import { formatMessage, beforeUpload as _beforeUpload, getSupportUploadTypes, string2ASCII } from '@luck-design-biz/base/utils';
8
10
 
9
11
  /**
10
12
  * 表单类型富文本上传
@@ -45,6 +47,18 @@ function buildComponent(props) {
45
47
  return "".concat(window.appConfig.OSS_HOST_V3, "?moduleCode=").concat(moduleCode, "&behaviorKey=").concat(behaviorKey, "&bucket=").concat(bucket, "&tag=").concat(tag, "&note=").concat(note);
46
48
  };
47
49
  var supportUploadTypes = getSupportUploadTypes(forbiddenTypes, supportTypes);
50
+ var headers = {};
51
+ var token = window.cookie.get(window.appConfig.authSaveKey);
52
+ if (token) headers.Authorization = "Bearer ".concat(token);
53
+ var ticket = history.location.query.ticket;
54
+ if (ticket) headers.ticket = string2ASCII(ticket);
55
+ if (window.__POWERED_BY_QIANKUN__) {
56
+ var pathname = replace(window.location.pathname, getCreateHistoryOptions().basename, '');
57
+ headers['Mf-Path'] = pathname.length > 0 ? pathname : '/';
58
+ headers['Sys-Code'] = getCreateHistoryOptions().basename.split('/')[1];
59
+ if (window.routeCode) headers['Menu-Code'] = window.routeCode;
60
+ }
61
+ ;
48
62
  return /*#__PURE__*/React.createElement(BasicFormItem, _extends({
49
63
  extra: "".concat(formatMessage({
50
64
  id: 'app.upload.supportUpload',
@@ -62,9 +76,7 @@ function buildComponent(props) {
62
76
  }),
63
77
  action: uploadUrl || getUrl('upload'),
64
78
  // 上传地址
65
- headers: {
66
- Authorization: "Bearer ".concat(window.cookie.get(window.appConfig.authSaveKey))
67
- },
79
+ headers: headers,
68
80
  // 请求头
69
81
  name: 'files',
70
82
  // 发送到后台的文件名
@@ -157,12 +157,22 @@ var FilesWall = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
157
157
  });
158
158
  onUploadChange && onUploadChange(e);
159
159
  };
160
+ var headers = {};
161
+ var token = window.cookie.get(window.appConfig.authSaveKey);
162
+ if (token) headers.Authorization = "Bearer ".concat(token);
163
+ var ticket = _umi.history.location.query.ticket;
164
+ if (ticket) headers.ticket = (0, _utils.string2ASCII)(ticket);
165
+ if (window.__POWERED_BY_QIANKUN__) {
166
+ var pathname = (0, _lodash.replace)(window.location.pathname, (0, _umi.getCreateHistoryOptions)().basename, '');
167
+ headers['Mf-Path'] = pathname.length > 0 ? pathname : '/';
168
+ headers['Sys-Code'] = (0, _umi.getCreateHistoryOptions)().basename.split('/')[1];
169
+ if (window.routeCode) headers['Menu-Code'] = window.routeCode;
170
+ }
171
+ ;
160
172
  var formItemProps = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, rest), {}, {
161
173
  action: getUrl('upload'),
162
174
  // 上传地址
163
- headers: {
164
- Authorization: "Bearer ".concat(window.cookie.get(window.appConfig.authSaveKey))
165
- },
175
+ headers: headers,
166
176
  // 请求头
167
177
  name: 'files',
168
178
  multiple: true,
@@ -206,12 +206,22 @@ var UploadGridForm = function UploadGridForm(_ref) {
206
206
  }
207
207
  });
208
208
  var renderUploadTopLeft = (0, _ahooks.useMemoizedFn)(function () {
209
+ var headers = {};
210
+ var token = window.cookie.get(window.appConfig.authSaveKey);
211
+ if (token) headers.Authorization = "Bearer ".concat(token);
212
+ var ticket = _umi.history.location.query.ticket;
213
+ if (ticket) headers.ticket = (0, _utils.string2ASCII)(ticket);
214
+ if (window.__POWERED_BY_QIANKUN__) {
215
+ var pathname = (0, _lodash.replace)(window.location.pathname, (0, _umi.getCreateHistoryOptions)().basename, '');
216
+ headers['Mf-Path'] = pathname.length > 0 ? pathname : '/';
217
+ headers['Sys-Code'] = (0, _umi.getCreateHistoryOptions)().basename.split('/')[1];
218
+ if (window.routeCode) headers['Menu-Code'] = window.routeCode;
219
+ }
220
+ ;
209
221
  var formItemProps = {
210
222
  action: uploadUrl || getUrl('upload'),
211
223
  // 上传地址
212
- headers: {
213
- Authorization: "Bearer ".concat(window.cookie.get(window.appConfig.authSaveKey))
214
- },
224
+ headers: headers,
215
225
  // 请求头
216
226
  name: 'files',
217
227
  multiple: true,
@@ -9,7 +9,9 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
9
9
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
10
10
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
11
  var _react = _interopRequireDefault(require("react"));
12
+ var _lodash = require("lodash");
12
13
  var _luckDesign = require("luck-design");
14
+ var _umi = require("umi");
13
15
  var _utils = require("@luck-design-biz/base/utils");
14
16
  var _excluded = ["uploadUrl", "moduleCode", "bucket", "tag", "note", "config", "supportTypes", "forbiddenTypes", "children", "dataFormat", "listType"];
15
17
  /**
@@ -51,6 +53,18 @@ function buildComponent(props) {
51
53
  return "".concat(window.appConfig.OSS_HOST_V3, "?moduleCode=").concat(moduleCode, "&behaviorKey=").concat(behaviorKey, "&bucket=").concat(bucket, "&tag=").concat(tag, "&note=").concat(note);
52
54
  };
53
55
  var supportUploadTypes = (0, _utils.getSupportUploadTypes)(forbiddenTypes, supportTypes);
56
+ var headers = {};
57
+ var token = window.cookie.get(window.appConfig.authSaveKey);
58
+ if (token) headers.Authorization = "Bearer ".concat(token);
59
+ var ticket = _umi.history.location.query.ticket;
60
+ if (ticket) headers.ticket = (0, _utils.string2ASCII)(ticket);
61
+ if (window.__POWERED_BY_QIANKUN__) {
62
+ var pathname = (0, _lodash.replace)(window.location.pathname, (0, _umi.getCreateHistoryOptions)().basename, '');
63
+ headers['Mf-Path'] = pathname.length > 0 ? pathname : '/';
64
+ headers['Sys-Code'] = (0, _umi.getCreateHistoryOptions)().basename.split('/')[1];
65
+ if (window.routeCode) headers['Menu-Code'] = window.routeCode;
66
+ }
67
+ ;
54
68
  return /*#__PURE__*/_react.default.createElement(_luckDesign.BasicFormItem, (0, _extends2.default)({
55
69
  extra: "".concat((0, _utils.formatMessage)({
56
70
  id: 'app.upload.supportUpload',
@@ -68,9 +82,7 @@ function buildComponent(props) {
68
82
  }),
69
83
  action: uploadUrl || getUrl('upload'),
70
84
  // 上传地址
71
- headers: {
72
- Authorization: "Bearer ".concat(window.cookie.get(window.appConfig.authSaveKey))
73
- },
85
+ headers: headers,
74
86
  // 请求头
75
87
  name: 'files',
76
88
  // 发送到后台的文件名
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luck-design-biz/luckda",
3
- "version": "1.0.1-11gcjs",
3
+ "version": "1.0.1-11gcjs3",
4
4
  "description": "前端配置管理中心业务组件库",
5
5
  "scripts": {
6
6
  "start": "cross-env NODE_OPTIONS=--max-old-space-size=10240 USER_RUNTIME=SITE RUNTIME=dev umi dev",
@@ -61,7 +61,7 @@
61
61
  "monaco-editor": "0.30.*",
62
62
  "postcss": "^8.4.38",
63
63
  "postcss-js": "^4.0.1",
64
- "postcss-nested": "^6.0.1",
64
+ "postcss-nested":"^6.0.1",
65
65
  "prettier": "^2.7.1",
66
66
  "prop-types": "^15.8.1",
67
67
  "querystring": "^0.2.0",
@@ -107,7 +107,6 @@
107
107
  "cross-var": "^1.1.0",
108
108
  "d3-selection": "^1.4.2",
109
109
  "dry-dry": "^0.4.0",
110
- "enzyme": "^3.11.0",
111
110
  "eslint": "^7.32.0",
112
111
  "eslint-plugin-babel": "^5.3.1",
113
112
  "eslint-plugin-react": "^7.31.10",
@@ -172,4 +171,4 @@
172
171
  "lib": "lib"
173
172
  },
174
173
  "author": ""
175
- }
174
+ }