Merge branches 'dev_item_bank', 'dev_new_shixunsrepository' and 'develop' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_new_shixunsrepository

dev_new_shixunsrepository
杨树明 5 years ago
commit cfbb8acfed

@ -41,8 +41,8 @@ module GitHelper
# 更新文件代码 # 更新文件代码
# content 文件内容message提交描述 # content 文件内容message提交描述
def update_file_content(content, repo_path, path, mail, username, message) def update_file_content(content, repo_path, path, mail, username, message)
content = Base64.encode64(content) #content = Base64.encode64(content)
GitService.update_file_base64(repo_path: repo_path, file_path: path, message: message, GitService.update_file(repo_path: repo_path, file_path: path, message: message,
content: content, author_name: username, author_email: mail) content: content, author_name: username, author_email: mail)
end end

@ -888,12 +888,14 @@ class ShixunsController < ApplicationController
def upload_git_file def upload_git_file
upload_file = params["file"] upload_file = params["file"]
uid_logger("#########################file_params####{params["#{params[:file]}"]}") uid_logger("#########################file_params##: #{params["file"]}")
raise "未上传文件" unless upload_file raise "未上传文件" unless upload_file
content = upload_file.tempfile.read content = upload_file.tempfile.read
uid_logger("#########################content####{content}")
author_name = current_user.real_name author_name = current_user.real_name
author_email = current_user.git_mail author_email = current_user.git_mail
message = params[:message] || "upload file by browser" message = params[:message] || "upload file by browser"
uid_logger("-----author_email: #{author_email}")
update_file_content(content, @repo_path, @path, author_email, author_name, message) update_file_content(content, @repo_path, @path, author_email, author_name, message)
render_ok render_ok
end end

@ -11,6 +11,7 @@ import {
Input, Input,
Tooltip Tooltip
} from "antd"; } from "antd";
import {parabola} from './animation/parabola'
import Headplugselections from "./component/Headplugselections"; import Headplugselections from "./component/Headplugselections";
import QuestionModal from "./component/QuestionModal"; import QuestionModal from "./component/QuestionModal";
import QuestionModals from "./component/QuestionModals"; import QuestionModals from "./component/QuestionModals";
@ -63,6 +64,7 @@ class Question extends Component {
disciplinesdatazsd:0, disciplinesdatazsd:0,
selectallquestionsonthispages:false, selectallquestionsonthispages:false,
oj_status:null, oj_status:null,
isVisible: false,
} }
} }
@ -206,6 +208,7 @@ class Question extends Component {
} }
//刷新加载
getdata = (data) => { getdata = (data) => {
const url = `/item_banks.json`; const url = `/item_banks.json`;
this.setState({ this.setState({
@ -240,6 +243,34 @@ class Question extends Component {
}); });
} }
//不刷新加载
getdatasy = (data) => {
const url = `/item_banks.json`;
axios.get((url), {params: data}).then((response) => {
setTimeout(()=>{
},1000);
if (response === null || response === undefined) {
return
}
if (response.data.status === 403 || response.data.status === 401 || response.data.status === 500) {
} else {
}
////console.log("item_banks");
////console.log(response);
this.setState({
Contentdata: response.data,
items_count: response.data.items_count,
})
}).catch((error) => {
});
}
paginationonChange = (pageNumber) => { paginationonChange = (pageNumber) => {
this.setState({ this.setState({
page: pageNumber, page: pageNumber,
@ -574,11 +605,11 @@ class Question extends Component {
page: this.state.page, page: this.state.page,
per_page:10, per_page:10,
}; };
this.getdata(data); this.getdatasy(data);
this.getbasket_listdata(); this.getbasket_listdata();
this.setState({ // this.setState({
visible:true // visible:true
}) // })
} }
}).catch((error) => { }).catch((error) => {
//console.log(error); //console.log(error);
@ -689,6 +720,10 @@ class Question extends Component {
}; };
this.getdata(data); this.getdata(data);
} }
render() { render() {
let { let {
page, per_page, items_count, Headertop, visible, placement, modalsType, modalsTypes,basket_list, page, per_page, items_count, Headertop, visible, placement, modalsType, modalsTypes,basket_list,
@ -701,8 +736,11 @@ class Question extends Component {
+ program_questions_count + program_questions_count
+ single_questions_count + single_questions_count
+ subjective_questions_count; + subjective_questions_count;
return ( return (
<div className="newMain clearfix" ref={this.saveContainer}> <div className="newMain clearfix" ref={this.saveContainer}>
{ {
visible===true? visible===true?
<style> <style>
@ -761,11 +799,14 @@ class Question extends Component {
} }
</style> </style>
<SiderBars <SiderBars
Datacount={Datacount}
myvisible={visible} myvisible={visible}
{...this.props} {...this.props}
{...this.state} {...this.state}
showDrawer={() => this.showDrawer()} showDrawer={() => this.showDrawer()}
Headertop={Headertop}/> Headertop={Headertop}
/>
{/*顶部*/} {/*顶部*/}
@ -781,6 +822,7 @@ class Question extends Component {
/> />
{/*头部*/} {/*头部*/}
<Contentpart {...this.state} {...this.props} <Contentpart {...this.state} {...this.props}
getitem_basketss={(id)=>this.getitem_basketss(id)} getitem_basketss={(id)=>this.getitem_basketss(id)}
selectallquestionsonthispage={()=>this.selectallquestionsonthispage()} selectallquestionsonthispage={()=>this.selectallquestionsonthispage()}
getitem_baskets={(e)=>this.getitem_baskets(e)} getitem_baskets={(e)=>this.getitem_baskets(e)}
@ -957,12 +999,3 @@ class Question extends Component {
} }
export default SnackbarHOC()(TPMIndexHOC(Question)); export default SnackbarHOC()(TPMIndexHOC(Question));
{/*<Drawer*/}
{/* className="drawercontainer"*/}
{/* placement={placement}*/}
{/* closable={false}*/}
{/* onClose={() => this.onClose()}*/}
{/* visible={visible}*/}
{/* mask={false}*/}
{/* closable={true}*/}
{/*>*/}

@ -0,0 +1,51 @@
/**
* 抛物线动画函数
* @param ballWrapper 小球的父容器
* @param origin 动画起点DOM
* @param target 动画目标DOM
* @param time 持续时间
* @param a 抛物线参数
* @param offset 动画尺寸
* @param callback 回调
*/
export function parabola(config) {
const {
ballWrapper,
origin,
target,
time = 1000,
a = 0.004,
callback,
finish,
offset = 0
} =
config || {};
const ballWrapperDimension = ballWrapper.getBoundingClientRect();
const originDimension = origin.getBoundingClientRect();
const targetDimension = target.getBoundingClientRect();
const x1 = originDimension.left + 0.5 * originDimension.width;
const y1 = originDimension.top + 0.5 * originDimension.height;
const x2 = targetDimension.left + 0.5 * targetDimension.width;
const y2 = targetDimension.top + 0.5 * targetDimension.height;
const diffx = x2 - x1;
const diffy = y2 - y1;
const speedx = diffx / time;
const b = (diffy - a * diffx * diffx) / diffx;
const refPoint_x = x1 - ballWrapperDimension.left - 0.5 * offset;
const refPoint_y = y1 - ballWrapperDimension.top - 0.5 * offset;
const start = Date.now();
const timer = setInterval(() => {
if (Date.now() - start > time) {
finish();
clearInterval(timer);
return;
}
const x = speedx * (Date.now() - start);
const y = a * x * x + b * x;
callback && callback(refPoint_x + x, refPoint_y + y);
}, 15);
}

@ -71,7 +71,7 @@ class Contentpart extends Component {
const contents = ( const contents = (
<div className="questiontypes" style={{ <div className="questiontypes" style={{
width:'93px', width:'93px',
height:'161px', height:'120px',
}}> }}>
<p className="questiontype " onClick={()=>this.props.setoj_status(null)}>全部</p> <p className="questiontype " onClick={()=>this.props.setoj_status(null)}>全部</p>
<p className="questiontypeheng"></p> <p className="questiontypeheng"></p>
@ -173,18 +173,6 @@ class Contentpart extends Component {
} }
{/*<Popover getPopupContainer={trigger => trigger.parentNode} placement="bottom" trigger="hover" content={content} onVisibleChange={()=>this.props.handleVisibleChanges(true)}>*/}
{/*<div className="sortinxdirection mr40">*/}
{/*<div className="subjecttit">*/}
{/* 题型*/}
{/*</div>*/}
{/* <i className="iconfont icon-sanjiaoxing-down font-12 lg ml7 icondowncolor"></i>*/}
{/*</div>*/}
{/*</Popover>*/}
{ {
defaultActiveKey===0||defaultActiveKey==="0"? defaultActiveKey===0||defaultActiveKey==="0"?
<Search <Search

@ -93,17 +93,27 @@ class SiderBars extends Component {
// console.log(this.props); // console.log(this.props);
var mypath= this.props&&this.props.match&&this.props.match.path; var mypath= this.props&&this.props.match&&this.props.match.path;
let{myvisible}=this.props; let{myvisible,Datacount,animateStyle}=this.props;
return ( return (
<div className={myvisible===true?"-task-sidebar mystask-sidebar":"-task-sidebar mystask-sidebars"} > <div className={myvisible===true?"-task-sidebar mystask-sidebar":Datacount&&Datacount>0?"-task-sidebar mystask-sidebars":"-task-sidebar mystask-sidebarss"} >
{this.props.mygetHelmetapi&&this.props.mygetHelmetapi.main_site===true?<div> {this.props.mygetHelmetapi&&this.props.mygetHelmetapi.main_site===true?<div>
{ {
mypath&&mypath==="/question"? mypath&&mypath==="/question"?
<Tooltip placement="left" title={"试题库"}> <Tooltip placement="left" title={"试题库"}>
<div className="feedback feedbackdivcolor xiaoshou shitikus" onClick={()=>this.props.showDrawer()} >
<div className="feedback feedbackdivcolor xiaoshou shitikus" onClick={()=>this.props.showDrawer()} >
{
Datacount&&Datacount>0?
<div className="shitikussmys maxnamewidth30">
{Datacount}
</div>
:""
}
<a target="_blank" className="color_white xiaoshou" > <a target="_blank" className="color_white xiaoshou" >
<i className="iconfont icon-shitilan color-white xiaoshou"></i> <i className="iconfont icon-shitilan color-white xiaoshou"></i>
</a> </a>

@ -882,3 +882,35 @@
border-radius: 4px; border-radius: 4px;
top: -50%; top: -50%;
} }
.shitikussmys{
width:29px !important;
height:20px!important;
background:#FF6601 !important;
border-radius:10px !important;
position: absolute !important;
font-size:11px !important;
color:#ffffff !important;
line-height:20px !important;
top: -14px !important;
right: -14px !important;
}
.maxnamewidth30{
max-width: 30px;
overflow:hidden;
text-overflow:ellipsis;
white-space:nowrap;
cursor: default;
}
.ball {
width: 8px;
height: 8px;
background: #FF6601;
position: absolute;
left: 0;
top: 0;
border-radius: 50%;
opacity: 0;
z-index: 1;
}

@ -268,8 +268,32 @@ body>.-task-title {
background: #EEEEEE; background: #EEEEEE;
} }
.mystask-sidebar{ .mystask-sidebar{
right: 210px !important; right: 220px !important;
} }
.mystask-sidebars{ .mystask-sidebars{
right: 10px !important; right: 20px !important;
}
.shitikussmys{
width:29px !important;
height:20px!important;
background:#FF6601 !important;
border-radius:10px !important;
position: absolute !important;
font-size:11px !important;
color:#ffffff !important;
line-height:20px !important;
top: -13px !important;
right: -10px !important;
}
.maxnamewidth30{
max-width: 30px;
overflow:hidden;
text-overflow:ellipsis;
white-space:nowrap;
cursor: default;
}
.mystask-sidebarss{
right: 5px !important;
} }

Loading…
Cancel
Save