From 6630cae57f44c3f155b413a516cbf775aa0d7768 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 30 Jul 2019 10:28:20 +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 | 6 +- .../src/modules/message/css/messagemy.css | 6 + .../src/modules/message/js/MessagChat.js | 21 + .../react/src/modules/message/js/MessagSub.js | 125 ++++ .../src/modules/message/js/MessagePrivate.js | 21 + .../src/modules/message/js/Messagerouting.js | 77 ++ public/react/src/modules/tpm/TPMIndexHOC.js | 5 +- .../modules/user/LoginRegisterComponent.js | 702 +++++++++--------- 8 files changed, 618 insertions(+), 345 deletions(-) create mode 100644 public/react/src/modules/message/css/messagemy.css create mode 100644 public/react/src/modules/message/js/MessagChat.js create mode 100644 public/react/src/modules/message/js/MessagSub.js create mode 100644 public/react/src/modules/message/js/MessagePrivate.js diff --git a/public/react/src/App.js b/public/react/src/App.js index 49dac07cd..e7ff43e79 100644 --- a/public/react/src/App.js +++ b/public/react/src/App.js @@ -18,9 +18,9 @@ import Notcompletedysl from './modules/user/Notcompletedysl'; import Trialapplicationysl from './modules/login/Trialapplicationysl'; import Trialapplicationreview from './modules/user/Trialapplicationreview'; import Addcourses from "./modules/courses/coursesPublic/Addcourses"; -import AccountProfile from"./modules/user/AccountProfile"; - +import AccountProfile from "./modules/user/AccountProfile"; +import Messagerouting from "./modules/message/js/Messagerouting"; import Trialapplication from './modules/login/Trialapplication' import NotFoundPage from './NotFoundPage' @@ -377,7 +377,7 @@ class App extends Component { - + {/* */} {/*列表页*/} {/**/} diff --git a/public/react/src/modules/message/css/messagemy.css b/public/react/src/modules/message/css/messagemy.css new file mode 100644 index 000000000..4bdd0f999 --- /dev/null +++ b/public/react/src/modules/message/css/messagemy.css @@ -0,0 +1,6 @@ +.myw120{ + width: 120px; +} +.myh120{ + height: 120px; +} \ No newline at end of file diff --git a/public/react/src/modules/message/js/MessagChat.js b/public/react/src/modules/message/js/MessagChat.js new file mode 100644 index 000000000..0598efb30 --- /dev/null +++ b/public/react/src/modules/message/js/MessagChat.js @@ -0,0 +1,21 @@ +import React, { Component } from 'react'; +//私信聊天页面 +class MessagChat extends Component{ + constructor(props) { + super(props); + this.state={ + + } + } + + componentDidMount(){ + } + render() { + return ( +
+ +
+ ) + } +} +export default MessagChat; \ No newline at end of file diff --git a/public/react/src/modules/message/js/MessagSub.js b/public/react/src/modules/message/js/MessagSub.js new file mode 100644 index 000000000..a58d059a7 --- /dev/null +++ b/public/react/src/modules/message/js/MessagSub.js @@ -0,0 +1,125 @@ +import React, { Component } from 'react'; +import { + Spin, + Pagination, +} from "antd"; +import axios from 'axios'; + +//消息页面 +class MessagSub extends Component{ + constructor(props) { + super(props); + this.state={ + page:1, + limit:10, + typeysl:"", + count:0, + isSpin:true, + } + } + // 初始化数据 + componentDidMount(){ + debugger + console.log("初始化数据了"); + this.getdata("",this.state.page); + } + + //塞选页数 + paginationonChanges=(pageNumber)=>{ + this.setState({ + page: pageNumber, + }) + this.getdata(this.state.typeysl,pageNumber); + + } + //获取数据源 + getdata=(types,page)=>{ + this.setState({ + isSpin:true, + }) + let{limit}=this.state; + let url = `/users/tidings.json`; + axios.get((url),{params:{ + type:types, + page:page, + per_page:limit, + }}).then((result) => { + if (result) { + console.log(types); + console.log(result); + if(result.data.message!==undefined){ + console.log("5151515151"); + return; + } + console.log("调用了消失的方法"); + console.log("5454545454"); + this.setState({ + count:result.data.count, + typeysl:types, + isSpin:false, + }) + } + }).catch((error) => { + console.log(error); + this.setState({ + isSpin:false, + }) + }) + } + + componentWillUnmount(){ + // 卸载异步操作设置状态 + this.setState = (state, callback) => { + return; + } + } + render() { + let{page,limit,typeysl,count,isSpin}=this.state; + console.log("6868686868"); + console.log(isSpin); + return ( +
+ {/*头部筛选数据*/} + + {/*下面内容页面*/} +
+ {/*这里可以进行数据处理*/} + +
+ + +
+
+ + {/*页数*/} +
+
+ +
+
+ +
+
+ ) + } +} +export default MessagSub; \ No newline at end of file diff --git a/public/react/src/modules/message/js/MessagePrivate.js b/public/react/src/modules/message/js/MessagePrivate.js new file mode 100644 index 000000000..7a7c61174 --- /dev/null +++ b/public/react/src/modules/message/js/MessagePrivate.js @@ -0,0 +1,21 @@ +import React, { Component } from 'react'; +//私信页面 +class MessagePrivate extends Component{ + constructor(props) { + super(props); + this.state={ + + } + } + + componentDidMount(){ + } + render() { + return ( +
+ +
+ ) + } +} +export default MessagePrivate; \ No newline at end of file diff --git a/public/react/src/modules/message/js/Messagerouting.js b/public/react/src/modules/message/js/Messagerouting.js index e69de29bb..6cf717e6d 100644 --- a/public/react/src/modules/message/js/Messagerouting.js +++ b/public/react/src/modules/message/js/Messagerouting.js @@ -0,0 +1,77 @@ +import React, { Component } from 'react'; +import {BrowserRouter as Router,Route,Switch} from 'react-router-dom'; +import {Input,Pagination,Tooltip} from 'antd'; +import {TPMIndexHOC} from "../../../modules/tpm/TPMIndexHOC"; +import {Link,NavLink} from 'react-router-dom'; +import { WordsBtn ,ActionBtn,SnackbarHOC,markdownToHTML,getImageUrl} from 'educoder'; +import axios from 'axios'; +import MessagSub from "./MessagSub"; +import MessagePrivate from "./MessagePrivate"; +import MessagChat from "./MessagChat"; +import "../css/messagemy.css" +// MessagSub 消息自路由 +// MessagePrivate 私信 +class Messagerouting extends Component{ + constructor(props) { + super(props); + this.state={ + routing:1, + } + } + + componentDidMount(){ + + } + // 切换路由 + + SwitchonClick=(value)=>{ + this.setState({ + routing:value, + }) + } + render() { + let{routing} =this.state; + return ( +
+
+ {/*左边*/} +
+ {/*头像*/} +
+ + + +

杨树林

+

工程师

+
+ {/*路由跳转*/} + +
+ + {/*右边*/} +
+
+ {/*消息自路由*/} + {routing===1? :""} + + {/*私信*/} + {routing===2? :""} + + {/*私信聊天页面*/} + {routing===3?:""} +
+
+
+ +
+ ) + } +} +export default SnackbarHOC() (TPMIndexHOC ( Messagerouting )); \ No newline at end of file diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js index e092c17d4..2e40d006a 100644 --- a/public/react/src/modules/tpm/TPMIndexHOC.js +++ b/public/react/src/modules/tpm/TPMIndexHOC.js @@ -264,7 +264,10 @@ export function TPMIndexHOC(WrappedComponent) { "is_teacher": false, "tidding_count": 0 } - */ + */ + if(response=== undefined){ + return + } if (response.data) { this.initCommonState(response.data) this.setState({ diff --git a/public/react/src/modules/user/LoginRegisterComponent.js b/public/react/src/modules/user/LoginRegisterComponent.js index eb0a3a5c2..cffc633f5 100644 --- a/public/react/src/modules/user/LoginRegisterComponent.js +++ b/public/react/src/modules/user/LoginRegisterComponent.js @@ -14,12 +14,12 @@ import './common.css' import './commontwo.css' const { TabPane } = Tabs; const loginInputsyl = { -"width":"434px", -"height": "462px", -"-webkit-box-shadow": "3px 10px 21px 0px rgba(76,76,76,0.15)", -"box-shadow": "3px 10px 21px 0px rgba(76,76,76,0.15)", -"border-radius": "6px", -"background": "#fff" + "width":"434px", + "height": "462px", + "-webkit-box-shadow": "3px 10px 21px 0px rgba(76,76,76,0.15)", + "box-shadow": "3px 10px 21px 0px rgba(76,76,76,0.15)", + "border-radius": "6px", + "background": "#fff" } //父组件EducoderLogin.js @@ -66,6 +66,7 @@ class LoginRegisterComponent extends Component { pciphone:true, MyEduCoderModals:false, registered:undefined, + Phonenumberisnotcodmms:undefined, } } @@ -103,13 +104,14 @@ class LoginRegisterComponent extends Component { pciphone:true, MyEduCoderModals:false, registered:undefined, + Phonenumberisnotcodmms:undefined, } } } //判断是否是手机端 - IsPC=()=> { + IsPC=()=> { var userAgentInfo = navigator.userAgent; var Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", @@ -162,7 +164,7 @@ class LoginRegisterComponent extends Component { StudyMakeMoney = () => { // 调用父组件方法 - this.props.Setshowbool(3); + // this.props.Setlogins(3); this.setState({ login: "", @@ -170,7 +172,12 @@ class LoginRegisterComponent extends Component { logins: "", passwords: "", codes: "", - }) + }); + try { + this.props.Setshowbool(3); + }catch (e) { + + } } onTabChange = (activeKey) => { console.log("onTabChange"); @@ -294,6 +301,7 @@ class LoginRegisterComponent extends Component { //登入接口 postLogin = () => { + if (this.state.login === undefined || this.state.login == "") { this.setState({ Phonenumberisnotco:"账号不能为空", @@ -310,34 +318,35 @@ class LoginRegisterComponent extends Component { login: this.state.login, password: this.state.password, }).then((response) => { + debugger if (response === undefined) { return } if(response.data.status === -2){ - if("该手机号尚未注册" || "该邮箱尚未注册"){ - this.setState({ - Phonenumberisnotco:response.data.message, - }) - return; - } - else if("错误的账号或密码"){ - this.setState({ - Phonenumberisnotco:response.data.message, - }) - return; - } - else if("违反平台使用规范,账号已被锁定"){ - this.setState({ - Phonenumberisnotco:response.data.message, - }) - - return; - } - else { - this.openNotification(response.data.message); - return; - } + if(response.data.message==="该手机号尚未注册" || response.data.message==="该邮箱尚未注册"){ + this.setState({ + Phonenumberisnotco:response.data.message, + }) + return; + } + else if(response.data.message==="错误的账号或密码"){ + this.setState({ + Phonenumberisnotcodmms:response.data.message, + }) + return; + } + else if(response.data.message==="违反平台使用规范,账号已被锁定"){ + this.setState({ + Phonenumberisnotco:response.data.message, + }) + + return; + } + else { + this.openNotification(response.data.message); + return; + } } @@ -468,7 +477,7 @@ class LoginRegisterComponent extends Component { // }) this.setMyEduCoderModals(); } - } + } }).catch((error) => { }) @@ -489,54 +498,54 @@ class LoginRegisterComponent extends Component { // this.setState({dragOk: true}) if(result){ - if(result.data.status===-2){ - if (id === 1) { - if(result.data.message==="该手机号码或邮箱已被注册"){ - this.setState({ - Phonenumberisnotco: undefined, - Phonenumberisnotcobool: false, - dragOk:true, - }) - }else { - this.setState({ - Phonenumberisnotco: result.data.message, - Phonenumberisnotcobool: true, - dragOk:false, - Whethertoverify:this.state.Whethertoverify===true?false:true, - }) - console.log("s5"); - - } - return; - } else if (id === 2) { - this.setState({ - Phonenumberisnotcos: result.data.message, - Phonenumberisnotcobool: true, - dragOk:false, - Whethertoverify:this.state.Whethertoverify===true?false:true, - }) - console.log("s6"); - - return; - } - }else { - if (id === 1) { - this.setState({ - Phonenumberisnotco: undefined, - Phonenumberisnotcobool: false, - dragOk:true, - }) - return; - } else if (id === 2) { - this.setState({ - Phonenumberisnotcos: undefined, - Phonenumberisnotcobool: false, - dragOk:true, - }) - return; - } - } - } + if(result.data.status===-2){ + if (id === 1) { + if(result.data.message==="该手机号码或邮箱已被注册"){ + this.setState({ + Phonenumberisnotco: undefined, + Phonenumberisnotcobool: false, + dragOk:true, + }) + }else { + this.setState({ + Phonenumberisnotco: result.data.message, + Phonenumberisnotcobool: true, + dragOk:false, + Whethertoverify:this.state.Whethertoverify===true?false:true, + }) + console.log("s5"); + + } + return; + } else if (id === 2) { + this.setState({ + Phonenumberisnotcos: result.data.message, + Phonenumberisnotcobool: true, + dragOk:false, + Whethertoverify:this.state.Whethertoverify===true?false:true, + }) + console.log("s6"); + + return; + } + }else { + if (id === 1) { + this.setState({ + Phonenumberisnotco: undefined, + Phonenumberisnotcobool: false, + dragOk:true, + }) + return; + } else if (id === 2) { + this.setState({ + Phonenumberisnotcos: undefined, + Phonenumberisnotcobool: false, + dragOk:true, + }) + return; + } + } + } }).catch((error) => { @@ -597,12 +606,12 @@ class LoginRegisterComponent extends Component { }) return; } - if(this.state.pciphone===true) { - if (this.state.dragOk === false) { - this.openNotification("拖动滑块验证"); - return; - } - } + if(this.state.pciphone===true) { + if (this.state.dragOk === false) { + this.openNotification("拖动滑块验证"); + return; + } + } if (this.state.getverificationcodes === true) { this.setState({ @@ -660,12 +669,14 @@ class LoginRegisterComponent extends Component { this.setState({ Phonenumberisnotco: undefined, Phonenumberisnotcobool: false, + Phonenumberisnotcodmms:undefined, login: stirngt, }) }else{ this.setState({ login: stirngt, Phonenumberisnotco:undefined, + Phonenumberisnotcodmms:undefined, }) } @@ -729,61 +740,61 @@ class LoginRegisterComponent extends Component { this.Emailphonenumberverification(e.target.value, 1); } inputOnBlurzhuche = (e, id) => { - if (e.target.value.length === 0) { - this.setState({ - Phonenumberisnotcos: undefined, - Phonenumberisnotcobool: false, - }) - return; - } - // var telephone = $("#telephoneAdd.tianjia_phone").val(); - var regph = /^[1][3,4,5,6,7,8][0-9]{9}$/; - // var email = $("#add_email.tianjia_email").val(); - var regemail = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/; - - // [1]手机号开头必须是1 [3,4,5,6,7,8] 第二位是3-8中的一个 [0-9]{9} 后边9位可以是0-9的任意数字。 - var stringdata = undefined; - if (!regph.test(e.target.value)) { - stringdata = "手机号格式不正确"; - this.setState({ - Phonenumberisnotcos: stringdata, - Phonenumberisnotcobool: true, - dragOk:false, - Whethertoverify:this.state.Whethertoverify===true?false:true, - }) - } else { - this.setState({ - Phonenumberisnotcos: undefined, - Phonenumberisnotcobool: false, + if (e.target.value.length === 0) { + this.setState({ + Phonenumberisnotcos: undefined, + Phonenumberisnotcobool: false, + }) + return; + } + // var telephone = $("#telephoneAdd.tianjia_phone").val(); + var regph = /^[1][3,4,5,6,7,8][0-9]{9}$/; + // var email = $("#add_email.tianjia_email").val(); + var regemail = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/; - }) - return - } + // [1]手机号开头必须是1 [3,4,5,6,7,8] 第二位是3-8中的一个 [0-9]{9} 后边9位可以是0-9的任意数字。 + var stringdata = undefined; + if (!regph.test(e.target.value)) { + stringdata = "手机号格式不正确"; + this.setState({ + Phonenumberisnotcos: stringdata, + Phonenumberisnotcobool: true, + dragOk:false, + Whethertoverify:this.state.Whethertoverify===true?false:true, + }) + } else { + this.setState({ + Phonenumberisnotcos: undefined, + Phonenumberisnotcobool: false, - if (!regemail.test(e.target.value)) { - if ((e.target.value.indexOf("@") != -1) === true) { - stringdata = "邮箱格式不正确"; - } else { - stringdata = "手机号格式不正确"; + }) + return + } - } - this.setState({ - Phonenumberisnotcos: stringdata, - Phonenumberisnotcobool: true, - dragOk:false, - Whethertoverify:this.state.Whethertoverify===true?false:true, - }) - return + if (!regemail.test(e.target.value)) { + if ((e.target.value.indexOf("@") != -1) === true) { + stringdata = "邮箱格式不正确"; } else { - this.setState({ - Phonenumberisnotcos: undefined, - Phonenumberisnotcobool: false, + stringdata = "手机号格式不正确"; - }) - this.Emailphonenumberverification(e.target.value, id); - return } + this.setState({ + Phonenumberisnotcos: stringdata, + Phonenumberisnotcobool: true, + dragOk:false, + Whethertoverify:this.state.Whethertoverify===true?false:true, + }) + return + } else { + this.setState({ + Phonenumberisnotcos: undefined, + Phonenumberisnotcobool: false, + + }) this.Emailphonenumberverification(e.target.value, id); + return + } + this.Emailphonenumberverification(e.target.value, id); } //获取登入密码 passwordonChange = (e) => { @@ -798,6 +809,7 @@ class LoginRegisterComponent extends Component { this.setState({ password: stirngt, Phonenumberisnotcodmm:undefined, + Phonenumberisnotcodmms:undefined, }) // this.setState({ // password: e.target.value @@ -807,28 +819,28 @@ class LoginRegisterComponent extends Component { loginInputonChanges = (e) => { console.log(e.target.value); var stirngt; - if(e.target.value.length>0){ - var str= e.target.value.replace(/\s*/g,"") - stirngt=str; - }else{ - stirngt= e.target.value; - } - if (e.target.value.length === 0) { - this.setState({ - Phonenumberisnotcos: undefined, - Phonenumberisnotcobool: false, - logins: stirngt, - dragOk:false, - Whethertoverify:this.state.Whethertoverify===true?false:true, - }) - }else{ - this.setState({ - logins: stirngt, - Phonenumberisnotcos: undefined, - dragOk:false, - Whethertoverify:this.state.Whethertoverify===true?false:true, - }) - } + if(e.target.value.length>0){ + var str= e.target.value.replace(/\s*/g,"") + stirngt=str; + }else{ + stirngt= e.target.value; + } + if (e.target.value.length === 0) { + this.setState({ + Phonenumberisnotcos: undefined, + Phonenumberisnotcobool: false, + logins: stirngt, + dragOk:false, + Whethertoverify:this.state.Whethertoverify===true?false:true, + }) + }else{ + this.setState({ + logins: stirngt, + Phonenumberisnotcos: undefined, + dragOk:false, + Whethertoverify:this.state.Whethertoverify===true?false:true, + }) + } } //获取注册密码 @@ -858,7 +870,7 @@ class LoginRegisterComponent extends Component { this.setState({ tab:e.key }) - console.log(e.key); + console.log(e.key); if(e.key === 0){ this.setState({ Phonenumberisnotcos:undefined @@ -916,6 +928,7 @@ class LoginRegisterComponent extends Component { // 注册 readAgreement, pciphone, + Phonenumberisnotcodmms, } = this.state // height: 346px; if (this.state.seconds === 0) { @@ -925,30 +938,30 @@ class LoginRegisterComponent extends Component { console.log(classpass); return ( -
- - -
- - 登录 - 注册 - - - { - parseInt(tab[0])==0 && -
- + +
+ + 登录 + 注册 + + + { + parseInt(tab[0])==0 && +
+ - - this.inputOnBlur(e, 1)} - style={{marginTop: '30px', height: '38px'}}> - - { - Phonenumberisnotco && Phonenumberisnotco != "" ? -

- {Phonenumberisnotco} -

- :
- } - - - { - Phonenumberisnotcodmm && Phonenumberisnotcodmm != "" ? -

- {Phonenumberisnotcodmm} -

- :
- } - - - - -
- } - - - { - parseInt(tab[0])==1 && -
- this.inputOnBlurzhuche(e, 2)} - style={{marginTop: '30px' , height: '38px',color:'#999999',fontSize:"14px"}}> - { - Phonenumberisnotcos && Phonenumberisnotcos !== "" ? -

- {Phonenumberisnotcos} -

- :
+ } + + + this.inputOnBlur(e, 1)} + style={{marginTop: '30px', height: '38px'}}> + + { + Phonenumberisnotco && Phonenumberisnotco != "" ? +

+ {Phonenumberisnotco} +

+ :
+ } + + + { + Phonenumberisnotcodmm && Phonenumberisnotcodmm != "" ? +

+ {Phonenumberisnotcodmm} +

+ : (Phonenumberisnotcodmms=== undefined?
:"") + } + { + Phonenumberisnotcodmms && Phonenumberisnotcodmms != "" ? +

+ {Phonenumberisnotcodmms} +

+ : "" + } + + + + +
+ } + + + { + parseInt(tab[0])==1 && +
+ this.inputOnBlurzhuche(e, 2)} + style={{marginTop: '30px' , height: '38px',color:'#999999',fontSize:"14px"}}> + { + Phonenumberisnotcos && Phonenumberisnotcos !== "" ? +

+ {Phonenumberisnotcos} +

+ :
+ + } + {this.state.MyEduCoderModals===true? {this.setNotcompleteds()}} + />:""} + + { + Whethertoverify===false&&pciphone===true? + + + : + "" - } - {this.state.MyEduCoderModals===true? {this.setNotcompleteds()}} - />:""} - - { - Whethertoverify===false&&pciphone===true? - - - : - "" - - } - { - Whethertoverify===true&&pciphone===true? - - + } + { + Whethertoverify===true&&pciphone===true? + + : "" - } + } -
- { - pciphone===true? - ( - Phonenumberisnotcosytdhk && Phonenumberisnotcosytdhk !== "" ? +
+ { + pciphone===true? + ( + Phonenumberisnotcosytdhk && Phonenumberisnotcosytdhk !== "" ?

{Phonenumberisnotcosytdhk}

:
- ) - :"" - } -
- - - -
- - - - { - getverificationcodes === undefined ? - - : getverificationcodes === true ? - - : - - } - -
-
- { - Phonenumberisnotcosyzm && Phonenumberisnotcosyzm !== "" ? -

- {Phonenumberisnotcosyzm} -

- :
+ ) + :"" + } +
+ + + +
+ + + + { + getverificationcodes === undefined ? + + : getverificationcodes === true ? + + : + + } + +
+
+ { + Phonenumberisnotcosyzm && Phonenumberisnotcosyzm !== "" ? +

+ {Phonenumberisnotcosyzm} +

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

- {Phonenumberisnotcosymmm} -

- :
- - } - 我已阅读并同意 + } + + this.Showandhide(key)}> + + }> + { + Phonenumberisnotcosymmm && Phonenumberisnotcosymmm !== "" ? +

+ {Phonenumberisnotcosymmm} +

+ :
+ + } + 我已阅读并同意 《服务协议条款》 - + -
- } -
-
+
+ } +
+ ); } }