Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xiaomai-cloud-class-web
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xiaomai-cloud-class
xiaomai-cloud-class-web
Commits
f4df368a
Commit
f4df368a
authored
Jun 22, 2021
by
guomingpang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:优化,隐藏手机登陆入口
parent
da680cd7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
131 additions
and
18 deletions
+131
-18
src/modules/root/Login.jsx
+114
-7
src/modules/root/Login.less
+0
-0
src/modules/root/WechatLogin.less
+7
-9
src/modules/root/WechatLogin.tsx
+10
-2
No files found.
src/modules/root/Login.jsx
View file @
f4df368a
import
React
,
{
useEffect
}
from
'react'
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
withRouter
}
from
'react-router-dom'
;
import
'./Login.less'
;
import
{
Input
,
Popover
,
message
,
Tabs
,
Button
}
from
'antd'
;
import
CheckBeforeSendCode
from
'../../components/CheckBeforeSendCode'
;
import
User
from
'@/common/js/user'
;
import
WechatLogin
from
'./WechatLogin'
;
import
BaseService
from
'@/domains/basic-domain/baseService'
;
import
axios
from
'axios'
;
import
_
from
'underscore'
;
import
user
from
'@/common/js/user'
;
const
{
TabPane
}
=
Tabs
;
function
Login
(
props
)
{
// const [phone, setPhone] = useState(''); // 登录手机号
// const [phoneverify, setPhoneverify] = useState(''); // 密码登录验证码
// const [openCheck1, setOpenCheck1] = useState(false);
// const [checking1, setChecking1] = useState(false);
// const [codeText, setCodeText] = useState('获取验证码'); // 验证码提示语
// const [waitStatus, setWaitStatus] = useState(false); // 验证码是否在倒计时
// const [errorMessage, setErrorMessage] = useState('');
// const [phoneError, setPhoneError] = useState(false);
// const [checkObject1, setCheckObject1] = useState({});
function
Login
()
{
useEffect
(()
=>
{
const
enterpriseId
=
getParameterByName
(
'enterpriseId'
);
const
userId
=
getParameterByName
(
'userId'
);
...
...
@@ -46,6 +60,92 @@ function Login() {
});
});
}
// async function checkAccount(code, callback = () => {}) {
// callback();
// }
// function checkSend(code) {
// if (!phone) {
// setPhoneError(true);
// setErrorMessage('请输入手机号');
// return;
// }
// if (phone.length != 11) {
// setPhoneError(true);
// setErrorMessage('请输入11位手机号');
// return;
// }
// !_.isEmpty(checkObject1) && checkObject1.reset();
// setOpenCheck1(true);
// }
// function handleSendSMSCode(checkData, userType) {
// if (waitStatus) return;
// let timer;
// const params = {
// phone: phone,
// sig: checkData.sig,
// sessionId: checkData.csessionid,
// token: checkData.token,
// scene: 'nc_login',
// serverType: 'CLOUD_CLASS_LOGIN',
// appTermEnum: 'XIAOMAI_CLOUD_CLASS_PC_WEB_ADMIN',
// };
// BaseService.sendLoginAuthCode(params).then((res) => {
// if (!res.success) {
// setErrorMessage(res.message);
// } else {
// timeSub(60);
// setChecking1(true);
// }
// });
// function timeSub(waitTime, unit) {
// clearTimeout(timer);
// timer = setTimeout(function () {
// if (waitTime === 0) {
// setCodeText('发送验证码');
// setChecking1(false);
// setWaitStatus(false);
// clearTimeout(timer);
// } else {
// setCodeText(`${waitTime}秒后重发`);
// setWaitStatus(true);
// timeSub(--waitTime, 1000);
// }
// }, unit || 0);
// }
// }
// function handleSubmit() {
// if (!phone) {
// setPhoneError(true);
// setErrorMessage('请输入手机号');
// return;
// }
// if (phone.length != 11) {
// setPhoneError(true);
// setErrorMessage('请输入11位手机号');
// return;
// }
// if (!phoneverify) {
// setErrorMessage('请输入验证码');
// return;
// }
// const params = {
// phone,
// authCode: phoneverify,
// appTermEnum: 'XIAOMAI_CLOUD_CLASS_PC_WEB_ADMIN',
// };
// BaseService.login(params).then((res) => {
// if (!res.success) {
// setErrorMessage(res.message);
// } else {
// User.setUserId(res.result.userId);
// User.setToken(res.result.xmToken);
// window.RCHistory.push({
// pathname: `/switch-route`,
// });
// }
// });
// }
return
(
<
div
className=
'login-page'
>
...
...
@@ -55,14 +155,21 @@ function Login() {
<
div
className=
'login-main'
>
<
div
className=
'left-banner'
>
<
div
className=
'img-box'
>
<
img
src=
'https://image.xiaomaiketang.com/xm/
zmsfCP4e5i
.png'
alt=
''
/>
<
img
src=
'https://image.xiaomaiketang.com/xm/
CDCcdAdaPs
.png'
alt=
''
/>
</
div
>
</
div
>
<
div
className=
'login-box'
>
<
img
className=
'login-logo'
src=
'https://image.xiaomaiketang.com/xm/PrxzFpFH7C.png'
></
img
>
<
h3
>
小麦企培(讲师版)
</
h3
>
<
h4
>
企业微信登陆
</
h4
>
<
WechatLogin
></
WechatLogin
>
<
div
className=
'left-top-block color-block'
></
div
>
<
div
className=
'right-bottom-block color-block'
></
div
>
<
div
className=
'login'
>
<
div
className=
'r'
>
<
Tabs
defaultActiveKey=
'1'
>
<
TabPane
tab=
'企业微信登录'
key=
'1'
>
<
WechatLogin
></
WechatLogin
>
</
TabPane
>
</
Tabs
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
...
...
src/modules/root/Login.less
View file @
f4df368a
This diff is collapsed.
Click to expand it.
src/modules/root/WechatLogin.less
View file @
f4df368a
...
...
@@ -11,20 +11,18 @@
}
.rwm {
position: relative;
width: 210px;
height: 210px;
text-align: center;
display: inline-block;
margin-top: 2
0
px;
border: 1px
dashe
d #e8e8e8;
margin-top: 2
4
px;
border: 1px
soli
d #e8e8e8;
border-radius: 2px;
padding: 5px;
#qrcode {
height: 180px;
}
padding: 15px;
.error {
position: absolute;
width:
18
0px;
height:
18
0px;
width:
20
0px;
height:
20
0px;
background: rgba(255, 255, 255, 0.95);
display: flex;
align-items: center;
...
...
src/modules/root/WechatLogin.tsx
View file @
f4df368a
...
...
@@ -5,13 +5,15 @@ import User from '@/common/js/user';
import
{
PATH
}
from
'@/domains/basic-domain/constants'
;
import
'./WechatLogin.less'
;
const
Logo
=
require
(
'@/common/images/logo.png'
);
declare
var
location
:
any
;
export
default
function
WechatLogin
()
{
export
default
function
WechatLogin
(
props
:
any
)
{
const
freshTime
=
60
;
const
init
:
any
=
null
;
const
[
status
,
setStatus
]
=
useState
(
0
);
const
[
ticket
,
setTicket
]
=
useState
(
''
);
const
[
leftTime
,
setLeftTime
]
=
useState
(
freshTime
);
const
QRCode
=
useRef
(
init
);
const
timer
=
useRef
(
init
);
const
leftTimeRef
=
useRef
(
init
);
...
...
@@ -25,16 +27,22 @@ export default function WechatLogin() {
Service
.
Hades
(
'anon/hades/getTicket'
,
{}).
then
((
res
:
any
)
=>
{
setTicket
(
res
.
result
);
const
redirect
=
`
${
PATH
}
?ticket=
${
res
.
result
}
&appTermEnum=XIAOMAI_CLOUD_CLASS_PC_WEB_ADMIN&env=
${
process
.
env
.
DEPLOY_ENV
||
'dev'
}
`
;
// console.log(redirect)
// const url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=ww409ccf9c6e31f19e&redirect_uri=${encodeURIComponent(redirect)}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
// console.log(url)
const
qrcodeWrapDom
:
any
=
document
.
querySelector
(
'#qrcode'
);
let
qrnode
=
new
qrcode
({
text
:
redirect
,
correctLevel
:
2
,
size
:
180
,
image
:
Logo
,
// image: 'https://image.xiaomaiketang.com/xm/Newk4NrxKC.png',
image
:
'https://image.xiaomaiketang.com/xm/bFkRBz7teA.png'
,
imageSize
:
50
,
});
qrcodeWrapDom
.
innerHTML
=
''
;
qrcodeWrapDom
&&
qrcodeWrapDom
.
appendChild
(
qrnode
);
// QRCode.current.innerHTML = ''
// QRCode.current.prepend(qrnode);
setLeftTime
(
freshTime
);
timer
.
current
=
setInterval
(()
=>
{
if
(
leftTimeRef
.
current
==
0
)
{
...
...
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