From 363ed577e51e75e1ee0f1751ea3d552fa067f4f3 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Sat, 2 Nov 2019 18:01:14 +0800 Subject: [PATCH 01/13] fix --- app/controllers/competitions/certificates_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/competitions/certificates_controller.rb b/app/controllers/competitions/certificates_controller.rb index ab52920cd..dfe666561 100644 --- a/app/controllers/competitions/certificates_controller.rb +++ b/app/controllers/competitions/certificates_controller.rb @@ -11,7 +11,7 @@ class Competitions::CertificatesController < Competitions::BaseController end def team - team = CompetitionTeam.find(id: params[:id]) + team = CompetitionTeam.find(params[:id]) return render_forbidden unless team.team_members.exists?(user_id: current_user.id) return render_not_found unless team.certificate_exist? From 4a48ab39328d45880c956029743bd3d120c919a3 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Sat, 2 Nov 2019 18:02:24 +0800 Subject: [PATCH 02/13] fix --- app/controllers/competitions/certificates_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/competitions/certificates_controller.rb b/app/controllers/competitions/certificates_controller.rb index dfe666561..68dad41c1 100644 --- a/app/controllers/competitions/certificates_controller.rb +++ b/app/controllers/competitions/certificates_controller.rb @@ -13,7 +13,7 @@ class Competitions::CertificatesController < Competitions::BaseController def team team = CompetitionTeam.find(params[:id]) return render_forbidden unless team.team_members.exists?(user_id: current_user.id) - return render_not_found unless team.certificate_exist? + return render_not_found unless team.certificate_exists? prize = team.competition_prize_users.first.competition_prize filename = "#{current_competition.name}-#{prize.name}-#{team.name}.pdf" From aa5eb76b570f95b5d27a2cf54940992b522060f2 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Sat, 2 Nov 2019 18:05:28 +0800 Subject: [PATCH 03/13] fix --- app/templates/competition_certificates/team.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/templates/competition_certificates/team.html.erb b/app/templates/competition_certificates/team.html.erb index e889d3c62..b38b3bd16 100644 --- a/app/templates/competition_certificates/team.html.erb +++ b/app/templates/competition_certificates/team.html.erb @@ -9,7 +9,7 @@

- <%= @member_names %>(指导老师:<%= @teacher_names %>) 在第二届“全国高校绿色计算大赛”(任务挑战组)中成绩突出,荣获“团体 <%= @prize.name %>”。 + <%= @member_names %>(指导老师:<%= @teacher_names %>) 在第二届“全国高校绿色计算大赛”(<%= @prize.competition.sub_title %>)中成绩突出,荣获“团体 <%= @prize.name %>”。

特发此证,以资鼓励。

From f34bffde8db565624b49d1e1afa22586543d23da Mon Sep 17 00:00:00 2001 From: p31729568 Date: Sat, 2 Nov 2019 18:09:15 +0800 Subject: [PATCH 04/13] fix --- app/services/competitions/save_prize_team_account_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/competitions/save_prize_team_account_service.rb b/app/services/competitions/save_prize_team_account_service.rb index 60d10cf54..098a5365b 100644 --- a/app/services/competitions/save_prize_team_account_service.rb +++ b/app/services/competitions/save_prize_team_account_service.rb @@ -10,7 +10,7 @@ class Competitions::SavePrizeTeamAccountService < ApplicationService def call Competitions::SavePrizeTeamAccountForm.new(params).validate! - prize_leaders = competition.competition_prize_users.where(competition.competition_prize_users) + prize_leaders = competition.competition_prize_users.where(user_id: user.id, leader: true) raise Error, '审批通过后不能修改' if prize_leaders.exists?(status: :approved) From 314c83d44aeb8dfef733bc73079958103bfc1e04 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Sat, 2 Nov 2019 18:23:52 +0800 Subject: [PATCH 05/13] admin: modify style --- app/views/admins/competition_prize_users/shared/_tr.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admins/competition_prize_users/shared/_tr.html.erb b/app/views/admins/competition_prize_users/shared/_tr.html.erb index fada20c43..18912c36a 100644 --- a/app/views/admins/competition_prize_users/shared/_tr.html.erb +++ b/app/views/admins/competition_prize_users/shared/_tr.html.erb @@ -16,7 +16,7 @@ <% if prize_user.leader? && prize_user.competition_prize.category == 'bonus' %> <% bank_content = [prize_user.extra&.[]('bank'), prize_user.extra&.[]('second_bank'), prize_user.extra&.[]('card_no')].compact.join('
').presence || '无' %> - <%= javascript_void_link('查看银行账户', data: { toggle: 'popover', title: '银行账号', content: bank_content.html_safe }) %> + <%= javascript_void_link('查看银行账户', data: { toggle: 'popover', title: '银行账号', content: bank_content.html_safe, html: true }) %> <% end %> <% if prize_user.pending? %> From ec60699406a9f947df89f7e1745b2d9e335ac7c4 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Sat, 2 Nov 2019 18:31:11 +0800 Subject: [PATCH 06/13] bug --- .../user/modal/ApplyForAddChildOrgModal.js | 4 ++-- .../user/modal/RealNameCertificationModal.js | 22 +++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/user/modal/ApplyForAddChildOrgModal.js b/public/react/src/modules/user/modal/ApplyForAddChildOrgModal.js index db32beed3..49c20ca81 100644 --- a/public/react/src/modules/user/modal/ApplyForAddChildOrgModal.js +++ b/public/react/src/modules/user/modal/ApplyForAddChildOrgModal.js @@ -76,7 +76,7 @@ class ApplyForAddChildOrgModal extends Component{ {...this.props } onOk={this.onOk} okText="保存" - className="applyForModal courseNormalForm" + className="applyForModal courseNormalForm styleForapply" > diff --git a/public/react/src/modules/user/modal/RealNameCertificationModal.js b/public/react/src/modules/user/modal/RealNameCertificationModal.js index b3bbdf319..4ab78bd5e 100644 --- a/public/react/src/modules/user/modal/RealNameCertificationModal.js +++ b/public/react/src/modules/user/modal/RealNameCertificationModal.js @@ -263,6 +263,7 @@ class RealNameCertificationModal extends Component{ onSendOk = () => { this.props.form.validateFieldsAndScroll((err, values) => { console.log(values); + console.log(this.state.department_id); if(!err){ let{imageUrl2}=this.state; let{current_user,basicInfo}=this.props; @@ -424,6 +425,26 @@ class RealNameCertificationModal extends Component{ }) } } + // 选择部门、学院 + changeDepartment=(e)=>{ + let arr = this.state.departments && this.state.departments.filter ? this.state.departments.filter(function(item){ + return item.name == e; + }) : []; + if (!arr[0]) { + this.setState({ + department_id: '', + departmentsName: e, + filterDepartments: [], + }) + this.this_department_id = '' + return; + } + this.this_department_id = arr[0].id + this.setState({ + departmentsName:e, + department_id: arr[0].id, + }) + } render(){ const { course_lists, checkBoxValues, searchValue, loading, imageUrl, imageUrl2, @@ -451,6 +472,7 @@ class RealNameCertificationModal extends Component{ changeJob:this.changeJob, filterList:this.filterList, changeList:this.changeList, + changeDepartment:this.changeDepartment, showApplyForAddOrgModal:this.showApplyForAddOrgModal, showApplyForAddChildOrgModal:this.showApplyForAddChildOrgModal } From 3433cb4556f3424164bc6e94b0cb0190edaf5a54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Sat, 2 Nov 2019 18:46:55 +0800 Subject: [PATCH 07/13] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CompetitionContentspdfpeopledata.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/CompetitionContentspdfpeopledata.js b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/CompetitionContentspdfpeopledata.js index 3651e4931..c5b1ed3e2 100644 --- a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/CompetitionContentspdfpeopledata.js +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/CompetitionContentspdfpeopledata.js @@ -427,7 +427,7 @@ class CompetitionContentspdfpeopledata extends Component {

职称:

-

{basicInfo && basicInfo.technical_title}

+

{basicInfo && (basicInfo.technical_title || basicInfo.student_id)}

学校:

From 867e43149cb7063fd48a1492265a9dca08013599 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Sat, 2 Nov 2019 19:04:56 +0800 Subject: [PATCH 08/13] =?UTF-8?q?=E5=AE=9E=E5=90=8D=E8=AE=A4=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../react/src/modules/user/modal/RealNameCertificationModal.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/user/modal/RealNameCertificationModal.js b/public/react/src/modules/user/modal/RealNameCertificationModal.js index 4ab78bd5e..53b32f679 100644 --- a/public/react/src/modules/user/modal/RealNameCertificationModal.js +++ b/public/react/src/modules/user/modal/RealNameCertificationModal.js @@ -273,7 +273,7 @@ class RealNameCertificationModal extends Component{ // 实名认证 let url = `/users/accounts/${current_user && current_user.login}/authentication_apply.json` axios.post((url),{ - name:basicInfo.name, + name:values.name, gender:parseInt(values.sex), id_number:values.credentials }).then((result)=>{ From e6b489b6ca1437096297625e42588348570a105a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Sat, 2 Nov 2019 19:13:05 +0800 Subject: [PATCH 09/13] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CompetitionContentspdfpeopledata.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/CompetitionContentspdfpeopledata.js b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/CompetitionContentspdfpeopledata.js index c5b1ed3e2..5a67235bd 100644 --- a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/CompetitionContentspdfpeopledata.js +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/CompetitionContentspdfpeopledata.js @@ -426,7 +426,8 @@ class CompetitionContentspdfpeopledata extends Component {

-

职称:

+

{basicInfo && basicInfo.technical_title ? "职称:" : ""}{basicInfo && basicInfo.student_id ? "学号:" : ""}

{basicInfo && (basicInfo.technical_title || basicInfo.student_id)}

From c58bfe7a86a0ec378c5982349de817f0d51e0e21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Mon, 4 Nov 2019 13:58:46 +0800 Subject: [PATCH 10/13] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=AD=9B=E9=80=89?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../react/src/modules/user/usersInfo/Infos.js | 35 ++-- .../src/modules/user/usersInfo/InfosCourse.js | 130 +++++++++++++-- .../src/modules/user/usersInfo/InfosPath.js | 133 +++++++++++++--- .../modules/user/usersInfo/InfosProject.js | 149 +++++++++++++++--- .../src/modules/user/usersInfo/InfosShixun.js | 140 ++++++++++++---- .../src/modules/user/usersInfo/usersInfo.css | 8 +- .../user/usersInfo/video/InfosVideo.js | 133 +++++++++++----- 7 files changed, 581 insertions(+), 147 deletions(-) diff --git a/public/react/src/modules/user/usersInfo/Infos.js b/public/react/src/modules/user/usersInfo/Infos.js index e872d25d1..a55cbb74c 100644 --- a/public/react/src/modules/user/usersInfo/Infos.js +++ b/public/react/src/modules/user/usersInfo/Infos.js @@ -148,7 +148,7 @@ class Infos extends Component{ }).catch((error)=>{ console.log(error) }) - + } changeType=(e)=>{ this.setState({ @@ -165,7 +165,7 @@ class Infos extends Component{ axios.post(url).then((result)=>{ if(result){ // this.setState( - // (prevState) => ({ + // (prevState) => ({ // data : update(prevState.data, {attendance_signed: {$set: true} }) // }) // ) @@ -225,7 +225,7 @@ class Infos extends Component{ } render(){ - let { + let { data , is_edit, sign, @@ -243,7 +243,7 @@ class Infos extends Component{ currentLogin = this.props.current_user.login; } const _commonProps = { - is_current: isCurrent, + is_current: isCurrent, login: currentLogin } return( @@ -254,16 +254,16 @@ class Infos extends Component{ { isRenders && this.cancelModulationModels()}/> } - - + - + {/* --------------------------------------------------------------------- */} {/* 题库 */} () } > @@ -287,7 +287,7 @@ class Infos extends Component{ } > - {/* 实训课程 */} + {/* 实践课程 */} () @@ -317,17 +317,16 @@ class Infos extends Component{ > - - () } > - - + +
) } } // CNotificationHOC() ( SnackbarHOC() ( TPMIndexHOC)) -export default (Infos) ; \ No newline at end of file +export default (Infos) ; diff --git a/public/react/src/modules/user/usersInfo/InfosCourse.js b/public/react/src/modules/user/usersInfo/InfosCourse.js index c733900d7..14046d495 100644 --- a/public/react/src/modules/user/usersInfo/InfosCourse.js +++ b/public/react/src/modules/user/usersInfo/InfosCourse.js @@ -1,7 +1,7 @@ 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 {Tooltip, Menu, Pagination, Spin, Dropdown} from 'antd'; import Loadable from 'react-loadable'; import Loading from '../../../Loading'; import axios from 'axios'; @@ -20,7 +20,8 @@ class InfosCourse extends Component{ status:undefined, page:1, per_page:16, - + sort_by: "updated_at", + sort_direction: "desc", totalCount:undefined, data:undefined, isSpin:false @@ -31,27 +32,35 @@ class InfosCourse extends Component{ this.setState({ isSpin:true }) - let{category,status,page}=this.state; - this.getCourses(category,status,page); + let {category, status, page, sort_by, sort_direction} = this.state; + this.getCourses(category, status, page, sort_by, sort_direction); } - getCourses=(category,status,page)=>{ + getCourses = (category, status, page, sort_by, sort_direction) => { let url=`/users/${this.props.match.params.username}/courses.json`; axios.get((url),{params:{ category, status, page, + sort_by, + sort_direction, per_page: this.props.is_current && category && page ==1?17:16 }}).then((result)=>{ if(result){ + console.log("请求成功"); this.setState({ totalCount:result.data.count, data:result.data, + sort_direction: sort_direction, + sort_by: sort_by, isSpin:false }) } }).catch((error)=>{ console.log(error); + this.setState({ + isSpin: false + }) }) } @@ -92,6 +101,27 @@ class InfosCourse extends Component{ } } + updatedlist(sort_by) { + //按照什么样子排序 + this.setState({ + isSpin: true + }); + let {category, status, page, sort_direction} = this.state; + this.getCourses(category, status, 1, sort_by, "desc"); + } + + updatedlists(sort_direction, i) { + // console.log("updatedlistssort_direction"); + // console.log(sort_direction); + // console.log(i); + //是否是倒序 + this.setState({ + isSpin: true + }); + let {category, status, page, sort_by} = this.state; + this.getCourses(category, status, page, sort_by, sort_direction); + } + render(){ let{ category, @@ -99,11 +129,25 @@ class InfosCourse extends Component{ page, data, totalCount, - isSpin + isSpin, + sort_by, + sort_direction } = this.state; let is_current=this.props.is_current; // console.log(this.props.current_user&&this.props.current_user.user_identity==="学生") + const menu = ( + + this.updatedlist("updated_at")}> + 最新动态 + + this.updatedlist("created_at")}> + 最新创建 + + + + ); + return(
@@ -113,17 +157,73 @@ class InfosCourse extends Component{
  • this.changeCategory("study")}>{is_current ? "我":"TA"}学习的
  • { - is_current && + is_current && } -

    +

    共参与{totalCount}个{category?category=="manage"?"发布":"学习":"课堂"} - 时间最新 + + + this.updatedlists("asc", 1)}> + + + + + this.updatedlists("desc", 2)}> + + + + + {sort_by === "updated_at" ? '最新动态' : sort_by === "created_at" ? '最新创建' : ""} + + + +

    +
    {/* 289 */} { @@ -138,7 +238,7 @@ class InfosCourse extends Component{ return(
    this.turnToCourses(`${item.first_category_url}`,item.can_visited)} style={{"cursor": "pointer",height:"289px"}}> { - item.is_public == 1 && + item.is_public == 1 &&
    @@ -152,7 +252,7 @@ class InfosCourse extends Component{

    非成员不能访问

    :"" } - +

    {item.name} @@ -171,14 +271,14 @@ class InfosCourse extends Component{ :""} { - item.members_count > 0 && + item.members_count > 0 && {item.members_count} } { - item.homework_commons_count > 0 && + item.homework_commons_count > 0 && {item.homework_commons_count} @@ -199,7 +299,7 @@ class InfosCourse extends Component{ }

    { - totalCount > 15 && + totalCount > 15 &&
    @@ -209,4 +309,4 @@ class InfosCourse extends Component{ ) } } -export default InfosCourse; \ No newline at end of file +export default InfosCourse; diff --git a/public/react/src/modules/user/usersInfo/InfosPath.js b/public/react/src/modules/user/usersInfo/InfosPath.js index 67809b6ef..0b1437f40 100644 --- a/public/react/src/modules/user/usersInfo/InfosPath.js +++ b/public/react/src/modules/user/usersInfo/InfosPath.js @@ -1,7 +1,7 @@ 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 {Tooltip, Menu, Pagination, Spin, Dropdown} from 'antd'; import Loadable from 'react-loadable'; import Loading from '../../../Loading'; import NoneData from '../../courses/coursesPublic/NoneData' @@ -19,11 +19,11 @@ class InfosPath extends Component{ this.state={ category:undefined, page:1, - sort_by:'time', status:undefined, per_page:16, isSpin:false, - + sort_by: "updated_at", + sort_direction: "desc", totalCount:undefined, data:undefined } @@ -33,28 +33,34 @@ class InfosPath extends Component{ this.setState({ isSpin:true }) - let{category,status,sort_by,page,per_page}=this.state; - this.getCourses(category,status,sort_by,page,per_page); + let {category, status, sort_by, page, per_page, sort_direction} = this.state; + this.getCourses(category, status, sort_by, page, sort_direction); } - getCourses=(category,status,sort_by,page,per_page)=>{ + getCourses = (category, status, sort_by, page, sort_direction) => { let url=`/users/${this.props.match.params.username}/subjects.json`; axios.get((url),{params:{ category, status, sort_by, page, + sort_direction, per_page:this.props.is_current && category && page ==1?17:16 }}).then((result)=>{ if(result){ this.setState({ totalCount:result.data.count, data:result.data, + sort_by: sort_by, + sort_direction: sort_direction, isSpin:false }) } }).catch((error)=>{ console.log(error); + this.setState({ + isSpin: false + }) }) } @@ -66,18 +72,18 @@ class InfosPath extends Component{ page:1, isSpin:true }) - let{sort_by}=this.state; - this.getCourses(cate,undefined,sort_by,1); + let {sort_by, sort_direction} = this.state; + this.getCourses(cate, undefined, sort_by, 1, sort_direction); } // 切换状态 changeStatus=(status)=>{ - let{category,sort_by}=this.state; + let {category, sort_by, sort_direction} = this.state; this.setState({ status, page:1, isSpin:true }) - this.getCourses(category,status,sort_by,1); + this.getCourses(category, status, sort_by, 1, sort_direction); } //切换页数 changePage=(page)=>{ @@ -85,8 +91,8 @@ class InfosPath extends Component{ page, isSpin:true }) - let{category,sort_by,status}=this.state; - this.getCourses(category,status,sort_by,page); + let {category, sort_by, status, sort_direction} = this.state; + this.getCourses(category, status, sort_by, page, sort_direction); } // 进入课堂 @@ -101,15 +107,38 @@ class InfosPath extends Component{ sort_by:sort, isSpin:true }) - let{category,status,page}=this.state; - this.getCourses(category,status,sort,page); + let {category, status, page, sort_direction} = this.state; + this.getCourses(category, status, sort, page, sort_direction); + } + + + //切换种类 + updatedlist(sort_by) { + //按照什么样子排序 + this.setState({ + isSpin: true + }); + let {category, status, page, sort_direction} = this.state; + this.getCourses(category, status, sort_by, 1, "desc"); + } + + //排序 + updatedlists(sort_direction) { + //是否是倒序 + this.setState({ + isSpin: true + }); + let {category, status, page, sort_by} = this.state; + this.getCourses(category, status, sort_by, page, sort_direction); } + render(){ let{ category, status, sort_by, + sort_direction, page, data, totalCount, @@ -117,6 +146,17 @@ class InfosPath extends Component{ } = this.state; let isStudent = this.props.isStudent(); let is_current=this.props.is_current; + const menu = ( + + this.updatedlist("updated_at")}> + 最近更新 + + this.updatedlist("created_at")}> + 最新创建 + + + + ); return(
    @@ -142,10 +182,65 @@ class InfosPath extends Component{
  • this.changeStatus("finished")}>已完成
  • } -
    +
    共参与{totalCount}个{category?category=="manage"?"发布":"学习":"实践课程"} - 时间最新 + + + this.updatedlists("asc")}> + + + + + this.updatedlists("desc")}> + + + + + {sort_by === "updated_at" ? '最近更新' : sort_by === "created_at" ? '最新创建' : ""} + + +
    +
    {/* 295 */} { @@ -163,7 +258,7 @@ class InfosPath extends Component{ item.tag &&
    {item.tag} {/**/}
    - } + } Subject12

    @@ -190,7 +285,7 @@ class InfosPath extends Component{ }

    { - totalCount > 15 && + totalCount > 15 &&
    @@ -200,4 +295,4 @@ class InfosPath extends Component{ ) } } -export default InfosPath; \ No newline at end of file +export default InfosPath; diff --git a/public/react/src/modules/user/usersInfo/InfosProject.js b/public/react/src/modules/user/usersInfo/InfosProject.js index 7bfde98b0..302d6def1 100644 --- a/public/react/src/modules/user/usersInfo/InfosProject.js +++ b/public/react/src/modules/user/usersInfo/InfosProject.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import { SnackbarHOC } from 'educoder'; import {BrowserRouter as Router,Route,Switch} from 'react-router-dom'; -import {Tooltip,Pagination,Spin} from 'antd'; +import {Tooltip, Pagination, Spin, Dropdown, Menu} from 'antd'; import axios from 'axios'; import NoneData from '../../courses/coursesPublic/NoneData' import {getImageUrl} from 'educoder'; @@ -16,7 +16,8 @@ class InfosProject extends Component{ status:undefined, page:1, per_page:16, - + sort_by: "updated_on", + sort_direction: "desc", totalCount:undefined, data:undefined, isSpin:false @@ -27,16 +28,18 @@ class InfosProject extends Component{ this.setState({ isSpin:true }) - let{category,status,page}=this.state; - this.getCourses(category,status,page); + let {category, status, page, sort_by, sort_direction} = this.state; + this.getCourses(category, status, page, sort_by, sort_direction); } - getCourses=(category,status,page)=>{ + getCourses = (category, status, page, sort_by, sort_direction) => { let url=`/users/${this.props.match.params.username}/projects.json`; axios.get((url),{params:{ category, status, page, + sort_by, + sort_direction, per_page:this.props.is_current && category && page ==1?17:16 }}).then((result)=>{ if(result){ @@ -49,6 +52,8 @@ class InfosProject extends Component{ this.setState({ totalCount:result.data.count, data:result.data, + sort_by: sort_by, + sort_direction: sort_direction, isSpin:false }) } @@ -56,6 +61,9 @@ class InfosProject extends Component{ } }).catch((error)=>{ console.log(error); + this.setState({ + isSpin: false + }) }) } @@ -66,8 +74,9 @@ class InfosProject extends Component{ page:1, isSpin:true }) - let{status}=this.state; - this.getCourses(cate,status,1); + let {status, sort_by, sort_direction} = this.state; + this.getCourses(cate, status, 1, sort_by, + sort_direction); } //切换状态 changeStatus=(status)=>{ @@ -76,8 +85,12 @@ class InfosProject extends Component{ page:1, isSpin:true }) - let{category}=this.state; - this.getCourses(category,status,1); + let { + category, sort_by, + sort_direction + } = this.state; + this.getCourses(category, status, 1, sort_by, + sort_direction); } //切换页数 changePage=(page)=>{ @@ -85,8 +98,12 @@ class InfosProject extends Component{ page, isSpin:true }) - let{category,status}=this.state; - this.getCourses(category,status,page); + let { + category, status, sort_by, + sort_direction + } = this.state; + this.getCourses(category, status, page, sort_by, + sort_direction); } // 进入项目 @@ -96,6 +113,27 @@ class InfosProject extends Component{ } } + + //切换种类 + updatedlist(sort_by) { + //按照什么样子排序 + this.setState({ + isSpin: true + }); + let {category, status, page, sort_direction} = this.state; + this.getCourses(category, status, 1, sort_by, "desc"); + } + + //排序 + updatedlists(sort_direction) { + //是否是倒序 + this.setState({ + isSpin: true + }); + let {category, status, page, sort_by} = this.state; + this.getCourses(category, status, page, sort_by, sort_direction); + } + render(){ let{ category, @@ -103,12 +141,24 @@ class InfosProject extends Component{ page, data, totalCount, - isSpin + isSpin, + sort_by, + sort_direction } = this.state; let isStudent = this.props.isStudent(); let is_current=this.props.is_current; - console.log(data) + const menu = ( + + this.updatedlist("updated_on")}> + 最新动态 + + this.updatedlist("created_on")}> + 最新创建 + + + + ); return(
    @@ -118,21 +168,76 @@ class InfosProject extends Component{
  • this.changeCategory("study")}>{is_current ? "我":"TA"}学习的
  • { - is_current && + is_current && } -

    +

    共参与{totalCount}个{category?category=="manage"?"发布":"学习":"项目"} - 时间最新 + + + this.updatedlists("asc")}> + + + + + this.updatedlists("desc")}> + + + + + {sort_by === "updated_on" ? '最近更新' : sort_by === "created_on" ? '最新创建' : ""} + + +

    +
    {/* 289 */} { - page == 1 && is_current && this.props.current_user && !category && this.props.current_user.user_identity != "学生" ? + page == 1 && is_current && this.props.current_user && !category && this.props.current_user.user_identity != "学生" ? :"" @@ -174,17 +279,17 @@ class InfosProject extends Component{
    { - item.members_count> 0 && + item.members_count > 0 && {item.members_count} } { - item.issues_count> 0 && + item.issues_count > 0 && {item.issues_count} } { - item.changesets_count> 0 && + item.changesets_count > 0 && {item.changesets_count} } @@ -196,7 +301,7 @@ class InfosProject extends Component{ }
    { - totalCount > 15 && + totalCount > 15 &&
    @@ -206,4 +311,4 @@ class InfosProject extends Component{ ) } } -export default InfosProject; \ No newline at end of file +export default InfosProject; diff --git a/public/react/src/modules/user/usersInfo/InfosShixun.js b/public/react/src/modules/user/usersInfo/InfosShixun.js index 55fb45cf6..cad70e716 100644 --- a/public/react/src/modules/user/usersInfo/InfosShixun.js +++ b/public/react/src/modules/user/usersInfo/InfosShixun.js @@ -1,6 +1,6 @@ import React, { Component } from 'react'; -import { Pagination , Spin } from 'antd'; +import {Pagination, Spin, Dropdown, Menu} from 'antd'; import NoneData from '../../courses/coursesPublic/NoneData' import axios from 'axios'; @@ -16,11 +16,11 @@ class InfosShixun extends Component{ this.state={ category:undefined, page:1, - sort_by:'time', status:undefined, per_page:16, isSpin:false, - + sort_by: "updated_at", + sort_direction: "desc", totalCount:undefined, data:undefined } @@ -30,11 +30,15 @@ class InfosShixun extends Component{ this.setState({ isSpin:true }) - let{category,status,sort_by,page}=this.state; - this.getCourses(category,status,sort_by,page); + let {category, status, sort_by, page, sort_direction} = this.state; + this.getCourses(category, status, sort_by, page, sort_direction); } - getCourses=(category,status,sort_by,page)=>{ + getCourses = (category, status, sort_by, page, sort_direction) => { + // console.log("请求数据成功"); + // console.log("getCourses"); + // console.log(sort_by); + // console.log(sort_direction); let url=`/users/${this.props.match.params.username}/shixuns.json`; axios.get((url),{params:{ category, @@ -44,14 +48,21 @@ class InfosShixun extends Component{ per_page:this.props.is_current && category && page ==1?17:16 }}).then((result)=>{ if(result){ + console.log("请求数据成功"); + console.log(sort_by); this.setState({ totalCount:result.data.count, data:result.data, + sort_by: sort_by, + sort_direction: sort_direction, isSpin:false }) } }).catch((error)=>{ console.log(error); + this.setState({ + isSpin: false + }) }) } @@ -63,8 +74,8 @@ class InfosShixun extends Component{ page:1, isSpin:true }) - let{sort_by}=this.state; - this.getCourses(cate,undefined,sort_by,1); + let {sort_by, sort_direction} = this.state; + this.getCourses(cate, undefined, sort_by, 1, sort_direction); } // 切换状态 changeStatus=(status)=>{ @@ -73,8 +84,8 @@ class InfosShixun extends Component{ page:1, isSpin:true }) - let{category,sort_by}=this.state; - this.getCourses(category,status,sort_by,1); + let {category, sort_by, sort_direction} = this.state; + this.getCourses(category, status, sort_by, 1, sort_direction); } //切换页数 changePage=(page)=>{ @@ -82,8 +93,8 @@ class InfosShixun extends Component{ page, isSpin:true }) - let{category,sort_by,status}=this.state; - this.getCourses(category,status,sort_by,page); + let {category, sort_by, status, sort_direction} = this.state; + this.getCourses(category, status, sort_by, page, sort_direction); } // 进入课堂 @@ -98,8 +109,28 @@ class InfosShixun extends Component{ sort_by:sort, isSpin:true }) - let{category,status,page}=this.state; - this.getCourses(category,status,sort,page); + let {category, status, page, sort_direction} = this.state; + this.getCourses(category, status, sort, page, sort_direction); + } + + //切换种类 + updatedlist(sort_by) { + //按照什么样子排序 + this.setState({ + isSpin: true + }); + let {category, status, page, sort_direction} = this.state; + this.getCourses(category, status, sort_by, 1, "desc"); + } + + //排序 + updatedlists(sort_direction) { + //是否是倒序 + this.setState({ + isSpin: true + }); + let {category, status, page, sort_by} = this.state; + this.getCourses(category, status, sort_by, page, sort_direction); } render(){ @@ -110,10 +141,22 @@ class InfosShixun extends Component{ page, data, totalCount, + sort_direction, isSpin } = this.state; - + let is_current=this.props.is_current; + const menu = ( + + this.updatedlist("updated_at")}> + 最新动态 + + this.updatedlist("created_at")}> + 语言类别 + + + + ); return(
    @@ -140,17 +183,57 @@ class InfosShixun extends Component{
  • this.changeStatus("passed")}>已通关
  • } -
    +
    共参与{totalCount}个{category?category=="manage"?"发布":"学习":"实训"} -
    -
  • - {sort_by=="time"?"时间最新":"语言类别"} -
      -
    • this.changeOrder("time")}>时间最新
    • -
    • this.changeOrder("language")}>语言类别
    • -
    -
  • -
    + + + this.updatedlists("asc")}> + + + + + this.updatedlists("desc")}> + + + + + {sort_by === "updated_at" ? '最新动态' : sort_by === "created_at" ? '语言类别' : ""} + + +
    {/* 298 */} { - page == 1 && is_current && !category && this.props.current_user && this.props.current_user.user_identity != "学生" ? + page == 1 && is_current && !category && this.props.current_user && this.props.current_user.user_identity != "学生" ? :"" } { @@ -201,7 +285,7 @@ class InfosShixun extends Component{ }
    { - totalCount > 15 && + totalCount > 15 &&
    @@ -211,4 +295,4 @@ class InfosShixun extends Component{ ) } } -export default InfosShixun; \ No newline at end of file +export default InfosShixun; diff --git a/public/react/src/modules/user/usersInfo/usersInfo.css b/public/react/src/modules/user/usersInfo/usersInfo.css index 6d8857acc..1cf335213 100644 --- a/public/react/src/modules/user/usersInfo/usersInfo.css +++ b/public/react/src/modules/user/usersInfo/usersInfo.css @@ -162,7 +162,7 @@ float:left; } .userpost label{ - display:block; + display: block; height: 18px; line-height:18px; } @@ -434,4 +434,8 @@ /* 防抖 */ .educontent .square-list { min-height: 400px; -} \ No newline at end of file +} + +.h10 { + height: 10px; +} diff --git a/public/react/src/modules/user/usersInfo/video/InfosVideo.js b/public/react/src/modules/user/usersInfo/video/InfosVideo.js index dfda982f2..dbf0a3150 100644 --- a/public/react/src/modules/user/usersInfo/video/InfosVideo.js +++ b/public/react/src/modules/user/usersInfo/video/InfosVideo.js @@ -1,6 +1,6 @@ import React, { useState, useEffect, useContext, useRef, memo } from 'react'; import {Link} from 'react-router-dom'; -import { Pagination, Input, Button } from 'antd' +import {Pagination, Input, Button} from 'antd' import { getUrl2, isDev, ThemeContext, ActionBtn, NoneData } from 'educoder' import axios from 'axios' import VideoInReviewItem from './VideoInReviewItem' @@ -55,7 +55,7 @@ function InfoVideo (props) { const [count, setCount] = useState(0) const [loading, setLoading] = useState(true) const [sortKey, setSortKey] = useState(_items[0].key) - + const editModalObj = useModal(false) const videoModalObj = useModal(false) const categoryObj = useCategory('all') @@ -64,7 +64,7 @@ function InfoVideo (props) { const theme = useContext(ThemeContext); const editModalEl = useRef(null); const videoEl = useRef(null); - + const { showNotification, history } = props; const username = props.match.params.username @@ -74,19 +74,19 @@ function InfoVideo (props) { } else { props.showProfessionalCertificationDialog() } - + } function fetchvideos() { const fetchUrl = `/users/${username}/videos.json` const sorts = sortKey.split('-') setLoading(true) - axios.get(fetchUrl, { + axios.get(fetchUrl, { params: { page: pageObj.current, per_page: PAGE_SIZE, sort_by: sorts[0], sort_direction: sorts[1], - // + // } }) .then((response) => { @@ -96,14 +96,14 @@ function InfoVideo (props) { setCount(response.data.count) } }).catch(() => { - + setLoading(false) }) } function fetchReviewvideos() { const fetchUrl = `/users/${username}/videos/review.json` const sorts = sortKey.split('-') setLoading(true) - axios.get(fetchUrl, { + axios.get(fetchUrl, { params: { page: pageObj.current, per_page: PAGE_SIZE, @@ -121,7 +121,7 @@ function InfoVideo (props) { }) } - + useEffect(() => { if (pageObj.current == 1) { if (categoryObj.category == 'all') { @@ -158,22 +158,22 @@ function InfoVideo (props) { _clipboard = new ClipboardJS('.copybtn'); _clipboard.on('success', (e) => { showNotification('复制成功') - }); + }); } - }, 200) + }, 200) } }, [videoModalObj.visible]) useEffect(() => { - + }, []) function editSuccess() { fetchvideos() } - + function onEditVideo(item) { - videoId = { + videoId = { videoId: item.id, title: item.title } @@ -182,12 +182,12 @@ function InfoVideo (props) { // this.refs['editVideoModal'].setVisible(true, video); } function onMaskClick(item) { - videoId = { + videoId = { videoId: item.id, title: item.title, file_url: item.file_url, cover_url: item.cover_url - + } videoModalObj.setVisible(true) } @@ -201,20 +201,23 @@ function InfoVideo (props) { function getCopyText (file_url, cover_url) { return `` } - const _inputValue = getCopyText(videoId.file_url, videoId.cover_url) + + const _inputValue = getCopyText(videoId.file_url, videoId.cover_url); + const sorts = sortKey.split('-') + return (
    - + -