Merge branch 'dev_aliyun' into develop

PCqiandao
cxt 5 years ago
commit ee7f89461e

@ -34,7 +34,10 @@ class AttendancesController < ApplicationController
@normal_count = @course.course_member_attendances.where(course_member_id: member&.id, course_attendance_id: attendance_ids, attendance_status: "NORMAL").size @normal_count = @course.course_member_attendances.where(course_member_id: member&.id, course_attendance_id: attendance_ids, attendance_status: "NORMAL").size
@leave_count = @course.course_member_attendances.where(course_member_id: member&.id, course_attendance_id: attendance_ids, attendance_status: "LEAVE").size @leave_count = @course.course_member_attendances.where(course_member_id: member&.id, course_attendance_id: attendance_ids, attendance_status: "LEAVE").size
@absence_count = @course.course_member_attendances.where(course_member_id: member&.id, course_attendance_id: attendance_ids, attendance_status: "ABSENCE").size @absence_count = @course.course_member_attendances.where(course_member_id: member&.id, course_attendance_id: attendance_ids, attendance_status: "ABSENCE").size
else
@attendances = @attendances.where("attendance_date = '#{current_date}' and start_time <= '#{current_end_time}' and end_time > '#{current_end_time}'")
end end
end end
@attendances_count = @attendances.size @attendances_count = @attendances.size

@ -1298,7 +1298,7 @@ class CoursesController < ApplicationController
def left_banner def left_banner
@user = current_user @user = current_user
@is_teacher = @user_course_identity < Course::ASSISTANT_PROFESSOR @is_teacher = @user_course_identity < Course::ASSISTANT_PROFESSOR
@course_modules = @course.course_modules.where.not(module_type: 'attendance').where(hidden: 0).includes(first_categories: :children) @course_modules = @course.course_modules.where(hidden: 0).includes(first_categories: :children)
@hidden_modules = @course.course_modules.where(hidden: 1) @hidden_modules = @course.course_modules.where(hidden: 1)
@second_category_type = ["shixun_homework", "graduation", "attachment", "board", "course_group", "video", "common_homework", "group_homework"] @second_category_type = ["shixun_homework", "graduation", "attachment", "board", "course_group", "video", "common_homework", "group_homework"]
end end

@ -9,8 +9,10 @@ class Weapps::AttendancesController < ApplicationController
def create def create
ActiveRecord::Base.transaction do ActiveRecord::Base.transaction do
attendance = @course.course_attendances.create!(create_params.merge(user_id: current_user.id)) attendance = @course.course_attendances.create!(create_params.merge(user_id: current_user.id))
unless params[:group_ids].blank? || @course.course_groups.where(id: params[:group_ids]).count == @course.course_groups.count group_ids = params[:group_ids] || []
group_ids = @course.charge_group_ids(current_user) & params[:group_ids].map(&:to_i) group_ids = group_ids.blank? ? @course.charge_group_ids(current_user) : @course.charge_group_ids(current_user) & params[:group_ids].map(&:to_i)
unless group_ids.blank? || @course.course_groups.where(id: group_ids).count == @course.course_groups.count
# group_ids = @course.charge_group_ids(current_user) & params[:group_ids].map(&:to_i)
group_ids.each do |group_id| group_ids.each do |group_id|
@course.course_attendance_groups.create!(course_group_id: group_id, course_attendance: attendance) @course.course_attendance_groups.create!(course_group_id: group_id, course_attendance: attendance)
end end

@ -38,7 +38,14 @@ class Weapps::ShixunSearchService < ApplicationService
keyword: "%#{keyword}%", name: "%#{keyword.split(" ").join("%")}%").distinct keyword: "%#{keyword}%", name: "%#{keyword.split(" ").join("%")}%").distinct
end end
shixuns.order("#{sort_str} #{order_str}") order =
if sort_str == "wechat_myshixuns_count"
"is_wechat_support desc, myshixuns_count #{order_str}"
else
"#{sort_str} #{order_str}"
end
shixuns.order(order)
end end
private private

@ -5,5 +5,6 @@ json.shixun_list @results do |obj|
json.study_count obj.myshixuns_count json.study_count obj.myshixuns_count
json.author_name obj.user.real_name json.author_name obj.user.real_name
json.author_img url_to_avatar(obj.user) json.author_img url_to_avatar(obj.user)
json.pic url_to_avatar(obj)
end end
json.shixuns_count @total_count json.shixuns_count @total_count

@ -69,6 +69,12 @@ class NullChildEditor extends Component{
style={{float: 'right'}} style={{float: 'right'}}
></i> ></i>
</Tooltip> } </Tooltip> }
{itemIndex === 0 && <Tooltip title="删除">
<i className="iconfont icon-htmal5icon19 font-18 color-grey-c ml10"
onClick={() => this.props.deleteChildAnswermain(index, itemIndex)}
style={{float: 'right'}}
></i>
</Tooltip> }
{ <Tooltip title={`新增参考答案`}> { <Tooltip title={`新增参考答案`}>
<i className="color-green font-16 iconfont icon-roundaddfill ml6" <i className="color-green font-16 iconfont icon-roundaddfill ml6"
onClick={() => addChildAnswer(index)} onClick={() => addChildAnswer(index)}

@ -217,6 +217,21 @@ class NullEditor extends Component{
) )
} }
deleteChildAnswermain=(index, childIndex)=>{
let newstandard_answers=this.state.standard_answers
this.props.confirm({
content: `确认要删除这个参考答案吗?`,
onOk: () => {
newstandard_answers.splice(index,1)
this.setState({
standard_answers:newstandard_answers
})
}
})
}
deleteChildAnswer = (index, childIndex) => { deleteChildAnswer = (index, childIndex) => {
if(!this.state.standard_answers[index][childIndex]) { if(!this.state.standard_answers[index][childIndex]) {
this.setState( this.setState(
@ -321,6 +336,7 @@ class NullEditor extends Component{
onAnswerChange={this.onAnswerChange} onAnswerChange={this.onAnswerChange}
addChildAnswer={this.addChildAnswer} addChildAnswer={this.addChildAnswer}
deleteChildAnswer={this.deleteChildAnswer} deleteChildAnswer={this.deleteChildAnswer}
deleteChildAnswermain={this.deleteChildAnswermain}
></NullChildEditor> ></NullChildEditor>
// answer.map((item, itemIndex) => { // answer.map((item, itemIndex) => {
// return <DMDEditor // return <DMDEditor

@ -120,6 +120,7 @@ class Detailss extends Component {
defaultActiveKey === "1" ? defaultActiveKey === "1" ?
<div className="ws25s" style={{ <div className="ws25s" style={{
position: "relative", position: "relative",
overflow: 'hidden',
}}> }}>
{ {
item && item.mode === "NUMBER" ? item && item.mode === "NUMBER" ?
@ -140,6 +141,15 @@ class Detailss extends Component {
<p className="h40s font-16" style={{ <p className="h40s font-16" style={{
color: "#909399" color: "#909399"
}}>签到码</p> }}>签到码</p>
<div style={{
overflow: 'hidden',
height: "1px",
width: "1px",
position: "absolute",
right: "-200px",
}}>
<input id={"file_path" + 1} className="file_path_input" value={item&&item.code}/>
</div>
</div> </div>
: :
item && item.mode === "QRCODE" ? item && item.mode === "QRCODE" ?
@ -174,14 +184,7 @@ class Detailss extends Component {
</div> </div>
</div> </div>
{
defaultActiveKey === "1" ?
item && item.mode === "NUMBER" ?
<input id={"file_path" + 1} className="file_path_input" value={item&&item.code}/>
:""
:
""
}
</div> </div>
</React.Fragment> </React.Fragment>

@ -103,6 +103,7 @@
text-align: right; text-align: right;
margin-right: 20px; margin-right: 20px;
line-height: 32px; line-height: 32px;
height: 32px;
} }
#form_in_modal_group_ids .ant-select-selection{ #form_in_modal_group_ids .ant-select-selection{
@ -150,6 +151,10 @@
color:#FF835C; color:#FF835C;
} }
.color909399{
color:#909399;
}
.color1890FF{ .color1890FF{
color:#1890FF; color:#1890FF;
} }
@ -186,3 +191,13 @@
.sginboxcolorFF835C .ant-select-arrow{ .sginboxcolorFF835C .ant-select-arrow{
color: #FF835C !important; color: #FF835C !important;
} }
.sginboxcolor909399 .ant-select-selection--single{
border:1px solid #909399 !important;
}
.sginboxcolor909399 .ant-select-arrow{
color: #909399 !important;
}

@ -14,7 +14,7 @@ class Signedinlist extends Component {
limit:5, limit:5,
page:1, page:1,
loading:false, loading:false,
attendanceslist:[{id:undefined,name:"全部分班"}], attendanceslist:[],
data:null, data:null,
group_ids:[], group_ids:[],
members_count:0, members_count:0,
@ -23,12 +23,12 @@ class Signedinlist extends Component {
{id:undefined,name:"全部状态"}, {id:undefined,name:"全部状态"},
{id:"NORMAL",name:"正常签到"}, {id:"NORMAL",name:"正常签到"},
{id:"LEAVE",name:"请 假"}, {id:"LEAVE",name:"请 假"},
{id:"ABSENCE",name:"旷 课"}, {id:"ABSENCE",name:this.props.defaultActiveKey ==="2"?"旷 课":"未签到"},
], ],
newstate:[ newstate:[
{id:"NORMAL",name:"正常签到"}, {id:"NORMAL",name:"正常签到"},
{id:"LEAVE",name:"请 假"}, {id:"LEAVE",name:"请 假"},
{id:"ABSENCE",name:"旷 课"}, {id:"ABSENCE",name:this.props.defaultActiveKey ==="2"?"旷 课":"未签到"},
], ],
course_members_count:'--', course_members_count:'--',
attendance_count:'--', attendance_count:'--',
@ -36,17 +36,15 @@ class Signedinlist extends Component {
} }
componentDidMount() { componentDidMount() {
this.getdatas(this.props&&this.props.switattendance_id,1,[],undefined) this.getdatas(this.props&&this.props.switattendance_id,1,[],undefined)
// this.getpath() // this.getpath()
} }
componentDidUpdate(prevProps, prevState) { componentDidUpdate(prevProps, prevState) {
if(prevProps.headdata!=this.props.headdata){ if(prevProps.headdata!=this.props.headdata){
let {attendanceslist}=this.state;
if(this.props.headdata){ if(this.props.headdata){
let listattendanceslist=attendanceslist; let listattendanceslist=[];
listattendanceslist.push({id:undefined,name:"全部分班"})
if(this.props.headdata.course_groups){ if(this.props.headdata.course_groups){
if(this.props.headdata.course_groups.length>0){ if(this.props.headdata.course_groups.length>0){
@ -56,7 +54,7 @@ class Signedinlist extends Component {
} }
} }
this.setState({ this.setState({
listattendanceslist:listattendanceslist, attendanceslist:listattendanceslist,
data:this.props.headdata, data:this.props.headdata,
course_members_count:this.props.headdata.normal_count, course_members_count:this.props.headdata.normal_count,
attendance_count:this.props.headdata.all_count attendance_count:this.props.headdata.all_count
@ -128,7 +126,7 @@ class Signedinlist extends Component {
let url=`/weapps/attendances/${this.props&&this.props.switattendance_id}.json`; let url=`/weapps/attendances/${this.props&&this.props.switattendance_id}.json`;
axios.get(url).then((response) => { axios.get(url).then((response) => {
if(response.data){ if(response.data){
listattendanceslist.push({id:undefined,name:"全部分班"})
if(response.data.course_groups.length>0){ if(response.data.course_groups.length>0){
response.data.course_groups.map((item,key)=>{ response.data.course_groups.map((item,key)=>{
listattendanceslist.push(item) listattendanceslist.push(item)
@ -151,7 +149,7 @@ class Signedinlist extends Component {
}) })
} }
this.setState({ this.setState({
listattendanceslist:listattendanceslist, attendanceslist:listattendanceslist,
data:response.data data:response.data
}) })
@ -161,7 +159,6 @@ class Signedinlist extends Component {
} }
handleChangestate=(value)=>{ handleChangestate=(value)=>{
let neval let neval
if(!value){ if(!value){
neval=undefined neval=undefined
this.setState({ this.setState({
@ -214,6 +211,7 @@ class Signedinlist extends Component {
this.setState({ this.setState({
member_attendances:newmember_attendances member_attendances:newmember_attendances
}) })
this.props.mygetdatas()
} }
}) })
.catch(function (error) { .catch(function (error) {
@ -264,14 +262,14 @@ class Signedinlist extends Component {
<span> <span>
<Select key={record.index} defaultValue={record.attendance_status} <Select key={record.index} defaultValue={record.attendance_status}
// className={"Signedinlistbox"} // className={"Signedinlistbox"}
className={record.attendance_status==="NORMAL"?"color26C7C9 Signedinlistbox sginboxcolor26C7C9":record.attendance_status==="LEAVE"?"colorEAAE4E Signedinlistbox sginboxcolorEAAE4E":record.attendance_status==="ABSENCE"?"colorFF835C Signedinlistbox sginboxcolorFF835C":"Signedinlistbox"} className={record.attendance_status==="NORMAL"?"color26C7C9 Signedinlistbox sginboxcolor26C7C9":record.attendance_status==="LEAVE"?"colorEAAE4E Signedinlistbox sginboxcolorEAAE4E":record.attendance_status==="ABSENCE"?this.props.defaultActiveKey==="2"?"colorFF835C Signedinlistbox sginboxcolorFF835C":"color909399 Signedinlistbox sginboxcolor909399":"Signedinlistbox"}
style={{ width: 167 }} onChange={(e)=>this.handleChange(e,record.user_id)}> style={{ width: 167 }} onChange={(e)=>this.handleChange(e,record.user_id)}>
{ {
newstate&&newstate.map((item,key)=>{ newstate&&newstate.map((item,key)=>{
return( return(
<Option value={item.id} key={key} <Option value={item.id} key={key}
className={item.name==="正常签到"?"color26C7C9 sginbox":item.name==="请 假"?"colorEAAE4E sginbox":item.name==="旷 课"?"colorFF835C sginbox":""}>{item.name}</Option> className={item.name==="正常签到"?"color26C7C9 sginbox":item.name==="请 假"?"colorEAAE4E sginbox":item.name==="旷 课"?"colorFF835C sginbox": item.name ==="未签到"?"color909399 sginbox":""}>{item.name}</Option>
) )
}) })
} }

@ -353,10 +353,10 @@ class Students_signin extends Component{
{ {
isAdmin===true? isAdmin===true?
<TabPane tab="签到统计" key="3"> <TabPane tab="签到统计" key="3">
<Signinstatistics {defaultActiveKey&&defaultActiveKey==="3"?<Signinstatistics
{...this.props} {...this.props}
{...this.state} {...this.state}
/> />:""}
</TabPane> </TabPane>
: :
"" ""

Loading…
Cancel
Save