Commit 265ab61b authored by baixian's avatar baixian

tuisong

parent 1df4cab2
......@@ -123,9 +123,17 @@ export default {
wxVisible: false,
wxSubmitting: false,
wxConfig: {
schedule_remind_on_off: 1,
schedule_remind_student_before: 0,
schedule_remind_teacher_before: 0,
1: {
schedule_remind_on_off: 1,
schedule_remind_student_before: 0,
schedule_remind_teacher_before: 0,
},
2: {
renew_remind_on_off: 1,
renew_remind_push_type: 1,
renew_remind_student_less_than: 3,
renew_remind_teacher_less_than: 3,
},
},
},
subscriptions: {
......@@ -403,8 +411,12 @@ export default {
schedule_remind,
teacher_minutes,
parent_minutes,
type,
push_type,
renew_remind,
teacher_min_times,
parent_min_times,
callBack,
unit_type,
} = payload;
const { wxSubmitting } = yield select(state => state.classmgt);
if (wxSubmitting) {
......@@ -420,9 +432,13 @@ export default {
const data = yield call(classMgtAjax.wxConfig, {
school_id: sid,
schedule_remind,
teacher_minutes,
parent_minutes,
type,
teacher_minutes: unit_type === 2 ? teacher_minutes * 60 * 24 : teacher_minutes,
parent_minutes: unit_type === 2 ? parent_minutes * 60 * 24 : parent_minutes,
type: [1, 2].join(','),
push_type,
renew_remind,
teacher_min_times,
parent_min_times,
});
yield put({
type: 'updateState',
......@@ -455,7 +471,7 @@ export default {
const { sid } = yield select(state => state.webapp);
const data = yield call(classMgtAjax.GetWxConfig, {
school_id: sid,
type: 1,
type: [1, 2].join(','),
});
if (data.code === 200) {
yield put({
......@@ -937,9 +953,17 @@ export default {
wxVisible: false,
wxSubmitting: false,
wxConfig: {
schedule_remind_on_off: 1,
schedule_remind_student_before: 0,
schedule_remind_teacher_before: 0,
1: {
schedule_remind_on_off: 1,
schedule_remind_student_before: 0,
schedule_remind_teacher_before: 0,
},
2: {
renew_remind_on_off: 1,
renew_remind_push_type: 1,
renew_remind_student_less_than: 3,
renew_remind_teacher_less_than: 3,
},
},
},
});
......
import { connect } from 'dva';
import React from 'react';
import PropTypes from 'prop-types';
import { message, Row, Col, Input, Select, Modal, Form, InputNumber, Checkbox } from 'antd';
import { message, Row, Col, Input, Select, Modal, Form, InputNumber, Checkbox, Radio } from 'antd';
import { imagify, pageIn } from '../../utils/index';
import pageStyle from './WxPushTimeModal.less';
const FormItem = Form.Item;
......@@ -27,13 +27,21 @@ class WxPushTimeModal extends React.Component {
schedule_remind,
teacher_minutes,
parent_minutes,
type,
push_type,
renew_remind,
teacher_min_times,
parent_min_times,
unit_type,
} = values;
save({
schedule_remind: schedule_remind ? 1 : 2,
teacher_minutes,
parent_minutes,
type,
push_type,
renew_remind: renew_remind ? 1 : 2,
teacher_min_times,
parent_min_times,
unit_type,
callBack: () => {
form.resetFields();
},
......@@ -56,11 +64,11 @@ class WxPushTimeModal extends React.Component {
const formItemModalLineLayout = {
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
sm: { span: 1 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 19 },
sm: { span: 23 },
},
};
return (
......@@ -74,18 +82,114 @@ class WxPushTimeModal extends React.Component {
className="modifyclassModal"
maskClosable={false}
zIndex={110}
width={650}
>
<Form hideRequiredMark className={pageStyle.modalform} labelAlign="left">
<FormItem>
{getFieldDecorator('schedule_remind', {
valuePropName: 'checked',
initialValue: Number(wxConfig.schedule_remind_on_off) == 1,
})(<Checkbox><span className={pageStyle.tip}>微信服务推送通知</span></Checkbox>)}
initialValue: Number(wxConfig[1].schedule_remind_on_off) == 1,
})(<Checkbox><span className={pageStyle.tip}>上课提醒</span></Checkbox>)}
</FormItem>
{getFieldDecorator('type', { initialValue: 1 })(<Input type="hidden" />)}
<FormItem className={pageStyle.firstItem} {...formItemModalLineLayout} label="家长:上课前">
{getFieldDecorator('parent_minutes', {
initialValue: wxConfig.schedule_remind_student_before,
<FormItem className={pageStyle.firstItem} {...formItemModalLineLayout}>
{getFieldDecorator('unit_type', {
initialValue: '1',
})(
<Radio.Group>
<Radio value="1">以分钟为单位</Radio>
<Radio value="2">以天为单位</Radio>
</Radio.Group>,
)}
</FormItem>
{
Number(getFieldValue('unit_type')) === 1 ?
<div>
<FormItem className={pageStyle.firstItem} {...formItemModalLineLayout}>
<div className={pageStyle.formText}><span className={pageStyle.parentTip}>家长</span>上课前</div>
{getFieldDecorator('parent_minutes', {
initialValue: wxConfig[1].schedule_remind_student_before,
rules: [
{
required: true,
message: '请输入正整数',
pattern: new RegExp(/^[1-9]\d*$/, 'g'),
},
],
})(<InputNumber disabled={!getFieldValue('schedule_remind')} min={0} max={120} />)}
<span className="ant-form-text"> 分钟推送上课提醒</span>
</FormItem>
<FormItem className={pageStyle.firstItem} {...formItemModalLineLayout}>
<div className={pageStyle.formText}><span className={pageStyle.teacherTip}>老师</span>上课前</div>
{getFieldDecorator('teacher_minutes', {
initialValue: wxConfig[1].schedule_remind_teacher_before,
rules: [
{
required: true,
message: '请输入正整数',
pattern: new RegExp(/^[1-9]\d*$/, 'g'),
},
],
})(<InputNumber disabled={!getFieldValue('schedule_remind')} min={0} max={120} />)}
<span className="ant-form-text"> 分钟推送上课提醒</span>
</FormItem>
</div> :
<div>
<FormItem className={pageStyle.firstItem} {...formItemModalLineLayout}>
<div className={pageStyle.formText}><span className={pageStyle.parentTip}>家长</span>上课前</div>
{getFieldDecorator('parent_minutes', {
initialValue: (wxConfig[1].schedule_remind_student_before / 60 / 24) > 1 ? (wxConfig[1].schedule_remind_student_before / 60 / 24) : 1,
rules: [
{
required: true,
message: '请输入正整数',
pattern: new RegExp(/^[1-9]\d*$/, 'g'),
},
],
})(<InputNumber disabled={!getFieldValue('schedule_remind')} min={1} max={2} />)}
<span className="ant-form-text"> 天推送上课提醒</span>
</FormItem>
<FormItem className={pageStyle.firstItem} {...formItemModalLineLayout}>
<div className={pageStyle.formText}><span className={pageStyle.teacherTip}>老师</span>上课前</div>
{getFieldDecorator('teacher_minutes', {
initialValue: (wxConfig[1].schedule_remind_teacher_before / 60 / 24) > 1 ? (wxConfig[1].schedule_remind_teacher_before / 60 / 24) : 1,
rules: [
{
required: true,
message: '请输入正整数',
pattern: new RegExp(/^[1-9]\d*$/, 'g'),
},
],
})(<InputNumber disabled={!getFieldValue('schedule_remind')} min={1} max={2} />)}
<span className="ant-form-text">天推送上课提醒</span>
</FormItem>
</div>
}
<FormItem>
{getFieldDecorator('renew_remind', {
valuePropName: 'checked',
initialValue: Number(wxConfig[2].renew_remind_on_off) == 1,
})(<Checkbox><span className={pageStyle.tip}>续费通知</span></Checkbox>)}
</FormItem>
<FormItem className={pageStyle.firstItem} {...formItemModalLineLayout}>
{getFieldDecorator('push_type', {
initialValue: `${wxConfig[2].renew_remind_push_type}`,
rules: [
{
required: true,
message: '请输入正整数',
},
],
})(
<Radio.Group disabled={!getFieldValue('renew_remind')}>
<Radio value="1">只推送一次</Radio>
<Radio value="2">每日推送</Radio>
</Radio.Group>,
)}
</FormItem>
<FormItem className={pageStyle.firstItem} {...formItemModalLineLayout}>
<div className={pageStyle.formText}><span className={pageStyle.parentTip}>家长</span>课时数小于</div>
{getFieldDecorator('parent_min_times', {
initialValue: wxConfig[2].renew_remind_student_less_than,
rules: [
{
required: true,
......@@ -93,12 +197,13 @@ class WxPushTimeModal extends React.Component {
pattern: new RegExp(/^[1-9]\d*$/, 'g'),
},
],
})(<InputNumber disabled={!getFieldValue('schedule_remind')} min={0} max={120} />)}
<span className="ant-form-text"> 分钟推送上课提醒</span>
})(<InputNumber disabled={!getFieldValue('renew_remind')} min={0} />)}
<span className="ant-form-text">时,推送续费通知</span>
</FormItem>
<FormItem className={pageStyle.firstItem} {...formItemModalLineLayout} label="老师:上课前">
{getFieldDecorator('teacher_minutes', {
initialValue: wxConfig.schedule_remind_teacher_before,
<FormItem className={pageStyle.firstItem} {...formItemModalLineLayout}>
<div className={pageStyle.formText}><span className={pageStyle.teacherTip}>老师</span>课时数小于</div>
{getFieldDecorator('teacher_min_times', {
initialValue: wxConfig[2].renew_remind_teacher_less_than,
rules: [
{
required: true,
......@@ -106,8 +211,8 @@ class WxPushTimeModal extends React.Component {
pattern: new RegExp(/^[1-9]\d*$/, 'g'),
},
],
})(<InputNumber disabled={!getFieldValue('schedule_remind')} min={0} max={120} />)}
<span className="ant-form-text"> 分钟推送上课提醒</span>
})(<InputNumber disabled={!getFieldValue('renew_remind')} min={0} />)}
<span className="ant-form-text">时,推送续费通知</span>
</FormItem>
</Form>
</Modal>
......
......@@ -14,6 +14,44 @@
.ant-form-item-label > label::after {
content: '';
}
.ant-form-item {
margin-bottom: 10px;
}
}
.formText {
display: inline-block;
font-size: 14px;
font-weight:400;
color:rgba(76,76,76,1);
margin-right: 9px;
.parentTip {
display: inline-block;
width: 37px;
height: 21px;
border: 1px solid #02B5FF;
font-size: 12px;
color: #02B5FF;
line-height: 21px;
text-align: center;
border-radius: 4px;
margin-right: 18px;
}
.teacherTip {
display: inline-block;
width: 37px;
height: 21px;
border: 1px solid #FF9D02;
font-size: 12px;
color: #FF9D02;
line-height: 21px;
text-align: center;
border-radius: 4px;
margin-right: 18px;
background:rgba(255,157,2,0.05);
}
}
.formRadio {
display: inline-block;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment