fix build bug

dev_aliyun2
harry 5 years ago
parent 5be361e2ef
commit 6706cb5135

@ -73,4 +73,11 @@ module.exports = override(
}), }),
addWebpackPlugin(new MonacoWebpackPlugin({})), addWebpackPlugin(new MonacoWebpackPlugin({})),
// addWebpackPlugin(instance), // addWebpackPlugin(instance),
(config) => {
config.resolve.plugins = config.resolve.plugins.filter(plugin => !(plugin instanceof ModuleScopePlugin));
if (process.env.NODE_ENV !== "development") {
config.output.publicPath = `/react/build/`;
}
return config
}
); );

@ -2,6 +2,7 @@
"name": "h5", "name": "h5",
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"homepage": "/react/build/",
"dependencies": { "dependencies": {
"@loadable/component": "^5.12.0", "@loadable/component": "^5.12.0",
"@novnc/novnc": "^1.1.0", "@novnc/novnc": "^1.1.0",
@ -90,4 +91,4 @@
"uglifyjs-webpack-plugin": "^2.2.0", "uglifyjs-webpack-plugin": "^2.2.0",
"webpack-bundle-analyzer": "^3.6.0" "webpack-bundle-analyzer": "^3.6.0"
} }
} }

@ -34,8 +34,8 @@
</script> </script>
<link rel="stylesheet" type="text/css" href="/css/css_min_all.css"> <link rel="stylesheet" type="text/css" href="%PUBLIC_URL%/css/css_min_all.css">
<link rel="stylesheet" type="text/css" href="/css/iconfont.css"> <link rel="stylesheet" type="text/css" href="%PUBLIC_URL%/css/iconfont.css">
<link rel="stylesheet" type="text/css" href="https://cdn.bootcss.com/quill/1.3.7/quill.core.min.css"> <link rel="stylesheet" type="text/css" href="https://cdn.bootcss.com/quill/1.3.7/quill.core.min.css">
@ -50,8 +50,8 @@
<div id="root" class="page -layout-v -fit widthunit"></div> <div id="root" class="page -layout-v -fit widthunit"></div>
<div id="picture_display" style="display: none;"></div> <div id="picture_display" style="display: none;"></div>
<!-- js css合并 文件优先级的问题 --> <!-- js css合并 文件优先级的问题 -->
<script type="text/javascript" src="/js/js_min_all.js"></script> <script type="text/javascript" src="%PUBLIC_URL%/js/js_min_all.js"></script>
<script type="text/javascript" src="/js/flv.min.js"></script> <script type="text/javascript" src="%PUBLIC_URL%/js/flv.min.js"></script>
<!-- 在tpi js里加载这3个脚本 --> <!-- 在tpi js里加载这3个脚本 -->
<script> <script>
@ -68,7 +68,7 @@
} else { } else {
if (href.indexOf('/tasks/') != -1) { if (href.indexOf('/tasks/') != -1) {
document.write('<script type="text/javascript" src="/assets/kindeditor/kindeditor.js"><\/script>'); document.write('<script type="text/javascript" src="/assets/kindeditor/kindeditor.js"><\/script>');
document.write('<script type="text/javascript" src="/js/create_kindeditor.js"><\/script>'); document.write('<script type="text/javascript" src="%PUBLIC_URL%/js/create_kindeditor.js"><\/script>');
document.write('<script type="text/javascript" src="/javascripts/educoder/edu_application.js"><\/script>'); document.write('<script type="text/javascript" src="/javascripts/educoder/edu_application.js"><\/script>');
} else if (href.indexOf('/paths/') != -1) { } else if (href.indexOf('/paths/') != -1) {
document.write('<script type="text/javascript" src="/javascripts/educoder/edu_application.js"><\/script>'); document.write('<script type="text/javascript" src="/javascripts/educoder/edu_application.js"><\/script>');

@ -4,10 +4,6 @@ import '../../courses/css/Courses.css'
import './css/TPMchallengesnew.css'; import './css/TPMchallengesnew.css';
require('codemirror/lib/codemirror.css'); require('codemirror/lib/codemirror.css');
let path = '/editormd/lib/'
path = getUrl("/editormd/lib/")
const $ = window.$; const $ = window.$;

@ -1,8 +1,6 @@
import React, {Component} from 'react'; import React, { Component } from 'react';
import {getUrl,getUploadActionUrl} from 'educoder'; import { getUrl, getUploadActionUrl } from 'educoder';
let path = getUrl("/editormd/lib/");
const $ = window.$; const $ = window.$;
@ -10,7 +8,7 @@ function create_editorMD(id, width, high, placeholder, imageUrl, callback) {
var editorName = window.editormd(id, { var editorName = window.editormd(id, {
width: width, width: width,
height: high, height: high,
path: path, // "/editormd/lib/" path: getUrl("/editormd/lib/"),
syncScrolling: "single", syncScrolling: "single",
tex: true, tex: true,
@ -78,15 +76,15 @@ export default class TPMeditorMD extends Component {
} }
questioMD=(initValue, id)=> { questioMD = (initValue, id) => {
this.contentChanged = false; this.contentChanged = false;
const placeholder = ""; const placeholder = "";
// amp; // amp;
// 编辑时要传memoId // 编辑时要传memoId
// const imageUrl = `/upload_with_markdown?container_id=&container_type=Memo`; // const imageUrl = `/upload_with_markdown?container_id=&container_type=Memo`;
const imageUrl = `${getUploadActionUrl()}`; const imageUrl = `${getUploadActionUrl()}`;
// 创建editorMd // 创建editorMd
let questio_editormd = create_editorMD(id, '100%', 400, placeholder, imageUrl, () => { let questio_editormd = create_editorMD(id, '100%', 400, placeholder, imageUrl, () => {
setTimeout(() => { setTimeout(() => {
@ -108,12 +106,12 @@ export default class TPMeditorMD extends Component {
} }
componentWillReceiveProps(newProps) { componentWillReceiveProps(newProps) {
this.questioMD(newProps.value,newProps.id) this.questioMD(newProps.value, newProps.id)
} }
render() { render() {
return ( return (
<div className="padding10-20 edu-back-greyf5 radius4" id="questioMD"> <div className="padding10-20 edu-back-greyf5 radius4" id="questioMD">
<textarea style={{display: 'none'}} id="questioadd" name="content"> </textarea> <textarea style={{ display: 'none' }} id="questioadd" name="content"> </textarea>
<div className="CodeMirror cm-s-defualt"> <div className="CodeMirror cm-s-defualt">
</div> </div>
</div> </div>

@ -1,67 +1,45 @@
import React, {Component} from 'react'; import React, { Component } from 'react';
import { Link } from "react-router-dom";
import {Input, Select, Radio, Checkbox, Popconfirm, message, Modal} from 'antd';
import {BrowserRouter as Router, Route, Link, Switch} from "react-router-dom";
// import "antd/dist/antd.css";
import { getImageUrl, getUploadActionUrl, getUrl } from 'educoder'; import { getImageUrl, getUploadActionUrl, getUrl } from 'educoder';
import axios from 'axios'; import axios from 'axios';
import '../css/TPMchallengesnew.css'; import '../css/TPMchallengesnew.css';
let origin = getUrl();
let path = getUrl("/editormd/lib/")
const $ = window.$; const $ = window.$;
let timeout;
let currentValue;
const Option = Select.Option;
const RadioGroup = Radio.Group;
// 恢复数据 // 恢复数据
function md_rec_data(k,mdu,id, editor){ function md_rec_data(k, mdu, id, editor) {
if(window.sessionStorage.getItem(k+mdu) !== null){ if (window.sessionStorage.getItem(k + mdu) !== null) {
editor.setValue(window.sessionStorage.getItem(k+mdu)); editor.setValue(window.sessionStorage.getItem(k + mdu));
md_clear_data(k,mdu,id); md_clear_data(k, mdu, id);
} }
} }
// 保存数据 // 保存数据
function md_add_data(k,mdu,d){ function md_add_data(k, mdu, d) {
window.sessionStorage.setItem(k+mdu,d); window.sessionStorage.setItem(k + mdu, d);
} }
// 清空保存的数据 // 清空保存的数据
function md_clear_data(k,mdu,id){ function md_clear_data(k, mdu, id) {
window.sessionStorage.removeItem(k+mdu); window.sessionStorage.removeItem(k + mdu);
var id1 = "#e_tip_"+id; var id1 = "#e_tip_" + id;
var id2 = "#e_tips_"+id; var id2 = "#e_tips_" + id;
if(k == 'content'){ if (k == 'content') {
$(id2).html(""); $(id2).html("");
}else{ } else {
$(id1).html(""); $(id1).html("");
} }
} }
function md_elocalStorage(editor,mdu,id){ function md_elocalStorage(editor, mdu, id) {
if (window.sessionStorage){ if (window.sessionStorage) {
var oc = window.sessionStorage.getItem('content'+mdu); var oc = window.sessionStorage.getItem('content' + mdu);
if(oc !== null ){ if (oc !== null) {
console.log("#e_tips_"+id) console.log("#e_tips_" + id)
$("#e_tips_"+id).data('editor', editor); $("#e_tips_" + id).data('editor', editor);
var h = '您上次有已保存的数据,是否<a style="cursor: pointer;" class="link-color-blue" onclick="md_rec_data(\'content\',\''+ mdu + '\',\'' + id + '\')">恢复</a> ? / <a style="cursor: pointer;" class="link-color-blue" onclick="md_clear_data(\'content\',\''+ mdu + '\',\'' + id + '\')">不恢复</a>'; var h = '您上次有已保存的数据,是否<a style="cursor: pointer;" class="link-color-blue" onclick="md_rec_data(\'content\',\'' + mdu + '\',\'' + id + '\')">恢复</a> ? / <a style="cursor: pointer;" class="link-color-blue" onclick="md_clear_data(\'content\',\'' + mdu + '\',\'' + id + '\')">不恢复</a>';
$("#e_tips_"+id).html(h); $("#e_tips_" + id).html(h);
} }
setInterval(function() { setInterval(function () {
var d = new Date(); var d = new Date();
var h = d.getHours(); var h = d.getHours();
var m = d.getMinutes(); var m = d.getMinutes();
@ -69,18 +47,18 @@ function md_elocalStorage(editor,mdu,id){
h = h < 10 ? '0' + h : h; h = h < 10 ? '0' + h : h;
m = m < 10 ? '0' + m : m; m = m < 10 ? '0' + m : m;
s = s < 10 ? '0' + s : s; s = s < 10 ? '0' + s : s;
if(editor.getValue().trim() != ""){ if (editor.getValue().trim() != "") {
md_add_data("content",mdu,editor.getValue()); md_add_data("content", mdu, editor.getValue());
var id1 = "#e_tip_"+id; var id1 = "#e_tip_" + id;
var id2 = "#e_tips_"+id; var id2 = "#e_tips_" + id;
$(id1).html(" 数据已于 " + h + ':' + m + ':' + s +" 保存 "); $(id1).html(" 数据已于 " + h + ':' + m + ':' + s + " 保存 ");
$(id2).html(""); $(id2).html("");
} }
},10000); }, 10000);
}else{ } else {
$("#e_tip_"+id).after('您的浏览器不支持localStorage.无法开启自动保存草稿服务,请升级浏览器!'); $("#e_tip_" + id).after('您的浏览器不支持localStorage.无法开启自动保存草稿服务,请升级浏览器!');
} }
} }
@ -89,7 +67,7 @@ function create_editorMD(id, width, high, placeholder, imageUrl, callback) {
var editorName = window.editormd(id, { var editorName = window.editormd(id, {
width: width, width: width,
height: high, height: high,
path: path, // "/editormd/lib/" path: getUrl("/editormd/lib/"), //
syncScrolling: "single", syncScrolling: "single",
tex: true, tex: true,
@ -155,9 +133,9 @@ export default class TPManswer extends Component {
practice_url: undefined, practice_url: undefined,
go_back_url: undefined, go_back_url: undefined,
value: 1, value: 1,
answer:"", answer: "",
id:undefined, id: undefined,
checkpointId:undefined, checkpointId: undefined,
power: false, power: false,
prev_challenge: undefined, prev_challenge: undefined,
next_challenge: undefined, next_challenge: undefined,
@ -194,14 +172,14 @@ export default class TPManswer extends Component {
componentDidMount() { componentDidMount() {
let id = this.props.match.params.shixunId; let id = this.props.match.params.shixunId;
let checkpointId=this.props.match.params.checkpointId; let checkpointId = this.props.match.params.checkpointId;
let newchoice_url= "/shixuns/"+id+"/challenges/newquestion"; let newchoice_url = "/shixuns/" + id + "/challenges/newquestion";
let newpractice_url= "/shixuns/"+id+"/challenges/new"; let newpractice_url = "/shixuns/" + id + "/challenges/new";
let newgo_back_url="/shixuns/"+id+"/challenges"; let newgo_back_url = "/shixuns/" + id + "/challenges";
this.setState({ this.setState({
shixunId:id, shixunId: id,
checkpointId:checkpointId checkpointId: checkpointId
}) })
@ -210,22 +188,22 @@ export default class TPManswer extends Component {
let newprev_challenge = response.data.prev_challenge; let newprev_challenge = response.data.prev_challenge;
let next_challenge = response.data.next_challenge; let next_challenge = response.data.next_challenge;
if (newprev_challenge != undefined) { if (newprev_challenge != undefined) {
if(newprev_challenge.st===0){ if (newprev_challenge.st === 0) {
newprev_challenge = "/shixuns/" + id + "/challenges/" + newprev_challenge.id + "/editcheckpoint"; newprev_challenge = "/shixuns/" + id + "/challenges/" + newprev_challenge.id + "/editcheckpoint";
}else{ } else {
newprev_challenge = "/shixuns/" + id + "/challenges/" + newprev_challenge.id + "/editquestion"; newprev_challenge = "/shixuns/" + id + "/challenges/" + newprev_challenge.id + "/editquestion";
} }
} }
if (next_challenge != undefined) { if (next_challenge != undefined) {
if(next_challenge.st===0){ if (next_challenge.st === 0) {
next_challenge = "/shixuns/" + id + "/challenges/" + next_challenge.id+ "/editcheckpoint"; next_challenge = "/shixuns/" + id + "/challenges/" + next_challenge.id + "/editcheckpoint";
}else{ } else {
next_challenge = "/shixuns/" + id + "/challenges/" + next_challenge.id+ "/editquestion"; next_challenge = "/shixuns/" + id + "/challenges/" + next_challenge.id + "/editquestion";
} }
} }
this.setState({ this.setState({
answer:response.data.answer, answer: response.data.answer,
power: response.data.power, power: response.data.power,
choice_url: newchoice_url, // 导航中的新建选择题url choice_url: newchoice_url, // 导航中的新建选择题url
practice_url: newpractice_url, //string 导航中新建实践题url practice_url: newpractice_url, //string 导航中新建实践题url
@ -233,14 +211,14 @@ export default class TPManswer extends Component {
position: response.data.position, //int 关卡位置,导航栏中的第几关 position: response.data.position, //int 关卡位置,导航栏中的第几关
prev_challenge: newprev_challenge, prev_challenge: newprev_challenge,
next_challenge: next_challenge, next_challenge: next_challenge,
}) })
if(response.data.power===false){ if (response.data.power === false) {
this.props.showSnackbar("没有权限修改"); this.props.showSnackbar("没有权限修改");
} }
if(response.data.answer===undefined||response.data.answer===null){ if (response.data.answer === undefined || response.data.answer === null) {
this.answerMD("", "answerMD"); this.answerMD("", "answerMD");
}else{ } else {
this.answerMD(response.data.answer, "answerMD"); this.answerMD(response.data.answer, "answerMD");
} }
@ -249,20 +227,20 @@ export default class TPManswer extends Component {
}); });
} }
challenge_answer_submit=()=> { challenge_answer_submit = () => {
let id = this.props.match.params.shixunId; let id = this.props.match.params.shixunId;
let{checkpointId}=this.state; let { checkpointId } = this.state;
let url = "/shixuns/"+id+"/challenges/"+checkpointId+".json"; let url = "/shixuns/" + id + "/challenges/" + checkpointId + ".json";
const answer_editormdvalue = this.answers_editormd.getValue(); const answer_editormdvalue = this.answers_editormd.getValue();
axios.put(url,{ axios.put(url, {
tab:2, tab: 2,
identifier:id, identifier: id,
id:checkpointId, id: checkpointId,
challenge:{ challenge: {
answer:answer_editormdvalue answer: answer_editormdvalue
}
} }
}
).then((response) => { ).then((response) => {
this.props.showSnackbar(response.data.messages); this.props.showSnackbar(response.data.messages);
@ -286,20 +264,20 @@ export default class TPManswer extends Component {
prev_challenge, prev_challenge,
next_challenge, next_challenge,
} = this.state; } = this.state;
let tab1url="/shixuns/" + shixunId + "/challenges/"+checkpointId+"/editcheckpoint"; let tab1url = "/shixuns/" + shixunId + "/challenges/" + checkpointId + "/editcheckpoint";
let tab2url="/shixuns/" + shixunId + "/challenges/"+checkpointId+"/tab=2"; let tab2url = "/shixuns/" + shixunId + "/challenges/" + checkpointId + "/tab=2";
let tab3url="/shixuns/" + shixunId + "/challenges/"+checkpointId+"/tab=3"; let tab3url = "/shixuns/" + shixunId + "/challenges/" + checkpointId + "/tab=3";
// console.log(this.props) // console.log(this.props)
return ( return (
<React.Fragment> <React.Fragment>
<div className="educontent mt30 mb30"> <div className="educontent mt30 mb30">
<div className="padding10-20 mb10 edu-back-white clearfix"> <div className="padding10-20 mb10 edu-back-white clearfix">
<span className="fl ring-blue mr10 mt7"> <span className="fl ring-blue mr10 mt7">
<img src={getImageUrl("images/educoder/icon/code.svg")} data-tip-down="实训任务" className="fl mt2 ml2"/> <img src={getImageUrl("images/educoder/icon/code.svg")} data-tip-down="实训任务" className="fl mt2 ml2" />
</span> </span>
<span className="font-16 task-hide fl TPMtaskName">{position}</span> <span className="font-16 task-hide fl TPMtaskName">{position}</span>
<Link to={go_back_url === undefined ? "" : go_back_url} <Link to={go_back_url === undefined ? "" : go_back_url}
className="color-grey-6 fr font-15 mt3">返回</Link> className="color-grey-6 fr font-15 mt3">返回</Link>
{prev_challenge === undefined ? "" : {prev_challenge === undefined ? "" :
<a href={prev_challenge} className="fr color-blue mr15 mt4">上一关</a> <a href={prev_challenge} className="fr color-blue mr15 mt4">上一关</a>
@ -310,13 +288,13 @@ export default class TPManswer extends Component {
} }
<a href={practice_url === undefined ? "" : practice_url} <a href={practice_url === undefined ? "" : practice_url}
className="fr color-blue mr15 mt4" className="fr color-blue mr15 mt4"
style={{display:this.props.status===2||this.props.status===1?'none':'block'}} style={{ display: this.props.status === 2 || this.props.status === 1 ? 'none' : 'block' }}
data-tip-down="新增代码编辑类型的任务">+&nbsp;实践类型</a> data-tip-down="新增代码编辑类型的任务">+&nbsp;实践类型</a>
<a href={choice_url === undefined ? "" : choice_url} <a href={choice_url === undefined ? "" : choice_url}
className="fr color-blue mr15 mt4" className="fr color-blue mr15 mt4"
style={{display:this.props.status===2||this.props.status===1?'none':'block'}} style={{ display: this.props.status === 2 || this.props.status === 1 ? 'none' : 'block' }}
data-tip-down="新增选择题类型的任务">+&nbsp;选择题类型</a> data-tip-down="新增选择题类型的任务">+&nbsp;选择题类型</a>
</div> </div>
@ -341,7 +319,7 @@ export default class TPManswer extends Component {
<p className="color-grey-6 font-16 mb30">参考答案</p> <p className="color-grey-6 font-16 mb30">参考答案</p>
<div className="df"> <div className="df">
<div className="padding10-20 edu-back-greyf5 radius4" id="answerMD"> <div className="padding10-20 edu-back-greyf5 radius4" id="answerMD">
<textarea style={{display: 'none'}} id="evaluate_script_show" name="content"> </textarea> <textarea style={{ display: 'none' }} id="evaluate_script_show" name="content"> </textarea>
<div className="CodeMirror cm-s-defualt"> <div className="CodeMirror cm-s-defualt">
</div> </div>
</div> </div>
@ -352,9 +330,9 @@ export default class TPManswer extends Component {
</div> </div>
<div className="clearfix mt20" style={{display:this.props.identity>4||this.props.identity===undefined||power===false?"none":"block"}}> <div className="clearfix mt20" style={{ display: this.props.identity > 4 || this.props.identity === undefined || power === false ? "none" : "block" }}>
<a className="defalutSubmitbtn fl mr20" <a className="defalutSubmitbtn fl mr20"
onClick={this.challenge_answer_submit}>提交</a> onClick={this.challenge_answer_submit}>提交</a>
{/*<a href={"/shixuns/" + shixunId + "/challenges"} className="defalutCancelbtn fl">取消</a>*/} {/*<a href={"/shixuns/" + shixunId + "/challenges"} className="defalutCancelbtn fl">取消</a>*/}
<Link to={"/shixuns/" + shixunId + "/challenges"} className={"defalutCancelbtn fl"}>取消</Link> <Link to={"/shixuns/" + shixunId + "/challenges"} className={"defalutCancelbtn fl"}>取消</Link>
</div> </div>

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save