Merge remote-tracking branch 'origin/dev_aliyun' into dev_aliyun

dev_aliyun_beta
杨树明 6 years ago
commit 838bace07c

@ -1,7 +1,10 @@
class Wechats::JsSdkSignaturesController < ApplicationController class Wechats::JsSdkSignaturesController < ApplicationController
def create def create
signature = Util::Wechat.js_sdk_signature(params[:url], params[:noncestr], params[:timestamp]) timestamp = (Time.now.to_f * 1000).to_i
render_ok(signature: signature) noncestr = ('A'..'z').to_a.sample(8).join
signature = Util::Wechat.js_sdk_signature(params[:url], noncestr, timestamp)
render_ok(appid: Util::Wechat.appid, timestamp: timestamp, noncestr: noncestr, signature: signature)
rescue Util::Wechat::Error => ex rescue Util::Wechat::Error => ex
render_error(ex.message) render_error(ex.message)
end end

@ -383,12 +383,12 @@ class Comments extends Component {
{/* <span className="ml5 mr5 color-grey-8">|</span>*/} {/* <span className="ml5 mr5 color-grey-8">|</span>*/}
<a href={`javascript:void(0)`} className="color-grey-8" {(this.props.showReply == undefined || this.props.showReply == true) && <a href={`javascript:void(0)`} className="color-grey-8"
onClick={() => this.initReply(item) } > onClick={() => this.initReply(item) } >
<Tooltip title={ "回复" }> <Tooltip title={ "回复" }>
<i className="iconfont icon-huifu1 mr5"></i> <i className="iconfont icon-huifu1 mr5"></i>
</Tooltip> </Tooltip>
</a> </a>}
{/* <span className="ml5 mr5 color-grey-8">|</span>*/} {/* <span className="ml5 mr5 color-grey-8">|</span>*/}

@ -527,6 +527,7 @@ class TopicDetail extends Component {
// TODO 图片上传地址 // TODO 图片上传地址
const courseId=this.props.match.params.coursesId; const courseId=this.props.match.params.coursesId;
const boardId = this.props.match.params.boardId const boardId = this.props.match.params.boardId
const isCourseEnd = this.props.isCourseEnd()
return ( return (
<div className="edu-back-white edu-class-container edu-position course-message topicDetail" id="yslforum_index_list"> {/* fl with100 */} <div className="edu-back-white edu-class-container edu-position course-message topicDetail" id="yslforum_index_list"> {/* fl with100 */}
<style>{` <style>{`
@ -678,8 +679,8 @@ class TopicDetail extends Component {
} }
</div> </div>
<MemoDetailMDEditor ref="editor" memo={memo} usingMockInput={true} placeholder="说点什么" {!isCourseEnd && <MemoDetailMDEditor ref="editor" memo={memo} usingMockInput={true} placeholder="说点什么"
height={160} showError={true} buttonText={'发表'} className={comments && comments.length && 'borderBottom'}></MemoDetailMDEditor> height={160} showError={true} buttonText={'发表'} className={comments && comments.length && 'borderBottom'}></MemoDetailMDEditor>}
{/* onClick={ this.createNewComment } {/* onClick={ this.createNewComment }
enableReplyTo={true} enableReplyTo={true}
@ -704,6 +705,7 @@ class TopicDetail extends Component {
loadMoreChildComments={this.loadMoreChildComments} loadMoreChildComments={this.loadMoreChildComments}
initReply={this.initReply} initReply={this.initReply}
showRewardButton={false} showRewardButton={false}
showReply={!isCourseEnd}
onlySuperAdminCouldHide={true} onlySuperAdminCouldHide={true}
></Comments> ></Comments>
@ -720,7 +722,7 @@ class TopicDetail extends Component {
{ total_count > REPLY_PAGE_COUNT && { total_count > REPLY_PAGE_COUNT &&
<Pagination showQuickJumper onChange={this.onPaginationChange} current={pageCount} total={total_count} pageSize={10}/> <Pagination showQuickJumper onChange={this.onPaginationChange} current={pageCount} total={total_count} pageSize={10}/>
} }
<div className="writeCommentBtn" onClick={this.showCommentInput}>写评论</div> {!isCourseEnd && <div className="writeCommentBtn" onClick={this.showCommentInput}>写评论</div>}
</div> </div>
</div> </div>

@ -327,6 +327,7 @@ class Boards extends Component{
} }
render(){ render(){
const isAdmin = this.props.isAdmin() const isAdmin = this.props.isAdmin()
const isCourseEnd = this.props.isCourseEnd()
const isAdminOrStudent = this.props.isAdminOrStudent() const isAdminOrStudent = this.props.isAdminOrStudent()
let { boardName, searchValue, boards, messages, checkBoxValues, let { boardName, searchValue, boards, messages, checkBoxValues,
checkAllValue, pagination, sort_type, parent_id } = this.state; checkAllValue, pagination, sort_type, parent_id } = this.state;
@ -350,9 +351,9 @@ class Boards extends Component{
searchPlaceholder={ '请输入帖子名称进行搜索' } searchPlaceholder={ '请输入帖子名称进行搜索' }
firstRowRight={ firstRowRight={
<React.Fragment> <React.Fragment>
{ isAdmin && !parent_id && <WordsBtn style="blue" className="mr30" onClick={()=>this.addDir()}>添加目录</WordsBtn> } { !isCourseEnd && isAdmin && !parent_id && <WordsBtn style="blue" className="mr30" onClick={()=>this.addDir()}>添加目录</WordsBtn> }
{ isAdmin && !!parent_id && <WordsBtn style="blue" className="mr30" onClick={()=>this.renameDir()}>目录重命名</WordsBtn> } { isAdmin && !!parent_id && <WordsBtn style="blue" className="mr30" onClick={()=>this.renameDir()}>目录重命名</WordsBtn> }
{ isAdminOrStudent && <WordsBtn style="blue" className="" onClick={()=>this.onToBoardsNew()}>我要发贴</WordsBtn> } { !isCourseEnd && isAdminOrStudent && <WordsBtn style="blue" className="" onClick={()=>this.onToBoardsNew()}>我要发贴</WordsBtn> }
</React.Fragment> </React.Fragment>
} }
secondRowLeft={ secondRowLeft={

@ -426,7 +426,7 @@ class CoursesBanner extends Component {
render() { render() {
let { Addcoursestypes, coursedata,excellent, modalsType, modalsTopval, loadtype,modalsBottomval,antIcon,is_guide,AccountProfiletype} = this.state; let { Addcoursestypes, coursedata,excellent, modalsType, modalsTopval, loadtype,modalsBottomval,antIcon,is_guide,AccountProfiletype} = this.state;
const isCourseEnd = this.props.isCourseEnd()
return ( return (
<div> <div>
{ {
@ -714,24 +714,24 @@ class CoursesBanner extends Component {
position: "relative" position: "relative"
}} }}
> >
<li className={"mt7 mr10im"}> {!isCourseEnd && <li className={"mt7 mr10im"}>
<a onClick={()=>this.addTeacher(true)}> <a onClick={()=>this.addTeacher(true)}>
<span className="color-white fl font-16 bannerurli width100f">添加老师</span> <span className="color-white fl font-16 bannerurli width100f">添加老师</span>
</a> </a>
</li> </li>}
<li className={"mt7 mr10im"}> {!isCourseEnd && <li className={"mt7 mr10im"}>
<a onClick={()=>this.addTeacher(false)}> <a onClick={()=>this.addTeacher(false)}>
<span className="color-white fl font-16 bannerurli width100f">添加助教</span> <span className="color-white fl font-16 bannerurli width100f">添加助教</span>
</a> </a>
</li> </li>}
<li className={"mt7 mr10im"}> {!isCourseEnd && <li className={"mt7 mr10im"}>
<a onClick={()=>this.addStudent()}> <a onClick={()=>this.addStudent()}>
<span className={"color-white fl font-16 bannerurli width100f"}>添加学生</span> <span className={"color-white fl font-16 bannerurli width100f"}>添加学生</span>
</a> </a>
</li> </li>}
{excellent===false? {excellent===false?
<li className={"mt7 mr10im ml10"} style={{overflow:"hidden"}}> <li className={"mt7 mr10im ml10"} style={{overflow:"hidden"}}>
<a> <a>

@ -497,6 +497,7 @@ class studentsList extends Component{
render(){ render(){
const isAdmin = this.props.isAdmin() const isAdmin = this.props.isAdmin()
const isSuperAdmin = this.props.isSuperAdmin() const isSuperAdmin = this.props.isSuperAdmin()
const isCourseEnd = this.props.isCourseEnd()
let { let {
page, page,
@ -591,7 +592,7 @@ class studentsList extends Component{
></CreateGroupByImportModal> ></CreateGroupByImportModal>
<WordsBtn style="blue" className="mr30" onClick={()=> this.refs['createGroupByImportModal'].setVisible(true)}>导入创建分班</WordsBtn> <WordsBtn style="blue" className="mr30" onClick={()=> this.refs['createGroupByImportModal'].setVisible(true)}>导入创建分班</WordsBtn>
</React.Fragment> } </React.Fragment> }
{ isAdmin && isParent && <WordsBtn style="blue" className="mr30" onClick={()=>this.addDir()}>添加分班</WordsBtn> } { !isCourseEnd && isAdmin && isParent && <WordsBtn style="blue" className="mr30" onClick={()=>this.addDir()}>添加分班</WordsBtn> }
{ isAdmin && !isParent && course_group_id != 0 && <WordsBtn style="blue" className="mr30" onClick={()=>this.deleteDir()}>删除分班</WordsBtn> } { isAdmin && !isParent && course_group_id != 0 && <WordsBtn style="blue" className="mr30" onClick={()=>this.deleteDir()}>删除分班</WordsBtn> }
{ isAdmin && !isParent && course_group_id != 0 && <WordsBtn style="blue" className="mr30" onClick={()=>this.renameDir()}>分班重命名</WordsBtn> } { isAdmin && !isParent && course_group_id != 0 && <WordsBtn style="blue" className="mr30" onClick={()=>this.renameDir()}>分班重命名</WordsBtn> }
<style>{` <style>{`

@ -244,6 +244,10 @@ export function TPMIndexHOC(WrappedComponent) {
return this.state.coursedata&&this.state.coursedata.course_identity >= 6 return this.state.coursedata&&this.state.coursedata.course_identity >= 6
} }
isCourseEnd = () => {
return this.state.current_user ? this.state.current_user.course_is_end : false
}
// setTrialapplication = ()=>{ // setTrialapplication = ()=>{
// this.setState({ // this.setState({
// isRenders:true // isRenders:true
@ -411,6 +415,8 @@ export function TPMIndexHOC(WrappedComponent) {
isStudent: this.isStudent, isStudent: this.isStudent,
isAdminOrStudent: this.isAdminOrStudent, isAdminOrStudent: this.isAdminOrStudent,
isNotMember: this.isNotMember, isNotMember: this.isNotMember,
isCourseEnd: this.isCourseEnd,
isUserid:this.state.coursedata&&this.state.coursedata.userid, isUserid:this.state.coursedata&&this.state.coursedata.userid,
fetchUser: this.fetchUser, fetchUser: this.fetchUser,

@ -15,7 +15,7 @@ import axios from 'axios';
import './css/TPMsettings.css'; import './css/TPMsettings.css';
import { getImageUrl, toPath, getUrl ,appendFileSizeToUploadFileAll} from 'educoder'; import { getImageUrl, toPath, getUrl ,appendFileSizeToUploadFileAll, getUploadActionUrl} from 'educoder';
let origin = getUrl(); let origin = getUrl();
@ -1372,15 +1372,18 @@ export default class TPMsettings extends Component {
}) })
} }
handleChange = (info) => { handleChange = (info) => {
let {fileList}=this.state;
if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') { if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') {
console.log("handleChange1"); console.log("handleChange1");
let {fileList}=this.state;
if(fileList.length===0){ // if(fileList.length===0){
let fileLists = info.fileList; let fileLists = info.fileList;
this.setState({ fileList:fileLists, this.setState({ fileList:fileLists,
deleteisnot:false}); deleteisnot:false});
} // }
} }
} }
@ -1497,10 +1500,13 @@ export default class TPMsettings extends Component {
// https://github.com/ant-design/ant-design/issues/15505 // https://github.com/ant-design/ant-design/issues/15505
// showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。 // showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。
// showUploadList: false, // showUploadList: false,
action: `${getUrl()}/api/attachments.json`, action: `${getUploadActionUrl()}`,
onChange: this.handleChange, onChange: this.handleChange,
onRemove: this.onAttachmentRemove, onRemove: this.onAttachmentRemove,
beforeUpload: (file) => { beforeUpload: (file, fileList) => {
if (this.state.fileList.length >= 1) {
return false
}
// console.log('beforeUpload', file.name); // console.log('beforeUpload', file.name);
const isLt150M = file.size / 1024 / 1024 < 50; const isLt150M = file.size / 1024 / 1024 < 50;
if (!isLt150M) { if (!isLt150M) {

@ -2,7 +2,7 @@ import React, {Component} from 'react';
import {TPMIndexHOC} from '../TPMIndexHOC'; import {TPMIndexHOC} from '../TPMIndexHOC';
import {SnackbarHOC,appendFileSizeToUploadFileAll} from 'educoder'; import {SnackbarHOC,appendFileSizeToUploadFileAll, getUploadActionUrl} from 'educoder';
import {Input, Select, Radio, Checkbox, Modal, Icon, DatePicker,Upload,Button,message,Form,notification,Tooltip} from 'antd'; import {Input, Select, Radio, Checkbox, Modal, Icon, DatePicker,Upload,Button,message,Form,notification,Tooltip} from 'antd';
@ -757,19 +757,19 @@ class Newshixuns extends Component {
}) })
} }
// 附件相关 START // 附件相关 START
handleChange = (info) => { handleChange = (info) => {
let {fileList}=this.state;
if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') { if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') {
let {fileList}=this.state;
console.log("handleChange1"); console.log("handleChange1");
if(fileList.length===0){ // if(fileList.length===0){
let fileLists = info.fileList; let fileLists = info.fileList;
this.setState({ this.setState({
// fileList:appendFileSizeToUploadFileAll(fileList), // fileList:appendFileSizeToUploadFileAll(fileList),
fileList:fileLists, fileList:fileLists,
deleteisnot:false}); deleteisnot:false});
} // }
} }
} }
@ -872,10 +872,14 @@ class Newshixuns extends Component {
// https://github.com/ant-design/ant-design/issues/15505 // https://github.com/ant-design/ant-design/issues/15505
// showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。 // showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。
// showUploadList: false, // showUploadList: false,
action: `${getUrl()}/api/attachments.json`, action: `${getUploadActionUrl()}`,
onChange: this.handleChange, onChange: this.handleChange,
onRemove: this.onAttachmentRemove, onRemove: this.onAttachmentRemove,
beforeUpload: (file) => { beforeUpload: (file, fileList) => {
if (this.state.fileList.length >= 1) {
return false
}
// console.log('beforeUpload', file.name); // console.log('beforeUpload', file.name);
const isLt150M = file.size / 1024 / 1024 < 50; const isLt150M = file.size / 1024 / 1024 < 50;
if (!isLt150M) { if (!isLt150M) {

Loading…
Cancel
Save