From 6b7cf4217cd66978be011ee4b750bab9d1d2c3c1 Mon Sep 17 00:00:00 2001 From: ysl <904079904@qq.com> Date: Fri, 21 Jun 2019 11:30:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/App.js | 3 +- .../tasks/GraduationTaskssettinglist.js | 3 +- .../src/modules/login/Trialapplication.js | 1065 +++++++++-------- public/react/src/modules/tpm/NewHeader.js | 13 +- 4 files changed, 589 insertions(+), 495 deletions(-) diff --git a/public/react/src/App.js b/public/react/src/App.js index f22ba14dd..d4c70e6aa 100644 --- a/public/react/src/App.js +++ b/public/react/src/App.js @@ -241,6 +241,7 @@ class App extends Component { render() { // let {isRenders} = this.state; + return ( @@ -254,7 +255,7 @@ class App extends Component { {/*{*/} {/* isRenders === true?*/} - + {/**/} {/*:""*/} {/*}*/} diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js index bfc7f361e..2f5b10f8f 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js @@ -1550,7 +1550,8 @@ class GraduationTaskssettinglist extends Component{ {taskslistdata.work_status===undefined?"":taskslistdata.work_status.map((item,key)=>{ return( - {item==="提交作品"?提交作品:""} + {item==="提交作品"?提交作品:""} + {item==="补交作品"?补交作品:""} {item==="修改作品"?修改作品:""} {item==="查看作品"?查看作品 :""} {item==="创建项目"?创建项目:""} diff --git a/public/react/src/modules/login/Trialapplication.js b/public/react/src/modules/login/Trialapplication.js index 9c9f0280b..a0903021a 100644 --- a/public/react/src/modules/login/Trialapplication.js +++ b/public/react/src/modules/login/Trialapplication.js @@ -1,10 +1,10 @@ import React, {Component} from 'react'; import {Redirect} from 'react-router'; import Dialog, { - DialogActions, - DialogContent, - DialogContentText, - DialogTitle, + DialogActions, + DialogContent, + DialogContentText, + DialogTitle, } from 'material-ui/Dialog'; import axios from 'axios'; @@ -14,343 +14,397 @@ import {Tabs, Input, Checkbox, Button, notification, Menu} from 'antd'; //试用申请页面 class Trialapplication extends Component { - // isRender控制弹出窗口显示 - constructor(props) { - super(props) - this.state = { - props:props, - login: "", - Phonenumberisnotcocodes:undefined, - codes: "", - reason: "", - Phonenumberisnotcoreason:undefined, - isRenders:false, - seconds: 60, - getverificationcodes: true, - Phonenumberisnotco: undefined, - Phonenumberisnotcobool: false, - readonlyInput: true, - } - // - console.log("Trialapplication"); - console.log(props); - } - - - componentWillReceiveProps(nextProps) { - - // this.setState({ - // isRenders:nextProps.isRenders - // }) - // console.log("componentWillReceiveProps"); - // console.log(nextProps); - } - //初始化数据 - componentDidMount() { - - if (this.props.isRenders != undefined) { - this.setState({ - isRenders: this.props.isRenders - }) - } - - axios.interceptors.response.use((response) => { - if(response!=undefined) - if (response&&response.data.status === 407) { - this.setState({ - isRenders: true - }) - } - return response; - }, (error) => { - // // if (error.response && error.response.data.error === '401 Unauthorized') { - // // this.back_url = window.location.href; - // // this.setState({ - // // isRender: true - // // }) - // // // TODO 这里如果样式变了会出现css不加载的情况 - // // const $ = window.$; - // // const isCssLoaded = window.getComputedStyle($('.log_nav li.active')[0], null) - // // .getPropertyValue('border-bottom') - // // == "2px solid rgb(69, 155, 229)" - // // if (!isCssLoaded) { - // // const isPort3007 = window.location.port == 3007; - // // let _url_origin = isPort3007 ? 'http://localhost:3000' : '' - // // - // // $('head').append( $('') - // // .attr('href', `${_url_origin}/stylesheets/educoder/edu-main.css`) ); - // // $('head').append( $('') - // // .attr('href', `${_url_origin}/stylesheets/educoder/edu-all.css`) ); - // // } - // // } - // // return Promise.reject(error); - }); - } - - //获取登入 - loginInputonChange = (e) => { - // console.log(e.target.value); - this.setState({ - login: e.target.value, - }) - - - } - //获取申请理由 - loginInputonChanges = (e) => { - // console.log(e.target.value); - this.setState({ - reason: e.target.value, - Phonenumberisnotcoreason:undefined, - }) - - - } - //获取code - codesonChange = (e) => { - this.setState({ - codes: e.target.value, - Phonenumberisnotcocodes:undefined, - }) - } - - openNotification = (messge) => { - notification.open({ - message: "提示", - description: - messge, - onClick: () => { - console.log('Notification Clicked!'); - }, - }); - }; - //倒计时 - getverificationcode = () => { - if (this.state.Phonenumberisnotcobool === false) { - if (this.state.login.length === 0) { - this.setState({ - Phonenumberisnotco: "请输入正确的手机号或邮箱", - }) - return - } else { - this.setState({ - Phonenumberisnotco: "请输入正确的手机号或邮箱", - }) - } - return; - } - if (this.state.getverificationcodes === true) { - this.setState({ - getverificationcodes: undefined, - }) - let timer = setInterval(() => { - this.setState((preState) => ({ - seconds: preState.seconds - 1, - }), () => { - if (this.state.seconds == 0) { - clearInterval(timer); - this.setState({ - getverificationcodes: false, - seconds: 60, - }) - } - }); - }, 1000) - this.SMSverification(); - } else { - this.setState({ - getverificationcodes: undefined, - }) - let timer = setInterval(() => { - this.setState((preState) => ({ - seconds: preState.seconds - 1, - }), () => { - if (this.state.seconds == 0) { - clearInterval(timer); - this.setState({ - getverificationcodes: false, - seconds: 60, - - }) - } - }); - }, 1000) - this.SMSverification(); - } - } - - //短信验证 - SMSverification = () => { - var url = `/accounts/get_verification_code.json`; - axios.get((url), { - params: { - login: this.state.login, - type: 3, - } - }).then((result) => { - //验证有问题{"status":1,"message":"success"} - console.log(result); - - - }).catch((error) => { - console.log(error); - - }) - } - - handleDialogClose() { - this.setState({ - isRenders: false - }) - window.location.href = "/"; - } - - postregistered = () => { - //提交按钮 - if (this.state.Phonenumberisnotcobool === false) { - // if (this.state.login.length === 0) { - // this.setState({ - // Phonenumberisnotco: "请输入手机号或邮箱", - // }) - // console.log("postregistered"); - // console.log("123456"); - // - // return - // } else { - this.setState({ - Phonenumberisnotco: this.state.Phonenumberisnotco, - }) - // console.log("postregistered"); - // console.log("1234567"); - // - // } - return; - } - if(this.state.codes.length===0){ - this.setState({ - Phonenumberisnotcocodes: "请输入验证码", - }) - return; - } - if(this.state.reason.length === 0){ - this.setState({ - Phonenumberisnotcoreason: "请输入推荐人信息或申请理由", - }) - return; - } - - - var url = "/users/trial_apply.json"; - axios.post(url, { - phone: this.state.login, - code: this.state.codes, - reason: this.state.reason, - }).then((result) => { - // console.log(result); - try { - // this.onTabChange("1"); - window.location.href = "/"; - } catch (e) { - - } - }).catch((error) => { - - }) - - - } - inputOnBlur = (e) => { - this.isCorrectname(e.target.value); - // this.Emailphonenumberverification(e.target.value, id); - } - isCorrectname = (value) => { - console.log(value.length); - if (value.length === 0) { - this.setState({ - Phonenumberisnotco: 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(value)) { - stringdata = "手机号格式不正确"; - this.setState({ - Phonenumberisnotco: stringdata, - Phonenumberisnotcobool: false, - }) - } else { - this.setState({ - Phonenumberisnotco: undefined, - Phonenumberisnotcobool: true, - }) - return - } - - if (!regemail.test(value)) { - if ((value.indexOf("@") != -1) === true) { - stringdata = "邮箱格式不正确"; - } else { - stringdata = "手机号格式不正确"; - - } - this.setState({ - Phonenumberisnotco: stringdata, - Phonenumberisnotcobool: false, - }) - - // this.Emailphonenumberverification(value) - return - } else { - this.setState({ - Phonenumberisnotco: undefined, - Phonenumberisnotcobool: true, - }) - return - } - } - //邮箱手机号验证 - Emailphonenumberverification = (value) => { - var url = `/accounts/valid_email_and_phone.json`; - axios.get((url), { - params: { - login: value, - type: 2, - } - }).then((result) => { - //验证有问题{"status":1,"message":"success"} - console.log(result); - - - }).catch((error) => { - console.log(error); - // this.setState({ - // login:"", - // logins:"", - // }) - }) - } - - //执行view - render() { - let {login, codes, reason, isRenders, Phonenumberisnotco, getverificationcodes,Phonenumberisnotcocodes,Phonenumberisnotcoreason, seconds} = this.state; - // console.log("Trialapplication22222222"); - // console.log(this.props); - return ( -
- { - isRenders === false?"": - -
- - - - - -
{ - this.handleDialogClose() - }}> - -
-
-
-
    + } + + + + + +
    { + this.handleDialogClose() + }}> + +
    +
    + +
    +
      试用申请 -
    - -
    -
    - 您尚未获得访问权限,请如实填写下述信息 -
    -
    - 管理员审核批准后,即可继续访问网站 -
    -
    - this.inputOnBlur(e)} - style={{"height": "38px",}} - name="myiphone" - > - { - Phonenumberisnotco && Phonenumberisnotco != "" ? -

    - {Phonenumberisnotco} -

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

    - {Phonenumberisnotcocodes} -

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

    - {Phonenumberisnotcoreason} -

    - :
    - } -
    - - - - -
    -
    - -
    -
- - } -
- - - - ) - - - } + "padding": "20px", + "text-align": "center!important", + "color": "#05101A", + "font-weight": "bold", + "font-size": "17px", + "margin-top": "10px", + }}>试用申请 + + +
+
+ 您尚未获得访问权限,请如实填写下述信息 +
+
+ 管理员审核批准后,即可继续访问网站 +
+ + { + user_phone_binded === true ? "" : +
+ this.inputOnBlur(e)} + style={{"height": "38px",}} + name="myiphone" + > + { + Phonenumberisnotco && Phonenumberisnotco != "" ? +

+ {Phonenumberisnotco} +

+ :
+ } +
+ } + + + { + user_phone_binded === true ? "" : +
+ + + + + { + getverificationcodes === undefined ? + + : getverificationcodes === true ? + + : + + } +
+ } + + + { + Phonenumberisnotcocodes && Phonenumberisnotcocodes != "" ? +

+ {Phonenumberisnotcocodes} +

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

+ {Phonenumberisnotcoreason} +

+ :
+ } +
+ + + + +
+ + +
+ + + + + } + + + + ) + + + } } diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index 3ef02578a..25d290fac 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -18,7 +18,7 @@ import Addcourses from '../courses/coursesPublic/Addcourses'; import LoginDialog from '../login/LoginDialog'; -// import Trialapplication from '../login/Trialapplication' +import Trialapplication from '../login/Trialapplication' import 'antd/lib/modal/style/index.css'; @@ -170,6 +170,7 @@ class NewHeader extends Component { submitapplications:false, isRender:false, isRenders:false, + showTrial:false, user:undefined, } } @@ -512,12 +513,17 @@ submittojoinclass=(value)=>{ } // trialapplications =()=>{ + // console.log("点击了") // this.setState({ // isRenders: true, + // showTrial:true, // }) // } - + // 关闭 + cancelModulationModels = () => { + this.setState({isRenders: false}) + } render() { const isLogin = true; // 这里不会出现未登录的情况,服务端在服务端路由时发现如果是未登录,则跳转到登录页了。 @@ -538,6 +544,7 @@ submittojoinclass=(value)=>{ submitapplicationsvalue, user, isRender, + isRenders, }=this.state; /* 用户名称 用户头像url @@ -574,11 +581,13 @@ submittojoinclass=(value)=>{ /> {/* :""*/} {/*}*/} + {/*{*/} {/* isRenders&&isRenders===true?*/} {/* this.cancelModulationModels()}*/} {/* />*/} {/* :""*/} {/*}*/}