Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
B
biz.qingxiao.com
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangxuelai
biz.qingxiao.com
Commits
0205326f
Commit
0205326f
authored
Oct 11, 2019
by
baixian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
选班
parent
fd34b90b
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
352 additions
and
9 deletions
+352
-9
eslint.xml
.idea/jsLinters/eslint.xml
+6
-0
api.js
src/common/api.js
+9
-8
teachers.js
src/models/teachers.js
+90
-0
ChooseClassModal.js
src/pages/teacher/ChooseClassModal.js
+121
-0
ChooseClassModal.less
src/pages/teacher/ChooseClassModal.less
+19
-0
index.js
src/pages/teacher/index.js
+98
-1
teachers.js
src/services/teachers.js
+9
-0
No files found.
.idea/jsLinters/eslint.xml
0 → 100644
View file @
0205326f
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"EslintConfiguration"
>
<custom-configuration-file
used=
"true"
path=
"E:\work\biz.qingxiao.com\.eslintrc"
/>
</component>
</project>
\ No newline at end of file
src/common/api.js
View file @
0205326f
...
...
@@ -4,15 +4,15 @@ const basepath = `${location.protocol}//${pathify(window.location.host)}/`;
let
api
=
''
;
let
dakaapi
=
''
;
if
(
ENVIRONMENT
==
'pro'
)
{
//
api = 'https://test.wp53.cn/v2/api/';
//
dakaapi = 'https:clock.wp53.cn/v3/';
api
=
'https://wx.m.shangjiadao.cn/v2/api/'
;
dakaapi
=
'https://qxapi.qingxiao.online/daka/v3/'
;
api
=
'https://test.wp53.cn/v2/api/'
;
dakaapi
=
'https:clock.wp53.cn/v3/'
;
//
api = 'https://wx.m.shangjiadao.cn/v2/api/';
//
dakaapi = 'https://qxapi.qingxiao.online/daka/v3/';
}
else
if
(
ENVIRONMENT
==
'dev'
)
{
api
=
'https://wx.m.shangjiadao.cn/v2/api/'
;
dakaapi
=
'https://qxapi.qingxiao.online/daka/v3/'
;
//
api = 'https://test.wp53.cn/v2/api/';
//
dakaapi = 'https:clock.wp53.cn/v3/';
//
api = 'https://wx.m.shangjiadao.cn/v2/api/';
//
dakaapi = 'https://qxapi.qingxiao.online/daka/v3/';
api
=
'https://test.wp53.cn/v2/api/'
;
dakaapi
=
'https:clock.wp53.cn/v3/'
;
}
else
if
(
ENVIRONMENT
==
'testenv'
)
{
api
=
'https://test.wp53.cn/v2/api/'
;
dakaapi
=
'https:clock.wp53.cn/v3/'
;
...
...
@@ -75,6 +75,7 @@ export default {
studentsUnBindWx
:
`
${
dakaapi
}
member/erp/student/wechat/remove`
,
},
teachers
:
`
${
dakaapi
}
member/erp/teachers`
,
choose_teacher
:
`
${
dakaapi
}
member/erp/teacher/distribution`
,
courses
:
{
courses
:
`
${
dakaapi
}
member/erp/courses`
,
coursesBuyOrRenew
:
`
${
dakaapi
}
member/erp/course/make`
,
...
...
src/models/teachers.js
View file @
0205326f
...
...
@@ -8,6 +8,9 @@ import {
}
from
'../utils/index'
;
import
errorcode
from
'../common/errorcode'
;
import
*
as
teachersAjax
from
'../services/teachers'
;
import
*
as
courseAjax
from
'../services/course'
;
import
classmgt
from
'./classmgt'
;
import
*
as
classMgtAjax
from
'../services/classmgt'
;
export
default
{
namespace
:
'teachers'
,
state
:
{
...
...
@@ -50,6 +53,10 @@ export default {
invitationTeacherList
:
[],
invitationTeacherTotal
:
0
,
invitationShow
:
false
,
chooseClassVisible
:
false
,
coursesList
:
[],
teacher_id
:
0
,
// 老师id
allClassList
:
[],
},
subscriptions
:
{
setup
({
dispatch
,
history
})
{
// eslint-disable-line
...
...
@@ -328,6 +335,82 @@ export default {
// message.error(teacherstatus.msg, 1);
}
},
*
checkClass
({
payload
},
{
call
,
put
,
select
})
{
const
{
courseId
}
=
payload
;
const
{
teacher_id
}
=
yield
select
(
state
=>
state
.
teachers
);
const
{
sid
}
=
yield
select
(
state
=>
state
.
webapp
);
const
classInfo
=
yield
call
(
classMgtAjax
.
getClassList
,
{
school_id
:
sid
,
page
:
1
,
perPage
:
100
,
extra
:
'teacher.course'
,
course_id
:
courseId
,
check_in_class_teacher_id
:
teacher_id
,
});
if
(
classInfo
.
code
==
200
)
{
yield
put
({
type
:
'updateState'
,
payload
:
{
sid
,
allClassList
:
classInfo
.
data
&&
classInfo
.
data
.
list
,
},
});
}
else
{
yield
put
({
type
:
'webapp/errorrequestresolve'
,
payload
:
{
data
:
classInfo
,
},
});
}
},
*
saveChooseClass
({
payload
},
{
call
,
put
,
select
})
{
const
{
value
}
=
payload
;
const
{
class_ids
,
callBack
}
=
value
;
const
{
teacher_id
,
submitting
}
=
yield
select
(
state
=>
state
.
teachers
);
const
{
sid
}
=
yield
select
(
state
=>
state
.
webapp
);
if
(
submitting
)
{
return
;
}
yield
put
({
type
:
'updateState'
,
payload
:
{
submitting
:
true
,
},
});
const
loadmessage
=
message
.
loading
(
'数据保存中...'
,
0
);
const
res
=
yield
call
(
teachersAjax
.
teachersChoose
,
{
class_ids
:
JSON
.
stringify
(
class_ids
),
teacher_id
,
});
yield
put
({
type
:
'updateState'
,
payload
:
{
submitting
:
false
,
},
});
setTimeout
(
loadmessage
);
if
(
res
.
code
===
200
)
{
yield
put
({
type
:
'updateState'
,
payload
:
{
chooseClassVisible
:
false
,
teacher_id
:
0
,
allClassList
:
[],
},
});
if
(
callBack
&&
(
typeof
callBack
==
'function'
))
{
callBack
();
}
}
else
{
yield
put
({
type
:
'webapp/errorrequestresolve'
,
payload
:
{
data
:
res
,
},
});
}
},
*
pageInit
({
payload
},
{
call
,
put
,
select
})
{
yield
put
({
type
:
'updateState'
,
...
...
@@ -371,6 +454,13 @@ export default {
invitationTeacherList
:
[],
invitationTeacherTotal
:
0
,
invitationShow
:
false
,
chooseClassVisible
:
false
,
coursesList
:
[],
teacher_id
:
0
,
allClassList
:
[],
courseList
:
[],
classIdList
:
[],
courseId
:
''
,
},
});
},
...
...
src/pages/teacher/ChooseClassModal.js
0 → 100644
View file @
0205326f
import
{
connect
}
from
'dva'
;
import
React
from
'react'
;
import
{
Icon
,
Button
,
Row
,
Col
,
Input
,
Select
,
Checkbox
,
Table
,
Modal
,
Form
,
Alert
,
message
}
from
'antd'
;
import
pageStyle
from
'./ChooseClassModal.less'
;
import
{
pageIn
}
from
'../../utils/index'
;
const
{
Option
}
=
Select
;
const
{
TextArea
}
=
Input
;
const
FormItem
=
Form
.
Item
;
const
CheckboxGroup
=
Checkbox
.
Group
;
class
ChooseClassModal
extends
React
.
Component
{
componentDidMount
()
{
// 挂载
pageIn
(
'班级管理'
);
}
componentWillUnmount
()
{
// 卸载
}
save
=
()
=>
{
const
{
form
,
save
,
}
=
this
.
props
;
form
.
validateFields
((
err
,
values
)
=>
{
if
(
!
err
)
{
const
{
class_ids
,
}
=
values
;
console
.
log
(
class_ids
,
'class_ids12222222222222'
);
save
({
class_ids
,
callBack
:
()
=>
{
form
.
resetFields
();
},
});
}
});
}
close
=
()
=>
{
const
{
form
,
close
}
=
this
.
props
;
form
.
resetFields
();
close
();
}
render
()
{
const
{
visible
,
submitting
,
courseList
,
selectChange
,
classList
,
handleCheckClass
,
form
:
{
getFieldDecorator
,
getFieldValue
},
}
=
this
.
props
;
const
formItemModalLineLayout
=
{
labelCol
:
{
xs
:
{
span
:
24
},
sm
:
{
span
:
6
},
},
wrapperCol
:
{
xs
:
{
span
:
24
},
sm
:
{
span
:
18
},
},
};
return
(
<
Modal
visible
=
{
visible
}
title
=
"选班"
okText
=
{
submitting
?
'保存中...'
:
'保存'
}
onCancel
=
{
this
.
close
}
onOk
=
{
this
.
save
}
width
=
{
570
}
heigh
=
{
432
}
confirmLoading
=
{
submitting
}
>
<
Form
labelAlign
=
"left"
>
<
FormItem
{...
formItemModalLineLayout
}
label
=
"课程"
>
{
getFieldDecorator
(
'course_id'
,
{
rules
:
[
{
required
:
true
,
message
:
'请选择课程'
,
},
],
})(
<
Select
className
=
{
pageStyle
.
selectitem
}
placeholder
=
"请选择课程"
onChange
=
{
e
=>
selectChange
(
e
)}
>
<
Option
value
=
""
>
全部课程
<
/Option
>
{
courseList
.
map
(
ele
=>
<
Option
value
=
{
ele
.
id
}
>
{
ele
.
title
}
<
/Option>
)
}
<
/Select>
,
)}
<
/FormItem
>
{
courseList
.
length
>
0
&&
<
div
className
=
{
pageStyle
.
checkwrap
}
>
<
FormItem
{...
formItemModalLineLayout
}
>
{
getFieldDecorator
(
'class_ids'
,
{
rules
:
[
{
required
:
true
,
message
:
'请选择班级'
,
},
],
})(
<
CheckboxGroup
onChange
=
{
e
=>
handleCheckClass
(
e
)}
>
{
classList
.
map
((
item
,
index
)
=>
<
div
className
=
{
pageStyle
.
listwrap
}
>
<
Checkbox
checked
=
{
item
.
teacher_in_class
}
value
=
{
item
.
id
}
>
{
item
.
title
}
<
/Checkbox></
div
>
,
)}
<
/CheckboxGroup>
,
)}
<
/FormItem
>
<
/div>
}
<
/Form
>
<
/Modal
>
);
}
}
ChooseClassModal
.
propTypes
=
{
};
const
ChooseClass
=
Form
.
create
()(
ChooseClassModal
);
export
default
ChooseClass
;
src/pages/teacher/ChooseClassModal.less
0 → 100644
View file @
0205326f
.checkwrap {
:global {
.ant-form-item-control-wrapper {
width: 100%;
max-height: 300px;
overflow-y: scroll;
}
.ant-checkbox-group {
width: 100%;
display: flex;
align-items: center;
flex-wrap: wrap;
}
}
}
.listwrap {
width: 50%;
margin-bottom: 10px;
}
src/pages/teacher/index.js
View file @
0205326f
import
{
connect
}
from
'dva'
;
import
React
from
'react'
;
import
{
Icon
,
Button
,
Row
,
Col
,
Input
,
Select
,
Modal
,
InputNumber
,
Radio
,
Table
,
Form
,
Pagination
}
from
'antd'
;
import
{
Icon
,
Button
,
Row
,
Col
,
Input
,
Select
,
Modal
,
InputNumber
,
Radio
,
Table
,
Form
,
Pagination
,
message
}
from
'antd'
;
import
pageStyle
from
'./index.less'
;
import
EditTeacher
from
'./EditTeacher'
;
import
ChooseClass
from
'./ChooseClassModal'
;
import
{
pageIn
,
hasBtnPower
}
from
'../../utils/index'
;
import
CouponAddModal
from
'../integralmanage/storesetting/CouponAddModal'
;
const
{
Option
}
=
Select
;
const
{
TextArea
}
=
Input
;
...
...
@@ -174,6 +176,68 @@ class ClassMgt extends React.Component {
},
});
}
handleChooseClass
=
(
record
)
=>
{
const
{
dispatch
}
=
this
.
props
;
dispatch
({
type
:
'teachers/updateState'
,
payload
:
{
chooseClassVisible
:
true
,
teacher_id
:
record
.
id
,
},
});
dispatch
({
type
:
'teachers/courseModelList'
,
payload
:
{
},
});
}
closeChooseClass
=
()
=>
{
const
{
dispatch
}
=
this
.
props
;
dispatch
({
type
:
'teachers/updateState'
,
payload
:
{
chooseClassVisible
:
false
,
teacher_id
:
0
,
allClassList
:
[],
courseListModal
:
[],
classIdList
:
[],
courseId
:
0
,
},
});
}
selectChangeCourse
=
(
e
)
=>
{
const
{
dispatch
}
=
this
.
props
;
dispatch
({
type
:
'teachers/checkClass'
,
payload
:
{
chooseClassVisible
:
false
,
courseId
:
e
,
},
});
}
handleCheckClass
=
(
e
)
=>
{
const
{
dispatch
}
=
this
.
props
;
console
.
log
(
e
,
'eeeeeeeeeee'
);
dispatch
({
type
:
'teachers/updateState'
,
payload
:
{
classIdList
:
e
,
},
});
}
saveChooseClass
=
(
value
)
=>
{
const
{
dispatch
}
=
this
.
props
;
// if (classIdList.length === 0) {
// message.error('请先选择班级', 1);
// return;
// }
dispatch
({
type
:
'teachers/saveChooseClass'
,
payload
:
{
value
,
},
});
}
render
()
{
const
{
teachersinfo
,
...
...
@@ -188,6 +252,9 @@ class ClassMgt extends React.Component {
invitationTeacherTotal
,
queryTeacherInvitationParams
,
invitationShow
,
chooseClassVisible
,
allClassList
,
submitting
,
}
=
this
.
props
;
const
{
getFieldDecorator
}
=
this
.
props
.
form
;
const
columns
=
[
...
...
@@ -268,6 +335,18 @@ class ClassMgt extends React.Component {
);
},
},
{
title
:
'启动状态'
,
dataIndex
:
'status'
,
key
:
'status'
,
render
:
(
text
,
record
)
=>
{
return
(
<
div
>
<
a
href
=
"javascript:;"
onClick
=
{()
=>
this
.
handleChooseClass
(
record
)}
>
选班
<
/a
>
<
/div
>
);
},
},
];
return
(
<
div
className
=
{
pageStyle
.
container
}
>
...
...
@@ -347,6 +426,16 @@ class ClassMgt extends React.Component {
editTeacherInfo
=
{
editTeacherInfo
}
editType
=
"add"
/>
<
ChooseClass
visible
=
{
chooseClassVisible
}
close
=
{
this
.
closeChooseClass
}
save
=
{
this
.
saveChooseClass
}
courseList
=
{
courseList
}
selectChange
=
{
this
.
selectChangeCourse
}
classList
=
{
allClassList
}
submitting
=
{
submitting
}
handleCheckClass
=
{
this
.
handleCheckClass
}
/
>
<
Modal
visible
=
{
invitationShow
}
title
=
{
<
span
style
=
{{
fontSize
:
'16px'
,
fontWeight
:
700
}}
>
老师加入通知
<
/span>
}
...
...
@@ -407,6 +496,10 @@ function mapStateToProps(state) {
queryTeacherInvitationParams
,
invitationTeacherTotal
,
invitationShow
,
chooseClassVisible
,
teacher_id
,
allClassList
,
submitting
,
}
=
state
.
teachers
;
const
{
courseList
,
...
...
@@ -424,6 +517,10 @@ function mapStateToProps(state) {
queryTeacherInvitationParams
,
invitationTeacherTotal
,
invitationShow
,
chooseClassVisible
,
teacher_id
,
allClassList
,
submitting
,
};
}
export
default
connect
(
mapStateToProps
)(
ForgotPassword
);
...
...
src/services/teachers.js
View file @
0205326f
...
...
@@ -16,6 +16,15 @@ export function teachersAdd(params) {
data
,
});
}
export
function
teachersChoose
(
params
)
{
const
data
=
qs
.
stringify
(
params
);
return
request
({
url
:
`
${
api
.
choose_teacher
}
`
,
method
:
'POST'
,
data
,
});
}
export
function
teachersPut
(
params
)
{
const
data
=
qs
.
stringify
(
params
);
return
request
({
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment