mirror of https://github.com/longtai-cn/hippo4j
parent
e98b106cb1
commit
c0d8f33f66
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"systemParams": "darwin-arm64-93",
|
||||||
|
"modulesFolders": [
|
||||||
|
"node_modules"
|
||||||
|
],
|
||||||
|
"flags": [],
|
||||||
|
"linkedModules": [],
|
||||||
|
"topLevelPatterns": [
|
||||||
|
"js-cookie@^3.0.5"
|
||||||
|
],
|
||||||
|
"lockfileEntries": {
|
||||||
|
"js-cookie@^3.0.5": "https://registry.npmmirror.com/js-cookie/-/js-cookie-3.0.5.tgz#0b7e2fd0c01552c58ba86e0841f94dc2557dcdbc"
|
||||||
|
},
|
||||||
|
"files": [],
|
||||||
|
"artifacts": {}
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2018 Copyright 2018 Klaus Hartl, Fagner Brack, GitHub Contributors
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
@ -0,0 +1,147 @@
|
|||||||
|
/*! js-cookie v3.0.5 | MIT */
|
||||||
|
;
|
||||||
|
(function (global, factory) {
|
||||||
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||||||
|
typeof define === 'function' && define.amd ? define(factory) :
|
||||||
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (function () {
|
||||||
|
var current = global.Cookies;
|
||||||
|
var exports = global.Cookies = factory();
|
||||||
|
exports.noConflict = function () { global.Cookies = current; return exports; };
|
||||||
|
})());
|
||||||
|
})(this, (function () { 'use strict';
|
||||||
|
|
||||||
|
/* eslint-disable no-var */
|
||||||
|
function assign (target) {
|
||||||
|
for (var i = 1; i < arguments.length; i++) {
|
||||||
|
var source = arguments[i];
|
||||||
|
for (var key in source) {
|
||||||
|
target[key] = source[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return target
|
||||||
|
}
|
||||||
|
/* eslint-enable no-var */
|
||||||
|
|
||||||
|
/* eslint-disable no-var */
|
||||||
|
var defaultConverter = {
|
||||||
|
read: function (value) {
|
||||||
|
if (value[0] === '"') {
|
||||||
|
value = value.slice(1, -1);
|
||||||
|
}
|
||||||
|
return value.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent)
|
||||||
|
},
|
||||||
|
write: function (value) {
|
||||||
|
return encodeURIComponent(value).replace(
|
||||||
|
/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
|
||||||
|
decodeURIComponent
|
||||||
|
)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
/* eslint-enable no-var */
|
||||||
|
|
||||||
|
/* eslint-disable no-var */
|
||||||
|
|
||||||
|
function init (converter, defaultAttributes) {
|
||||||
|
function set (name, value, attributes) {
|
||||||
|
if (typeof document === 'undefined') {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
attributes = assign({}, defaultAttributes, attributes);
|
||||||
|
|
||||||
|
if (typeof attributes.expires === 'number') {
|
||||||
|
attributes.expires = new Date(Date.now() + attributes.expires * 864e5);
|
||||||
|
}
|
||||||
|
if (attributes.expires) {
|
||||||
|
attributes.expires = attributes.expires.toUTCString();
|
||||||
|
}
|
||||||
|
|
||||||
|
name = encodeURIComponent(name)
|
||||||
|
.replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent)
|
||||||
|
.replace(/[()]/g, escape);
|
||||||
|
|
||||||
|
var stringifiedAttributes = '';
|
||||||
|
for (var attributeName in attributes) {
|
||||||
|
if (!attributes[attributeName]) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
stringifiedAttributes += '; ' + attributeName;
|
||||||
|
|
||||||
|
if (attributes[attributeName] === true) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// Considers RFC 6265 section 5.2:
|
||||||
|
// ...
|
||||||
|
// 3. If the remaining unparsed-attributes contains a %x3B (";")
|
||||||
|
// character:
|
||||||
|
// Consume the characters of the unparsed-attributes up to,
|
||||||
|
// not including, the first %x3B (";") character.
|
||||||
|
// ...
|
||||||
|
stringifiedAttributes += '=' + attributes[attributeName].split(';')[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
return (document.cookie =
|
||||||
|
name + '=' + converter.write(value, name) + stringifiedAttributes)
|
||||||
|
}
|
||||||
|
|
||||||
|
function get (name) {
|
||||||
|
if (typeof document === 'undefined' || (arguments.length && !name)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// To prevent the for loop in the first place assign an empty array
|
||||||
|
// in case there are no cookies at all.
|
||||||
|
var cookies = document.cookie ? document.cookie.split('; ') : [];
|
||||||
|
var jar = {};
|
||||||
|
for (var i = 0; i < cookies.length; i++) {
|
||||||
|
var parts = cookies[i].split('=');
|
||||||
|
var value = parts.slice(1).join('=');
|
||||||
|
|
||||||
|
try {
|
||||||
|
var found = decodeURIComponent(parts[0]);
|
||||||
|
jar[found] = converter.read(value, found);
|
||||||
|
|
||||||
|
if (name === found) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
return name ? jar[name] : jar
|
||||||
|
}
|
||||||
|
|
||||||
|
return Object.create(
|
||||||
|
{
|
||||||
|
set,
|
||||||
|
get,
|
||||||
|
remove: function (name, attributes) {
|
||||||
|
set(
|
||||||
|
name,
|
||||||
|
'',
|
||||||
|
assign({}, attributes, {
|
||||||
|
expires: -1
|
||||||
|
})
|
||||||
|
);
|
||||||
|
},
|
||||||
|
withAttributes: function (attributes) {
|
||||||
|
return init(this.converter, assign({}, this.attributes, attributes))
|
||||||
|
},
|
||||||
|
withConverter: function (converter) {
|
||||||
|
return init(assign({}, this.converter, converter), this.attributes)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
attributes: { value: Object.freeze(defaultAttributes) },
|
||||||
|
converter: { value: Object.freeze(converter) }
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
var api = init(defaultConverter, { path: '/' });
|
||||||
|
/* eslint-enable no-var */
|
||||||
|
|
||||||
|
return api;
|
||||||
|
|
||||||
|
}));
|
@ -0,0 +1,2 @@
|
|||||||
|
/*! js-cookie v3.0.5 | MIT */
|
||||||
|
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self,function(){var n=e.Cookies,o=e.Cookies=t();o.noConflict=function(){return e.Cookies=n,o}}())}(this,(function(){"use strict";function e(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)e[o]=n[o]}return e}var t=function t(n,o){function r(t,r,i){if("undefined"!=typeof document){"number"==typeof(i=e({},o,i)).expires&&(i.expires=new Date(Date.now()+864e5*i.expires)),i.expires&&(i.expires=i.expires.toUTCString()),t=encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var c="";for(var u in i)i[u]&&(c+="; "+u,!0!==i[u]&&(c+="="+i[u].split(";")[0]));return document.cookie=t+"="+n.write(r,t)+c}}return Object.create({set:r,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var t=document.cookie?document.cookie.split("; "):[],o={},r=0;r<t.length;r++){var i=t[r].split("="),c=i.slice(1).join("=");try{var u=decodeURIComponent(i[0]);if(o[u]=n.read(c,u),e===u)break}catch(e){}}return e?o[e]:o}},remove:function(t,n){r(t,"",e({},n,{expires:-1}))},withAttributes:function(n){return t(this.converter,e({},this.attributes,n))},withConverter:function(n){return t(e({},this.converter,n),this.attributes)}},{attributes:{value:Object.freeze(o)},converter:{value:Object.freeze(n)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"});return t}));
|
@ -0,0 +1,2 @@
|
|||||||
|
/*! js-cookie v3.0.5 | MIT */
|
||||||
|
function e(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)e[n]=r[n]}return e}var t=function t(r,n){function o(t,o,i){if("undefined"!=typeof document){"number"==typeof(i=e({},n,i)).expires&&(i.expires=new Date(Date.now()+864e5*i.expires)),i.expires&&(i.expires=i.expires.toUTCString()),t=encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var c="";for(var u in i)i[u]&&(c+="; "+u,!0!==i[u]&&(c+="="+i[u].split(";")[0]));return document.cookie=t+"="+r.write(o,t)+c}}return Object.create({set:o,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var t=document.cookie?document.cookie.split("; "):[],n={},o=0;o<t.length;o++){var i=t[o].split("="),c=i.slice(1).join("=");try{var u=decodeURIComponent(i[0]);if(n[u]=r.read(c,u),e===u)break}catch(e){}}return e?n[e]:n}},remove:function(t,r){o(t,"",e({},r,{expires:-1}))},withAttributes:function(r){return t(this.converter,e({},this.attributes,r))},withConverter:function(r){return t(e({},this.converter,r),this.attributes)}},{attributes:{value:Object.freeze(n)},converter:{value:Object.freeze(r)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"});export{t as default};
|
@ -0,0 +1,134 @@
|
|||||||
|
/*! js-cookie v3.0.5 | MIT */
|
||||||
|
/* eslint-disable no-var */
|
||||||
|
function assign (target) {
|
||||||
|
for (var i = 1; i < arguments.length; i++) {
|
||||||
|
var source = arguments[i];
|
||||||
|
for (var key in source) {
|
||||||
|
target[key] = source[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return target
|
||||||
|
}
|
||||||
|
/* eslint-enable no-var */
|
||||||
|
|
||||||
|
/* eslint-disable no-var */
|
||||||
|
var defaultConverter = {
|
||||||
|
read: function (value) {
|
||||||
|
if (value[0] === '"') {
|
||||||
|
value = value.slice(1, -1);
|
||||||
|
}
|
||||||
|
return value.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent)
|
||||||
|
},
|
||||||
|
write: function (value) {
|
||||||
|
return encodeURIComponent(value).replace(
|
||||||
|
/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
|
||||||
|
decodeURIComponent
|
||||||
|
)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
/* eslint-enable no-var */
|
||||||
|
|
||||||
|
/* eslint-disable no-var */
|
||||||
|
|
||||||
|
function init (converter, defaultAttributes) {
|
||||||
|
function set (name, value, attributes) {
|
||||||
|
if (typeof document === 'undefined') {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
attributes = assign({}, defaultAttributes, attributes);
|
||||||
|
|
||||||
|
if (typeof attributes.expires === 'number') {
|
||||||
|
attributes.expires = new Date(Date.now() + attributes.expires * 864e5);
|
||||||
|
}
|
||||||
|
if (attributes.expires) {
|
||||||
|
attributes.expires = attributes.expires.toUTCString();
|
||||||
|
}
|
||||||
|
|
||||||
|
name = encodeURIComponent(name)
|
||||||
|
.replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent)
|
||||||
|
.replace(/[()]/g, escape);
|
||||||
|
|
||||||
|
var stringifiedAttributes = '';
|
||||||
|
for (var attributeName in attributes) {
|
||||||
|
if (!attributes[attributeName]) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
stringifiedAttributes += '; ' + attributeName;
|
||||||
|
|
||||||
|
if (attributes[attributeName] === true) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// Considers RFC 6265 section 5.2:
|
||||||
|
// ...
|
||||||
|
// 3. If the remaining unparsed-attributes contains a %x3B (";")
|
||||||
|
// character:
|
||||||
|
// Consume the characters of the unparsed-attributes up to,
|
||||||
|
// not including, the first %x3B (";") character.
|
||||||
|
// ...
|
||||||
|
stringifiedAttributes += '=' + attributes[attributeName].split(';')[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
return (document.cookie =
|
||||||
|
name + '=' + converter.write(value, name) + stringifiedAttributes)
|
||||||
|
}
|
||||||
|
|
||||||
|
function get (name) {
|
||||||
|
if (typeof document === 'undefined' || (arguments.length && !name)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// To prevent the for loop in the first place assign an empty array
|
||||||
|
// in case there are no cookies at all.
|
||||||
|
var cookies = document.cookie ? document.cookie.split('; ') : [];
|
||||||
|
var jar = {};
|
||||||
|
for (var i = 0; i < cookies.length; i++) {
|
||||||
|
var parts = cookies[i].split('=');
|
||||||
|
var value = parts.slice(1).join('=');
|
||||||
|
|
||||||
|
try {
|
||||||
|
var found = decodeURIComponent(parts[0]);
|
||||||
|
jar[found] = converter.read(value, found);
|
||||||
|
|
||||||
|
if (name === found) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
return name ? jar[name] : jar
|
||||||
|
}
|
||||||
|
|
||||||
|
return Object.create(
|
||||||
|
{
|
||||||
|
set,
|
||||||
|
get,
|
||||||
|
remove: function (name, attributes) {
|
||||||
|
set(
|
||||||
|
name,
|
||||||
|
'',
|
||||||
|
assign({}, attributes, {
|
||||||
|
expires: -1
|
||||||
|
})
|
||||||
|
);
|
||||||
|
},
|
||||||
|
withAttributes: function (attributes) {
|
||||||
|
return init(this.converter, assign({}, this.attributes, attributes))
|
||||||
|
},
|
||||||
|
withConverter: function (converter) {
|
||||||
|
return init(assign({}, this.converter, converter), this.attributes)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
attributes: { value: Object.freeze(defaultAttributes) },
|
||||||
|
converter: { value: Object.freeze(converter) }
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
var api = init(defaultConverter, { path: '/' });
|
||||||
|
/* eslint-enable no-var */
|
||||||
|
|
||||||
|
export { api as default };
|
@ -0,0 +1 @@
|
|||||||
|
module.exports = require('./dist/js.cookie')
|
@ -0,0 +1,71 @@
|
|||||||
|
{
|
||||||
|
"name": "js-cookie",
|
||||||
|
"version": "3.0.5",
|
||||||
|
"description": "A simple, lightweight JavaScript API for handling cookies",
|
||||||
|
"browser": "dist/js.cookie.js",
|
||||||
|
"module": "dist/js.cookie.mjs",
|
||||||
|
"unpkg": "dist/js.cookie.min.js",
|
||||||
|
"jsdelivr": "dist/js.cookie.min.js",
|
||||||
|
"exports": {
|
||||||
|
".": {
|
||||||
|
"import": "./dist/js.cookie.mjs",
|
||||||
|
"require": "./dist/js.cookie.js"
|
||||||
|
},
|
||||||
|
"./package.json": "./package.json"
|
||||||
|
},
|
||||||
|
"directories": {
|
||||||
|
"test": "test"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"cookie",
|
||||||
|
"cookies",
|
||||||
|
"browser",
|
||||||
|
"amd",
|
||||||
|
"commonjs",
|
||||||
|
"client",
|
||||||
|
"js-cookie",
|
||||||
|
"browserify"
|
||||||
|
],
|
||||||
|
"scripts": {
|
||||||
|
"test": "grunt test",
|
||||||
|
"format": "grunt exec:format",
|
||||||
|
"dist": "rm -rf dist/* && rollup -c",
|
||||||
|
"release": "release-it"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git://github.com/js-cookie/js-cookie.git"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"index.js",
|
||||||
|
"dist/**/*"
|
||||||
|
],
|
||||||
|
"author": "Klaus Hartl",
|
||||||
|
"license": "MIT",
|
||||||
|
"devDependencies": {
|
||||||
|
"@rollup/plugin-terser": "^0.4.0",
|
||||||
|
"browserstack-runner": "github:browserstack/browserstack-runner#1e85e559951bdf97ffe2a7c744ee67ca83589fde",
|
||||||
|
"eslint": "^7.31.0",
|
||||||
|
"eslint-config-standard": "^16.0.3",
|
||||||
|
"eslint-plugin-html": "^7.0.0",
|
||||||
|
"eslint-plugin-markdown": "^3.0.0",
|
||||||
|
"grunt": "^1.0.4",
|
||||||
|
"grunt-compare-size": "^0.4.2",
|
||||||
|
"grunt-contrib-connect": "^3.0.0",
|
||||||
|
"grunt-contrib-nodeunit": "^5.0.0",
|
||||||
|
"grunt-contrib-qunit": "^7.0.0",
|
||||||
|
"grunt-contrib-watch": "^1.1.0",
|
||||||
|
"grunt-exec": "^3.0.0",
|
||||||
|
"gzip-js": "^0.3.2",
|
||||||
|
"prettier": "^2.3.2",
|
||||||
|
"qunit": "^2.9.3",
|
||||||
|
"release-it": "^15.0.0",
|
||||||
|
"rollup": "^3.17.2",
|
||||||
|
"rollup-plugin-filesize": "^10.0.0",
|
||||||
|
"rollup-plugin-license": "^3.0.0",
|
||||||
|
"standard": "^17.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14"
|
||||||
|
}
|
||||||
|
}
|
@ -1,3 +1,4 @@
|
|||||||
/.git
|
/.git
|
||||||
node_modules
|
node_modules
|
||||||
build
|
build
|
||||||
|
src/lib/*
|
@ -1,3 +1,2 @@
|
|||||||
export * from './useThemeMode';
|
|
||||||
export * from './useTransLate';
|
export * from './useTransLate';
|
||||||
export * from './useFormToUrl';
|
export * from './useFormToUrl';
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
import { useContext, useEffect } from 'react';
|
|
||||||
import { useLocalStorageState } from 'ahooks';
|
|
||||||
import { MyContext, THEME_NAME } from '@/context';
|
|
||||||
|
|
||||||
export const useThemeMode = (): { isDark: boolean | undefined; setIsDark: (isDark: boolean) => void } => {
|
|
||||||
const [isDark, setIsDark] = useLocalStorageState<boolean>('current-mode', { defaultValue: false });
|
|
||||||
const { setThemeName } = useContext<any>(MyContext);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
isDark ? setThemeName(THEME_NAME.DARK) : setThemeName(THEME_NAME.DEFAULT);
|
|
||||||
}, [isDark, setThemeName]);
|
|
||||||
|
|
||||||
return { isDark, setIsDark };
|
|
||||||
};
|
|
@ -0,0 +1,37 @@
|
|||||||
|
.login-wrapper {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 550px;
|
||||||
|
grid-template-rows: 1fr;
|
||||||
|
height: 100%;
|
||||||
|
.login-bgi {
|
||||||
|
background: url('https://gw.alipayobjects.com/zos/rmsportal/FfdJeJRQWjEeGTpqgBKj.png') no-repeat fixed center center;
|
||||||
|
background-size: contain;
|
||||||
|
}
|
||||||
|
.login-form-wrapper {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
.img-wrapper {
|
||||||
|
width: 50px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
img {
|
||||||
|
flex: 1;
|
||||||
|
object-fit: contain;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.tip {
|
||||||
|
margin-block-start: 12px;
|
||||||
|
margin-block-end: 36px;
|
||||||
|
}
|
||||||
|
.form-content {
|
||||||
|
width: 330px;
|
||||||
|
.login-edit {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,143 @@
|
|||||||
import React from 'react';
|
import { useCallback, useMemo, useState } from 'react';
|
||||||
|
import { Typography, Tabs, TabsProps, Form, Input, Checkbox, Button, message } from 'antd';
|
||||||
|
import service from './service';
|
||||||
|
import { LockOutlined, UserOutlined } from '@ant-design/icons';
|
||||||
|
import style from './index.module.less';
|
||||||
|
import { useRequest } from 'ahooks';
|
||||||
|
import { setToken } from '@/utils';
|
||||||
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
|
const { Paragraph } = Typography;
|
||||||
|
|
||||||
|
enum TABS_KEY {
|
||||||
|
LOGIN = 'login',
|
||||||
|
PHONE = 'phoneLogin',
|
||||||
|
}
|
||||||
|
|
||||||
const Login = () => {
|
const Login = () => {
|
||||||
return <></>;
|
const [form] = Form.useForm();
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const { validateFields } = form;
|
||||||
|
const [remenberMe, setRemenberMe] = useState(0);
|
||||||
|
|
||||||
|
const { run, loading } = useRequest(service.fetchLogin, {
|
||||||
|
manual: true,
|
||||||
|
onSuccess: res => {
|
||||||
|
if (res) {
|
||||||
|
message.success('登陆成功');
|
||||||
|
navigate('/thread-poll/index');
|
||||||
|
setToken(res?.data);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const handleLogin = useCallback(() => {
|
||||||
|
validateFields()
|
||||||
|
.then(values => {
|
||||||
|
console.log('value:::', values, remenberMe);
|
||||||
|
run({
|
||||||
|
password: '1BsL68bUgS52alKirqFprU1QfWJyPFlb3dA2AzEMc6kMTpTHN1doEN4=',
|
||||||
|
rememberMe: 1,
|
||||||
|
tag: 'lw4xNmj6QuamOFsy',
|
||||||
|
username: 'baoxinyi_user',
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(err => console.log('err:::', err));
|
||||||
|
}, [remenberMe, validateFields, run]);
|
||||||
|
|
||||||
|
const formNode = useMemo(
|
||||||
|
() => (
|
||||||
|
<Form form={form}>
|
||||||
|
<Form.Item
|
||||||
|
name="username"
|
||||||
|
initialValue={'baoxinyi_user'}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请输入用户名!',
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Input
|
||||||
|
placeholder="用户名"
|
||||||
|
prefix={<UserOutlined className={'prefixIcon'} />}
|
||||||
|
size="large"
|
||||||
|
allowClear
|
||||||
|
></Input>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
name="password"
|
||||||
|
initialValue={'baoxinyi_user'}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请输入密码!',
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Input.Password
|
||||||
|
placeholder="密码"
|
||||||
|
prefix={<LockOutlined className={'prefixIcon'} />}
|
||||||
|
size="large"
|
||||||
|
allowClear
|
||||||
|
></Input.Password>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item name="rememberMe">
|
||||||
|
<div className={style['login-edit']}>
|
||||||
|
<Checkbox
|
||||||
|
value={1}
|
||||||
|
checked
|
||||||
|
onChange={e => {
|
||||||
|
setRemenberMe(e.target.checked ? 1 : 0);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
记住密码
|
||||||
|
</Checkbox>
|
||||||
|
<Button type="link">忘记密码</Button>
|
||||||
|
</div>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item>
|
||||||
|
<Button
|
||||||
|
htmlType="submit"
|
||||||
|
type="primary"
|
||||||
|
style={{ width: '100%' }}
|
||||||
|
size="large"
|
||||||
|
onClick={handleLogin}
|
||||||
|
loading={loading}
|
||||||
|
>
|
||||||
|
登陆
|
||||||
|
</Button>
|
||||||
|
</Form.Item>
|
||||||
|
</Form>
|
||||||
|
),
|
||||||
|
[form, loading, handleLogin]
|
||||||
|
);
|
||||||
|
|
||||||
|
const items: TabsProps['items'] = [
|
||||||
|
{
|
||||||
|
key: TABS_KEY.LOGIN,
|
||||||
|
label: '账号密码登陆',
|
||||||
|
children: formNode,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: TABS_KEY.PHONE,
|
||||||
|
label: '手机号登陆',
|
||||||
|
children: formNode,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
return (
|
||||||
|
<div className={style['login-wrapper']}>
|
||||||
|
<div className={style['login-bgi']}></div>
|
||||||
|
<div className={style['login-form-wrapper']}>
|
||||||
|
<div className={style['img-wrapper']}>
|
||||||
|
<img src="https://nageoffer.com/img/logo3.png" alt="" />
|
||||||
|
</div>
|
||||||
|
<Paragraph className={style['tip']}>全球最好用的线程池管理工具</Paragraph>
|
||||||
|
<div className={style['form-content']}>
|
||||||
|
<Tabs centered defaultActiveKey={TABS_KEY.LOGIN} items={items} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
export default Login;
|
export default Login;
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
import { IRouterList } from '@/typings';
|
||||||
|
import Login from '.';
|
||||||
|
|
||||||
|
const routerList: IRouterList[] = [{ path: '/login', component: Login }];
|
||||||
|
|
||||||
|
export default routerList;
|
@ -0,0 +1,13 @@
|
|||||||
|
import request from '@/utils';
|
||||||
|
|
||||||
|
const fetchLogin = async (body: any) => {
|
||||||
|
const { data } = await request<{ data: string; roles: string[] }>('/hippo4j/v1/cs/auth/login', {
|
||||||
|
method: 'POST',
|
||||||
|
body,
|
||||||
|
});
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default {
|
||||||
|
fetchLogin,
|
||||||
|
};
|
@ -1,2 +1,3 @@
|
|||||||
/// <reference types="react-scripts" />
|
/// <reference types="react-scripts" />
|
||||||
declare module '*.less';
|
declare module '*.less';
|
||||||
|
declare module 'crypto-browserify' {}
|
||||||
|
Loading…
Reference in new issue