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

dev_forum
杨树林 5 years ago
commit 0b238c7021

@ -2,8 +2,8 @@ class AddDepartmentAppliesController < ApplicationController
before_action :require_login, :check_auth before_action :require_login, :check_auth
def create def create
CreateAddDepartmentApplyService.call(current_user, create_params) department = CreateAddDepartmentApplyService.call(current_user, create_params)
render_ok render_ok(id: department.id)
rescue CreateAddDepartmentApplyService::Error => ex rescue CreateAddDepartmentApplyService::Error => ex
render_error(ex.message) render_error(ex.message)
end end

@ -2,8 +2,8 @@ class AddSchoolAppliesController < ApplicationController
before_action :require_login, :check_auth before_action :require_login, :check_auth
def create def create
CreateAddSchoolApplyService.call(current_user, create_params) school = CreateAddSchoolApplyService.call(current_user, create_params)
render_ok render_ok(id: school.id)
rescue CreateAddSchoolApplyService::Error => ex rescue CreateAddSchoolApplyService::Error => ex
render_error(ex.message) render_error(ex.message)
end end

@ -9,13 +9,15 @@ class Users::InterestsController < Users::BaseController
extension = current_user.user_extension || current_user.build_user_extension extension = current_user.user_extension || current_user.build_user_extension
return render_error('请选择职业') unless %w(teacher student professional).include?(identity) return render_error('请选择职业') unless %w(teacher student professional).include?(identity)
interest_ids = Array.wrap(params[:interest_ids]).map(&:to_i)
return render_error('请选择兴趣') if interest_ids.blank?
ActiveRecord::Base.transaction do ActiveRecord::Base.transaction do
extension.update_column(:identity, identity) extension.update_column(:identity, identity)
# 兴趣 # 兴趣
current_user.user_interests.delete_all
UserInterest.bulk_insert(:user_id, :repertoire_id) do |worker| UserInterest.bulk_insert(:user_id, :repertoire_id) do |worker|
(Repertoire.pluck(:id) & Array.wrap(params[:interest_ids]).map(&:to_i)).each do |repertoire_id| (Repertoire.pluck(:id) & interest_ids).each do |repertoire_id|
worker.add(user_id: current_user.id, repertoire_id: repertoire_id) worker.add(user_id: current_user.id, repertoire_id: repertoire_id)
end end
end end

@ -38,6 +38,6 @@ class CreateAddDepartmentApplyService < ApplicationService
message.save(validate: false) message.save(validate: false)
end end
school department
end end
end end

@ -13,7 +13,7 @@ class Users::BindPhoneService < ApplicationService
raise Error, '该手机号已被绑定' if User.where.not(id: user.id).exists?(phone: params[:phone]) raise Error, '该手机号已被绑定' if User.where.not(id: user.id).exists?(phone: params[:phone])
code = VerificationCode.where(phone: params[:phone], code: params[:code], code_type: 5).last code = VerificationCode.where(phone: params[:phone], code: params[:code], code_type: 4).last
raise Error, '验证码无效' unless code&.effective? raise Error, '验证码无效' unless code&.effective?
ActiveRecord::Base.transaction do ActiveRecord::Base.transaction do

@ -171,7 +171,9 @@ em.vertical-line{display: inline-block;width: 2px;background: #999;height: 10px}
#log_reg_content{border-radius: 5px;background: #FFFFff;width: 100%;text-align: center;position: absolute;top: 165px; #log_reg_content{border-radius: 5px;background: #FFFFff;width: 100%;text-align: center;position: absolute;top: 165px;
left: 0px;padding: 40px 30px;box-sizing: border-box} left: 0px;padding: 40px 30px;box-sizing: border-box}
.log_nav{border-bottom:1px solid #eaeaea;} .log_nav{border-bottom:1px solid #eaeaea;}
.log_nav li{float: left;text-align: center;font-size: 16px;padding-bottom:15px;margin: 0px 20px;cursor: pointer;} .log_nav li{float: left;text-align: center;font-size: 16px;padding-bottom:15px;
/*margin: 0px 20px;*/
cursor: pointer;}
.log_nav li.active{border-bottom: 2px solid #459be5;} .log_nav li.active{border-bottom: 2px solid #459be5;}
.log-botton{width: 100%;text-align: center;color: #FFFFff!important;display: block;background: #cbcbcb;height: 45px;line-height: 45px;border-radius: 4px;letter-spacing: 2px;cursor: pointer} .log-botton{width: 100%;text-align: center;color: #FFFFff!important;display: block;background: #cbcbcb;height: 45px;line-height: 45px;border-radius: 4px;letter-spacing: 2px;cursor: pointer}
.log-botton:hover{color: #FFFFff!important;} .log-botton:hover{color: #FFFFff!important;}

@ -1,5 +1,6 @@
import React, {Component} from "React"; import React, {Component} from "React";
import {Form, Select, Input, Button, Checkbox, DatePicker,Spin,Icon} from "antd"; import {Form, Select, Input, Button, Checkbox, DatePicker,Spin,Icon} from "antd";
import ApplyForAddOrgModal from '../../user/modal/ApplyForAddOrgModal';
import axios from 'axios'; import axios from 'axios';
import "../css/Courses.css"; import "../css/Courses.css";
import locale from 'antd/lib/date-picker/locale/zh_CN'; import locale from 'antd/lib/date-picker/locale/zh_CN';
@ -7,6 +8,7 @@ import moment from 'moment';
import Modals from '../../modals/Modals'; import Modals from '../../modals/Modals';
const { Option } = Select; const { Option } = Select;
@ -284,12 +286,13 @@ class CoursesNew extends Component {
// console.log(e.target.checked); // console.log(e.target.checked);
} }
Searchvalue=(value)=>{ Searchvalue=(value)=>{
let url="/courses/search_course_list.json"; let url="/courses/search_course_list.json";
axios.post(url,{ axios.post(url,{
search:value search:value
}).then((result)=>{ }).then((result)=>{
// console.log(result.data) // console.log(result.data)
if (result.data.message===undefined) { if (result.data.status===0) {
this.setState({ this.setState({
searchlist: result.data.course_lists, searchlist: result.data.course_lists,
// course:value, // course:value,
@ -304,14 +307,19 @@ class CoursesNew extends Component {
}) })
} }
handleSearch=(value)=>{ handleSearch=(value)=>{
this.props.form.setFieldsValue({
classroom:value, if(value!=""){
course:value this.props.form.setFieldsValue({
}); classroom:value,
this.Searchvalue(value) course:value
});
this.Searchvalue(value)
}
}; };
handleChange=(value)=>{ handleChange=(value)=>{
this.props.form.setFieldsValue({ this.props.form.setFieldsValue({
course:value, course:value,
classroom:value classroom:value
@ -320,13 +328,24 @@ class CoursesNew extends Component {
handleSearchschool=(value)=>{ handleSearchschool=(value)=>{
this.props.form.setFieldsValue({ if(value!="") {
school:value, this.props.form.setFieldsValue({
fetching:true, school: value,
}); fetching: true,
this.Searchvalue(value) });
this.getschool(value)
}
}; };
handleChangeschools=(value)=>{
this.props.form.setFieldsValue({
school: value,
fetching: true,
});
}
handleChangeschool=(value)=>{ handleChangeschool=(value)=>{
this.setState({ this.setState({
@ -338,35 +357,56 @@ class CoursesNew extends Component {
}; };
getschool=(value)=>{ getschool=(value)=>{
let url="/schools/school_list.json"; let url="/schools/school_list.json";
axios.get(url,{ axios.get(url,{
params: { params: {
search: value search: value
} }
}).then((result)=>{ }).then((result)=>{
if (result.data.message===undefined) { if (result.data.status===0) {
this.setState({ this.setState({
searchlistscholl: result.data.school_names, searchlistscholl: result.data.school_names,
scholl: value school: value
}) })
this.props.form.setFieldsValue({ this.props.form.setFieldsValue({
scholl: value school: value
}) })
} }
}).catch((error)=>{ }).catch((error)=>{
console.log(error) console.log(error)
}) })
} }
showApplyForAddOrgModal = () => {
this.applyForAddOrgForm.setVisible(true)
}
render() { render() {
let {datatime} = this.state; let {datatime,school,searchlistscholl} = this.state;
const {getFieldDecorator} = this.props.form; const {getFieldDecorator} = this.props.form;
const propsWithoutForm = Object.assign({}, this.props)
delete propsWithoutForm.form
const options = this.state.searchlist && this.state.searchlist.map(d => <Option key={d.name} value={d.name}>{d.name}</Option>); const options = this.state.searchlist && this.state.searchlist.map(d => <Option key={d.name} value={d.name}>{d.name}</Option>);
const optionschool = this.state.searchlistscholl.map(z => <Option key={z} value={z}>{z}</Option>); const optionschool = this.state.searchlistscholl&&this.state.searchlistscholl.map(z => <Option key={z} value={z}>{z}</Option>);
// console.log(this.props.current_user.user_school) // console.log(this.props.current_user.user_school)
// form合并了
// console.log(optionschool)
return ( return (
<React.Fragment> <React.Fragment>
<div> <div>
<style>
{
`
.color-green-light {
color: #45E660!important;
}
`
}
</style>
<ApplyForAddOrgModal ref="applyForAddOrgModal" wrappedComponentRef={(form) => this.applyForAddOrgForm = form} schoolName={school}
{...propsWithoutForm}></ApplyForAddOrgModal>
{/*提示*/} {/*提示*/}
<Modals <Modals
modalsType={this.state.Modalstype} modalsType={this.state.Modalstype}
@ -411,31 +451,9 @@ class CoursesNew extends Component {
} }
`} `}
</style> </style>
<div className="stud-class-set bor-bottom-greyE padding10200"> {/*<div className="stud-class-set bor-bottom-greyE padding10200">*/}
<Form.Item label="课堂所属单位">
{getFieldDecorator('school', { {/*</div>*/}
rules: [{required: true, message: "不能为空"}],
})(
<Select
showSearch
className={"fl construction mr10 "}
placeholder="请输入并选择课本堂的所属单位"
// value={this.state.school}
onSearch={this.handleSearchschool}
// notFoundContent={this.state.fetching ? <Spin size="small" /> : null}
onChange={this.handleChangeschool}
onFocus={()=>this.getschool("")}
allowClear={true}
>
{optionschool}
</Select>
)}
<span className={"newcoursestitle fl"}>
{/*(输入内容出现匹配的下拉菜单←同账号管理的单位信息填写)*/}
</span>
<div id='isschool'></div>
</Form.Item>
</div>
<div className="stud-class-set bor-bottom-greyE padding10200 "> <div className="stud-class-set bor-bottom-greyE padding10200 ">
<div className={"TabsWarpcourse"}> <div className={"TabsWarpcourse"}>
@ -455,7 +473,6 @@ class CoursesNew extends Component {
> >
{options} {options}
</Select> </Select>
)} )}
<span className={"newcoursestitle fl"}> <span className={"newcoursestitle fl"}>
{/*错误示例数据结构2017本部数据结构2017秋季数据结构2017电子商务1班*/} {/*错误示例数据结构2017本部数据结构2017秋季数据结构2017电子商务1班*/}
@ -605,7 +622,7 @@ class CoursesNew extends Component {
</Form.Item> </Form.Item>
</span> </span>
</div> </div>
<div className="stud-class-set padding10200 coursenavbox"> <div className="stud-class-set padding10200 coursenavbox bor-bottom-greyE">
<Form.Item <Form.Item
label="公开设置" label="公开设置"
hasFeedback hasFeedback
@ -619,9 +636,45 @@ class CoursesNew extends Component {
<span className={"coursesselect"}>选中后本课堂对所有用户可见否则仅本课堂成员可见</span> <span className={"coursesselect"}>选中后本课堂对所有用户可见否则仅本课堂成员可见</span>
</Form.Item> </Form.Item>
</div> </div>
<div className="stud-class-set padding10200 coursenavbox mb20">
<Form.Item label="课堂所属单位">
{getFieldDecorator('school', {
rules: [{required: true, message: "不能为空"}],
})(
<Select
showSearch
className={"fl construction mr10 "}
placeholder="请输入并选择课本堂的所属单位"
// value={this.state.school}
onSearch={this.handleSearchschool}
// notFoundContent={this.state.fetching ? <Spin size="small" /> : null}
onChange={this.handleChangeschools}
allowClear={true}
>
{optionschool}
</Select>
)}
<span className={"newcoursestitle fl"}>
{/*(输入内容出现匹配的下拉菜单←同账号管理的单位信息填写)*/}
</span>
<div id='isschool'></div>
</Form.Item>
{searchlistscholl.length===0?<div style={{height:"20px",lineHeight:"20px"}} className="ml20">
<span>
<span style={{color: '#CDCDCD'}}>未找到包含{school}的高校</span>
<span style={{color: '#4CACFF', cursor: 'pointer'}} onClick={this.showApplyForAddOrgModal}>申请新增</span>
</span>
</div>:""}
</div>
<div className={"FAFAFA"}> <div className={"FAFAFA"}>
<Form.Item wrapperCol={{span: 12, offset: 5}}> <Form.Item >
<div className="clearfix mt80 mb30"> <div className="clearfix mt40 mb30">
<Button type="primary" htmlType="submit" className="defalutSubmitbtn fl mr20"> <Button type="primary" htmlType="submit" className="defalutSubmitbtn fl mr20">
提交 提交
</Button> </Button>

@ -411,6 +411,7 @@ class LoginDialog extends Component {
<Dialog open={true} id="DialogID" <Dialog open={true} id="DialogID"
style={{ display: isRender==false? 'none' : ''}} style={{ display: isRender==false? 'none' : ''}}
disableEscapeKeyDown={true} disableEscapeKeyDown={true}
disableBackdropClick={true}
onClose={() => this.handleDialogClose()} onClose={() => this.handleDialogClose()}
> >
{isRender===true? {isRender===true?
@ -477,7 +478,7 @@ class LoginDialog extends Component {
登录 登录
</div> </div>
<p className="clearfix mt10"> <p className="clearfix mt20">
<span className="fl"> <span className="fl">
<input type="checkbox" <input type="checkbox"

@ -136,7 +136,7 @@ body>.-task-title {
margin-right: 20px; margin-right: 20px;
} }
.HeaderSearch .ant-input-search .ant-input{ .HeaderSearch .ant-input-search .ant-input{
height:30px; /*height:30px;*/
background: #373e3f !important; background: #373e3f !important;
border: 1px solid #373e3f !important; border: 1px solid #373e3f !important;

File diff suppressed because it is too large Load Diff

@ -51,7 +51,7 @@ export default class TpmQuestionMain extends Component {
<span className="mr30 color-orange pt10">*</span> <span className="mr30 color-orange pt10">*</span>
<div className="flex1 mr20"> <div className="flex1 mr20">
<TPMMDEditor ref={this.props.contentMdRef} placeholder="请输入选择题的过关任务内容" mdID={'courseContentMD'} refreshTimeout={1500} <TPMMDEditor ref={this.props.contentMdRef} placeholder="请输入选择题的过关任务内容" mdID={'courseContentMD'} refreshTimeout={1500}
watch={true} className="courseMessageMD" initValue={this.props.contentMdRefval}></TPMMDEditor> watch={true} className="courseMessageMD" initValue={this.props.contentMdRefval} height={700}></TPMMDEditor>
</div> </div>
<div> <div>
<span <span

@ -173,7 +173,9 @@ em.vertical-line{display: inline-block;width: 2px;background: #999;height: 10px}
#log_reg_content{border-radius: 5px;background: #FFFFff;width: 100%;text-align: center;position: absolute;top: 165px; #log_reg_content{border-radius: 5px;background: #FFFFff;width: 100%;text-align: center;position: absolute;top: 165px;
left: 0px;padding: 40px 30px;box-sizing: border-box} left: 0px;padding: 40px 30px;box-sizing: border-box}
.log_nav{border-bottom:1px solid #eaeaea;} .log_nav{border-bottom:1px solid #eaeaea;}
.log_nav li{float: left;text-align: center;font-size: 16px;padding-bottom:15px;margin: 0px 20px;cursor: pointer;} .log_nav li{float: left;text-align: center;font-size: 16px;padding-bottom:15px;
/*margin: 0px 20px;*/
cursor: pointer;}
.log_nav li.active{border-bottom: 2px solid #459be5;} .log_nav li.active{border-bottom: 2px solid #459be5;}
.log-botton{width: 100%;text-align: center;color: #FFFFff!important;display: block;background: #cbcbcb;height: 45px;line-height: 45px;border-radius: 4px;letter-spacing: 2px;cursor: pointer} .log-botton{width: 100%;text-align: center;color: #FFFFff!important;display: block;background: #cbcbcb;height: 45px;line-height: 45px;border-radius: 4px;letter-spacing: 2px;cursor: pointer}
.log-botton:hover{color: #FFFFff!important;} .log-botton:hover{color: #FFFFff!important;}

Loading…
Cancel
Save