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
ba92d52e
Commit
ba92d52e
authored
Jan 05, 2021
by
zhangleyuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:处理微信授权登录
parent
85f7696e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
108 additions
and
26 deletions
+108
-26
src/App.tsx
+12
-16
src/common/js/config.ts
+27
-0
src/modules/authorize/index.jsx
+38
-0
src/modules/authorize/index.less
+23
-0
src/routes/config/cloudClass.tsx
+8
-10
No files found.
src/App.tsx
View file @
ba92d52e
...
...
@@ -12,22 +12,18 @@ class App extends React.Component {
render
()
{
return
(
<
div
className=
"app"
>
<
div
className=
"content__body"
>
<
Content
>
{
allRoutes
.
map
((
route
:
RouteConfig
)
=>
{
return
(
<
Route
key=
{
route
.
path
}
component=
{
route
.
component
}
path=
{
route
.
path
}
exact=
{
route
.
exact
}
/>
)
})
}
</
Content
>
</
div
>
{
allRoutes
.
map
((
route
:
RouteConfig
)
=>
{
return
(
<
Route
key=
{
route
.
path
}
component=
{
route
.
component
}
path=
{
route
.
path
}
exact=
{
route
.
exact
}
/>
)
})
}
</
div
>
)
}
...
...
src/common/js/config.ts
0 → 100644
View file @
ba92d52e
/*
* @Author: zhangleyuan
* @Date: 2021-01-05 10:55:02
* @LastEditors: zhangleyuan
* @LastEditTime: 2021-01-05 11:02:06
* @Description: 描述一下
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
/*
* @Author: wufan
* @Date: 2020-08-27 19:57:29
* @Last Modified by: wufan
* @Last Modified time: 2020-09-04 16:20:52
* 系统配置
*/
const
APP_ID_MAP
=
{
dev
:
'wx3ea60e78ddfa277e'
,
rc
:
'wx5c5a1fb71ecab7bc'
,
gray
:
'wxe9f022ccb4d24a51'
,
prod
:
'wx5098ed9a6e115469'
}
// 调试环境,默认dev
const
ENV
=
'dev'
;
export
const
AppId
=
APP_ID_MAP
[
ENV
];
src/modules/authorize/index.jsx
0 → 100644
View file @
ba92d52e
import
React
from
'react'
;
import
Service
from
'@/common/js/service'
;
import
{
AppId
}
from
'@/common/js/config'
import
'./index.less'
;
class
Authorize
extends
React
.
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
}
}
componentDidMount
()
{
}
wechatLogin
=
()
=>
{
let
path
=
window
.
location
.
origin
+
window
.
location
.
pathname
;
let
htmlUrl
=
'https://open.weixin.qq.com/connect/oauth2/authorize?appid='
+
AppId
+
'&redirect_uri='
+
encodeURIComponent
(
path
)
+
'&response_type=code&scope=snsapi_userinfo&state=state#wechat_redirect'
;
window
.
location
.
href
=
htmlUrl
;
}
render
()
{
return
(
<
div
className=
"authorize-page"
>
<
div
>
<
img
src=
"https://image.xiaomaiketang.com/xm/HsCjyKTbWw.png"
className=
"avatar-img"
></
img
>
</
div
>
<
div
>
<
button
className=
"login-btn"
onClick=
{
this
.
wechatLogin
}
>
微信登录
</
button
>
</
div
>
</
div
>
)
}
}
export
default
Authorize
;
src/modules/authorize/index.less
0 → 100644
View file @
ba92d52e
.authorize-page{
background: #F4F6FA;
width:100%;
height:100vh;
text-align:center;
padding-top:18.9vw;
.avatar-img{
width:16vw;
height:16vw;
}
.login-btn{
width: 91.2vw;
height: 11.7vw;
background: #1CAC1B;
border-radius: 1.3vw;
display:inline-block;
color:#FFF;
border:none;
margin-top:10.6vw;
font-size:4vw;
}
}
\ No newline at end of file
src/routes/config/cloudClass.tsx
View file @
ba92d52e
/*
* @Author: 吴文洁
* @Date: 2020-04-29 10:26:32
* @LastEditors:
吴文洁
* @LastEditTime: 202
0-12-21 17:44:3
1
* @LastEditors:
zhangleyuan
* @LastEditTime: 202
1-01-05 10:23:5
1
* @Description: 内容线路由配置
*/
import
{
MenuConfig
}
from
'@/routes/interface'
;
import
VideoCourse
from
'@/modules/video-cours
e'
;
import
Authorize
from
'@/modules/authoriz
e'
;
const
CloudClassConfig
:
MenuConfig
=
{
key
:
'cloudClass'
,
name
:
'云课堂'
,
routes
:
[
{
key
:
'
video_cours
e'
,
name
:
'
视频课
'
,
path
:
'/
cloudclass/video_cours
e'
,
component
:
VideoCourse
key
:
'
authoriz
e'
,
name
:
'
授权登录
'
,
path
:
'/
wechat-authoriz
e'
,
component
:
Authorize
,
}
]
};
export
default
CloudClassConfig
;
\ No newline at end of file
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