diff --git a/public/react/src/App.js b/public/react/src/App.js index 9b85acfa8..f9b6fd36b 100644 --- a/public/react/src/App.js +++ b/public/react/src/App.js @@ -64,6 +64,12 @@ const EducoderLogin = Loadable({ loader: () => import('./modules/login/EducoderLogin'), loading: Loading, }) + +//微信登录 +const Otherlogin=Loadable({ + loader: () => import('./modules/login/Otherlogin'), + loading: Loading, +}) const TestIndex = Loadable({ loader: () => import('./modules/test'), loading: Loading, @@ -406,6 +412,9 @@ class App extends Component { + { diff --git a/public/react/src/modules/courses/css/Courses.css b/public/react/src/modules/courses/css/Courses.css index 12c4e8d3e..160104920 100644 --- a/public/react/src/modules/courses/css/Courses.css +++ b/public/react/src/modules/courses/css/Courses.css @@ -1701,4 +1701,47 @@ input.ant-input-number-input:focus { /*}*/ .yslinputcourput .ant-form-explain{ padding-left: 0px !important; +} +.wechatloginfont{ + font-size: 14px; + font-family: PingFangSC-Regular,PingFangSC; + font-weight: 400; + color: #555555; + line-height: 20px; + margin-top: 10px; +} + +.wechatdiv{ + margin-top: 40px !important; + width: 800px !important; +} + +.wechatContent{ + padding: 0px 50px; +} + +.wechatpass{ + width: 300px; + height: 46px; +} + +.wechatnewchat{ + width: 62px; + height: 62px; + background: rgba(255,170,170,1); + border-radius: 50%; + text-align: center; + line-height: 62px; + color: #fff; + margin: 0 auto; +} +.wechatweoldchat{ + width: 62px; + height: 62px; + background:rgba(164,211,255,1); + border-radius: 50%; + text-align: center; + line-height: 62px; + color: #fff; + margin: 0 auto; } \ 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 7a0637678..b0c1602a9 100644 --- a/public/react/src/modules/login/LoginDialog.js +++ b/public/react/src/modules/login/LoginDialog.js @@ -638,7 +638,7 @@ class LoginDialog extends Component { frameBorder="0" 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%2fwww.educoder.net%2f&response_type=code&scope=snsapi_login#wechat_redirect">:""} + src="https://open.weixin.qq.com/connect/qrconnect?appid=wx6b119e2d829c13fa&redirect_uri=https%3a%2f%2fwww.educoder.net%2fotherlogin&response_type=code&scope=snsapi_login#wechat_redirect">:""} {weixinlogin===true?

this.hideweixinlogin()}>返回账号登录

:""} diff --git a/public/react/src/modules/login/Otherlogin.js b/public/react/src/modules/login/Otherlogin.js new file mode 100644 index 000000000..2dc82b578 --- /dev/null +++ b/public/react/src/modules/login/Otherlogin.js @@ -0,0 +1,313 @@ +import React, {Component} from "react"; +import { + Form, + Select, + Input, + Button, + Checkbox, + Upload, + Icon, + message, + Modal, + Table, + Divider, + InputNumber, + Tag, + DatePicker, + Radio, + Tooltip, + notification, + Layout, + Spin +} from "antd"; +import axios from 'axios'; +const { Header, Footer, Sider, Content } = Layout; +import { getImageUrl } from 'educoder' +import {Link, Switch, Route, Redirect} from 'react-router-dom'; +import '../courses/css/members.css'; +import "../courses/common/formCommon.css" +import '../courses/css/Courses.css'; +import beijintulogontwo from '../../../src/images/login/beijintulogontwo.png'; +import educodernet from '../../../src/images/login/educodernet.png'; + +//educoder登入页面 +var sectionStyle = { + "height": "100%", + "width": "100%", + "min-width": "1000px", +// makesure here is String确保这里是一个字符串,以下是es6写法 + + +}; +var imgback = { + " background-size":"cover", +"background-repeat":"no-repeat", + backgroundImage: `url(${beijintulogontwo})`, +} +var imgmian ={ + width: "100%", + background: `url(${beijintulogontwo})`, + position: "relative", + +} + +var newContainer={ + // background: `url(${beijintulogontwo})`, + backgroundPosition: "center" , + backgroundRepeat: "no-repeat", + backgroundAttachment: "fixed", + backgroundSize: "100% 100%", + height:" 100%", + width:" 100%", + position: "absolute", + top: "0px", + bottom: "0px", + minHeight: "100%", + paddingTop: "40px", + +} +class Otherlogin extends Component { + constructor(props) { + super(props); + this.state={ + login:undefined, + password:undefined, + data:undefined, + logintypes:undefined, + spinnings:true + } + + } + + getinfo=()=>{ + let url = `/users/get_user_info.json` + axios.get(url).then((result)=> { + console.log(result); + if(result){ + this.setState({ + data:result.data, + spinnings:false + }) + } + }).catch((error)=>{ + this.setState({ + spinnings:false + }) + }) + + } + + 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.true===false){ + this.getinfo() + }else{ + // this.getinfo() + window.location.href="/" + } + } + } + }).catch((error)=>{ + this.setState({ + spinnings:false + }) + }) + } + + + loginInputonChange=(e)=>{ + if(e.target.value===undefined||e.target.value===""||e.target.value===null){ + + }else{ + if(this.state.logintypes==="username"){ + this.setState({ + logintypes:undefined + }) + } + } + + this.setState({ + login:e.target.value, + }) + } + passwordonChange=(e)=>{ + if(e.target.value===undefined||e.target.value===""||e.target.value===null){ + + }else{ + if(this.state.logintypes==="password"){ + this.setState({ + logintypes:undefined + }) + } + } + + this.setState({ + password:e.target.value, + }) + } + postwechatlogin=(type,username,password)=>{ + + if(type===false){ + if(username===undefined||username===""||username===null){ + this.setState({ + logintypes:"username" + }) + return + } + if(password===undefined||password===""||password===null){ + this.setState({ + logintypes:"password" + }) + return + } + } + let url = "/bind_user.json"; + axios.post(url, { + type: 'wechat', + not_bind:type, + username:username, + password:password + }).then((response) => { + if(response.data.status===0){ + window.location.href="/" + } + }).catch((error) => { + console.log(error) + }); + } + render() { + let {data,logintypes,spinnings} = this.state; + + console.log(logintypes) + return ( +
+ + + +
+
+
+
+ +
+
+ 为了更好的为您服务,请关联一个EduCoder账号 +
+
+ +
+ +

+ + +

+ 新用户 +
+ + +
欢迎来到EduCoder,新用户登录EduCoder可以到“账号管理-安全设置”中绑定手机/邮箱,以后可以用绑定的手机/邮箱,设置的密码登录EduCoder了。
+ 立即体验表示您已经同意我们的 服务协议条款 +
+ +
+
+ +

+ +

+ + +

+ 老用户 +
+ + +
已有EduCoder账号,可以输入您的账号和密码,将您的微信账号与EduCoder账号进行绑定。
+ + + + + + + {this.state.logintypes==="username"?请填写账号:this.state.logintypes==="password"?请填写密码:""} +
+ +
+
+ +

+
+ +
+
+
© 2019 EduCoder湘ICP备17009477号Trustie   &   IntelliDE inside.
+
+
+
+
+ ) + } + +} + +export default Otherlogin; diff --git a/public/react/src/modules/user/LoginRegisterComponent.js b/public/react/src/modules/user/LoginRegisterComponent.js index 022564f5b..1e71ed681 100644 --- a/public/react/src/modules/user/LoginRegisterComponent.js +++ b/public/react/src/modules/user/LoginRegisterComponent.js @@ -1163,7 +1163,7 @@ class LoginRegisterComponent extends Component { color: '#676767', }}>我已阅读并同意 - 《服务协议条款》 + 《服务协议条款》 @@ -1184,7 +1184,7 @@ class LoginRegisterComponent extends Component { frameBorder="0" 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%2fwww.educoder.net%2f&response_type=code&scope=snsapi_login#wechat_redirect">:""} + src="https://open.weixin.qq.com/connect/qrconnect?appid=wx6b119e2d829c13fa&redirect_uri=https%3a%2f%2fwww.educoder.net%2fotherlogin&response_type=code&scope=snsapi_login#wechat_redirect">:""} {weixinlogin===true?

this.hideweixinlogin()}>返回登录注册

:""}