From 199bb1862f45da260a5ed15002c5abc44f53a294 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Thu, 22 Aug 2019 14:24:00 +0800 Subject: [PATCH 01/52] =?UTF-8?q?=E4=BD=BF=E7=94=A8downloadFile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/common/TextUtil.js | 4 ++-- .../src/modules/courses/members/studentsList.js | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/public/react/src/common/TextUtil.js b/public/react/src/common/TextUtil.js index 4c83131f1..013ea2a8f 100644 --- a/public/react/src/common/TextUtil.js +++ b/public/react/src/common/TextUtil.js @@ -1,4 +1,4 @@ -import { bytesToSize, getUrl2 } from 'educoder'; +import { bytesToSize, getUrl, getUrl2 } from 'educoder'; const $ = window.$ export function isImageExtension(fileName) { @@ -40,7 +40,7 @@ export function markdownToHTML(oldContent, selector) { } } function _doDownload(options) { - $.fileDownload("/api" + options.url, { + $.fileDownload(getUrl() + "/api" + options.url, { successCallback: options.successCallback, failCallback: options.failCallback }); diff --git a/public/react/src/modules/courses/members/studentsList.js b/public/react/src/modules/courses/members/studentsList.js index 2a510789e..5ec3acab5 100644 --- a/public/react/src/modules/courses/members/studentsList.js +++ b/public/react/src/modules/courses/members/studentsList.js @@ -8,7 +8,7 @@ import CourseLayoutcomponent from '../common/CourseLayoutComponent' import Titlesearchsection from '../common/titleSearch/TitleSearchSection' import ColorCountText from '../common/titleSearch/ColorCountText' -import { WordsBtn, trigger, on, off } from 'educoder' +import { WordsBtn, trigger, on, off, getUrl, downloadFile } from 'educoder' import Modals from "../../modals/Modals"; import axios from 'axios' import _ from 'lodash' @@ -150,7 +150,19 @@ class studentsList extends Component{ } }else { this.props.showNotification(`正在下载中`); - window.open("/api"+url, '_blank'); + + // getUrl() + "/api"+ + const fileUrl = url; + downloadFile({ + url: fileUrl, + successCallback: (url) => { + console.log('successCallback') + }, + failCallback: (responseHtml, url) => { + console.log('failCallback') + } + }) + // window.open(fileUrl, "_self");// , '_blank' } }).catch((error) => { console.log(error) From bae43137a537ecc503caf6d53af59d7d887f9c13 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Thu, 22 Aug 2019 15:26:12 +0800 Subject: [PATCH 02/52] slowdownload --- public/react/src/common/UrlTool.js | 8 +++++ .../modules/courses/members/studentsList.js | 4 +++ public/react/src/modules/tpm/TPMIndexHOC.js | 33 ++++++++++++++++--- 3 files changed, 41 insertions(+), 4 deletions(-) diff --git a/public/react/src/common/UrlTool.js b/public/react/src/common/UrlTool.js index fc2100694..aeb9a8d62 100644 --- a/public/react/src/common/UrlTool.js +++ b/public/react/src/common/UrlTool.js @@ -37,6 +37,14 @@ export function getUrl(path, goTest) { } return `${path ? path: ''}`; } +export function getStaticUrl() { + const local = TEST_HOST; + if (isDev) { + return local + } + // todo cdn + return '' +} export function getUrl2(path, goTest) { const local = 'http://localhost:3000' if (isDev) { diff --git a/public/react/src/modules/courses/members/studentsList.js b/public/react/src/modules/courses/members/studentsList.js index 5ec3acab5..76112692a 100644 --- a/public/react/src/modules/courses/members/studentsList.js +++ b/public/react/src/modules/courses/members/studentsList.js @@ -153,6 +153,10 @@ class studentsList extends Component{ // getUrl() + "/api"+ const fileUrl = url; + + this.props.slowDownload(fileUrl) + return; + downloadFile({ url: fileUrl, successCallback: (url) => { diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js index 6149687bc..820451525 100644 --- a/public/react/src/modules/tpm/TPMIndexHOC.js +++ b/public/react/src/modules/tpm/TPMIndexHOC.js @@ -5,9 +5,9 @@ import PropTypes from 'prop-types'; import NewHeader from './NewHeader' import NewFooter from './NewFooter' import SiderBar from './SiderBar' -import { getUrl } from 'educoder' +import { getUrl, downloadFile } from 'educoder' import axios from 'axios'; - +import { Spin } from 'antd' import './TPMIndex.css' import LoginDialog from '../login/LoginDialog'; import AccountProfile from '../user/AccountProfile'; @@ -79,7 +79,9 @@ export function TPMIndexHOC(WrappedComponent) { coursedata: {}, isRender: false, - AccountProfiletype: false + AccountProfiletype: false, + + slowDownloading: false } } @@ -364,6 +366,22 @@ export function TPMIndexHOC(WrappedComponent) { DownloadOpenPdf=(type,url)=>{ type===true?window.open(url):window.location.href=url; } + slowDownload = (url, tip) => { + this._slowDownloadTip = tip || '正在生成文件,请稍后...'; + this.setState({ slowDownloading: true }) + const fileUrl = url; + downloadFile({ + url: fileUrl, + successCallback: (url) => { + this.setState({ slowDownloading: false }) + console.log('successCallback') + }, + failCallback: (responseHtml, url) => { + this.setState({ slowDownloading: false }) + console.log('failCallback') + } + }) + } render() { let{Headertop,Footerdown, isRender, AccountProfiletype}=this.state; const common = { @@ -387,7 +405,9 @@ export function TPMIndexHOC(WrappedComponent) { ShowOnlinePdf:(url)=>this.ShowOnlinePdf(url), DownloadFileA:(title,url)=>this.DownloadFileA(title,url), - DownloadOpenPdf:(type,url)=>this.DownloadOpenPdf(type,url) + DownloadOpenPdf:(type,url)=>this.DownloadOpenPdf(type,url), + + slowDownload: this.slowDownload } return (
参考答案:
{ questionType.standard_answer && questionType.standard_answer.map((item,k)=>{ diff --git a/public/react/src/modules/courses/exercise/question/simpleAnswer.js b/public/react/src/modules/courses/exercise/question/simpleAnswer.js index 527044968..1dfcbdb2a 100644 --- a/public/react/src/modules/courses/exercise/question/simpleAnswer.js +++ b/public/react/src/modules/courses/exercise/question/simpleAnswer.js @@ -85,9 +85,9 @@ class simpleAnswer extends Component{参考答案:
+参考答案:
{/* */}{item.question.question_number}、{map[item.question.question_type]} { item.question.is_necessary==1 ? 必答:选答 } - { item.question.question_type == 2 && item.question.min_choices && item.question.max_choices ? + { item.question.question_type == 2 && item.question.min_choices != undefined && item.question.min_choices != null && item.question.max_choices != undefined && item.question.max_choices != null ? { item.question.min_choices == item.question.max_choices ? "可选"+item.question.max_choices+"项" : From 4f703146113ec7b99b5d620d3bf0a5a487909768 Mon Sep 17 00:00:00 2001 From: caicai8 <1149225589@qq.com> Date: Thu, 29 Aug 2019 18:43:35 +0800 Subject: [PATCH 22/52] =?UTF-8?q?=E9=97=AE=E5=8D=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/courses/poll/PollListItem.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/poll/PollListItem.js b/public/react/src/modules/courses/poll/PollListItem.js index eda994a9a..eb5766362 100644 --- a/public/react/src/modules/courses/poll/PollListItem.js +++ b/public/react/src/modules/courses/poll/PollListItem.js @@ -54,7 +54,7 @@ class PollListItem extends Component{ }
- { item.author && {item.author} }
+ { item.author && {item.author} }
{
item.polls_status !=1 &&
From 8d97bbfbfa5e4d8a1bcb72b496e1e5b9c3c465e3 Mon Sep 17 00:00:00 2001
From: SylorHuang "+e+"
') { out+=this.options.sanitize?escape(cap[0]):cap[0]; }
+ */
+/**
+ * marked - a markdown parser
+ * Copyright (c) 2011-2018, Christopher Jeffrey. (MIT Licensed)
+ * https://github.com/markedjs/marked
+ 2019 08 29
+
+ case"html":return this.renderer.html((this.token.text));
+ -->
+ case"html":return this.renderer.paragraph(this.inline.output(this.token.text));
+
+ add: && !(e instanceof String)
+ */
+!function(e){"use strict";var x={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}|~{3,})([^`~\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|\\n*|\\n*|?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:g,table:g,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};function a(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||k.defaults,this.rules=x.normal,this.options.pedantic?this.rules=x.pedantic:this.options.gfm&&(this.rules=x.gfm)}x._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,x._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,x.def=i(x.def).replace("label",x._label).replace("title",x._title).getRegex(),x.bullet=/(?:[*+-]|\d{1,9}\.)/,x.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,x.item=i(x.item,"gm").replace(/bull/g,x.bullet).getRegex(),x.list=i(x.list).replace(/bull/g,x.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+x.def.source+")").getRegex(),x._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",x._comment=//,x.html=i(x.html,"i").replace("comment",x._comment).replace("tag",x._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),x.paragraph=i(x._paragraph).replace("hr",x.hr).replace("heading"," {0,3}#{1,6} +").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}|~{3,})[^`\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",x._tag).getRegex(),x.blockquote=i(x.blockquote).replace("paragraph",x.paragraph).getRegex(),x.normal=f({},x),x.gfm=f({},x.normal,{nptable:/^ *([^|\n ].*\|.*)\n *([-:]+ *\|[-| :]*)(?:\n((?:.*[^>\n ].*(?:\n|$))*)\n*|$)/,table:/^ *\|(.+)\n *\|?( *[-:]+[-| :]*)(?:\n((?: *[^>\n ].*(?:\n|$))*)\n*|$)/}),x.pedantic=f({},x.normal,{html:i("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?\\1> *(?:\\n{2,}|\\s*$)| ?/gm,""),this.token(s,t),this.tokens.push({type:"blockquote_end"});else if(s=this.rules.list.exec(e)){for(e=e.substring(s[0].length),a={type:"list_start",ordered:d=1<(i=s[2]).length,start:d?+i:"",loose:!1},this.tokens.push(a),n=!(h=[]),f=(s=s[0].match(this.rules.item)).length,c=0;c'+(n?e:_(e,!0))+"
\n":"
"},r.prototype.blockquote=function(e){return""+(n?e:_(e,!0))+"
\n"+e+"
\n"},r.prototype.html=function(e){return e},r.prototype.heading=function(e,t,n,r){return this.options.headerIds?"
\n":"
\n"},r.prototype.list=function(e,t,n){var r=t?"ol":"ul";return"<"+r+(t&&1!==n?' start="'+n+'"':"")+">\n"+e+""+r+">\n"},r.prototype.listitem=function(e){return"\n\n"+e+"\n"+t+"
\n"},r.prototype.tablerow=function(e){return"\n"+e+" \n"},r.prototype.tablecell=function(e,t){var n=t.header?"th":"td";return(t.align?"<"+n+' align="'+t.align+'">':"<"+n+">")+e+""+n+">\n"},r.prototype.strong=function(e){return""+e+""},r.prototype.em=function(e){return""+e+""},r.prototype.codespan=function(e){return""+e+"
"},r.prototype.br=function(){return this.options.xhtml?"
":"
"},r.prototype.del=function(e){return""+e+""},r.prototype.link=function(e,t,n){if(null===(e=l(this.options.sanitize,this.options.baseUrl,e)))return n;var r='"+n+""},r.prototype.image=function(e,t,n){if(null===(e=l(this.options.sanitize,this.options.baseUrl,e)))return n;var r='":">"},r.prototype.text=function(e){return e},s.prototype.strong=s.prototype.em=s.prototype.codespan=s.prototype.del=s.prototype.text=function(e){return e},s.prototype.link=s.prototype.image=function(e,t,n){return""+n},s.prototype.br=function(){return""},h.parse=function(e,t){return new h(t).parse(e)},h.prototype.parse=function(e){this.inline=new p(e.links,this.options),this.inlineText=new p(e.links,f({},this.options,{renderer:new s})),this.tokens=e.reverse();for(var t="";this.next();)t+=this.tok();return t},h.prototype.next=function(){return this.token=this.tokens.pop(),this.token},h.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0},h.prototype.parseText=function(){for(var e=this.token.text;"text"===this.peek().type;)e+="\n"+this.next().text;return this.inline.output(e)},h.prototype.tok=function(){switch(this.token.type){case"space":return"";case"hr":return this.renderer.hr();case"heading":return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,c(this.inlineText.output(this.token.text)),this.slugger);case"code":return this.renderer.code(this.token.text,this.token.lang,this.token.escaped);case"table":var e,t,n,r,s="",i="";for(n="",e=0;e
"+_(e.message+"",!0)+"";throw e}}g.exec=g,k.options=k.setOptions=function(e){return f(k.defaults,e),k},k.getDefaults=function(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:new r,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,xhtml:!1}},k.defaults=k.getDefaults(),k.Parser=h,k.parser=h.parse,k.Renderer=r,k.TextRenderer=s,k.Lexer=a,k.lexer=a.lex,k.InlineLexer=p,k.inlineLexer=p.output,k.Slugger=t,k.parse=k,"undefined"!=typeof module&&"object"==typeof exports?module.exports=k:"function"==typeof define&&define.amd?define(function(){return k}):e.marked=k}(this||("undefined"!=typeof window?window:global)); \ No newline at end of file From a0bc6db9952f5a439bac76bb4ee27210def3ede5 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Thu, 29 Aug 2019 20:03:24 +0800 Subject: [PATCH 26/52] =?UTF-8?q?=E7=89=88=E6=9C=AC=E9=80=80=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/editormd/lib/marked.min.js | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/public/editormd/lib/marked.min.js b/public/editormd/lib/marked.min.js index 1ba27d2f4..519296797 100644 --- a/public/editormd/lib/marked.min.js +++ b/public/editormd/lib/marked.min.js @@ -1,18 +1,13 @@ -/** +/** + * marked v0.3.3 - a markdown parser + * Copyright (c) 2011-2014, Christopher Jeffrey. (MIT Licensed) + * https://github.com/chjj/marked + 备注,这个改动没启用,只是做个记录: br不转成br 加了个 if (cap[0] != '' && cap[0] != '
'+(n?e:_(e,!0))+"
\n":""+(n?e:_(e,!0))+"
"},r.prototype.blockquote=function(e){return"\n"+e+"\n"},r.prototype.html=function(e){return e},r.prototype.heading=function(e,t,n,r){return this.options.headerIds?"
"+e+"
\n"},r.prototype.table=function(e,t){return t&&(t=""+t+""),""+e+"
"},r.prototype.br=function(){return this.options.xhtml?""+_(e.message+"",!0)+"";throw e}}g.exec=g,k.options=k.setOptions=function(e){return f(k.defaults,e),k},k.getDefaults=function(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:new r,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,xhtml:!1}},k.defaults=k.getDefaults(),k.Parser=h,k.parser=h.parse,k.Renderer=r,k.TextRenderer=s,k.Lexer=a,k.lexer=a.lex,k.InlineLexer=p,k.inlineLexer=p.output,k.Slugger=t,k.parse=k,"undefined"!=typeof module&&"object"==typeof exports?module.exports=k:"function"==typeof define&&define.amd?define(function(){return k}):e.marked=k}(this||("undefined"!=typeof window?window:global)); \ No newline at end of file +(function(){var block={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:noop,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:noop,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,blockquote:/^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,def:/^ *\[([^\]]+)\]: *([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:noop,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/};block.bullet=/(?:[*+-]|\d+\.)/;block.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/;block.item=replace(block.item,"gm")(/bull/g,block.bullet)();block.list=replace(block.list)(/bull/g,block.bullet)("hr","\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))")("def","\\n+(?="+block.def.source+")")();block.blockquote=replace(block.blockquote)("def",block.def)();block._tag="(?!(?:"+"a|em|strong|small|s|cite|q|dfn|abbr|data|time|code"+"|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo"+"|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b";block.html=replace(block.html)("comment",//)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/
"+(escaped?code:escape(code,true))+"\n
"}return''+(escaped?code:escape(code,true))+"\n
\n"};Renderer.prototype.blockquote=function(quote){return"\n"+quote+"\n"};Renderer.prototype.html=function(html){return html};Renderer.prototype.heading=function(text,level,raw){return"
"+text+"
\n"};Renderer.prototype.table=function(header,body){return""+text+"
"};Renderer.prototype.br=function(){return this.options.xhtml?""+escape(e.message+"",true)+""}throw e}}marked.options=marked.setOptions=function(opt){merge(marked.defaults,opt);return marked};marked.defaults={gfm:true,tables:true,breaks:false,pedantic:false,sanitize:false,smartLists:false,silent:false,highlight:null,langPrefix:"lang-",smartypants:false,headerPrefix:"",renderer:new Renderer,xhtml:false};marked.Parser=Parser;marked.parser=Parser.parse;marked.Renderer=Renderer;marked.Lexer=Lexer;marked.lexer=Lexer.lex;marked.InlineLexer=InlineLexer;marked.inlineLexer=InlineLexer.output;marked.parse=marked;if(typeof module!=="undefined"&&typeof exports==="object"){module.exports=marked}else{if(typeof define==="function"&&define.amd){define(function(){return marked})}else{this.marked=marked}}}).call(function(){return this||(typeof window!=="undefined"?window:global)}()); \ No newline at end of file From bdf284f5568c375eaafcdfd2528cdee8f385c557 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Fri, 30 Aug 2019 08:48:19 +0800 Subject: [PATCH 27/52] =?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/modules/modals/SendTopics.js | 232 +++++++----------- .../src/modules/user/usersInfo/InfosTopics.js | 101 ++++++-- .../user/usersInfo/Withoutpermission.png | Bin 0 -> 8051 bytes .../src/modules/user/usersInfo/usersInfo.css | 21 ++ 4 files changed, 182 insertions(+), 172 deletions(-) create mode 100755 public/react/src/modules/user/usersInfo/Withoutpermission.png diff --git a/public/react/src/modules/modals/SendTopics.js b/public/react/src/modules/modals/SendTopics.js index 013988d93..6e53a716f 100644 --- a/public/react/src/modules/modals/SendTopics.js +++ b/public/react/src/modules/modals/SendTopics.js @@ -1,158 +1,100 @@ import React,{ Component } from "react"; import { Modal,Radio,Input,Tooltip,Checkbox,Select, Row,Col } from "antd"; import axios from 'axios'; -import { SnackbarHOC } from 'educoder'; -import Modals from './Modals'; const { Search } = Input; class SendTopics extends Component{ constructor(props){ super(props); this.state={ - sentShixunPath:false, - sendToCourseList:undefined, - openSearch:false, - sendToCourseId:undefined, - sendToShixunArray:[], - Modalstype:false, - cardsModalcancel:this.cardsModalcancel, - cardsModalsave:this.cardsModalsave, - modalsTopval:'', - Modalsbottomval:'', - courseurl:'' + courses:[], + search:null, + Radiolist:undefined, + showcheck:false } } - //发送至 - SentToLesson =() =>{ - let id=this.props.detailInfoList.id; - let url="/paths/"+id+"/choose_course.json"; - axios.get(url).then((result)=>{ - if(result.status==200){ - if (result.data.status === 403||result.data.status === 402||result.data.status === 407||result.data.status === 408) { - }else{ - this.setState({ - sendToCourseList:result.data, - sentShixunPath:true - }) - } + componentDidMount(){ + let{search}=this.state; + this.onupdatalist(search) + } + onupdatalist=(search)=>{ + let url="/question_banks/my_courses.json"; + axios.get(url,{params:{ + search } + }).then((result)=>{ + this.setState({ + courses:result.data.courses + }) }).catch((error)=>{ console.log(error); }) - // this.setState({ - // sentShixunPath:true - // }) - } - //隐藏发送至弹框 - hideSenttothevalue =()=>{ - this.setState({ - sentShixunPath:false, - sendToShixunArray:[], - sendToCourseId:undefined, - }) - this.props.topicscancelmodel() - } - //打开课堂列表下拉框 - openList=()=>{ - this.setState({ - openSearch:true - }) - } - //关闭课堂列表下拉框 - closeList=()=>{ - this.setState({ - openSearch:false - }) - } - - // 选择课堂获取选中的Id - selectCloseList=(e)=>{ - this.setState({ - openSearch:false, - sendToCourseId:e - }) - } + } - //选择checkbox - changeCheckBoxs=(list)=>{ - this.setState({ - sendToShixunArray:list, - // shixunNum:list.length - }) - } - - //确认提交 - submitInfo=()=>{ - let {sendToCourseId,sendToShixunArray}=this.state; - if(sendToCourseId===undefined){ - this.props.showSnackbar("您还未选择发送的课堂"); - }else if(parseInt(sendToShixunArray.length)==0){ - this.props.showSnackbar("您还未选择实训"); - }else{ - let id=this.props.detailInfoList.id; - let url="/paths/"+id+"/send_to_course.json"; - axios.post(url,{ - shixun_ids:sendToShixunArray, - course_id:sendToCourseId - }).then((result)=>{ - if(result.data.status===1){ - this.setState({ - Modalstype:true, - sentShixunPath:false, - Modalstopval:result.data.message, - courseurl:result.data.url, - sendToShixunArray:[], - sendToCourseId:undefined, - }) - } - }).catch((error)=>{ - console.log(error); - }) - } - } + onSearchChange=(e)=>{ + this.setState({ + search:e.target.value + }) + // this.onupdatalist(e.target.value) + } - componentDidMount(){ - // let id=this.props.detailInfoList.id; - // let url="/paths/"+id+"/choose_course.json"; - // axios.get(url).then((result)=>{ - // if(result.status==200){ - // this.setState({ - // sendToCourseList:result.data - // }) - // } - // }).catch((error)=>{ - // console.log(error); - // }) - } + onSearch=(search)=>{ + this.onupdatalist(search) + } - cardsModalcancel=()=>{ - this.setState({ - Modalstype:false, - }) - } - cardsModalsave=()=>{ - let {courseurl}=this.state; - window.location.href =courseurl; - } + onChange=(e)=>{ + this.setState({ + Radiolist:e.target.value + }) + } + submitInfo=()=>{ + let{Radiolist}=this.state; + let url=`/question_banks/send_to_course.json`; + let object_id=this.props.checkBoxValues; + let object_type=this.props.category; + if(Radiolist===undefined){ + this.setState({ + showcheck:true + }) + }else{ + axios.post(url,{ + object_id: object_id, + object_type:object_type, + course_id:Radiolist + } + ).then((result)=>{ + if(result.data.status===0){ + this.props.updataslist() + this.props.topicscancelmodel() + this.props.showNotification(result.data.message) + }else{ + this.props.showNotification(result.data.message) + } + }).catch((error)=>{ + console.log(error) + }) + } + + } render(){ - let{sentShixunPath,sendToCourseList,Modalstype,Modalstopval,Modalsbottomval,cardsModalcancel,cardsModalsave}= this.state; + let{courses,Radiolist,showcheck}= this.state; + + const radioStyle = { + display: 'block', + height: '30px', + lineHeight: '30px', + }; + return(