Conflicts:
	public/react/src/modules/login/Trialapplication.js
dev_forum
caishi 5 years ago
commit 9525f59f88

@ -67,7 +67,9 @@
<!-- <link rel="stylesheet" type="text/css" href="https://www.educoder.net/stylesheets/css/font-awesome.css?1510652321"> --> <!-- <link rel="stylesheet" type="text/css" href="https://www.educoder.net/stylesheets/css/font-awesome.css?1510652321"> -->
<link rel="stylesheet" type="text/css" href="http://47.96.87.25:48080/stylesheets/educoder/iconfont/iconfont.css"> <!--<link rel="stylesheet" type="text/css" href="http://47.96.87.25:48080/stylesheets/educoder/iconfont/iconfont.css">-->
<!--需要去build js配置-->
<link rel="stylesheet" type="text/css" href="/css/iconfont.css"> <link rel="stylesheet" type="text/css" href="/css/iconfont.css">
<style> <style>
/*<!--去除浏览器点击操作后有蓝色的底块-->*/ /*<!--去除浏览器点击操作后有蓝色的底块-->*/

@ -1,224 +1,225 @@
'use strict'; 'use strict';
// Do this as the first thing so that any code reading it knows the right env. // Do this as the first thing so that any code reading it knows the right env.
process.env.BABEL_ENV = 'production'; process.env.BABEL_ENV = 'production';
process.env.NODE_ENV = 'production'; process.env.NODE_ENV = 'production';
// Makes the script crash on unhandled rejections instead of silently // Makes the script crash on unhandled rejections instead of silently
// ignoring them. In the future, promise rejections that are not handled will // ignoring them. In the future, promise rejections that are not handled will
// terminate the Node.js process with a non-zero exit code. // terminate the Node.js process with a non-zero exit code.
process.on('unhandledRejection', err => { process.on('unhandledRejection', err => {
throw err; throw err;
}); });
// Ensure environment variables are read. // Ensure environment variables are read.
require('../config/env'); require('../config/env');
const path = require('path'); const path = require('path');
const chalk = require('chalk'); const chalk = require('chalk');
const fs = require('fs-extra'); const fs = require('fs-extra');
const webpack = require('webpack'); const webpack = require('webpack');
const config = require('../config/webpack.config.prod'); const config = require('../config/webpack.config.prod');
const paths = require('../config/paths'); const paths = require('../config/paths');
const checkRequiredFiles = require('react-dev-utils/checkRequiredFiles'); const checkRequiredFiles = require('react-dev-utils/checkRequiredFiles');
const formatWebpackMessages = require('react-dev-utils/formatWebpackMessages'); const formatWebpackMessages = require('react-dev-utils/formatWebpackMessages');
const printHostingInstructions = require('react-dev-utils/printHostingInstructions'); const printHostingInstructions = require('react-dev-utils/printHostingInstructions');
const FileSizeReporter = require('react-dev-utils/FileSizeReporter'); const FileSizeReporter = require('react-dev-utils/FileSizeReporter');
const printBuildError = require('react-dev-utils/printBuildError'); const printBuildError = require('react-dev-utils/printBuildError');
var CombinedStream = require('combined-stream'); var CombinedStream = require('combined-stream');
var fs2 = require('fs'); var fs2 = require('fs');
const measureFileSizesBeforeBuild = const measureFileSizesBeforeBuild =
FileSizeReporter.measureFileSizesBeforeBuild; FileSizeReporter.measureFileSizesBeforeBuild;
const printFileSizesAfterBuild = FileSizeReporter.printFileSizesAfterBuild; const printFileSizesAfterBuild = FileSizeReporter.printFileSizesAfterBuild;
const useYarn = fs.existsSync(paths.yarnLockFile); const useYarn = fs.existsSync(paths.yarnLockFile);
// These sizes are pretty large. We'll warn for bundles exceeding them. // These sizes are pretty large. We'll warn for bundles exceeding them.
const WARN_AFTER_BUNDLE_GZIP_SIZE = 512 * 1024; const WARN_AFTER_BUNDLE_GZIP_SIZE = 512 * 1024;
const WARN_AFTER_CHUNK_GZIP_SIZE = 1024 * 1024; const WARN_AFTER_CHUNK_GZIP_SIZE = 1024 * 1024;
// Warn and crash if required files are missing // Warn and crash if required files are missing
if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) { if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) {
process.exit(1); process.exit(1);
} }
function removeExceptGitDir(dir) { function removeExceptGitDir(dir) {
// readdirSync // readdirSync
const list = fs2.readdirSync(dir) const list = fs2.readdirSync(dir)
// if (err) return done(err); // if (err) return done(err);
var pending = list.length; var pending = list.length;
// if (!pending) return done(null, results); // if (!pending) return done(null, results);
list.forEach(function(file) { list.forEach(function(file) {
if (file.indexOf('.git') == -1) { if (file.indexOf('.git') == -1) {
file = path.resolve(dir, file); file = path.resolve(dir, file);
fs.removeSync(file) fs.removeSync(file)
} }
}); });
} }
// First, read the current file sizes in build directory. // First, read the current file sizes in build directory.
// This lets us display how much they changed later. // This lets us display how much they changed later.
measureFileSizesBeforeBuild(paths.appBuild) measureFileSizesBeforeBuild(paths.appBuild)
.then(previousFileSizes => { .then(previousFileSizes => {
// Remove all content but keep the directory so that // Remove all content but keep the directory so that
// if you're in it, you don't end up in Trash // if you're in it, you don't end up in Trash
// fs.emptyDirSync(paths.appBuild); // fs.emptyDirSync(paths.appBuild);
console.log('removeExceptGitDir') console.log('removeExceptGitDir')
removeExceptGitDir(paths.appBuild) removeExceptGitDir(paths.appBuild)
console.log('copyPublicFolder') console.log('copyPublicFolder')
// Merge with the public folder // Merge with the public folder
copyPublicFolder(); copyPublicFolder();
// Start the webpack build // Start the webpack build
return build(previousFileSizes); return build(previousFileSizes);
}) })
.then( .then(
({ stats, previousFileSizes, warnings }) => { ({ stats, previousFileSizes, warnings }) => {
if (warnings.length) { if (warnings.length) {
console.log(chalk.yellow('Compiled with warnings.\n')); console.log(chalk.yellow('Compiled with warnings.\n'));
console.log(warnings.join('\n\n')); console.log(warnings.join('\n\n'));
console.log( console.log(
'\nSearch for the ' + '\nSearch for the ' +
chalk.underline(chalk.yellow('keywords')) + chalk.underline(chalk.yellow('keywords')) +
' to learn more about each warning.' ' to learn more about each warning.'
); );
console.log( console.log(
'To ignore, add ' + 'To ignore, add ' +
chalk.cyan('// eslint-disable-next-line') + chalk.cyan('// eslint-disable-next-line') +
' to the line before.\n' ' to the line before.\n'
); );
} else { } else {
console.log(chalk.green('Compiled successfully.\n')); console.log(chalk.green('Compiled successfully.\n'));
} }
console.log('File sizes after gzip:\n'); console.log('File sizes after gzip:\n');
printFileSizesAfterBuild( printFileSizesAfterBuild(
stats, stats,
previousFileSizes, previousFileSizes,
paths.appBuild, paths.appBuild,
WARN_AFTER_BUNDLE_GZIP_SIZE, WARN_AFTER_BUNDLE_GZIP_SIZE,
WARN_AFTER_CHUNK_GZIP_SIZE WARN_AFTER_CHUNK_GZIP_SIZE
); );
console.log(); console.log();
const appPackage = require(paths.appPackageJson); const appPackage = require(paths.appPackageJson);
const publicUrl = paths.publicUrl; const publicUrl = paths.publicUrl;
const publicPath = config.output.publicPath; const publicPath = config.output.publicPath;
const buildFolder = path.relative(process.cwd(), paths.appBuild); const buildFolder = path.relative(process.cwd(), paths.appBuild);
printHostingInstructions( printHostingInstructions(
appPackage, appPackage,
publicUrl, publicUrl,
publicPath, publicPath,
buildFolder, buildFolder,
useYarn useYarn
); );
}, },
err => { err => {
console.log(chalk.red('Failed to compile.\n')); console.log(chalk.red('Failed to compile.\n'));
printBuildError(err); printBuildError(err);
process.exit(1); process.exit(1);
} }
); );
// Create the production build and print the deployment instructions. // Create the production build and print the deployment instructions.
function build(previousFileSizes) { function build(previousFileSizes) {
console.log('Creating an optimized production build...'); console.log('Creating an optimized production build...');
let compiler = webpack(config); let compiler = webpack(config);
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
compiler.run((err, stats) => { compiler.run((err, stats) => {
if (err) { if (err) {
return reject(err); return reject(err);
} }
const messages = formatWebpackMessages(stats.toJson({}, true)); const messages = formatWebpackMessages(stats.toJson({}, true));
if (messages.errors.length) { if (messages.errors.length) {
// Only keep the first error. Others are often indicative // Only keep the first error. Others are often indicative
// of the same problem, but confuse the reader with noise. // of the same problem, but confuse the reader with noise.
if (messages.errors.length > 1) { if (messages.errors.length > 1) {
messages.errors.length = 1; messages.errors.length = 1;
} }
return reject(new Error(messages.errors.join('\n\n'))); return reject(new Error(messages.errors.join('\n\n')));
} }
if ( if (
process.env.CI && process.env.CI &&
(typeof process.env.CI !== 'string' || (typeof process.env.CI !== 'string' ||
process.env.CI.toLowerCase() !== 'false') && process.env.CI.toLowerCase() !== 'false') &&
messages.warnings.length messages.warnings.length
) { ) {
console.log( console.log(
chalk.yellow( chalk.yellow(
'\nTreating warnings as errors because process.env.CI = true.\n' + '\nTreating warnings as errors because process.env.CI = true.\n' +
'Most CI servers set it automatically.\n' 'Most CI servers set it automatically.\n'
) )
); );
return reject(new Error(messages.warnings.join('\n\n'))); return reject(new Error(messages.warnings.join('\n\n')));
} }
generateNewIndexJsp(); generateNewIndexJsp();
return resolve({ return resolve({
stats, stats,
previousFileSizes, previousFileSizes,
warnings: messages.warnings, warnings: messages.warnings,
}); });
}); });
}); });
} }
function copyPublicFolder() { function copyPublicFolder() {
fs.copySync(paths.appPublic, paths.appBuild, { fs.copySync(paths.appPublic, paths.appBuild, {
dereference: true, dereference: true,
filter: file => file !== paths.appHtml, filter: file => file !== paths.appHtml,
}); });
} }
function generateNewIndexJsp() { function generateNewIndexJsp() {
// var combinedStream = CombinedStream.create(); // var combinedStream = CombinedStream.create();
var filePath = paths.appBuild + '/index.html'; var filePath = paths.appBuild + '/index.html';
// var htmlContent = fs2.createReadStream( filePath ) // var htmlContent = fs2.createReadStream( filePath )
// stream没有replace方法 // stream没有replace方法
// htmlContent = htmlContent.replace('/js/js_min_all.js', '/react/build/js/js_min_all.js') // htmlContent = htmlContent.replace('/js/js_min_all.js', '/react/build/js/js_min_all.js')
// htmlContent = htmlContent.replace('/css/css_min_all.css', '/react/build/css/css_min_all.css') // htmlContent = htmlContent.replace('/css/css_min_all.css', '/react/build/css/css_min_all.css')
// combinedStream.append(htmlContent); // combinedStream.append(htmlContent);
// combinedStream.pipe(fs2.createWriteStream( filePath )); // combinedStream.pipe(fs2.createWriteStream( filePath ));
var outputPath = paths.appBuild + '/../../../public/react/build/index.html' var outputPath = paths.appBuild + '/../../../public/react/build/index.html'
fs2.readFile(filePath, 'utf8', function (err,data) { fs2.readFile(filePath, 'utf8', function (err,data) {
if (err) { if (err) {
return console.log(err); return console.log(err);
} }
const newVersion = '1.1.1' const newVersion = '1.1.1'
let cdnHost = 'https://shixun.educoder.net' let cdnHost = 'https://shixun.educoder.net'
cdnHost = 'https://cdn-testeduplus2.educoder.net' cdnHost = 'https://cdn-testeduplus2.educoder.net'
cdnHost = '' cdnHost = ''
var result = data.replace('/js/js_min_all.js', `${cdnHost}/react/build/js/js_min_all.js?v=${newVersion}`) var result = data.replace('/js/js_min_all.js', `${cdnHost}/react/build/js/js_min_all.js?v=${newVersion}`)
.replace('/js/js_min_all_2.js', `${cdnHost}/react/build/js/js_min_all_2.js?v=${newVersion}`) .replace('/js/js_min_all_2.js', `${cdnHost}/react/build/js/js_min_all_2.js?v=${newVersion}`)
.replace('/css/css_min_all.css', `${cdnHost}/react/build/css/css_min_all.css?v=${newVersion}`) .replace('/css/css_min_all.css', `${cdnHost}/react/build/css/css_min_all.css?v=${newVersion}`)
.replace('/js/create_kindeditor.js', `${cdnHost}/react/build/js/create_kindeditor.js?v=${newVersion}`) .replace('/css/iconfont.css', `${cdnHost}/react/build/css/iconfont.css?v=${newVersion}`)
.replace('/js/create_kindeditor.js', `${cdnHost}/react/build/js/create_kindeditor.js?v=${newVersion}`)
// .replace('/react/build/./static/css/main', `${cdnHost}/react/build/./static/css/main`)
// .replace('/react/build/./static/js/main', `${cdnHost}/react/build/./static/js/main`) // .replace('/react/build/./static/css/main', `${cdnHost}/react/build/./static/css/main`)
// .replace('/react/build/./static/js/main', `${cdnHost}/react/build/./static/js/main`)
.replace(/https:\/\/testeduplus2.educoder.net/g, '');
// .replace(/http:\/\/testbdweb.educoder.net/g, ''); .replace(/https:\/\/testeduplus2.educoder.net/g, '');
// .replace(/http:\/\/testbdweb.educoder.net/g, '');
// .replace('/css/css_min_all.css', '/react/build/css/css_min_all.css');
// .replace('/css/css_min_all.css', '/react/build/css/css_min_all.css');
fs2.writeFile(outputPath, result, 'utf8', function (err) {
if (err) return console.log(err); fs2.writeFile(outputPath, result, 'utf8', function (err) {
commitAndPush(); if (err) return console.log(err);
}); commitAndPush();
}); });
} });
}
function commitAndPush() {
var exec = require('child_process').exec; function commitAndPush() {
function puts(error, stdout, stderr) { console.log(stdout) } var exec = require('child_process').exec;
var options = {cwd:"./build"}; function puts(error, stdout, stderr) { console.log(stdout) }
exec("git status && git commit -am 'b' && git push", options, puts); var options = {cwd:"./build"};
exec("git status && git commit -am 'b' && git push", options, puts);
} }

@ -1,6 +1,6 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { getUrl2 } from 'educoder' import { getUrl2, isDev } from 'educoder'
const $ = window.$ const $ = window.$
let _url_origin = getUrl2() let _url_origin = getUrl2()
@ -81,18 +81,19 @@ class Cropper extends Component {
$.ajaxSetup({ $.ajaxSetup({
cache: true cache: true
}); });
const _isDev = isDev()
let _path = _isDev ? 'public' : 'build'
$('head').append($('<link rel="stylesheet" type="text/css" />') $('head').append($('<link rel="stylesheet" type="text/css" />')
.attr('href', `${_url_origin}/react/public/js/cropper/cropper.min.css`)); .attr('href', `${_url_origin}/react/${_path}/js/cropper/cropper.min.css`));
$.getScript( $.getScript(
`${_url_origin}/react/public/js/cropper/cropper.js`, `${_url_origin}/react/${_path}/js/cropper/cropper.js`,
(data, textStatus, jqxhr) => { (data, textStatus, jqxhr) => {
}); });
$.getScript( $.getScript(
`${_url_origin}/react/public/js/cropper/html2canvas.min.js`, `${_url_origin}/react/${_path}/js/cropper/html2canvas.min.js`,
(data, textStatus, jqxhr) => { (data, textStatus, jqxhr) => {
}); });

@ -51,16 +51,16 @@ class EvaluateSuccessEffectDisplay extends Component {
</div> </div>
<div className="clearfix" id="picture-content"> <div className="clearfix" id="picture-content">
<div className="fl with33 mr03precent pt10 mb50"> <div className="fl with33 mr03precent pt10 mb50">
<img alt="Icon" {orignal_picture[0] && <img alt="Icon"
src={orignal_picture[0].pic_url}/> src={ orignal_picture[0].pic_url}/>}
</div> </div>
<div className="fl with33 mr03precent pt10 mb50"> <div className="fl with33 mr03precent pt10 mb50">
<img alt="Icon" {user_picture[0] && <img alt="Icon"
src={user_picture[0].pic_url}/> src={ user_picture[0].pic_url }/>}
</div> </div>
<div className="fl with33 mr03precent pt10 mb50"> <div className="fl with33 mr03precent pt10 mb50">
<img alt="Icon" { answer_picture[0] && <img alt="Icon"
src={answer_picture[0].pic_url}/> src={ answer_picture[0].pic_url}/> }
</div> </div>
</div> </div>
</div> </div>

@ -896,7 +896,7 @@ pop_box_new(htmlvalue, 480, 182);
{/* mb20 加了有样式问题 */} {/* mb20 加了有样式问题 */}
<DialogActions className={""} id="dialog-actions"> <DialogActions className={""} id="dialog-actions">
{ this.isSingleButton ? <div className="task-popup-submit clearfix" { this.isSingleButton ? <div className="task-popup-submit clearfix"
style={{ textAlign: 'center' }}> style={{ textAlign: 'center', 'margin-bottom': '14px'}}>
<a className="task-btn task-btn-orange" <a className="task-btn task-btn-orange"
onClick={this.handleGdialogClose} onClick={this.handleGdialogClose}
>知道啦</a> >知道啦</a>

@ -33,7 +33,4 @@ body {
} }
.anticon anticon-paper-clip{ .anticon anticon-paper-clip{
color: #29bd8b !important; color: #29bd8b !important;
}
.notificationmystyle{
z-index: 99999999;
} }

@ -28,16 +28,6 @@ class Fileslistitem extends Component{
this.props.Settingtypes(discussMessage.id) this.props.Settingtypes(discussMessage.id)
} }
downloadfiles=(url,name)=>{
const aLink = document.createElement('a');
aLink.style.display='none';
console.log(name)
aLink.setAttribute('download',name)
aLink.href = url;
document.body.appendChild(aLink);
aLink.click();
// document.body.removeChild(aLink);
}
showfiles=(value)=>{ showfiles=(value)=>{
let {discussMessage,coursesId}=this.props let {discussMessage,coursesId}=this.props
let file_id=discussMessage.id let file_id=discussMessage.id
@ -47,16 +37,22 @@ class Fileslistitem extends Component{
course_id:coursesId course_id:coursesId
}, },
}).then((result)=>{ }).then((result)=>{
if(result.data.attachment_histories.length===0){ if(result.data.attachment_histories.length===0){
this.downloadfiles(result.data.url,result.data.title) let link = document.createElement('a');
document.body.appendChild(link);
link.href = result.data.url;
link.download = result.data.title;
//兼容火狐浏览器
let evt = document.createEvent("MouseEvents");
evt.initEvent("click", false, false);
link.dispatchEvent(evt);
document.body.removeChild(link);
}else{ }else{
this.setState({ this.setState({
Showoldfiles:true, Showoldfiles:true,
allfiles:result.data allfiles:result.data
}) })
} }
}).catch((error)=>{ }).catch((error)=>{
console.log(error) console.log(error)
}) })
@ -208,15 +204,19 @@ class Fileslistitem extends Component{
} }
{ {
this.props.isNotMember ? this.props.isNotMember===true?
discussMessage.is_lock === true ?
<span className="fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.title}</span> <span className="fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.title}</span>
:"" :<a
} onClick={()=>this.showfiles(discussMessage.title)}
title={discussMessage.title}
className="fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.title}</a>:""
}
{ {
discussMessage.is_lock === true ? discussMessage.is_lock === true ?
<Tooltip title={ this.props.isNotMember?"私有属性,非课堂成员不能访问":"私有属性"} placement="bottom"> <Tooltip title={ this.props.isNotMember===true?"私有属性,非课堂成员不能访问":"私有属性"} placement="bottom">
<i className="iconfont icon-guansuo color-grey-c ml10 font-16 fl mt4"></i> <i className="iconfont icon-guansuo color-grey-c ml10 font-16 fl mt4"></i>
</Tooltip> </Tooltip>
:"" :""

@ -58,8 +58,9 @@ function buildColumns(that, student_works) {
const isAdminOrStudent = that.props.isAdminOrStudent() const isAdminOrStudent = that.props.isAdminOrStudent()
const isStudent = that.props.isStudent() const isStudent = that.props.isStudent()
const isNiPing = homework_status && homework_status.indexOf('匿评中') != -1 const isNiPing = homework_status && homework_status.indexOf('匿评中') != -1
const isAppeal = homework_status && homework_status.indexOf('申诉中') != -1
// https://www.trustie.net/issues/21450 分组作业作品列表 学时视角,匿评阶段的列表显示信息不正确 // https://www.trustie.net/issues/21450 分组作业作品列表 学时视角,匿评阶段的列表显示信息不正确
const niPingAndIsStudent = isStudent && isNiPing const niPingAndIsStudent = isStudent && (isNiPing || isAppeal)
let columns = [{ let columns = [{
width: 60, width: 60,

@ -293,9 +293,11 @@ class CommonWorkPost extends Component{
} }
// 附件相关 START // 附件相关 START
handleChange = (info) => { handleChange = (info) => {
let fileList = info.fileList; if (info.file.status === 'uploading') {
let fileList = info.fileList;
this.setState({ fileList: appendFileSizeToUploadFileAll(fileList) }); this.setState({ fileList: appendFileSizeToUploadFileAll(fileList) });
}
} }
onAttachmentRemove = (file) => { onAttachmentRemove = (file) => {
@ -587,6 +589,18 @@ render(){
onChange: this.handleChange, onChange: this.handleChange,
onRemove: this.onAttachmentRemove, onRemove: this.onAttachmentRemove,
beforeUpload: (file) => { beforeUpload: (file) => {
// TODO 文件存在则提示并退出
let gotSameFile = false;
this.state.fileList && this.state.fileList.some((item) => {
if (item.name && item.name.startsWith(file.name)) {
gotSameFile = true;
return true
}
})
if (gotSameFile) {
this.props.showNotification("该附件已被上传!")
return false
}
console.log('beforeUpload', file.name); console.log('beforeUpload', file.name);
const isLt150M = file.size / 1024 / 1024 < 150; const isLt150M = file.size / 1024 / 1024 < 150;
if (!isLt150M) { if (!isLt150M) {

@ -1149,7 +1149,8 @@ class CommonWorkSetting extends Component{
<div className={" mb10 ml30"}> <div className={" mb10 ml30"}>
<span>结束时间</span> <span>结束时间</span>
<ConditionToolTip condition={moment(init_late_time) < this.fetchMoment} title={"时间已过,不能再修改"}> {/* <ConditionToolTip condition={moment(init_late_time) < this.fetchMoment} title={""}>
</ConditionToolTip> */}
<span> <span>
<DatePicker <DatePicker
showToday={false} showToday={false}
@ -1163,7 +1164,8 @@ class CommonWorkSetting extends Component{
value={!late_time ? undefined :moment(late_time, dateFormat)} value={!late_time ? undefined :moment(late_time, dateFormat)}
onChange={this.onChangeTimelatetime} onChange={this.onChangeTimelatetime}
disabledTime={disabledDateTime} disabledTime={disabledDateTime}
disabled={!allow_late || noAuth || moment(init_late_time) < moment()} // || moment(init_late_time) < moment()
disabled={!allow_late || noAuth }
// disabledDate={ (late_time) => // disabledDate={ (late_time) =>
// { // {
// const end_time = this.state.end_time // const end_time = this.state.end_time
@ -1172,7 +1174,7 @@ class CommonWorkSetting extends Component{
// } // }
/> />
</span> </span>
</ConditionToolTip>
<span className={"font-14 color-grey-9 ml10"}>学生延时提交作品的时间截点</span> <span className={"font-14 color-grey-9 ml10"}>学生延时提交作品的时间截点</span>
{<div className={"latetimetype color-red "}>{latetimetype}</div>} {<div className={"latetimetype color-red "}>{latetimetype}</div>}
</div> </div>

@ -38,7 +38,8 @@ class NewWork extends Component{
} }
} }
fetchCourseData = (courseId) => { fetchCourseData = (courseId) => {
const url = `/courses/${courseId}/homework_commons/new.json?type=1` const isGroup = this.props.isGroup()
const url = `/courses/${courseId}/homework_commons/new.json?type=${isGroup ? 3 : 1}`
axios.get(url, { axios.get(url, {
}) })
.then((response) => { .then((response) => {
@ -369,7 +370,8 @@ class NewWork extends Component{
</p> */} </p> */}
<CBreadcrumb items={[ <CBreadcrumb items={[
{ to: `/courses/${courseId}`, name: this.state.course_name}, { to: `/courses/${courseId}`, name: this.state.course_name},
{ to: `/courses/${courseId}/${moduleEngName}/${category && category.category_id ? category.category_id : ''}`, name: moduleName }, { to: `/courses/${courseId}/${moduleEngName}/${category && category.category_id ? category.category_id : ''}`
, name: category && category.category_name },
{ name: `${ this.isEdit ? '编辑' : '新建'}` } { name: `${ this.isEdit ? '编辑' : '新建'}` }
]}></CBreadcrumb> ]}></CBreadcrumb>

@ -107,9 +107,9 @@ class ExerciseListItem extends Component{
} }
{ {
this.props.isNotMember()? this.props.isNotMember()? item.lock_status === 0 ?
<span className="fl mt3 font-16 font-bd color-dark comnonwidth580" title={item.exercise_name}>{item.exercise_name}</span> <span className="fl mt3 font-16 font-bd color-dark comnonwidth580" title={item.exercise_name}>{item.exercise_name}</span>
:"" : <a className="fl font-16 font-bd mt2 color-grey-3 task-hide comnonwidth580" title={item.exercise_name} href={`/courses/${coursesId}/exercises/${item.id}/student_exercise_list?tab=0`}>{item.exercise_name}</a>:""
} }
{ {

@ -548,7 +548,7 @@ class Exercisesetting extends Component{
}, },
}; };
console.log(flagPageEdit===true?polls&&polls.exercise_status===1?3:2:1) // console.log(flagPageEdit===true?polls&&polls.exercise_status===1?3:2:1)
return( return(
<div> <div>
<Modals <Modals

@ -7,6 +7,7 @@ import '../css/members.css';
import '../css/busyWork.css'; import '../css/busyWork.css';
import axios from 'axios'; import axios from 'axios';
import Modals from '../../modals/Modals'; import Modals from '../../modals/Modals';
import DownloadMessage from '../../modals/DownloadMessage';
import Studentshavecompletedthelist from './Studentshavecompletedthelist'; import Studentshavecompletedthelist from './Studentshavecompletedthelist';
import WrappedExercisesetting from './Exercisesetting'; import WrappedExercisesetting from './Exercisesetting';
import ExerciseDisplay from './ExerciseDisplay' import ExerciseDisplay from './ExerciseDisplay'
@ -112,10 +113,25 @@ class Testpapersettinghomepage extends Component{
experiment=(url)=>{ experiment=(url)=>{
axios.get(url).then((response) => { axios.get(url).then((response) => {
if(response.status === 200){ if(response.data.status&&response.data.status===-1){
window.open(url, '_blank');
}else if(response.data.status&&response.data.status===-2){
} if(response.data.messages === "100"){
// 已超出文件导出的上限数量100 ),建议:
this.setState({
DownloadType:false,
DownloadMessageval:100
})
}else {
//因附件资料超过500M
this.setState({
DownloadType:false,
DownloadMessageval:500
})
}
}else {
window.open(url, '_blank');
}
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
}); });
@ -152,6 +168,13 @@ class Testpapersettinghomepage extends Component{
Loadtype:false Loadtype:false
}) })
} }
Downloadcal=()=>{
this.setState({
DownloadType:false,
DownloadMessageval:undefined
})
}
render(){ render(){
let {tab,visible,Commonheadofthetestpaper}=this.state; let {tab,visible,Commonheadofthetestpaper}=this.state;
const isAdmin =this.props.isAdmin(); const isAdmin =this.props.isAdmin();
@ -159,6 +182,12 @@ class Testpapersettinghomepage extends Component{
return( return(
<div className="newMain clearfix "> <div className="newMain clearfix ">
<DownloadMessage
{...this.props}
value={this.state.DownloadMessageval}
modalCancel={this.Downloadcal}
modalsType={this.state.DownloadType}
/>
<div className={"educontent mb20"} style={{width:"1200px"}}> <div className={"educontent mb20"} style={{width:"1200px"}}>
{/* 公用的提示弹框 */} {/* 公用的提示弹框 */}
{this.state.Modalstype===true?<Modals {this.state.Modalstype===true?<Modals
@ -262,7 +291,7 @@ class Testpapersettinghomepage extends Component{
导出<i className="iconfont icon-xiajiantou font-12 ml2"></i> 导出<i className="iconfont icon-xiajiantou font-12 ml2"></i>
<ul className="drop_down_menu" style={{"right":"-34px","left":"unset","height":"auto"}}> <ul className="drop_down_menu" style={{"right":"-34px","left":"unset","height":"auto"}}>
<li><a onClick={()=>this.experiment(`/api/exercises/${this.props.match.params.Id}/exercise_lists.xlsx`)}>学生成绩</a></li> <li><a onClick={()=>this.experiment(`/api/exercises/${this.props.match.params.Id}/exercise_lists.xlsx`)}>学生成绩</a></li>
<li><a href={`/api/exercises/${this.props.match.params.Id}/export_exercise`} >空白试卷</a></li> <li><a onClick={()=>this.experiment(`/api/exercises/${this.props.match.params.Id}/export_exercise`)} >空白试卷</a></li>
<li><a onClick={()=>this.experiment(`/api/zip/export_exercises?exercise_id=${this.props.match.params.Id}${this.state.groupyslsval}`)}>学生答题试卷</a></li> <li><a onClick={()=>this.experiment(`/api/zip/export_exercises?exercise_id=${this.props.match.params.Id}${this.state.groupyslsval}`)}>学生答题试卷</a></li>
</ul> </ul>
</li>:""} </li>:""}

@ -229,15 +229,17 @@ class GraduateTaskItem extends Component{
} }
{ {
this.props.isNotMember? this.props.isNotMember===true?this.props.discussMessage.private_icon===true?
<span className="fl mt3 font-16 font-bd color-dark maxwidth580" title={discussMessage.name}>{discussMessage.name}</span> <span className="fl mt3 font-16 font-bd color-dark maxwidth580" title={discussMessage.name}>{discussMessage.name}</span>
:"" :<a href={"/courses/"+coursesId+"/graduation_tasks/"+categoryid+"/"+taskid+"/list"}
title={discussMessage.name}
className="fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.name}</a>:""
} }
{ {
this.props.discussMessage.private_icon===true? this.props.discussMessage.private_icon===true?
<Tooltip title={ this.props.isNotMember?"私有属性,非课堂成员不能访问":"私有属性"} placement="bottom"> <Tooltip title={ this.props.isNotMember===true?"私有属性,非课堂成员不能访问":"私有属性"} placement="bottom">
<i className="iconfont icon-guansuo color-grey-c ml10 font-16 fl mt4"></i> <i className="iconfont icon-guansuo color-grey-c ml10 font-16 fl mt4"></i>
</Tooltip> </Tooltip>
: :

@ -2,7 +2,7 @@ import React,{Component} from "React";
import { Form, Select, Input, Button,Checkbox,Upload,Icon,message,Modal,Spin,Tooltip} from "antd"; import { Form, Select, Input, Button,Checkbox,Upload,Icon,message,Modal,Spin,Tooltip} from "antd";
import {Link} from 'react-router-dom'; import {Link} from 'react-router-dom';
import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor'; import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor';
import { WordsBtn,getUrl ,bytesToSize,getImageUrl} from 'educoder'; import { WordsBtn,getUrl ,bytesToSize,getImageUrl,appendFileSizeToUploadFileAll} from 'educoder';
import axios from 'axios'; import axios from 'axios';
import Modals from '../../../modals/Modals'; import Modals from '../../../modals/Modals';
const Search = Input.Search; const Search = Input.Search;
@ -116,12 +116,12 @@ class GraduationTasksSubmitedit extends Component{
} }
// 附件相关 START // 附件相关 START
handleChange = (info) => { handleChange = (info) => {
let fileList = info.fileList;
// for(var list of fileList ){ if (info.file.status === 'uploading') {
// console.log(list)
// } let fileList = info.fileList;
this.setState({ fileList }); this.setState({ fileList:appendFileSizeToUploadFileAll(fileList) });
}
} }
//onAttachmentRemove = (file) => { //onAttachmentRemove = (file) => {
@ -479,6 +479,18 @@ class GraduationTasksSubmitedit extends Component{
onChange: this.handleChange, onChange: this.handleChange,
onRemove: this.onAttachmentRemove, onRemove: this.onAttachmentRemove,
beforeUpload: (file) => { beforeUpload: (file) => {
// TODO 文件存在则提示并退出
let gotSameFile = false;
this.state.fileList && this.state.fileList.some((item) => {
if (item.name && item.name.startsWith(file.name)) {
gotSameFile = true;
return true
}
})
if (gotSameFile) {
this.props.showNotification("该附件已被上传!")
return false
}
console.log('beforeUpload', file.name); console.log('beforeUpload', file.name);
const isLt150M = file.size / 1024 / 1024 < 150; const isLt150M = file.size / 1024 / 1024 < 150;
if (!isLt150M) { if (!isLt150M) {

@ -2,7 +2,7 @@ import React,{Component} from "React";
import { Form, Select, Input, Button,Checkbox,Upload,Icon,message,Modal,Tooltip,Spin} from "antd"; import { Form, Select, Input, Button,Checkbox,Upload,Icon,message,Modal,Tooltip,Spin} from "antd";
import {Link} from 'react-router-dom'; import {Link} from 'react-router-dom';
import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor'; import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor';
import { WordsBtn,getUrl,getImageUrl,bytesToSize} from 'educoder'; import { WordsBtn,getUrl,getImageUrl,bytesToSize,appendFileSizeToUploadFileAll} from 'educoder';
import axios from 'axios'; import axios from 'axios';
import Modals from '../../../modals/Modals'; import Modals from '../../../modals/Modals';
const Search = Input.Search; const Search = Input.Search;
@ -123,12 +123,10 @@ class GraduationTasksSubmitnew extends Component{
} }
// 附件相关 START // 附件相关 START
handleChange = (info) => { handleChange = (info) => {
let fileList = info.fileList; if (info.file.status === 'uploading') {
let fileList = info.fileList;
// for(var list of fileList ){ this.setState({ fileList:appendFileSizeToUploadFileAll(fileList) });
// console.log(list) }
// }
this.setState({ fileList });
} }
onAttachmentRemove = (file) => { onAttachmentRemove = (file) => {
@ -478,6 +476,18 @@ render(){
onChange: this.handleChange, onChange: this.handleChange,
onRemove: this.onAttachmentRemove, onRemove: this.onAttachmentRemove,
beforeUpload: (file) => { beforeUpload: (file) => {
// TODO 文件存在则提示并退出
let gotSameFile = false;
this.state.fileList && this.state.fileList.some((item) => {
if (item.name && item.name.startsWith(file.name)) {
gotSameFile = true;
return true
}
})
if (gotSameFile) {
this.props.showNotification("该附件已被上传!")
return false
}
console.log('beforeUpload', file.name); console.log('beforeUpload', file.name);
const isLt150M = file.size / 1024 / 1024 < 150; const isLt150M = file.size / 1024 / 1024 < 150;
if (!isLt150M) { if (!isLt150M) {

@ -37,7 +37,8 @@ function buildColumns(that) {
dataIndex: 'name', dataIndex: 'name',
key: 'index', key: 'index',
render: (content, item, index) => { render: (content, item, index) => {
return <a href="javascript:;">{(that.state.page - 1) * 20 + index + 1} </a> return item.isApply == true ? '' : <a href="javascript:;">{(that.state.page - 1) * 20 + index + 1
- (that.state.application_list ? that.state.application_list.length : 0)} </a>
} }
} }
// ,{ // ,{
@ -65,7 +66,7 @@ function buildColumns(that) {
}] }]
that.state.course_groups && that.state.course_groups.length && columns.push({ that.state.course_groups && that.state.course_groups.length && columns.push({
title: <Tooltip title="仅能批阅指定分班的作品">管理权限</Tooltip>, title: <Tooltip title="仅能批阅指定分班的作品">管理权限</Tooltip>,
// width: 230, width: 260,
key: 'course_groups', key: 'course_groups',
dataIndex: 'course_groups', dataIndex: 'course_groups',
// onClick={() => that.joinCourseGroup(item.id)} // onClick={() => that.joinCourseGroup(item.id)}
@ -136,7 +137,7 @@ function buildColumns(that) {
if (hasGraduationModule) { if (hasGraduationModule) {
columns.push({ columns.push({
title: '答辩组', title: '答辩组',
width: 74, // width: 90,
key: 'graduation_group', key: 'graduation_group',
dataIndex: 'graduation_group', dataIndex: 'graduation_group',
render: text => ( render: text => (
@ -546,6 +547,7 @@ class studentsList extends Component{
const combineArray = teachers.slice(0) const combineArray = teachers.slice(0)
if (page == 1) { if (page == 1) {
this.state.application_list && this.state.application_list.slice(0).reverse().forEach(item => { this.state.application_list && this.state.application_list.slice(0).reverse().forEach(item => {
item.isApply = true
combineArray.unshift(item) combineArray.unshift(item)
}) })
} }

@ -0,0 +1,21 @@
import {Base64} from 'js-base64';
import axios from 'axios';
// 导出实习报告批量zip 、xlsx 类型
export function Internshipreportsy (url,struy,types,stingtype){
axios.get((url),{responseType: 'blob'}).then((response) => {
const blob = new Blob([response.data], { type: stingtype });
const downloadElement = document.createElement('a');
const href = window.URL.createObjectURL(blob);
const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
downloadElement.href = href;
downloadElement.download = string+struy+types;
document.body.appendChild(downloadElement);
downloadElement.click();
document.body.removeChild(downloadElement) ;// 下载完成移除元素
window.URL.revokeObjectURL(href) // 释放掉blob对象
}).catch((error) => {
console.log(error)
});
}

@ -4,7 +4,9 @@ import {WordsBtn, ActionBtn} from 'educoder';
import TraineetraininginformationModal from './TraineetraininginformationModal'; import TraineetraininginformationModal from './TraineetraininginformationModal';
import ModulationModal from "../coursesPublic/ModulationModal"; import ModulationModal from "../coursesPublic/ModulationModal";
import HomeworkModal from "../coursesPublic/HomeworkModal"; import HomeworkModal from "../coursesPublic/HomeworkModal";
import DownloadMessage from '../../modals/DownloadMessage';
import {Base64} from 'js-base64'; import {Base64} from 'js-base64';
import {Internshipreportsy} from './Httpdownloads'
import { import {
Form, Form,
Select, Select,
@ -1336,88 +1338,40 @@ class Listofworks extends Component {
}); });
} }
/// 确认是否下载
confirmysl(url){
axios.get(url).then((response) => {
if(response.data.status&&response.data.status===-1){
// 导出实习报告批量 }else if(response.data.status&&response.data.status===-2){
internshipreport = (url)=>{ if(response.data.messages === "100"){
console.log("internshipreport"); // 已超出文件导出的上限数量100 ),建议:
var struy="";
try {
struy = moment().format('YYYY-MM-DD')+"-"+moment().format('hh-mm');
struy=struy.replace(/-/g,"");
}catch (e) {
console.log(1347);
console.log(e);
}
axios.get((url),{responseType: 'blob'}).then((response) => { this.setState({
console.log("1350"); DownloadType:false,
console.log(response); DownloadMessageval:100
if(response.status&&response.status===-1){ })
}else {
//因附件资料超过500M
}else if(response.status&&response.status===-2){ this.setState({
DownloadType:false,
}else{ DownloadMessageval:500
// window.location.href("/api"+url); })
// console.log("开始下载zip文件") }
const type='application/zip'//ZIP文件 }else {
const blob = new Blob([response.data], { type: type }) window.open(url, '_blank');
const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob)
const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
console.log(response.headers['content-disposition'].split('=')[1]);
downloadElement.href = href
downloadElement.download = string+struy+".zip"
document.body.appendChild(downloadElement)
downloadElement.click()
document.body.removeChild(downloadElement) // 下载完成移除元素
window.URL.revokeObjectURL(href) // 释放掉blob对象
} }
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
}); });
} }
// 课堂学生成绩的导出下载
Classstudentachievement=(url)=>{
console.log("Classstudentachievement");
// console.log();
var struy="";
try {
struy = moment().format('YYYY-MM-DD')+"-"+moment().format('hh-mm');
struy=struy.replace(/-/g,"");
}catch (e) {
console.log(1397);
console.log(e);
}
axios.get((url),{responseType: 'blob'}).then((response) => {
console.log("1374");
console.log(response);
if(response.status&&response.status===-1){
}else if(response.status&&response.status===-2){ Downloadcal=()=>{
this.setState({
}else{ DownloadType:false,
const type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' //excel文件 DownloadMessageval:undefined
const blob = new Blob([response.data], { type: type }) })
const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob)
const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
console.log(response.headers['content-disposition'].split('=')[1]);
downloadElement.href = href
downloadElement.download =string+struy+".xlsx";
document.body.appendChild(downloadElement)
downloadElement.click()
document.body.removeChild(downloadElement) // 下载完成移除元素
window.URL.revokeObjectURL(href) // 释放掉blob对象
}
}).catch((error) => {
console.log(error)
});
} }
render() { render() {
// console.log("Listofworks.js000") // console.log("Listofworks.js000")
@ -1442,7 +1396,13 @@ class Listofworks extends Component {
issCancel={() => this.hideshowmodel()} issCancel={() => this.hideshowmodel()}
updatas={() => this.isupdatas()} updatas={() => this.isupdatas()}
/> : ""} /> : ""}
<DownloadMessage
{...this.props}
value={this.state.DownloadMessageval}
modalCancel={this.Downloadcal}
modalsType={this.state.DownloadType}
/>
{visibles === true ? {visibles === true ?
<div> <div>
@ -1566,8 +1526,8 @@ class Listofworks extends Component {
{this.props.isAdmin()? <li className="li_line drop_down fr color-blue font-16 mr8 mt20" style={{"padding":"0 20px"}}> {this.props.isAdmin()? <li className="li_line drop_down fr color-blue font-16 mr8 mt20" style={{"padding":"0 20px"}}>
导出<i className="iconfont icon-xiajiantou font-12 ml2"></i> 导出<i className="iconfont icon-xiajiantou font-12 ml2"></i>
<ul className="drop_down_menu" style={{"right":"-0px","left":"unset","height":"auto"}}> <ul className="drop_down_menu" style={{"right":"-0px","left":"unset","height":"auto"}}>
<li><a onClick={()=>this.internshipreport(`/zip/shixun_report?homework_common_id=${this.props.match.params.homeworkid}&work_status=${this.state.course_groupyslstwo}&course_group=${this.state.checkedValuesineinfo}&search=${this.state.searchtext}`)}>实训报告</a></li> <li><a onClick={()=>this.confirmysl(`/zip/shixun_report?homework_common_id=${this.props.match.params.homeworkid}&work_status=${this.state.course_groupyslstwo}&course_group=${this.state.checkedValuesineinfo}&search=${this.state.searchtext}`)}>实训报告</a></li>
<li><a onClick={()=>this.Classstudentachievement(`/homework_commons/${this.props.match.params.homeworkid}/works_list.xlsx?group_id=${this.state.checkedValuesineinfo}&search=${this.state.searchtext}`)} >学生成绩</a></li> <li><a onClick={()=>this.confirmysl(`/homework_commons/${this.props.match.params.homeworkid}/works_list.xlsx?group_id=${this.state.checkedValuesineinfo}&search=${this.state.searchtext}`)} >学生成绩</a></li>
</ul> </ul>
</li>:""} </li>:""}

@ -3,7 +3,8 @@ import CoursesListType from '../coursesPublic/CoursesListType';
import {WordsBtn,ActionBtn} from 'educoder'; import {WordsBtn,ActionBtn} from 'educoder';
import ShixunWorkModal from './Shixunworkdetails/ShixunWorkModal'; import ShixunWorkModal from './Shixunworkdetails/ShixunWorkModal';
import HomeworkModal from "../coursesPublic/HomeworkModal"; import HomeworkModal from "../coursesPublic/HomeworkModal";
import NoneData from '../coursesPublic/NoneData' import NoneData from '../coursesPublic/NoneData';
import DownloadMessage from '../../modals/DownloadMessage';
import { import {
Form, Form,
Select, Select,
@ -457,91 +458,40 @@ class ShixunStudentWork extends Component {
}) })
} }
// 导出实习报告批量 // 导出实习报告批量
internshipreport = (url) => { /// 确认是否下载
console.log("internshipreport"); confirmysl(url){
// var homeworkid = this.props.match.params.homeworkid;
// let url = "/zip/shixun_report";
axios.get(url).then((response) => { axios.get(url).then((response) => {
console.log("326");
console.log(response);
if(response.data.status&&response.data.status===-1){ if(response.data.status&&response.data.status===-1){
}else if(response.data.status&&response.data.status===-2){ }else if(response.data.status&&response.data.status===-2){
if(response.data.messages === "100"){
}else{ // 已超出文件导出的上限数量100 ),建议:
const type='application/zip'//ZIP文件
const blob = new Blob([response.data], { type: type }) this.setState({
const downloadElement = document.createElement('a') DownloadType:false,
const href = window.URL.createObjectURL(blob) DownloadMessageval:100
//后台再header中传文件名 })
// console.log(Base64.decode(response.headers['content-disposition'].split('=')[1])); }else {
const string = Base64.decode(response.headers['content-disposition'].split('=')[1]); //因附件资料超过500M
downloadElement.href = href this.setState({
var now=""; DownloadType:false,
try { DownloadMessageval:500
now = moment().year()+""+(moment().month()+1)+""+moment().date()+""+moment().hour()+""+moment().minute()+"" })
console.log(now);
} catch (e) {
console.log("1376");
} }
downloadElement.download = string+now+".zip" }else {
document.body.appendChild(downloadElement) window.open(url, '_blank');
downloadElement.click()
document.body.removeChild(downloadElement) // 下载完成移除元素
window.URL.revokeObjectURL(href) // 释放掉blob对象
} }
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
}); });
} }
// 课堂学生成绩的导出下载 Downloadcal=()=>{
Classstudentachievement = (url) => { this.setState({
console.log("Classstudentachievement"); DownloadType:false,
// const course_id = this.props.match.params.coursesId; DownloadMessageval:undefined
// let url = "/courses/" + course_id + "/export_member_scores_excel.xlsx"; })
axios.get(url).then((response) => {
console.log("1374");
console.log(response);
if(response.data.status&&response.data.status===-1){
}else if(response.data.status&&response.data.status===-2){
}else{
const type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' //excel文件
const blob = new Blob([response.data], { type: type })
const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob)
//后台再header中传文件名
// console.log("1409");
// console.log(Base64.decode(response.headers['content-disposition'].split('=')[1]));
const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
var now="";
try {
now = moment().year()+""+(moment().month()+1)+""+moment().date()+""+moment().hour()+""+moment().minute()+""
console.log("1422");
console.log(now);
} catch (e) {
console.log("1432");
}
downloadElement.href = href
downloadElement.download =string+now+".xlsx";
document.body.appendChild(downloadElement)
downloadElement.click()
document.body.removeChild(downloadElement) // 下载完成移除元素
window.URL.revokeObjectURL(href) // 释放掉blob对象
}
}).catch((error) => {
console.log(error)
});
} }
render() { render() {
let { let {
data, data,
@ -631,6 +581,13 @@ class ShixunStudentWork extends Component {
issCancel={()=>this.hideshowmodel()} issCancel={()=>this.hideshowmodel()}
updatas={()=>this.getupdata()} updatas={()=>this.getupdata()}
/>:""} />:""}
<DownloadMessage
{...this.props}
value={this.state.DownloadMessageval}
modalCancel={this.Downloadcal}
modalsType={this.state.DownloadType}
/>
{/*立即发布*/} {/*立即发布*/}
<HomeworkModal <HomeworkModal
modaltype={this.state.modaltype} modaltype={this.state.modaltype}
@ -726,9 +683,9 @@ class ShixunStudentWork extends Component {
{this.props.isAdmin() ? <li className="li_line drop_down fr color-blue font-16 mr8 mt20" style={{"padding": "0 20px"}}> {this.props.isAdmin() ? <li className="li_line drop_down fr color-blue font-16 mr8 mt20" style={{"padding": "0 20px"}}>
导出<i className="iconfont icon-xiajiantou font-12 ml2"></i> 导出<i className="iconfont icon-xiajiantou font-12 ml2"></i>
<ul className="drop_down_menu" style={{"right": "-0px", "left": "unset", "height": "auto"}}> <ul className="drop_down_menu" style={{"right": "-0px", "left": "unset", "height": "auto"}}>
<li><a onClick={()=>this.internshipreport(`/zip/shixun_report?homework_common_id=${this.props.match.params.homeworkid}`)}>实训报告</a> <li><a onClick={()=>this.confirmysl(`/zip/shixun_report?homework_common_id=${this.props.match.params.homeworkid}`)}>实训报告</a>
</li> </li>
<li><a onClick={()=>this.Classstudentachievement(`/homework_commons/${this.props.match.params.homeworkid}/works_list.xlsx`)}>学生成绩</a> <li><a onClick={()=>this.confirmysl(`/homework_commons/${this.props.match.params.homeworkid}/works_list.xlsx`)}>学生成绩</a>
</li> </li>
</ul> </ul>
</li> : ""} </li> : ""}

@ -8,6 +8,7 @@ import OfficialAcademicTranscript from './shixunreport/OfficialAcademicTranscrip
import Coursesshixundetails from './shixunreport/Coursesshixundetails'; import Coursesshixundetails from './shixunreport/Coursesshixundetails';
import Shixunechart from './shixunreport/Shixunechart'; import Shixunechart from './shixunreport/Shixunechart';
import {UnControlled as CodeMirror} from 'react-codemirror2'; import {UnControlled as CodeMirror} from 'react-codemirror2';
import DownloadMessage from '../../modals/DownloadMessage';
import 'codemirror/mode/cmake/cmake'; import 'codemirror/mode/cmake/cmake';
import 'codemirror/mode/xml/xml'; import 'codemirror/mode/xml/xml';
import 'codemirror/mode/javascript/javascript'; import 'codemirror/mode/javascript/javascript';
@ -30,47 +31,35 @@ class ShixunWorkReport extends Component {
spinning:true spinning:true
} }
} }
// 导出实习报告批量 /// 确认是否下载
internshipreport = (url) => { confirmysl(url){
console.log("internshipreport");
// var homeworkid = this.props.match.params.homeworkid;
// let url = "/zip/shixun_report";
axios.get(url).then((response) => { axios.get(url).then((response) => {
console.log("326");
console.log(response);
if(response.data.status&&response.data.status===-1){ if(response.data.status&&response.data.status===-1){
}else if(response.data.status&&response.data.status===-2){ }else if(response.data.status&&response.data.status===-2){
if(response.data.messages === "100"){
// 已超出文件导出的上限数量100 ),建议:
}else{ this.setState({
const type='application/zip'//ZIP文件 DownloadType:false,
const blob = new Blob([response.data], { type: type }) DownloadMessageval:100
const downloadElement = document.createElement('a') })
const href = window.URL.createObjectURL(blob) }else {
//后台再header中传文件名 //因附件资料超过500M
// console.log(Base64.decode(response.headers['content-disposition'].split('=')[1])); this.setState({
const string = Base64.decode(response.headers['content-disposition'].split('=')[1]); DownloadType:false,
downloadElement.href = href DownloadMessageval:500
var now=""; })
try {
now = moment().year()+""+(moment().month()+1)+""+moment().date()+""+moment().hour()+""+moment().minute()+""
console.log(now);
} catch (e) {
console.log("1376");
} }
downloadElement.download = string+now+".zip" }else {
document.body.appendChild(downloadElement) window.open(url, '_blank');
downloadElement.click()
document.body.removeChild(downloadElement) // 下载完成移除元素
window.URL.revokeObjectURL(href) // 释放掉blob对象
} }
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
}); });
} }
componentDidMount() { componentDidMount() {
this.setState({ this.setState({
spinning:true spinning:true
@ -104,6 +93,12 @@ class ShixunWorkReport extends Component {
} }
} }
} }
Downloadcal=()=>{
this.setState({
DownloadType:false,
DownloadMessageval:undefined
})
}
render() { render() {
let{data} =this.state; let{data} =this.state;
let category_id=data===undefined?"":data.category.category_id; let category_id=data===undefined?"":data.category.category_id;
@ -129,13 +124,18 @@ class ShixunWorkReport extends Component {
<WordsBtn className="fl">{data&&data.username}</WordsBtn> <WordsBtn className="fl">{data&&data.username}</WordsBtn>
</p> </p>
</div> </div>
<DownloadMessage
{...this.props}
value={this.state.DownloadMessageval}
modalCancel={this.Downloadcal}
modalsType={this.state.DownloadType}
/>
<div style={{ width:'100%',height:'75px'}} > <div style={{ width:'100%',height:'75px'}} >
<p className=" fl color-black mt25 summaryname">{data&&data.shixun_name}</p> <p className=" fl color-black mt25 summaryname">{data&&data.shixun_name}</p>
{/*{this.props.isAdmin()?<a className=" fr font-14 ml30 mt10 mr20 color-grey-9 ">导出实训报告数据</a>:""}*/} {/*{this.props.isAdmin()?<a className=" fr font-14 ml30 mt10 mr20 color-grey-9 ">导出实训报告数据</a>:""}*/}
{this.props.isAdmin() ? <a {this.props.isAdmin() ? <a
className="fr color-blue font-16" className="fr color-blue font-16"
onClick={()=>this.internshipreport(`/zip/shixun_report?homework_common_id=${homeworkid}`)} onClick={()=>this.confirmysl(`/zip/shixun_report?homework_common_id=${homeworkid}`)}
>导出实训报告数据</a> : ""} >导出实训报告数据</a> : ""}
</div> </div>

@ -304,15 +304,16 @@ class ShixunhomeWorkItem extends Component{
} }
{ {
this.props.isNotMember? this.props.isNotMember===true? this.props.discussMessage.private_icon===true?
<span className="fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.name}</span> <span className="fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.name}</span>
:"" : <Link to={`/courses/${this.props.match.params.coursesId}/${this.state.shixuntypes}/${discussMessage.homework_id}/openlist`}
className="fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.name}</Link>:""
} }
{ {
this.props.discussMessage.private_icon===true? this.props.discussMessage.private_icon===true?
<Tooltip title={ this.props.isNotMember?"私有属性,非课堂成员不能访问":"私有属性"} placement="bottom"> <Tooltip title={ this.props.isNotMember===true?"私有属性,非课堂成员不能访问":"私有属性"} placement="bottom">
<i className="iconfont icon-guansuo color-grey-c ml10 font-16 fl mt4"></i> <i className="iconfont icon-guansuo color-grey-c ml10 font-16 fl mt4"></i>
</Tooltip> </Tooltip>
: :
@ -356,9 +357,9 @@ class ShixunhomeWorkItem extends Component{
` `
} }
</style> </style>
{this.props.isAdmin?<div className={this.props.isAdminOrTeacher()?"homepagePostSetting homepagePostSettingname":"homepagePostSetting homepagePostSettingbox"} style={{"right":"-2px","top":"44px","display":"block"}}> {this.props.isAdmin?<div className={this.props.isAdminOrCreator()?"homepagePostSetting homepagePostSettingname":"homepagePostSetting homepagePostSettingbox"} style={{"right":"-2px","top":"44px","display":"block"}}>
<a className="btn colorblue font-16" href={"/shixuns/"+discussMessage.shixun_identifier+"/challenges"} target={"_blank"}>实训详情</a> <a className="btn colorblue font-16" href={"/shixuns/"+discussMessage.shixun_identifier+"/challenges"} target={"_blank"}>实训详情</a>
{this.props.isAdminOrTeacher()?<a onClick={()=>this.editname(discussMessage.name,discussMessage.homework_id)} className={"btn colorblue ml20 font-16"}>重命名</a>:""} {this.props.isAdminOrCreator()?<a onClick={()=>this.editname(discussMessage.name,discussMessage.homework_id)} className={"btn colorblue ml20 font-16"}>重命名</a>:""}
<WordsBtn className="btn colorblue ml20 font-16" to={`/courses/${this.props.match.params.coursesId}/${this.state.shixuntypes}/${discussMessage.homework_id}/settings`} > 设置</WordsBtn> <WordsBtn className="btn colorblue ml20 font-16" to={`/courses/${this.props.match.params.coursesId}/${this.state.shixuntypes}/${discussMessage.homework_id}/settings`} > 设置</WordsBtn>
</div>:""} </div>:""}

@ -27,7 +27,7 @@ import '../poll/pollStyle.css'
import moment from 'moment'; import moment from 'moment';
import 'moment/locale/zh-cn'; import 'moment/locale/zh-cn';
import Modals from "../../modals/Modals"; import Modals from "../../modals/Modals";
import DownloadMessage from '../../modals/DownloadMessage';
const RadioGroup = Radio.Group; const RadioGroup = Radio.Group;
//GraduationTaskssetting.js //GraduationTaskssetting.js
@ -1609,93 +1609,40 @@ class Trainingjobsetting extends Component {
showmodel:false showmodel:false
}) })
} }
// 导出实习报告批量
internshipreport = (url) => {
console.log("internshipreport");
// var homeworkid = this.props.match.params.homeworkid;
// let url = "/zip/shixun_report";
axios.get(url).then((response) => {
console.log("326");
console.log(response);
if(response.data.status&&response.data.status===-1){
}else if(response.data.status&&response.data.status===-2){
}else{
const type='application/zip'//ZIP文件
const blob = new Blob([response.data], { type: type })
const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob)
//后台再header中传文件名
// console.log(Base64.decode(response.headers['content-disposition'].split('=')[1]));
const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
downloadElement.href = href
var now="";
try {
now = moment().year()+""+(moment().month()+1)+""+moment().date()+""+moment().hour()+""+moment().minute()+""
console.log(now);
} catch (e) {
console.log("1376");
}
downloadElement.download = string+now+".zip"
document.body.appendChild(downloadElement)
downloadElement.click()
document.body.removeChild(downloadElement) // 下载完成移除元素
window.URL.revokeObjectURL(href) // 释放掉blob对象
}
}).catch((error) => {
console.log(error)
});
}
// 课堂学生成绩的导出下载 /// 确认是否下载
Classstudentachievement = (url) => { confirmysl(url){
console.log("Classstudentachievement");
// const course_id = this.props.match.params.coursesId;
// let url = "/courses/" + course_id + "/export_member_scores_excel.xlsx";
axios.get(url).then((response) => { axios.get(url).then((response) => {
console.log("1374");
console.log(response);
if(response.data.status&&response.data.status===-1){ if(response.data.status&&response.data.status===-1){
}else if(response.data.status&&response.data.status===-2){ }else if(response.data.status&&response.data.status===-2){
if(response.data.messages === "100"){
}else{ // 已超出文件导出的上限数量100 ),建议:
const type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' //excel文件 this.setState({
const blob = new Blob([response.data], { type: type }) DownloadType:false,
const downloadElement = document.createElement('a') DownloadMessageval:100
const href = window.URL.createObjectURL(blob) })
//后台再header中传文件名 }else {
// console.log("1409"); //因附件资料超过500M
// console.log(Base64.decode(response.headers['content-disposition'].split('=')[1])); this.setState({
const string = Base64.decode(response.headers['content-disposition'].split('=')[1]); DownloadType:false,
var now=""; DownloadMessageval:500
try { })
now = moment().year()+""+(moment().month()+1)+""+moment().date()+""+moment().hour()+""+moment().minute()+""
console.log("1422");
console.log(now);
} catch (e) {
console.log("1432");
} }
downloadElement.href = href }else {
downloadElement.download =string+now+".xlsx"; window.open(url, '_blank');
document.body.appendChild(downloadElement)
downloadElement.click()
document.body.removeChild(downloadElement) // 下载完成移除元素
window.URL.revokeObjectURL(href) // 释放掉blob对象
} }
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
}); });
} }
Downloadcal=()=>{
this.setState({
DownloadType:false,
DownloadMessageval:undefined
})
}
render() { render() {
@ -1729,6 +1676,14 @@ class Trainingjobsetting extends Component {
data={[]} data={[]}
issCancel={()=>this.hideshowmodel()} issCancel={()=>this.hideshowmodel()}
/>:""} />:""}
<DownloadMessage
{...this.props}
value={this.state.DownloadMessageval}
modalCancel={this.Downloadcal}
modalsType={this.state.DownloadType}
/>
{/*立即发布*/} {/*立即发布*/}
<HomeworkModal <HomeworkModal
modaltype={this.state.modaltype} modaltype={this.state.modaltype}
@ -1835,9 +1790,9 @@ class Trainingjobsetting extends Component {
{this.props.isAdmin() ? <li className="li_line drop_down fr color-blue font-16 mr8 mt20" style={{"padding": "0 20px"}}> {this.props.isAdmin() ? <li className="li_line drop_down fr color-blue font-16 mr8 mt20" style={{"padding": "0 20px"}}>
导出<i className="iconfont icon-xiajiantou font-12 ml2"></i> 导出<i className="iconfont icon-xiajiantou font-12 ml2"></i>
<ul className="drop_down_menu" style={{"right": "-0px", "left": "unset", "height": "auto"}}> <ul className="drop_down_menu" style={{"right": "-0px", "left": "unset", "height": "auto"}}>
<li><a onClick={()=>this.internshipreport(`/zip/shixun_report?homework_common_id=${this.props.match.params.homeworkid}`)}>实训报告</a> <li><a onClick={()=>this.confirmysl(`/zip/shixun_report?homework_common_id=${this.props.match.params.homeworkid}`)}>实训报告</a>
</li> </li>
<li><a onClick={()=>this.Classstudentachievement(`/homework_commons/${this.props.match.params.homeworkid}/works_list.xlsx`)}>学生成绩</a> <li><a onClick={()=>this.confirmysl(`/homework_commons/${this.props.match.params.homeworkid}/works_list.xlsx`)}>学生成绩</a>
</li> </li>
</ul> </ul>
</li>: ""} </li>: ""}

@ -1,8 +1,6 @@
import React, {Component} from "react"; import React, {Component} from "react";
import CoursesListType from '../coursesPublic/CoursesListType'; import CoursesListType from '../coursesPublic/CoursesListType';
import {WordsBtn, ActionBtn, markdownToHTML} from 'educoder'; import {WordsBtn, ActionBtn, markdownToHTML} from 'educoder';
import GraduateTopicReply from '../graduation/topics/GraduateTopicReply'
import MemoDetailMDEditortwo from '../../forums/MemoDetailMDEditortwo'
import { import {
Form, Form,
Select, Select,
@ -37,13 +35,9 @@ import CommonReply from "../common/comments/CommonReply";
import Homeworddescription from "../shixunHomework/Homeworddescription"; import Homeworddescription from "../shixunHomework/Homeworddescription";
import ShixunWorkModal from './Shixunworkdetails/ShixunWorkModal'; import ShixunWorkModal from './Shixunworkdetails/ShixunWorkModal';
import HomeworkModal from "../coursesPublic/HomeworkModal"; import HomeworkModal from "../coursesPublic/HomeworkModal";
// import Homeworddescription from "../shixunHomework/Homeworddescription"; import DownloadMessage from '../../modals/DownloadMessage';
const TextArea = Input.TextArea const TextArea = Input.TextArea
//GraduationTaskssetting.js
//作业问答页面 //作业问答页面
class Workquestionandanswer extends Component { class Workquestionandanswer extends Component {
//unifiedsetting 统一设置 //unifiedsetting 统一设置
@ -319,93 +313,38 @@ class Workquestionandanswer extends Component {
}) })
} }
/// 确认是否下载
// 导出实习报告批量 confirmysl(url){
internshipreport = (url) => {
console.log("internshipreport");
// var homeworkid = this.props.match.params.homeworkid;
// let url = "/zip/shixun_report";
axios.get(url).then((response) => { axios.get(url).then((response) => {
console.log("326");
console.log(response);
if(response.data.status&&response.data.status===-1){ if(response.data.status&&response.data.status===-1){
}else if(response.data.status&&response.data.status===-2){ }else if(response.data.status&&response.data.status===-2){
if(response.data.messages === "100"){
}else{ // 已超出文件导出的上限数量100 ),建议:
const type='application/zip'//ZIP文件 this.setState({
const blob = new Blob([response.data], { type: type }) DownloadType:false,
const downloadElement = document.createElement('a') DownloadMessageval:100
const href = window.URL.createObjectURL(blob) })
//后台再header中传文件名 }else {
// console.log(Base64.decode(response.headers['content-disposition'].split('=')[1])); //因附件资料超过500M
const string = Base64.decode(response.headers['content-disposition'].split('=')[1]); this.setState({
downloadElement.href = href DownloadType:false,
var now=""; DownloadMessageval:500
try { })
now = moment().year()+""+(moment().month()+1)+""+moment().date()+""+moment().hour()+""+moment().minute()+""
console.log(now);
} catch (e) {
console.log("1376");
} }
downloadElement.download = string+now+".zip" }else {
document.body.appendChild(downloadElement) window.open(url, '_blank');
downloadElement.click()
document.body.removeChild(downloadElement) // 下载完成移除元素
window.URL.revokeObjectURL(href) // 释放掉blob对象
} }
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
}); });
} }
Downloadcal=()=>{
// 课堂学生成绩的导出下载 this.setState({
Classstudentachievement = (url) => { DownloadType:false,
console.log("Classstudentachievement"); DownloadMessageval:undefined
// const course_id = this.props.match.params.coursesId; })
// let url = "/courses/" + course_id + "/export_member_scores_excel.xlsx";
axios.get(url).then((response) => {
console.log("1374");
console.log(response);
if(response.data.status&&response.data.status===-1){
}else if(response.data.status&&response.data.status===-2){
}else{
const type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' //excel文件
const blob = new Blob([response.data], { type: type })
const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob)
//后台再header中传文件名
// console.log("1409");
// console.log(Base64.decode(response.headers['content-disposition'].split('=')[1]));
const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
var now="";
try {
now = moment().year()+""+(moment().month()+1)+""+moment().date()+""+moment().hour()+""+moment().minute()+""
console.log("1422");
console.log(now);
} catch (e) {
console.log("1432");
}
downloadElement.href = href
downloadElement.download =string+now+".xlsx";
document.body.appendChild(downloadElement)
downloadElement.click()
document.body.removeChild(downloadElement) // 下载完成移除元素
window.URL.revokeObjectURL(href) // 释放掉blob对象
}
}).catch((error) => {
console.log(error)
});
} }
render() { render() {
const dateFormat = 'YYYY-MM-DD HH:mm:ss'; const dateFormat = 'YYYY-MM-DD HH:mm:ss';
let { let {
@ -434,6 +373,12 @@ class Workquestionandanswer extends Component {
issCancel={() => this.hideshowmodel()} issCancel={() => this.hideshowmodel()}
updatas={() => this.isupdatas()} updatas={() => this.isupdatas()}
/> : ""} /> : ""}
<DownloadMessage
{...this.props}
value={this.state.DownloadMessageval}
modalCancel={this.Downloadcal}
modalsType={this.state.DownloadType}
/>
{/*立即发布*/} {/*立即发布*/}
<HomeworkModal <HomeworkModal
modaltype={this.state.modaltype} modaltype={this.state.modaltype}
@ -531,9 +476,9 @@ class Workquestionandanswer extends Component {
<li className="li_line drop_down fr color-blue font-16 mr8 mt20" style={{"padding": "0 20px"}}> <li className="li_line drop_down fr color-blue font-16 mr8 mt20" style={{"padding": "0 20px"}}>
导出<i className="iconfont icon-xiajiantou font-12 ml2"></i> 导出<i className="iconfont icon-xiajiantou font-12 ml2"></i>
<ul className="drop_down_menu" style={{"right": "-0px", "left": "unset", "height": "auto"}}> <ul className="drop_down_menu" style={{"right": "-0px", "left": "unset", "height": "auto"}}>
<li><a onClick={()=>this.internshipreport(`/zip/shixun_report?homework_common_id=${this.props.match.params.homeworkid}`)}>实训报告</a> <li><a onClick={()=>this.confirmysl(`/zip/shixun_report?homework_common_id=${this.props.match.params.homeworkid}`)}>实训报告</a>
</li> </li>
<li><a onClick={()=>this.Classstudentachievement(`/homework_commons/${this.props.match.params.homeworkid}/works_list.xlsx`)}>学生成绩</a> <li><a onClick={()=>this.confirmysl(`/homework_commons/${this.props.match.params.homeworkid}/works_list.xlsx`)}>学生成绩</a>
</li> </li>
</ul> </ul>
</li> : ""} </li> : ""}

@ -62,6 +62,8 @@ class EducoderLogin extends Component {
this.state = { this.state = {
showbool: 3, showbool: 3,
logini:3, logini:3,
namezh:"",
passmm:""
} }
}else { }else {
if(props.match.url === "/login"){ if(props.match.url === "/login"){
@ -69,6 +71,8 @@ class EducoderLogin extends Component {
showbool: 1, showbool: 1,
loginstatus:true, loginstatus:true,
logini:1, logini:1,
namezh:"",
passmm:""
} }
}else if(props.match.url === "/register"){ }else if(props.match.url === "/register"){
@ -76,11 +80,15 @@ class EducoderLogin extends Component {
showbool: 1, showbool: 1,
loginstatus:false, loginstatus:false,
logini:2, logini:2,
namezh:"",
passmm:""
} }
}else{ }else{
this.state = { this.state = {
showbool: 1, showbool: 1,
logini:1, logini:1,
namezh:"",
passmm:""
} }
} }
@ -101,14 +109,16 @@ class EducoderLogin extends Component {
}) })
} }
Setshowbool = (e) => { Setshowbool = (e,name,pass) => {
if (e===1) { if (e===1) {
this.setState({ this.setState({
showbool: 1 showbool: 1
}) })
} else if(e===2) { } else if(e===2) {
this.setState({ this.setState({
showbool: 2 showbool: 2,
namezh:name,
passmm:pass,
}) })
}else if(e===3){ }else if(e===3){
this.setState({ this.setState({
@ -155,7 +165,7 @@ class EducoderLogin extends Component {
<div style={{"margin-top": "40px","height":"580px"}}> <div style={{"margin-top": "40px","height":"580px"}}>
<LoginRegisterComponent {...this.props} {...this.state} <LoginRegisterComponent {...this.props} {...this.state}
Setshowbool={(e)=>this.Setshowbool(e)} ></LoginRegisterComponent> Setshowbool={(e,name,pass)=>this.Setshowbool(e,name,pass)} ></LoginRegisterComponent>
</div> </div>

@ -316,7 +316,7 @@ class LoginDialog extends Component {
// // return Promise.reject(error); // // return Promise.reject(error);
}); });
} }
handleDialogClose() { handleDialogClose = () => {
if(this.props.match.path==="/"){ if(this.props.match.path==="/"){
this.setState({ this.setState({
isRender: false isRender: false

@ -387,6 +387,9 @@ class Trialapplication extends Component {
.dialogBox2{ .dialogBox2{
height: 420px; height: 420px;
} }
#DialogIDysl{
/*z-index: 20000; 影响notification*/
}
#DialogIDysl .dialogBox { #DialogIDysl .dialogBox {
width: 560px; width: 560px;
} }

@ -0,0 +1,51 @@
import React, { Component } from 'react';
import {getImageUrl} from 'educoder';
import { Modal} from 'antd';
class DownloadMessage extends Component {
constructor(props) {
super(props);
this.state = {
funmodalsType:false,
istype:false
}
}
setDownload=()=>{
this.props.modalCancel();
window.open(`/users/${this.props.user.login}/private_messages`)
}
render() {
return(
<Modal
keyboard={false}
title="提示"
visible={this.props.modalsType===undefined?false:this.props.modalsType}
closable={false}
footer={null}
destroyOnClose={true}
centered={true}
width="530px"
>
<div className="task-popup-content">
{this.props.value===500?<p>
<p className="task-popup-text-center font-16">因附件资料超过500M您可以通过检索分批下载</p>
<p className="task-popup-text-center font-16 mt5">或者通过微信或者QQ联系管理员辅助您打包下载</p>
</p>:this.props.value===100?
<p>
<p className="task-popup-text-center font-16">已超出文件导出的上限数量 <span className={"color-orange-tip"}>100</span> </p>
<p className="task-popup-text-center font-16 mt20">1.通过检索分批次下载</p>
<p className="task-popup-text-center font-16 mt5">2.联系管理员辅助下载</p>
</p>
:""}
<div className="clearfix mt30 edu-txt-center">
<a className="task-btn mr30" onClick={this.props.modalCancel}>取消</a>
<a className="task-btn task-btn-orange" onClick={this.setDownload}>立即联系</a>
</div>
</div>
</Modal>
)
}
}
export default DownloadMessage;

@ -6,6 +6,8 @@ import {BrowserRouter as Router, Route, Link, Switch} from "react-router-dom";
// import "antd/dist/antd.css"; // import "antd/dist/antd.css";
import TPMMDEditor from '../../tpm/challengesnew/TPMMDEditor';
import axios from 'axios'; import axios from 'axios';
import './css/TPMchallengesnew.css'; import './css/TPMchallengesnew.css';
@ -28,129 +30,10 @@ const Option = Select.Option;
const RadioGroup = Radio.Group; const RadioGroup = Radio.Group;
// 恢复数据
function md_rec_data(k,mdu,id, editor){
if(window.sessionStorage.getItem(k+mdu) !== null){
editor.setValue(window.sessionStorage.getItem(k+mdu));
md_clear_data(k,mdu,id);
}
}
// 保存数据
function md_add_data(k,mdu,d){
window.sessionStorage.setItem(k+mdu,d);
}
// 清空保存的数据
function md_clear_data(k,mdu,id){
window.sessionStorage.removeItem(k+mdu);
var id1 = "#e_tip_"+id;
var id2 = "#e_tips_"+id;
if(k == 'content'){
$(id2).html("");
}else{
$(id1).html("");
}
}
function md_elocalStorage(editor,mdu,id){
if (window.sessionStorage){
var oc = window.sessionStorage.getItem('content'+mdu);
if(oc !== null ){
$("#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>';
$("#e_tips_"+id).html(h);
}
setInterval(function() {
var d = new Date();
var h = d.getHours();
var m = d.getMinutes();
var s = d.getSeconds();
h = h < 10 ? '0' + h : h;
m = m < 10 ? '0' + m : m;
s = s < 10 ? '0' + s : s;
if(editor.getValue().trim() != ""){
md_add_data("content",mdu,editor.getValue());
var id1 = "#e_tip_"+id;
var id2 = "#e_tips_"+id;
$(id1).html(" 数据已于 " + h + ':' + m + ':' + s +" 保存 ");
$(id2).html("");
}
},10000);
}else{
$("#e_tip_"+id).after('您的浏览器不支持localStorage.无法开启自动保存草稿服务,请升级浏览器!');
}
}
function create_editorMD(id, width, high, placeholder, imageUrl, callback) {
var editorName = window.editormd(id, {
width: width,
height: high,
path: path, // "/editormd/lib/"
syncScrolling: "single",
tex: true,
tocm: true,
emoji: true,
taskList: true,
codeFold: true,
searchReplace: true,
htmlDecode: "style,script,iframe",
sequenceDiagram: true,
autoFocus: false,
toolbarIcons: function () {
// Or return editormd.toolbarModes[name]; // full, simple, mini
// Using "||" set icons align right.
return ["bold", "italic", "|", "list-ul", "list-ol", "|", "code", "code-block", "|", "testIcon", "testIcon1", '|', "image", "table", '|', "watch", "clear"]
},
toolbarCustomIcons: {
testIcon: "<a type=\"inline\" class=\"latex\" ><div class='zbg'></div></a>",
testIcon1: "<a type=\"latex\" class=\"latex\" ><div class='zbg_latex'></div></a>"
},
//这个配置在simple.html中并没有但是为了能够提交表单使用这个配置可以让构造出来的HTML代码直接在第二个隐藏的textarea域中方便post提交表单。
saveHTMLToTextarea: true,
// 用于增加自定义工具栏的功能可以直接插入HTML标签不使用默认的元素创建图标
dialogMaskOpacity: 0.6,
placeholder: placeholder,
imageUpload: true,
imageFormats: ["jpg", "jpeg", "gif", "png", "bmp", "webp", "JPG", "JPEG", "GIF", "PNG", "BMP", "WEBP"],
imageUploadURL: imageUrl,//url
onload: function () {
// this.previewing();
$("#" + id + " [type=\"latex\"]").bind("click", function () {
editorName.cm.replaceSelection("```latex");
editorName.cm.replaceSelection("\n");
editorName.cm.replaceSelection("\n");
editorName.cm.replaceSelection("```");
var __Cursor = editorName.cm.getDoc().getCursor();
editorName.cm.setCursor(__Cursor.line - 1, 0);
});
$("#" + id + " [type=\"inline\"]").bind("click", function () {
editorName.cm.replaceSelection("$$$$");
var __Cursor = editorName.cm.getDoc().getCursor();
editorName.cm.setCursor(__Cursor.line, __Cursor.ch - 2);
editorName.cm.focus();
});
$("[type=\"inline\"]").attr("title", "行内公式");
$("[type=\"latex\"]").attr("title", "多行公式");
md_elocalStorage(editorName, `exercise__${id}`, "Memochallengesnew");
callback && callback()
}
});
return editorName;
}
export default class TPMchallengesnew extends Component { export default class TPMchallengesnew extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.exercisememoMDRef=React.createRef();
this.state = { this.state = {
choice_url: undefined, choice_url: undefined,
practice_url: undefined, practice_url: undefined,
@ -180,52 +63,6 @@ export default class TPMchallengesnew extends Component {
} }
exerciseMD(initValue, id) {
this.contentChanged = false;
const placeholder = "";
// amp;
// 编辑时要传memoId
const imageUrl = `/api/attachments.json`;
// 创建editorMd
const exercise_editormd = create_editorMD(id, '100%', 400, placeholder, imageUrl, () => {
setTimeout(() => {
exercise_editormd.resize()
exercise_editormd.cm && exercise_editormd.cm.refresh()
}, 500)
if (initValue != undefined) {
exercise_editormd.setValue(initValue)
}
exercise_editormd.cm.on("change", (_cm, changeObj) => {
console.log('....contentChanged')
this.contentChanged = true;
})
});
this.exercise_editormd = exercise_editormd;
window.exercise_editormd = exercise_editormd;
}
formatSearch = (url) => {
if (typeof url !== "undefined") {
url = url.substr(1); //从起始索引号提取字符串中指定数目的字符
var arr = url.split("&"), //把字符串分割为字符串数组
obj = {},
newarr = [];
arr.forEach(function (v, i) { //数组遍历
// console.log(v);
// console.log(i);
newarr = v.split("=");
if (typeof obj[newarr[0]] === "undefined") {
obj[newarr[0]] = newarr[1];
}
});
return obj;
}
;
}
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;
@ -244,9 +81,11 @@ export default class TPMchallengesnew extends Component {
position: response.data.position, position: response.data.position,
task_pass_default: response.data.task_pass_default, task_pass_default: response.data.task_pass_default,
submit_url: response.data.submit_url, submit_url: response.data.submit_url,
checkpointId:checkpointId checkpointId:checkpointId,
exercisememoMDRefval:response.data.task_pass_default
}) })
this.exerciseMD(response.data.task_pass_default, "exercisememoMD");
this.exercisememoMDRef.current.setValue(response.data.task_pass_default||'')
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
}); });
@ -296,11 +135,13 @@ export default class TPMchallengesnew extends Component {
exec_time:response.data.exec_time, exec_time:response.data.exec_time,
tab2url: "/shixuns/" + id + "/challenges/"+checkpointId+"/tab=2", tab2url: "/shixuns/" + id + "/challenges/"+checkpointId+"/tab=2",
tab3url: "/shixuns/" + id + "/challenges/"+checkpointId+"/tab=3", tab3url: "/shixuns/" + id + "/challenges/"+checkpointId+"/tab=3",
exercisememoMDRefval:response.data.task_pass
}) })
if(response.data.power===false){ if(response.data.power===false){
this.props.showSnackbar("你没有权限修改"); this.props.showSnackbar("你没有权限修改");
} }
this.exerciseMD(response.data.task_pass, "exercisememoMD");
this.exercisememoMDRef.current.setValue(response.data.task_pass||'')
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
}); });
@ -372,8 +213,7 @@ export default class TPMchallengesnew extends Component {
return return
} }
const exercise_editormdvalue = this.exercise_editormd.getValue(); const exercise_editormdvalue = this.exercisememoMDRef.current.getValue().trim();
let id = this.props.match.params.shixunId; let id = this.props.match.params.shixunId;
let url = "/shixuns/" + id + "/challenges.json"; let url = "/shixuns/" + id + "/challenges.json";
@ -457,7 +297,7 @@ export default class TPMchallengesnew extends Component {
let {shixunCreatePractice, shixunCreatePracticeGroup, onshixunsmarkvalue, shixunsskillvaluelist,checkpointId,exec_time} = this.state; let {shixunCreatePractice, shixunCreatePracticeGroup, onshixunsmarkvalue, shixunsskillvaluelist,checkpointId,exec_time} = this.state;
const exercise_editormdvalue = this.exercise_editormd.getValue(); const exercise_editormdvalue = this.exercisememoMDRef.current.getValue().trim();
let id = this.props.match.params.shixunId; let id = this.props.match.params.shixunId;
@ -631,11 +471,9 @@ export default class TPMchallengesnew extends Component {
<p className="color-grey-6 font-16 mb30">过关任务</p> <p className="color-grey-6 font-16 mb30">过关任务</p>
<div className="padding10-20 edu-back-greyf5 radius4" id="exercisememoMD"> <TPMMDEditor ref={this.exercisememoMDRef} placeholder="请输入选择题的题干内容" mdID={'exercisememoMD'} refreshTimeout={1500}
<textarea style={{display: 'none'}} onInput={this.Executiveorder} id="exercisememoMD_show" name="content"> </textarea> watch={true} className="courseMessageMD" initValue={this.state.exercisememoMDRefval}></TPMMDEditor>
<div className="CodeMirror cm-s-defualt">
</div>
</div>
<p id="e_tip_Memochallengesnew" className="edu-txt-right color-grey-cd font-12"></p> <p id="e_tip_Memochallengesnew" className="edu-txt-right color-grey-cd font-12"></p>
<p id="e_tips_Memochallengesnew" className="edu-txt-right color-grey-cd font-12"></p> <p id="e_tips_Memochallengesnew" className="edu-txt-right color-grey-cd font-12"></p>
</div> </div>

@ -1,306 +1,306 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Select, Input } from 'antd'; import { Select, Input } from 'antd';
import 'antd/lib/style/index.css'; import 'antd/lib/style/index.css';
import 'antd/lib/select/style/index.css'; import 'antd/lib/select/style/index.css';
import 'antd/lib/input/style/index.css'; import 'antd/lib/input/style/index.css';
import './shixunCss/ShixunSearchBar.css'; import './shixunCss/ShixunSearchBar.css';
import axios from 'axios'; import axios from 'axios';
const $ = window.$; const $ = window.$;
const Option = Select.Option; const Option = Select.Option;
const Search = Input.Search; const Search = Input.Search;
class ShixunSearchBar extends Component { class ShixunSearchBar extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.state = { this.state = {
status: undefined, status: undefined,
diff: undefined, diff: undefined,
InputValue: undefined, InputValue: undefined,
shixunhoverData: [], shixunhoverData: [],
shixunchildValues:'', shixunchildValues:'',
shixunsearchAllvalue:"a", shixunsearchAllvalue:"a",
openStatus:false, openStatus:false,
openLevel:false openLevel:false
} }
} }
//状态筛选 //状态筛选
status_search = (value) => { status_search = (value) => {
let newvalue = value; let newvalue = value;
if (newvalue === "0") { if (newvalue === "0") {
newvalue = " " newvalue = " "
} else if (newvalue === "1") { } else if (newvalue === "1") {
newvalue = 2 newvalue = 2
} else if (newvalue === "2") { } else if (newvalue === "2") {
newvalue = 1 newvalue = 1
} else if (newvalue === "3") { } else if (newvalue === "3") {
newvalue = 3 newvalue = 3
} }
this.setState({ this.setState({
status: newvalue, status: newvalue,
openStatus:false openStatus:false
}) })
let list = [{'type': 1}, {'value': newvalue}]; let list = [{'type': 1}, {'value': newvalue}];
this.props.StatusEnquiry(list); this.props.StatusEnquiry(list);
} }
//难度筛选 //难度筛选
diff_search = (value) => { diff_search = (value) => {
this.setState({ this.setState({
diff: value, diff: value,
openLevel:false openLevel:false
}) })
let list=[{'type':2},{'value':value}]; let list=[{'type':2},{'value':value}];
this.props.StatusEnquiry(list); this.props.StatusEnquiry(list);
} }
//输入框搜索 //输入框搜索
Input_search = (value) => { Input_search = (value) => {
this.setState({ this.setState({
InputValue: value InputValue: value
}) })
this.props.OnSearchInput(value); this.props.OnSearchInput(value);
} }
//查询 //查询
shixunsearchAll = (e) => { shixunsearchAll = (e) => {
let{shixunsearchAllvalue}=this.state; let{shixunsearchAllvalue}=this.state;
let id = e.target.value; let id = e.target.value;
if(shixunsearchAllvalue===id){ if(shixunsearchAllvalue===id){
return return
} }
if(id===0){ if(id===0){
id=" " id=" "
this.setState({ this.setState({
InputValue: " " InputValue: " "
}) })
this.props.OnSearchInput(""); this.props.OnSearchInput("");
} }
let list=[{'tag_level':1},{'tag_id':id}]; let list=[{'tag_level':1},{'tag_id':id}];
if(id!=undefined){ if(id!=undefined){
this.setState({ this.setState({
shixunsearchAllvalue:id, shixunsearchAllvalue:id,
shixunchildValues:"" shixunchildValues:""
}) })
this.props.Updatasearchlist(list); this.props.Updatasearchlist(list);
} }
} }
shixunsearchall=(e)=>{ shixunsearchall=(e)=>{
let{shixunsearchAllvalue}=this.state; let{shixunsearchAllvalue}=this.state;
let id = "a"; let id = "a";
if(shixunsearchAllvalue===id){ if(shixunsearchAllvalue===id){
return return
} }
this.setState({ this.setState({
shixunsearchAllvalue:"a", shixunsearchAllvalue:"a",
shixunchildValues:"" shixunchildValues:""
}) })
this.props.allUpdatashixunlist(); this.props.allUpdatashixunlist();
} }
//选择Tab页详情 //选择Tab页详情
getshixunchildValue = (e) => { getshixunchildValue = (e) => {
let id = e.target.name; let id = e.target.name;
let newid=e.target.id; let newid=e.target.id;
let list=[{'tag_level':2},{'tag_id':id}]; let list=[{'tag_level':2},{'tag_id':id}];
if(id!=undefined||newid!=undefined){ if(id!=undefined||newid!=undefined){
this.setState({ this.setState({
shixunsearchAllvalue:newid shixunsearchAllvalue:newid
}) })
this.props.Updatasearchlist(list); this.props.Updatasearchlist(list);
} }
} }
getshixunchildValues = (e) => { getshixunchildValues = (e) => {
let id = e.target.id; let id = e.target.id;
let newid=e.target.name; let newid=e.target.name;
let list=[{'tag_level':3},{'tag_id':id}]; let list=[{'tag_level':3},{'tag_id':id}];
if(id!=undefined||newid!=undefined){ if(id!=undefined||newid!=undefined){
this.setState({ this.setState({
shixunchildValues:id, shixunchildValues:id,
shixunsearchAllvalue:newid shixunsearchAllvalue:newid
}) })
this.props.Updatasearchlist(list); this.props.Updatasearchlist(list);
} }
} }
componentDidMount() { componentDidMount() {
let hoverUrlArr = []; let hoverUrlArr = [];
let hoverUrl = `/shixuns/menus.json`; let hoverUrl = `/shixuns/menus.json`;
axios.get(hoverUrl axios.get(hoverUrl
).then((response) => { ).then((response) => {
hoverUrlArr = response.data; hoverUrlArr = response.data;
hoverUrlArr.reverse(); hoverUrlArr.reverse();
this.setState({ this.setState({
shixunhoverData: hoverUrlArr shixunhoverData: hoverUrlArr
}) })
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
}) })
} }
// componentWillReceiveProps(nextProps) { // componentWillReceiveProps(nextProps) {
// console.log(nextProps.parsedid) // console.log(nextProps.parsedid)
// if(nextProps.newtag_level===1){ // if(nextProps.newtag_level===1){
// this.setState({ // this.setState({
// InputValue: this.props.keyword, // InputValue: this.props.keyword,
// shixunsearchAllvalue:nextProps.parsedid // shixunsearchAllvalue:nextProps.parsedid
// //
// }) // })
// }else if(nextProps.newtag_level===2){ // }else if(nextProps.newtag_level===2){
// this.setState({ // this.setState({
// InputValue: this.props.keyword, // InputValue: this.props.keyword,
// shixunsearchAllvalue:nextProps.newpalce, // shixunsearchAllvalue:nextProps.newpalce,
// shixunchildValues:nextProps.parsedid // shixunchildValues:nextProps.parsedid
// //
// }) // })
// }else if(nextProps.newtag_level===3){ // }else if(nextProps.newtag_level===3){
// this.setState({ // this.setState({
// InputValue: this.props.keyword, // InputValue: this.props.keyword,
// shixunsearchAllvalue:nextProps.newpalce, // shixunsearchAllvalue:nextProps.newpalce,
// shixunchildValues:nextProps.parsedid // shixunchildValues:nextProps.parsedid
// //
// }) // })
// } // }
// //
// //
// } // }
openStatusOption=()=>{ openStatusOption=()=>{
this.setState({ this.setState({
openLevel:false, openLevel:false,
openStatus:true openStatus:true
}) })
} }
openLevelOption=()=>{ openLevelOption=()=>{
this.setState({ this.setState({
openLevel:true, openLevel:true,
openStatus:false openStatus:false
}) })
} }
openStatusOptions=()=>{ openStatusOptions=()=>{
this.setState({ this.setState({
openLevel:false, openLevel:false,
openStatus:false openStatus:false
}) })
} }
Input_searchs = (e) => { Input_searchs = (e) => {
this.setState({ this.setState({
InputValue: e.target.value InputValue: e.target.value
}) })
} }
render() { render() {
let {shixunhoverData, shixunchildValues, shixunsearchAllvalue, InputValue,openStatus,openLevel} = this.state; let {shixunhoverData, shixunchildValues, shixunsearchAllvalue, InputValue,openStatus,openLevel} = this.state;
let {typepvisible} = this.props; let {typepvisible} = this.props;
//实训首页筛选的移入和点击事件 //实训首页筛选的移入和点击事件
$(".shaiItem").hover(function(){ $(".shaiItem").hover(function(){
var hei=parseInt($(".shaiAllItem").height())-2; var hei=parseInt($(".shaiAllItem").height())-2;
$(this).find(".subshaicontent").css("top", '34px'); $(this).find(".subshaicontent").css("top", '34px');
$(this).find(".subshaicontent").show(); $(this).find(".subshaicontent").show();
},function(){ },function(){
$(this).find(".subshaicontent").hide(); $(this).find(".subshaicontent").hide();
}); });
$(".shaiItem").live("click",function(){ $(".shaiItem").live("click",function(){
$(".shaiItem").removeClass("active"); $(".shaiItem").removeClass("active");
$(this).addClass("active"); $(this).addClass("active");
$(".subshaicontent").hide(); $(".subshaicontent").hide();
}); });
$(".subshaicontent").live("click", function(event){ $(".subshaicontent").live("click", function(event){
$(".subshaicontent").hide(); $(".subshaicontent").hide();
event.stopPropagation(); event.stopPropagation();
}); });
return ( return (
<div className="edu-back-white" > <div className="edu-back-white" >
<div className="educontent"> <div className="educontent">
<div className="pt40 pb40"> <div className="pt40 pb40">
<div className="clearfix mb30 shaiContent"> <div className="clearfix mb30 shaiContent">
<span className="shaiTitle fl mt3">方向</span> <span className="shaiTitle fl mt3">方向</span>
<div className="fl pr shaiAllItem"> <div className="fl pr shaiAllItem">
<li className={shixunsearchAllvalue==="a"?"shaiItem shixun_repertoire active":"shaiItem shixun_repertoire"} value= "a" onClick={this.shixunsearchall}>全部</li> <li className={shixunsearchAllvalue==="a"?"shaiItem shixun_repertoire active":"shaiItem shixun_repertoire"} value= "a" onClick={this.shixunsearchall}>全部</li>
{ {
shixunhoverData.map((item,key)=>{ shixunhoverData.map((item,key)=>{
return( return(
<li key={key} className={parseInt(shixunsearchAllvalue)===item.id?"shaiItem shixun_repertoire active":"shaiItem shixun_repertoire"} value={item.id} onClick={this.shixunsearchAll}> <li key={key} className={parseInt(shixunsearchAllvalue)===item.id?"shaiItem shixun_repertoire active":"shaiItem shixun_repertoire"} value={item.id} onClick={this.shixunsearchAll}>
{item.name} {item.name}
<div className="subshaicontent" id={item.id+"show"} style={{ top: '33px', display: 'none',maxHeight: '400px' }}> <div className="subshaicontent" id={item.id+"show"} style={{ top: '33px', display: 'none',maxHeight: '400px' }}>
{ {
item.sub_repertoires.map((list,k)=>{ item.sub_repertoires.map((list,k)=>{
return( return(
<div className="mt20 pb10 subshaicontent-part" key={k}> <div className="mt20 pb10 subshaicontent-part" key={k}>
<a style={{ height: '20px' }} className={ "mb15 shixun_repertoire color-dark"} name={list.id} id={item.id} onClick={this.getshixunchildValue}>{list.name}</a> <a style={{ height: '20px' }} className={ "mb15 shixun_repertoire color-dark"} name={list.id} id={item.id} onClick={this.getshixunchildValue}>{list.name}</a>
<div className="sub-Item clearfix"> <div className="sub-Item clearfix">
{ {
list.tags.map((tag,e)=>{ list.tags.map((tag,e)=>{
return( return(
<a className={parseInt(shixunchildValues)===tag.id?"shixun_repertoire active":"shixun_repertoire"} key={e} id={tag.id} name={item.id} title="subshaicontentshow" rel="subshaicontent" onClick={this.getshixunchildValues}>{tag.name}</a> <a className={parseInt(shixunchildValues)===tag.id?"shixun_repertoire active":"shixun_repertoire"} key={e} id={tag.id} name={item.id} title="subshaicontentshow" rel="subshaicontent" onClick={this.getshixunchildValues}>{tag.name}</a>
) )
}) })
} }
</div> </div>
</div> </div>
) )
}) })
} }
</div> </div>
</li> </li>
) )
}) })
} }
</div> </div>
</div> </div>
<div className="clearfix"> <div className="clearfix">
<span className="shaiTitle fl mt6">筛选</span> <span className="shaiTitle fl mt6">筛选</span>
<div className="fl" onMouseLeave={this.openStatusOptions} id={"area"}> <div className="fl" onMouseLeave={this.openStatusOptions} id={"area"}>
{/*<Select className="statusSelect" defaultValue="0" style={{ width: 120 }} onChange={this.status_search} onMouseEnter={this.openStatusOption} open={openStatus}>*/} {/*<Select className="statusSelect" defaultValue="0" style={{ width: 120 }} onChange={this.status_search} onMouseEnter={this.openStatusOption} open={openStatus}>*/}
{/*<Option value="0" type="status">全部状态</Option>*/} {/*<Option value="0" type="status">全部状态</Option>*/}
{/*<Option value="1" type="status">已发布</Option>*/} {/*<Option value="1" type="status">已发布</Option>*/}
{/*<Option value="2" type="status">未发布</Option>*/} {/*<Option value="2" type="status">未发布</Option>*/}
{/*<Option value="3" type="status">已关闭</Option>*/} {/*<Option value="3" type="status">已关闭</Option>*/}
{/*</Select>*/} {/*</Select>*/}
<Select defaultValue="0" style={{ width: 120 }} onChange={this.diff_search} onMouseEnter={this.openLevelOption} open={openLevel} getPopupContainer={() => document.getElementById("area")}> <Select defaultValue="0" style={{ width: 120 }} onChange={this.diff_search} onMouseEnter={this.openLevelOption} open={openLevel} getPopupContainer={() => document.getElementById("area")}>
<Option value="0">全部难度</Option> <Option value="0">全部难度</Option>
<Option value="1">初级学员</Option> <Option value="1">初级学员</Option>
<Option value="2">中级学员</Option> <Option value="2">中级学员</Option>
<Option value="3">高级学员</Option> <Option value="3">高级学员</Option>
<Option value="4">顶级学员</Option> <Option value="4">顶级学员</Option>
</Select> </Select>
</div> </div>
{/*<div className="fr mt3">*/} {/*<div className="fr mt3">*/}
{/*<Search*/} {/*<Search*/}
{/*style={{ width: 300 }}*/} {/*style={{ width: 300 }}*/}
{/*class="search-new-input fl"*/} {/*class="search-new-input fl"*/}
{/*placeholder="请输入创建者或名称进行搜索"*/} {/*placeholder="请输入创建者或名称进行搜索"*/}
{/*value={InputValue}*/} {/*value={InputValue}*/}
{/*onInput={this.Input_searchs}*/} {/*onInput={this.Input_searchs}*/}
{/*onSearch={value => this.Input_search(value)}*/} {/*onSearch={value => this.Input_search(value)}*/}
{/*enterButton*/} {/*enterButton*/}
{/*/>*/} {/*/>*/}
{/*</div>*/} {/*</div>*/}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
); );
} }
} }
export default ShixunSearchBar; export default ShixunSearchBar;

@ -41,7 +41,7 @@ class ShixunsIndex extends Component {
parsedid:undefined, parsedid:undefined,
newtag_level:undefined, newtag_level:undefined,
newpalce:undefined, newpalce:undefined,
sort:undefined sort:"desc"
} }
} }
componentDidMount(){ componentDidMount(){
@ -100,6 +100,8 @@ class ShixunsIndex extends Component {
} }
allUpdatashixunlist=()=>{ allUpdatashixunlist=()=>{
let{sort}=this.state;
this.setState({ this.setState({
order_by: 'publish_time', order_by: 'publish_time',
tag_level: 1, tag_level: 1,
@ -109,8 +111,8 @@ class ShixunsIndex extends Component {
keyword:'', keyword:'',
status: 0, status: 0,
diff: 0, diff: 0,
}) })
let params={ let params={
order_by: 'publish_time', order_by: 'publish_time',
tag_level: 1, tag_level: 1,
@ -120,6 +122,7 @@ class ShixunsIndex extends Component {
keyword:'', keyword:'',
status: 0, status: 0,
diff: 0, diff: 0,
sort:sort
} }
this.shixunresultend(params) this.shixunresultend(params)
} }
@ -135,7 +138,7 @@ class ShixunsIndex extends Component {
typepvisible:true typepvisible:true
}) })
let {order_by, page, limit, keyword, status, diff} = this.state; let {order_by, sort, limit, keyword, status, diff} = this.state;
let params={ let params={
order_by:order_by, order_by:order_by,
@ -146,6 +149,7 @@ class ShixunsIndex extends Component {
keyword:keyword, keyword:keyword,
status:status, status:status,
diff:diff, diff:diff,
sort:sort
} }
this.shixunresultend(params) this.shixunresultend(params)
@ -192,7 +196,7 @@ class ShixunsIndex extends Component {
typepvisible:true, typepvisible:true,
pages:1 pages:1
}) })
let {order_by, tag_level, tag_id, page, limit, status, diff} = this.state; let {order_by, tag_level, tag_id, sort, limit, status, diff} = this.state;
let params= { let params= {
order_by:order_by, order_by:order_by,
tag_level:tag_level, tag_level:tag_level,
@ -202,6 +206,7 @@ class ShixunsIndex extends Component {
keyword:value, keyword:value,
status:status, status:status,
diff:diff, diff:diff,
sort:sort
} }
this.shixunresultend(params) this.shixunresultend(params)
}else{ }else{
@ -247,7 +252,7 @@ class ShixunsIndex extends Component {
typepvisible:true, typepvisible:true,
pages:value pages:value
}) })
let {order_by, tag_level, tag_id, limit, keyword, status, diff} = this.state; let {order_by, tag_level, tag_id, limit, keyword, status, diff,sort} = this.state;
let params= { let params= {
order_by:order_by, order_by:order_by,
tag_level:tag_level, tag_level:tag_level,
@ -257,6 +262,7 @@ class ShixunsIndex extends Component {
keyword:keyword, keyword:keyword,
status:status, status:status,
diff:diff, diff:diff,
sort:sort
} }
let Url=`/shixuns.json`; let Url=`/shixuns.json`;

@ -2,6 +2,7 @@ import React, {Component} from 'react';
import {Button} from 'antd'; import {Button} from 'antd';
import {broadcastChannelPostMessage} from 'educoder';
import axios from 'axios'; import axios from 'axios';
import './common.css' import './common.css'
import mytc from './img/mytc.png'; import mytc from './img/mytc.png';
@ -17,29 +18,68 @@ import ysj from './img/ysj.png';
import yunwei from './img/yunwei.png'; import yunwei from './img/yunwei.png';
import rgzn from './img/rgzn.png'; import rgzn from './img/rgzn.png';
import qita from './img/qita.png'; import qita from './img/qita.png';
//父组件 EducoderLogin.js //父组件 EducoderLogin.js
class InterestpageComponent extends Component { class InterestpageComponent extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.state = { this.state = {
gouxuans: 0, gouxuans: "",
gouxuans2:0, gouxuans2:0,
gouxuans3:[{id:1,name:"前端开发",bool:false,url:qdkf},{id:2,name:"后端开发",bool:false,url:hdkf},{id:3,name:"移动开发",bool:false,url:ydkf},{id:4,name:"数据库",bool:false,url:sjk},{id:5,name:"云计算和大数据",bool:false,url:ysj},{id:6,name:"运维与测试",bool:false,url:yunwei},{id:7,name:"人工智能",bool:false,url:rgzn},{id:8,name:"其他",bool:false,url:qita}], gouxuans3:[{id:1,name:"前端开发",bool:false,url:qdkf},{id:2,name:"后端开发",bool:false,url:hdkf},{id:3,name:"移动开发",bool:false,url:ydkf},{id:4,name:"数据库",bool:false,url:sjk},{id:5,name:"云计算和大数据",bool:false,url:ysj},{id:6,name:"运维与测试",bool:false,url:yunwei},{id:7,name:"人工智能",bool:false,url:rgzn},{id:8,name:"其他",bool:false,url:qita}],
namezh:this.props.namezh,
passmm:this.props.passmm,
}
}
componentWillReceiveProps(nextProps) {
// console.log("46");
// console.log(nextProps);
// console.log(this.props);
if (nextProps.namezh != this.props.namezh) {
// console.log("50");
// console.log(nextProps.user);
if (nextProps.namezh !== undefined) {
// console.log("53");
// console.log(nextProps.user);
this.setState({
namezh: nextProps.namezh,
})
}
}
if (nextProps.passmm != this.props.passmm) {
// console.log("50");
// console.log(nextProps.user);
if (nextProps.passmm !== undefined) {
// console.log("53");
// console.log(nextProps.user);
this.setState({
passmm: nextProps.passmm,
})
}
} }
} }
Clickteacher=(e)=>{ Clickteacher=(e)=>{
console.log(e); console.log(e);
if(e === 1){ if(e === "teacher"){
this.setState({ this.setState({
gouxuans:1, gouxuans:"teacher",
}) })
}else if(e === 2){ }else if(e ==="student"){
this.setState({ this.setState({
gouxuans:2, gouxuans:"student",
}) })
}else if(e === 3){ }else if(e === "professional"){
this.setState({ this.setState({
gouxuans:3, gouxuans:"professional",
}) })
} }
} }
@ -63,6 +103,64 @@ class InterestpageComponent extends Component {
}) })
} }
//兴趣页面点击
Interestcompletionpage(){
if(this.state.gouxuans.length === 0){
this.props.showNotification("请选择您的职业");
return
}
var ints=[];
for (var i =0;i<this.state.gouxuans.length;i++) {
if(this.state.gouxuans[i].bool === true){
ints.push(this.state.gouxuans[i].id);
}
}
var url = "/users/interest.json";
axios.post(url, {
identity:this.state.gouxuans,
interest_ids: ints,
}).then((response) => {
if (response !== undefined) {
this.Jumptotheinterestpage();
}
}).catch((error) => {
console.log(error);
})
}
//跳转然后登入
Jumptotheinterestpage=()=>{
console.log(this.state.login);
console.log(this.state.password);
var url = "/accounts/login.json";
axios.post(url, {
login: this.props.login,
password: this.props.password,
}).then((response) => {
if (response === undefined) {
return
}
if (response.status === 200) {
// if (response.data.status === 402) {
// window.location.href = response.data.url;
// } else {
// broadcastChannelPostMessage('refreshPage')
// this.setState({
// isRender: false
// })
window.location.href = "/"
// }
}
}).catch((error) => {
console.log(error);
})
}
render() { render() {
const { const {
gouxuans, gouxuans,
@ -77,15 +175,15 @@ class InterestpageComponent extends Component {
<div className="mt15"><span className="yslspans1">请选择你的职业</span></div> <div className="mt15"><span className="yslspans1">请选择你的职业</span></div>
<div className="ysldivhome1" > <div className="ysldivhome1" >
<div className="ysldivhomediv" style={{marginLeft:"30px"}} > <div className="ysldivhomediv" style={{marginLeft:"30px"}} >
<div className="ysldivhomedivtxt" onClick={()=>this.Clickteacher(1)}>{gouxuans ===1? <img src={gouxuan} className="gouxuanimg"/>:<img className="gouxuanimg" src={meigouxuan}/>}老师</div> <div className="ysldivhomedivtxt" onClick={()=>this.Clickteacher("teacher")}>{gouxuans ==="teacher"? <img src={gouxuan} className="gouxuanimg"/>:<img className="gouxuanimg" src={meigouxuan}/>}老师</div>
<div className="ysldivhomedivimg" ><img src={skzbdx} className="ysldivhomedivimg"/></div> <div className="ysldivhomedivimg" ><img src={skzbdx} className="ysldivhomedivimg"/></div>
</div> </div>
<div className="ysldivhomediv" style={{ marginLeft:"101px",marginRight:"101px"}}> <div className="ysldivhomediv" style={{ marginLeft:"101px",marginRight:"101px"}}>
<div className="ysldivhomedivtxt" onClick={()=>this.Clickteacher(2)}>{gouxuans===2? <img src={gouxuan} className="gouxuanimg"/>:<img className="gouxuanimg" src={meigouxuan}/>}学生</div> <div className="ysldivhomedivtxt" onClick={()=>this.Clickteacher("student")}>{gouxuans==="student"? <img src={gouxuan} className="gouxuanimg"/>:<img className="gouxuanimg" src={meigouxuan}/>}学生</div>
<div className="ysldivhomedivimg"><img src={mytc} className="ysldivhomedivimg"/></div> <div className="ysldivhomedivimg"><img src={mytc} className="ysldivhomedivimg"/></div>
</div> </div>
<div className="ysldivhomediv" > <div className="ysldivhomediv" >
<div className="ysldivhomedivtxt" onClick={()=>this.Clickteacher(3)}>{gouxuans===3?<img src={gouxuan} className="gouxuanimg"/>:<img className="gouxuanimg" src={meigouxuan}/>}专业人士</div> <div className="ysldivhomedivtxt" onClick={()=>this.Clickteacher("professional")}>{gouxuans==="professional"?<img src={gouxuan} className="gouxuanimg"/>:<img className="gouxuanimg" src={meigouxuan}/>}专业人士</div>
<div className="ysldivhomedivimg"><img src={zyrs1} className="ysldivhomedivimg"/></div> <div className="ysldivhomedivimg"><img src={zyrs1} className="ysldivhomedivimg"/></div>
</div> </div>
</div> </div>
@ -104,7 +202,7 @@ class InterestpageComponent extends Component {
) )
})} })}
</div> </div>
<Button className="yslbutton" size={"large"} type="primary" style={{width:"255px",height: "36px",background: "#4CACFF"}}>完成</Button> <Button className="yslbutton" size={"large"} type="primary"onClick={()=>this.Interestcompletionpage()} style={{width:"255px",height: "36px",background: "#4CACFF"} }>完成</Button>
</div> </div>

@ -344,8 +344,8 @@ class LoginRegisterComponent extends Component {
passwords: "", passwords: "",
Agreetotheterms: "", Agreetotheterms: "",
}) })
this.props.history.push(result.data.redirect_uri); // this.props.history.push(result.data.redirect_uri);
//this.props.Setshowbool(2); this.props.Setshowbool(2,this.state.logins,this.state.passwords);
} catch (e) { } catch (e) {
} }
@ -662,7 +662,7 @@ class LoginRegisterComponent extends Component {
<div className="left_right mt25 font-12 " style={{color: '#676767'}}> <div className="left_right mt25 font-12 " style={{color: '#676767'}}>
<Checkbox onChange={this.onAutoLoginChange} checked={autoLogin}>下次自动登录</Checkbox> <Checkbox onChange={this.onAutoLoginChange} checked={autoLogin}>下次自动登录</Checkbox>
<a onClick={this.StudyMakeMoney} <a onClick={()=>this.StudyMakeMoney()}
className="mr3 color-grey-9 mt3 font-12">找回密码</a> className="mr3 color-grey-9 mt3 font-12">找回密码</a>
</div> </div>

@ -59,7 +59,7 @@ class ChangeHeaderPicModal extends Component{
if (visible) { if (visible) {
setTimeout(() => { setTimeout(() => {
this.init() this.init()
}, 300) }, 500)
} }
} }

Loading…
Cancel
Save