Merge remote-tracking branch 'origin/dev_aliyun' into dev_tj

merge aliyun
dev_daiao
tangjiang 5 years ago
commit ba3fffb681

@ -453,7 +453,7 @@ class HomeworkCommonsController < ApplicationController
# 课堂结束后不能再更新
unless @course.is_end
UpdateHomeworkSettingService.call(@homework, publish_params)
UpdateHomeworkPublishSettingService.call(@homework, publish_params)
# 作业未发布时unified_setting参数不能为空
=begin
if @homework.publish_time.nil? || @homework.publish_time > Time.now
@ -585,8 +585,8 @@ class HomeworkCommonsController < ApplicationController
tip_exception("缺少answer_open_evaluation参数") if params[:answer_open_evaluation].nil?
tip_exception("缺少work_efficiency参数") if params[:work_efficiency].nil?
tip_exception("缺少eff_score参数") if params[:work_efficiency] && params[:eff_score].blank?
tip_exception("效率分不能小于等于0") if params[:eff_score] && params[:eff_score].to_f <= 0
tip_exception("效率分不能大于总分值") if params[:eff_score] && params[:eff_score].to_f.round(2) > params[:total_score].to_f.round(2)
tip_exception("效率分不能小于等于0") if params[:work_efficiency] && params[:eff_score] && params[:eff_score].to_f <= 0
tip_exception("效率分不能大于总分值") if params[:work_efficiency] && params[:eff_score] && params[:eff_score].to_f.round(2) > params[:total_score].to_f.round(2)
tip_exception("缺少shixun_evaluation参数") if params[:shixun_evaluation].blank?
tip_exception("缺少challenge_settings参数") if params[:challenge_settings].blank?
# tip_exception("缺少challenge_id参数") if params[:challenge_settings][:challenge_id].blank?
@ -1652,7 +1652,7 @@ class HomeworkCommonsController < ApplicationController
end
def publish_params
params.permit(:unified_setting, :publish_time, :end_time, group_settings: [])
params.permit(:unified_setting, :publish_time, :end_time, group_settings: [:publish_time, :end_time, group_id: []])
end
end

@ -107,7 +107,7 @@ class Weapps::CoursesController < Weapps::BaseController
# 批量修改角色
def change_member_roles
@course = current_course
tip_exception("请至少选择一个角色") if params[:roles].blank?
tip_exception("请至少选择一个角色") if params[:roles].reject(&:blank?).blank?
tip_exception("不能具有老师、助教两种角色") if params[:roles].include?("PROFESSOR") && params[:roles].include?("ASSISTANT_PROFESSOR")
params[:user_ids].each do |user_id|

@ -6,8 +6,9 @@ class Weapps::HomeworkCommonsController < Weapps::BaseController
def update_settings
begin
# 课堂结束后不能再更新
if @course.is_end
UpdateHomeworkSettingService.call(@homework, publish_params)
unless @course.is_end
UpdateHomeworkPublishSettingService.call(@homework, publish_params)
render_ok
else
tip_exception("课堂已结束不能再更新")
end
@ -31,7 +32,7 @@ class Weapps::HomeworkCommonsController < Weapps::BaseController
end
def publish_params
params.permit(:unified_setting, :publish_time, :end_time, group_settings: [])
params.permit(:unified_setting, :publish_time, :end_time, group_settings: [:publish_time, :end_time, group_id: []])
end
end

@ -1,4 +1,4 @@
class UpdateHomeworkSettingService < ApplicationService
class UpdateHomeworkPublishSettingService < ApplicationService
attr_reader :homework, :params
def initialize(homework, params)
@ -7,6 +7,7 @@ class UpdateHomeworkSettingService < ApplicationService
end
def call
puts params
course = homework.course
# 作业未发布时unified_setting参数不能为空
if homework.publish_time.nil? || homework.publish_time > Time.now
@ -37,9 +38,9 @@ class UpdateHomeworkSettingService < ApplicationService
tip_exception("分班id不能为空") if setting[:group_id].length == 0
tip_exception("发布时间不能为空") if setting[:publish_time].blank?
tip_exception("截止时间不能为空") if setting[:end_time].blank?
tip_exception("发布时间不能早于当前时间") if setting[:publish_time] <= strf_time(Time.now)
tip_exception("截止时间不能早于当前时间") if setting[:end_time] <= strf_time(Time.now)
tip_exception("截止时间不能早于发布时间") if setting[:publish_time] > setting[:end_time]
tip_exception("发布时间不能早于当前时间") if setting[:publish_time].to_time <= Time.now
tip_exception("截止时间不能早于当前时间") if setting[:end_time].to_time <= Time.now
tip_exception("截止时间不能早于发布时间") if setting[:publish_time].to_time > setting[:end_time].to_time
tip_exception("截止时间不能晚于课堂结束时间(#{course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")}") if
course.end_date.present? && setting[:end_time] > course.end_date.end_of_day
@ -74,15 +75,15 @@ class UpdateHomeworkSettingService < ApplicationService
else
if homework.end_time > Time.now && homework.unified_setting
tip_exception("截止时间不能为空") if params[:end_time].blank?
tip_exception("截止时间不能早于当前时间") if params[:end_time] <= strf_time(Time.now)
tip_exception("截止时间不能早于当前时间") if params[:end_time].to_time <= Time.now
tip_exception("截止时间不能晚于课堂结束时间(#{course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")}") if
course.end_date.present? && params[:end_time] > strf_time(course.end_date.end_of_day)
course.end_date.present? && params[:end_time].to_time > course.end_date.end_of_day
homework.end_time = params[:end_time]
elsif !homework.unified_setting
homework.create_homework_group_settings
tip_exception("分班发布设置不能为空") if params[:group_settings].blank?
tip_exception("分班发布设置不能为空") if params[:group_settings].reject(&:blank?).blank?
params[:group_settings].each do |setting|
group_settings = HomeworkGroupSetting.where(homework_common_id: homework.id, course_group_id: setting[:group_id])
@ -90,12 +91,12 @@ class UpdateHomeworkSettingService < ApplicationService
tip_exception("发布时间不能为空") if setting[:publish_time].blank?
tip_exception("截止时间不能为空") if setting[:end_time].blank?
# 如果该发布规则 没有已发布的分班则需判断发布时间
tip_exception("发布时间不能早于等于当前时间") if setting[:publish_time] <= strf_time(Time.now) && group_settings.group_published.count == 0
tip_exception("发布时间不能早于等于当前时间") if setting[:publish_time].to_time <= Time.now && group_settings.group_published.count == 0
tip_exception("截止时间不能早于等于当前时间") if setting[:end_time] <= strf_time(Time.now) && group_settings.none_end.count > 0
tip_exception("截止时间不能早于发布时间") if setting[:publish_time] > setting[:end_time]
tip_exception("截止时间不能早于等于当前时间") if setting[:end_time].to_time <= Time.now && group_settings.none_end.count > 0
tip_exception("截止时间不能早于发布时间") if setting[:publish_time].to_time > setting[:end_time].to_time
tip_exception("截止时间不能晚于课堂结束时间(#{course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")}") if
course.end_date.present? && setting[:end_time] > strf_time(course.end_date.end_of_day)
course.end_date.present? && setting[:end_time].to_time > course.end_date.end_of_day
group_settings.none_published.update_all(publish_time: setting[:publish_time])
group_settings.none_end.update_all(end_time: setting[:end_time])

@ -2,7 +2,7 @@ import React, {Component} from 'react';
import './public-path';
import logo from './logo.svg';
import './App.css';
import {LocaleProvider} from 'antd'
import {ConfigProvider} from 'antd'
import zhCN from 'antd/lib/locale-provider/zh_CN';
import {
BrowserRouter as Router,
@ -483,7 +483,7 @@ class App extends Component {
// console.log(mygetHelmetapi);
return (
<Provider store={store}>
<LocaleProvider locale={zhCN}>
<ConfigProvider locale={zhCN}>
<MuiThemeProvider theme={theme}>
<Accountnewprofile {...this.props}{...this.state}/>
<LoginDialog {...this.props} {...this.state} Modifyloginvalue={()=>this.Modifyloginvalue()}></LoginDialog>
@ -708,7 +708,7 @@ class App extends Component {
</Switch>
</Router>
</MuiThemeProvider>
</LocaleProvider>
</ConfigProvider>
</Provider>
);
}

@ -132,7 +132,9 @@ class Trainingjobsetting extends Component {
CalculateMax: 100,//总分值
borredszf:"ml10 color-grey-9",
borredszfl:true,
borredszfls:''
borredszfls:'',
total_scoretwo:0,
total_score:0,
}
// console.log("获取到的值")
// console.log("Trainingjobsetting")
@ -302,7 +304,10 @@ class Trainingjobsetting extends Component {
proportion: result.data.shixun_evaluation === 0 ? "均分比例" : result.data.shixun_evaluation === 1 ? "经验值比例" : result.data.shixun_evaluation === 2 ? "自定义分值" : "",
publicwork: result.data.work_public,
challenge_settings: result.data.challenge_settings,
code_review: result.data.code_review
code_review: result.data.code_review,
total_scoretwo:result.data.total_score,
total_score:result.data.total_score,
})
this.props.Getdataback(result, result.data);
@ -646,6 +651,7 @@ class Trainingjobsetting extends Component {
if (this.state.completionefficiencyscore === true) {
latedeductiontwos = this.state.latedeductiontwo;
}
//从这里开始记得等于0的时候还要做判断
if (challenge_scoredata.length > 0) {
var len = 0;
for (var k = 0; k < challenge_scoredata.length; k++) {
@ -680,6 +686,16 @@ class Trainingjobsetting extends Component {
}
}else{
try {
if(parseFloat(this.state.CalculateMax)!==parseFloat(0)){
this.props.showNotification(`分值之和必须等于总分值:${this.state.CalculateMax}`);
this.scrollToAnchor("zongfentimeid");
return;
}
}catch (e) {
}
}
var url = `/homework_commons/${homeworkid}/update_settings.json`;
@ -707,7 +723,9 @@ class Trainingjobsetting extends Component {
shixun_evaluation: this.state.proportion === "均分比例" ? 0 : this.state.proportion === "经验值比例" ? 1 : this.state.proportion === "自定义分值" ? 2 : 0,
challenge_settings: array,
score_open: this.state.publicwork,
total_score:this.state.CalculateMax
total_score:this.state.CalculateMax,
total_scoretwo:this.state.CalculateMax,//记录总分值点击取消的时候还原总分值
}
} else {
// //非统一配置
@ -738,7 +756,8 @@ class Trainingjobsetting extends Component {
shixun_evaluation: this.state.proportion === "均分比例" ? 0 : this.state.proportion === "经验值比例" ? 1 : this.state.proportion === "自定义分值" ? 2 : 0,
challenge_settings: array,
score_open: this.state.publicwork,
total_score:this.state.CalculateMax
total_score:this.state.CalculateMax,
total_scoretwo:this.state.CalculateMax
}
}
@ -1193,8 +1212,7 @@ class Trainingjobsetting extends Component {
}
//总比分
Totalscorecalculation = (value) => {
debugger
this.setState({
CalculateMax: value,
})
@ -2150,6 +2168,9 @@ class Trainingjobsetting extends Component {
})
this.refs.targetElementTrainingjobsetting.scrollIntoView();
this.getTrainingjobsetting(false);
this.setState({
CalculateMax:this.state.total_scoretwo,
})
}
rulesCheckInfo = (rules) => {

@ -136,7 +136,7 @@ class AccountBasic extends Component {
}
handleSubmit = () => {
this.props.form.validateFieldsAndScroll((err, values) => {
this.props.form.validateFieldsAndScroll({ force: true }, (err, values) => {
console.log(values);
let {basicInfo}=this.props;
if(!err ){
@ -148,12 +148,12 @@ class AccountBasic extends Component {
this.props.showNotification('请先选择院系/部门')
return;
}
let url=`/users/accounts/${basicInfo.id}.json`
axios.put((url),{
nickname:values.nickname,
// 认证中的不能修改
name: basicInfo.authentication == 'uncertified' ?
name: basicInfo.authentication == 'uncertified' ?
(this.state.showRealName ? values.name : this.state.realName ) : basicInfo.name,
show_realname:this.state.showRealName,
gender:parseInt(values.sex),
@ -173,7 +173,7 @@ class AccountBasic extends Component {
}
this.props.getBasicInfo();
this.props.history.push('/account/profile')
}
}).catch((error)=>{
console.log(error);
@ -357,7 +357,7 @@ class AccountBasic extends Component {
})
}
addOrgSuccess = (name) => {
// const schoolList = this.state.schoolList.slice(0)
@ -377,7 +377,7 @@ class AccountBasic extends Component {
}
showApplyForAddOrgModal = () => {
this.applyForAddOrgForm.setVisible(true)
this.applyForAddOrgForm.setVisible(true)
}
showApplyForAddChildOrgModal = () => {
let{school,schoolList}=this.state;
@ -385,18 +385,18 @@ class AccountBasic extends Component {
return item.name == school;
});
if(arr.length > 0){
this.applyForAddChildOrgForm.setVisible(true)
this.applyForAddChildOrgForm.setVisible(true)
}else{
this.props.showNotification("请先选择正确的单位或者学校!");
}
}
checkNameLength = (rule, value, callback) => {
if (value && value.length <= MAX_NAME_LENGTH) {
callback();
return;
}
callback(`请输入真实姓名,最大限制${MAX_NAME_LENGTH}个字符`);
}
// checkNameLength = (rule, value, callback) => {
// if (value && value.length <= MAX_NAME_LENGTH) {
// callback();
// return;
// }
// callback(`请输入真实姓名,最大限制${MAX_NAME_LENGTH}个字符`);
// }
// 切换职称
changeJob=(e)=>{
this.setState({
@ -410,9 +410,53 @@ class AccountBasic extends Component {
})
}
}
//昵称
handleSubmitName(rule, value, callback){
if (value) {
let iconRule1 = /[`~!@#$%^&*()\-+=<>?:"{}|,.\/;'\\[\]·~@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/im;
// 判断是否含有emoji表情
let iconRule2 = /[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF][\u200D|\uFE0F]|[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF]|[0-9|*|#]\uFE0F\u20E3|[0-9|#]\u20E3|[\u203C-\u3299]\uFE0F\u200D|[\u203C-\u3299]\uFE0F|[\u2122-\u2B55]|\u303D|[\A9|\AE]\u3030|\uA9|\uAE|\u3030/ig;
// 如果为true字符串含有emoji表情 false不含
const iconRule2s =iconRule2.test(value);
// 如果为true字符串含有特殊符号 false不
const iconRule1s =iconRule1.test(value);
if (iconRule2s===true|| iconRule1s===true) {
callback('2-20位中英文、数字及下划线');
}
else if(value.length<2){
callback('2-20位中英文、数字及下划线');
}else if(value.length>=21){
callback('2-20位中英文、数字及下划线');
}
}
callback();
}
// 姓名
handleSubmitNames(rule, value, callback){
if (value) {
let iconRule1 = /[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/im;
// 判断是否含有emoji表情
let iconRule2 = /[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF][\u200D|\uFE0F]|[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF]|[0-9|*|#]\uFE0F\u20E3|[0-9|#]\u20E3|[\u203C-\u3299]\uFE0F\u200D|[\u203C-\u3299]\uFE0F|[\u2122-\u2B55]|\u303D|[\A9|\AE]\u3030|\uA9|\uAE|\u3030/ig;
// 如果为true字符串含有emoji表情 false不含
const iconRule2s =iconRule2.test(value);
// 如果为true字符串含有特殊符号 false不
const iconRule1s =iconRule1.test(value);
if (iconRule2s===true|| iconRule1s===true) {
callback('2-10位中英文、数字');
}
else if(value.length<2){
callback('2-10位中英文、数字');
}else if(value.length>=11){
callback('2-10位中英文、数字');
}
}
callback();
}
render() {
let{
let{
nameLength,
showRealName,
filterSchoolList,
@ -446,10 +490,10 @@ class AccountBasic extends Component {
{...propsWithoutForm} addOrgSuccess={this.addOrgSuccess}
></ApplyForAddOrgModal>
<ApplyForAddChildOrgModal ref="applyForAddChildOrgModal" schoolName={school} schoolId={school_id} departmentName={departmentsName}
{...propsWithoutForm} wrappedComponentRef={(form) => this.applyForAddChildOrgForm = form}
{...propsWithoutForm} wrappedComponentRef={(form) => this.applyForAddChildOrgForm = form}
addChildOrgSuccess={this.addChildOrgSuccess}
></ApplyForAddChildOrgModal>
<div className="basicForm courseNormalForm">
<style>{`
.formItemInline {
@ -525,9 +569,12 @@ class AccountBasic extends Component {
{getFieldDecorator('nickname', {
rules: [{
// initialValue: this.state.cityDefaultValue,
required: true,
required: true,
message: '请输入您的昵称',
}],
},
{ validator: this.handleSubmitName },
],
validateTrigger: 'onSubmit', // 设置进行表单验证的时机为onSubmit
})(
<Input placeholder={`请输入您的昵称,最大限制${MAX_NICKNAME_LENGTH}个字符`} className="exercicenewinputysl" onInput={this.changeNickName} maxLength={MAX_NICKNAME_LENGTH} addonAfter ={
<span className="color-grey-6 font-13">{String(nameLength)}/{MAX_NICKNAME_LENGTH}</span>
@ -552,18 +599,21 @@ class AccountBasic extends Component {
{ basicInfo.authentication == 'uncertified' ? <React.Fragment>{getFieldDecorator('name', {
rules: [{
// initialValue: this.state.cityDefaultValue,
required: true,
required: true,
message: `请输入真实姓名,最大限制${MAX_NAME_LENGTH}个字符`,
validator: this.checkNameLength
}],
},
{ validator: this.handleSubmitNames },
],
validateTrigger: 'onSubmit', // 设置进行表单验证的时机为onSubmit
})(
<Input placeholder={`请输入真实姓名,最大限制${MAX_NAME_LENGTH}个字符`} className="yslgraduainputedit" disabled={!showRealName && this.state.forDisable == true } addonAfter={
<i className={showRealName?"iconfont icon-xianshi font-18 color-blue":"iconfont icon-yincang font-18 color-blue"}
onClick={()=>this.showOrHide(showRealName)}></i>
}></Input>
)}
)}
<span>{ showRealName ? '(显示:平台将显示您的真实姓名)' : '(隐藏:平台将显示你的昵称)' }</span>
</React.Fragment> :
</React.Fragment> :
<div className="df" style={{}}>
<Tooltip title="已完成实名认证,不能修改">
<span className="mr8" >{showRealName ? this.props.basicInfo.name : getHiddenName(this.props.basicInfo.name)}</span>
@ -573,7 +623,7 @@ class AccountBasic extends Component {
<span>{ showRealName ? '(显示:平台将显示您的真实姓名)' : '(隐藏:平台将显示你的昵称)' }</span>
</div>
}
</Form.Item>
</Form.Item>
<Form.Item
label="性别"
@ -581,7 +631,7 @@ class AccountBasic extends Component {
>
{getFieldDecorator('sex', {
rules: [{
required: true,
required: true,
message: '请选择性别',
}],
})(
@ -589,7 +639,7 @@ class AccountBasic extends Component {
<ConditionToolTip title="已完成实名认证,不能修改" condition={basicInfo.authentication != 'uncertified'} >
<Radio value="0" disabled={basicInfo.authentication != 'uncertified'}></Radio>
<Radio value="1" disabled={basicInfo.authentication != 'uncertified'}></Radio>
</ConditionToolTip>
</ConditionToolTip>
</RadioGroup>
)}
</Form.Item>
@ -602,19 +652,19 @@ class AccountBasic extends Component {
{getFieldDecorator('city', {
rules: [{
type: 'array',
required: true,
required: true,
message: '请先选择所在地',
}],
})(
<City></City>
)}
</Form.Item>
<AccountBasicEditItem
identity={identity}
getFieldDecorator = {getFieldDecorator}
professionalFlag = {professionalFlag}
basicInfo = {basicInfo}
{...this.props}
<AccountBasicEditItem
identity={identity}
getFieldDecorator = {getFieldDecorator}
professionalFlag = {professionalFlag}
basicInfo = {basicInfo}
{...this.props}
{...this.state}
{...common}
form={this.props.form}
@ -630,7 +680,7 @@ class AccountBasic extends Component {
<div className="clearfix mt30 mb30"> */}
<Button type="primary" onClick={this.handleSubmit} size="middle" className="saveBtn mr20 mt30">{"保存"}</Button>
{this.props.basicInfo.base_info_completed &&
{this.props.basicInfo.base_info_completed &&
<Button type="" onClick={() => { this.props.history.push('/account/profile') }} size="middle" className="saveBtn cancelBtn mr20 mt30">{"取消"}</Button>}
{/* </div>
</Form.Item> */}

Loading…
Cancel
Save