阿里云合并到自己的分支

dev_cs
杨树林 6 years ago
commit fa4500de7a

@ -5,6 +5,8 @@ class Admins::BaseController < ApplicationController
layout 'admin'
skip_before_action :verify_authenticity_token
before_action :require_login, :require_admin!
after_action :rebind_event_if_ajax_render_partial

@ -12,7 +12,7 @@ class TaskBanksController < ApplicationController
ActiveRecord::Base.transaction do
begin
@bank.update_attributes(gtask_bank_params)
Attachment.associate_container(params[:attachment_ids], @bank.id, @bank.class) if params[:attachment_ids].blank?
Attachment.associate_container(params[:attachment_ids], @bank.id, @bank.class) if params[:attachment_ids]
normal_status(0, "更新成功")
rescue Exception => e
uid_logger(e.message)

@ -1,11 +1,12 @@
class Users::QuestionBanksController < Users::BaseController
before_action :require_login
before_action :private_user_resources!
skip_before_action :check_observed_user_exists!
# before_action :private_user_resources!
before_action :check_query_params!
before_action :check_user_permission!
def index
service = Users::QuestionBankService.new(observed_user, query_params)
service = Users::QuestionBankService.new(User.current, query_params)
question_banks = service.call
@count = question_banks.count

@ -1,35 +1,33 @@
#coding=utf-8
module SessionExtenstions
module EntryExtension
def compressed?
@compressed
end
def value
if @value
begin
Marshal.load(compressed? ? Zlib::Inflate.inflate(@value) : @value)
rescue TypeError
compressed? ? Zlib::Inflate.inflate(@value) : @value
end
end
end
def size
if @value.nil?
0
else
@value.bytesize
end
end
end
end
ActiveSupport::Cache::Entry.const_set("DEFAULT_COMPRESS_LIMIT", 1)
ActiveSupport::Cache::Entry.send(:prepend, SessionExtenstions::EntryExtension)
#coding=utf-8
module SessionExtenstions
module EntryExtension
def compressed?
@compressed
end
def value
if @value
begin
Marshal.load(compressed? ? Zlib::Inflate.inflate(@value) : @value)
rescue TypeError
compressed? ? Zlib::Inflate.inflate(@value) : @value
end
end
end
def size
if @value.nil?
0
else
@value.bytesize
end
end
end
end
ActiveSupport::Cache::Entry.const_set("DEFAULT_COMPRESS_LIMIT", 1)
ActiveSupport::Cache::Entry.send(:prepend, SessionExtenstions::EntryExtension)

@ -55,12 +55,14 @@ Rails.application.routes.draw do
get :homepage_info
end
get :question_banks, on: :collection, to: 'users/question_banks#index'
scope module: :users do
resources :courses, only: [:index]
resources :shixuns, only: [:index]
resources :projects, only: [:index]
resources :subjects, only: [:index]
resources :question_banks, only: [:index]
# resources :question_banks, only: [:index]
resource :experience_records, only: [:show]
resource :grade_records, only: [:show]
resource :watch, only: [:create, :destroy]

@ -62,7 +62,7 @@ module.exports = {
// We generate sourcemaps in production. This is slow but gives good results.
// You can exclude the *.map files from the build during deployment.
// devtool: shouldUseSourceMap ? 'nosources-source-map' : false, //正式版
devtool: shouldUseSourceMap ? 'source-map' : 'source-map',//测试版
devtool: shouldUseSourceMap ? 'source-map' : false,//测试版
// In production, we only want to load the polyfills and the app code.
entry: [require.resolve('./polyfills'), paths.appIndexJs],
output: {

@ -100,6 +100,7 @@ class NewWorkForm extends Component{
const courseId = this.state.course_id || this.props.match.params.coursesId ;
this.props.form.validateFieldsAndScroll((err, values) => {
if(err && err.personNum) delete err.personNum;
console.log(values)
const mdContnet = this.contentMdRef.current.getValue().trim();
console.log(mdContnet)
@ -135,7 +136,7 @@ class NewWorkForm extends Component{
}
// const errKeys = Object.keys(err); // || errKeys.length == 1 && errKeys[0] == 'content' && mdContnet
if (!err) {
if (!err || Object.keys(err).length == 0) {
if (this.state.isEdit) {
this.doEdit(courseId, values)
} else {
@ -451,12 +452,12 @@ class NewWorkForm extends Component{
>
{getFieldDecorator('personNum', {
validateTrigger: 'onNone',
rules: [{
// rules: [{
// required: true,
// message: '人数不能为空'
// validator: this.personNumValidator
// required: true, message: '请输入最小人数和最大人数'
}],
// }],
})(
<div>
<p className="clearfix">

@ -62,6 +62,8 @@ class ExerciseDisplay extends Component{
response.data.exercise.exercise_status = response.data.exercise.exercise_status == undefined ? 1 : response.data.exercise.exercise_status
this.setState({...response.data})
this.props.detailFetchCallback && this.props.detailFetchCallback(response);
} else {
this.props.detailFetchCallback && this.props.detailFetchCallback(response);
}
})
.catch(function (error) {

@ -216,9 +216,9 @@ class Bullsubdirectory extends Component{
let{description,whethertoeditysl,addonAfter,eduintits,informs,isSpinysl} =this.state;
let{myname,mydescription,id}=this.props;
const {getFieldDecorator} = this.props.form;
console.log("Bullsubdirectory");
console.log(this.props.isAdmin());
console.log(this.props.yslbool);
// console.log("Bullsubdirectory");
// console.log(this.props.isAdmin());
// console.log(this.props.yslbool);
return(
<React.Fragment >
<div >

@ -231,7 +231,7 @@ class Eduinforms extends Component{
<p style={{height: '20px'}}>
<span className="font-18 fl color-dark-21">公告栏</span>
{
this.props.isClassManagement() === true?
this.props.isClassManagement()===true?
(this.state.yslbool===false?
<li className="btn colorblue font-16 fr bluebkbk pointer"
onClick={() => this.bianji(true)}>

@ -67,10 +67,22 @@ class GroupPackage extends Component {
<span className="ysltextcolor05">{datas&&datas.min_num}~ {datas&&datas.max_num} 学生提交作品时需要关联同组成员组内成员作品共享</span>
</p>
}
<p>
<span className="ysltextcolor66">基于项目实施</span>
<span className="ysltextcolor05">学生必须在本平台创建项目项目管理员可以提交作品</span>
</p>
{
datas===undefined?"":datas.base_on_project===undefined?"":
datas.base_on_project===true?
<p>
<span className="ysltextcolor66">基于项目实施</span>
<span className="ysltextcolor05">学生必须在本平台创建项目项目管理员可以提交作品</span>
</p>
:datas.base_on_project===false?
<p>
<span className="ysltextcolor66">不基于项目</span>
<span className="ysltextcolor05">无需在平台创建项目任意小组成员均可以提交作品</span>
</p>
:""
}
</div>
:<div className="ml47text">
{

@ -91,6 +91,7 @@ function CourseGroupChooserModal({ course_groups = [], isAdminOrCreator, item, i
}
.courseGroupChooserModal .drop_down_menu .mainGroup.ant-checkbox-group {
width: 100%;
max-height: 300px!important;
height: 300px;
}
.courseGroupChooserModal .drop_down_search {

@ -663,7 +663,7 @@ class studentsList extends Component{
<style>{`
/* CourseGroupChooser */
.drop_down_menu .mainGroup.ant-checkbox-group {
max-height: 380px;
max-height: 170px;
overflow-y: auto;
}
.task_menu_ul .ant-menu-item, .task_menu_ul .ant-menu-submenu-title{

@ -48,7 +48,8 @@ class CoursesNew extends Component {
addonAfteronelenone:0,
addonAfteronelentwo:0,
bordebool:false,
smallspinning:false
smallspinning:false,
bottonloading:false
}
}
componentDidMount() {
@ -217,7 +218,9 @@ class CoursesNew extends Component {
if (!err) {
this.setState({
bottonloading:true
})
// console.log('Received values of form: ', values);
@ -240,7 +243,7 @@ class CoursesNew extends Component {
if (response.data.status === 0) {
// this.goback()
window.location.href=first_category_url;
window.location.href=first_category_url;
if(this.state.boolxinjian===true) {
var yslGuideone = window.localStorage.getItem('yslGuideone');
try {
@ -257,11 +260,19 @@ class CoursesNew extends Component {
}
}
}
}else{
this.setState({
bottonloading:false
})
}
}).catch((error) => {
console.log(error)
})
}
}else{
this.setState({
bottonloading:false
})
}
});
} else {
this.props.form.validateFields((err, values) => {
@ -283,6 +294,9 @@ class CoursesNew extends Component {
// debugger
//新建
// console.log('Received values of form: ', values);
this.setState({
bottonloading:true
})
let url = "/courses.json";
axios.post(url, {
@ -300,6 +314,7 @@ class CoursesNew extends Component {
).then((response) => {
if (response.status === 200) {
// this.goback
window.location.href=response.data.first_category_url;
if(this.state.boolxinjian===true){
var yslGuideone = window.localStorage.getItem('yslGuideone');
@ -318,11 +333,19 @@ class CoursesNew extends Component {
}
}
}else{
this.setState({
bottonloading:false
})
}
}).catch((error) => {
console.log(error)
})
}
}else{
this.setState({
bottonloading:false
})
}
});
}
@ -934,7 +957,7 @@ class CoursesNew extends Component {
<div className={"FAFAFA"}>
<Form.Item >
<div className="clearfix mt40 mb30">
<Button type="primary" htmlType="submit" className="defalutSubmitbtn fl mr20">
<Button type="primary" htmlType="submit" loading={this.state.bottonloading} className="defalutSubmitbtn fl mr20">
提交
</Button>
{/*<a className="defalutSubmitbtn fl mr20">提交</a>*/}

@ -55,7 +55,8 @@ class Goldsubject extends Component {
addonAfteronelentwo:"",
Whethertocreateanewclassroom:true,
bordebool:false,
smallspinning:false
smallspinning:false,
bottonloading:false
}
}
// disabledEndDate= endValue => {
@ -351,7 +352,9 @@ class Goldsubject extends Component {
}catch (e) {
}
this.setState({
bottonloading:true
})
let url = "/courses/" + coursesId + ".json";
axios.put(url,
datasysl
@ -372,12 +375,21 @@ class Goldsubject extends Component {
return
}
}catch (e) {
this.setState({
bottonloading:false
})
}
}else{
this.setState({
bottonloading:false
})
}
}).catch((error) => {
console.log(error)
this.setState({
bottonloading:false
})
})
}
@ -424,20 +436,15 @@ class Goldsubject extends Component {
course_module_types: values.checkboxgroup,
school:values.school
};
try {
// console.log("提交的ysldatas数据");
// console.log(ysldatas);
// console.log(JSON.stringify(ysldatas));
// console.log(moment(values.starttime).format("YYYY-MM-DD"));
// console.log(moment(values.endtime).format("YYYY-MM-DD"));
}catch (e) {
}
this.setState({
bottonloading:true
})
axios.post(url,
ysldatas
).then((response) => {
if (response.status === 200) {
// this.goback
window.location.href=response.data.first_category_url;
var yslGuideone = window.localStorage.getItem('yslGuideone');
@ -451,11 +458,16 @@ class Goldsubject extends Component {
return
}
}catch (e) {
this.setState({
bottonloading:false
})
}
}
}).catch((error) => {
console.log(error)
this.setState({
bottonloading:false
})
})
}
});
@ -1074,9 +1086,11 @@ class Goldsubject extends Component {
<div className={"FAFAFA"}>
<Form.Item >
<div className="clearfix mt40 mb30">
<Button type="primary" htmlType="submit" className="defalutSubmitbtn fl mr20">
<Button type="primary" htmlType="submit" loading={this.state.bottonloading} className="defalutSubmitbtn fl mr20">
提交
</Button>
{/*<a className="defalutSubmitbtn fl mr20">提交</a>*/}
<a className="defalutCancelbtn fl" onClick={this.goback}>取消</a>
</div>

@ -16,6 +16,7 @@ class AboutUs extends React.Component {
}
componentDidMount(){
window.document.title = "关于我们";
this.getContent();
}

@ -16,6 +16,7 @@ class Agreement extends React.Component {
}
componentDidMount(){
window.document.title = "服务协议";
this.getContent();
}

@ -17,6 +17,7 @@ class ContactUs extends React.Component {
}
componentDidMount(){
window.document.title = "联系我们";
this.getData();
}

@ -21,6 +21,7 @@ class Cooperatives extends React.Component {
}
componentDidMount(){
window.document.title = "合作伙伴";
this.getCooperatives();
}

@ -13,6 +13,10 @@ class Feedback extends React.Component {
super(props);
}
componentDidMount() {
window.document.title = "意见反馈";
}
componentDidUpdate(prevProps) {
if (prevProps.current_user !== this.props.current_user) {
if(!this.props.checkIfLogin()) {

@ -16,6 +16,7 @@ class HelpCenter extends React.Component {
}
componentDidMount(){
window.document.title = "帮助中心";
this.getContent();
}

@ -31,8 +31,22 @@ class MainContent extends Component {
onResizeButtonClick = () => {
// console.log('onResizeButtonClick')
}
onRunCodeTest = () => {
const vncContainer = this.refs['vncContainer']
if (vncContainer) {
vncContainer.showCodeEvaluate && vncContainer.showCodeEvaluate()
}
this.props.onRunCodeTest();
}
hideCodeEvaluate = () => {
const vncContainer = this.refs['vncContainer']
if (vncContainer) {
vncContainer.onBottomDrawerClose && vncContainer.onBottomDrawerClose()
}
}
render() {
const { challenge, output_sets, onRunCodeTest, latest_output, record, st, readRepoTimeout,
const onRunCodeTest = this.onRunCodeTest
const { challenge, output_sets, latest_output, record, st, readRepoTimeout,
onTestSetHeaderClick, loading, codeLoading, shixun, vnc_url} = this.props
// if (output_sets && output_sets.test_sets) {
@ -97,11 +111,23 @@ class MainContent extends Component {
{ showIframeContent && vnc_url ?
<CodeRepositoryViewContainer { ...this.props } isOnlyContainer={true}>
<VNCContainer
ref="vncContainer"
vnc_url={vnc_url}
{...this.props}
codeEvaluate={
<div id="games_valuation_contents">
<CodeEvaluateView output_sets={output_sets} latest_output={latest_output}
record={record} onTestSetHeaderClick={onTestSetHeaderClick}
{...this.props} inDrawer={true}
hideCodeEvaluate={this.hideCodeEvaluate}
></CodeEvaluateView>
</div>
}
></VNCContainer>
<div id="actionView" className="-layout-h -center -bg-grey-90 -grey-20 -bg-darkblack" style={{height:'48px'}}>
<ActionView onRunCodeTest={onRunCodeTest} {...this.props}></ActionView>
<ActionView {...this.props}
onRunCodeTest={onRunCodeTest}
></ActionView>
</div>
</CodeRepositoryViewContainer>
:
@ -158,7 +184,7 @@ class MainContent extends Component {
</div>
<div id="actionView" className="-layout-h -center -bg-grey-90 -grey-20 -bg-darkblack" style={{height:'48px'}}>
<ActionView onRunCodeTest={onRunCodeTest} {...this.props}></ActionView>
<ActionView {...this.props} onRunCodeTest={onRunCodeTest}></ActionView>
</div>
</React.Fragment>

@ -10,6 +10,8 @@ import RepoTree from './component/repo/RepoTree'
import TPIMonaco from './component/monaco/TPIMonaco'
import notEditablePathImg from '../../images/tpi/notEditablePath.png'
import { Drawer } from "antd";
import './VNC.css'
const $ = window.$;
const firstDrawerWidth = 260;
@ -103,6 +105,16 @@ class VNCContainer extends Component {
}
}
}
onBottomDrawerClose = () => {
this.setState({ bottomDrawer: false })
}
swtichBottomDrawer = () => {
this.setState({ bottomDrawer: !this.state.bottomDrawer })
}
showCodeEvaluate = () => {
this.setState({ bottomDrawer: true })
}
/*
selectedKeys={fileTreeSelectedKeys}
onSelect={onTreeSelect}
@ -125,6 +137,23 @@ class VNCContainer extends Component {
secondDrawerClassName="codeInDrawer"
>
<style>{`
/* 评测结果 */
.codeEvaluateDrawer #game_test_set_results {
height: 198px;
}
.codeEvaluateDrawer .ant-drawer-body {
padding: 0px;
}
.codeEvaluateFloatButton {
bottom: 180px !important;
left: unset;
right: 0px;
top: unset;
}
.codeEvaluateFloatButton .text {
left: 10px;
}
.vncDrawer .ant-drawer-body {
padding: 0px;
}
@ -173,10 +202,36 @@ class VNCContainer extends Component {
></RepoTree>
</SecondDrawer>
<FloatButton></FloatButton>
{/* <FloatButton></FloatButton> */}
<VNCDisplay
{...this.props}
></VNCDisplay>
>
<Drawer
mask={true}
title=""
width={firstDrawerWidth}
// closable={false}
onClose={this.onBottomDrawerClose}
visible={this.state.bottomDrawer}
className={'codeEvaluateDrawer'}
placement="bottom"
getContainer={false}
style={{ position: 'absolute', bottom: '25px', zIndex: 1 }}
afterVisibleChange={(visible) => {
if (visible) {
const canvas = $('.vncDisply canvas')[0]
canvas && canvas.focus()
}
}}
>
{ this.props.codeEvaluate }
</Drawer>
<FloatButton onClick={this.swtichBottomDrawer}
className="codeEvaluateFloatButton"
>测试集</FloatButton>
</VNCDisplay>
</React.Fragment>

@ -165,7 +165,10 @@ class VNCDisplay extends Component {
<div id="status">Loading</div>
<div id="sendCtrlAltDelButton">Send CtrlAltDel</div>
</div>
<div id="screen"></div>
<div id="screen">
</div>
{this.props.children}
</div>
);
}

@ -8,10 +8,10 @@ class FloatButton extends Component {
}
render() {
const { challenge, vnc_url, children } = this.props
const { challenge, vnc_url, children, className } = this.props
return (
<div className="float_button" onClick={this.props.onClick}>
<div className={`float_button ${className}` } onClick={this.props.onClick}>
<style>{`
`}</style>

@ -127,4 +127,11 @@
height: 10px;
margin: 5px 0;
float: right;
}
.-task-ces-info .inputTitle {
line-height: 16px;
}
.-task-ces-info .inputTitle .input{
white-space: pre-wrap;
}

@ -227,7 +227,12 @@ class CodeEvaluateView extends Component {
<div className="clearfix df inputTitle">
<span className="fl fb color-grey">测试输入</span>
<div className="fl color-blue" style={{flex:1}} dangerouslySetInnerHTML={{__html: item.input.replace(/\r\n/g,"</br>")}}></div>
<div className="fl color-blue input" style={{flex:1}}
// dangerouslySetInnerHTML={{__html: (item.input.replace(/\r\n/g,"</br>"))}}
>
{item.input}
</div>
</div>
</div>
@ -307,14 +312,21 @@ class CodeEvaluateView extends Component {
<a href="javascript:void(0);" className="tab_type tab_color">测试结果</a>
</li>
<Tooltip id="tooltip-icon-expand" title={ evaluateViewExpanded ? "收起" : "展开"}>
{this.props.inDrawer ? <Tooltip id="tooltip-icon-expand" title={ "收起" }>
{/*TODO 按钮大小改造css*/}
{/* icon-guanbi */}
<a className="iconButton fr mr15 mt4" onClick={this.props.hideCodeEvaluate} id="extend_and_zoom" >
<i className={ "font-18 iconfont icon-guanbi" }></i>
</a>
</Tooltip> : <Tooltip id="tooltip-icon-expand" title={ evaluateViewExpanded ? "" : ""}>
{/*TODO 按钮大小改造css*/}
<a className="iconButton fr mr15" onClick={this.onEvaluateViewExpand} id="extend_and_zoom" >
<i className={ evaluateViewExpanded ? "font-18 iconfont icon-shousuo" : "iconfont icon-zhankai font-18" }></i>
</a>
</Tooltip>
</Tooltip>}
<div className="cl"></div>
</ul>

@ -1,7 +1,7 @@
import React,{ Component } from "react";
import {getUrl,markdownToHTML} from 'educoder';
import {Input} from 'antd';
import {Input,Button} from 'antd';
import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom";
import axios from 'axios';
@ -86,7 +86,8 @@ class PathNew extends Component{
pathName:"",
description:"",
point:"",
flag_name:true
flag_name:true,
bottonloading:false
}
}
@ -124,6 +125,9 @@ class PathNew extends Component{
return;
}
if (this.isEditPage == true) {
this.setState({
bottonloading:true
})
let pathId = this.props.match.params.pathId;
const editUrl = `/paths/${pathId}.json`
@ -135,11 +139,21 @@ class PathNew extends Component{
// console.log(response.data.subject_id);
if (response.data.subject_id) {
this.props.history.push(`/paths/${response.data.subject_id}`)
}
}else{
this.setState({
bottonloading:false
})
}
}).catch((error)=>{
console.log(error);
this.setState({
bottonloading:false
})
})
} else {
this.setState({
bottonloading:true
})
let url="/paths.json"
axios.post(url,{
name:pathName,
@ -149,9 +163,16 @@ class PathNew extends Component{
// console.log(response.data.subject_id);
if (response.data.subject_id) {
this.props.history.push(`/paths/${response.data.subject_id}`)
}
}else{
this.setState({
bottonloading:false
})
}
}).catch((error)=>{
console.log(error);
this.setState({
bottonloading:false
})
})
}
@ -267,7 +288,7 @@ class PathNew extends Component{
</div>
<div className="clearfix mb30 mt30">
<a href="javascript:void(0)" className="defalutSubmitbtn fl mr20" onClick={this.submitNewPath}>提交</a>
<Button className="defalutSubmitbtn fl mr20" loading={this.state.bottonloading} onClick={this.submitNewPath}>提交</Button>
{this.isEditPage ?
<Link to={`/paths/${this.props.match.params.pathId}`}
className="defalutCancelbtn fl">取消</Link>

@ -233,7 +233,8 @@ class Newshixuns extends Component {
systemenvironmenttype:false,
testcoderunmodetype:false,
attachmentidstype:false,
datalisttype:false
datalisttype:false,
bottonloading:false
}
}
@ -494,6 +495,9 @@ class Newshixuns extends Component {
} else {
newmulti_webssh = ""
}
this.setState({
bottonloading:true
})
axios.post(Url, {
name: name,
can_copy: can_copy,
@ -513,9 +517,16 @@ class Newshixuns extends Component {
if (response.status === 200) {
window.location.href = "/shixuns/" + response.data.shixun_identifier + "/challenges";
// window.open("/shixuns/"+response.data.shixun_identifier+"/challenges");
}
}else{
this.setState({
bottonloading:false
})
}
}).catch((error) => {
console.log(error)
this.setState({
bottonloading:false
})
})
}
@ -1321,7 +1332,9 @@ class Newshixuns extends Component {
<div className="clearfix mt30">
<a className="defalutSubmitbtn fl mr20" onClick={this.submit_new_shixun}>提交</a>
<Button className="defalutSubmitbtn fl mr20" loading={this.state.bottonloading} onClick={this.submit_new_shixun}>
提交
</Button>
<a href="/shixuns" className="defalutCancelbtn fl">取消</a>
</div>

@ -384,4 +384,14 @@ a.white-btn.use_scope-btn:hover{
.ml82{
margin-left: 82px;
}
.ant-btn-primary.active, .ant-btn-primary:active {
color: #fff;
background-color: #096dd9;
border-color: #096dd9;
}
.ant-btn:hover, .ant-btn:focus, .ant-btn:active, .ant-btn.active{
background-color: #4CACFF;
}

@ -6,9 +6,6 @@
margin-left: 32%;
}
.square-Item{
/*min-height: 324px;*/
}
.square-img{
min-height: 210px;
}

@ -31,8 +31,8 @@ class InfosBanner extends Component{
let user_type=this.props.current_user&&this.props.current_user.user_identity;
let targetuserid=this.props.data&&this.props.data.id;
// console.log(is_current)
// console.log(current_user)
// console.log(is_current)
// console.log(current_user)
// console.log(current_user.is_teacher)
// console.log(current_user.admin)
return(
@ -124,7 +124,7 @@ class InfosBanner extends Component{
</li>}
{/*自己的主页且不是学生显示题库按钮*/}
{((is_current && current_user && current_user.is_teacher ) || current_user && current_user.admin)
{(is_current && current_user)
&&<li className={`${moduleName == 'topics' ? 'active' : '' }`}>
<Link
onClick={() => this.setState({moduleName: 'topics'})}

@ -103,7 +103,7 @@ class InfosCourse extends Component{
} = this.state;
let is_current=this.props.is_current;
console.log(this.props.current_user&&this.props.current_user.user_identity==="学生")
// console.log(this.props.current_user&&this.props.current_user.user_identity==="学生")
return(
<div className="educontent">
<Spin size="large" spinning={isSpin}>

@ -31,33 +31,34 @@ class InfosTopics extends Component{
}
componentDidMount(){
let types=this.props.match.params.topicstype;
let professional_certification=this.props.current_user&&this.props.current_user.professional_certification;
if(professional_certification===false&&types==="publicly"){
this.setState({
isshowprofes:true
})
}else{
this.updataslist()
}
}
componentDidUpdate(prevProps) {
if(prevProps.current_user!=this.props.current_user){
let types=this.props.match.params.topicstype;
let professional_certification=this.props.current_user&&this.props.current_user.professional_certification;
console.log(professional_certification)
if(professional_certification===false&&types==="publicly"){
this.setState({
isshowprofes:true
})
}else{
this.updataslist()
}
}
// let types=this.props.match.params.topicstype;
// let professional_certification=this.props.current_user&&this.props.current_user.professional_certification;
//
// if(professional_certification===false&&types==="publicly"){
// this.setState({
// isshowprofes:true
// })
// }else{
// this.updataslist()
// }
this.updataslist()
}
// componentDidUpdate(prevProps) {
//
// if(prevProps.current_user!=this.props.current_user){
// let types=this.props.match.params.topicstype;
// let professional_certification=this.props.current_user&&this.props.current_user.professional_certification;
//
// console.log(professional_certification)
// if(professional_certification===false&&types==="publicly"){
// this.setState({
// isshowprofes:true
// })
// }else{
// this.updataslist()
// }
// }
// }
updataslist=()=>{
let types=this.props.match.params.topicstype;
let { category,course_list_id,sort_by,sort_direction,page}=this.state;
@ -65,39 +66,12 @@ class InfosTopics extends Component{
}
searchAlldata=(type,category,course_list_id,sort_by,sort_direction,page)=>{
// if(this.props.current_user.login!=this.props.match.params.username){
// return
// }else{
//
// }
let types=this.props.match.params.topicstype;
let professional_certification=this.props.current_user&&this.props.current_user.professional_certification;
if(professional_certification===false&&types==="publicly"){
}else{
this.setState({
isSpin:true
})
let types=this.props.match.params.topicstype;
let user_id="";
if(types==="publicly"){
user_id=this.props.current_user&&this.props.current_user.login;
}else{
user_id=this.props.match.params&&this.props.match.params.username;
}
if(user_id===undefined){
user_id=1
}
let {per_page}=this.state;
let url=`/users/${user_id}/question_banks.json`;
let url=`/users/question_banks.json`;
axios.get(encodeURI(url),{params:{
type,
@ -109,19 +83,33 @@ class InfosTopics extends Component{
per_page
}
}).then((response) => {
this.setState({
data:response.data,
checkBoxValues:[],
isSpin:false
})
if(response){
if(response.status){
if(response.data.status == -2){
this.setState({
isshowprofes:true,
isSpin:false
})
}else if(response.data.status === 403||response.data.status === 401||response.data.status === 500){
this.setState({
isSpin:false
})
}else{
this.setState({
data:response.data,
checkBoxValues:[],
isSpin:false
})
}
}
}
}).catch((error) => {
this.setState({
isSpin:false
})
});
}
}
searchCategory=(type)=>{

@ -115,6 +115,9 @@ class NewGtaskForms extends Component{
let {data}=this.props;
let task_type=data.task_type
let topicId=this.props.topicId
let attachment_ids = contentFileList.map(item => {
return item.response ? item.response.id : item.id
})
this.props.form.validateFields((err, values) => {
const mdContnet = this.contentMdRef.current.getValue().trim();
@ -132,7 +135,7 @@ class NewGtaskForms extends Component{
max_num:task_type===1?undefined:max_num,
base_on_project: task_type===1?task_type:base_on_project===true?1:0
},
attachment_ids:contentFileList
attachment_ids:attachment_ids
}
).then((response) => {
if(response.data.status===0){

Loading…
Cancel
Save