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

topic_bank
cxt 5 years ago
commit ae29f70a14

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

@ -776,6 +776,10 @@ Rails.application.routes.draw do
end end
post 'callbacks/aliyun_vod', to: 'callbacks/aliyun_vods#create' post 'callbacks/aliyun_vod', to: 'callbacks/aliyun_vods#create'
namespace :wechats do
resource :js_sdk_signature, only: [:create]
end
end end
namespace :admins do namespace :admins do
@ -884,10 +888,6 @@ Rails.application.routes.draw do
end end
end end
namespace :wechats do
resource :js_sdk_signature, only: [:create]
end
#git 认证回调 #git 认证回调
match 'gitauth/*url', to: 'gits#auth', via: :all match 'gitauth/*url', to: 'gits#auth', via: :all

@ -1,3 +1,6 @@
export function isDev() { export function isDev() {
return window.location.port === "3007"; return window.location.port === "3007";
} }
// const isMobile
export const isMobile = (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));

@ -20,8 +20,7 @@ export { markdownToHTML, uploadNameSizeSeperator, appendFileSizeToUploadFile, ap
downloadFile, sortDirections } from './TextUtil' downloadFile, sortDirections } from './TextUtil'
export { handleDateString, getNextHalfHourOfMoment,formatDuring } from './DateUtil' export { handleDateString, getNextHalfHourOfMoment,formatDuring } from './DateUtil'
export { isDev as isDev, isMobile } from './Env'
export { isDev as isDev } from './Env'
export { toStore as toStore, fromStore as fromStore } from './Store' export { toStore as toStore, fromStore as fromStore } from './Store'

@ -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={

@ -646,7 +646,7 @@ render(){
{/*<span className="color-grey-9 ml3 mr3">&gt;</span>*/} {/*<span className="color-grey-9 ml3 mr3">&gt;</span>*/}
{/*</WordsBtn>*/} {/*</WordsBtn>*/}
<span>{`${current_user ? current_user.username : ''} ${ this.isEdit ? '编辑' : '提交'}作品` }</span> <span>{`${current_user ? current_user.real_name : ''} ${ this.isEdit ? '编辑' : '提交'}作品` }</span>
</p> </p>
<div style={{ width:'100%',height:'75px'}} > <div style={{ width:'100%',height:'75px'}} >

@ -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>
{ {
@ -625,7 +625,7 @@ class CoursesBanner extends Component {
) )
: ""} : ""}
{this.props.isStudent()?<a className="fr user_default_btn user_blue_btn mr20 font-18" {this.props.isStudent()?this.props.current_user&&this.props.current_user.course_is_end===true?"":<a className="fr user_default_btn user_blue_btn mr20 font-18"
onClick={() => this.exitclass()} onClick={() => this.exitclass()}
> 退出课堂 </a>:""} > 退出课堂 </a>:""}
@ -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>

@ -619,7 +619,7 @@ class GraduationTasksSubmitedit extends Component{
{/*<Link to={"/courses/"+courseId+"/graduation/graduation_tasks/"+category_id} className="color-grey-6">{workslist&&workslist.task_name}</Link>*/} {/*<Link to={"/courses/"+courseId+"/graduation/graduation_tasks/"+category_id} className="color-grey-6">{workslist&&workslist.task_name}</Link>*/}
{/*<span className="color-grey-9 ml3 mr3">&gt;</span>*/} {/*<span className="color-grey-9 ml3 mr3">&gt;</span>*/}
{/*</WordsBtn>*/} {/*</WordsBtn>*/}
<span>{this.props.user&&this.props.user.username} 修改作品</span> <span>{this.props.current_user&&this.props.current_user.real_name} 修改作品</span>
</p> </p>
<div style={{ width:'100%',height:'75px'}} > <div style={{ width:'100%',height:'75px'}} >

@ -552,7 +552,7 @@ render(){
}, },
}; };
// console.log(this.props) console.log(this.props)
@ -601,7 +601,7 @@ render(){
{/*<Link to={"/courses/"+courseId+"/graduation/graduation_tasks/"+category_id} className="color-grey-6">{workslist&&workslist.task_name}</Link>*/} {/*<Link to={"/courses/"+courseId+"/graduation/graduation_tasks/"+category_id} className="color-grey-6">{workslist&&workslist.task_name}</Link>*/}
{/*<span className="color-grey-9 ml3 mr3">&gt;</span>*/} {/*<span className="color-grey-9 ml3 mr3">&gt;</span>*/}
{/*</WordsBtn>*/} {/*</WordsBtn>*/}
<span>{this.props.user&&this.props.user.username} 提交作品</span> <span>{this.props.current_user&&this.props.current_user.real_name} 提交作品</span>
</p> </p>
<div style={{ width:'100%',height:'75px'}} > <div style={{ width:'100%',height:'75px'}} >

@ -29,7 +29,7 @@ class AddStudentModal extends Component{
const { name, school_name } = this.state const { name, school_name } = this.state
let url = `/courses/${courseId}/search_users.json?page=${page}&limit=${pageCount}&school_name=${school_name || ''}&name=${name || ''}` let url = `/courses/${courseId}/search_users.json?page=${page}&limit=${pageCount}&school_name=${school_name || ''}&name=${name || ''}`
this.setState({ loading: true }) this.setState({ loading: true })
axios.get(url) axios.get(encodeURI(url))
.then((response) => { .then((response) => {
if (!response.data.users || response.data.users.length == 0) { if (!response.data.users || response.data.users.length == 0) {
this.setState({ this.setState({

@ -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>{`

@ -377,7 +377,7 @@ class studentsList extends Component{
if(searchValue!=""){ if(searchValue!=""){
url+='&search='+searchValue; url+='&search='+searchValue;
} }
const result = await axios.get(url) const result = await axios.get(encodeURI(url))
// axios.get((url)).then((result)=>{ // axios.get((url)).then((result)=>{
if (result.data.teacher_list) { if (result.data.teacher_list) {
this.setState({ this.setState({

@ -2499,6 +2499,8 @@ class Listofworksstudentone extends Component {
// console.log(data); // console.log(data);
// console.log(datas); // console.log(datas);
// console.log(this.props.isAdmin()); // console.log(this.props.isAdmin());
let course_is_end = this.props.current_user&&this.props.current_user.course_is_end;
return ( return (
this.props.isAdmin() === true ? this.props.isAdmin() === true ?
( (
@ -2639,7 +2641,7 @@ class Listofworksstudentone extends Component {
<ul className="clearfix" style={{padding: '20px 15px 10px 20px'}}> <ul className="clearfix" style={{padding: '20px 15px 10px 20px'}}>
<li className="clearfix "> <li className="clearfix ">
<span className="fl mr10 color-grey-6 ">计算成绩时间{teacherdata&&teacherdata.calculation_time==null?"--": moment(teacherdata&&teacherdata.calculation_time).format('YYYY-MM-DD HH:mm')}</span> <span className="fl mr10 color-grey-6 ">计算成绩时间{teacherdata&&teacherdata.calculation_time==null?"--": moment(teacherdata&&teacherdata.calculation_time).format('YYYY-MM-DD HH:mm')}</span>
<span> {course_is_end===true?<span>
{teacherdata&&teacherdata.publish_immediately===false&&computeTimetype===true? {teacherdata&&teacherdata.publish_immediately===false&&computeTimetype===true?
(this.props.isNotMember()===false?<div className={"computeTime font-13"} onClick={this.setComputeTimet}> (this.props.isNotMember()===false?<div className={"computeTime font-13"} onClick={this.setComputeTimet}>
计算成绩 计算成绩
@ -2649,7 +2651,7 @@ class Listofworksstudentone extends Component {
计算成绩 计算成绩
</div>:"") </div>:"")
} }
</span> </span>:""}
<div className="fr mr5 search-newysl" style={{marginBottom: '1px'}}> <div className="fr mr5 search-newysl" style={{marginBottom: '1px'}}>
<Search <Search
@ -2944,7 +2946,7 @@ class Listofworksstudentone extends Component {
<div className="fr"> <div className="fr">
<span className="fl mr10 color-grey-6 ">计算成绩时间{teacherdata&&teacherdata.calculation_time==null?"--": moment(teacherdata&&teacherdata.calculation_time).format('YYYY-MM-DD HH:mm')}</span> <span className="fl mr10 color-grey-6 ">计算成绩时间{teacherdata&&teacherdata.calculation_time==null?"--": moment(teacherdata&&teacherdata.calculation_time).format('YYYY-MM-DD HH:mm')}</span>
{teacherdata&&teacherdata.task_operation[0]==="开启挑战"?"":<span> { course_is_end===true?"":teacherdata&&teacherdata.task_operation[0]==="开启挑战"?"":<span>
{computeTimetype===true? {computeTimetype===true?
(this.props.isNotMember()===false? (this.props.isNotMember()===false?
<div className={"computeTime font-13"} onClick={this.setComputeTime}> <div className={"computeTime font-13"} onClick={this.setComputeTime}>
@ -3154,7 +3156,7 @@ class Listofworksstudentone extends Component {
<div className="fr"> <div className="fr">
<span className="fl mr10 color-grey-6 ">计算成绩时间{teacherdata&&teacherdata.calculation_time==null?"--": moment(teacherdata&&teacherdata.calculation_time).format('YYYY-MM-DD HH:mm')}</span> <span className="fl mr10 color-grey-6 ">计算成绩时间{teacherdata&&teacherdata.calculation_time==null?"--": moment(teacherdata&&teacherdata.calculation_time).format('YYYY-MM-DD HH:mm')}</span>
{teacherdata&&teacherdata.task_operation&&teacherdata.task_operation[0]==="开启挑战"?"":<span> { course_is_end===true?"":teacherdata&&teacherdata.task_operation&&teacherdata.task_operation[0]==="开启挑战"?"":<span>
{computeTimetype===true? {computeTimetype===true?
(this.props.isNotMember()===false?<div className={"computeTime font-13"} onClick={this.setComputeTime}> (this.props.isNotMember()===false?<div className={"computeTime font-13"} onClick={this.setComputeTime}>
计算成绩 计算成绩

@ -160,7 +160,7 @@ class DetailCardsEditAndAdd extends Component{
url+="&type="+id; url+="&type="+id;
} }
axios.get(url).then((result)=>{ axios.get(encodeURI(url)).then((result)=>{
if(result.status===200){ if(result.status===200){
this.setState({ this.setState({
ChooseShixunList:result.data, ChooseShixunList:result.data,
@ -322,7 +322,7 @@ class DetailCardsEditAndAdd extends Component{
if(type!=0){ if(type!=0){
url+="&type="+type; url+="&type="+type;
} }
axios.get(url).then((result)=>{ axios.get(encodeURI(url)).then((result)=>{
if(result.status===200){ if(result.status===200){
let list =result.data.shixun_list; let list =result.data.shixun_list;

@ -205,7 +205,7 @@ class TPMBanner extends Component {
SenttotheSearch=(value)=>{ SenttotheSearch=(value)=>{
let id = this.props.match.params.shixunId; let id = this.props.match.params.shixunId;
let url="/shixuns/" + id +"/search_user_courses.json?search="+value; let url="/shixuns/" + id +"/search_user_courses.json?search="+value;
axios.get(url, { axios.get(encodeURI(url), {
params: { params: {
page:1, page:1,
limit:10 limit:10

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