From 56665203d5bc9884b6d75304984fc057a579feb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 24 Sep 2019 16:11:24 +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 --- public/react/src/AppConfig.js | 22 ++++----- .../courses/busyWork/CommonWorkItem.js | 41 +++++++++++++++-- .../graduation/tasks/GraduateTaskItem.js | 45 +++++++++++++++---- .../modules/courses/graduation/tasks/index.js | 2 + .../graduation/topics/GraduateTopicItem.js | 37 +++++++++++++-- 5 files changed, 120 insertions(+), 27 deletions(-) diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index 025db7f5c..48e47edbe 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -21,16 +21,16 @@ let hashTimeout // TODO 开发期多个身份切换 let debugType ="" -if (isDev) { - const _search = window.location.search; - let parsed = {}; - if (_search) { - parsed = queryString.parse(_search); - } - debugType = window.location.search.indexOf('debug=t') != -1 ? 'teacher' : - window.location.search.indexOf('debug=s') != -1 ? 'student' : - window.location.search.indexOf('debug=a') != -1 ? 'admin' : parsed.debug || 'admin' -} +// if (isDev) { +// const _search = window.location.search; +// let parsed = {}; +// if (_search) { +// parsed = queryString.parse(_search); +// } +// debugType = window.location.search.indexOf('debug=t') != -1 ? 'teacher' : +// window.location.search.indexOf('debug=s') != -1 ? 'student' : +// window.location.search.indexOf('debug=a') != -1 ? 'admin' : parsed.debug || 'admin' +// } window._debugType = debugType; export function initAxiosInterceptors(props) { @@ -44,7 +44,7 @@ export function initAxiosInterceptors(props) { // proxy = "https://testeduplus2.educoder.net" //proxy="http://47.96.87.25:48080" proxy="https://pre-newweb.educoder.net" - proxy="https://test-newweb.educoder.net" + // proxy="https://test-newweb.educoder.net" // 在这里使用requestMap控制,避免用户通过双击等操作发出重复的请求; // 如果需要支持重复的请求,考虑config里面自定义一个allowRepeat参考来控制 diff --git a/public/react/src/modules/courses/busyWork/CommonWorkItem.js b/public/react/src/modules/courses/busyWork/CommonWorkItem.js index 122ed12d2..27b168b72 100644 --- a/public/react/src/modules/courses/busyWork/CommonWorkItem.js +++ b/public/react/src/modules/courses/busyWork/CommonWorkItem.js @@ -7,22 +7,41 @@ import CoursesListType from '../coursesPublic/CoursesListType' import { WordsBtn } from 'educoder' import AccessoryModal2 from '../coursesPublic/AccessoryModal2' import AccessoryModal from '../coursesPublic/AccessoryModal' +import LoginDialog from '../../login/LoginDialog'; import axios from 'axios' class CommonWorkItem extends Component{ constructor(props){ super(props); this.state = { - aModalVisible: false + aModalVisible: false, + isRender:false, } } onItemClick = (item) => { + // console.log("onItemClick"); + // console.log(this.props); + try { + if(this.props.current_user.username==="游客"){ + this.setState({ + isRender:true, + match:"", + }); + return + } + }catch (e) { + } const isStudent = this.props.isStudent() if (isStudent) { this.props.toWorkQuestionPage(this.props.match.params, item.homework_id) } else { this.props.toWorkListPage(this.props.match.params, item.homework_id) } - } + }; + Modifyloginvalue=()=>{ + this.setState({ + isRender:false, + }) + }; sendMoreAttachment = (item) => { this.handleItem = item; const url = `/student_works/${item.work_id}/supply_attachments.json` @@ -104,7 +123,7 @@ class CommonWorkItem extends Component{ render(){ let { mainList,workType }=this.props; - const { aModalVisible, fileList, revise_reason } = this.state + const { aModalVisible, fileList, revise_reason,isRender } = this.state let coursesId = this.props.match.params.coursesId; const isStudent = this.props.isStudent() @@ -119,6 +138,11 @@ class CommonWorkItem extends Component{ fileList={fileList} description={revise_reason} > */} + {isRender===true?this.Modifyloginvalue()} + {...this.props} + {...this.state} + />:""} @@ -144,6 +171,14 @@ class CommonWorkItem extends Component{ }
this.props.onItemClick(Object.assign({}, item, {id: item.homework_id})) }>

+ {} : () => this.onItemClick(item)} diff --git a/public/react/src/modules/courses/graduation/tasks/GraduateTaskItem.js b/public/react/src/modules/courses/graduation/tasks/GraduateTaskItem.js index 8ab3c3628..44c9be848 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduateTaskItem.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduateTaskItem.js @@ -7,14 +7,15 @@ import axios from 'axios'; import Modals from '../../../modals/Modals'; import Associationmodel from '../../coursesPublic/Associationmodel'; import AccessoryModal from "../../coursesPublic/AccessoryModal"; - +import LoginDialog from "../../../login/LoginDialog"; class GraduateTaskItem extends Component{ constructor(props){ super(props); this.state = { modalname:"关联项目", - visible:false + visible:false, + isRender:false, } } @@ -32,6 +33,11 @@ class GraduateTaskItem extends Component{ // isrelate:is_relate // }) } + Modifyloginvalue=()=>{ + this.setState({ + isRender:false, + }) + }; cannelAssociation=()=>{ @@ -132,7 +138,24 @@ class GraduateTaskItem extends Component{ setupdate=()=>{ this.props.funlist - } + }; + showfiles =(url)=>{ + // console.log("ShixunhomeWorkItemshowfiles"); + // console.log( this.props.current_user.username); + try { + if(this.props.current_user.username==="游客"){ + this.setState({ + isRender:true, + match:"", + }); + return + } + }catch (e) { + } + this.props.history.push(url); + // this.props.current_user + + }; render(){ let { Modalstype, @@ -142,7 +165,8 @@ class GraduateTaskItem extends Component{ cardsModalsavetype, loadtype, modalname, - visible + visible, + isRender } = this.state; const { checkBox, @@ -165,7 +189,11 @@ class GraduateTaskItem extends Component{ modalSave={cardsModalsavetype} loadtype={loadtype} /> - + {isRender===true?this.Modifyloginvalue()} + {...this.props} + {...this.state} + />:""} {visible===true?this.showfiles("/courses/"+coursesId+"/graduation_tasks/"+categoryid+"/detail/"+taskid+"/list")} title={discussMessage.name} className=" fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.name}:"" } { this.props.isStudent? this.showfiles("/courses/"+coursesId+"/graduation_tasks/"+categoryid+"/detail/"+taskid+"/list")} title={discussMessage.name} className=" fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.name}:"" } @@ -232,8 +260,7 @@ class GraduateTaskItem extends Component{ { this.props.isNotMember===true?this.props.discussMessage.private_icon===true? {discussMessage.name} - :this.showfiles("/courses/"+coursesId+"/graduation_tasks/"+categoryid+"/"+taskid+"/list")} title={discussMessage.name} className=" fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.name}:"" } diff --git a/public/react/src/modules/courses/graduation/tasks/index.js b/public/react/src/modules/courses/graduation/tasks/index.js index ae764cc95..4a7ee9710 100644 --- a/public/react/src/modules/courses/graduation/tasks/index.js +++ b/public/react/src/modules/courses/graduation/tasks/index.js @@ -744,6 +744,8 @@ class GraduationTasks extends Component{

{ + editTopic=(topicId)=>{ + let courseId=this.props.match.params.coursesId; this.props.history.push(`/courses/${courseId}/graduation_topics/${topicId}/edit`); } toDetailPage=(topicId)=>{ + // console.log("toDetailPage"); + // console.log(this.props); + try { + if(this.props.current_user.username==="游客"){ + this.setState({ + isRender:true, + match:"", + }); + return + } + }catch (e) { + } let courseId=this.props.match.params.coursesId; this.props.history.push(`/courses/${courseId}/graduation_topics/${topicId}/detail`); - } + }; + Modifyloginvalue=()=>{ + this.setState({ + isRender:false, + }) + }; render(){ const { checkBox, discussMessage, index,chooseTopic, data, courseId } = this.props; - + const { + isRender + }=this.state; const isAdmin = this.props.isAdmin(); const isStudent=this.props.isStudent(); const isNotMember=this.props.isNotMember(); @@ -32,6 +56,11 @@ class GraduateTopicItem extends Component{ } return(
+ {isRender===true?this.Modifyloginvalue()} + {...this.props} + {...this.state} + />:""}