Commit ba92d52e by zhangleyuan

feat:处理微信授权登录

parent 85f7696e
...@@ -12,8 +12,6 @@ class App extends React.Component { ...@@ -12,8 +12,6 @@ class App extends React.Component {
render() { render() {
return ( return (
<div className="app"> <div className="app">
<div className="content__body">
<Content>
{ {
allRoutes.map((route: RouteConfig) => { allRoutes.map((route: RouteConfig) => {
return ( return (
...@@ -26,8 +24,6 @@ class App extends React.Component { ...@@ -26,8 +24,6 @@ class App extends React.Component {
) )
}) })
} }
</Content>
</div>
</div> </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: 吴文洁 * @Author: 吴文洁
* @Date: 2020-04-29 10:26:32 * @Date: 2020-04-29 10:26:32
* @LastEditors: 吴文洁 * @LastEditors: zhangleyuan
* @LastEditTime: 2020-12-21 17:44:31 * @LastEditTime: 2021-01-05 10:23:51
* @Description: 内容线路由配置 * @Description: 内容线路由配置
*/ */
import { MenuConfig } from '@/routes/interface'; import { MenuConfig } from '@/routes/interface';
import VideoCourse from '@/modules/video-course'; import Authorize from '@/modules/authorize';
const CloudClassConfig: MenuConfig = { const CloudClassConfig: MenuConfig = {
key: 'cloudClass', key: 'cloudClass',
name: '云课堂', name: '云课堂',
routes: [ routes: [
{ {
key: 'video_course', key: 'authorize',
name: '视频课', name: '授权登录',
path: '/cloudclass/video_course', path: '/wechat-authorize',
component: VideoCourse component: Authorize,
} }
] ]
}; };
export default CloudClassConfig; 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