diff --git a/public/react/src/App.css b/public/react/src/App.css index 7b0455bea..50bccfb60 100644 --- a/public/react/src/App.css +++ b/public/react/src/App.css @@ -58,4 +58,9 @@ html, body { /* resize */ .editormd .CodeMirror { border-right: none !important; +} +.editormd-preview { + border-left: 1px solid rgb(221, 221, 221); + /* 某些情况下,被cm盖住了 */ + z-index: 99; } \ No newline at end of file diff --git a/public/react/src/common/components/LinkAfterLogin.js b/public/react/src/common/components/LinkAfterLogin.js new file mode 100644 index 000000000..d0df08f0a --- /dev/null +++ b/public/react/src/common/components/LinkAfterLogin.js @@ -0,0 +1,23 @@ +import React, { Component } from 'react'; + +// 登录后才能跳转 +class LinkAfterLogin extends Component { + + constructor(props) { + super(props); + } + checkAuth = () => { + if (this.props.checkIfLogin()) { + this.props.history.push(this.props.to) + } else { + this.props.showLoginDialog() + } + } + render() { + return( + <a {...this.props} onClick={this.checkAuth}>{this.props.children}</a> + ) + } +} + +export default LinkAfterLogin; \ No newline at end of file diff --git a/public/react/src/common/educoder.js b/public/react/src/common/educoder.js index 2afbca8d1..2074e495a 100644 --- a/public/react/src/common/educoder.js +++ b/public/react/src/common/educoder.js @@ -36,6 +36,7 @@ export { ModalHOC } from './components/ModalHOC' export { SetAppModel } from './components/SetAppModel' +export { default as LinkAfterLogin } from './components/LinkAfterLogin' export { default as Cropper } from './components/Cropper' export { default as ConditionToolTip } from './components/ConditionToolTip' export { default as DragValidator } from './components/DragValidator' diff --git a/public/react/src/modules/comment/CommentContainer.js b/public/react/src/modules/comment/CommentContainer.js index 0e12d0e7d..b02f4094f 100644 --- a/public/react/src/modules/comment/CommentContainer.js +++ b/public/react/src/modules/comment/CommentContainer.js @@ -15,6 +15,7 @@ class CommentContainer extends Component { <Comments {...this.props} + showHiddenButton={true} > </Comments> diff --git a/public/react/src/modules/comment/Comments.js b/public/react/src/modules/comment/Comments.js index 380b90bd9..ae246197c 100644 --- a/public/react/src/modules/comment/Comments.js +++ b/public/react/src/modules/comment/Comments.js @@ -58,6 +58,9 @@ const _origin = window.location.origin; comment_count_without_reply currentPage comments + + showRewardButton 是否显示奖励按钮 + showHiddenButton 是否显示隐藏按钮 接口 deleteComment 删除 @@ -360,7 +363,8 @@ class Comments extends Component { </a> :""} - { (this.props.onlySuperAdminCouldHide && item.isSuperAdmin || !this.props.onlySuperAdminCouldHide && item.admin === true) ? + { this.props.showHiddenButton == true + && (this.props.onlySuperAdminCouldHide && item.isSuperAdmin || !this.props.onlySuperAdminCouldHide && item.admin === true) ? <Tooltip title={ item.hidden ? "取消隐藏" : "隐藏评论" } disableFocusListener={true}> <a href="javascript:void(0);" className="color-grey-8 fl mt1" onClick={() => this.onCommentBtnClick(item, '', item.hidden ? 'hiddenCancel' : 'hidden') }> <i className={` ${item.hidden ? 'iconfont icon-yincangbiyan' : 'fa fa-eye'} mr5`}></i> diff --git a/public/react/src/modules/courses/boards/TopicDetail.js b/public/react/src/modules/courses/boards/TopicDetail.js index 970cf798a..d60c34461 100644 --- a/public/react/src/modules/courses/boards/TopicDetail.js +++ b/public/react/src/modules/courses/boards/TopicDetail.js @@ -648,7 +648,10 @@ class TopicDetail extends Component { <div className="padding30 memoContent new_li" style={{ paddingBottom: '10px'}}> - {memo.is_md == true ? <MarkdownToHtml content={memo.content}></MarkdownToHtml> : + {/* <MarkdownToHtml content={memo.content}></MarkdownToHtml> */} + {memo.is_md == true ? + <MarkdownToHtml content={memo.content}></MarkdownToHtml> + : <div dangerouslySetInnerHTML={{ __html: memo.content }}></div> } </div> diff --git a/public/react/src/modules/courses/coursesPublic/Startshixuntask.js b/public/react/src/modules/courses/coursesPublic/Startshixuntask.js index d146b5ef4..4075eff03 100644 --- a/public/react/src/modules/courses/coursesPublic/Startshixuntask.js +++ b/public/react/src/modules/courses/coursesPublic/Startshixuntask.js @@ -1,5 +1,5 @@ import React,{ Component } from "react"; -import { WordsBtn } from 'educoder'; +import { WordsBtn, getTaskUrlById } from 'educoder'; import {Tooltip,message,Modal,Spin} from 'antd'; import {Link} from 'react-router-dom'; import axios from 'axios'; @@ -44,6 +44,11 @@ class Startshixuntask extends Component{ startbtn:false }) }else{ + setTimeout(() => { + this.setState({ + startbtn: false, + }) + }, 1000) if(response.data.status!=401&&response.data.status!=403){ const w=window.open('about:blank'); @@ -156,13 +161,31 @@ class Startshixuntask extends Component{ {/*<a onClick={this.hidestartshixunCombattype}>知道了</a>*/} {/*</p>*/} </Modal> - + <style>{` + a.startShixunTask_continueShixun { + padding: 0; + color: #4CACFF !important; + font-size: 16px; + } + `}</style> + {/* 如果是继续实战和查看实战,实训作业这边,后台会直接返回identity,直接写成a标签 */} {this.props.isStudent? <span> - {this.props.data&&this.props.data.task_operation&&this.props.data.task_operation?startbtn===false?<span onClick={()=>this.taskoperationId( this.props.data&&this.props.data.task_operation[1])}> - {this.props.data&&this.props.data.task_operation[0]} - </span>:"开启中":""} - </span>:"" + {this.props.data&&this.props.data.task_operation&&this.props.data.task_operation?startbtn===false + ? + ((this.props.data && this.props.data.task_operation[1] && this.props.data.task_operation[1].indexOf('/') == -1) ? + <span> + <a href={getTaskUrlById(this.props.data.task_operation[1])} + class="startShixunTask_continueShixun" + >{this.props.data.task_operation[0]}</a> + </span> + : + <span onClick={()=>this.taskoperationId( this.props.data&&this.props.data.task_operation[1])}> + {this.props.data&&this.props.data.task_operation[0]} + </span>) + :"开启中":""} + </span> + :"" } </a> diff --git a/public/react/src/modules/courses/shixunHomework/CommitSummary.js b/public/react/src/modules/courses/shixunHomework/CommitSummary.js index 728d86f96..69c88eb38 100644 --- a/public/react/src/modules/courses/shixunHomework/CommitSummary.js +++ b/public/react/src/modules/courses/shixunHomework/CommitSummary.js @@ -130,10 +130,11 @@ class CommitSummary extends Component{ height:'20px' }} > <div className="educontent mb30"> - <p className="clearfix mb20 mt10 ml29"> + <p className="clearfix mb20 mt10 "> <a className="btn colorgrey fl hovercolorblue " onClick={()=>this.gotohome()}>{data === undefined ? "" :data.course_name===undefined?"": data.course_name}</a> <span className="color-grey-9 fl ml3 mr3">></span> - <a style="grey" + {/* style="grey" */} + <a className="btn colorgrey fl hovercolorblue ">{data === undefined ? "" :data.category===undefined?"":data.category.category_name}</a> <span className="color-grey-9 fl ml3 mr3">></span> <a className="fl">作业详情</a> @@ -142,7 +143,7 @@ class CommitSummary extends Component{ </div> <div> - <p className="ml29 fl color-black mt10 summaryname" onClick={this.asdasdsad}>修改总结</p> + <p className=" fl color-black mt10 summaryname" onClick={this.asdasdsad}>{this.state.description ? '修改总结' : '提交总结'}</p> <a onClick={()=>this.gotohome()} className="color-grey-6 fr font-16 ml30 mt10">返回</a> </div> {/*educontentbox*/} diff --git a/public/react/src/modules/forums/MemoDetail.js b/public/react/src/modules/forums/MemoDetail.js index 8441a8ac9..e08f321a4 100644 --- a/public/react/src/modules/forums/MemoDetail.js +++ b/public/react/src/modules/forums/MemoDetail.js @@ -189,11 +189,17 @@ class MemoDetail extends Component { let filesize = item.filesize attachments.push( - <p className="clearfix" key={index} > - <a href={item.url} className="color-green clearfix notefileDownload" target="_blank"> - <i className="iconfont icon-xiazai color-green ml5 fl"></i><span className="fl">{fileName}{filesize? ` ${filesize}` : ''}</span> + <div className="color-grey df" key={index}> + <a className="color-grey "> + <i className="font-14 color-green iconfont icon-fujian mr8" aria-hidden="true"></i> </a> - </p> + <a href={item.url} title={fileName.length > 30 ? fileName : ''} + className="mr12 color9B9B overflowHidden1" length="58" style={{maxWidth: '480px'}}> + {fileName} + </a> + <span className="color656565 mt2 color-grey-6 font-12 mr8">{filesize}</span> + + </div> ) }) return attachments; @@ -693,7 +699,7 @@ class MemoDetail extends Component { <div className="padding40-30 bor-bottom-greyE"> <div className="font-16 mb5 cdefault clearfix pr pr35" style={{display: 'flex', alignItems: 'center'}}> {/* overflowHidden1 */} - <span className="noteDetailTitle " style={{maxWidth: '634px'}}>{memo.subject + memo.subject}</span> + <span className="noteDetailTitle " style={{maxWidth: '634px'}}>{memo.subject}</span> { memo.sticky && <span className="btn-cir btn-cir-red ml10 " style={{ height: '20px', alignSelf: 'flex-start', marginTop: '10px' }} >置顶</span>} @@ -768,6 +774,7 @@ class MemoDetail extends Component { <div className="padding40 memoContent new_li"> { !memo.is_md ? <div dangerouslySetInnerHTML={{__html: memo.content}}></div> : + <div id="memo_content_editorMd" className="new_li"> <textarea style={{'display': 'none'}}> {memo.content} diff --git a/public/react/src/modules/forums/MemoNew.js b/public/react/src/modules/forums/MemoNew.js index e6482b8b6..48c789eae 100644 --- a/public/react/src/modules/forums/MemoNew.js +++ b/public/react/src/modules/forums/MemoNew.js @@ -387,6 +387,11 @@ class MemoNew extends Component { // repertoires: [], // currentSelectRepertoiresIndex: -1, }, ()=> { + // 解决有时候编辑时内容不显示的问题 + setTimeout(() => { + this.mdRef.current && this.mdRef.current.setValue(content || '') + }, 2000) + $('.upload_filename').each((index, item) => { var width = window._textWidth($(item), '14px'); console.log(width) @@ -548,10 +553,12 @@ class MemoNew extends Component { return attachments; } handleChange = (info) => { - let fileList = info.fileList; - this.setState({ - fileList: appendFileSizeToUploadFileAll(fileList) - }); + if (info.file.status === 'uploading' || info.file.status === 'done') { + let fileList = info.fileList; + this.setState({ + fileList: appendFileSizeToUploadFileAll(fileList) + }); + } } onAttachmentRemove = (file) => { this.props.confirm({ @@ -619,7 +626,7 @@ class MemoNew extends Component { console.log('beforeUpload', file.name); const isLt150M = file.size / 1024 / 1024 < 150; if (!isLt150M) { - // message.error('文件大小必须小于150MB!'); + this.props.showNotification('文件大小必须小于150MB!'); } return isLt150M; }, diff --git a/public/react/src/modules/forums/PostItem.js b/public/react/src/modules/forums/PostItem.js index 43b63c3fa..99dcab46d 100644 --- a/public/react/src/modules/forums/PostItem.js +++ b/public/react/src/modules/forums/PostItem.js @@ -79,7 +79,7 @@ class PostItem extends Component { </p> </div> - { user && (user.admin === true || user.user_id === memo.author_id) && + { user && (user.admin === true || user.login === memo.login) && <div className="edu-position-hidebox" style={{position: 'absolute', right: '18px',top:'0px'}}> <a href="javascript:void(0);"><i className="fa fa-bars font-16"></i></a> <ul className="edu-position-hide undis"> diff --git a/public/react/src/modules/forums/RecommendShixun.js b/public/react/src/modules/forums/RecommendShixun.js index af0ca0007..535b027cc 100644 --- a/public/react/src/modules/forums/RecommendShixun.js +++ b/public/react/src/modules/forums/RecommendShixun.js @@ -32,7 +32,7 @@ class RecommendShixun extends Component { </img> </a> <div className="ml10 flex1"> - <a href={`/shixuns/${_shixun.identifier}/challenges`} target="_blank" data-tip-down={_shixun.name} + <a href={`/shixuns/${_shixun.identifier}/challenges`} target="_blank" title={_shixun.name && _shixun.name.length > 9 ? _shixun.name : ''} className="color-grey-6 task-hide mb10 recomment-name" style={{maxWidth:'147px'}}> {_shixun.name} </a> diff --git a/public/react/src/modules/forums/RightHotQuestion.js b/public/react/src/modules/forums/RightHotQuestion.js index 35ab37644..d5e7ce713 100644 --- a/public/react/src/modules/forums/RightHotQuestion.js +++ b/public/react/src/modules/forums/RightHotQuestion.js @@ -24,7 +24,9 @@ class RightHotQuestion extends Component { } return hot_memos.map((item, index) => { return <div className="hotQuestionItem" key={index}> - <Link to={`/forums/${item.id}`} className="color-grey-6 task-hide mb5 questiontName"> + <Link to={`/forums/${item.id}`} className="color-grey-6 task-hide mb5 questiontName" + title={ item.subject && item.subject.length > 15 ? item.subject : '' } + > {item.subject} </Link> <p className="clearfix font-12 color-grey-9"> diff --git a/public/react/src/modules/forums/RightMyPublish.js b/public/react/src/modules/forums/RightMyPublish.js index 94a09f7d9..fc101ae30 100644 --- a/public/react/src/modules/forums/RightMyPublish.js +++ b/public/react/src/modules/forums/RightMyPublish.js @@ -7,7 +7,7 @@ import PropTypes from 'prop-types'; import classNames from 'classnames' -import { getImageUrl, toPath } from 'educoder' +import { getImageUrl, toPath, LinkAfterLogin } from 'educoder' import match_adImg from '../../images/ad/match_ad.jpg' const $ = window.$ @@ -58,7 +58,7 @@ class RightMyPublish extends Component { </img> </div> - <Link to={'/forums/new'} className="sendMyQuestion edu-default-btn edu-blueback-btn edu-txt-center font-16 mb30">发布话题</Link> + <LinkAfterLogin {...this.props} to={'/forums/new'} className="sendMyQuestion edu-default-btn edu-blueback-btn edu-txt-center font-16 mb30">发布话题</LinkAfterLogin> {/*<p className="edu-txt-center font-16"> <span>我的发布</span><br/> <Link to={`/forums/categories/my_published`} className="color-blue">{my_memos_count}</Link> diff --git a/public/react/src/modules/forums/shixun/ShiXunPostItem.js b/public/react/src/modules/forums/shixun/ShiXunPostItem.js index 961e16ff1..765591c6c 100644 --- a/public/react/src/modules/forums/shixun/ShiXunPostItem.js +++ b/public/react/src/modules/forums/shixun/ShiXunPostItem.js @@ -44,7 +44,9 @@ class ShiXunPostItem extends Component <Link to={`${memo.tpm_url}`} title={memo.subject} target="_blank">{memo.subject}</Link> </p> { memo.reward && - <span className="color-orange ml20 fl" data-tip-down={`获得平台奖励金币:${memo.reward}`}> + <span className="color-orange ml20 fl" data-tip-down={`获得平台奖励金币:${memo.reward}`} + style={{ lineHeight: '20px' }} + > <i className="iconfont icon-gift font-16 mr5 fl"></i><span className="fl mt3">{memo.reward}</span> </span> } @@ -53,7 +55,7 @@ class ShiXunPostItem extends Component <span className="fl color-grey-9">{memo.username}</span> <span className="fl color-grey-9 ml40">{moment(memo.updated_at).fromNow()}</span> { !!tagStr && <span className="fl color-grey-9 ml40">来自 {tagStr}</span>} - { !!memo.praise_count && <span className="fr color-grey-6 ml20 font-12">{memo.praise_count} 赞</span>} + { !!memo.praises_count && <span className="fr color-grey-6 ml20 font-12">{memo.praises_count} 赞</span>} { !!memo.replies_count && <span className="fr color-grey-6 font-12">{memo.replies_count} 回复</span>} </p> </div> diff --git a/public/react/src/modules/moop_cases/CaseList.js b/public/react/src/modules/moop_cases/CaseList.js index b968cc930..bfb453dd8 100644 --- a/public/react/src/modules/moop_cases/CaseList.js +++ b/public/react/src/modules/moop_cases/CaseList.js @@ -93,7 +93,7 @@ class CaseList extends Component{ <div className="edu-back-white mb30 mt30"> <p className="padding20-30 clearfix bor-bottom-greyE"> <span className="font-18 fl color-grey-3">教学案例</span> - <ActionBtn style="colorBlue" className="fr" onClick={() => this.addQuestion(null, Q_TYPE_SINGLE)}>发布案例</ActionBtn> + <ActionBtn style="colorBlue" className="fr" to="/moop_cases/new">发布案例</ActionBtn> </p> <div className="clearfix pl30 pr30"> <ul className="fl library_nav mt25"> diff --git a/public/react/src/modules/page/tpiPage.css b/public/react/src/modules/page/tpiPage.css index 55e75059d..fe71de64f 100644 --- a/public/react/src/modules/page/tpiPage.css +++ b/public/react/src/modules/page/tpiPage.css @@ -13,9 +13,11 @@ margin-top: -20px; margin-left: -17px; left: 50%; - top: 50%; + top: 50%; + /* .editormd-preview 有个 z-index 99 某些情况下,被cm盖住了 */ z-index: 50; } + .b-label>.resize-helper button{ width: 24px; height: 24px; @@ -64,6 +66,7 @@ ,#game_show_content #tab_con_5 .editormd-preview { width: 100% !important; height: 100% !important; + z-index: 20; } /* tab 样式覆盖 */ diff --git a/public/react/src/modules/paths/PathNew.js b/public/react/src/modules/paths/PathNew.js index 3acad7eed..04e391732 100644 --- a/public/react/src/modules/paths/PathNew.js +++ b/public/react/src/modules/paths/PathNew.js @@ -71,7 +71,7 @@ function create_editorMD(id, width, high, placeholder, imageUrl,initValue, callb } }); // 一个页面有多个md时,onload方法只执行了一次 - window.md_elocalStorage(editorName, `MemoQuestion_${id}`, `${id}`); + // window.md_elocalStorage(editorName, `MemoQuestion_${id}`, `${id}`); return editorName; } diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js index bbb2eb97d..0361b090f 100644 --- a/public/react/src/modules/tpm/TPMIndexHOC.js +++ b/public/react/src/modules/tpm/TPMIndexHOC.js @@ -9,6 +9,7 @@ import { getUrl } from 'educoder' import axios from 'axios'; import './TPMIndex.css' +import LoginDialog from '../login/LoginDialog'; import Trialapplication from "../login/Trialapplication"; // import "antd/dist/antd.css"; // import '../../css/educoder/edu-common.css' @@ -74,6 +75,8 @@ export function TPMIndexHOC(WrappedComponent) { Headertop:undefined, Footerdown:undefined, coursedata: {}, + + isRender: false } } @@ -286,9 +289,22 @@ export function TPMIndexHOC(WrappedComponent) { }).catch((error) => { console.log(error) }) + } + hideLoginDialog = () => { + this.setState({ + isRender: false + }) + } + showLoginDialog = () => { + this.setState({ + isRender: true + }) + } + checkIfLogin = () => { + return this.state.current_user && this.state.current_user.login != '' } render() { - let{Headertop,Footerdown}=this.state; + let{Headertop,Footerdown, isRender}=this.state; const common = { isSuperAdmin:this.isSuperAdmin, isAdminOrCreator:this.isAdminOrCreator, @@ -299,11 +315,18 @@ export function TPMIndexHOC(WrappedComponent) { isAdminOrStudent: this.isAdminOrStudent, isNotMember: this.isNotMember, isUserid:this.state.coursedata&&this.state.coursedata.userid, - fetchUser: this.fetchUser + fetchUser: this.fetchUser, + + showLoginDialog: this.showLoginDialog, + checkIfLogin: this.checkIfLogin, } return ( <div> - + {isRender===true ? <LoginDialog + Modifyloginvalue={()=>this.hideLoginDialog()} + {...this.state} + {...this.props} + /> : ""} <SiderBar Headertop={Headertop}/> {/* 注释掉了1440 影响到了手机屏幕的展示 */} <style>{ diff --git a/public/react/src/modules/tpm/TPMShixunDiscuss.js b/public/react/src/modules/tpm/TPMShixunDiscuss.js index 58830620a..9350060cc 100644 --- a/public/react/src/modules/tpm/TPMShixunDiscuss.js +++ b/public/react/src/modules/tpm/TPMShixunDiscuss.js @@ -50,6 +50,7 @@ class TPMShixunDiscuss extends Component { <Comments {...this.props} user={user} + showHiddenButton={true} ></Comments> // onPaginationChange={this.onPaginationChange} // <ShixunDiscuss diff --git a/public/react/src/modules/user/account/AccountBasicEdit.js b/public/react/src/modules/user/account/AccountBasicEdit.js index aa7f9dec1..d2e5b0670 100644 --- a/public/react/src/modules/user/account/AccountBasicEdit.js +++ b/public/react/src/modules/user/account/AccountBasicEdit.js @@ -18,6 +18,8 @@ export function getHiddenName(name) { const newName = name.substr(0,1)+str; return newName } +const MAX_NAME_LENGTH = 10 +const MAX_NICKNAME_LENGTH = 20 class AccountBasic extends Component { constructor(props){ super(props); @@ -126,7 +128,7 @@ class AccountBasic extends Component { // 输入昵称时change剩余的字数 changeNickName=(e)=>{ - let num= 20 - parseInt(e.target.value.length); + let num= MAX_NICKNAME_LENGTH - parseInt(e.target.value.length); this.setState({ nameLength:num < 0 ? 0 : num }) @@ -394,11 +396,11 @@ class AccountBasic extends Component { } } checkNameLength = (rule, value, callback) => { - if (value && value.length <= 10) { + if (value && value.length <= MAX_NAME_LENGTH) { callback(); return; } - callback('请输入您的姓名,最大限制10个字符'); + callback(`请输入真实姓名,最大限制${MAX_NAME_LENGTH}个字符`); } render() { @@ -498,8 +500,8 @@ class AccountBasic extends Component { message: '请输入您的昵称', }], })( - <Input placeholder="请输入您的昵称,最大限制20个字符" onInput={this.changeNickName} maxLength="20" suffix ={ - <span className="color-grey-6 font-13">{String(nameLength)}/20</span> + <Input placeholder={`请输入您的昵称,最大限制${MAX_NICKNAME_LENGTH}个字符`} onInput={this.changeNickName} maxLength={MAX_NICKNAME_LENGTH} suffix ={ + <span className="color-grey-6 font-13">{String(nameLength)}/{MAX_NICKNAME_LENGTH}</span> }></Input> )} </Form.Item> @@ -512,11 +514,11 @@ class AccountBasic extends Component { rules: [{ // initialValue: this.state.cityDefaultValue, required: true, - message: '请输入您的姓名,最大限制10个字符', + message: `请输入真实姓名,最大限制${MAX_NAME_LENGTH}个字符`, validator: this.checkNameLength }], })( - <Input placeholder="请输入您的姓名,最大限制10个字符" disabled={!showRealName && this.state.forDisable == true } suffix={ + <Input placeholder={`请输入真实姓名,最大限制${MAX_NAME_LENGTH}个字符`} disabled={!showRealName && this.state.forDisable == true } suffix={ <i className={showRealName?"iconfont icon-xianshi font-18 color-blue":"iconfont icon-yincang font-18 color-blue"} onClick={()=>this.showOrHide(showRealName)}></i> }></Input>