From 413b29ed1a97cbc1b783fc920edc43ba5a32b17d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 19 Jul 2019 14:18:26 +0800 Subject: [PATCH] =?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/App.js | 9 +- .../src/modules/user/FindPasswordComponent.js | 9 ++ .../modules/user/LoginRegisterComponent.js | 121 +++++++++++++++--- public/react/src/search/SearchPage.js | 82 ++++++++++++ public/react/src/search/searchc.css | 74 +++++++++++ 5 files changed, 275 insertions(+), 20 deletions(-) create mode 100644 public/react/src/search/SearchPage.js create mode 100644 public/react/src/search/searchc.css diff --git a/public/react/src/App.js b/public/react/src/App.js index c86498851..293d1baca 100644 --- a/public/react/src/App.js +++ b/public/react/src/App.js @@ -110,6 +110,11 @@ const CoursesIndex = Loadable({ loader: () => import('./modules/courses/Index'), loading: Loading, }) +const SearchPage = Loadable({ + loader: () => import('./search/SearchPage'), + loading: Loading, +}) + // 课堂讨论 // const BoardIndex = Loadable({ // loader: () => import('./modules/courses/boards/BoardIndex'), @@ -328,9 +333,10 @@ class App extends Component { {/*实训课程(原实训路径)*/} - + {/*课堂*/} + {/* 课堂讨论 */} {/* */} @@ -340,6 +346,7 @@ class App extends Component { {/* */} {/* 兴趣页面*/} {/**/} + diff --git a/public/react/src/modules/user/FindPasswordComponent.js b/public/react/src/modules/user/FindPasswordComponent.js index 76375547f..8a2982465 100644 --- a/public/react/src/modules/user/FindPasswordComponent.js +++ b/public/react/src/modules/user/FindPasswordComponent.js @@ -309,6 +309,15 @@ class LoginRegisterComponent extends Component { //是否验证通过 dragOkCallback = () => { console.log(this.state.login); + if(this.state.login===""||this.state.login.length===0){ + this.setState({ + Phonenumberisnotco: "账号不能为空", + Phonenumberisnotcobool: true, + dragOk:false, + Whethertoverify:this.state.Whethertoverify===true?false:true, + }) + return + } this.Emailphonenumberverification(this.state.login) } diff --git a/public/react/src/modules/user/LoginRegisterComponent.js b/public/react/src/modules/user/LoginRegisterComponent.js index dd2523420..0b4044711 100644 --- a/public/react/src/modules/user/LoginRegisterComponent.js +++ b/public/react/src/modules/user/LoginRegisterComponent.js @@ -51,6 +51,10 @@ class LoginRegisterComponent extends Component { codes: "", Phonenumberisnotco: undefined, Phonenumberisnotcos: undefined, + Phonenumberisnotcosyzm:undefined, + Phonenumberisnotcosymmm:undefined, + Phonenumberisnotcosytdhk:undefined, + Phonenumberisnotcosyfwtk:undefined, Phonenumberisnotcobool: false, Whethertoverify:false, @@ -81,6 +85,10 @@ class LoginRegisterComponent extends Component { codes: "", Phonenumberisnotco: undefined, Phonenumberisnotcos: undefined, + Phonenumberisnotcosyzm:undefined, + Phonenumberisnotcosymmm:undefined, + Phonenumberisnotcosytdhk:undefined, + Phonenumberisnotcosyfwtk:undefined, Phonenumberisnotcobool: false, Whethertoverify:false, @@ -175,6 +183,15 @@ class LoginRegisterComponent extends Component { //是否验证通过 dragOkCallback = () => { console.log(this.state.logins); + if(this.state.logins===""||this.state.logins.length===0){ + this.setState({ + Phonenumberisnotco:"账号不能为空", + Phonenumberisnotcobool: true, + dragOk:false, + Whethertoverify:this.state.Whethertoverify===true?false:true, + }) + return + } this.Emailphonenumberverification(this.state.logins, 2) } @@ -182,8 +199,10 @@ class LoginRegisterComponent extends Component { //是否同意 onChange = (e) => { + this.setState({ Agreetotheterms: e.target.checked, + Phonenumberisnotcosyfwtk:undefined, }) } @@ -225,21 +244,31 @@ class LoginRegisterComponent extends Component { } //注册接口 postregistered = () => { - if (this.state.logins === undefined || this.state.logins === "") { - this.openNotification(`请输入登录手机号码或邮箱`,2); - + if (this.state.logins === undefined || this.state.logins === ""||this.state.logins.length===0) { + this.setState({ + Phonenumberisnotcos:"账号不能为空", + }) return } else if (this.state.dragOk === false) { - this.openNotification(`请拖动滑块验证`,2); + this.setState({ + Phonenumberisnotcosytdhk:"请拖动滑块完成验证", + }) return - } else if (this.state.codes === undefined || this.state.codes == "") { - this.openNotification(`请输入验证码`,2); + } else if (this.state.codes === undefined || this.state.codes == ""||this.state.codes.length===0) { + // this.openNotification(`请输入验证码`,2); + this.setState({ + Phonenumberisnotcosyzm:"验证码不能为空", + }) return - } else if (this.state.passwords === undefined || this.state.passwords == "") { - this.openNotification(`请输入密码`,2); + } else if (this.state.passwords === undefined || this.state.passwords == "" ||this.state.passwords.length===0) { + this.setState({ + Phonenumberisnotcosymmm:"密码不能为空", + }) return } else if (this.state.Agreetotheterms === false) { - this.openNotification(`请同意服务协议条款`,2); + this.setState({ + Phonenumberisnotcosyfwtk:"请同意服务协议条款", + }) return; } var url = "/accounts/register.json"; @@ -249,14 +278,30 @@ class LoginRegisterComponent extends Component { code: this.state.codes, }).then((result) => { if(result){ + if(result.data.status===-2){ + if(response.data.message==="验证码不正确"){ + this.setState({ + Phonenumberisnotcosyzm:"验证码不正确", + }) + + return; + }else if(response.data.message==="验证码已失效"){ this.setState({ - logins: "", - dragOk: false, - codes: "", - passwords: "", - Agreetotheterms: "", + Phonenumberisnotcosyzm:"验证码不正确", }) - this.props.history.push("/interesse"); + + return; + } + }else { + this.setState({ + logins: "", + dragOk: false, + codes: "", + passwords: "", + Agreetotheterms: "", + }) + this.props.history.push("/interesse"); + } } }).catch((error) => { @@ -514,12 +559,14 @@ class LoginRegisterComponent extends Component { } this.setState({ passwords: stirngt, + Phonenumberisnotcosymmm:undefined, }) } //获取code codesonChange = (e) => { this.setState({ - codes: e.target.value + codes: e.target.value, + Phonenumberisnotcosyzm:undefined, }) } //切换tab @@ -565,6 +612,11 @@ class LoginRegisterComponent extends Component { dragOk, Whethertoverify, classpassbool, + Phonenumberisnotcosyzm, + Phonenumberisnotcosymmm, + Phonenumberisnotcosytdhk, + Phonenumberisnotcosyfwtk, + Phonenumberisnotcobool, // 注册 readAgreement, } = this.state @@ -687,6 +739,7 @@ class LoginRegisterComponent extends Component { { @@ -718,10 +771,17 @@ class LoginRegisterComponent extends Component { : "" } + { + Phonenumberisnotcosytdhk && Phonenumberisnotcosytdhk != "" ? +

+ {Phonenumberisnotcosytdhk} +

+ :
+ } -
+
+ { + Phonenumberisnotcosyzm && Phonenumberisnotcosyzm != "" ? +

+ {Phonenumberisnotcosyzm} +

+ :
+ + } - this.Showandhide(key)}> }> + { + Phonenumberisnotcosymmm && Phonenumberisnotcosymmm!== "" ? +

+ {Phonenumberisnotcosymmm} +

+ : "" + + } 我已阅读并同意服务协议条款 + { + Phonenumberisnotcosyfwtk && Phonenumberisnotcosyfwtk!== "" ? +

+ {Phonenumberisnotcosyfwtk} +

+ : "" + + } diff --git a/public/react/src/search/SearchPage.js b/public/react/src/search/SearchPage.js new file mode 100644 index 000000000..076bc9f4d --- /dev/null +++ b/public/react/src/search/SearchPage.js @@ -0,0 +1,82 @@ +import React,{ Component } from "react"; +import {Checkbox,Input,Table, Pagination,Menu,Icon} from "antd"; +import {Link,NavLink} from 'react-router-dom'; +import { WordsBtn ,ActionBtn,SnackbarHOC} from 'educoder'; +const Search = Input.Search; +import axios from 'axios'; +import './searchc.css' +import {TPMIndexHOC} from "../modules/tpm/TPMIndexHOC"; + +class SearchPage extends Component{ + constructor(props) { + super(props); + this.state={ + tab:"0", + count:0, + } + } + //切换tab + changeTab=(e)=>{ + this.setState({ + tab:e.key + }) + + + } + + componentDidMount(){ + // const query =this.props.location.search; + // const type = query.split('?tab='); + // let sum = [] + // sum.push(type[1]) + // // console.log("componentDidMountcomponentDidMount"); + // // console.log(sum); + // this.setState({ + // tab:sum, + // }) + + } + setdatafuns =(value)=>{ + + } + + render(){ + let {tab,count}=this.state; + console.log(tab); + return( +
+
+
+ 搜索} + onSearch={ (value)=>this.setdatafuns(value)} /> +
+ +
+ + 开发社区 + 实践课程 + 翻转课堂 + 交流问答 + +
+ +
+

共找到相关结果{count}

+
+ +
+ + + + +
+
+ + ) + } +} + +export default SnackbarHOC() (TPMIndexHOC ( SearchPage )); \ No newline at end of file diff --git a/public/react/src/search/searchc.css b/public/react/src/search/searchc.css new file mode 100644 index 000000000..9fe8b22a0 --- /dev/null +++ b/public/react/src/search/searchc.css @@ -0,0 +1,74 @@ +.searchinput{ + width: 800px; + margin-top: 53px; +} +.headersear{ + height: 160px; + background: #EAF2F9; + display: flex; + justify-content: center; +} +.packinput .ant-input{ + height: 55px; + width:663px !important; + font-size: 18px; + color: #681616 !important; + border-color: #E1EDF8 !important; +} + +.packinput .ant-input-group-addon .ant-btn{ + width:137px !important; + font-size: 18px; + height: 53px; + background:rgba(76,172,255,1); + +} +.tabtitle{ + width: 100% !important; + height: 62px !important; + box-shadow: 3px 10px 21px 0px rgba(76, 76, 76, 0.15); + border-radius: 6px; + background: #fff; + background: rgb(244, 244, 244); +} + + +.tabtitless{ + height: 62px !important; + line-height: 62px !important; + +} +.tabtitle1{ + margin-left: 181px !important; + +} +.tabtitle2{ + margin-left: 90px !important; + +} + + +.counttit{ + width: 130px; + height: 18px; +} + +.counttittext{ + width: 130px; + height: 18px; + color: #888888; + font-size: 13px; + margin-top: 24px; + padding-bottom: 17px; + margin-left: 343px; + +} +.counttittexts{ + color: #4CACFF !important; + font-size: 13px; +} + +.mainx{ + display: flex; + justify-content: center; +} \ No newline at end of file