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 ( +
+
+