Commit bf2809d3 authored by baixian's avatar baixian

tuisong1

parent 265ab61b
...@@ -12,11 +12,11 @@ ...@@ -12,11 +12,11 @@
<![endif]--> <![endif]-->
<script charset="utf-8" src="https://map.qq.com/api/js?v=2.exp&key=XSZBZ-5LHCV-5I2P7-UQHPW-6456F-JBB3B"></script> <script charset="utf-8" src="https://map.qq.com/api/js?v=2.exp&key=XSZBZ-5LHCV-5I2P7-UQHPW-6456F-JBB3B"></script>
<script src="https://cdn.img.shangjiadao.cn/qingxiao/biz/js/console-polyfill.js?20191012222" charset="utf-8"></script><script src="https://cdn.img.shangjiadao.cn/qingxiao/biz/js/es6-shim.min.js?20191012222" charset="utf-8"></script><script src="https://cdn.img.shangjiadao.cn/qingxiao/biz/js/es5-shim.js?20191012222" charset="utf-8"></script><script src="https://cdn.img.shangjiadao.cn/qingxiao/biz/js/es5-sham.min.js?20191012222" charset="utf-8"></script><script src="https://cdn.img.shangjiadao.cn/qingxiao/biz/js/json3.min.js?20191012222" charset="utf-8"></script><script src="https://cdn.img.shangjiadao.cn/qingxiao/biz/js/html5shiv.min.js?20191012222" charset="utf-8"></script><script src="https://cdn.img.shangjiadao.cn/qingxiao/biz/js/polyfill.js?20191012222" charset="utf-8"></script><script src="https://cdn.img.shangjiadao.cn/qingxiao/biz/lib/vendor.dll.js?20191012222" charset="utf-8"></script> <script src="js/console-polyfill.js?20191012222" charset="utf-8"></script><script src="js/es6-shim.min.js?20191012222" charset="utf-8"></script><script src="js/es5-shim.js?20191012222" charset="utf-8"></script><script src="js/es5-sham.min.js?20191012222" charset="utf-8"></script><script src="js/json3.min.js?20191012222" charset="utf-8"></script><script src="js/html5shiv.min.js?20191012222" charset="utf-8"></script><script src="js/polyfill.js?20191012222" charset="utf-8"></script><script src="lib/vendor.dll.js?20191012222" charset="utf-8"></script>
</head> </head>
</head> </head>
<body> <body>
<div id="root"></div> <div id="root"></div>
<script src="https://cdn.img.shangjiadao.cn/qingxiao/biz/dist/main.js?1572591383487" charset="utf-8"></script> <script src="dist/main.js?1573024267747" charset="utf-8"></script>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -125,8 +125,9 @@ export default { ...@@ -125,8 +125,9 @@ export default {
wxConfig: { wxConfig: {
1: { 1: {
schedule_remind_on_off: 1, schedule_remind_on_off: 1,
schedule_remind_student_before: 0, schedule_remind_student_before: 60,
schedule_remind_teacher_before: 0, schedule_remind_teacher_before: 120,
schedule_remind_unit_of_time: 1,
}, },
2: { 2: {
renew_remind_on_off: 1, renew_remind_on_off: 1,
...@@ -135,6 +136,7 @@ export default { ...@@ -135,6 +136,7 @@ export default {
renew_remind_teacher_less_than: 3, renew_remind_teacher_less_than: 3,
}, },
}, },
wxTimeKey: 1,
}, },
subscriptions: { subscriptions: {
setup({ dispatch, history }) { // eslint-disable-line setup({ dispatch, history }) { // eslint-disable-line
...@@ -416,9 +418,11 @@ export default { ...@@ -416,9 +418,11 @@ export default {
teacher_min_times, teacher_min_times,
parent_min_times, parent_min_times,
callBack, callBack,
unit_type, schedule_remind_unit_of_time,
teacher_day,
parent_day,
} = payload; } = payload;
const { wxSubmitting } = yield select(state => state.classmgt); const { wxSubmitting, wxTimeKey } = yield select(state => state.classmgt);
if (wxSubmitting) { if (wxSubmitting) {
return; return;
} }
...@@ -432,13 +436,14 @@ export default { ...@@ -432,13 +436,14 @@ export default {
const data = yield call(classMgtAjax.wxConfig, { const data = yield call(classMgtAjax.wxConfig, {
school_id: sid, school_id: sid,
schedule_remind, schedule_remind,
teacher_minutes: unit_type === 2 ? teacher_minutes * 60 * 24 : teacher_minutes, teacher_minutes: Number(wxTimeKey) === 2 ? teacher_day * 60 * 24 : teacher_minutes,
parent_minutes: unit_type === 2 ? parent_minutes * 60 * 24 : parent_minutes, parent_minutes: Number(wxTimeKey) === 2 ? parent_day * 60 * 24 : parent_minutes,
type: [1, 2].join(','), type: [1, 2].join(','),
push_type, push_type,
renew_remind, renew_remind,
teacher_min_times, teacher_min_times,
parent_min_times, parent_min_times,
schedule_remind_unit_of_time: wxTimeKey,
}); });
yield put({ yield put({
type: 'updateState', type: 'updateState',
...@@ -478,6 +483,7 @@ export default { ...@@ -478,6 +483,7 @@ export default {
type: 'updateState', type: 'updateState',
payload: { payload: {
wxConfig: data.data, wxConfig: data.data,
wxTimeKey: data.data[1].schedule_remind_unit_of_time,
}, },
}); });
} else { } else {
...@@ -489,6 +495,15 @@ export default { ...@@ -489,6 +495,15 @@ export default {
}); });
} }
}, },
* updateWxTimeKey({ payload }, { call, put, select }) {
const { timeKey } = payload;
yield put({
type: 'updateState',
payload: {
wxTimeKey: timeKey,
},
});
},
* goback({ payload }, { call, put, select }) { * goback({ payload }, { call, put, select }) {
yield put(routerRedux.goBack()); yield put(routerRedux.goBack());
}, },
...@@ -952,11 +967,13 @@ export default { ...@@ -952,11 +967,13 @@ export default {
statusChangeSubmitting: false, statusChangeSubmitting: false,
wxVisible: false, wxVisible: false,
wxSubmitting: false, wxSubmitting: false,
wxTimeKey: 1,
wxConfig: { wxConfig: {
1: { 1: {
schedule_remind_on_off: 1, schedule_remind_on_off: 1,
schedule_remind_student_before: 0, schedule_remind_student_before: 60,
schedule_remind_teacher_before: 0, schedule_remind_teacher_before: 120,
schedule_remind_unit_of_time: 1,
}, },
2: { 2: {
renew_remind_on_off: 1, renew_remind_on_off: 1,
......
import { connect } from 'dva'; import { connect } from 'dva';
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { message, Row, Col, Input, Select, Modal, Form, InputNumber, Checkbox, Radio } from 'antd'; import { message, Row, Col, Input, Select, Modal, Form, InputNumber, Checkbox, Radio, Tabs } from 'antd';
import { imagify, pageIn } from '../../utils/index'; import { imagify, pageIn } from '../../utils/index';
import pageStyle from './WxPushTimeModal.less'; import pageStyle from './WxPushTimeModal.less';
const FormItem = Form.Item; const FormItem = Form.Item;
const { TabPane } = Tabs;
class WxPushTimeModal extends React.Component { class WxPushTimeModal extends React.Component {
componentWillMount() { componentWillMount() {
} }
...@@ -31,7 +32,8 @@ class WxPushTimeModal extends React.Component { ...@@ -31,7 +32,8 @@ class WxPushTimeModal extends React.Component {
renew_remind, renew_remind,
teacher_min_times, teacher_min_times,
parent_min_times, parent_min_times,
unit_type, teacher_day,
parent_day,
} = values; } = values;
save({ save({
schedule_remind: schedule_remind ? 1 : 2, schedule_remind: schedule_remind ? 1 : 2,
...@@ -41,7 +43,8 @@ class WxPushTimeModal extends React.Component { ...@@ -41,7 +43,8 @@ class WxPushTimeModal extends React.Component {
renew_remind: renew_remind ? 1 : 2, renew_remind: renew_remind ? 1 : 2,
teacher_min_times, teacher_min_times,
parent_min_times, parent_min_times,
unit_type, teacher_day,
parent_day,
callBack: () => { callBack: () => {
form.resetFields(); form.resetFields();
}, },
...@@ -54,12 +57,20 @@ class WxPushTimeModal extends React.Component { ...@@ -54,12 +57,20 @@ class WxPushTimeModal extends React.Component {
form.resetFields(); form.resetFields();
close(); close();
} }
wxSwitchTime = (key) => {
const { wxSwitchTime } = this.props;
const timeKey = Number(key);
wxSwitchTime({
timeKey,
});
}
render() { render() {
const { const {
visible, visible,
wxSubmitting, wxSubmitting,
form: { getFieldDecorator, getFieldValue }, form: { getFieldDecorator, getFieldValue },
wxConfig, wxConfig,
wxTimeKey,
} = this.props; } = this.props;
const formItemModalLineLayout = { const formItemModalLineLayout = {
labelCol: { labelCol: {
...@@ -82,7 +93,7 @@ class WxPushTimeModal extends React.Component { ...@@ -82,7 +93,7 @@ class WxPushTimeModal extends React.Component {
className="modifyclassModal" className="modifyclassModal"
maskClosable={false} maskClosable={false}
zIndex={110} zIndex={110}
width={650} width={550}
> >
<Form hideRequiredMark className={pageStyle.modalform} labelAlign="left"> <Form hideRequiredMark className={pageStyle.modalform} labelAlign="left">
<FormItem> <FormItem>
...@@ -91,23 +102,13 @@ class WxPushTimeModal extends React.Component { ...@@ -91,23 +102,13 @@ class WxPushTimeModal extends React.Component {
initialValue: Number(wxConfig[1].schedule_remind_on_off) == 1, initialValue: Number(wxConfig[1].schedule_remind_on_off) == 1,
})(<Checkbox><span className={pageStyle.tip}>上课提醒</span></Checkbox>)} })(<Checkbox><span className={pageStyle.tip}>上课提醒</span></Checkbox>)}
</FormItem> </FormItem>
<FormItem className={pageStyle.firstItem} {...formItemModalLineLayout}> <Tabs activeKey={`${wxTimeKey}`} onChange={this.wxSwitchTime}>
{getFieldDecorator('unit_type', { <TabPane tab="以分钟为单位" key="1">
initialValue: '1',
})(
<Radio.Group>
<Radio value="1">以分钟为单位</Radio>
<Radio value="2">以天为单位</Radio>
</Radio.Group>,
)}
</FormItem>
{
Number(getFieldValue('unit_type')) === 1 ?
<div> <div>
<FormItem className={pageStyle.firstItem} {...formItemModalLineLayout}> <FormItem className={pageStyle.firstItem} {...formItemModalLineLayout}>
<div className={pageStyle.formText}><span className={pageStyle.parentTip}>家长</span>上课前</div> <div className={pageStyle.formText}><span className={pageStyle.parentTip}>家长</span>上课前</div>
{getFieldDecorator('parent_minutes', { {getFieldDecorator('parent_minutes', {
initialValue: wxConfig[1].schedule_remind_student_before, initialValue: Number(wxConfig[1].schedule_remind_unit_of_time) === 1 ? wxConfig[1].schedule_remind_student_before : 60,
rules: [ rules: [
{ {
required: true, required: true,
...@@ -115,13 +116,13 @@ class WxPushTimeModal extends React.Component { ...@@ -115,13 +116,13 @@ class WxPushTimeModal extends React.Component {
pattern: new RegExp(/^[1-9]\d*$/, 'g'), pattern: new RegExp(/^[1-9]\d*$/, 'g'),
}, },
], ],
})(<InputNumber disabled={!getFieldValue('schedule_remind')} min={0} max={120} />)} })(<InputNumber disabled={!getFieldValue('schedule_remind')} min={0} max={2880} />)}
<span className="ant-form-text"> 分钟推送上课提醒</span> <span className="ant-form-text"> 分钟推送上课提醒</span>
</FormItem> </FormItem>
<FormItem className={pageStyle.firstItem} {...formItemModalLineLayout}> <FormItem className={pageStyle.firstItem} {...formItemModalLineLayout}>
<div className={pageStyle.formText}><span className={pageStyle.teacherTip}>老师</span>上课前</div> <div className={pageStyle.formText}><span className={pageStyle.teacherTip}>老师</span>上课前</div>
{getFieldDecorator('teacher_minutes', { {getFieldDecorator('teacher_minutes', {
initialValue: wxConfig[1].schedule_remind_teacher_before, initialValue: Number(wxConfig[1].schedule_remind_unit_of_time) === 1 ? wxConfig[1].schedule_remind_teacher_before : 120,
rules: [ rules: [
{ {
required: true, required: true,
...@@ -129,14 +130,16 @@ class WxPushTimeModal extends React.Component { ...@@ -129,14 +130,16 @@ class WxPushTimeModal extends React.Component {
pattern: new RegExp(/^[1-9]\d*$/, 'g'), pattern: new RegExp(/^[1-9]\d*$/, 'g'),
}, },
], ],
})(<InputNumber disabled={!getFieldValue('schedule_remind')} min={0} max={120} />)} })(<InputNumber disabled={!getFieldValue('schedule_remind')} min={0} max={2880} />)}
<span className="ant-form-text"> 分钟推送上课提醒</span> <span className="ant-form-text"> 分钟推送上课提醒</span>
</FormItem> </FormItem>
</div> : </div>
</TabPane>
<TabPane tab="以天为单位" key="2">
<div> <div>
<FormItem className={pageStyle.firstItem} {...formItemModalLineLayout}> <FormItem className={pageStyle.firstItem} {...formItemModalLineLayout}>
<div className={pageStyle.formText}><span className={pageStyle.parentTip}>家长</span>上课前</div> <div className={pageStyle.formText}><span className={pageStyle.parentTip}>家长</span>上课前</div>
{getFieldDecorator('parent_minutes', { {getFieldDecorator('parent_day', {
initialValue: (wxConfig[1].schedule_remind_student_before / 60 / 24) > 1 ? (wxConfig[1].schedule_remind_student_before / 60 / 24) : 1, initialValue: (wxConfig[1].schedule_remind_student_before / 60 / 24) > 1 ? (wxConfig[1].schedule_remind_student_before / 60 / 24) : 1,
rules: [ rules: [
{ {
...@@ -150,7 +153,7 @@ class WxPushTimeModal extends React.Component { ...@@ -150,7 +153,7 @@ class WxPushTimeModal extends React.Component {
</FormItem> </FormItem>
<FormItem className={pageStyle.firstItem} {...formItemModalLineLayout}> <FormItem className={pageStyle.firstItem} {...formItemModalLineLayout}>
<div className={pageStyle.formText}><span className={pageStyle.teacherTip}>老师</span>上课前</div> <div className={pageStyle.formText}><span className={pageStyle.teacherTip}>老师</span>上课前</div>
{getFieldDecorator('teacher_minutes', { {getFieldDecorator('teacher_day', {
initialValue: (wxConfig[1].schedule_remind_teacher_before / 60 / 24) > 1 ? (wxConfig[1].schedule_remind_teacher_before / 60 / 24) : 1, initialValue: (wxConfig[1].schedule_remind_teacher_before / 60 / 24) > 1 ? (wxConfig[1].schedule_remind_teacher_before / 60 / 24) : 1,
rules: [ rules: [
{ {
...@@ -163,7 +166,8 @@ class WxPushTimeModal extends React.Component { ...@@ -163,7 +166,8 @@ class WxPushTimeModal extends React.Component {
<span className="ant-form-text">天推送上课提醒</span> <span className="ant-form-text">天推送上课提醒</span>
</FormItem> </FormItem>
</div> </div>
} </TabPane>
</Tabs>
<FormItem> <FormItem>
{getFieldDecorator('renew_remind', { {getFieldDecorator('renew_remind', {
valuePropName: 'checked', valuePropName: 'checked',
...@@ -187,7 +191,7 @@ class WxPushTimeModal extends React.Component { ...@@ -187,7 +191,7 @@ class WxPushTimeModal extends React.Component {
)} )}
</FormItem> </FormItem>
<FormItem className={pageStyle.firstItem} {...formItemModalLineLayout}> <FormItem className={pageStyle.firstItem} {...formItemModalLineLayout}>
<div className={pageStyle.formText}><span className={pageStyle.parentTip}>家长</span>课时数小于</div> <div className={pageStyle.formText}><span className={pageStyle.parentTip}>家长</span>课时数小于等于</div>
{getFieldDecorator('parent_min_times', { {getFieldDecorator('parent_min_times', {
initialValue: wxConfig[2].renew_remind_student_less_than, initialValue: wxConfig[2].renew_remind_student_less_than,
rules: [ rules: [
...@@ -197,11 +201,11 @@ class WxPushTimeModal extends React.Component { ...@@ -197,11 +201,11 @@ class WxPushTimeModal extends React.Component {
pattern: new RegExp(/^[1-9]\d*$/, 'g'), pattern: new RegExp(/^[1-9]\d*$/, 'g'),
}, },
], ],
})(<InputNumber disabled={!getFieldValue('renew_remind')} min={0} />)} })(<InputNumber disabled={!getFieldValue('renew_remind')} min={0} max={99} />)}
<span className="ant-form-text">时,推送续费通知</span> <span className="ant-form-text">时,推送续费通知</span>
</FormItem> </FormItem>
<FormItem className={pageStyle.firstItem} {...formItemModalLineLayout}> <FormItem className={pageStyle.firstItem} {...formItemModalLineLayout}>
<div className={pageStyle.formText}><span className={pageStyle.teacherTip}>老师</span>课时数小于</div> <div className={pageStyle.formText}><span className={pageStyle.teacherTip}>老师</span>课时数小于等于</div>
{getFieldDecorator('teacher_min_times', { {getFieldDecorator('teacher_min_times', {
initialValue: wxConfig[2].renew_remind_teacher_less_than, initialValue: wxConfig[2].renew_remind_teacher_less_than,
rules: [ rules: [
...@@ -211,7 +215,7 @@ class WxPushTimeModal extends React.Component { ...@@ -211,7 +215,7 @@ class WxPushTimeModal extends React.Component {
pattern: new RegExp(/^[1-9]\d*$/, 'g'), pattern: new RegExp(/^[1-9]\d*$/, 'g'),
}, },
], ],
})(<InputNumber disabled={!getFieldValue('renew_remind')} min={0} />)} })(<InputNumber disabled={!getFieldValue('renew_remind')} min={0} max={99} />)}
<span className="ant-form-text">时,推送续费通知</span> <span className="ant-form-text">时,推送续费通知</span>
</FormItem> </FormItem>
</Form> </Form>
......
...@@ -15,7 +15,13 @@ ...@@ -15,7 +15,13 @@
content: ''; content: '';
} }
.ant-form-item { .ant-form-item {
margin-bottom: 10px; margin-bottom: 5px;
}
.ant-tabs-nav-wrap {
margin-left: 20px;
}
.ant-tabs-bar {
border-bottom: none;
} }
} }
.formText { .formText {
......
...@@ -438,6 +438,13 @@ class ClassMgtForm extends React.Component { ...@@ -438,6 +438,13 @@ class ClassMgtForm extends React.Component {
payload: value, payload: value,
}); });
} }
wxSwitchTime = (timeKey) => {
const { dispatch } = this.props;
dispatch({
type: 'classmgt/updateWxTimeKey',
payload: timeKey,
});
}
render() { render() {
const { getFieldDecorator } = this.props.form; const { getFieldDecorator } = this.props.form;
const { const {
...@@ -462,6 +469,7 @@ class ClassMgtForm extends React.Component { ...@@ -462,6 +469,7 @@ class ClassMgtForm extends React.Component {
wxVisible, wxVisible,
wxSubmitting, wxSubmitting,
wxConfig, wxConfig,
wxTimeKey,
} = this.props; } = this.props;
const visible = false; const visible = false;
const columns = [ const columns = [
...@@ -712,6 +720,8 @@ class ClassMgtForm extends React.Component { ...@@ -712,6 +720,8 @@ class ClassMgtForm extends React.Component {
save={this.handleSaveWx} save={this.handleSaveWx}
wxSubmitting={wxSubmitting} wxSubmitting={wxSubmitting}
wxConfig={wxConfig} wxConfig={wxConfig}
wxSwitchTime={this.wxSwitchTime}
wxTimeKey={wxTimeKey}
/> />
</div> </div>
); );
...@@ -751,6 +761,7 @@ function mapStateToProps(state) { ...@@ -751,6 +761,7 @@ function mapStateToProps(state) {
wxVisible, wxVisible,
wxSubmitting, wxSubmitting,
wxConfig, wxConfig,
wxTimeKey,
} = state.classmgt; } = state.classmgt;
return { return {
classList, classList,
...@@ -780,6 +791,7 @@ function mapStateToProps(state) { ...@@ -780,6 +791,7 @@ function mapStateToProps(state) {
wxVisible, wxVisible,
wxSubmitting, wxSubmitting,
wxConfig, wxConfig,
wxTimeKey,
}; };
} }
export default connect(mapStateToProps)(ClassMgt); export default connect(mapStateToProps)(ClassMgt);
......
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