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/common/educoder.js b/public/react/src/common/educoder.js index 263e08808..749d2a1e5 100644 --- a/public/react/src/common/educoder.js +++ b/public/react/src/common/educoder.js @@ -50,3 +50,4 @@ export { default as DMDEditor } from './components/markdown/DMDEditor' +export { default as ImageLayerHook } from './hooks/ImageLayerHook' \ No newline at end of file diff --git a/public/react/src/common/hooks/ImageLayerHook.js b/public/react/src/common/hooks/ImageLayerHook.js new file mode 100644 index 000000000..c9f0a14a4 --- /dev/null +++ b/public/react/src/common/hooks/ImageLayerHook.js @@ -0,0 +1,47 @@ +import React, { useState, useEffect, memo } from 'react' +import ImageLayer from '../../modules/page/layers/ImageLayer' +import { isImageExtension } from 'educoder' +function ImageLayerHook(props) { + const [showImage, setShowImage] = useState(false) + const [imageSrc, setImageSrc] = useState('') + + const { parentSel, childSel, watchPropsArray } = props + + const onImageLayerClose = () => { + setShowImage(false) + setImageSrc('') + } + const onDelegateClick = (event) => { + const imageSrc = event.target.src || event.target.getAttribute('src') || event.target.getAttribute('href') + // 判断imageSrc是否是图片 + const fileName = event.target.innerHTML.trim() + if (isImageExtension(imageSrc.trim()) || isImageExtension(fileName) || event.target.tagName == 'IMG' || imageSrc.indexOf('base64,') != -1) { + // 非回复里的头像图片; 非emoticons + if (imageSrc.indexOf('/images/avatars/User') === -1 && + imageSrc.indexOf('kindeditor/plugins/emoticons') === -1 ) { + setShowImage(true) + setImageSrc(imageSrc) + } + event.stopPropagation() + event.preventDefault && event.preventDefault() + event.originalEvent.preventDefault() + // event.originalEvent.stopPropagation() + // event.originalEvent.cancelBubble = true + return false; + } + } + useEffect(() => { + $(parentSel) + .delegate(childSel, "click", onDelegateClick); + + return () => { + $(parentSel).undelegate(childSel, "click", onDelegateClick ) + } + }) + + return ( + + ) +} + +export default memo(ImageLayerHook) \ No newline at end of file diff --git a/public/react/src/context/TPIContextProvider.js b/public/react/src/context/TPIContextProvider.js index 10e9c07e2..449f79a7a 100644 --- a/public/react/src/context/TPIContextProvider.js +++ b/public/react/src/context/TPIContextProvider.js @@ -424,7 +424,7 @@ pop_box_new(htmlvalue, 480, 182); */ let user = resData.user; user.username = resData.user.name; - user.user_url = `/user/${resData.user.login}`; + user.user_url = `/users/${resData.user.login}`; // user.image_url = resData.image_url; user.is_teacher = resData.is_teacher; resData.user = user; diff --git a/public/react/src/modules/courses/members/modal/CourseGroupChooserModal.js b/public/react/src/modules/courses/members/modal/CourseGroupChooserModal.js index dc3044cc0..3f4f1a0ca 100644 --- a/public/react/src/modules/courses/members/modal/CourseGroupChooserModal.js +++ b/public/react/src/modules/courses/members/modal/CourseGroupChooserModal.js @@ -1,4 +1,4 @@ -import React, { useState, useEffect, useRef, memo } from 'react' +import React, { useState, useEffect, useRef, useMemo } from 'react' import { trigger } from 'educoder' import { Input, Checkbox } from "antd"; import CourseGroupChooser from '../CourseGroupChooser' @@ -105,4 +105,4 @@ function CourseGroupChooserModal({ course_groups = [], isAdminOrCreator, item, i ) } -export default memo(CourseGroupChooserModal) \ No newline at end of file +export default useMemo(CourseGroupChooserModal) \ No newline at end of file diff --git a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js index 1ba8c85b7..f31cb954d 100644 --- a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js +++ b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js @@ -1411,7 +1411,7 @@ class Listofworksstudentone extends Component { // } this.setState({ page: e.current, - teacherlists: teacherlists + // teacherlists: teacherlists }) } diff --git a/public/react/src/modules/login/Trialapplication.js b/public/react/src/modules/login/Trialapplication.js index 7900a68bb..02116ce7d 100644 --- a/public/react/src/modules/login/Trialapplication.js +++ b/public/react/src/modules/login/Trialapplication.js @@ -33,6 +33,8 @@ class Trialapplication extends Component { user_phone_binded: props.user_phone_binded, showTrial: false, user: undefined, + borredss:"bor-reds", + borredssz:"bor-reds fl mr5", } //user_phone_binded 判断是否手机号验证 // console.log("Trialapplication"); @@ -371,7 +373,7 @@ class Trialapplication extends Component { //执行view render() { - let {login, codes, reason, isRenders, user_phone_binded, Phonenumberisnotco, getverificationcodes, Phonenumberisnotcocodes, Phonenumberisnotcoreason, seconds} = this.state; + let {login, codes, reason, isRenders, user_phone_binded,borredss,borredssz, Phonenumberisnotco, getverificationcodes, Phonenumberisnotcocodes, Phonenumberisnotcoreason, seconds} = this.state; // console.log("Trialapplication22222222"); // console.log(this.props); @@ -600,12 +602,13 @@ class Trialapplication extends Component { onChange={this.loginInputonChange} onBlur={(e) => this.inputOnBlur(e)} style={{"height": "38px",}} + className={Phonenumberisnotco && Phonenumberisnotco !== ""?borredss:""} name="myiphone" > { Phonenumberisnotco && Phonenumberisnotco != "" ? -

- {Phonenumberisnotco} +

+ {Phonenumberisnotco}

:
} @@ -617,7 +620,9 @@ class Trialapplication extends Component { user_phone_binded === true ? "" :
- this.getverificationcode()} - size={"large"}>验证码 + size={"large"}>获取验证码 : diff --git a/public/react/src/modules/page/main/CodeEvaluateView.css b/public/react/src/modules/page/main/CodeEvaluateView.css index bd0427d7b..137174d95 100644 --- a/public/react/src/modules/page/main/CodeEvaluateView.css +++ b/public/react/src/modules/page/main/CodeEvaluateView.css @@ -126,4 +126,5 @@ display: inline-block; height: 10px; margin: 5px 0; + float: right; } \ No newline at end of file diff --git a/public/react/src/modules/page/main/CodeEvaluateView.js b/public/react/src/modules/page/main/CodeEvaluateView.js index 48bb0b245..8be0b8765 100644 --- a/public/react/src/modules/page/main/CodeEvaluateView.js +++ b/public/react/src/modules/page/main/CodeEvaluateView.js @@ -184,8 +184,8 @@ class CodeEvaluateView extends Component { { headIconClass && } { _headLockIconClass && } - { item.ts_memo && 消耗内存{item.ts_memo}MB } - { item.ts_memo && item.ts_time && } + { item.ts_mem && 消耗内存{item.ts_mem}MB } + { item.ts_mem && item.ts_time && } { item.ts_time && 代码执行时长:{item.ts_time}秒 }

diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index c31d5d466..15360f6ec 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -169,8 +169,8 @@ class NewHeader extends Component { RadioGroupvalue:undefined, submitapplications:false, isRender:false, - isRenders:false, - showTrial:false, + // isRenders:false, + // showTrial:false, } // console.log("176") // console.log(props); @@ -547,13 +547,13 @@ submittojoinclass=(value)=>{ } } - trialapplications =()=>{ - console.log("点击了") - this.setState({ - isRenders: true, - showTrial:true, - }) - } + // trialapplications =()=>{ + // console.log("点击了") + // this.setState({ + // isRenders: true, + // showTrial:true, + // }) + // } // 关闭 cancelModulationModels = () => { @@ -617,14 +617,15 @@ submittojoinclass=(value)=>{ /> {/* :""*/} {/*}*/} - { - isRenders&&isRenders===true? - this.cancelModulationModels()} - /> - :"" - } + + {/*{*/} + {/* isRenders&&isRenders===true?*/} + {/* this.cancelModulationModels()}*/} + {/* />*/} + {/* :""*/} + {/*}*/} this.cancelModulationModels()} >
{/*<%= link_to image_tag("/images/educoder/logo.png", alt:"高校智能化教学与实训平台", className:"logoimg"), home_path %>*/} @@ -756,7 +757,7 @@ submittojoinclass=(value)=>{
  • 我的项目
  • 账号管理
  • {/*
  • this.educoderlogin()} >登入测试接口
  • */} -
  • this.trialapplications()} >试用申请
  • + {/*
  • this.trialapplications()} >试用申请
  • */} {/*
  • 兴趣页
  • */}
  • 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/modules/user/modal/ApplyForAddOrgModal.js b/public/react/src/modules/user/modal/ApplyForAddOrgModal.js index 76664bfec..95cfa9105 100644 --- a/public/react/src/modules/user/modal/ApplyForAddOrgModal.js +++ b/public/react/src/modules/user/modal/ApplyForAddOrgModal.js @@ -40,7 +40,7 @@ class ApplyForAddOrgModal extends Component{ if(!err){ let url=`/add_school_applies.json`; axios.post(url,{ - schoolName:values.schoolName, + name:values.schoolName, province:values.city && values.city[0], city:values.city && values.city[1], address:values.address, diff --git a/public/react/src/modules/user/modal/RealNameCertificationModal.js b/public/react/src/modules/user/modal/RealNameCertificationModal.js index ccb301a32..6c92423cd 100644 --- a/public/react/src/modules/user/modal/RealNameCertificationModal.js +++ b/public/react/src/modules/user/modal/RealNameCertificationModal.js @@ -2,7 +2,7 @@ import React, { Component } from "react"; import { message, Icon, Input, Form, Upload} from "antd"; import axios from 'axios' import ModalWrapper from "../../courses/common/ModalWrapper" -import { City, getUploadActionUrl,getImageUrl } from 'educoder' +import { City, getUploadActionUrl, getImageUrl, ImageLayerHook } from 'educoder' import '../account/common.css' import authImg from '../../../images/account/auth.png' @@ -201,7 +201,11 @@ class RealNameCertificationModal extends Component{ } .applyForModal .ant-form-item-label label { color: #979797 + } + .applyForModal .ant-upload.ant-upload-drag .ant-upload { + padding: 0px; } + .certificationModal .ant-modal-body{ padding:20px; } @@ -295,9 +299,9 @@ class RealNameCertificationModal extends Component{ {imageUrl2 ? - + // avatar - : + :

    @@ -311,7 +315,9 @@ class RealNameCertificationModal extends Component{

    示例图片 - 查看大图 + + 查看大图
    diff --git a/public/react/src/search/SearchPage.js b/public/react/src/search/SearchPage.js new file mode 100644 index 000000000..14966b670 --- /dev/null +++ b/public/react/src/search/SearchPage.js @@ -0,0 +1,219 @@ +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,markdownToHTML,getImageUrl} 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, + keywords:"python", + type:"", + page:1, + perpages:20, + data:[], + } + } + //切换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, + // }) + this.getdata(this.state.page); + + } + setdatafuns =(value)=>{ + + } + paginationonChanges = (pageNumber) => { + this.setState({ + page: pageNumber, + loadingstate: true, + }) + this.getdata(pageNumber); + } + //获取数据 + getdata=(pages)=>{ + let url = "/search.json"; + axios.get(url,{params:{ + keyword:this.state.keywords, + type:this.state.types, + page:pages, + per_page:this.state.perpages, + } + }).then((response) => { + if(response === undefined){ + + return + } + console.log("63"); + console.log(response.data); + this.setState({ + count:response.data.count, + data:response.data.results, + }) + }).catch((error) => { + console.log("56"); + console.log(error); + }); + } + + render(){ + let {tab,count,data,page,perpages}=this.state; + console.log(tab); + return( +
    +
    +
    + 搜索} + onSearch={ (value)=>this.setdatafuns(value)} /> +
    + +
    +
    + + 开发社区 + 实践课程 + 翻转课堂 + 交流问答 + +
    +
    + { + JSON.stringify(data) === "[]" ? + +
    +
    +
    + +

    没有数据可以显示!

    +
    +
    + +
    + : +
    +
    +

    共找到相关结果{count}

    +
    + +
    + +
    + {data === undefined ? "" : data.map((item, key) => { + return ( +
    + +
    + {/*标题*/} + + {/*描述*/} +
    + {item.content.content === undefined || item.content.content===0?"": item.content.content.map((item4, key4) => { + return ( + + ) + }) + } +
    + +
    + {/*内容*/} + {item.content.description === undefined || item.content.description===0?"": item.content.description.map((item3, key3) => { + return ( + + ) + }) + } +
    + +
    + +
    + {/*挑战名字*/} + {item.content.challenge_names === undefined || item.content.challenge_names===0?"": item.content.challenge_names.map((item5, key5) => { + return ( + + ) + }) + } +
    + +
    + {/*挑战标签*/} + {item.content.challenge_tag_names === undefined || item.content.challenge_tag_names===0?"": item.content.challenge_tag_names.map((item6, key6) => { + return ( + 1?"markdown-body tzbq ":"markdown-body tzbqx"} + dangerouslySetInnerHTML={{__html:item6}} /> + ) + }) + } +
    + + + + +
    +
    + ) + })} + + +
    + + + + +
    + +
    + +
    +
    + } + + + { + count && count && count> perpages ? +
    + +
    + : "" + } + +
    + + ) + } +} + +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..a3e9fafbd --- /dev/null +++ b/public/react/src/search/searchc.css @@ -0,0 +1,117 @@ +.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{ + height: 62px !important; + box-shadow: 3px 10px 21px 0px rgba(76, 76, 76, 0.15); + border-radius: 6px; + background: #fff; + display: flex; + justify-content: center; +} +.tabtitles2{ + background: #fff; + height: 62px !important; + width: 1200px; +} + +.tabtitless{ + height: 62px !important; + line-height: 62px !important; + +} +.tabtitle1{ + +} +.tabtitle2{ + margin-left: 30px !important; + +} + + +.counttit{ + display: flex; + justify-content: center; +} + +.counttittext{ + text-align: left; + width: 1200px; + height: 18px; + color: #888888; + font-size: 13px; + margin-top: 24px; + + +} +.counttittexts{ + color: #4CACFF !important; + font-size: 13px; +} + +.mainx{ + display: flex; + justify-content: center; + margin-top: 17px; +} +.project-packages-list{ + +} +.project-package-item{ + display: -webkit-flex; + display: flex; + flex-direction:column; + margin-bottom: 20px; + padding: 20px; + background: white; + /* box-shadow: 1px 3px 3px 1px rgba(156,156,156,0.16); */ + +} +.xuxianpro{ + height: 20px; + border-bottom: 1px dashed; + border-color: #EAEAEA; + margin-bottom: 18px; +} +.magr11{ + margin-top: 11px; +} +.highlight{ + color: #4CACFF; +} +.fonttext{ + font-size: 20px; + font-weight:bold; +} + +.fontextcolor{ + color: #777777; +} +.tzbq{ + margin-left: 68px; +} +.tzbqx{ + margin-left: 24px; +} \ No newline at end of file