Commit ba92d52e by zhangleyuan

feat:处理微信授权登录

parent 85f7696e
......@@ -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>
)
}
......
/*
* @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];
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;
.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
/*
* @Author: 吴文洁
* @Date: 2020-04-29 10:26:32
* @LastEditors: 吴文洁
* @LastEditTime: 2020-12-21 17:44:31
* @LastEditors: zhangleyuan
* @LastEditTime: 2021-01-05 10:23:51
* @Description: 内容线路由配置
*/
import { MenuConfig } from '@/routes/interface';
import VideoCourse from '@/modules/video-course';
import Authorize from '@/modules/authorize';
const CloudClassConfig: MenuConfig = {
key: 'cloudClass',
name: '云课堂',
routes: [
{
key: 'video_course',
name: '视频课',
path: '/cloudclass/video_course',
component: VideoCourse
key: 'authorize',
name: '授权登录',
path: '/wechat-authorize',
component: Authorize,
}
]
};
export default CloudClassConfig;
\ No newline at end of file
export default CloudClassConfig;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment