From 04d20727ea7ce95e0a05a75568208f53060247e7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Mon, 4 Nov 2019 14:14:46 +0800
Subject: [PATCH 01/16] =?UTF-8?q?qq=E7=99=BB=E5=BD=95start?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../react/src/modules/login/LoginDialog.css | 8 +-
public/react/src/modules/login/LoginDialog.js | 135 +++---------------
.../src/modules/login/Otherloginstart.js | 1 -
3 files changed, 28 insertions(+), 116 deletions(-)
diff --git a/public/react/src/modules/login/LoginDialog.css b/public/react/src/modules/login/LoginDialog.css
index 9a9373770..37e2f48b6 100644
--- a/public/react/src/modules/login/LoginDialog.css
+++ b/public/react/src/modules/login/LoginDialog.css
@@ -136,12 +136,18 @@
.startlogin{
color:#888;
}
+
.weixinheight390{
height: 390px;
}
+
+.qqheight390{
+ width: 450px;
+ height: 390px;
+}
#log_reg_content {
padding: 38px 30px 20px !important;
}
.textcenter{
text-align: center;
-}
\ No newline at end of file
+}
diff --git a/public/react/src/modules/login/LoginDialog.js b/public/react/src/modules/login/LoginDialog.js
index 6bd6ac41f..6763f0f91 100644
--- a/public/react/src/modules/login/LoginDialog.js
+++ b/public/react/src/modules/login/LoginDialog.js
@@ -7,7 +7,7 @@ import Dialog, {
DialogContentText,
DialogTitle,
} from 'material-ui/Dialog';
-import {notification } from 'antd';
+import {notification,Modal } from 'antd';
import axios from 'axios';
@@ -104,8 +104,8 @@ class LoginDialog extends Component {
MyEduCoderModals:false,
Phonenumberisnotco:undefined,
Phonenumberisnotcobool:false,
- weixinlogin:false
-
+ weixinlogin:false,
+ qqlogin:false
};
}
enter=(num) =>{
@@ -529,14 +529,23 @@ class LoginDialog extends Component {
weixinlogin:true
})
}
+ openqqlogin=()=>{
+ this.setState({
+ qqlogin:true
+ })
+ window.location.href=`https://graph.qq.com/oauth2.0/show?which=Login&display=pc&client_id=101508858&redirect_uri=https%3a%2f%2f${window.location.host}%2fotherloginstart&response_type=code`
+
+ // window.location.href=`https://graph.qq.com/oauth2.0/show?which=Login&display=pc&client_id=101508858&redirect_uri=https%3a%2f%2fwww.educoder.net%2fotherloginstart&tp=qq&response_type=code`
+ }
hideweixinlogin=()=>{
this.setState({
- weixinlogin:false
+ weixinlogin:false,
+ qqlogin:false
})
}
render() {
- let{open,login,speedy,loginValue,regular,isGoing,isGoingValue,disabled,bottonclass,Phonenumberisnotco,
- dialogBox,shortcutnum,disabledType,gaincode,authCodeType,authCodeclass, isRender,weixinlogin}=this.state;
+ let{qqlogin,login,isGoing,isGoingValue,disabled,bottonclass,Phonenumberisnotco,
+ dialogBox, isRender,weixinlogin}=this.state;
if (isRender === undefined) {
isRender = false
@@ -659,6 +668,9 @@ class LoginDialog extends Component {
this.openweixinlogin()}>
+ {/*this.openqqlogin()} className={"ml10"}>*/}
+ {/**/}
+ {/**/}
:""}
@@ -669,7 +681,9 @@ class LoginDialog extends Component {
sandbox="allow-scripts allow-same-origin allow-top-navigation"
scrolling="no"
src={`https://open.weixin.qq.com/connect/qrconnect?appid=wx6b119e2d829c13fa&redirect_uri=https%3a%2f%2f${window.location.host}%2fotherloginstart&response_type=code&scope=snsapi_login#wechat_redirect`}>:""}
- {weixinlogin===true?
+
+
+ {weixinlogin===true?
this.hideweixinlogin()}>返回账号登录
:""}
@@ -690,110 +704,3 @@ class LoginDialog extends Component {
export default LoginDialog ;
-
-// onkeypress="user_login_keypress(event);"
-
-// onkeypress="user_login_keypress(event);"
-
-
-{/* }
-
-
-
-{/*第三方账号登录*/}
-
-{/* }
-
-//
-// {/**/}
diff --git a/public/react/src/modules/login/Otherloginstart.js b/public/react/src/modules/login/Otherloginstart.js
index fc5d46bbc..97e06f9da 100644
--- a/public/react/src/modules/login/Otherloginstart.js
+++ b/public/react/src/modules/login/Otherloginstart.js
@@ -10,7 +10,6 @@ class Otherloginstart extends Component {
let query=this.props.location.search;
const type = query.split('?code=');
const types = type[1].split('&state=');
- console.log(types)
let codeurl = `/auth/wechat/callback.json`
axios.get(codeurl,{params:{
code:types[0]
From 3815b70c7935764a007b8648850a388d100fffef Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Mon, 4 Nov 2019 15:27:38 +0800
Subject: [PATCH 02/16] =?UTF-8?q?qq=E7=99=BB=E5=BD=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/react/src/modules/login/LoginDialog.js | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/public/react/src/modules/login/LoginDialog.js b/public/react/src/modules/login/LoginDialog.js
index 6763f0f91..46bdea005 100644
--- a/public/react/src/modules/login/LoginDialog.js
+++ b/public/react/src/modules/login/LoginDialog.js
@@ -533,7 +533,7 @@ class LoginDialog extends Component {
this.setState({
qqlogin:true
})
- window.location.href=`https://graph.qq.com/oauth2.0/show?which=Login&display=pc&client_id=101508858&redirect_uri=https%3a%2f%2f${window.location.host}%2fotherloginstart&response_type=code`
+ window.location.href=`https://graph.qq.com/oauth2.0/show?which=Login&display=pc&client_id=101508858&redirect_uri=https%3a%2f%2f${window.location.host}%2otherloginqq&response_type=code`
// window.location.href=`https://graph.qq.com/oauth2.0/show?which=Login&display=pc&client_id=101508858&redirect_uri=https%3a%2f%2fwww.educoder.net%2fotherloginstart&tp=qq&response_type=code`
}
@@ -668,9 +668,9 @@ class LoginDialog extends Component {
this.openweixinlogin()}>
- {/*this.openqqlogin()} className={"ml10"}>*/}
- {/**/}
- {/**/}
+ this.openqqlogin()} className={"ml10"}>
+
+
:""}
From 194b9677ba1e9f386e7e34282ccaa85505c31215 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Mon, 4 Nov 2019 17:29:48 +0800
Subject: [PATCH 03/16] =?UTF-8?q?qq=E7=99=BB=E5=BD=95=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/react/src/App.js | 8 ++-
public/react/src/AppConfig.js | 39 +++++++-----
public/react/src/modules/login/LoginDialog.js | 4 +-
public/react/src/modules/login/Otherlogin.js | 6 +-
.../react/src/modules/login/Otherloginqq.js | 60 +++++++++++++++++++
.../src/modules/login/Otherloginstart.js | 42 +++++++------
6 files changed, 120 insertions(+), 39 deletions(-)
create mode 100644 public/react/src/modules/login/Otherloginqq.js
diff --git a/public/react/src/App.js b/public/react/src/App.js
index e4cd6a732..84b5c0ae4 100644
--- a/public/react/src/App.js
+++ b/public/react/src/App.js
@@ -75,7 +75,10 @@ const Otherloginstart=Loadable({
loader: () => import('./modules/login/Otherloginstart'),
loading: Loading,
})
-
+const Otherloginsqq=Loadable({
+ loader: () => import('./modules/login/Otherloginqq'),
+ loading: Loading,
+})
// const TestIndex = Loadable({
// loader: () => import('./modules/test'),
// loading: Loading,
@@ -527,6 +530,9 @@ class App extends Component {
+
diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js
index ece36b61c..7bdecd966 100644
--- a/public/react/src/AppConfig.js
+++ b/public/react/src/AppConfig.js
@@ -21,16 +21,16 @@ let hashTimeout
// TODO 开发期多个身份切换
let debugType =""
-if (isDev) {
- const _search = window.location.search;
- let parsed = {};
- if (_search) {
- parsed = queryString.parse(_search);
- }
- debugType = window.location.search.indexOf('debug=t') != -1 ? 'teacher' :
- window.location.search.indexOf('debug=s') != -1 ? 'student' :
- window.location.search.indexOf('debug=a') != -1 ? 'admin' : parsed.debug || 'admin'
-}
+// if (isDev) {
+// const _search = window.location.search;
+// let parsed = {};
+// if (_search) {
+// parsed = queryString.parse(_search);
+// }
+// debugType = window.location.search.indexOf('debug=t') != -1 ? 'teacher' :
+// window.location.search.indexOf('debug=s') != -1 ? 'student' :
+// window.location.search.indexOf('debug=a') != -1 ? 'admin' : parsed.debug || 'admin'
+// }
window._debugType = debugType;
export function initAxiosInterceptors(props) {
initOnlineOfflineListener()
@@ -73,15 +73,22 @@ export function initAxiosInterceptors(props) {
}
requestProxy(config)
- var url = `/api${config.url}`;
+ let url = `/api${config.url}`;
+
+ //qq登录去掉api
+ if(config.params&&config.params.redirect_uri!=undefined){
+ if(config.params.redirect_uri.indexOf('otherloginqq')!=-1){
+ url = `${config.url}`;
+ }
+ }
if(`${config[0]}`!=`true`){
if (window.location.port === "3007") {
- if (url.indexOf('.json') == -1) {
-
- alert('开发提示:请给接口加.json:' + url)
-
- }
+ // if (url.indexOf('.json') == -1) {
+ //
+ // alert('开发提示:请给接口加.json:' + url)
+ //
+ // }
config.url = `${proxy}${url}`;
if (config.url.indexOf('?') == -1) {
config.url = `${config.url}?debug=${debugType}`;
diff --git a/public/react/src/modules/login/LoginDialog.js b/public/react/src/modules/login/LoginDialog.js
index 46bdea005..574f46356 100644
--- a/public/react/src/modules/login/LoginDialog.js
+++ b/public/react/src/modules/login/LoginDialog.js
@@ -533,8 +533,8 @@ class LoginDialog extends Component {
this.setState({
qqlogin:true
})
- window.location.href=`https://graph.qq.com/oauth2.0/show?which=Login&display=pc&client_id=101508858&redirect_uri=https%3a%2f%2f${window.location.host}%2otherloginqq&response_type=code`
-
+ //window.location.href=`https://graph.qq.com/oauth2.0/show?which=Login&display=pc&client_id=101508858&redirect_uri=https%3a%2f%2f${window.location.host}%2otherloginqq&response_type=code`
+ window.location.href=`https://graph.qq.com/oauth2.0/show?which=Login&display=pc&client_id=101508858&redirect_uri=https%3a%2f%2ftest-newweb.educoder.net%2fotherloginqq&response_type=code`
// window.location.href=`https://graph.qq.com/oauth2.0/show?which=Login&display=pc&client_id=101508858&redirect_uri=https%3a%2f%2fwww.educoder.net%2fotherloginstart&tp=qq&response_type=code`
}
hideweixinlogin=()=>{
diff --git a/public/react/src/modules/login/Otherlogin.js b/public/react/src/modules/login/Otherlogin.js
index 73f0c6dc6..59710ab2f 100644
--- a/public/react/src/modules/login/Otherlogin.js
+++ b/public/react/src/modules/login/Otherlogin.js
@@ -132,6 +132,8 @@ class Otherlogin extends Component {
}
postwechatlogin=(type,username,password)=>{
+ let query=this.props.location.search;
+ const types = query.split('?type=');
if(type===false){
if(username===undefined||username===""||username===null){
this.setState({
@@ -146,9 +148,11 @@ class Otherlogin extends Component {
return
}
}
+
+
let url = "/bind_user.json";
axios.post(url, {
- type: 'wechat',
+ type: types[1]==="qq"?"qq":'wechat',
not_bind:type,
username:username,
password:password
diff --git a/public/react/src/modules/login/Otherloginqq.js b/public/react/src/modules/login/Otherloginqq.js
new file mode 100644
index 000000000..ae614b474
--- /dev/null
+++ b/public/react/src/modules/login/Otherloginqq.js
@@ -0,0 +1,60 @@
+import React, { Component } from 'react';
+
+import { BrowserRouter as Router, Route, Link } from "react-router-dom";
+
+import { Spin } from 'antd';
+import axios from 'axios';
+class Otherloginqq extends Component {
+
+ componentDidMount() {
+ let query=this.props.location.search;
+
+ if(query!= ""){
+
+ }
+ const type = query.split('?code=');
+ let codeurl = `/auth/qq/callback`;
+ axios.get(codeurl,{params:{
+ code:type[1],
+ redirect_uri:`https://test-newweb.educoder.net/otherloginqq`
+ }}).then((result)=> {
+ if(result){
+ if(result.data.status===0){
+ if(result.data.new_user===true){
+ window.location.href="/otherlogin?type=qq"
+ }else{
+ // this.getinfo()
+ if(types[1]==="account"){
+ window.location.href="/account/binding"
+ }else{
+ window.location.href="/"
+ }
+
+ }
+ }
+ }
+ }).catch((error)=>{
+
+ })
+ }
+
+ render() {
+ // Loading
+ return (
+
+
+
+
+ );
+ }
+}
+
+export default Otherloginqq;
\ No newline at end of file
diff --git a/public/react/src/modules/login/Otherloginstart.js b/public/react/src/modules/login/Otherloginstart.js
index 97e06f9da..9901fc8ad 100644
--- a/public/react/src/modules/login/Otherloginstart.js
+++ b/public/react/src/modules/login/Otherloginstart.js
@@ -8,30 +8,34 @@ class Otherloginstart extends Component {
componentDidMount() {
let query=this.props.location.search;
- const type = query.split('?code=');
- const types = type[1].split('&state=');
- let codeurl = `/auth/wechat/callback.json`
- axios.get(codeurl,{params:{
- code:types[0]
- }}).then((result)=> {
- if(result){
- if(result.data.status===0){
- if(result.data.new_user===true){
- window.location.href="/otherlogin"
- }else{
- // this.getinfo()
- if(types[1]==="account"){
- window.location.href="/account/binding"
+ debugger
+ if(query!= ""){
+ const type = query.split('?code=');
+ const types = type[1].split('&state=');
+ let codeurl = `/auth/wechat/callback.json`
+ axios.get(codeurl,{params:{
+ code:types[0]
+ }}).then((result)=> {
+ if(result){
+ if(result.data.status===0){
+ if(result.data.new_user===true){
+ window.location.href="/otherlogin?type=wechat"
}else{
- window.location.href="/"
- }
+ // this.getinfo()
+ if(types[1]==="account"){
+ window.location.href="/account/binding"
+ }else{
+ window.location.href="/"
+ }
+ }
}
}
- }
- }).catch((error)=>{
+ }).catch((error)=>{
+
+ })
+ }
- })
}
From 6df0ab0c2c8b799292453b7e31f6b69603f1f269 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Mon, 4 Nov 2019 20:58:40 +0800
Subject: [PATCH 04/16] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/react/src/AppConfig.js | 20 +++----
.../modules/user/account/AccountBinding.js | 58 +++++++++++++++++++
2 files changed, 68 insertions(+), 10 deletions(-)
diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js
index 7bdecd966..8440db911 100644
--- a/public/react/src/AppConfig.js
+++ b/public/react/src/AppConfig.js
@@ -21,16 +21,16 @@ let hashTimeout
// TODO 开发期多个身份切换
let debugType =""
-// if (isDev) {
-// const _search = window.location.search;
-// let parsed = {};
-// if (_search) {
-// parsed = queryString.parse(_search);
-// }
-// debugType = window.location.search.indexOf('debug=t') != -1 ? 'teacher' :
-// window.location.search.indexOf('debug=s') != -1 ? 'student' :
-// window.location.search.indexOf('debug=a') != -1 ? 'admin' : parsed.debug || 'admin'
-// }
+if (isDev) {
+ const _search = window.location.search;
+ let parsed = {};
+ if (_search) {
+ parsed = queryString.parse(_search);
+ }
+ debugType = window.location.search.indexOf('debug=t') != -1 ? 'teacher' :
+ window.location.search.indexOf('debug=s') != -1 ? 'student' :
+ window.location.search.indexOf('debug=a') != -1 ? 'admin' : parsed.debug || 'admin'
+}
window._debugType = debugType;
export function initAxiosInterceptors(props) {
initOnlineOfflineListener()
diff --git a/public/react/src/modules/user/account/AccountBinding.js b/public/react/src/modules/user/account/AccountBinding.js
index b36095fcb..68a642a96 100644
--- a/public/react/src/modules/user/account/AccountBinding.js
+++ b/public/react/src/modules/user/account/AccountBinding.js
@@ -146,6 +146,7 @@ class AccountSecure extends Component {
}
`}
绑定登录账号
+
}
{weixinlogin===true?