From 535e47d06de3b0dd97e6f8289bc2a83a05115777 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Thu, 4 Jul 2019 11:16:00 +0800 Subject: [PATCH 01/11] img --- public/react/src/modules/user/account/AccountImg.js | 6 +++++- .../src/modules/user/account/ChangeHeaderPicModal.js | 9 ++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/public/react/src/modules/user/account/AccountImg.js b/public/react/src/modules/user/account/AccountImg.js index fdb4bedb9..12dfb9d29 100644 --- a/public/react/src/modules/user/account/AccountImg.js +++ b/public/react/src/modules/user/account/AccountImg.js @@ -1,12 +1,16 @@ import React, { Component } from 'react'; import { SnackbarHOC, getImageUrl } from 'educoder'; - +import ChangeHeaderPicModal from './ChangeHeaderPicModal' class AccountNav extends Component { + editImg = () => { + this.refs['picModal'].setVisible(true) + } render() { // newMain clearfix return (
+ + {this.props.isAdmin() ?
  • + 导出 + +
  • : ""} {this.props.isAdmin() ?jobsettingsdata&&jobsettingsdata.data.end_immediately===true? 立即截止 : "": ""} {this.props.isAdmin() ?jobsettingsdata&&jobsettingsdata.data.publish_immediately===true? @@ -1997,7 +2080,7 @@ class Trainingjobsetting extends Component { 提交 {/*提交*/} - 取消 + this.cancelEdit()}>取消
    : "" } From 19cfbc2cc11601bba40259ca744135db59c2c6c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Thu, 4 Jul 2019 14:24:21 +0800 Subject: [PATCH 07/11] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../react/src/modules/courses/coursesPublic/AccessoryModal.js | 2 -- .../react/src/modules/courses/coursesPublic/SelectSetting.js | 1 - .../modules/courses/exercise/Studentshavecompletedthelist.js | 1 - public/react/src/modules/courses/members/teacherList.js | 1 - .../react/src/modules/courses/poll/PollDetailTabForthRules.js | 3 +-- .../src/modules/courses/shixunHomework/Trainingjobsetting.js | 1 + public/react/src/modules/login/Trialapplication.js | 1 - 7 files changed, 2 insertions(+), 8 deletions(-) diff --git a/public/react/src/modules/courses/coursesPublic/AccessoryModal.js b/public/react/src/modules/courses/coursesPublic/AccessoryModal.js index 72512be43..5541a01a6 100644 --- a/public/react/src/modules/courses/coursesPublic/AccessoryModal.js +++ b/public/react/src/modules/courses/coursesPublic/AccessoryModal.js @@ -151,7 +151,6 @@ class AccessoryModal extends Component{ }).then((result)=>{ if(result.data.status===0){ - debugger this.props.Cancel() this.props.setupdate() @@ -199,7 +198,6 @@ class AccessoryModal extends Component{ }).then((result)=>{ if(result.data.status===0){ - debugger this.props.Cancel() this.props.setupdate() diff --git a/public/react/src/modules/courses/coursesPublic/SelectSetting.js b/public/react/src/modules/courses/coursesPublic/SelectSetting.js index 4e84bae8c..08e01e28e 100644 --- a/public/react/src/modules/courses/coursesPublic/SelectSetting.js +++ b/public/react/src/modules/courses/coursesPublic/SelectSetting.js @@ -175,7 +175,6 @@ class Selectsetting extends Component{ } savecouseShixunModal=()=>{ - debugger let {fileList,is_public,unified_setting,description,datatime,course_groups}=this.state; let newfileList=[]; diff --git a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js index 09cfdf947..a3ee9ef1a 100644 --- a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js +++ b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js @@ -2192,7 +2192,6 @@ class Studentshavecompletedthelist extends Component { } funtaskstatustwo = (checkedValues, data) => { - debugger // console.log(checkedValues); if (JSON.stringify(checkedValues) === "[]") { // console.log(checkedValues); diff --git a/public/react/src/modules/courses/members/teacherList.js b/public/react/src/modules/courses/members/teacherList.js index c5422b96f..5f2459dd3 100644 --- a/public/react/src/modules/courses/members/teacherList.js +++ b/public/react/src/modules/courses/members/teacherList.js @@ -211,7 +211,6 @@ class studentsList extends Component{ } onCheckAllChange = (e, item, index) => { const that = this; - debugger; const checkAllArray = that.state.checkAllArray.slice(0) checkAllArray[index] = !checkAllArray[index] that.setState({checkAllArray}) diff --git a/public/react/src/modules/courses/poll/PollDetailTabForthRules.js b/public/react/src/modules/courses/poll/PollDetailTabForthRules.js index cb24ebc8d..ac0417f39 100644 --- a/public/react/src/modules/courses/poll/PollDetailTabForthRules.js +++ b/public/react/src/modules/courses/poll/PollDetailTabForthRules.js @@ -48,8 +48,7 @@ class PollDetailTabForthRules extends Component{ selectedCourse:[], flagPageEdit:this.props.flagPageEdit } - console.log("PollDetailTabForthRules"); - console.log(props); + } componentDidUpdate(prevProps) { if (JSON.stringify(this.props.rules) != JSON.stringify(prevProps.rules) ) { diff --git a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js index 84f2f72ba..91cbec710 100644 --- a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js +++ b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js @@ -1623,6 +1623,7 @@ class Trainingjobsetting extends Component { }).catch((error) => { console.log(error) }); + } // 课堂学生成绩的导出下载 diff --git a/public/react/src/modules/login/Trialapplication.js b/public/react/src/modules/login/Trialapplication.js index cd3b72dad..89164da2b 100644 --- a/public/react/src/modules/login/Trialapplication.js +++ b/public/react/src/modules/login/Trialapplication.js @@ -227,7 +227,6 @@ class Trialapplication extends Component { postregistered = () => { //提交按钮 - debugger if (this.state.user_phone_binded === false) { if (this.state.Phonenumberisnotcobool === false) { From 1c4315697ffd68978d4174b5c03c09c46ccd9c5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Thu, 4 Jul 2019 14:32:24 +0800 Subject: [PATCH 08/11] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../react/src/modules/courses/shixunHomework/Listofworks.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/public/react/src/modules/courses/shixunHomework/Listofworks.js b/public/react/src/modules/courses/shixunHomework/Listofworks.js index 438a7f152..a922172bc 100644 --- a/public/react/src/modules/courses/shixunHomework/Listofworks.js +++ b/public/react/src/modules/courses/shixunHomework/Listofworks.js @@ -1325,6 +1325,10 @@ class Listofworks extends Component { axios.get(url).then((response) => { this.props.showNotification(`${response.data.message}`); + this.setState({ + loadingstate: true + }) + this.Startsorting(this.state.order, this.state.course_groupyslstwo, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit); }).catch((error) => { console.log(error) }); From a7e6972e76dee72616a34ce158656a56b8c8036f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Thu, 4 Jul 2019 14:55:26 +0800 Subject: [PATCH 09/11] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../react/src/modules/courses/shixunHomework/Listofworks.js | 2 +- .../modules/courses/shixunHomework/Listofworksstudentone.js | 4 ++-- .../src/modules/courses/shixunHomework/ShixunStudentWork.js | 2 +- .../src/modules/courses/shixunHomework/Trainingjobsetting.js | 2 +- .../modules/courses/shixunHomework/Workquestionandanswer.js | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/public/react/src/modules/courses/shixunHomework/Listofworks.js b/public/react/src/modules/courses/shixunHomework/Listofworks.js index a922172bc..2553300ab 100644 --- a/public/react/src/modules/courses/shixunHomework/Listofworks.js +++ b/public/react/src/modules/courses/shixunHomework/Listofworks.js @@ -1481,7 +1481,7 @@ class Listofworks extends Component {

    -

    +

    {teacherdata === undefined ? "" : teacherdata.homework_name}

    -

    +

    {teacherdata === undefined ? "" : teacherdata.homework_name}

    -

    +

    {jobsettingsdata === undefined ? "" : jobsettingsdata.data.homework_name}

    -

    +

    {data&&data.homework_name}

    -

    +

    {jobsettingsdata === undefined ? "" : jobsettingsdata.data.homework_name}

    diff --git a/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js b/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js index c342227c6..28560d4fe 100644 --- a/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js +++ b/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js @@ -412,7 +412,7 @@ class Workquestionandanswer extends Component {

    -

    +

    {jobsettingsdata === undefined ? "" : jobsettingsdata.data.homework_name}

    Date: Thu, 4 Jul 2019 15:12:05 +0800 Subject: [PATCH 10/11] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../shixunHomework/ShixunStudentWork.js | 7 ++- .../shixunHomework/ShixunhomeWorkItem.js | 2 +- .../Shixunworkdetails/ShixunWorkModal.js | 57 ++++++++++--------- 3 files changed, 36 insertions(+), 30 deletions(-) diff --git a/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js b/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js index 7188c65bd..30d5830d2 100644 --- a/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js +++ b/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js @@ -659,7 +659,7 @@ class ShixunStudentWork extends Component { {data&&data?
    -
      +
      • 查重时间:{data&&data.last_review_time} @@ -715,7 +715,7 @@ class ShixunStudentWork extends Component {
      -
      +
      @@ -755,11 +755,12 @@ class ShixunStudentWork extends Component { {datalist === undefined ? "" : } diff --git a/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js b/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js index 5731c3b73..d6c96182b 100644 --- a/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js +++ b/public/react/src/modules/courses/shixunHomework/ShixunhomeWorkItem.js @@ -358,7 +358,7 @@ class ShixunhomeWorkItem extends Component{ ` } - {this.props.isAdmin?
      + {this.props.isAdmin?
      实训详情 {this.props.isAdminOrTeacher()?this.editname(discussMessage.name,discussMessage.homework_id)} className={"btn colorblue ml20 font-16"}>重命名:""} 设置 diff --git a/public/react/src/modules/courses/shixunHomework/Shixunworkdetails/ShixunWorkModal.js b/public/react/src/modules/courses/shixunHomework/Shixunworkdetails/ShixunWorkModal.js index 5a4ad673c..173346c81 100644 --- a/public/react/src/modules/courses/shixunHomework/Shixunworkdetails/ShixunWorkModal.js +++ b/public/react/src/modules/courses/shixunHomework/Shixunworkdetails/ShixunWorkModal.js @@ -31,7 +31,9 @@ class ShixunWorkModal extends Component{ response.data.group_list.map((item,key)=>{ newgroup_list.push(item) }) - if( response.data.ungroup_list!== undefined || response.data.ungroup_list !== null){ + if(response.data.ungroup_list===undefined){ + + }else{ newgroup_list.push(response.data.ungroup_list) } this.setState({ @@ -255,31 +257,10 @@ class ShixunWorkModal extends Component{ { - group_list===undefined?course_groups.ungroup_list.work_count===0?"": - -
      -
    • - - - -
    • -
    • - {course_groups.ungroup_list.work_count} -
    • -
    • - {course_groups.ungroup_list.last_review_time} -
    • -
      - - : - group_list&&group_list.length===0?"":group_list[0]===undefined?"":group_list.map((item,key)=>{ + group_list===undefined?"": + group_list&&group_list.length===0?"":group_list.map((item,key)=>{ return( - item.work_count===0?"":
      +
    • +//
    • +// +// +// +//
    • +//
    • +// {course_groups.ungroup_list.work_count} +//
    • +//
    • +// {course_groups.ungroup_list.last_review_time} +//
    • +//
      +// +// : \ No newline at end of file From 74f213c4815a63da4fe1eb866ac834d1cbdd4d09 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Thu, 4 Jul 2019 15:17:14 +0800 Subject: [PATCH 11/11] cropper --- public/react/src/common/components/Cropper.js | 13 ++++++++---- public/react/src/modules/tpm/TPMIndexHOC.js | 11 ++++++---- public/react/src/modules/user/AccountPage.js | 4 ++-- .../src/modules/user/account/AccountImg.js | 10 +++++---- .../src/modules/user/account/AccountNav.js | 2 +- .../user/account/ChangeHeaderPicModal.js | 21 ++++++++++++++----- 6 files changed, 41 insertions(+), 20 deletions(-) diff --git a/public/react/src/common/components/Cropper.js b/public/react/src/common/components/Cropper.js index 2fe71ea2b..f11248751 100644 --- a/public/react/src/common/components/Cropper.js +++ b/public/react/src/common/components/Cropper.js @@ -110,13 +110,15 @@ class Cropper extends Component { render() { const { width, height, previewId, imageSrc } = this.props; + return (
      {/* This rule is very important, please do not ignore this! */}
      - {/* http://localhost:3007/images/footNavLogo.png 图片转了后不对 */} - + {/* http://localhost:3007/images/footNavLogo.png 图片转了后不对 + || "/images/testPicture.jpg" + || "/images/shixun0.jpg" + */} +
      {/* background: 'aquamarine', 'border-radius': '128px' diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js index f03d59751..cc89f3003 100644 --- a/public/react/src/modules/tpm/TPMIndexHOC.js +++ b/public/react/src/modules/tpm/TPMIndexHOC.js @@ -75,9 +75,11 @@ export function TPMIndexHOC(WrappedComponent) { // header里面需要有user initCommonState(user) { + // 更新头像后,需要改变参数,不然会被图片缓存影响到 + const newUser = Object.assign({}, {...user}, { image_url: `${user.image_url}?t=${new Date().getTime()}`}); this.setState({ - user, - current_user: user + user: newUser, + current_user: newUser }) } showShixun = () => { @@ -230,7 +232,7 @@ export function TPMIndexHOC(WrappedComponent) { /** 课堂权限相关方法,暂时写这里了 ----------------------------------------END */ - fetchUser() { + fetchUser = () => { let url = `/users/get_user_info.json` let courseId; let query = this.props.location.pathname; @@ -289,7 +291,8 @@ export function TPMIndexHOC(WrappedComponent) { isStudent: this.isStudent, isAdminOrStudent: this.isAdminOrStudent, isNotMember: this.isNotMember, - isUserid:this.state.coursedata&&this.state.coursedata.userid + isUserid:this.state.coursedata&&this.state.coursedata.userid, + fetchUser: this.fetchUser } return (
      diff --git a/public/react/src/modules/user/AccountPage.js b/public/react/src/modules/user/AccountPage.js index 430f086a1..065724faf 100644 --- a/public/react/src/modules/user/AccountPage.js +++ b/public/react/src/modules/user/AccountPage.js @@ -51,11 +51,11 @@ class AccountPage extends Component { } getBasicInfo=(login)=>{ - let url=`/users/accounts/${login}.json`; + let url=`/users/accounts/${login || this.props.current_user.login}.json`; axios.get(url).then((result)=>{ if(result.data){ this.setState({ - basicInfo:result.data + basicInfo: Object.assign({}, {...result.data}, { avatar_url: `${result.data.avatar_url}?t=${new Date().getTime()}`}) }) if(result.data && result.data.base_info_completed == false){ this.props.history.push(`/account/basic/edit`); diff --git a/public/react/src/modules/user/account/AccountImg.js b/public/react/src/modules/user/account/AccountImg.js index a802367f2..b8e060750 100644 --- a/public/react/src/modules/user/account/AccountImg.js +++ b/public/react/src/modules/user/account/AccountImg.js @@ -2,14 +2,16 @@ import React, { Component } from 'react'; import { SnackbarHOC, getImageUrl } from 'educoder'; import ChangeHeaderPicModal from './ChangeHeaderPicModal' -class AccountNav extends Component { +class AccountImg extends Component { editImg = () => { this.refs['picModal'].setVisible(true) } render() { + const picUrl = getImageUrl("images/"+this.props.src) return (
      - + - 头像 + 头像

      修改头像

      ); } } -export default AccountNav; +export default AccountImg; diff --git a/public/react/src/modules/user/account/AccountNav.js b/public/react/src/modules/user/account/AccountNav.js index ea84b735e..6f07bd075 100644 --- a/public/react/src/modules/user/account/AccountNav.js +++ b/public/react/src/modules/user/account/AccountNav.js @@ -22,7 +22,7 @@ class AccountNav extends Component { return (
      - + {basicInfo && basicInfo.name} {basicInfo && basicInfo.technical_title}
      diff --git a/public/react/src/modules/user/account/ChangeHeaderPicModal.js b/public/react/src/modules/user/account/ChangeHeaderPicModal.js index 1691c2a22..89f21838e 100644 --- a/public/react/src/modules/user/account/ChangeHeaderPicModal.js +++ b/public/react/src/modules/user/account/ChangeHeaderPicModal.js @@ -28,6 +28,10 @@ class ChangeHeaderPicModal extends Component{ file = files[0]; if (/^image\/\w+/.test(file.type)) { + if (file.size > 2 * 1024 * 1024) { + this.props.showNotification && this.props.showNotification("仅支持文件大小小于2M的文件") + return; + } uploadedImageType = file.type; uploadedImageName = file.name; @@ -41,7 +45,6 @@ class ChangeHeaderPicModal extends Component{ // cropper = new Cropper(image, options); inputImage.value = null; } else { - this.props.showNotification && this.props.showNotification("请选择一个图片格式的文件") // window.alert('Please choose an image file.'); } @@ -72,14 +75,16 @@ class ChangeHeaderPicModal extends Component{ var dataUrl = canvas.toDataURL("image/jpeg"); console.log(dataUrl) - const url = `/users/accounts/${this.props.userLogin || 'kosasa'}/avatar.json` + const url = `/users/accounts/${this.props.userLogin}/avatar.json` axios.put(url, { image: dataUrl }) .then((response) => { // {"status":0,"message":"success","avatar_url":"avatars/User/15739"} if (response.data.status == 0) { - + // this.props.getBasicInfo() + this.props.fetchUser() + // 头像更新后会触发AccountPage的DidUpdate,然后会调用getBasicInfo this.props.showNotification && this.props.showNotification("修改头像成功") this.setVisible(false) } @@ -111,6 +116,7 @@ class ChangeHeaderPicModal extends Component{ text-align: center; width: 120px; height: 120px; + border: 1px solid #eee; } .previewWrap { flex-direction: column; @@ -121,10 +127,14 @@ class ChangeHeaderPicModal extends Component{ } .changeHeaderModal .tip { color: #9B9B9B; + margin-top: 4px; + } + .changeHeaderModal .cropperWrap .tip { + display: inline-block; } .previewWrap .tip { text-align: center; - margin-top: 2px; + margin-top: 4px; } #uploadBtn { color: #4CACFF; @@ -134,8 +144,9 @@ class ChangeHeaderPicModal extends Component{ } `}
      -
      +