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

PCqiandao
cxt 5 years ago
commit 27766f66f8

@ -8,7 +8,7 @@ class Weapps::SubjectQuery < ApplicationQuery
end end
def call def call
subjects = @current_laboratory.subjects.unhidden.publiced subjects = @current_laboratory.subjects.unhidden.publiced.show_moblied
# 课程体系的过滤 # 课程体系的过滤
if params[:sub_discipline_id].present? if params[:sub_discipline_id].present?

@ -36,7 +36,7 @@ class Teacherentry extends Component {
<React.Fragment> <React.Fragment>
<div className={index===0?"ws100s edu-back-white ": "ws100s edu-back-white mt20"}> <div className={index===0?"ws100s edu-back-white ": "ws100s edu-back-white mt20"}>
<div className="ws100s teacherentrydiv "> <div className="ws100s teacherentrydiv ">
<p className="ws100s teachedivp ymaxnamewidthdivp xiaoshou" onClick={()=>this.props.qiandaoxiangq(true,item.id)}> <p className={isAdmin?"ws100s teachedivp ymaxnamewidthdivp xiaoshou":"ws100s teachedivp ymaxnamewidthdivp"} onClick={isAdmin?()=>this.props.qiandaoxiangq(true,item.id):""}>
{ {
item.name item.name
} }
@ -112,10 +112,24 @@ class Teacherentry extends Component {
( (
this.props.defaultActiveKey === "1" ? this.props.defaultActiveKey === "1" ?
<div className="ws100s xaxisreverseorder"> <div className="ws100s xaxisreverseorder">
{
item.attendance_status?
(
item.attendance_status==="ABSENCE"?
<div className="qiandaobutton xiaoshou" onClick={()=>this.props.Signin(item.mode,item.id,item.attendance_code)}>
签到
</div>
:
item.attendance_status==="NORMAL"?
<div className="qiandaobutton" >
正常签到
</div>
:""
)
:
""
}
<div className="qiandaobutton xiaoshou" onClick={()=>this.props.Signin(item.mode,item.id,item.attendance_code)}>
签到
</div>
</div> </div>
: :
<div className="ws100s xaxisreverseorder"> <div className="ws100s xaxisreverseorder">

@ -4,8 +4,9 @@ import axios from 'axios';
import Teacherentry from "../Teacherentry"; import Teacherentry from "../Teacherentry";
import NoneDatas from '../NoneDatas'; import NoneDatas from '../NoneDatas';
import LoadingSpin from '../../../../../common/LoadingSpin'; import LoadingSpin from '../../../../../common/LoadingSpin';
import { Modal, Button } from 'antd';
import Listjihe from "../../../../question/component/Listjihe"; const { confirm } = Modal;
//在线学习 //在线学习
class Teaccomponent extends Component{ class Teaccomponent extends Component{
@ -34,55 +35,78 @@ class Teaccomponent extends Component{
} }
//截止 //截止
thisEnd=(attendance_id)=>{ thisEnd=(attendance_id)=>{
const url = `/weapps/attendances/${attendance_id}/end.json`; let thiss=this
var data={
} confirm({
axios.post(url, data) title: '提示',
.then((result) => { content: '确认截止此签到吗?',
if (result.data.status === 0) { onOk() {
// try { const url = `/weapps/attendances/${attendance_id}/end.json`;
// this.props.showNotification(`截止成功`); var data={
// }catch (e) {
//
// }
this.props.getsetdatas();
}else{
this.props.showNotification(result.data.message);
} }
}).catch((error) => { axios.post(url, data)
//console.log(error); .then((result) => {
}) if (result.data.status === 0) {
// try {
// this.props.showNotification(`截止成功`);
// }catch (e) {
//
// }
thiss.props.getsetdatas();
}else{
thiss.props.showNotification(result.data.message);
}
}).catch((error) => {
//console.log(error);
})
},
onCancel() {
},
});
} }
//删除 //删除
thisdelete=(attendance_id)=>{ thisdelete=(attendance_id)=>{
const url = `/weapps/attendances/${attendance_id}.json`; let thiss=this
var data={ confirm({
title: '提示',
} content: '确认删除此签到吗?',
axios.delete(url, data) onOk () {
.then((result) => { const url = `/weapps/attendances/${attendance_id}.json`;
if (result.data.status === 0) { var data={
// try {
// this.props.showNotification(`删除成功`);
// }catch (e) {
//
// }
this.props.getsetdatas();
}else{
this.props.showNotification(result.data.message);
} }
}).catch((error) => { axios.delete(url, data)
//console.log(error); .then((result) => {
}) if (result.data.status === 0) {
// try {
// thiss.props.showNotification(`删除成功`);
// }catch (e) {
//
// }
thiss.props.getsetdatas();
}else{
thiss.props.showNotification(result.data.message);
}
}).catch((error) => {
//console.log(error);
})
},
onCancel() {
},
});
} }
//学生签到 //学生签到
Signin=(attendance_mode,attendance_id,code)=>{ Signin=(attendance_mode,attendance_id,code)=>{
debugger
const url = `/weapps/course_member_attendances.json`; const url = `/weapps/course_member_attendances.json`;
var data={ var data={

@ -161,4 +161,28 @@
.textcenter{ .textcenter{
text-align: center !important; text-align: center !important;
}
.sginboxcolor26C7C9 .ant-select-selection--single{
border:1px solid #26C7C9 !important;
}
.sginboxcolor26C7C9 .ant-select-arrow{
color: #26C7C9 !important;
}
.sginboxcolorEAAE4E .ant-select-selection--single{
border:1px solid #EAAE4E !important;
}
.sginboxcolorEAAE4E .ant-select-arrow{
color: #EAAE4E !important;
}
.sginboxcolorFF835C .ant-select-selection--single{
border:1px solid #FF835C !important;
}
.sginboxcolorFF835C .ant-select-arrow{
color: #FF835C !important;
} }

@ -21,14 +21,14 @@ class Signedinlist extends Component {
attendance_status:undefined, attendance_status:undefined,
state:[ state:[
{id:undefined,name:"全部状态"}, {id:undefined,name:"全部状态"},
{id:"NORMAL",name:"正常出勤"}, {id:"NORMAL",name:"正常签到"},
{id:"LEAVE",name:"请假"}, {id:"LEAVE",name:"请 假"},
{id:"ABSENCE",name:"旷课"}, {id:"ABSENCE",name:"旷 课"},
], ],
newstate:[ newstate:[
{id:"NORMAL",name:"正常出勤"}, {id:"NORMAL",name:"正常签到"},
{id:"LEAVE",name:"请假"}, {id:"LEAVE",name:"请 假"},
{id:"ABSENCE",name:"旷课"}, {id:"ABSENCE",name:"旷 课"},
], ],
course_members_count:'--', course_members_count:'--',
attendance_count:'--', attendance_count:'--',
@ -43,7 +43,7 @@ class Signedinlist extends Component {
} }
componentDidUpdate(prevProps, prevState) { componentDidUpdate(prevProps, prevState) {
if(prevProps.headdata!=this.props.headdata){ if(prevProps.headdata!=this.props.headdata){
console.log(this.props.headdata)
let {attendanceslist}=this.state; let {attendanceslist}=this.state;
if(this.props.headdata){ if(this.props.headdata){
let listattendanceslist=attendanceslist; let listattendanceslist=attendanceslist;
@ -58,8 +58,8 @@ class Signedinlist extends Component {
this.setState({ this.setState({
listattendanceslist:listattendanceslist, listattendanceslist:listattendanceslist,
data:this.props.headdata, data:this.props.headdata,
course_members_count:this.props.headdata.all_count, course_members_count:this.props.headdata.normal_count,
attendance_count:this.props.headdata.normal_count attendance_count:this.props.headdata.all_count
}) })
} }
@ -124,8 +124,7 @@ class Signedinlist extends Component {
} }
getpath=(id)=>{ getpath=(id)=>{
let {attendanceslist}=this.state; let listattendanceslist=[]
let listattendanceslist=attendanceslist
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){
@ -147,12 +146,12 @@ class Signedinlist extends Component {
}) })
}else{ }else{
this.setState({ this.setState({
course_members_count:response.data.all_count, course_members_count:response.data.normal_count,
attendance_count: response.data.normal_count attendance_count: response.data.all_count
}) })
} }
this.setState({ this.setState({
listattendanceslist:attendanceslist, listattendanceslist:listattendanceslist,
data:response.data data:response.data
}) })
@ -190,6 +189,17 @@ class Signedinlist extends Component {
} }
handleChange=(attendance_status,value)=>{ handleChange=(attendance_status,value)=>{
let {member_attendances}=this.state;
let newmember_attendances=member_attendances;
newmember_attendances.map((item,key)=>{
if(item.user_id===value){
item.attendance_status=attendance_status
}
})
let url=`/weapps/course_member_attendances/update_status.json`; let url=`/weapps/course_member_attendances/update_status.json`;
axios.post(url, { axios.post(url, {
@ -201,7 +211,9 @@ class Signedinlist extends Component {
.then((response) => { .then((response) => {
if (response.data.status == 0) { if (response.data.status == 0) {
this.props.showNotification(`修改状态成功`); this.props.showNotification(`修改状态成功`);
this.setState({
member_attendances:newmember_attendances
})
} }
}) })
.catch(function (error) { .catch(function (error) {
@ -212,38 +224,54 @@ class Signedinlist extends Component {
} }
render() { render() {
let {attendanceslist,state,data,member_attendances,newstate}=this.state; let {attendanceslist,state,data,member_attendances,newstate,attendance_status}=this.state;
const columns = [ const columns = [
{ {
title: '序号', title: '序号',
dataIndex: 'index', dataIndex: 'index',
key: 'index', key: 'index',
width:300,
className: "textcenter", className: "textcenter",
}, },
{ {
title: '姓名', title: '姓名',
dataIndex: 'user_name', dataIndex: 'user_name',
key: 'user_name', key: 'user_name',
width:300,
className: "textcenter", className: "textcenter",
render: (text, record) => (
<span>{record.user_name===null?"--":record.user_name}</span>
)
}, },
{ {
title: '学号', title: '学号',
dataIndex: 'student_id', dataIndex: 'student_id',
key: 'student_id', key: 'student_id',
width:300,
className: "textcenter", className: "textcenter",
render: (text, record) => (
<span>{record.student_id===null?"--":record.student_id}</span>
)
}, },
{ {
title: '状态', title: '状态',
key: 'attendance_status', key: 'attendance_status',
width:300,
dataIndex: 'attendance_status', dataIndex: 'attendance_status',
className: "textcenter",
render: (text, record) => ( render: (text, record) => (
<span> <span>
<Select key={record.index} defaultValue={record.attendance_status} className={"Signedinlistbox"} style={{ width: 167 }} onChange={(e)=>this.handleChange(e,record.user_id)}> <Select key={record.index} defaultValue={record.attendance_status}
// 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"}
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}>{item.name}</Option> <Option value={item.id} key={key}
className={item.name==="正常签到"?"color26C7C9 sginbox":item.name==="请 假"?"colorEAAE4E sginbox":item.name==="旷 课"?"colorFF835C sginbox":""}>{item.name}</Option>
) )
}) })
} }
@ -274,11 +302,18 @@ class Signedinlist extends Component {
<Col className="gutter-row ml20" span={6}> <Col className="gutter-row ml20" span={6}>
<Select defaultValue="全部状态" className={"Signedinlistbox"} style={{ width: 167 }} onChange={this.handleChangestate}> <Select defaultValue="全部状态"
className={"Signedinlistbox"}
//className={attendance_status&&attendance_status==="NORMAL"?"color26C7C9 Signedinlistbox sginboxcolor26C7C9":attendance_status&&attendance_status==="LEAVE"?"colorEAAE4E Signedinlistbox sginboxcolorEAAE4E":attendance_status&&attendance_status==="ABSENCE"?"colorFF835C Signedinlistbox sginboxcolorFF835C":"Signedinlistbox"}
style={{ width: 167 }} onChange={this.handleChangestate}>
{ {
state&&state.map((item,key)=>{ state&&state.map((item,key)=>{
return( return(
<Option value={item.id} key={key}>{item.name}</Option> <Option value={item.id} key={key}
//className={item.name==="正常签到"?"color26C7C9":item.name==="请假"?"colorEAAE4E":item.name==="旷课"?"colorFF835C":""}
>
{item.name}
</Option>
) )
}) })
} }

@ -25,8 +25,6 @@ class Signindetails extends Component{
//.log(response); //.log(response);
if(response){ if(response){
if(response.data){ if(response.data){
console.log("头部数据")
console.log(response.data)
this.setState({ this.setState({
headdata:response.data headdata:response.data
}) })
@ -37,12 +35,6 @@ class Signindetails extends Component{
} }
componentDidUpdate = (prevProps) => {
console.log("componentDidUpdate");
}
render(){ render(){
let {headdata}= this.state; let {headdata}= this.state;

@ -111,6 +111,18 @@ class Students_signin extends Component{
leave_count:response.data.leave_count, leave_count:response.data.leave_count,
absence_count:response.data.absence_count, absence_count:response.data.absence_count,
}) })
if(response.data.attendances.length===0&&mydata.page!==1){
this.setState({
page:mydata.page-1,
limit:5
})
let data={
key: mydata.key,
page:mydata.page-1,
limit:5
}
this.gogetdatas(data);
}
} }
} }
this.setState({ this.setState({

@ -30,7 +30,7 @@ class ShixunPathSearch extends Component {
//适配器 //适配器
onChangeLabel(value) { onChangeLabel(value) {
let rs = value === 'new' ? 'updated_at' : 'myshixuns_scount' let rs = value === 'new' ? 'updated_at' : 'myshixuns_count'
let { discipline_id, sub_discipline_id } = this.state; let { discipline_id, sub_discipline_id } = this.state;
this.setState({ this.setState({
order: rs, order: rs,

Loading…
Cancel
Save