Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wechat-common
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
wechat-common
Commits
0a6e2e3f
Commit
0a6e2e3f
authored
Mar 31, 2021
by
zhangleyuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:添加去企业微信授权登录
parent
199a611b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
122 additions
and
4 deletions
+122
-4
src/index.tsx
+1
-1
src/modules/authorize/index.jsx
+3
-0
src/modules/workWxAuthorize/index.jsx
+82
-0
src/modules/workWxAuthorize/index.less
+27
-0
src/routes/config/cloudClass.tsx
+9
-3
No files found.
src/index.tsx
View file @
0a6e2e3f
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* @Author: 吴文洁
* @Author: 吴文洁
* @Date: 2020-04-27 20:35:34
* @Date: 2020-04-27 20:35:34
* @LastEditors: zhangleyuan
* @LastEditors: zhangleyuan
* @LastEditTime: 2021-0
1-14 10:48:59
* @LastEditTime: 2021-0
3-31 16:30:47
* @Description:
* @Description:
*/
*/
...
...
src/modules/authorize/index.jsx
View file @
0a6e2e3f
...
@@ -15,6 +15,9 @@ class Authorize extends React.Component {
...
@@ -15,6 +15,9 @@ class Authorize extends React.Component {
}
}
}
}
componentDidMount
()
{
componentDidMount
()
{
// console.log("ticket",window.getParameterByName('ticket'))
// const searchParams = this.props.location.search;
// const {code,ticket} = queryString.parse(searchParams);
const
code
=
window
.
getParameterByName
(
'code'
);
const
code
=
window
.
getParameterByName
(
'code'
);
const
ticket
=
window
.
getParameterByName
(
'ticket'
);
const
ticket
=
window
.
getParameterByName
(
'ticket'
);
this
.
setState
({
this
.
setState
({
...
...
src/modules/workWxAuthorize/index.jsx
0 → 100644
View file @
0a6e2e3f
import
React
from
'react'
;
import
Service
from
'@/common/js/service'
;
import
'./index.less'
;
class
WorkWxAuthorize
extends
React
.
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
scanState
:
''
,
messageText
:
''
}
}
componentDidMount
()
{
const
code
=
window
.
getParameterByName
(
'code'
);
if
(
!
code
){
this
.
workWechatAuthorize
();
}
else
{
this
.
workWechatLogin
();
}
}
workWechatLogin
=
()
=>
{
const
code
=
window
.
getParameterByName
(
'code'
);
const
ticket
=
window
.
getParameterByName
(
'ticket'
);
const
storeId
=
window
.
getParameterByName
(
'storeId'
);
Service
.
hades
(
"/anon/hades/wXWorkUserTicketLogin"
,
{
appTermEnum
:
appTermEnum
,
code
,
ticket
,
storeId
},
(
res
)
=>
{
if
(
res
.
code
==
200
)
{
this
.
setState
({
scanState
:
'success'
})
}
else
{
let
message
=
res
.
message
.
split
(
','
).
join
(
'<br />'
)
this
.
setState
({
scanState
:
'error'
,
messageText
:
message
})
}
})
}
workWechatAuthorize
=
()
=>
{
const
params
=
{}
Service
.
hades
(
'/anon/hades/getCorpTrainSuiteId'
,
params
).
then
((
res
)
=>
{
let
path
=
window
.
location
.
href
;
const
htmlUrl
=
`https://open.weixin.qq.com/connect/oauth2/authorize?appid=
${
res
.
result
}
&redirect_uri=
${
encodeURIComponent
(
path
)}
&response_type=code&scope=snsapi_privateinfo&state=STATE#wechat_redirect`
window
.
location
.
href
=
htmlUrl
;
})
}
render
()
{
const
{
scanState
,
messageText
}
=
this
.
state
;
return
(
<
div
className=
"work-authorize-page"
>
<
div
className=
"box"
>
{
scanState
===
'success'
&&
<
div
className=
"success"
>
<
img
src=
"https://image.xiaomaiketang.com/xm/iRkcMHPHba.png"
alt=
""
/>
<
p
>
扫码成功
</
p
>
</
div
>
}
{
scanState
===
'error'
&&
<
div
className=
"error"
>
<
img
src=
"https://image.xiaomaiketang.com/xm/6kSAYFMm2r.png
"
alt=
""
/>
<
p
className=
'message'
>
{
messageText
}
</
p
>
</
div
>
}
</
div
>
</
div
>
)
}
}
export
default
WorkWxAuthorize
;
src/modules/workWxAuthorize/index.less
0 → 100644
View file @
0a6e2e3f
.work-authorize-page{
.box {
width: 100%;
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
background: rgba(244, 246, 250, 1);
}
img{
width:60px;
}
p {
font-size: 17px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #333333;
line-height: 24px;
margin-top: 12px;
}
.hide {
display: none;
text-align: center;
}
}
src/routes/config/cloudClass.tsx
View file @
0a6e2e3f
...
@@ -2,14 +2,14 @@
...
@@ -2,14 +2,14 @@
* @Author: 吴文洁
* @Author: 吴文洁
* @Date: 2020-04-29 10:26:32
* @Date: 2020-04-29 10:26:32
* @LastEditors: zhangleyuan
* @LastEditors: zhangleyuan
* @LastEditTime: 2021-0
1-05 10:23:51
* @LastEditTime: 2021-0
3-31 16:31:55
* @Description: 内容线路由配置
* @Description: 内容线路由配置
*/
*/
import
{
MenuConfig
}
from
'@/routes/interface'
;
import
{
MenuConfig
}
from
'@/routes/interface'
;
import
Authorize
from
'@/modules/authorize'
;
import
Authorize
from
'@/modules/authorize'
;
import
WorkWxAuthorize
from
'@/modules/workWxAuthorize'
;
const
CloudClassConfig
:
MenuConfig
=
{
const
CloudClassConfig
:
MenuConfig
=
{
key
:
'cloudClass'
,
key
:
'cloudClass'
,
name
:
'云课堂'
,
name
:
'云课堂'
,
...
@@ -19,7 +19,13 @@ const CloudClassConfig: MenuConfig = {
...
@@ -19,7 +19,13 @@ const CloudClassConfig: MenuConfig = {
name
:
'授权登录'
,
name
:
'授权登录'
,
path
:
'/wechat-authorize'
,
path
:
'/wechat-authorize'
,
component
:
Authorize
,
component
:
Authorize
,
}
},
{
key
:
'authorize'
,
name
:
'授权登录'
,
path
:
'/work-wechat-authorize'
,
component
:
WorkWxAuthorize
,
},
]
]
};
};
export
default
CloudClassConfig
;
export
default
CloudClassConfig
;
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