Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

dev_forum
caishi 6 years ago
commit 1d83e0b497

@ -442,12 +442,18 @@ class ApplicationController < ActionController::Base
shixun.shixun_service_configs.each do |config|
mirror = config.mirror_repository
if mirror.name.present?
# 资源限制没有就传默认值。
cpu_limit = config.cpu_limit.presence || 1
cpu_request = config.lower_cpu_limit.presence || 0.1
memory_limit = config.memory_limit.presence || 1024
request_limit = config.resource_limit.presence || 10
resource_limit = config.resource_limit.presence || 10000
container << {:image => mirror.name,
:cpuLimit => config.cpu_limit,
:cpuRequest => config.lower_cpu_limit,
:memoryLimit => "#{config.memory_limit}M",
:memoryRequest => "#{config.request_limit}M",
:resourceLimit => "#{config.resource_limit}K",
:cpuLimit => cpu_limit,
:cpuRequest => cpu_request,
:memoryLimit => "#{memory_limit}M",
:memoryRequest => "#{request_limit}M",
:resourceLimit => "#{resource_limit}K",
:type => mirror.try(:main_type) == "1" ? "main" : "sub"}
end
end

@ -1,5 +1,5 @@
class EduSettingsController < ApplicationController
# before_action :require_admin
before_action :require_admin
before_action :set_edu_setting, only: [:show, :edit, :update, :destroy]
# GET /edu_settings

@ -147,17 +147,9 @@ class PollVotesController < ApplicationController
else
question_max_choices = 0
end
if @poll_question.min_choices.present?
question_min_choices = @poll_question.min_choices
else
question_min_choices = 0
end
if question_max_choices > 0 && (user_vote_count > question_max_choices)
normal_status(-1,"多选题答案超过最大限制!")
end
if question_min_choices > 0 && (user_vote_count < question_min_choices)
normal_status(-1,"多选题答题不得少于最小限制!")
end
elsif (poll_user.present? && poll_user.commit_status == 1) || poll_user_status == 3
normal_status(-1,"已提交/已结束的问卷不允许修改!")
end

@ -896,13 +896,31 @@ class PollsController < ApplicationController
def commit_poll
ActiveRecord::Base.transaction do
begin
poll_user_current = @poll.poll_users.find_by_group_ids(current_user.id).first
poll_user_params = {
:commit_status => 1,
:end_at => Time.now
}
poll_user_current.update_attributes(poll_user_params)
normal_status(0, "问卷提交成功!")
@poll_multi_questions = @poll.poll_questions.where(question_type:2).select(:id,:max_choices,:min_choices,:question_number)
error_question = []
@poll_multi_questions.each do |q|
poll_user_votes = current_user.poll_votes.where(poll_question_id:q.id)&.size
if q.max_choices.present? && (poll_user_votes > q.max_choices)
error_messages = "#{q.question_number}题:超过最大选项限制"
elsif q.min_choices.present? && (poll_user_votes < q.min_choices)
error_messages = "#{q.question_number}题:不得少于最小选项限制"
else
error_messages = nil
end
error_question.push(error_messages)
end
error_question = error_question.reject(&:blank?)
if error_question.reject(&:blank?).length > 0
normal_status(-1, "#{error_question.join("\n")}")
else
poll_user_current = @poll.poll_users.find_by_group_ids(current_user.id).first
poll_user_params = {
:commit_status => 1,
:end_at => Time.now
}
poll_user_current.update_attributes(poll_user_params)
normal_status(0, "问卷提交成功!")
end
## 需添加发送消息的接口,稍后添加
rescue Exception => e
uid_logger_error(e.message)

@ -370,7 +370,7 @@ class NewWork extends Component{
<span>{pageType==="new"?"新建":"编辑"}</span>
</p> */}
<CBreadcrumb items={[
{ to: current_user.first_category_url, name: this.state.course_name},
{ to: current_user && current_user.first_category_url, name: this.state.course_name},
{ to: `/courses/${courseId}/${moduleEngName}/${category && category.category_id ? category.category_id : ''}`
, name: category && category.category_name },
{ name: `${ this.isEdit ? '编辑' : '新建'}` }
@ -388,7 +388,7 @@ class NewWork extends Component{
</p>
<div>
{/* onSubmit={this.handleSubmit} */}
<Form >
<Form className="courseForm">
<Form.Item
label="标题"
className="AboutInputForm"

@ -36,6 +36,17 @@ class ModalWrapper extends Component{
className={className || ''}
keyboard={false}
>
{
visible == true ? <style>
{
`
body {
overflow: hidden !important;
}
`
}
</style>:""
}
<div className="newupload_conbox clearfix">
{this.props.children}
{this.props.checkBoxValuestype===true?<div className={"mt10 color-red"}>

@ -135,8 +135,8 @@ class shixunAnswer extends Component{
let url=`/exercise_questions/${this.props.questionType.question_id}/adjust_score.json`
const list = Object.assign({}, this.state.dataCopy[key])
console.log("111111111111111111111111");
console.log(this.props);
// console.log("111111111111111111111111");
// console.log(this.props);
// 调分值为0且和第一次的数据相同则不修改
if(parseInt(e.target.value)==parseInt(list.my_score)){
return;

@ -459,6 +459,11 @@ class CoursesNew extends Component {
width: 280px;
margin-left: 10px;
}
.construction .ant-select-selection__placeholder, .ant-select-search__field__placeholder {
line-height: 28px;
z-index: 2000;
}
`}
</style>
@ -641,7 +646,7 @@ class CoursesNew extends Component {
</Form.Item>
</div>
<div className="stud-class-set padding10200 coursenavbox mb20">
<div className="stud-class-set padding10200 mb20">
<Form.Item label="课堂所属单位">
{getFieldDecorator('school', {
rules: [{required: true, message: "不能为空"}],

@ -464,7 +464,7 @@ class Poll extends Component{
modalsBottomval,
loadtype
}=this.state;
console.log(this.props);
// console.log(this.props);
let {child}=this.props;
let {coursesId,Id}=this.props.match.params
const isAdmin = this.props.isAdmin()

@ -34,7 +34,7 @@ class PollDetailIndex extends Component{
}
getPollInfo=()=>{
console.log(this.props);
// console.log(this.props);
let pollId=this.props.match.params.pollId;
let url=`/polls/${pollId}/common_header.json`
axios.get(url).then((result)=>{
@ -123,7 +123,7 @@ class PollDetailIndex extends Component{
/>
<div className="educontent mt10 mb50">
<p className="clearfix mb20">
<WordsBtn style="grey" className="fl" to={current_user.first_category_url}>{this.props.coursedata.name}</WordsBtn>
<WordsBtn style="grey" className="fl" to={current_user && current_user.first_category_url}>{this.props.coursedata.name}</WordsBtn>
<span className="color-grey-9 fl ml3 mr3">&gt;</span>
<WordsBtn style="grey" className="fl" to={`/courses/${this.props.match.params.coursesId}/polls/${user_permission && user_permission.left_banner_id}`}>问卷</WordsBtn>
<span className="color-grey-9 fl ml3 mr3">&gt;</span>

@ -127,9 +127,9 @@ class PollDetailTabSecond extends Component{
<span className="color-green">{options.answer_users_count}</span>
<span>
<p className="percentForm fl mr15">
<span className="percentValue" style={{"width":`${parseFloat(options.answer_percent ? options.answer_percent : 0 ).toFixed(2)*100}%`}}></span>
<span className="percentValue" style={{"width":`${(options.answer_percent * 100).toFixed(1)}%`}}></span>
</p>
<font className="color-grey-9">{parseFloat(options.answer_percent ? options.answer_percent : 0 ).toFixed(2)*100} %</font>
<font className="color-grey-9">{(options.answer_percent * 100).toFixed(1)}%</font>
</span>
</ul>
{

@ -315,7 +315,7 @@ class PollInfo extends Component{
></Modals>
<div className="educontent mt10 mb50">
<p className="clearfix mb20">
<WordsBtn style="grey" className="fl" to={current_user.first_category_url}>{courseName}</WordsBtn>
<WordsBtn style="grey" className="fl" to={current_user && current_user.first_category_url}>{courseName}</WordsBtn>
<span className="color-grey-9 fl ml3 mr3">&gt;</span>
<WordsBtn style="grey" className="fl" to={`/courses/${this.props.match.params.coursesId}/polls/${poll && poll.left_banner_id}`}>问卷</WordsBtn>
<span className="color-grey-9 fl ml3 mr3">&gt;</span>

@ -844,12 +844,12 @@ class PollNew extends Component {
if (object.question.question_type === 2) {
if (object.question.max_choices > 0) {
if (object.question.min_choices < 2) {
this.props.showNotification(`可选最小不能少于2个`);
return;
}
// if (object.question.min_choices < 2) {
// this.props.showNotification(`可选最小不能少于2个`);
//
// return;
//
// }
}
}
@ -1332,10 +1332,10 @@ class PollNew extends Component {
if (object.question.question_type === 2) {
if (object.question.max_choices > 0) {
if (object.question.min_choices < 2) {
this.props.showNotification(`可选最小不能少于2个`);
return;
}
// if (object.question.min_choices < 2) {
// this.props.showNotification(`可选最小不能少于2个`);
// return;
// }
}
}
if (object.question.new === "new") {
@ -2108,14 +2108,17 @@ class PollNew extends Component {
}
//最大值
HandleGradationGroupChangeee = (value, index) => {
HandleGradationGroupChangeee = (value, index,minchoices) => {
// console.log(value);
let arr = this.state.adddom;
for (var i = 0; i < arr.length; i++) {
if (index === i) {
arr[i].question.min_choices= minchoices===null?0:minchoices===undefined?0:parseInt(minchoices);
arr[i].question.max_choices = parseInt(value);
}
}
// console.log(2119);
// console.log(arr);
this.setState({
adddom: arr
})
@ -2322,7 +2325,7 @@ class PollNew extends Component {
gotohome=()=>{
const { current_user} = this.props
this.props.history.push(current_user.first_category_url);
this.props.history.push(current_user && current_user.first_category_url);
// let courseId=this.props.match.params.coursesId;
@ -2772,7 +2775,7 @@ class PollNew extends Component {
className="ml10 mr10 color-grey-6 lineh-40 fl">~</span>
{/*可选最大*/}
<Select className="fl w100"
onChange={(value) => this.HandleGradationGroupChangeee(value, indexo)}
onChange={(value) => this.HandleGradationGroupChangeee(value, indexo,itemo.question.min_choices)}
value={itemo.question.max_choices === 0 || itemo.question.max_choices === "0" ? "--" : itemo.question.min_choices === null ? "--" : itemo.question.min_choices === undefined ? "--" : itemo.question.max_choices}
>
<Option value={String("0")}>--</Option>
@ -3015,7 +3018,7 @@ class PollNew extends Component {
className="ml10 mr10 color-grey-6 lineh-40 fl">~</span>
{/*可选最大*/}
<Select className="fl w100"
onChange={(value) => this.HandleGradationGroupChangeee(value, indexo)}
onChange={(value) => this.HandleGradationGroupChangeee(value, indexo,itemo.question.min_choices)}
value={itemo.question.max_choices === 0 || itemo.question.max_choices === "0" ? "--" : itemo.question.min_choices === null ? "--" : itemo.question.min_choices === undefined ? "--" : itemo.question.max_choices}
>
<Option value={String("0")}>--</Option>
@ -3267,7 +3270,7 @@ class PollNew extends Component {
className="ml10 mr10 color-grey-6 lineh-40 fl">~</span>
{/*可选最大*/}
<Select className="fl w100"
onChange={(value) => this.HandleGradationGroupChangeee(value, indexo)}
onChange={(value) => this.HandleGradationGroupChangeee(value, indexo,itemo.question.min_choices)}
value={itemo.question.max_choices === 0 || itemo.question.max_choices === "0" ? "--" : itemo.question.min_choices === null ? "--" : itemo.question.min_choices === undefined ? "--" : itemo.question.max_choices}
>
<Option value={String("0")}>--</Option>

File diff suppressed because it is too large Load Diff

@ -42,7 +42,7 @@ class TPMNav extends Component {
className={`${match.url.indexOf('ranking_list') != -1 ? 'active' : ''} fl`}>排行榜</Link>
{/* target="_blank"*/}
<a
href={`/shixuns/${shixunId}/settings`} className="fr"
href={`/shixuns/${shixunId}/settings`} className="edu-default-btn edu-blueline-btn ml20 fr"
style={{display: this.props.identity >4||this.props.identity===undefined ? "none" : 'block'}}
>配置</a>
</div>

@ -14,7 +14,7 @@ class AccountNav extends Component {
}
render() {
let { basicInfo } = this.props
console.log(this.props);
// console.log(this.props);
const path = window.location.pathname
const isBasic = path.indexOf('profile') != -1 || path == "/account"
const isCertification = path.indexOf('certification') != -1

Loading…
Cancel
Save