Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
C
chatGLM
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘坚-丰林-DEV
chatGLM
Commits
e1bc8ac6
Commit
e1bc8ac6
authored
Apr 14, 2023
by
littleforest
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: remove login
parent
adcd6e39
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
6 additions
and
380 deletions
+6
-380
defaultSettings.ts
config/defaultSettings.ts
+1
-1
routes.ts
config/routes.ts
+0
-14
app.tsx
src/app.tsx
+3
-16
index.less
src/pages/Chat/index.less
+1
-0
index.tsx
src/pages/Chat/index.tsx
+1
-0
document.ejs
src/pages/document.ejs
+0
-9
index.less
src/pages/user/Login/index.less
+0
-50
index.tsx
src/pages/user/Login/index.tsx
+0
-290
No files found.
config/defaultSettings.ts
View file @
e1bc8ac6
...
@@ -6,7 +6,7 @@ const Settings: LayoutSettings & {
...
@@ -6,7 +6,7 @@ const Settings: LayoutSettings & {
}
=
{
}
=
{
navTheme
:
'light'
,
navTheme
:
'light'
,
// 拂晓蓝
// 拂晓蓝
primaryColor
:
'#
1890ff
'
,
primaryColor
:
'#
009B95
'
,
layout
:
'mix'
,
layout
:
'mix'
,
contentWidth
:
'Fluid'
,
contentWidth
:
'Fluid'
,
fixedHeader
:
false
,
fixedHeader
:
false
,
...
...
config/routes.ts
View file @
e1bc8ac6
...
@@ -5,20 +5,6 @@
...
@@ -5,20 +5,6 @@
component
:
'./Chat'
,
component
:
'./Chat'
,
layout
:
false
,
layout
:
false
,
},
},
{
path
:
'/user'
,
layout
:
false
,
routes
:
[
{
name
:
'login'
,
path
:
'/user/login'
,
component
:
'./User/Login'
,
},
{
component
:
'./404'
,
},
],
},
{
{
path
:
'/welcome'
,
path
:
'/welcome'
,
name
:
'welcome'
,
name
:
'welcome'
,
...
...
src/app.tsx
View file @
e1bc8ac6
import
Footer
from
'@/components/Footer'
;
import
Footer
from
'@/components/Footer'
;
import
RightContent
from
'@/components/RightContent'
;
import
RightContent
from
'@/components/RightContent'
;
import
{
BookOutlined
,
LinkOutlined
}
from
'@ant-design/icons'
;
import
type
{
Settings
as
LayoutSettings
}
from
'@ant-design/pro-components'
;
import
type
{
Settings
as
LayoutSettings
}
from
'@ant-design/pro-components'
;
import
{
PageLoading
,
SettingDrawer
}
from
'@ant-design/pro-components'
;
import
{
PageLoading
,
SettingDrawer
}
from
'@ant-design/pro-components'
;
import
type
{
RunTimeLayoutConfig
}
from
'umi'
;
import
type
{
RunTimeLayoutConfig
}
from
'umi'
;
import
{
history
,
Link
}
from
'umi'
;
import
{
history
}
from
'umi'
;
import
defaultSettings
from
'../config/defaultSettings'
;
import
defaultSettings
from
'../config/defaultSettings'
;
import
{
currentUser
as
queryCurrentUser
}
from
'./services/ant-design-pro/api'
;
import
{
currentUser
as
queryCurrentUser
}
from
'./services/ant-design-pro/api'
;
const
isDev
=
process
.
env
.
NODE_ENV
===
'development'
;
const
loginPath
=
'/chat'
;
const
loginPath
=
'/user/login'
;
/** 获取用户信息比较慢的时候会展示一个 loading */
/** 获取用户信息比较慢的时候会展示一个 loading */
export
const
initialStateConfig
=
{
export
const
initialStateConfig
=
{
...
@@ -65,18 +64,6 @@ export const layout: RunTimeLayoutConfig = ({ initialState, setInitialState }) =
...
@@ -65,18 +64,6 @@ export const layout: RunTimeLayoutConfig = ({ initialState, setInitialState }) =
history
.
push
(
loginPath
);
history
.
push
(
loginPath
);
}
}
},
},
links
:
isDev
?
[
<
Link
key=
"openapi"
to=
"/umi/plugin/openapi"
target=
"_blank"
>
<
LinkOutlined
/>
<
span
>
OpenAPI 文档
</
span
>
</
Link
>,
<
Link
to=
"/~docs"
key=
"docs"
>
<
BookOutlined
/>
<
span
>
业务组件文档
</
span
>
</
Link
>,
]
:
[],
menuHeaderRender
:
undefined
,
menuHeaderRender
:
undefined
,
// 自定义 403 页面
// 自定义 403 页面
// unAccessible: <div>unAccessible</div>,
// unAccessible: <div>unAccessible</div>,
...
...
src/pages/Chat/index.less
View file @
e1bc8ac6
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
background: white !important;
background: white !important;
}
}
.sider {
.sider {
width: 240px !important;
min-height: 100vh;
min-height: 100vh;
padding: 30px 20px;
padding: 30px 20px;
.siderChatContent {
.siderChatContent {
...
...
src/pages/Chat/index.tsx
View file @
e1bc8ac6
...
@@ -28,6 +28,7 @@ const Chat: React.FC = () => {
...
@@ -28,6 +28,7 @@ const Chat: React.FC = () => {
const
onSend
=
(
value
:
any
)
=>
{
const
onSend
=
(
value
:
any
)
=>
{
console
.
log
(
value
);
console
.
log
(
value
);
form
.
setFieldValue
(
'chatInput'
,
''
);
form
.
setFieldValue
(
'chatInput'
,
''
);
setFirstChat
(
true
);
};
};
const
onChange
=
(
value
:
any
)
=>
{
const
onChange
=
(
value
:
any
)
=>
{
...
...
src/pages/document.ejs
View file @
e1bc8ac6
...
@@ -213,7 +213,6 @@
...
@@ -213,7 +213,6 @@
min-height: 420px;
min-height: 420px;
"
"
>
>
<img
src=
"<%= context.config.publicPath +'pro_icon.svg'%>"
alt=
"logo"
width=
"256"
/>
<div
class=
"page-loading-warp"
>
<div
class=
"page-loading-warp"
>
<div
class=
"ant-spin ant-spin-lg ant-spin-spinning"
>
<div
class=
"ant-spin ant-spin-lg ant-spin-spinning"
>
<span
class=
"ant-spin-dot ant-spin-dot-spin"
<span
class=
"ant-spin-dot ant-spin-dot-spin"
...
@@ -222,14 +221,6 @@
...
@@ -222,14 +221,6 @@
></span>
></span>
</div>
</div>
</div>
</div>
<div
style=
"display: flex; align-items: center; justify-content: center"
>
<img
src=
"https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg"
width=
"32"
style=
"margin-right: 8px"
/>
Ant Design
</div>
</div>
</div>
</div>
</div>
</body>
</body>
...
...
src/pages/user/Login/index.less
deleted
100644 → 0
View file @
adcd6e39
@import (reference) '~antd/es/style/themes/index';
.container {
display: flex;
flex-direction: column;
height: 100vh;
overflow: auto;
background: @layout-body-background;
}
.lang {
width: 100%;
height: 40px;
line-height: 44px;
text-align: right;
:global(.ant-dropdown-trigger) {
margin-right: 24px;
}
}
.content {
flex: 1;
padding: 32px 0;
}
@media (min-width: @screen-md-min) {
.container {
background-image: url('https://gw.alipayobjects.com/zos/rmsportal/TVYTbAXWheQpRcWDaDMu.svg');
background-repeat: no-repeat;
background-position: center 110px;
background-size: 100%;
}
.content {
padding: 32px 0 24px;
}
}
.icon {
margin-left: 8px;
color: rgba(0, 0, 0, 0.2);
font-size: 24px;
vertical-align: middle;
cursor: pointer;
transition: color 0.3s;
&:hover {
color: @primary-color;
}
}
src/pages/user/Login/index.tsx
deleted
100644 → 0
View file @
adcd6e39
import
Footer
from
'@/components/Footer'
;
import
{
login
}
from
'@/services/ant-design-pro/api'
;
import
{
getFakeCaptcha
}
from
'@/services/ant-design-pro/login'
;
import
{
AlipayCircleOutlined
,
LockOutlined
,
MobileOutlined
,
TaobaoCircleOutlined
,
UserOutlined
,
WeiboCircleOutlined
,
}
from
'@ant-design/icons'
;
import
{
LoginForm
,
ProFormCaptcha
,
ProFormCheckbox
,
ProFormText
,
}
from
'@ant-design/pro-components'
;
import
{
Alert
,
message
,
Tabs
}
from
'antd'
;
import
React
,
{
useState
}
from
'react'
;
import
{
FormattedMessage
,
history
,
SelectLang
,
useIntl
,
useModel
}
from
'umi'
;
import
styles
from
'./index.less'
;
const
LoginMessage
:
React
.
FC
<
{
content
:
string
;
}
>
=
({
content
})
=>
(
<
Alert
style=
{
{
marginBottom
:
24
,
}
}
message=
{
content
}
type=
"error"
showIcon
/>
);
const
Login
:
React
.
FC
=
()
=>
{
const
[
userLoginState
,
setUserLoginState
]
=
useState
<
API
.
LoginResult
>
({});
const
[
type
,
setType
]
=
useState
<
string
>
(
'account'
);
const
{
initialState
,
setInitialState
}
=
useModel
(
'@@initialState'
);
const
intl
=
useIntl
();
const
fetchUserInfo
=
async
()
=>
{
const
userInfo
=
await
initialState
?.
fetchUserInfo
?.();
if
(
userInfo
)
{
await
setInitialState
((
s
)
=>
({
...
s
,
currentUser
:
userInfo
,
}));
}
};
const
handleSubmit
=
async
(
values
:
API
.
LoginParams
)
=>
{
try
{
// 登录
const
msg
=
await
login
({
...
values
,
type
});
if
(
msg
.
status
===
'ok'
)
{
const
defaultLoginSuccessMessage
=
intl
.
formatMessage
({
id
:
'pages.login.success'
,
defaultMessage
:
'登录成功!'
,
});
message
.
success
(
defaultLoginSuccessMessage
);
await
fetchUserInfo
();
/** 此方法会跳转到 redirect 参数所在的位置 */
if
(
!
history
)
return
;
const
{
query
}
=
history
.
location
;
const
{
redirect
}
=
query
as
{
redirect
:
string
};
history
.
push
(
redirect
||
'/'
);
return
;
}
console
.
log
(
msg
);
// 如果失败去设置用户错误信息
setUserLoginState
(
msg
);
}
catch
(
error
)
{
const
defaultLoginFailureMessage
=
intl
.
formatMessage
({
id
:
'pages.login.failure'
,
defaultMessage
:
'登录失败,请重试!'
,
});
message
.
error
(
defaultLoginFailureMessage
);
}
};
const
{
status
,
type
:
loginType
}
=
userLoginState
;
return
(
<
div
className=
{
styles
.
container
}
>
<
div
className=
{
styles
.
lang
}
data
-
lang
>
{
SelectLang
&&
<
SelectLang
/>
}
</
div
>
<
div
className=
{
styles
.
content
}
>
<
LoginForm
logo=
{
<
img
alt=
"logo"
src=
"/logo.svg"
/>
}
title=
"Ant Design"
subTitle=
{
intl
.
formatMessage
({
id
:
'pages.layouts.userLayout.title'
})
}
initialValues=
{
{
autoLogin
:
true
,
}
}
actions=
{
[
<
FormattedMessage
key=
"loginWith"
id=
"pages.login.loginWith"
defaultMessage=
"其他登录方式"
/>,
<
AlipayCircleOutlined
key=
"AlipayCircleOutlined"
className=
{
styles
.
icon
}
/>,
<
TaobaoCircleOutlined
key=
"TaobaoCircleOutlined"
className=
{
styles
.
icon
}
/>,
<
WeiboCircleOutlined
key=
"WeiboCircleOutlined"
className=
{
styles
.
icon
}
/>,
]
}
onFinish=
{
async
(
values
)
=>
{
await
handleSubmit
(
values
as
API
.
LoginParams
);
}
}
>
<
Tabs
activeKey=
{
type
}
onChange=
{
setType
}
>
<
Tabs
.
TabPane
key=
"account"
tab=
{
intl
.
formatMessage
({
id
:
'pages.login.accountLogin.tab'
,
defaultMessage
:
'账户密码登录'
,
})
}
/>
<
Tabs
.
TabPane
key=
"mobile"
tab=
{
intl
.
formatMessage
({
id
:
'pages.login.phoneLogin.tab'
,
defaultMessage
:
'手机号登录'
,
})
}
/>
</
Tabs
>
{
status
===
'error'
&&
loginType
===
'account'
&&
(
<
LoginMessage
content=
{
intl
.
formatMessage
({
id
:
'pages.login.accountLogin.errorMessage'
,
defaultMessage
:
'账户或密码错误(admin/ant.design)'
,
})
}
/>
)
}
{
type
===
'account'
&&
(
<>
<
ProFormText
name=
"username"
fieldProps=
{
{
size
:
'large'
,
prefix
:
<
UserOutlined
className=
{
styles
.
prefixIcon
}
/>,
}
}
placeholder=
{
intl
.
formatMessage
({
id
:
'pages.login.username.placeholder'
,
defaultMessage
:
'用户名: admin or user'
,
})
}
rules=
{
[
{
required
:
true
,
message
:
(
<
FormattedMessage
id=
"pages.login.username.required"
defaultMessage=
"请输入用户名!"
/>
),
},
]
}
/>
<
ProFormText
.
Password
name=
"password"
fieldProps=
{
{
size
:
'large'
,
prefix
:
<
LockOutlined
className=
{
styles
.
prefixIcon
}
/>,
}
}
placeholder=
{
intl
.
formatMessage
({
id
:
'pages.login.password.placeholder'
,
defaultMessage
:
'密码: ant.design'
,
})
}
rules=
{
[
{
required
:
true
,
message
:
(
<
FormattedMessage
id=
"pages.login.password.required"
defaultMessage=
"请输入密码!"
/>
),
},
]
}
/>
</>
)
}
{
status
===
'error'
&&
loginType
===
'mobile'
&&
<
LoginMessage
content=
"验证码错误"
/>
}
{
type
===
'mobile'
&&
(
<>
<
ProFormText
fieldProps=
{
{
size
:
'large'
,
prefix
:
<
MobileOutlined
className=
{
styles
.
prefixIcon
}
/>,
}
}
name=
"mobile"
placeholder=
{
intl
.
formatMessage
({
id
:
'pages.login.phoneNumber.placeholder'
,
defaultMessage
:
'手机号'
,
})
}
rules=
{
[
{
required
:
true
,
message
:
(
<
FormattedMessage
id=
"pages.login.phoneNumber.required"
defaultMessage=
"请输入手机号!"
/>
),
},
{
pattern
:
/^1
\d
{10}$/
,
message
:
(
<
FormattedMessage
id=
"pages.login.phoneNumber.invalid"
defaultMessage=
"手机号格式错误!"
/>
),
},
]
}
/>
<
ProFormCaptcha
fieldProps=
{
{
size
:
'large'
,
prefix
:
<
LockOutlined
className=
{
styles
.
prefixIcon
}
/>,
}
}
captchaProps=
{
{
size
:
'large'
,
}
}
placeholder=
{
intl
.
formatMessage
({
id
:
'pages.login.captcha.placeholder'
,
defaultMessage
:
'请输入验证码'
,
})
}
captchaTextRender=
{
(
timing
,
count
)
=>
{
if
(
timing
)
{
return
`${count} ${intl.formatMessage({
id: 'pages.getCaptchaSecondText',
defaultMessage: '获取验证码',
})}`
;
}
return
intl
.
formatMessage
({
id
:
'pages.login.phoneLogin.getVerificationCode'
,
defaultMessage
:
'获取验证码'
,
});
}
}
name=
"captcha"
rules=
{
[
{
required
:
true
,
message
:
(
<
FormattedMessage
id=
"pages.login.captcha.required"
defaultMessage=
"请输入验证码!"
/>
),
},
]
}
onGetCaptcha=
{
async
(
phone
)
=>
{
const
result
=
await
getFakeCaptcha
({
phone
,
});
if
(
result
===
false
)
{
return
;
}
message
.
success
(
'获取验证码成功!验证码为:1234'
);
}
}
/>
</>
)
}
<
div
style=
{
{
marginBottom
:
24
,
}
}
>
<
ProFormCheckbox
noStyle
name=
"autoLogin"
>
<
FormattedMessage
id=
"pages.login.rememberMe"
defaultMessage=
"自动登录"
/>
</
ProFormCheckbox
>
<
a
style=
{
{
float
:
'right'
,
}
}
>
<
FormattedMessage
id=
"pages.login.forgotPassword"
defaultMessage=
"忘记密码"
/>
</
a
>
</
div
>
</
LoginForm
>
</
div
>
<
Footer
/>
</
div
>
);
};
export
default
Login
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment