From 3af911654eeb4daf33d09f7b5052c33d2fa4c5d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Thu, 4 Jul 2019 15:44:14 +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 --- .../courses/coursesPublic/PathModal.js | 6 +- .../courses/shixunHomework/shixunHomework.js | 2 +- public/react/src/modules/home/shixunsHome.js | 2 +- public/react/src/modules/paths/PathNew.js | 26 +- public/react/src/modules/tpm/NewHeader.js | 4 +- .../modules/tpm/component/TPMRightSection.js | 410 ++++----- .../react/src/modules/user/usersInfo/Infos.js | 780 +++++++++--------- .../src/modules/user/usersInfo/InfosPath.js | 392 ++++----- 8 files changed, 811 insertions(+), 811 deletions(-) diff --git a/public/react/src/modules/courses/coursesPublic/PathModal.js b/public/react/src/modules/courses/coursesPublic/PathModal.js index 0b69fa15d..fc6747e08 100644 --- a/public/react/src/modules/courses/coursesPublic/PathModal.js +++ b/public/react/src/modules/courses/coursesPublic/PathModal.js @@ -75,13 +75,13 @@ class PathModal extends Component{ if(patheditarry===undefined){ this.setState({ patheditarrytype:true, - patheditarryvalue:"请先选择实训课程" + patheditarryvalue:"请先选择实践课程" }) return }else if(patheditarry.length===0){ this.setState({ patheditarrytype:true, - patheditarryvalue:"请先选择实训课程" + patheditarryvalue:"请先选择实践课程" }) return } @@ -137,7 +137,7 @@ class PathModal extends Component{ />:""} this.editname(datas&&datas.main_category_name)} className={"mr30"}>目录重命名*/} : this.editDir(datas&&datas.category_name)} className={"mr30 font-16"}>目录重命名:""} - {this.props.isAdmin()===true?datas&&datas.category_name===undefined||datas&&datas.category_name===null?选用实训课程:"":""} + {this.props.isAdmin()===true?datas&&datas.category_name===undefined||datas&&datas.category_name===null?选用实践课程:"":""} {this.props.isAdmin()===true?this.createCommonWork()}>选用实训:""}

diff --git a/public/react/src/modules/home/shixunsHome.js b/public/react/src/modules/home/shixunsHome.js index 9ef26f7a8..9093ec22d 100644 --- a/public/react/src/modules/home/shixunsHome.js +++ b/public/react/src/modules/home/shixunsHome.js @@ -189,7 +189,7 @@ class ShixunsHome extends Component { {/*实训路径*/}
-

实训课程

+

实践课程

TRAINING COURSE

更多 diff --git a/public/react/src/modules/paths/PathNew.js b/public/react/src/modules/paths/PathNew.js index 89adbc233..0575fc817 100644 --- a/public/react/src/modules/paths/PathNew.js +++ b/public/react/src/modules/paths/PathNew.js @@ -94,7 +94,7 @@ class PathNew extends Component{ submitNewPath=()=>{ let {pathName} = this.state; if(pathName===""){ - this.props.showSnackbar("请输入实训课程名称"); + this.props.showSnackbar("请输入实践课程名称"); window.location.href="#part_Name"; this.setState({ flag_name:false @@ -103,23 +103,23 @@ class PathNew extends Component{ } let des=this.Des_editMD.getValue(); if(des===""){ - this.props.showSnackbar("请输入实训课程的简介"); + this.props.showSnackbar("请输入实践课程的简介"); window.location.href="#part_Des"; return; } if (des.length > 5000) { - this.props.showSnackbar("实训课程的简介最大限制5000个字符"); + this.props.showSnackbar("实践课程的简介最大限制5000个字符"); window.location.href="#part_Des"; return; } let point = this.Point_editMD.getValue(); if(point===""){ - this.props.showSnackbar("请输入实训课程的学习须知"); + this.props.showSnackbar("请输入实践课程的学习须知"); window.location.href="#part_point"; return; } if(point.length > 500){ - this.props.showSnackbar("实训课程的学习须知最大限制500个字符"); + this.props.showSnackbar("实践课程的学习须知最大限制500个字符"); window.location.href="#part_point"; return; } @@ -177,10 +177,10 @@ class PathNew extends Component{ }) const Des_editMD = create_editorMD("shixun_introduction","100%","490px" - ,"请在此输入实训课程的简介,最大限制5000个字符","/api/attachments.json", response.data.description,""); + ,"请在此输入实践课程的简介,最大限制5000个字符","/api/attachments.json", response.data.description,""); this.Des_editMD=Des_editMD; const Point_editMD = create_editorMD("shixun_propaedeutics","100%","260px" - ,"请在此输入实训课程的学习须知,最大限制500个字符","/api/attachments.json",response.data.learning_notes,""); + ,"请在此输入实践课程的学习须知,最大限制500个字符","/api/attachments.json",response.data.learning_notes,""); this.Point_editMD=Point_editMD; } }).catch((error)=>{ @@ -189,9 +189,9 @@ class PathNew extends Component{ } else { this.isEditPage = false - const Des_editMD = create_editorMD("shixun_introduction","100%","490px","请在此输入实训课程的简介,最大限制5000个字符","/api/attachments.json","",""); + const Des_editMD = create_editorMD("shixun_introduction","100%","490px","请在此输入实践课程的简介,最大限制5000个字符","/api/attachments.json","",""); this.Des_editMD=Des_editMD; - const Point_editMD = create_editorMD("shixun_propaedeutics","100%","260px","请在此输入实训课程的学习须知,最大限制500个字符","/api/attachments.json","",""); + const Point_editMD = create_editorMD("shixun_propaedeutics","100%","260px","请在此输入实践课程的学习须知,最大限制500个字符","/api/attachments.json","",""); this.Point_editMD=Point_editMD; } @@ -210,9 +210,9 @@ class PathNew extends Component{
-

创建实训课程

+

创建实践课程

-

实训课程名称

+

实践课程名称

*
@@ -233,7 +233,7 @@ class PathNew extends Component{ *
- +

@@ -247,7 +247,7 @@ class PathNew extends Component{ *
- +

diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index c5b72946e..bf8271940 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -751,7 +751,7 @@ submittojoinclass=(value)=>{
  • 我的课堂
  • {/* p 老师 l 学生 */}
  • 我的实训
  • -
  • 我的实训课程
  • +
  • 我的实践课程
  • 我的项目
  • 账号管理
  • {/*
  • this.educoderlogin()} >登入测试接口
  • */} @@ -788,7 +788,7 @@ submittojoinclass=(value)=>{
      diff --git a/public/react/src/modules/tpm/component/TPMRightSection.js b/public/react/src/modules/tpm/component/TPMRightSection.js index bfc1fb0e4..28c49333a 100644 --- a/public/react/src/modules/tpm/component/TPMRightSection.js +++ b/public/react/src/modules/tpm/component/TPMRightSection.js @@ -1,205 +1,205 @@ -import React, { Component } from 'react'; - -import { BrowserRouter as Router, Route, Link } from "react-router-dom"; - -import axios from 'axios'; - -import { getImageUrl,} from "educoder"; - -import './TPMright.css'; - -import {Icon,Tooltip} from 'antd'; - -// import "antd/dist/antd.css"; - -class TPMRightSection extends Component { - constructor(props) { - super(props) - this.state = { - - TPMRightSection:false, - clickNewsubscripttype:false - } - } - - // componentDidMount() { - // let id=this.props.match.params.shixunId; - // - // let shixunsDetailsURL=`/shixuns/`+id+`/show_right.json`; - // - // axios.get(shixunsDetailsURL).then((response)=> { - // if(response.status===200){ - // this.setState({ - // TPMRightSectionData: response.data - // }); - // } - // }).catch((error)=>{ - // console.log(error) - // }); - // } - - // shouldComponentUpdate(nextProps, nextState) { - // return nextProps.TPMRightSectionData !== this.state.TPMRightSectionData - // } - clickNewsubscript=(val)=>{ - if(val===0){ - this.setState({ - TPMRightSection:true, - clickNewsubscripttype:true - }) - }else{ - this.setState({ - TPMRightSection:false, - clickNewsubscripttype:false - }) - } - - } - render() { - let {TPMRightSection,clickNewsubscripttype}=this.state; - let {TPMRightSectionData}=this.props - - return ( -
      - { - TPMRightSectionData===undefined?"": -
      -
      -

      创建者

      -
      - - 头像 - -
      - -

      {TPMRightSectionData===undefined?"":TPMRightSectionData.creator===undefined?"":TPMRightSectionData.creator.name}

      -
      - 发布 {TPMRightSectionData.user_shixuns_count} - {/*粉丝 {TPMRightSectionData.fans_count}*/} - {/* 取消关注 */} -
      - -
      -
      -
      - { - TPMRightSectionData === undefined ? "" :TPMRightSectionData.tags===undefined?"": TPMRightSectionData.tags.length === 0 ? "" : -
      -

      技能标签 {TPMRightSectionData.tags.length}

      -
      -
      - { TPMRightSectionData.tags.map((item,key)=>{ - return( - {item.tag_name} - )}) - } -
      -
      - - -
      15&&clickNewsubscripttype===false?"newsubscript mb9 color-grey-9":"newsubscript mb9 color-grey-9 none"} - - data-tip-down="显示全部" - onClick={()=>this.clickNewsubscript(0)}>... -
      - - -
      this.clickNewsubscript(1)}> -
      - -
      - - - } - -
      -

      推荐实训

      -
      - { - TPMRightSectionData===undefined?"":TPMRightSectionData.recommands===undefined?"":TPMRightSectionData.recommands.map((item,key)=>{ - return( -
      - - 69?1526971094 - -
      - - {item.name} - -

      - {item.stu_num} 人学习 -

      -

      {item.level}

      -
      -
      - ) - }) - } -
      -
      - -
      -

      相关实训课程

      -
      - { - TPMRightSectionData===undefined?"":TPMRightSectionData.paths===undefined?"":TPMRightSectionData.paths.map((i,k)=>{ - - return( - -
      - - - 实训 - - -
      - {i.name} -

      - - - {i.stages_count} - - - {/**/} - {/*{i.score_count}*/} - {/**/} - - - {i.members_count} - - -

      -
      - -
      - - ) - }) - } -
      -
      - - - -
      - } -
      - ) - - - } -} - -export default TPMRightSection; +import React, { Component } from 'react'; + +import { BrowserRouter as Router, Route, Link } from "react-router-dom"; + +import axios from 'axios'; + +import { getImageUrl,} from "educoder"; + +import './TPMright.css'; + +import {Icon,Tooltip} from 'antd'; + +// import "antd/dist/antd.css"; + +class TPMRightSection extends Component { + constructor(props) { + super(props) + this.state = { + + TPMRightSection:false, + clickNewsubscripttype:false + } + } + + // componentDidMount() { + // let id=this.props.match.params.shixunId; + // + // let shixunsDetailsURL=`/shixuns/`+id+`/show_right.json`; + // + // axios.get(shixunsDetailsURL).then((response)=> { + // if(response.status===200){ + // this.setState({ + // TPMRightSectionData: response.data + // }); + // } + // }).catch((error)=>{ + // console.log(error) + // }); + // } + + // shouldComponentUpdate(nextProps, nextState) { + // return nextProps.TPMRightSectionData !== this.state.TPMRightSectionData + // } + clickNewsubscript=(val)=>{ + if(val===0){ + this.setState({ + TPMRightSection:true, + clickNewsubscripttype:true + }) + }else{ + this.setState({ + TPMRightSection:false, + clickNewsubscripttype:false + }) + } + + } + render() { + let {TPMRightSection,clickNewsubscripttype}=this.state; + let {TPMRightSectionData}=this.props + + return ( +
      + { + TPMRightSectionData===undefined?"": +
      +
      +

      创建者

      +
      + + 头像 + +
      + +

      {TPMRightSectionData===undefined?"":TPMRightSectionData.creator===undefined?"":TPMRightSectionData.creator.name}

      +
      + 发布 {TPMRightSectionData.user_shixuns_count} + {/*粉丝 {TPMRightSectionData.fans_count}*/} + {/* 取消关注 */} +
      + +
      +
      +
      + { + TPMRightSectionData === undefined ? "" :TPMRightSectionData.tags===undefined?"": TPMRightSectionData.tags.length === 0 ? "" : +
      +

      技能标签 {TPMRightSectionData.tags.length}

      +
      +
      + { TPMRightSectionData.tags.map((item,key)=>{ + return( + {item.tag_name} + )}) + } +
      +
      + + +
      15&&clickNewsubscripttype===false?"newsubscript mb9 color-grey-9":"newsubscript mb9 color-grey-9 none"} + + data-tip-down="显示全部" + onClick={()=>this.clickNewsubscript(0)}>... +
      + + +
      this.clickNewsubscript(1)}> +
      + +
      + + + } + +
      +

      推荐实训

      +
      + { + TPMRightSectionData===undefined?"":TPMRightSectionData.recommands===undefined?"":TPMRightSectionData.recommands.map((item,key)=>{ + return( +
      + + 69?1526971094 + +
      + + {item.name} + +

      + {item.stu_num} 人学习 +

      +

      {item.level}

      +
      +
      + ) + }) + } +
      +
      + +
      +

      相关实践课程

      +
      + { + TPMRightSectionData===undefined?"":TPMRightSectionData.paths===undefined?"":TPMRightSectionData.paths.map((i,k)=>{ + + return( + +
      + + + 实训 + + +
      + {i.name} +

      + + + {i.stages_count} + + + {/**/} + {/*{i.score_count}*/} + {/**/} + + + {i.members_count} + + +

      +
      + +
      + + ) + }) + } +
      +
      + + + +
      + } +
      + ) + + + } +} + +export default TPMRightSection; diff --git a/public/react/src/modules/user/usersInfo/Infos.js b/public/react/src/modules/user/usersInfo/Infos.js index 58c0b3c4e..9c8abcde1 100644 --- a/public/react/src/modules/user/usersInfo/Infos.js +++ b/public/react/src/modules/user/usersInfo/Infos.js @@ -1,391 +1,391 @@ -import React, { Component } from 'react'; -import { SnackbarHOC } from 'educoder'; -import {Link} from 'react-router-dom'; -import {Tooltip,Menu} from 'antd'; -import Loadable from 'react-loadable'; -import Loading from '../../../Loading'; -import {BrowserRouter as Router,Route,Switch} from 'react-router-dom'; - -import axios from 'axios'; -import {getImageUrl} from 'educoder'; -import { TPMIndexHOC } from '../../tpm/TPMIndexHOC'; -import { CNotificationHOC } from '../../courses/common/CNotificationHOC' -import "./usersInfo.css" -import "../../courses/css/members.css" -import "../../courses/css/Courses.css" -import update from 'immutability-helper' - -import Trialapplication from '../../login/Trialapplication' - -const InfosCourse = Loadable({ - loader: () => import('./InfosCourse'), - loading:Loading, -}) -const InfosShixun = Loadable({ - loader: () => import('./InfosShixun'), - loading:Loading, -}) -const InfosPath = Loadable({ - loader: () => import('./InfosPath'), - loading:Loading, -}) -const InfosProject = Loadable({ - loader: () => import('./InfosProject'), - loading:Loading, -}) - -const $ = window.$; -class Infos extends Component{ - constructor(props){ - super(props); - this.state={ - data:undefined, - is_current:true, - is_edit:false, - sign:undefined, - type:0, - login:undefined, - isRenders:false, - moduleName:"courses", - next_gold:undefined - } - } - componentDidMount =()=>{ - this.getInfo(this.props.match.params.username); - } - //判断是否看的是当前用户的个人主页 - componentDidUpdate =(prevProps)=> { - if(this.props.current_user && prevProps.current_user != this.props.current_user){ - console.log(this.props); - if(this.props.current_user.login != this.props.match.params.username){ - this.setState({ - is_current:false, - login:this.props.current_user.login - }) - } - } - } - - - //获取个人主页信息 - getInfo = (user_login) =>{ - let url =`/users/${user_login}/homepage_info.json`; - axios.get(url).then((result)=>{ - if(result){ - this.setState({ - data:result.data, - followed:result.data.followed, - sign:result.data.brief_introduction, - id:result.data.id, - next_gold:result.data.tomorrow_attendance_gold - }) - } - }).catch((error)=>{ - console.log(error); - }) - } - - // 编辑签名 - editmysign=()=>{ - this.setState({ - is_edit:true - },()=>{ - $("#mysign").focus(); - }) - } - // 输入签名 - inputSign=(e)=>{ - this.setState({ - sign:e.target.value - }) - } - //取消编辑签名 - savemysign=()=>{ - let { sign } =this.state; - let url=`/users/brief_introduction.json`; - axios.post((url),{ - content:sign - }).then((result)=>{ - if(result){ - this.setState({ - is_edit:false - }) - } - }).catch((error)=>{ - console.log(error) - }) - - } - changeType=(e)=>{ - this.setState({ - type:e.key - }) - } - turnTo=(url)=>{ - this.props.history.push(url); - } - - //签到 - signFor=()=>{ - let url=`/users/attendance.json` - axios.post(url).then((result)=>{ - if(result){ - // this.setState( - // (prevState) => ({ - // data : update(prevState.data, {attendance_signed: {$set: true} }) - // }) - // ) - // this.setState({ - // next_gold:result.data.next_gold - // }) - this.getInfo(this.props.match.params.username); - } - }).catch((error)=>{ - console.log(error); - }) - } - - // 关注 - followPerson=()=>{ - let{followed,id}=this.state; - let url=`/users/${id}/watch.json`; - // 取消关注 - if(followed){ - axios.delete(url).then((result)=>{ - if(result){ - this.setState({ - followed:false - }) - } - }).catch((error)=>{ - console.log(error) - }) - }else{ - // 关注 - axios.post(url).then((result)=>{ - if(result){ - this.setState({ - followed:true - }) - } - }).catch((error)=>{ - console.log(error); - }) - } - } - - // 试用申请 - trialapplications =()=>{ - this.setState({ - isRenders: true, - showTrial:true - }) - } - cancelModulationModels=()=>{ - this.setState({ - isRenders: false - }) - } - ToBank=(url)=>{ - window.location.href=url; - } - - render(){ - let { - data , - is_current, - is_edit, - sign, - type, - followed, - id, - login, - isRenders, - moduleName, - next_gold - }=this.state; - let {username}= this.props.match.params; - - let {pathname}=this.props.location; - moduleName=pathname.split("/")[3]; - return( -
      - { - isRenders && this.cancelModulationModels()}/> - } -
      -
      -
      -
      -
      -
      -
      - {is_current ? "我":"TA"}的经验值 - {data && data.experience} -
      - -
      - {is_current ? "我":"TA"}的金币 - {data && data.grade} -
      -
      - 头像 -
      -
      - {is_current ? "我":"TA"}的粉丝 - {data && data.fan_count} -
      - -
      - {is_current ? "我":"TA"}的关注 - {data && data.follow_count} -
      - - {data && data.name} -
      -
      -
      -
      - { - data && is_current == false && data.identity =="学生" ? "" : {data && data.identity} - } - - - - - - - - - - - - - - - - - - - - - {/* */} - { - data && data.college_identifier && - - - - - - } -
      -
      -
      -

      - { - is_edit && is_current ? - - : - is_current ? - {sign || "这家伙很懒,什么都没留下~"} - : - {sign || "这家伙很懒,什么都没留下~"} - } -

      - { - is_current ? -
      - { - data && data.can_apply_trial == false ? - data.attendance_signed ? - - 已签到 -

      明日签到 +{next_gold} 金币

      -
      - : - 签到 - : - 试用申请 - } -
      - : - - } -
      -
      -
      -
    • - this.setState({moduleName: 'courses'})} - to={`/users/${username}/courses`}>课堂 -
    • -
    • - this.setState({moduleName: 'shixuns'})} - to={`/users/${username}/shixuns`}>实训 -
    • -
    • - this.setState({moduleName: 'paths'})} - to={`/users/${username}/paths`}>实训课程 -
    • -
    • - this.setState({moduleName: 'projects'})} - to={`/users/${username}/projects`}>项目 -
    • - - { data && data.identity!="学生" &&
    • 题库
    • } - -
      -
      -
      -
      -
      - - - {/* --------------------------------------------------------------------- */} - - {/* 课堂 */} - {/* http://localhost:3007/courses/1309/homework/9300/setting */} - () - } - > - - {/* 实训 */} - () - } - > - - {/* 实训课程 */} - () - } - > - - {/* 项目 */} - () - } - > - () - } - > - - -
      - ) - } -} +import React, { Component } from 'react'; +import { SnackbarHOC } from 'educoder'; +import {Link} from 'react-router-dom'; +import {Tooltip,Menu} from 'antd'; +import Loadable from 'react-loadable'; +import Loading from '../../../Loading'; +import {BrowserRouter as Router,Route,Switch} from 'react-router-dom'; + +import axios from 'axios'; +import {getImageUrl} from 'educoder'; +import { TPMIndexHOC } from '../../tpm/TPMIndexHOC'; +import { CNotificationHOC } from '../../courses/common/CNotificationHOC' +import "./usersInfo.css" +import "../../courses/css/members.css" +import "../../courses/css/Courses.css" +import update from 'immutability-helper' + +import Trialapplication from '../../login/Trialapplication' + +const InfosCourse = Loadable({ + loader: () => import('./InfosCourse'), + loading:Loading, +}) +const InfosShixun = Loadable({ + loader: () => import('./InfosShixun'), + loading:Loading, +}) +const InfosPath = Loadable({ + loader: () => import('./InfosPath'), + loading:Loading, +}) +const InfosProject = Loadable({ + loader: () => import('./InfosProject'), + loading:Loading, +}) + +const $ = window.$; +class Infos extends Component{ + constructor(props){ + super(props); + this.state={ + data:undefined, + is_current:true, + is_edit:false, + sign:undefined, + type:0, + login:undefined, + isRenders:false, + moduleName:"courses", + next_gold:undefined + } + } + componentDidMount =()=>{ + this.getInfo(this.props.match.params.username); + } + //判断是否看的是当前用户的个人主页 + componentDidUpdate =(prevProps)=> { + if(this.props.current_user && prevProps.current_user != this.props.current_user){ + console.log(this.props); + if(this.props.current_user.login != this.props.match.params.username){ + this.setState({ + is_current:false, + login:this.props.current_user.login + }) + } + } + } + + + //获取个人主页信息 + getInfo = (user_login) =>{ + let url =`/users/${user_login}/homepage_info.json`; + axios.get(url).then((result)=>{ + if(result){ + this.setState({ + data:result.data, + followed:result.data.followed, + sign:result.data.brief_introduction, + id:result.data.id, + next_gold:result.data.tomorrow_attendance_gold + }) + } + }).catch((error)=>{ + console.log(error); + }) + } + + // 编辑签名 + editmysign=()=>{ + this.setState({ + is_edit:true + },()=>{ + $("#mysign").focus(); + }) + } + // 输入签名 + inputSign=(e)=>{ + this.setState({ + sign:e.target.value + }) + } + //取消编辑签名 + savemysign=()=>{ + let { sign } =this.state; + let url=`/users/brief_introduction.json`; + axios.post((url),{ + content:sign + }).then((result)=>{ + if(result){ + this.setState({ + is_edit:false + }) + } + }).catch((error)=>{ + console.log(error) + }) + + } + changeType=(e)=>{ + this.setState({ + type:e.key + }) + } + turnTo=(url)=>{ + this.props.history.push(url); + } + + //签到 + signFor=()=>{ + let url=`/users/attendance.json` + axios.post(url).then((result)=>{ + if(result){ + // this.setState( + // (prevState) => ({ + // data : update(prevState.data, {attendance_signed: {$set: true} }) + // }) + // ) + // this.setState({ + // next_gold:result.data.next_gold + // }) + this.getInfo(this.props.match.params.username); + } + }).catch((error)=>{ + console.log(error); + }) + } + + // 关注 + followPerson=()=>{ + let{followed,id}=this.state; + let url=`/users/${id}/watch.json`; + // 取消关注 + if(followed){ + axios.delete(url).then((result)=>{ + if(result){ + this.setState({ + followed:false + }) + } + }).catch((error)=>{ + console.log(error) + }) + }else{ + // 关注 + axios.post(url).then((result)=>{ + if(result){ + this.setState({ + followed:true + }) + } + }).catch((error)=>{ + console.log(error); + }) + } + } + + // 试用申请 + trialapplications =()=>{ + this.setState({ + isRenders: true, + showTrial:true + }) + } + cancelModulationModels=()=>{ + this.setState({ + isRenders: false + }) + } + ToBank=(url)=>{ + window.location.href=url; + } + + render(){ + let { + data , + is_current, + is_edit, + sign, + type, + followed, + id, + login, + isRenders, + moduleName, + next_gold + }=this.state; + let {username}= this.props.match.params; + + let {pathname}=this.props.location; + moduleName=pathname.split("/")[3]; + return( +
      + { + isRenders && this.cancelModulationModels()}/> + } +
      +
      +
      +
      +
      +
      +
      + {is_current ? "我":"TA"}的经验值 + {data && data.experience} +
      + +
      + {is_current ? "我":"TA"}的金币 + {data && data.grade} +
      +
      + 头像 +
      +
      + {is_current ? "我":"TA"}的粉丝 + {data && data.fan_count} +
      + +
      + {is_current ? "我":"TA"}的关注 + {data && data.follow_count} +
      + + {data && data.name} +
      +
      +
      +
      + { + data && is_current == false && data.identity =="学生" ? "" : {data && data.identity} + } + + + + + + + + + + + + + + + + + + + + + {/* */} + { + data && data.college_identifier && + + + + + + } +
      +
      +
      +

      + { + is_edit && is_current ? + + : + is_current ? + {sign || "这家伙很懒,什么都没留下~"} + : + {sign || "这家伙很懒,什么都没留下~"} + } +

      + { + is_current ? +
      + { + data && data.can_apply_trial == false ? + data.attendance_signed ? + + 已签到 +

      明日签到 +{next_gold} 金币

      +
      + : + 签到 + : + 试用申请 + } +
      + : + + } +
      +
      +
      +
    • + this.setState({moduleName: 'courses'})} + to={`/users/${username}/courses`}>课堂 +
    • +
    • + this.setState({moduleName: 'shixuns'})} + to={`/users/${username}/shixuns`}>实训 +
    • +
    • + this.setState({moduleName: 'paths'})} + to={`/users/${username}/paths`}>实践课程 +
    • +
    • + this.setState({moduleName: 'projects'})} + to={`/users/${username}/projects`}>项目 +
    • + + { data && data.identity!="学生" &&
    • 题库
    • } + +
      +
      +
      +
      +
      + + + {/* --------------------------------------------------------------------- */} + + {/* 课堂 */} + {/* http://localhost:3007/courses/1309/homework/9300/setting */} + () + } + > + + {/* 实训 */} + () + } + > + + {/* 实训课程 */} + () + } + > + + {/* 项目 */} + () + } + > + () + } + > + + +
      + ) + } +} export default CNotificationHOC() ( SnackbarHOC() ( TPMIndexHOC(Infos) )); \ No newline at end of file diff --git a/public/react/src/modules/user/usersInfo/InfosPath.js b/public/react/src/modules/user/usersInfo/InfosPath.js index 0cd74cfd2..6e5fa247d 100644 --- a/public/react/src/modules/user/usersInfo/InfosPath.js +++ b/public/react/src/modules/user/usersInfo/InfosPath.js @@ -1,197 +1,197 @@ -import React, { Component } from 'react'; -import { SnackbarHOC } from 'educoder'; -import {BrowserRouter as Router,Route,Switch} from 'react-router-dom'; -import {Tooltip,Menu,Pagination, Spin} from 'antd'; -import Loadable from 'react-loadable'; -import Loading from '../../../Loading'; -import NoneData from '../../courses/coursesPublic/NoneData' -import axios from 'axios'; -import {getImageUrl,setImagesUrl} from 'educoder'; -import { TPMIndexHOC } from '../../tpm/TPMIndexHOC'; -import { CNotificationHOC } from '../../courses/common/CNotificationHOC' -import "./usersInfo.css" - -import Create from './publicCreatNew' - -class InfosPath extends Component{ - constructor(props){ - super(props); - this.state={ - category:undefined, - page:1, - sort_by:'time', - status:undefined, - per_page:16, - isSpin:false, - - totalCount:undefined, - data:undefined - } - } - - componentDidMount=()=>{ - this.setState({ - isSpin:true - }) - let{category,status,sort_by,page,per_page}=this.state; - this.getCourses(category,status,sort_by,page,per_page); - } - - getCourses=(category,status,sort_by,page,per_page)=>{ - let url=`/users/${this.props.match.params.username}/subjects.json`; - axios.get((url),{params:{ - category, - status, - sort_by, - page, - per_page:this.props.is_current && category && page ==1?17:16 - }}).then((result)=>{ - if(result){ - this.setState({ - totalCount:result.data.count, - data:result.data, - isSpin:false - }) - } - }).catch((error)=>{ - console.log(error); - }) - } - - //切换种类 - changeCategory=(cate)=>{ - this.setState({ - category:cate, - status:undefined, - page:1, - isSpin:true - }) - let{sort_by}=this.state; - this.getCourses(cate,undefined,sort_by,1); - } - // 切换状态 - changeStatus=(status)=>{ - let{category,sort_by}=this.state; - this.setState({ - status, - page:1, - isSpin:true - }) - this.getCourses(category,status,sort_by,1); - } - //切换页数 - changePage=(page)=>{ - this.setState({ - page, - isSpin:true - }) - let{category,sort_by,status}=this.state; - this.getCourses(category,status,sort_by,page); - } - - // 进入课堂 - turnToCourses=(url)=>{ - this.props.history.push(url); - } - - - // 切换排序方式 - changeOrder= (sort)=>{ - this.setState({ - sort_by:sort, - isSpin:true - }) - let{category,status,page}=this.state; - this.getCourses(category,status,sort,page); - } - - render(){ - let{ - category, - status, - sort_by, - page, - data, - totalCount, - isSpin - } = this.state; - let isStudent = this.props.isStudent(); - let is_current=this.props.is_current; - return( -
      - - - { - category && category == "manage" && is_current && - - } - { - category && category == "study" && is_current && - - } -
      - 共参与{totalCount}个{category?category=="manage"?"发布":"学习":"实训课程"} - 时间最新 -
      -
      - { - !isStudent && page == 1 && !category && is_current && - - } - { - (!data || data.subjects.length==0) && (isStudent || category) && - } - { - data && data.subjects && data.subjects.map((item,key)=>{ - return( -
      this.turnToCourses(`/paths/${item.id}`)}> - { - item.tag &&
      {item.tag}
      - } - Subject12 -
      -

      - {item.name} -

      -
      -

      - {item.owner_name} - - - - - {item.visits_count} - -

      -
      -
      -
      - ) - }) - } -
      - { - totalCount > 15 && -
      - -
      - } -
      -
      - ) - } -} +import React, { Component } from 'react'; +import { SnackbarHOC } from 'educoder'; +import {BrowserRouter as Router,Route,Switch} from 'react-router-dom'; +import {Tooltip,Menu,Pagination, Spin} from 'antd'; +import Loadable from 'react-loadable'; +import Loading from '../../../Loading'; +import NoneData from '../../courses/coursesPublic/NoneData' +import axios from 'axios'; +import {getImageUrl,setImagesUrl} from 'educoder'; +import { TPMIndexHOC } from '../../tpm/TPMIndexHOC'; +import { CNotificationHOC } from '../../courses/common/CNotificationHOC' +import "./usersInfo.css" + +import Create from './publicCreatNew' + +class InfosPath extends Component{ + constructor(props){ + super(props); + this.state={ + category:undefined, + page:1, + sort_by:'time', + status:undefined, + per_page:16, + isSpin:false, + + totalCount:undefined, + data:undefined + } + } + + componentDidMount=()=>{ + this.setState({ + isSpin:true + }) + let{category,status,sort_by,page,per_page}=this.state; + this.getCourses(category,status,sort_by,page,per_page); + } + + getCourses=(category,status,sort_by,page,per_page)=>{ + let url=`/users/${this.props.match.params.username}/subjects.json`; + axios.get((url),{params:{ + category, + status, + sort_by, + page, + per_page:this.props.is_current && category && page ==1?17:16 + }}).then((result)=>{ + if(result){ + this.setState({ + totalCount:result.data.count, + data:result.data, + isSpin:false + }) + } + }).catch((error)=>{ + console.log(error); + }) + } + + //切换种类 + changeCategory=(cate)=>{ + this.setState({ + category:cate, + status:undefined, + page:1, + isSpin:true + }) + let{sort_by}=this.state; + this.getCourses(cate,undefined,sort_by,1); + } + // 切换状态 + changeStatus=(status)=>{ + let{category,sort_by}=this.state; + this.setState({ + status, + page:1, + isSpin:true + }) + this.getCourses(category,status,sort_by,1); + } + //切换页数 + changePage=(page)=>{ + this.setState({ + page, + isSpin:true + }) + let{category,sort_by,status}=this.state; + this.getCourses(category,status,sort_by,page); + } + + // 进入课堂 + turnToCourses=(url)=>{ + this.props.history.push(url); + } + + + // 切换排序方式 + changeOrder= (sort)=>{ + this.setState({ + sort_by:sort, + isSpin:true + }) + let{category,status,page}=this.state; + this.getCourses(category,status,sort,page); + } + + render(){ + let{ + category, + status, + sort_by, + page, + data, + totalCount, + isSpin + } = this.state; + let isStudent = this.props.isStudent(); + let is_current=this.props.is_current; + return( +
      + + + { + category && category == "manage" && is_current && + + } + { + category && category == "study" && is_current && + + } +
      + 共参与{totalCount}个{category?category=="manage"?"发布":"学习":"实践课程"} + 时间最新 +
      +
      + { + !isStudent && page == 1 && !category && is_current && + + } + { + (!data || data.subjects.length==0) && (isStudent || category) && + } + { + data && data.subjects && data.subjects.map((item,key)=>{ + return( +
      this.turnToCourses(`/paths/${item.id}`)}> + { + item.tag &&
      {item.tag}
      + } + Subject12 +
      +

      + {item.name} +

      +
      +

      + {item.owner_name} + + + + + {item.visits_count} + +

      +
      +
      +
      + ) + }) + } +
      + { + totalCount > 15 && +
      + +
      + } +
      +
      + ) + } +} export default InfosPath; \ No newline at end of file