xydata-tools 1.1.29 → 1.1.30
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.
|
@@ -186,7 +186,8 @@ export default {
|
|
|
186
186
|
enableAddButton: {
|
|
187
187
|
type: Boolean,
|
|
188
188
|
default: false
|
|
189
|
-
}
|
|
189
|
+
},
|
|
190
|
+
|
|
190
191
|
},
|
|
191
192
|
data() {
|
|
192
193
|
return {
|
|
@@ -205,7 +206,9 @@ export default {
|
|
|
205
206
|
changeStatus: true,
|
|
206
207
|
preStatus: true,
|
|
207
208
|
first: true,
|
|
208
|
-
lastTouchEndTime: null // 记录最后一次 touchend 的时间,用于避免重复触发
|
|
209
|
+
lastTouchEndTime: null, // 记录最后一次 touchend 的时间,用于避免重复触发
|
|
210
|
+
clickThreshold: 20,
|
|
211
|
+
longPressTime: 300
|
|
209
212
|
};
|
|
210
213
|
},
|
|
211
214
|
computed: {
|
|
@@ -447,12 +450,19 @@ export default {
|
|
|
447
450
|
item.zIndex = 99;
|
|
448
451
|
item.moveEnd = true;
|
|
449
452
|
this.tempItem = item;
|
|
453
|
+
|
|
454
|
+
// 记录起始坐标,用于通过位移判断点击
|
|
455
|
+
item.startX = item.oldX;
|
|
456
|
+
item.startY = item.oldY;
|
|
457
|
+
|
|
450
458
|
this.timer = setTimeout(() => {
|
|
451
459
|
item.scale = this.scale;
|
|
452
460
|
item.opacity = this.opacity;
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
461
|
+
if (this.timer) {
|
|
462
|
+
clearTimeout(this.timer);
|
|
463
|
+
this.timer = null;
|
|
464
|
+
}
|
|
465
|
+
}, this.longPressTime);
|
|
456
466
|
},
|
|
457
467
|
handleClick(item, type) {
|
|
458
468
|
// 设为disable后无法触发touch事件
|
|
@@ -485,13 +495,21 @@ export default {
|
|
|
485
495
|
}
|
|
486
496
|
|
|
487
497
|
// 判断是否为点击操作(而非拖动)
|
|
488
|
-
|
|
498
|
+
const moveDistance = Math.sqrt(Math.pow(item.oldX - (item.startX || 0), 2) + Math.pow(item.oldY - (item.startY || 0), 2));
|
|
499
|
+
const isClickAction = this.timer && moveDistance < this.rpx2px(this.clickThreshold);
|
|
500
|
+
|
|
501
|
+
if (isClickAction && this.preStatus && this.changeStatus) {
|
|
489
502
|
if (this.moveType === 'video') {
|
|
490
503
|
this.playVideo(item);
|
|
491
504
|
} else {
|
|
492
|
-
|
|
505
|
+
setTimeout(()=>{
|
|
506
|
+
this.previewImage(item);
|
|
507
|
+
},0)
|
|
493
508
|
}
|
|
494
|
-
}
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
// 无论是否触发点击,都需清理计时器防止后续意外放大
|
|
512
|
+
if (this.timer) {
|
|
495
513
|
clearTimeout(this.timer);
|
|
496
514
|
this.timer = null;
|
|
497
515
|
}
|
|
@@ -688,6 +706,8 @@ export default {
|
|
|
688
706
|
id: this.guid(16),
|
|
689
707
|
disable: false,
|
|
690
708
|
offset: 0,
|
|
709
|
+
startX: 0,
|
|
710
|
+
startY: 0,
|
|
691
711
|
moveEnd: false,
|
|
692
712
|
loading: true
|
|
693
713
|
});
|
|
@@ -6,6 +6,7 @@ import { useEffect } from 'react';
|
|
|
6
6
|
import { getSessionStorage, setSessionStorage, removeSessionStorage } from "../../utils/token.js";
|
|
7
7
|
import { message, Spin } from 'antd';
|
|
8
8
|
import { queryAaaCurrent, queryCurrent, accountAAALogout } from "../../services/service.js";
|
|
9
|
+
import { getQueryVariable } from "../../utils/utils";
|
|
9
10
|
|
|
10
11
|
// ========== 公共辅助函数 ==========
|
|
11
12
|
|
|
@@ -240,8 +241,9 @@ var XyAuthLayout = function XyAuthLayout(props) {
|
|
|
240
241
|
var token = getSessionStorage('Token');
|
|
241
242
|
var loginType = envData.login_type || 'BOTH';
|
|
242
243
|
var pathName = window.location.pathname;
|
|
244
|
+
var loginId = getQueryVariable('loginId');
|
|
243
245
|
useEffect(function () {
|
|
244
|
-
if (!token) {
|
|
246
|
+
if (!token && !(loginId && ['BOTH', 'AAA'].includes(loginType))) {
|
|
245
247
|
// 当登录方式为SSO_NEW或BOTH时,可在路径加上sso进行统一登陆,当登录方式固定为SSO或SSO_NEW时,直接跳转到SSO登录
|
|
246
248
|
if (['SSO_NEW', 'BOTH'].includes(loginType) && pathName.indexOf('/sso') >= 0 || ['SSO', 'SSO_NEW'].includes(loginType)) {
|
|
247
249
|
setSessionStorage('sso_redirect_url', window.location.href);
|
|
@@ -251,11 +253,12 @@ var XyAuthLayout = function XyAuthLayout(props) {
|
|
|
251
253
|
window.location.href = "".concat(window.publicPath || '/', "user/login");
|
|
252
254
|
}
|
|
253
255
|
} else {
|
|
254
|
-
|
|
256
|
+
// 当有TOKEN或者AAA登录并携带loginId时可进入
|
|
257
|
+
getUserinfo(loginId);
|
|
255
258
|
}
|
|
256
259
|
}, []);
|
|
257
260
|
var getUserinfo = /*#__PURE__*/function () {
|
|
258
|
-
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
261
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(loginId) {
|
|
259
262
|
var response;
|
|
260
263
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
261
264
|
while (1) switch (_context4.prev = _context4.next) {
|
|
@@ -273,12 +276,16 @@ var XyAuthLayout = function XyAuthLayout(props) {
|
|
|
273
276
|
break;
|
|
274
277
|
case 7:
|
|
275
278
|
_context4.next = 9;
|
|
276
|
-
return queryAaaCurrent({}
|
|
279
|
+
return queryAaaCurrent({}, {
|
|
280
|
+
headers: {
|
|
281
|
+
loginId: loginId
|
|
282
|
+
}
|
|
283
|
+
});
|
|
277
284
|
case 9:
|
|
278
285
|
_context4.t0 = _context4.sent;
|
|
279
286
|
case 10:
|
|
280
287
|
response = _context4.t0;
|
|
281
|
-
if (!((response === null || response === void 0 ? void 0 : response.status) === 401
|
|
288
|
+
if (!((response === null || response === void 0 ? void 0 : response.status) === 401)) {
|
|
282
289
|
_context4.next = 17;
|
|
283
290
|
break;
|
|
284
291
|
}
|
|
@@ -311,7 +318,7 @@ var XyAuthLayout = function XyAuthLayout(props) {
|
|
|
311
318
|
}
|
|
312
319
|
}, _callee4, null, [[0, 20]]);
|
|
313
320
|
}));
|
|
314
|
-
return function getUserinfo() {
|
|
321
|
+
return function getUserinfo(_x) {
|
|
315
322
|
return _ref4.apply(this, arguments);
|
|
316
323
|
};
|
|
317
324
|
}();
|
|
@@ -319,6 +326,7 @@ var XyAuthLayout = function XyAuthLayout(props) {
|
|
|
319
326
|
// 加载状态
|
|
320
327
|
if (!token) {
|
|
321
328
|
return /*#__PURE__*/_jsx("div", {
|
|
329
|
+
className: "xyAuthLayoutLoading",
|
|
322
330
|
style: {
|
|
323
331
|
display: 'flex',
|
|
324
332
|
justifyContent: 'center',
|
package/dist/services/service.js
CHANGED
|
@@ -24,17 +24,17 @@ function _queryCurrent() {
|
|
|
24
24
|
}));
|
|
25
25
|
return _queryCurrent.apply(this, arguments);
|
|
26
26
|
}
|
|
27
|
-
export function queryAaaCurrent(_x2) {
|
|
27
|
+
export function queryAaaCurrent(_x2, _x3) {
|
|
28
28
|
return _queryAaaCurrent.apply(this, arguments);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
// 退出登录 | aaa
|
|
32
32
|
function _queryAaaCurrent() {
|
|
33
|
-
_queryAaaCurrent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
|
|
33
|
+
_queryAaaCurrent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params, options) {
|
|
34
34
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
35
35
|
while (1) switch (_context2.prev = _context2.next) {
|
|
36
36
|
case 0:
|
|
37
|
-
return _context2.abrupt("return", doRequest('/api/aaa/current', 'POST', params));
|
|
37
|
+
return _context2.abrupt("return", doRequest('/api/aaa/current', 'POST', params, options));
|
|
38
38
|
case 1:
|
|
39
39
|
case "end":
|
|
40
40
|
return _context2.stop();
|
|
@@ -43,7 +43,7 @@ function _queryAaaCurrent() {
|
|
|
43
43
|
}));
|
|
44
44
|
return _queryAaaCurrent.apply(this, arguments);
|
|
45
45
|
}
|
|
46
|
-
export function accountAAALogout(
|
|
46
|
+
export function accountAAALogout(_x4) {
|
|
47
47
|
return _accountAAALogout.apply(this, arguments);
|
|
48
48
|
}
|
|
49
49
|
function _accountAAALogout() {
|
package/dist/utils/request.js
CHANGED
|
@@ -11,7 +11,7 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
|
|
|
11
11
|
* request 网络请求工具
|
|
12
12
|
*/
|
|
13
13
|
import { notification, message } from 'antd';
|
|
14
|
-
import { getSessionStorage } from "./token.js";
|
|
14
|
+
import { getSessionStorage, setSessionStorage } from "./token.js";
|
|
15
15
|
import { handleUnauthorized } from "../components";
|
|
16
16
|
|
|
17
17
|
/* ********************************************************************************************************************************* */
|
|
@@ -133,6 +133,7 @@ function _doRequest() {
|
|
|
133
133
|
token,
|
|
134
134
|
response,
|
|
135
135
|
fetchOptions,
|
|
136
|
+
_token,
|
|
136
137
|
result,
|
|
137
138
|
rspCode,
|
|
138
139
|
_args2 = arguments;
|
|
@@ -177,36 +178,41 @@ function _doRequest() {
|
|
|
177
178
|
return _context2.abrupt("return", errorHandler(null));
|
|
178
179
|
case 16:
|
|
179
180
|
if (!response.ok) {
|
|
180
|
-
_context2.next =
|
|
181
|
+
_context2.next = 32;
|
|
181
182
|
break;
|
|
182
183
|
}
|
|
183
184
|
_context2.prev = 17;
|
|
184
|
-
|
|
185
|
+
// 如果获取用户的接口上有返回token,那么存储token
|
|
186
|
+
_token = response.headers.get('Authorization');
|
|
187
|
+
if (response.url.indexOf('/api/aaa/current') && _token) {
|
|
188
|
+
setSessionStorage('Token', _token);
|
|
189
|
+
}
|
|
190
|
+
_context2.next = 22;
|
|
185
191
|
return response.clone().json();
|
|
186
|
-
case
|
|
192
|
+
case 22:
|
|
187
193
|
result = _context2.sent;
|
|
188
194
|
rspCode = result.rspCode; // 状态编码只有在已定义的,需要处理的编码里才会返回响应,否则会进入错误回调
|
|
189
195
|
if (!(rspCode && PROCESS_RESPONSE_CODES.includes(rspCode))) {
|
|
190
|
-
_context2.next =
|
|
196
|
+
_context2.next = 26;
|
|
191
197
|
break;
|
|
192
198
|
}
|
|
193
199
|
return _context2.abrupt("return", result);
|
|
194
|
-
case 24:
|
|
195
|
-
_context2.next = 30;
|
|
196
|
-
break;
|
|
197
200
|
case 26:
|
|
198
|
-
_context2.
|
|
201
|
+
_context2.next = 32;
|
|
202
|
+
break;
|
|
203
|
+
case 28:
|
|
204
|
+
_context2.prev = 28;
|
|
199
205
|
_context2.t1 = _context2["catch"](17);
|
|
200
206
|
// JSON 解析失败,按网络异常处理
|
|
201
207
|
console.error(_context2.t1);
|
|
202
208
|
return _context2.abrupt("return", errorHandler(null));
|
|
203
|
-
case
|
|
209
|
+
case 32:
|
|
204
210
|
return _context2.abrupt("return", errorHandler(response));
|
|
205
|
-
case
|
|
211
|
+
case 33:
|
|
206
212
|
case "end":
|
|
207
213
|
return _context2.stop();
|
|
208
214
|
}
|
|
209
|
-
}, _callee2, null, [[4, 12], [17,
|
|
215
|
+
}, _callee2, null, [[4, 12], [17, 28]]);
|
|
210
216
|
}));
|
|
211
217
|
return _doRequest.apply(this, arguments);
|
|
212
218
|
}
|
package/dist/utils/utils.js
CHANGED
|
@@ -31,15 +31,17 @@ export var asyncCallback = function asyncCallback(res, isTip) {
|
|
|
31
31
|
* @returns {string|boolean} - 返回查询参数的值,如果不存在则返回 false
|
|
32
32
|
*/
|
|
33
33
|
export function getQueryVariable(variable) {
|
|
34
|
-
var
|
|
34
|
+
var parts = window.location.href.split('?');
|
|
35
|
+
if (parts.length < 2) return null;
|
|
36
|
+
var query = parts[1];
|
|
35
37
|
var vars = query.split('&');
|
|
36
38
|
for (var i = 0; i < vars.length; i++) {
|
|
37
39
|
var pair = vars[i].split('=');
|
|
38
|
-
if (pair[0]
|
|
39
|
-
return pair[1];
|
|
40
|
+
if (decodeURIComponent(pair[0]) === variable) {
|
|
41
|
+
return decodeURIComponent(pair[1]);
|
|
40
42
|
}
|
|
41
43
|
}
|
|
42
|
-
return
|
|
44
|
+
return null;
|
|
43
45
|
}
|
|
44
46
|
|
|
45
47
|
/**
|