diff --git a/src/forge/Merge/MessageCount.js b/src/forge/Merge/MessageCount.js index cc8c271e5..2a0fb7eee 100644 --- a/src/forge/Merge/MessageCount.js +++ b/src/forge/Merge/MessageCount.js @@ -351,7 +351,7 @@ class MessageCount extends Component{ if(values.issue_tag_ids===''){ values.issue_tag_ids = [] }else{ - values.issue_tag_ids = [parseInt(values.issue_tag_ids,0)] + values.issue_tag_ids = [parseInt(values.issue_tag_ids,10)] } if(values.assigned_to_id===0){ diff --git a/src/modules/user/usersInfo/Infos.js b/src/modules/user/usersInfo/Infos.js index 376721d8b..b673176ed 100644 --- a/src/modules/user/usersInfo/Infos.js +++ b/src/modules/user/usersInfo/Infos.js @@ -1,91 +1,84 @@ import React, { Component } from 'react'; - -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 { Route, Switch } from 'react-router-dom'; import UpgradeModals from '../../modals/UpgradeModals'; import axios from 'axios'; -import {getImageUrl} from 'educoder'; import InfosBanner from './InfosBanner' - import "./usersInfo.css" import "../../courses/css/members.css" import "../../courses/css/Courses.css" - - import Trialapplication from '../../login/Trialapplication' const InfosPackage = Loadable({ - loader: () => import('./InfosPackage'), - loading:Loading, + loader: () => import('./InfosPackage'), + loading: Loading, }) const InfosCourse = Loadable({ loader: () => import('./InfosCourse'), - loading:Loading, + loading: Loading, }) const InfosShixun = Loadable({ loader: () => import('./InfosShixun'), - loading:Loading, + loading: Loading, }) const InfosPath = Loadable({ loader: () => import('./InfosPath'), - loading:Loading, + loading: Loading, }) const InfosProject = Loadable({ loader: () => import('./InfosProject'), - loading:Loading, + loading: Loading, }) const InfosVideo = Loadable({ loader: () => import('./video/InfosVideo'), - loading:Loading, + loading: Loading, }) -const InfosTopics=Loadable({ - loader: () => import('./InfosTopics'), - loading:Loading, +const InfosTopics = Loadable({ + loader: () => import('./InfosTopics'), + loading: Loading, }) const $ = window.$; -class Infos extends Component{ - constructor(props){ +class Infos extends Component { + constructor(props) { super(props); - this.state={ - data:undefined, - is_current:undefined, - is_edit:false, - sign:undefined, - type:0, - login:undefined, - isRenders:false, - moduleName:"classrooms", - next_gold:undefined + this.state = { + data: undefined, + is_current: undefined, + is_edit: false, + sign: undefined, + type: 0, + login: undefined, + isRenders: false, + moduleName: "classrooms", + next_gold: undefined } } - componentDidMount =()=>{ - let upsystem=`/users/system_update.json`; - axios.get(upsystem).then((response)=>{ - let updata=response.data; - this.setState({ - updata:updata - }) - }).catch((error)=>{ - console.log(error); - }) + componentDidMount = () => { + let upsystem = `/users/system_update.json`; + axios.get(upsystem).then((response) => { + let updata = response.data; + this.setState({ + updata: updata + }) + }).catch((error) => { + console.log(error); + }) - this.getInfo(this.props.match.params.username); + this.getInfo(this.props.match.params.username); } //判断是否看的是当前用户的个人主页 - componentDidUpdate =(prevProps)=> { - if(this.props.current_user && prevProps.current_user != this.props.current_user){ - if(this.props.current_user.login != this.props.match.params.username){ + componentDidUpdate = (prevProps) => { + if (this.props.current_user && prevProps.current_user != this.props.current_user) { + if (this.props.current_user.login != this.props.match.params.username) { this.setState({ - is_current:false, - login:this.props.current_user.login + is_current: false, + login: this.props.current_user.login }) } } else { @@ -98,235 +91,208 @@ class Infos extends Component{ //获取个人主页信息 - getInfo = (user_login) =>{ - let url =`/users/${user_login}/homepage_info.json`; - axios.get(url).then((result)=>{ - if(result){ - if (result.data.status === 403||result.data.status === 401||result.data.status === 500||result.data.status === 404) { + getInfo = (user_login) => { + let url = `/users/${user_login}/homepage_info.json`; + axios.get(url).then((result) => { + if (result) { + if (result.data.status === 403 || result.data.status === 401 || result.data.status === 500 || result.data.status === 404) { - }else{ - 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 - }) - } + } else { + 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)=>{ + }).catch((error) => { console.log(error); }) } // 编辑签名 - editmysign=()=>{ + editmysign = () => { this.setState({ - is_edit:true - },()=>{ + is_edit: true + }, () => { $("#mysign").focus(); }) } // 输入签名 - inputSign=(e)=>{ + inputSign = (e) => { this.setState({ - sign:e.target.value + sign: e.target.value }) } //取消编辑签名 - savemysign=()=>{ - let { sign } =this.state; - let url=`/users/brief_introduction.json`; - axios.post((url),{ - content:sign - }).then((result)=>{ - if(result){ + 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 + is_edit: false }) } - }).catch((error)=>{ + }).catch((error) => { console.log(error) }) } - changeType=(e)=>{ + changeType = (e) => { this.setState({ - type:e.key + type: e.key }) } - turnTo=(url)=>{ + 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 - // }) + signFor = () => { + let url = `/users/attendance.json` + axios.post(url).then((result) => { + if (result) { this.getInfo(this.props.match.params.username); } - }).catch((error)=>{ + }).catch((error) => { console.log(error); }) } // 关注 - followPerson=()=>{ - let{followed,id}=this.state; - let url=`/users/${id}/watch.json`; + followPerson = () => { + let { followed, id } = this.state; + let url = `/users/${id}/watch.json`; // 取消关注 - if(followed){ - axios.delete(url).then((result)=>{ - if(result){ + if (followed) { + axios.delete(url).then((result) => { + if (result) { this.setState({ - followed:false + followed: false }) } - }).catch((error)=>{ + }).catch((error) => { console.log(error) }) - }else{ + } else { // 关注 - axios.post(url).then((result)=>{ - if(result){ + axios.post(url).then((result) => { + if (result) { this.setState({ - followed:true + followed: true }) } - }).catch((error)=>{ + }).catch((error) => { console.log(error); }) } } - - // 试用申请 - // trialapplications =()=>{ - // this.setState({ - // isRenders: true, - // showTrial:true - // }) - // } - cancelModulationModels=()=>{ + cancelModulationModels = () => { this.setState({ isRenders: false }) } - ToBank=(url)=>{ - window.location.href=url; + ToBank = (url) => { + window.location.href = url; } - render(){ + render() { let { - data , - is_edit, - sign, - type, - followed, - id, isRenders, - moduleName, - next_gold - }=this.state; + } = this.state; let isCurrent = true; let currentLogin; - if(this.props.current_user && this.props.current_user.login != this.props.match.params.username){ - isCurrent=false; + if (this.props.current_user && this.props.current_user.login != this.props.match.params.username) { + isCurrent = false; currentLogin = this.props.current_user.login; } const _commonProps = { is_current: isCurrent, login: currentLogin } - return( + return (
- {this.state.updata===undefined?"":} + {this.state.updata === undefined ? "" : } { - isRenders && this.cancelModulationModels()}/> + isRenders && this.cancelModulationModels()} /> } - {/* --------------------------------------------------------------------- */} - {/* 题库 */} - () - } - > + {/* --------------------------------------------------------------------- */} + {/* 题库 */} + () + } + > - {/* 课堂 */} - {/* http://localhost:3007/courses/1309/homework/9300/setting */} + {/* 课堂 */} () - } - > + render={ + (props) => () + } + > {/* 实训项目 */} - () - } - > + () + } + > {/* 实践课程 */} - () - } - > + () + } + > {/* 开发项目 */} - () - } - > + () + } + > - {/* 众包 */} - {/* http://localhost:3007/courses/1309/homework/9300/setting */} - () - } - > + {/* 众包 */} + () + } + > - {/* 视频 */} - () - } - > + {/* 视频 */} + () + } + > () - } - > + render={ + (props) => () + } + >
) } } -// CNotificationHOC() ( SnackbarHOC() ( TPMIndexHOC)) -export default (Infos) ; +export default (Infos); diff --git a/src/modules/user/usersInfo/InfosBank.js b/src/modules/user/usersInfo/InfosBank.js index 50104b466..54172b39d 100644 --- a/src/modules/user/usersInfo/InfosBank.js +++ b/src/modules/user/usersInfo/InfosBank.js @@ -1,13 +1,11 @@ import React, { Component } from 'react'; -import { Pagination, Spin, Checkbox, Modal } from 'antd'; +import { Pagination, Spin, Checkbox } from 'antd'; import moment from 'moment'; import axios from 'axios'; import NoneData from '../../courses/coursesPublic/NoneData' -import { getImageUrl } from 'educoder'; import "./usersInfo.css" import Modals from '../../modals/Modals' -const dateFormat = "YYYY-MM-DD HH:mm" class InfosBank extends Component { constructor(props) { super(props); @@ -151,7 +149,6 @@ class InfosBank extends Component { modalsTopval, modalsBottomval, modalSave } = this.state; - let isStudent = this.props.isStudent(); let is_current = this.props.is_current; return (
@@ -164,15 +161,15 @@ class InfosBank extends Component { >
-
  • this.changeType("publicly")}>{is_current ? "我" : "TA"}的题库
  • -
  • this.changeType("personal")}>公共题库
  • +
  • this.changeType("publicly")}>{is_current ? "我" : "TA"}的题库
  • +
  • this.changeType("personal")}>公共题库
    • @@ -182,7 +179,7 @@ class InfosBank extends Component { { data && data.course_list && data.course_list.map((item, key) => { return ( -
    • this.changeCourseListId(`${item.id}`)}> +
    • this.changeCourseListId(`${item.id}`)}> {item.name}
    • ) @@ -195,7 +192,7 @@ class InfosBank extends Component { 共参与{totalCount}个题库
    • - {sort_by == "updated_at" ? "时间最新" : sort_by == "name" ? "作业名称" : "贡献者"} + {sort_by === "updated_at" ? "时间最新" : sort_by == "name" ? "作业名称" : "贡献者"}
      • this.changeOrder("updated_at")}>时间最新
      • this.changeOrder("name")}>作业名称
      • @@ -206,7 +203,7 @@ class InfosBank extends Component {

        { - !data || data.question_banks.length == 0 && + !data || data.question_banks.length === 0 && } { data && data.question_banks && data.question_banks.map((item, key) => { @@ -220,7 +217,7 @@ class InfosBank extends Component { {item.name} 发送 { - item.is_public == false ? + item.is_public === false ? this.setPublic(1)} className="bank_public color-blue_4C fr mr60">设为公开 : "" }

        diff --git a/src/modules/user/usersInfo/InfosPackage.js b/src/modules/user/usersInfo/InfosPackage.js index ec1659c96..92b478cea 100644 --- a/src/modules/user/usersInfo/InfosPackage.js +++ b/src/modules/user/usersInfo/InfosPackage.js @@ -3,8 +3,10 @@ import { Pagination, Spin } from 'antd'; import axios from 'axios'; import Modals from '../../modals/Modals'; import NoneData from '../../courses/coursesPublic/NoneData'; -import "./usersInfo.css" +import "./usersInfo.css"; import moment from 'moment'; + + let categorylist = [ { name: "全部", value: undefined }, { name: "前端开发", value: "front" }, @@ -138,9 +140,9 @@ class InfosPackage extends Component { this.getCourses(category, status, 1); } }) - .catch(function (error) { - console.log(error); - }); + .catch(function (error) { + console.log(error); + }); this.cancelProject(); } render() { @@ -153,11 +155,8 @@ class InfosPackage extends Component { isSpin } = this.state; let is_current = this.props.is_current; - - // console.log(data) return (
        - {/*提示*/} @@ -206,22 +202,6 @@ class InfosPackage extends Component { onClick={() => this.changeCategory("study")} className="font-16 w66">{is_current ? "我" : "TA"}学习的
        - { category == "manage" ?