Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

dev_hjm
jingquan huang 6 years ago
commit 56264e34bd

@ -1,48 +1,48 @@
class ModifyKeContentsForMarkdown < ActiveRecord::Migration[5.2] class ModifyKeContentsForMarkdown < ActiveRecord::Migration[5.2]
include ActionView::Helpers::SanitizeHelper include ActionView::Helpers::SanitizeHelper
def change def change
def ke_transform_to_md content # def ke_transform_to_md content
return content if content.blank? # return content if content.blank?
s_contents = sanitize(content, tags: %w(img a span table td tr tbody pre), attributes: %w(src href target style)) # s_contents = sanitize(content, tags: %w(img a span table td tr tbody pre), attributes: %w(src href target style))
s_contents.gsub(/^(\n)/, "").gsub(/(\n)+/, "<br>").gsub(/$(\n)/, "") # s_contents.gsub(/^(\n)/, "").gsub(/(\n)+/, "<br>").gsub(/$(\n)/, "")
.gsub(/(\n)+/, "<br>").gsub("\t", " ") # .gsub(/(\n)+/, "<br>").gsub("\t", " ")
end # end
#
# 课程讨论区 # # 课程讨论区
MessageDetail.find_each do |m| # MessageDetail.find_each do |m|
content = ke_transform_to_md m.content # content = ke_transform_to_md m.content
m.update_column(:content, content) # m.update_column(:content, content)
end # end
#
# 试卷的标题 # # 试卷的标题
ExerciseQuestion.find_each do |eq| # ExerciseQuestion.find_each do |eq|
question_title = ke_transform_to_md eq.question_title # question_title = ke_transform_to_md eq.question_title
eq.update_column(:question_title, question_title) # eq.update_column(:question_title, question_title)
end # end
#
# 试卷的答案 # # 试卷的答案
ExerciseStandardAnswer.find_each do |esa| # ExerciseStandardAnswer.find_each do |esa|
answer_text = ke_transform_to_md esa.answer_text # answer_text = ke_transform_to_md esa.answer_text
esa.update_column(:answer_text, answer_text) # esa.update_column(:answer_text, answer_text)
end # end
#
# 试卷题库的问题标题 # # 试卷题库的问题标题
ExerciseBankQuestion.find_each do |ebq| # ExerciseBankQuestion.find_each do |ebq|
question_title = ke_transform_to_md ebq.question_title # question_title = ke_transform_to_md ebq.question_title
ebq.update_column(:question_title, question_title) # ebq.update_column(:question_title, question_title)
end # end
#
# 试卷答案 # # 试卷答案
ExerciseBankStandardAnswer.find_each do |ebsa| # ExerciseBankStandardAnswer.find_each do |ebsa|
answer_text = ke_transform_to_md ebsa.answer_text # answer_text = ke_transform_to_md ebsa.answer_text
ebsa.update_column(:answer_text, answer_text) # ebsa.update_column(:answer_text, answer_text)
end # end
#
# 问卷的标题 # # 问卷的标题
PollQuestion.find_each do |pq| # PollQuestion.find_each do |pq|
question_title = ke_transform_to_md pq.question_title # question_title = ke_transform_to_md pq.question_title
pq.update_column(:question_title, question_title) # pq.update_column(:question_title, question_title)
end # end
end end
end end

@ -1,63 +1,63 @@
class SecondMofidyKeContentsForMd < ActiveRecord::Migration[5.2] class SecondMofidyKeContentsForMd < ActiveRecord::Migration[5.2]
include ActionView::Helpers::SanitizeHelper include ActionView::Helpers::SanitizeHelper
def change def change
def ke_transform_to_md content # def ke_transform_to_md content
return content if content.blank? # return content if content.blank?
s_contents = sanitize(content, tags: %w(img a span table td tr tbody pre), attributes: %w(src href target style)) # s_contents = sanitize(content, tags: %w(img a span table td tr tbody pre), attributes: %w(src href target style))
s_contents.gsub(/^(\n)/, "").gsub(/(\n)+/, "<br>").gsub(/$(\n)/, "") # s_contents.gsub(/^(\n)/, "").gsub(/(\n)+/, "<br>").gsub(/$(\n)/, "")
.gsub(/(\n)+/, "<br>").gsub("\t", " ") # .gsub(/(\n)+/, "<br>").gsub("\t", " ")
end # end
#
# 作业 # # 作业
HomeworkCommon.find_each do |hc| # HomeworkCommon.find_each do |hc|
description = ke_transform_to_md hc.description # description = ke_transform_to_md hc.description
reference_answer = ke_transform_to_md hc.reference_answer # reference_answer = ke_transform_to_md hc.reference_answer
explanation = ke_transform_to_md hc.explanation # explanation = ke_transform_to_md hc.explanation
hc.update_attributes(description: description, reference_answer: reference_answer, explanation: explanation) # hc.update_attributes(description: description, reference_answer: reference_answer, explanation: explanation)
end # end
#
# 作业题库 # # 作业题库
HomeworkBank.find_each do |hb| # HomeworkBank.find_each do |hb|
description = ke_transform_to_md hb.description # description = ke_transform_to_md hb.description
reference_answer = ke_transform_to_md hb.reference_answer # reference_answer = ke_transform_to_md hb.reference_answer
hb.update_attributes(description: description, reference_answer: reference_answer) # hb.update_attributes(description: description, reference_answer: reference_answer)
end # end
#
# 毕业任务 # # 毕业任务
GraduationTask.find_each do |gt| # GraduationTask.find_each do |gt|
description = ke_transform_to_md gt.description # description = ke_transform_to_md gt.description
gt.update_column(:description, description) # gt.update_column(:description, description)
end # end
#
# 毕设选题 # # 毕设选题
GraduationTopic.find_each do |gt| # GraduationTopic.find_each do |gt|
description = ke_transform_to_md gt.description # description = ke_transform_to_md gt.description
gt.update_column(:description, description) # gt.update_column(:description, description)
end # end
#
# 毕设作品 # # 毕设作品
GraduationWork.find_each do |gw| # GraduationWork.find_each do |gw|
description = ke_transform_to_md gw.description # description = ke_transform_to_md gw.description
gw.update_column(:description, description) # gw.update_column(:description, description)
end # end
#
# 毕设任务题库 # # 毕设任务题库
GtaskBank.find_each do |gb| # GtaskBank.find_each do |gb|
description = ke_transform_to_md gb.description # description = ke_transform_to_md gb.description
gb.update_column(:description, description) # gb.update_column(:description, description)
end # end
#
# 毕设选题题库 # # 毕设选题题库
GtopicBank.find_each do |gb| # GtopicBank.find_each do |gb|
description = ke_transform_to_md gb.description # description = ke_transform_to_md gb.description
gb.update_column(:description, description) # gb.update_column(:description, description)
end # end
#
# 交流问答 # # 交流问答
Memo.find_each do |m| # Memo.find_each do |m|
content = ke_transform_to_md m.content # content = ke_transform_to_md m.content
m.update_column(:content, content) # m.update_column(:content, content)
end # end
end end
end end

@ -1,17 +1,17 @@
class ThirdModifyKeForStudentWork < ActiveRecord::Migration[5.2] class ThirdModifyKeForStudentWork < ActiveRecord::Migration[5.2]
include ActionView::Helpers::SanitizeHelper include ActionView::Helpers::SanitizeHelper
def change def change
def ke_transform_to_md content # def ke_transform_to_md content
return content if content.blank? # return content if content.blank?
s_contents = sanitize(content, tags: %w(img a span table td tr tbody pre), attributes: %w(src href target style)) # s_contents = sanitize(content, tags: %w(img a span table td tr tbody pre), attributes: %w(src href target style))
s_contents.gsub(/^(\n)/, "").gsub(/(\n)+/, "<br>").gsub(/$(\n)/, "") # s_contents.gsub(/^(\n)/, "").gsub(/(\n)+/, "<br>").gsub(/$(\n)/, "")
.gsub(/(\n)+/, "<br>").gsub("\t", " ") # .gsub(/(\n)+/, "<br>").gsub("\t", " ")
end # end
#
# 学生的作品 过滤掉一些描述的ke图片的作品 # # 学生的作品 过滤掉一些描述的ke图片的作品
StudentWork.where("description is not null and LENGTH(description) < 1000000").find_each do |sw| # StudentWork.where("description is not null and LENGTH(description) < 1000000").find_each do |sw|
description = ke_transform_to_md sw.description # description = ke_transform_to_md sw.description
sw.update_column(:description, description) # sw.update_column(:description, description)
end # end
end end
end end

@ -58,4 +58,9 @@ html, body {
/* resize */ /* resize */
.editormd .CodeMirror { .editormd .CodeMirror {
border-right: none !important; border-right: none !important;
}
.editormd-preview {
border-left: 1px solid rgb(221, 221, 221);
/* 某些情况下被cm盖住了 */
z-index: 99;
} }

@ -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;

@ -36,6 +36,7 @@ export { ModalHOC } from './components/ModalHOC'
export { SetAppModel } from './components/SetAppModel' export { SetAppModel } from './components/SetAppModel'
export { default as LinkAfterLogin } from './components/LinkAfterLogin'
export { default as Cropper } from './components/Cropper' export { default as Cropper } from './components/Cropper'
export { default as ConditionToolTip } from './components/ConditionToolTip' export { default as ConditionToolTip } from './components/ConditionToolTip'
export { default as DragValidator } from './components/DragValidator' export { default as DragValidator } from './components/DragValidator'

@ -15,6 +15,7 @@ class CommentContainer extends Component {
<Comments <Comments
{...this.props} {...this.props}
showHiddenButton={true}
> >
</Comments> </Comments>

@ -58,6 +58,9 @@ const _origin = window.location.origin;
comment_count_without_reply comment_count_without_reply
currentPage currentPage
comments comments
showRewardButton 是否显示奖励按钮
showHiddenButton 是否显示隐藏按钮
接口 接口
deleteComment 删除 deleteComment 删除
@ -360,7 +363,8 @@ class Comments extends Component {
</a> </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}> <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') }> <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> <i className={` ${item.hidden ? 'iconfont icon-yincangbiyan' : 'fa fa-eye'} mr5`}></i>

@ -648,7 +648,10 @@ class TopicDetail extends Component {
<div className="padding30 memoContent new_li" style={{ paddingBottom: '10px'}}> <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 dangerouslySetInnerHTML={{ __html: memo.content }}></div>
} }
</div> </div>

@ -1,5 +1,5 @@
import React,{ Component } from "react"; import React,{ Component } from "react";
import { WordsBtn } from 'educoder'; import { WordsBtn, getTaskUrlById } from 'educoder';
import {Tooltip,message,Modal,Spin} from 'antd'; import {Tooltip,message,Modal,Spin} from 'antd';
import {Link} from 'react-router-dom'; import {Link} from 'react-router-dom';
import axios from 'axios'; import axios from 'axios';
@ -44,6 +44,11 @@ class Startshixuntask extends Component{
startbtn:false startbtn:false
}) })
}else{ }else{
setTimeout(() => {
this.setState({
startbtn: false,
})
}, 1000)
if(response.data.status!=401&&response.data.status!=403){ if(response.data.status!=401&&response.data.status!=403){
const w=window.open('about:blank'); const w=window.open('about:blank');
@ -156,13 +161,31 @@ class Startshixuntask extends Component{
{/*<a onClick={this.hidestartshixunCombattype}>知道了</a>*/} {/*<a onClick={this.hidestartshixunCombattype}>知道了</a>*/}
{/*</p>*/} {/*</p>*/}
</Modal> </Modal>
<style>{`
a.startShixunTask_continueShixun {
padding: 0;
color: #4CACFF !important;
font-size: 16px;
}
`}</style>
{/* 如果是继续实战和查看实战实训作业这边后台会直接返回identity直接写成a标签 */}
{this.props.isStudent? {this.props.isStudent?
<span> <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&&this.props.data.task_operation?startbtn===false
{this.props.data&&this.props.data.task_operation[0]} ?
</span>:"":""} ((this.props.data && this.props.data.task_operation[1] && this.props.data.task_operation[1].indexOf('/') == -1) ?
</span>:"" <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> </a>

@ -130,10 +130,11 @@ class CommitSummary extends Component{
height:'20px' height:'20px'
}} > }} >
<div className="educontent mb30"> <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> <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">&gt;</span> <span className="color-grey-9 fl ml3 mr3">&gt;</span>
<a style="grey" {/* style="grey" */}
<a
className="btn colorgrey fl hovercolorblue ">{data === undefined ? "" :data.category===undefined?"":data.category.category_name}</a> className="btn colorgrey fl hovercolorblue ">{data === undefined ? "" :data.category===undefined?"":data.category.category_name}</a>
<span className="color-grey-9 fl ml3 mr3">&gt;</span> <span className="color-grey-9 fl ml3 mr3">&gt;</span>
<a className="fl">作业详情</a> <a className="fl">作业详情</a>
@ -142,7 +143,7 @@ class CommitSummary extends Component{
</div> </div>
<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> <a onClick={()=>this.gotohome()} className="color-grey-6 fr font-16 ml30 mt10">返回</a>
</div> </div>
{/*educontentbox*/} {/*educontentbox*/}

@ -189,11 +189,17 @@ class MemoDetail extends Component {
let filesize = item.filesize let filesize = item.filesize
attachments.push( attachments.push(
<p className="clearfix" key={index} > <div className="color-grey df" key={index}>
<a href={item.url} className="color-green clearfix notefileDownload" target="_blank"> <a className="color-grey ">
<i className="iconfont icon-xiazai color-green ml5 fl"></i><span className="fl">{fileName}{filesize? ` ${filesize}` : ''}</span> <i className="font-14 color-green iconfont icon-fujian mr8" aria-hidden="true"></i>
</a> </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; return attachments;
@ -693,7 +699,7 @@ class MemoDetail extends Component {
<div className="padding40-30 bor-bottom-greyE"> <div className="padding40-30 bor-bottom-greyE">
<div className="font-16 mb5 cdefault clearfix pr pr35" style={{display: 'flex', alignItems: 'center'}}> <div className="font-16 mb5 cdefault clearfix pr pr35" style={{display: 'flex', alignItems: 'center'}}>
{/* overflowHidden1 */} {/* 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 " { memo.sticky && <span className="btn-cir btn-cir-red ml10 "
style={{ height: '20px', alignSelf: 'flex-start', marginTop: '10px' }} style={{ height: '20px', alignSelf: 'flex-start', marginTop: '10px' }}
>置顶</span>} >置顶</span>}
@ -768,6 +774,7 @@ class MemoDetail extends Component {
<div className="padding40 memoContent new_li"> <div className="padding40 memoContent new_li">
{ !memo.is_md ? { !memo.is_md ?
<div dangerouslySetInnerHTML={{__html: memo.content}}></div> : <div dangerouslySetInnerHTML={{__html: memo.content}}></div> :
<div id="memo_content_editorMd" className="new_li"> <div id="memo_content_editorMd" className="new_li">
<textarea style={{'display': 'none'}}> <textarea style={{'display': 'none'}}>
{memo.content} {memo.content}

@ -387,6 +387,11 @@ class MemoNew extends Component {
// repertoires: [], // repertoires: [],
// currentSelectRepertoiresIndex: -1, // currentSelectRepertoiresIndex: -1,
}, ()=> { }, ()=> {
// 解决有时候编辑时内容不显示的问题
setTimeout(() => {
this.mdRef.current && this.mdRef.current.setValue(content || '')
}, 2000)
$('.upload_filename').each((index, item) => { $('.upload_filename').each((index, item) => {
var width = window._textWidth($(item), '14px'); var width = window._textWidth($(item), '14px');
console.log(width) console.log(width)
@ -548,10 +553,12 @@ class MemoNew extends Component {
return attachments; return attachments;
} }
handleChange = (info) => { handleChange = (info) => {
let fileList = info.fileList; if (info.file.status === 'uploading' || info.file.status === 'done') {
this.setState({ let fileList = info.fileList;
fileList: appendFileSizeToUploadFileAll(fileList) this.setState({
}); fileList: appendFileSizeToUploadFileAll(fileList)
});
}
} }
onAttachmentRemove = (file) => { onAttachmentRemove = (file) => {
this.props.confirm({ this.props.confirm({
@ -619,7 +626,7 @@ class MemoNew extends Component {
console.log('beforeUpload', file.name); console.log('beforeUpload', file.name);
const isLt150M = file.size / 1024 / 1024 < 150; const isLt150M = file.size / 1024 / 1024 < 150;
if (!isLt150M) { if (!isLt150M) {
// message.error('文件大小必须小于150MB!'); this.props.showNotification('文件大小必须小于150MB!');
} }
return isLt150M; return isLt150M;
}, },

@ -79,7 +79,7 @@ class PostItem extends Component {
</p> </p>
</div> </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'}}> <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> <a href="javascript:void(0);"><i className="fa fa-bars font-16"></i></a>
<ul className="edu-position-hide undis"> <ul className="edu-position-hide undis">

@ -32,7 +32,7 @@ class RecommendShixun extends Component {
</img> </img>
</a> </a>
<div className="ml10 flex1"> <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'}}> className="color-grey-6 task-hide mb10 recomment-name" style={{maxWidth:'147px'}}>
{_shixun.name} {_shixun.name}
</a> </a>

@ -24,7 +24,9 @@ class RightHotQuestion extends Component {
} }
return hot_memos.map((item, index) => { return hot_memos.map((item, index) => {
return <div className="hotQuestionItem" key={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} {item.subject}
</Link> </Link>
<p className="clearfix font-12 color-grey-9"> <p className="clearfix font-12 color-grey-9">

@ -7,7 +7,7 @@ import PropTypes from 'prop-types';
import classNames from 'classnames' import classNames from 'classnames'
import { getImageUrl, toPath } from 'educoder' import { getImageUrl, toPath, LinkAfterLogin } from 'educoder'
import match_adImg from '../../images/ad/match_ad.jpg' import match_adImg from '../../images/ad/match_ad.jpg'
const $ = window.$ const $ = window.$
@ -58,7 +58,7 @@ class RightMyPublish extends Component {
</img> </img>
</div> </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"> {/*<p className="edu-txt-center font-16">
<span>我的发布</span><br/> <span>我的发布</span><br/>
<Link to={`/forums/categories/my_published`} className="color-blue">{my_memos_count}</Link> <Link to={`/forums/categories/my_published`} className="color-blue">{my_memos_count}</Link>

@ -44,7 +44,9 @@ class ShiXunPostItem extends Component
<Link to={`${memo.tpm_url}`} title={memo.subject} target="_blank">{memo.subject}</Link> <Link to={`${memo.tpm_url}`} title={memo.subject} target="_blank">{memo.subject}</Link>
</p> </p>
{ memo.reward && { 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> <i className="iconfont icon-gift font-16 mr5 fl"></i><span className="fl mt3">{memo.reward}</span>
</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">{memo.username}</span>
<span className="fl color-grey-9 ml40">{moment(memo.updated_at).fromNow()}</span> <span className="fl color-grey-9 ml40">{moment(memo.updated_at).fromNow()}</span>
{ !!tagStr && <span className="fl color-grey-9 ml40">来自 {tagStr}</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>} { !!memo.replies_count && <span className="fr color-grey-6 font-12">{memo.replies_count} 回复</span>}
</p> </p>
</div> </div>

@ -93,7 +93,7 @@ class CaseList extends Component{
<div className="edu-back-white mb30 mt30"> <div className="edu-back-white mb30 mt30">
<p className="padding20-30 clearfix bor-bottom-greyE"> <p className="padding20-30 clearfix bor-bottom-greyE">
<span className="font-18 fl color-grey-3">教学案例</span> <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> </p>
<div className="clearfix pl30 pr30"> <div className="clearfix pl30 pr30">
<ul className="fl library_nav mt25"> <ul className="fl library_nav mt25">

@ -13,9 +13,11 @@
margin-top: -20px; margin-top: -20px;
margin-left: -17px; margin-left: -17px;
left: 50%; left: 50%;
top: 50%; top: 50%;
/* .editormd-preview 有个 z-index 99 某些情况下被cm盖住了 */
z-index: 50; z-index: 50;
} }
.b-label>.resize-helper button{ .b-label>.resize-helper button{
width: 24px; width: 24px;
height: 24px; height: 24px;
@ -64,6 +66,7 @@
,#game_show_content #tab_con_5 .editormd-preview { ,#game_show_content #tab_con_5 .editormd-preview {
width: 100% !important; width: 100% !important;
height: 100% !important; height: 100% !important;
z-index: 20;
} }
/* tab 样式覆盖 */ /* tab 样式覆盖 */

@ -71,7 +71,7 @@ function create_editorMD(id, width, high, placeholder, imageUrl,initValue, callb
} }
}); });
// 一个页面有多个md时onload方法只执行了一次 // 一个页面有多个md时onload方法只执行了一次
window.md_elocalStorage(editorName, `MemoQuestion_${id}`, `${id}`); // window.md_elocalStorage(editorName, `MemoQuestion_${id}`, `${id}`);
return editorName; return editorName;
} }

@ -9,6 +9,7 @@ import { getUrl } from 'educoder'
import axios from 'axios'; import axios from 'axios';
import './TPMIndex.css' import './TPMIndex.css'
import LoginDialog from '../login/LoginDialog';
import Trialapplication from "../login/Trialapplication"; import Trialapplication from "../login/Trialapplication";
// import "antd/dist/antd.css"; // import "antd/dist/antd.css";
// import '../../css/educoder/edu-common.css' // import '../../css/educoder/edu-common.css'
@ -74,6 +75,8 @@ export function TPMIndexHOC(WrappedComponent) {
Headertop:undefined, Headertop:undefined,
Footerdown:undefined, Footerdown:undefined,
coursedata: {}, coursedata: {},
isRender: false
} }
} }
@ -286,9 +289,22 @@ export function TPMIndexHOC(WrappedComponent) {
}).catch((error) => { }).catch((error) => {
console.log(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() { render() {
let{Headertop,Footerdown}=this.state; let{Headertop,Footerdown, isRender}=this.state;
const common = { const common = {
isSuperAdmin:this.isSuperAdmin, isSuperAdmin:this.isSuperAdmin,
isAdminOrCreator:this.isAdminOrCreator, isAdminOrCreator:this.isAdminOrCreator,
@ -299,11 +315,18 @@ export function TPMIndexHOC(WrappedComponent) {
isAdminOrStudent: this.isAdminOrStudent, isAdminOrStudent: this.isAdminOrStudent,
isNotMember: this.isNotMember, isNotMember: this.isNotMember,
isUserid:this.state.coursedata&&this.state.coursedata.userid, isUserid:this.state.coursedata&&this.state.coursedata.userid,
fetchUser: this.fetchUser fetchUser: this.fetchUser,
showLoginDialog: this.showLoginDialog,
checkIfLogin: this.checkIfLogin,
} }
return ( return (
<div> <div>
{isRender===true ? <LoginDialog
Modifyloginvalue={()=>this.hideLoginDialog()}
{...this.state}
{...this.props}
/> : ""}
<SiderBar Headertop={Headertop}/> <SiderBar Headertop={Headertop}/>
{/* 注释掉了1440 影响到了手机屏幕的展示 */} {/* 注释掉了1440 影响到了手机屏幕的展示 */}
<style>{ <style>{

@ -50,6 +50,7 @@ class TPMShixunDiscuss extends Component {
<Comments <Comments
{...this.props} {...this.props}
user={user} user={user}
showHiddenButton={true}
></Comments> ></Comments>
// onPaginationChange={this.onPaginationChange} // onPaginationChange={this.onPaginationChange}
// <ShixunDiscuss // <ShixunDiscuss

@ -18,6 +18,8 @@ export function getHiddenName(name) {
const newName = name.substr(0,1)+str; const newName = name.substr(0,1)+str;
return newName return newName
} }
const MAX_NAME_LENGTH = 10
const MAX_NICKNAME_LENGTH = 20
class AccountBasic extends Component { class AccountBasic extends Component {
constructor(props){ constructor(props){
super(props); super(props);
@ -126,7 +128,7 @@ class AccountBasic extends Component {
// 输入昵称时change剩余的字数 // 输入昵称时change剩余的字数
changeNickName=(e)=>{ changeNickName=(e)=>{
let num= 20 - parseInt(e.target.value.length); let num= MAX_NICKNAME_LENGTH - parseInt(e.target.value.length);
this.setState({ this.setState({
nameLength:num < 0 ? 0 : num nameLength:num < 0 ? 0 : num
}) })
@ -394,11 +396,11 @@ class AccountBasic extends Component {
} }
} }
checkNameLength = (rule, value, callback) => { checkNameLength = (rule, value, callback) => {
if (value && value.length <= 10) { if (value && value.length <= MAX_NAME_LENGTH) {
callback(); callback();
return; return;
} }
callback('请输入您的姓名最大限制10个字符'); callback(`请输入真实姓名,最大限制${MAX_NAME_LENGTH}个字符`);
} }
render() { render() {
@ -498,8 +500,8 @@ class AccountBasic extends Component {
message: '请输入您的昵称', message: '请输入您的昵称',
}], }],
})( })(
<Input placeholder="请输入您的昵称最大限制20个字符" onInput={this.changeNickName} maxLength="20" suffix ={ <Input placeholder={`请输入您的昵称,最大限制${MAX_NICKNAME_LENGTH}个字符`} onInput={this.changeNickName} maxLength={MAX_NICKNAME_LENGTH} suffix ={
<span className="color-grey-6 font-13">{String(nameLength)}/20</span> <span className="color-grey-6 font-13">{String(nameLength)}/{MAX_NICKNAME_LENGTH}</span>
}></Input> }></Input>
)} )}
</Form.Item> </Form.Item>
@ -512,11 +514,11 @@ class AccountBasic extends Component {
rules: [{ rules: [{
// initialValue: this.state.cityDefaultValue, // initialValue: this.state.cityDefaultValue,
required: true, required: true,
message: '请输入您的姓名最大限制10个字符', message: `请输入真实姓名,最大限制${MAX_NAME_LENGTH}个字符`,
validator: this.checkNameLength 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"} <i className={showRealName?"iconfont icon-xianshi font-18 color-blue":"iconfont icon-yincang font-18 color-blue"}
onClick={()=>this.showOrHide(showRealName)}></i> onClick={()=>this.showOrHide(showRealName)}></i>
}></Input> }></Input>

Loading…
Cancel
Save