Merge branch 'master' of https://bdgit.educoder.net/Hjqreturn/educoder
commit
de83952229
@ -1,103 +0,0 @@
|
|||||||
function Base64() {
|
|
||||||
|
|
||||||
// private property
|
|
||||||
_keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
|
||||||
|
|
||||||
// public method for encoding
|
|
||||||
this.encode = function (input) {
|
|
||||||
var output = "";
|
|
||||||
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
|
|
||||||
var i = 0;
|
|
||||||
input = _utf8_encode(input);
|
|
||||||
while (i < input.length) {
|
|
||||||
chr1 = input.charCodeAt(i++);
|
|
||||||
chr2 = input.charCodeAt(i++);
|
|
||||||
chr3 = input.charCodeAt(i++);
|
|
||||||
enc1 = chr1 >> 2;
|
|
||||||
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
|
|
||||||
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
|
|
||||||
enc4 = chr3 & 63;
|
|
||||||
if (isNaN(chr2)) {
|
|
||||||
enc3 = enc4 = 64;
|
|
||||||
} else if (isNaN(chr3)) {
|
|
||||||
enc4 = 64;
|
|
||||||
}
|
|
||||||
output = output +
|
|
||||||
_keyStr.charAt(enc1) + _keyStr.charAt(enc2) +
|
|
||||||
_keyStr.charAt(enc3) + _keyStr.charAt(enc4);
|
|
||||||
}
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
// public method for decoding
|
|
||||||
this.decode = function (input) {
|
|
||||||
var output = "";
|
|
||||||
var chr1, chr2, chr3;
|
|
||||||
var enc1, enc2, enc3, enc4;
|
|
||||||
var i = 0;
|
|
||||||
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
|
|
||||||
while (i < input.length) {
|
|
||||||
enc1 = _keyStr.indexOf(input.charAt(i++));
|
|
||||||
enc2 = _keyStr.indexOf(input.charAt(i++));
|
|
||||||
enc3 = _keyStr.indexOf(input.charAt(i++));
|
|
||||||
enc4 = _keyStr.indexOf(input.charAt(i++));
|
|
||||||
chr1 = (enc1 << 2) | (enc2 >> 4);
|
|
||||||
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
|
|
||||||
chr3 = ((enc3 & 3) << 6) | enc4;
|
|
||||||
output = output + String.fromCharCode(chr1);
|
|
||||||
if (enc3 != 64) {
|
|
||||||
output = output + String.fromCharCode(chr2);
|
|
||||||
}
|
|
||||||
if (enc4 != 64) {
|
|
||||||
output = output + String.fromCharCode(chr3);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
output = _utf8_decode(output);
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
// private method for UTF-8 encoding
|
|
||||||
_utf8_encode = function (string) {
|
|
||||||
string = string.replace(/\r\n/g,"\n");
|
|
||||||
var utftext = "";
|
|
||||||
for (var n = 0; n < string.length; n++) {
|
|
||||||
var c = string.charCodeAt(n);
|
|
||||||
if (c < 128) {
|
|
||||||
utftext += String.fromCharCode(c);
|
|
||||||
} else if((c > 127) && (c < 2048)) {
|
|
||||||
utftext += String.fromCharCode((c >> 6) | 192);
|
|
||||||
utftext += String.fromCharCode((c & 63) | 128);
|
|
||||||
} else {
|
|
||||||
utftext += String.fromCharCode((c >> 12) | 224);
|
|
||||||
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
|
|
||||||
utftext += String.fromCharCode((c & 63) | 128);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
return utftext;
|
|
||||||
}
|
|
||||||
|
|
||||||
// private method for UTF-8 decoding
|
|
||||||
_utf8_decode = function (utftext) {
|
|
||||||
var string = "";
|
|
||||||
var i = 0;
|
|
||||||
var c = c1 = c2 = 0;
|
|
||||||
while ( i < utftext.length ) {
|
|
||||||
c = utftext.charCodeAt(i);
|
|
||||||
if (c < 128) {
|
|
||||||
string += String.fromCharCode(c);
|
|
||||||
i++;
|
|
||||||
} else if((c > 191) && (c < 224)) {
|
|
||||||
c2 = utftext.charCodeAt(i+1);
|
|
||||||
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
|
|
||||||
i += 2;
|
|
||||||
} else {
|
|
||||||
c2 = utftext.charCodeAt(i+1);
|
|
||||||
c3 = utftext.charCodeAt(i+2);
|
|
||||||
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
|
|
||||||
i += 3;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return string;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,63 +1,72 @@
|
|||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import Snackbar from 'material-ui/Snackbar';
|
import Snackbar from 'material-ui/Snackbar';
|
||||||
import Fade from 'material-ui/transitions/Fade';
|
import Fade from 'material-ui/transitions/Fade';
|
||||||
|
import { notification } from 'antd'
|
||||||
export function SnackbarHOC(options = {}) {
|
export function SnackbarHOC(options = {}) {
|
||||||
return function wrap(WrappedComponent) {
|
return function wrap(WrappedComponent) {
|
||||||
return class Wrapper extends Component {
|
return class Wrapper extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.showSnackbar = this.showSnackbar.bind(this)
|
this.showSnackbar = this.showSnackbar.bind(this)
|
||||||
this.state = {
|
this.state = {
|
||||||
snackbarText: '',
|
snackbarText: '',
|
||||||
snackbarOpen: false,
|
snackbarOpen: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handleSnackbarClose() {
|
handleSnackbarClose() {
|
||||||
this.setState({
|
this.setState({
|
||||||
snackbarOpen: false,
|
snackbarOpen: false,
|
||||||
snackbarVertical: '',
|
snackbarVertical: '',
|
||||||
snackbarHorizontal: '',
|
snackbarHorizontal: '',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 全局的snackbar this.props.showSnackbar调用即可
|
// 全局的snackbar this.props.showSnackbar调用即可
|
||||||
showSnackbar(text, vertical, horizontal) {
|
showSnackbar(description, message = "提示",icon) {
|
||||||
this.setState({
|
// this.setState({
|
||||||
snackbarOpen: true,
|
// snackbarOpen: true,
|
||||||
snackbarText: text,
|
// snackbarText: text,
|
||||||
snackbarVertical: vertical,
|
// snackbarVertical: vertical,
|
||||||
snackbarHorizontal: horizontal,
|
// snackbarHorizontal: horizontal,
|
||||||
})
|
// })
|
||||||
}
|
const data = {
|
||||||
render() {
|
message,
|
||||||
const { snackbarOpen, snackbarText, snackbarHorizontal, snackbarVertical } = this.state;
|
description
|
||||||
|
}
|
||||||
|
if (icon) {
|
||||||
return (
|
data.icon = icon;
|
||||||
<React.Fragment>
|
}
|
||||||
<Snackbar
|
notification.open(data);
|
||||||
className={"rootSnackbar"}
|
}
|
||||||
style={{zIndex:30000}}
|
|
||||||
open={this.state.snackbarOpen}
|
render() {
|
||||||
autoHideDuration={3000}
|
const { snackbarOpen, snackbarText, snackbarHorizontal, snackbarVertical } = this.state;
|
||||||
anchorOrigin={{ vertical: this.state.snackbarVertical || 'top'
|
|
||||||
, horizontal: this.state.snackbarHorizontal || 'center' }}
|
|
||||||
onClose={() => this.handleSnackbarClose()}
|
return (
|
||||||
transition={Fade}
|
<React.Fragment>
|
||||||
SnackbarContentProps={{
|
<Snackbar
|
||||||
'aria-describedby': 'message-id',
|
className={"rootSnackbar"}
|
||||||
}}
|
style={{zIndex:30000}}
|
||||||
resumeHideDuration={2000}
|
open={this.state.snackbarOpen}
|
||||||
message={<span id="message-id">{this.state.snackbarText}</span>}
|
autoHideDuration={3000}
|
||||||
/>
|
anchorOrigin={{ vertical: this.state.snackbarVertical || 'top'
|
||||||
<WrappedComponent {...this.props} showSnackbar={ this.showSnackbar } >
|
, horizontal: this.state.snackbarHorizontal || 'center' }}
|
||||||
|
onClose={() => this.handleSnackbarClose()}
|
||||||
</WrappedComponent>
|
transition={Fade}
|
||||||
</React.Fragment>
|
SnackbarContentProps={{
|
||||||
)
|
'aria-describedby': 'message-id',
|
||||||
}
|
}}
|
||||||
}
|
resumeHideDuration={2000}
|
||||||
}
|
message={<span id="message-id">{this.state.snackbarText}</span>}
|
||||||
|
/>
|
||||||
|
<WrappedComponent {...this.props} showSnackbar={ this.showSnackbar } >
|
||||||
|
|
||||||
|
</WrappedComponent>
|
||||||
|
</React.Fragment>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,84 @@
|
|||||||
|
import React, {Component} from 'react';
|
||||||
|
|
||||||
|
import {BrowserRouter as Router, Route, Link, Switch} from "react-router-dom";
|
||||||
|
import TPMMDEditor from '../../tpm/challengesnew/TPMMDEditor';
|
||||||
|
|
||||||
|
|
||||||
|
export default class TpmQuestionMain extends Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props)
|
||||||
|
this.state = {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<div className="edu-back-white mb10 clearfix">
|
||||||
|
<div className="padding40-20">
|
||||||
|
<p className="color-grey-6 font-16 mb30">任务名称</p>
|
||||||
|
<div className="df">
|
||||||
|
<span className="mr30 color-orange pt10">*</span>
|
||||||
|
<div className="flex1 mr20">
|
||||||
|
<input type="text"
|
||||||
|
className={this.props.questionInputvaluetype === true ? "input-100-45 greyInpus wind100" : "input-100-45 greyInput "}
|
||||||
|
maxLength="50"
|
||||||
|
name="challenge[subject]"
|
||||||
|
value={this.props.questionsInputvalue}
|
||||||
|
placeholder="请输入任务名称(此信息将提前展示给学员),例:计算学生的课程成绩绩点"
|
||||||
|
onInput={this.props.questionInputvalue}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div style={{width: '57px'}}>
|
||||||
|
<span
|
||||||
|
className={this.props.questionInputvaluetype === true ? "color-orange mt8 fl" : "color-orange mt8 fl none"}
|
||||||
|
id="new_shixun_name"><i className="fa fa-exclamation-circle mr3"></i>必填项</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div className="edu-back-white padding40-20 mb20">
|
||||||
|
<p className="color-grey-6 font-16 mb30">过关任务</p>
|
||||||
|
<div className="df">
|
||||||
|
<span className="mr30 color-orange pt10">*</span>
|
||||||
|
<div className="flex1 mr20">
|
||||||
|
<TPMMDEditor ref={this.props.contentMdRef} placeholder="请输入选择题的过关任务内容" mdID={'courseContentMD'} refreshTimeout={1500}
|
||||||
|
watch={true} className="courseMessageMD" initValue={this.props.contentMdRefval}></TPMMDEditor>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<span
|
||||||
|
className={this.props.questionInputvaluetypes === true ? "color-orange mt8 fl" : "color-orange mt8 fl none"}
|
||||||
|
id="new_shixun_pass"><i
|
||||||
|
className="fa fa-exclamation-circle mr3"></i>必填项</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<p id="e_tip_questioMDQuestion" className="edu-txt-right color-grey-cd font-12 pdr20"></p>
|
||||||
|
<p id="e_tips_questioMDQuestion" className="edu-txt-right color-grey-cd font-12 pdr20"></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div className="clearfix mt30"
|
||||||
|
style={{display: this.props.identity > 4 || this.props.identity === undefined || this.props.power === false ? "none" : "block"}}>
|
||||||
|
<a className="defalutSubmitbtn fl mr20"
|
||||||
|
onClick={this.props.sumittype === true ? "" : this.props.clickquestionsumit}>提交</a>
|
||||||
|
<a href={this.props.go_back_url}
|
||||||
|
className="defalutCancelbtn fl">取消</a>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in new issue