ebaoferc 0.0.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.
@@ -0,0 +1,295 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
8
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
9
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
10
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
11
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
12
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
13
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
14
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
15
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
16
+ // @ts-nocheck
17
+ import cls from 'classnames';
18
+ import React, { useCallback, useEffect, useRef, useState } from 'react';
19
+ import Close from "./icons/close";
20
+ import Refresh from "./icons/refresh";
21
+ import Slider from "./icons/slider";
22
+ import style from "./style.module.less";
23
+ import { jsx as _jsx } from "react/jsx-runtime";
24
+ import { jsxs as _jsxs } from "react/jsx-runtime";
25
+ var getPagePos = function getPagePos(event) {
26
+ if ('pageX' in event) {
27
+ return {
28
+ x: event.pageX,
29
+ y: event.pageY
30
+ };
31
+ }
32
+ if ('touches' in event) {
33
+ var touch = event.touches[0] || event.changedTouches[0];
34
+ return {
35
+ x: touch.pageX,
36
+ y: touch.pageY
37
+ };
38
+ }
39
+ return {
40
+ x: 0,
41
+ y: 0
42
+ };
43
+ };
44
+ var getEventShim = function getEventShim() {
45
+ var ua = navigator.userAgent.toLowerCase();
46
+ var isSupportTouch = /mobile|android|iphone|ipad|ipod|phone/.test(ua);
47
+ return isSupportTouch ? {
48
+ start: 'touchstart',
49
+ move: 'touchmove',
50
+ end: 'touchend'
51
+ } : {
52
+ start: 'mousedown',
53
+ move: 'mousemove',
54
+ end: 'mouseup'
55
+ };
56
+ };
57
+ export default function SliderVerify(props) {
58
+ var id = useRef('');
59
+ var _useState = useState(''),
60
+ _useState2 = _slicedToArray(_useState, 2),
61
+ bgImg = _useState2[0],
62
+ setBgImg = _useState2[1];
63
+ var _useState3 = useState(''),
64
+ _useState4 = _slicedToArray(_useState3, 2),
65
+ verifyImg = _useState4[0],
66
+ setVerifyImg = _useState4[1];
67
+ var currentCaptchaConfig = useRef({
68
+ startSlidingTime: new Date(),
69
+ endSlidingTime: new Date(),
70
+ trackList: [],
71
+ movePercent: 0,
72
+ bgImageWidth: 0,
73
+ bgImageHeight: 0,
74
+ sliderImageWidth: 0,
75
+ sliderImageHeight: 0,
76
+ end: 0,
77
+ startX: 0,
78
+ startY: 0,
79
+ moveX: 0
80
+ });
81
+ var sliderMoveBtn = useRef(null);
82
+ var sliderImgDiv = useRef(null);
83
+ var bgImgRef = useRef(null);
84
+ var reset = function reset() {
85
+ var bgImageWidth = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
86
+ var bgImageHeight = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
87
+ var sliderImageWidth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
88
+ var sliderImageHeight = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
89
+ var end = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 206;
90
+ if (sliderMoveBtn.current) {
91
+ sliderMoveBtn.current.style.transform = 'translate(0px, 0px)';
92
+ }
93
+ if (sliderImgDiv.current) {
94
+ sliderImgDiv.current.style.transform = 'translate(0px, 0px)';
95
+ }
96
+ currentCaptchaConfig.current = {
97
+ startSlidingTime: new Date(),
98
+ endSlidingTime: new Date(),
99
+ trackList: [],
100
+ movePercent: 0,
101
+ bgImageWidth: bgImageWidth,
102
+ bgImageHeight: bgImageHeight,
103
+ sliderImageWidth: sliderImageWidth,
104
+ sliderImageHeight: sliderImageHeight,
105
+ end: end,
106
+ startX: 0,
107
+ startY: 0,
108
+ moveX: 0
109
+ };
110
+ };
111
+ var fetchVerify = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
112
+ var data, captcha;
113
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
114
+ while (1) switch (_context.prev = _context.next) {
115
+ case 0:
116
+ _context.next = 2;
117
+ return props.getVerifyCode();
118
+ case 2:
119
+ data = _context.sent;
120
+ id.current = data.id;
121
+ captcha = data.captcha;
122
+ setBgImg(captcha.backgroundImage);
123
+ setVerifyImg(captcha.sliderImage);
124
+ reset(captcha.backgroundImageWidth, captcha.backgroundImageHeight, captcha.sliderImageWidth, captcha.sliderImageHeight);
125
+ case 8:
126
+ case "end":
127
+ return _context.stop();
128
+ }
129
+ }, _callee);
130
+ })), [props.getVerifyCode]);
131
+ var validate = /*#__PURE__*/function () {
132
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
133
+ var result, _props$onSuccess, _props$onFail;
134
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
135
+ while (1) switch (_context2.prev = _context2.next) {
136
+ case 0:
137
+ _context2.next = 2;
138
+ return props.checkVerifyCode(_objectSpread({
139
+ id: id.current
140
+ }, currentCaptchaConfig.current));
141
+ case 2:
142
+ result = _context2.sent;
143
+ if (result.matching) {
144
+ reset();
145
+ (_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 || _props$onSuccess.call(props, result);
146
+ } else {
147
+ fetchVerify();
148
+ (_props$onFail = props.onFail) === null || _props$onFail === void 0 || _props$onFail.call(props);
149
+ }
150
+ case 4:
151
+ case "end":
152
+ return _context2.stop();
153
+ }
154
+ }, _callee2);
155
+ }));
156
+ return function validate() {
157
+ return _ref2.apply(this, arguments);
158
+ };
159
+ }();
160
+ var move = function move(event) {
161
+ var _getPagePos = getPagePos(event),
162
+ pageX = _getPagePos.x,
163
+ pageY = _getPagePos.y;
164
+ var _currentCaptchaConfig = currentCaptchaConfig.current,
165
+ startX = _currentCaptchaConfig.startX,
166
+ startY = _currentCaptchaConfig.startY,
167
+ startSlidingTime = _currentCaptchaConfig.startSlidingTime,
168
+ end = _currentCaptchaConfig.end,
169
+ bgImageWidth = _currentCaptchaConfig.bgImageWidth,
170
+ trackList = _currentCaptchaConfig.trackList;
171
+ var track = {
172
+ x: pageX - startX,
173
+ y: pageY - startY,
174
+ type: 'move',
175
+ t: new Date().getTime() - startSlidingTime.getTime()
176
+ };
177
+ trackList.push(track);
178
+ var moveX = pageX - startX;
179
+ if (moveX < 0) {
180
+ moveX = 0;
181
+ } else if (moveX > end) {
182
+ moveX = end;
183
+ }
184
+ currentCaptchaConfig.current.moveX = moveX;
185
+ currentCaptchaConfig.current.movePercent = moveX / bgImageWidth;
186
+ if (sliderMoveBtn.current) {
187
+ sliderMoveBtn.current.style.transform = 'translate(' + moveX + 'px, 0px)';
188
+ }
189
+ if (sliderImgDiv.current) {
190
+ sliderImgDiv.current.style.transform = 'translate(' + moveX + 'px, 0px)';
191
+ }
192
+ };
193
+ var up = function up(event) {
194
+ var _bgImgRef$current$cli, _bgImgRef$current, _bgImgRef$current$cli2, _bgImgRef$current2;
195
+ document.removeEventListener(getEventShim().move, move);
196
+ document.removeEventListener(getEventShim().end, up);
197
+ currentCaptchaConfig.current.endSlidingTime = new Date();
198
+ var _getPagePos2 = getPagePos(event),
199
+ pageX = _getPagePos2.x,
200
+ pageY = _getPagePos2.y;
201
+ var _currentCaptchaConfig2 = currentCaptchaConfig.current,
202
+ startX = _currentCaptchaConfig2.startX,
203
+ startY = _currentCaptchaConfig2.startY,
204
+ startSlidingTime = _currentCaptchaConfig2.startSlidingTime,
205
+ trackList = _currentCaptchaConfig2.trackList;
206
+ var track = {
207
+ x: pageX - startX,
208
+ y: pageY - startY,
209
+ type: 'up',
210
+ t: new Date().getTime() - startSlidingTime.getTime()
211
+ };
212
+ trackList.push(track);
213
+ currentCaptchaConfig.current.bgImageWidth = (_bgImgRef$current$cli = (_bgImgRef$current = bgImgRef.current) === null || _bgImgRef$current === void 0 ? void 0 : _bgImgRef$current.clientWidth) !== null && _bgImgRef$current$cli !== void 0 ? _bgImgRef$current$cli : 0;
214
+ currentCaptchaConfig.current.bgImageHeight = (_bgImgRef$current$cli2 = (_bgImgRef$current2 = bgImgRef.current) === null || _bgImgRef$current2 === void 0 ? void 0 : _bgImgRef$current2.clientHeight) !== null && _bgImgRef$current$cli2 !== void 0 ? _bgImgRef$current$cli2 : 0;
215
+ validate();
216
+ };
217
+ var handleMouseDown = function handleMouseDown(event) {
218
+ var _getPagePos3 = getPagePos(event),
219
+ startX = _getPagePos3.x,
220
+ startY = _getPagePos3.y;
221
+ currentCaptchaConfig.current.startX = startX;
222
+ currentCaptchaConfig.current.startY = startY;
223
+ var _currentCaptchaConfig3 = currentCaptchaConfig.current,
224
+ startSlidingTime = _currentCaptchaConfig3.startSlidingTime,
225
+ trackList = _currentCaptchaConfig3.trackList;
226
+ var pageX = currentCaptchaConfig.current.startX;
227
+ var pageY = currentCaptchaConfig.current.startY;
228
+ trackList.push({
229
+ x: pageX - startX,
230
+ y: pageY - startY,
231
+ type: 'down',
232
+ t: new Date().getTime() - startSlidingTime.getTime()
233
+ });
234
+ document.addEventListener(getEventShim().move, move, {
235
+ passive: false
236
+ });
237
+ document.addEventListener(getEventShim().end, up, {
238
+ passive: false
239
+ });
240
+ };
241
+ useEffect(function () {
242
+ fetchVerify();
243
+ return function () {
244
+ document.removeEventListener(getEventShim().move, move);
245
+ document.removeEventListener(getEventShim().end, up);
246
+ };
247
+ }, [fetchVerify]);
248
+ return /*#__PURE__*/_jsxs("div", {
249
+ className: cls(style.slider, props.className),
250
+ children: [/*#__PURE__*/_jsxs("div", {
251
+ className: style['content'],
252
+ children: [/*#__PURE__*/_jsx("div", {
253
+ className: style['bg-img-div'],
254
+ children: /*#__PURE__*/_jsx("img", {
255
+ id: "bg-img",
256
+ src: bgImg,
257
+ ref: bgImgRef
258
+ })
259
+ }), /*#__PURE__*/_jsx("div", {
260
+ className: style['slider-img-div'],
261
+ ref: sliderImgDiv,
262
+ children: /*#__PURE__*/_jsx("img", {
263
+ id: "slider-img",
264
+ src: verifyImg
265
+ })
266
+ })]
267
+ }), /*#__PURE__*/_jsxs("div", {
268
+ className: style['slider-move'],
269
+ children: [/*#__PURE__*/_jsx("div", {
270
+ className: style['slider-move-track'],
271
+ children: "\u62D6\u52A8\u6ED1\u5757\u5B8C\u6210\u62FC\u56FE"
272
+ }), /*#__PURE__*/_jsx("div", {
273
+ ref: sliderMoveBtn,
274
+ className: style['slider-move-btn'],
275
+ onMouseDown: handleMouseDown,
276
+ onTouchStart: handleMouseDown,
277
+ children: /*#__PURE__*/_jsx("div", {
278
+ className: style['slider-move-btn-img'],
279
+ children: /*#__PURE__*/_jsx(Slider, {})
280
+ })
281
+ })]
282
+ }), /*#__PURE__*/_jsxs("div", {
283
+ className: style['bottom'],
284
+ children: [/*#__PURE__*/_jsx("div", {
285
+ className: style['refresh-btn'],
286
+ onClick: fetchVerify,
287
+ children: /*#__PURE__*/_jsx(Refresh, {})
288
+ }), /*#__PURE__*/_jsx("div", {
289
+ className: style['close-btn'],
290
+ onClick: props.onClose,
291
+ children: /*#__PURE__*/_jsx(Close, {})
292
+ })]
293
+ })]
294
+ });
295
+ }
@@ -0,0 +1,121 @@
1
+ .slider {
2
+ background-color: #fff;
3
+ width: 278px;
4
+ z-index: 999;
5
+ box-sizing: border-box;
6
+ padding: 9px;
7
+ border-radius: 6px;
8
+ box-shadow: 0 0 11px 0 #999;
9
+ user-select: none;
10
+ }
11
+
12
+ .slider .content {
13
+ width: 100%;
14
+ height: 159px;
15
+ position: relative;
16
+ }
17
+
18
+ .bg-img-div {
19
+ width: 100%;
20
+ height: 100%;
21
+ position: absolute;
22
+ transform: translate(0, 0);
23
+ }
24
+
25
+ .slider-img-div {
26
+ height: 100%;
27
+ position: absolute;
28
+ transform: translate(0, 0);
29
+ }
30
+
31
+ .bg-img-div img {
32
+ width: 100%;
33
+ -webkit-user-drag: none;
34
+ -khtml-user-drag: none;
35
+ -moz-user-drag: none;
36
+ -o-user-drag: none;
37
+ }
38
+
39
+ .slider-img-div img {
40
+ height: 100%;
41
+ -webkit-user-drag: none;
42
+ -khtml-user-drag: none;
43
+ -moz-user-drag: none;
44
+ -o-user-drag: none;
45
+ }
46
+
47
+ .slider .slider-move {
48
+ width: 100%;
49
+ margin: 11px 0;
50
+ position: relative;
51
+ }
52
+
53
+ .slider .bottom {
54
+ width: 100%;
55
+ display: flex;
56
+ justify-content: flex-end;
57
+ }
58
+
59
+ .refresh-btn,
60
+ .close-btn {
61
+ display: inline-block;
62
+ }
63
+
64
+ .slider-move .slider-move-track {
65
+ line-height: 32px;
66
+ font-size: 14px;
67
+ text-align: center;
68
+ white-space: nowrap;
69
+ color: #88949d;
70
+ user-select: none;
71
+ user-select: none;
72
+ user-select: none;
73
+ border-radius: 20px;
74
+ background: #dfe1e2;
75
+ box-shadow: inset 0 0 4px 0 rgba(0, 0, 0, 15%);
76
+ }
77
+
78
+ .slider-move .slider-move-btn {
79
+ transform: translate(0, 0);
80
+ position: absolute;
81
+ top: -8px;
82
+ left: 0;
83
+ width: 48px;
84
+ height: 48px;
85
+ -webkit-user-drag: none;
86
+ -khtml-user-drag: none;
87
+ -moz-user-drag: none;
88
+ -o-user-drag: none;
89
+ box-shadow: 0 0 8px 0 rgba(0, 0, 0, 30%), inset 0 0 6px 0 rgba(0, 0, 0, 5%);
90
+ background-color: white;
91
+ border-radius: 50%;
92
+ display: flex;
93
+ justify-content: center;
94
+ align-items: center;
95
+ }
96
+
97
+ .slider-move .slider-move-btn-img {
98
+ -webkit-user-drag: none;
99
+ -khtml-user-drag: none;
100
+ -moz-user-drag: none;
101
+ -o-user-drag: none;
102
+ display: flex;
103
+ }
104
+
105
+ .slider-move-btn:hover,
106
+ .close-btn:hover,
107
+ .refresh-btn:hover {
108
+ cursor: pointer;
109
+ }
110
+
111
+ .bottom .close-btn {
112
+ width: 20px;
113
+ height: 20px;
114
+ margin: 5px;
115
+ }
116
+
117
+ .bottom .refresh-btn {
118
+ width: 20px;
119
+ height: 20px;
120
+ margin: 5px;
121
+ }
@@ -0,0 +1,3 @@
1
+ import type { QueryFilterProps } from '@ant-design/pro-components';
2
+ import './index.less';
3
+ export default function StyledQueryFilter(props: QueryFilterProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,23 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ var _excluded = ["children"];
3
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
9
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
10
+ import { QueryFilter } from '@ant-design/pro-components';
11
+ import "./index.less";
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ export default function StyledQueryFilter(props) {
14
+ var children = props.children,
15
+ rest = _objectWithoutProperties(props, _excluded);
16
+ return /*#__PURE__*/_jsx(QueryFilter, _objectSpread(_objectSpread({
17
+ className: 'styledQueryFilter',
18
+ defaultColsNumber: 7,
19
+ defaultCollapsed: false
20
+ }, rest), {}, {
21
+ children: children
22
+ }));
23
+ }
@@ -0,0 +1,22 @@
1
+ // :where(.css-dev-only-do-not-override-rjkcww).ant-pro-card .ant-pro-card-body {
2
+ // padding-block: 0;
3
+ // }
4
+ :where(.css-dev-only-do-not-override-rjkcww).ant-pro-query-filter:where(
5
+ .css-dev-only-do-not-override-rjkcww
6
+ ).ant-pro-query-filter {
7
+ padding: 4px 24px;
8
+ }
9
+
10
+ .ant-pro-query-filter.styledQueryFilter {
11
+ padding: 0;
12
+
13
+ .ant-col-offset-12 {
14
+ .ant-form-item-label {
15
+ flex: 0 0 80px !important;
16
+ }
17
+ }
18
+
19
+ .ant-pro-query-filter-row {
20
+ row-gap: 20px;
21
+ }
22
+ }
@@ -0,0 +1,28 @@
1
+ import type { TableProps } from 'antd';
2
+ import { SetStateAction } from 'react';
3
+ import './index.less';
4
+ export declare const PaginationCommonProps: {
5
+ showSizeChanger: boolean;
6
+ showQuickJumper: boolean;
7
+ showTotal: (total: number) => string;
8
+ };
9
+ export declare const TableCellText: (text: string | number, maxWidth?: number) => import("react/jsx-runtime").JSX.Element | "-";
10
+ export default function (props: TableProps<any> & {
11
+ maxCellWidth?: number;
12
+ }): import("react/jsx-runtime").JSX.Element;
13
+ export declare const useRowSelection: () => {
14
+ selectedRowKeys: any[];
15
+ selectedRows: any[];
16
+ setSelectedRowKeys: import("react").Dispatch<SetStateAction<any[]>>;
17
+ setSelectedRows: import("react").Dispatch<SetStateAction<any[]>>;
18
+ rowSelection: {
19
+ selectedRowKeys: any[];
20
+ onChange: (keys: SetStateAction<any[]>, rows: SetStateAction<any[]>) => void;
21
+ };
22
+ onRow: (record: {
23
+ id: any;
24
+ }) => {
25
+ onClick: () => void;
26
+ };
27
+ clearRows: () => void;
28
+ };
@@ -0,0 +1,133 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ var _excluded = ["columns", "pagination", "maxCellWidth"];
3
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
4
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
5
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
6
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
7
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
8
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
9
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
10
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
11
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
12
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
14
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
15
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
16
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
17
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
18
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
19
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
20
+ import { Table, Typography } from 'antd';
21
+ import cls from 'classnames';
22
+ import { isValidElement, useState } from 'react';
23
+ import "./index.less";
24
+ import { jsx as _jsx } from "react/jsx-runtime";
25
+ var showTotal = function showTotal(total) {
26
+ return "\u5171 ".concat(total, " \u6761");
27
+ };
28
+ export var PaginationCommonProps = {
29
+ showSizeChanger: true,
30
+ showQuickJumper: true,
31
+ showTotal: showTotal
32
+ };
33
+ export var TableCellText = function TableCellText(text) {
34
+ var maxWidth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 230;
35
+ var val = text || text === 0 ? text : '-';
36
+ if (val === '-') return '-';
37
+ return /*#__PURE__*/_jsx(Typography.Text, {
38
+ ellipsis: {
39
+ tooltip: {
40
+ color: '#fff',
41
+ title: val,
42
+ placement: 'topLeft',
43
+ overlayInnerStyle: {
44
+ color: '#000',
45
+ width: maxWidth + 100,
46
+ lineHeight: '22px',
47
+ padding: '15px'
48
+ }
49
+ }
50
+ },
51
+ style: {
52
+ maxWidth: maxWidth
53
+ },
54
+ children: val
55
+ });
56
+ };
57
+ export default function (props) {
58
+ var columns = props.columns,
59
+ pagination = props.pagination,
60
+ _props$maxCellWidth = props.maxCellWidth,
61
+ maxCellWidth = _props$maxCellWidth === void 0 ? 230 : _props$maxCellWidth,
62
+ rest = _objectWithoutProperties(props, _excluded);
63
+ var _columns = columns === null || columns === void 0 ? void 0 : columns.map(function (item) {
64
+ return _objectSpread(_objectSpread({}, item), {}, {
65
+ ellipsis: false,
66
+ render: function render(val, record, index) {
67
+ var renderVal = item.render ? item.render(val, record, index) : val;
68
+ return /*#__PURE__*/isValidElement(renderVal) ? renderVal : TableCellText(renderVal, item.longTextWidth || maxCellWidth);
69
+ }
70
+ });
71
+ });
72
+ return /*#__PURE__*/_jsx(Table, _objectSpread({
73
+ rowKey: "id",
74
+ rowClassName: function rowClassName(record, index, indent) {
75
+ var _props$rowClassName;
76
+ var gapClass = index % 2 === 1 ? 'styledTableBgColor' : '';
77
+ var origin = typeof (props === null || props === void 0 ? void 0 : props.rowClassName) === 'string' ? props === null || props === void 0 ? void 0 : props.rowClassName : props === null || props === void 0 || (_props$rowClassName = props.rowClassName) === null || _props$rowClassName === void 0 ? void 0 : _props$rowClassName.call(props, record, index, indent);
78
+ return cls(gapClass, origin);
79
+ },
80
+ scroll: {
81
+ x: 'max-content'
82
+ },
83
+ columns: _columns,
84
+ pagination: pagination ? _objectSpread(_objectSpread({}, PaginationCommonProps), pagination) : pagination
85
+ }, rest));
86
+ }
87
+ export var useRowSelection = function useRowSelection() {
88
+ var _useState = useState([]),
89
+ _useState2 = _slicedToArray(_useState, 2),
90
+ selectedRowKeys = _useState2[0],
91
+ setSelectedRowKeys = _useState2[1];
92
+ var _useState3 = useState([]),
93
+ _useState4 = _slicedToArray(_useState3, 2),
94
+ selectedRows = _useState4[0],
95
+ setSelectedRows = _useState4[1];
96
+ var rowSelection = {
97
+ selectedRowKeys: selectedRowKeys,
98
+ onChange: function onChange(keys, rows) {
99
+ setSelectedRowKeys(keys);
100
+ setSelectedRows(rows);
101
+ }
102
+ };
103
+ var onRow = function onRow(record) {
104
+ return {
105
+ onClick: function onClick() {
106
+ if (selectedRowKeys.includes(record.id)) {
107
+ setSelectedRowKeys(selectedRowKeys.filter(function (key) {
108
+ return key !== record.id;
109
+ }));
110
+ setSelectedRows(selectedRows.filter(function (item) {
111
+ return item.id !== record.id;
112
+ }));
113
+ } else {
114
+ setSelectedRowKeys([].concat(_toConsumableArray(selectedRowKeys), [record.id]));
115
+ setSelectedRows([].concat(_toConsumableArray(selectedRows), [record]));
116
+ }
117
+ }
118
+ };
119
+ };
120
+ var clearRows = function clearRows() {
121
+ setSelectedRowKeys([]);
122
+ setSelectedRows([]);
123
+ };
124
+ return {
125
+ selectedRowKeys: selectedRowKeys,
126
+ selectedRows: selectedRows,
127
+ setSelectedRowKeys: setSelectedRowKeys,
128
+ setSelectedRows: setSelectedRows,
129
+ rowSelection: rowSelection,
130
+ onRow: onRow,
131
+ clearRows: clearRows
132
+ };
133
+ };
@@ -0,0 +1,11 @@
1
+ .styledTableBgColor {
2
+ background: #f9f9f9;
3
+
4
+ td {
5
+ background: #f9f9f9 !important;
6
+ }
7
+
8
+ :global(.ant-table-cell-row-hover) {
9
+ background: #f0f0f0 !important;
10
+ }
11
+ }