Commit b5bf2d9e authored by baixian's avatar baixian

优化

parent 040daad7
......@@ -284,6 +284,7 @@ class classRoomMgt extends React.Component {
xs: { span: 24 },
sm: { span: 14 },
}}
extra="排课周期最长一年有效"
>
{getFieldDecorator('end_date', {
rules: [{ required: true, message: '结束时间不能为空' }],
......
......@@ -14,6 +14,27 @@ class qrcodeShow extends React.Component {
}
componentWillUnmount() { // 卸载
}
download = () => {
const { previewQrcode, downloadTitle } = this.props;
const url = previewQrcode;
const name = `${downloadTitle}主题码`;
const image = new Image();
image.setAttribute('crossOrigin', 'anonymous');
image.onload = () => {
const canvas = document.createElement('canvas');
canvas.width = image.width;
canvas.height = image.height;
const context = canvas.getContext('2d');
context.drawImage(image, 0, 0, image.width, image.height);
const url = canvas.toDataURL('image/png'); // 得到图片的base64编码数据
const a = document.createElement('a'); // 生成一个a元素
const event = new MouseEvent('click'); // 创建一个单击事件
a.download = name || 'photo'; // 设置图片名称
a.href = url; // 将生成的URL设置为a.href属性
a.dispatchEvent(event); // 触发a的单击事件
};
image.src = imagify(url);
}
render() {
const {
......@@ -21,6 +42,7 @@ class qrcodeShow extends React.Component {
previewQrcode,
closeQrcodeShow,
title,
hrefType,
} = this.props;
return (
<div className={pageStyle.container} style={{ display: previewQrcodeShow ? 'flex' : 'none' }}>
......@@ -32,6 +54,9 @@ class qrcodeShow extends React.Component {
</div>
<div className={pageStyle.qrCode}>
<img className={pageStyle.qrCodeImage} src={imagify(previewQrcode)} alt="" />
{
hrefType && hrefType === 1 && <div className={pageStyle.download} onClick={this.download}>保存图片至桌面</div>
}
</div>
</div>
</div>
......
......@@ -26,7 +26,7 @@
background-color: rgba(0,0,0,0.5);
}
.qrcodeBox {
height: 320px;
min-height: 320px;
border-radius: 10px;
background-color: #fff;
position: relative;
......@@ -72,3 +72,10 @@
display: block;
margin: -10px auto 0;
}
.download {
font-size: 16px;
color: #1890FF;
text-align: center;
padding: 20px 0;
cursor: pointer;
}
......@@ -470,17 +470,18 @@ export default {
const {
callStudentOperateList, rule_leave, rule_absent, expend, classDetail,
} = yield select(state => state.callstudents);
console.log(expend, 'expend');
const { value, index } = payload;
if (value == 1 || value == 2) {
callStudentOperateList[index].expend = expend;
}
if (rule_leave == 1 && value == 3) { // 选中请假 并且请假扣课时
callStudentOperateList[index].expend = 1;
callStudentOperateList[index].expend = expend;
} else if (rule_leave == 2 && value == 3) {
callStudentOperateList[index].expend = 0;
}
if (rule_absent == 1 && value == 4) { // 选中旷课 并且旷课扣课时
callStudentOperateList[index].expend = 1;
callStudentOperateList[index].expend = expend;
} else if (rule_leave == 2 && value == 3) {
callStudentOperateList[index].expend = 0;
}
......
......@@ -382,7 +382,7 @@ export default {
classSubmitting: true,
},
});
const { values, form } = payload;
const { values, form, type } = payload;
const loading = message.loading('数据保存中...', 0);
const classAddDate = yield call(classMgtAjax.classAdd, Object.assign(values, {
school_id: sid,
......@@ -417,6 +417,9 @@ export default {
},
},
});
if (type && type === 'indexhref') {
yield put(routerRedux.push('/sjd/classmgt'));
}
if (form) {
form.resetFields();
}
......
......@@ -137,6 +137,8 @@ export default {
mode_class,
rule_leave,
rule_absent,
callBack,
type,
} = payload;
const loadmessage = message.loading('课程保存中...', 0);
const postFunction = editCourseInfo.id != 0 ? courseAjax.coursePut : courseAjax.courseAdd;
......@@ -157,9 +159,15 @@ export default {
});
setTimeout(loadmessage);
if (data.code == 200) {
if (callBack && (typeof callBack) == 'function') {
callBack();
}
yield put({
type: 'courseModelList',
});
if (type && type === 'indexhref') {
yield put(routerRedux.push('/sjd/course'));
}
yield put({
type: 'updateState',
payload: {
......@@ -167,7 +175,7 @@ export default {
editCourseInfo: {
id: 0,
school_id: 0,
title: '222',
title: '',
color: 1,
mode_time: 1,
mode_interval: 1,
......
......@@ -18,6 +18,7 @@ import * as classMgtAjax from '../services/classmgt';
import * as uploader from '../services/uploader';
import { calendar } from '../utils/calendar';
import * as goodsAjax from '../services/integral';
import * as commonAjax from '../services/common';
export default {
namespace: 'createtheme',
state: {
......@@ -372,14 +373,37 @@ export default {
if (callBack && (typeof callBack == 'function')) {
callBack();
}
console.log(data, 'daddddd');
if ((newParams.id != undefined) && newParams.id !== 0) {
yield delay(500);
yield put(routerRedux.goBack());
yield put({
type: 'thememgt/getCode',
payload: {
record: {
class_id: data.data.class_id,
id: data.data.id,
title: data.data.title,
subject_type: Number(data.data.subject_type),
},
},
});
} else {
yield delay(500);
yield put(routerRedux.push({
pathname: `/sjd/thememgt/${class_id}`,
}));
yield put({
type: 'thememgt/getCode',
payload: {
record: {
class_id: data.data.class_id,
id: data.data.id,
title: data.data.title,
subject_type: Number(data.data.subject_type),
},
},
});
}
} else {
yield put({
......
......@@ -5,6 +5,7 @@ import { delay } from 'redux-saga';
import * as thememgtajax from '../services/thememgt';
import errorcode from '../common/errorcode';
import * as themeAjax from '../services/createtheme';
import * as commonAjax from '../services/common';
export default {
namespace: 'thememgt',
state: {
......@@ -93,6 +94,53 @@ export default {
pathname: `/sjd/clockmgt/${payload.subject_type}/${classId}/${payload.subject_id}`,
}));
},
* getCode({ payload }, { call, put, select }) {
const { record } = payload;
console.log(record, 'record');
const loading = message.loading('小程序码生成中,请稍等...', 0);
let params;
switch (record.subject_type) {
case 1:
params = {
scene: `i=${record.class_id}&t=${record.id}&w=${record.school_id}`,
page: 'src/pages/themeindex/index',
width: 430,
};
break;
case 2:
params = {
scene: `i=${record.class_id}&t=${record.id}&w=${record.school_id}`,
page: 'src/pages/calendarthemeindex/index',
width: 430,
};
break;
case 3:
params = {
scene: `i=${record.class_id}&t=${record.id}`,
page: 'src/pages/morethemeindex/index',
width: 430,
};
break;
default:
params = {};
break;
}
const data = yield call(commonAjax.generateQrcode, params);
setTimeout(loading);
if (data.code === 200) {
message.success('小程序码生成成功', 1);
yield put({
type: 'updateState',
payload: {
previewQrcode: data.data.url,
previewQrcodeShow: true,
downloadTitle: record.title,
},
});
} else {
message.error('小程序码生成失败', 1);
}
},
* subjecttypechange({ payload }, { call, put, select }) {
const { subjectType } = payload;
yield put({
......
......@@ -7,7 +7,7 @@
transition: all 0.2s;
// overflow: auto;
// min-width: 900px;
}
.collapsedcontent {
margin-left: 220px;
......@@ -27,7 +27,7 @@
:global {
.mainDom {
.ant-layout {
overflow-x: initial!important;
//overflow-x: initial!important;
}
}
}
......
......@@ -204,6 +204,7 @@ class EditClassModal extends React.Component {
xs: { span: 24 },
sm: { span: 19 },
}}
extra="设置后班级排课达到上课次数后,将自动结业,请酌情考虑。"
>
<Row gutter={8}>
<Col span={19}>
......
......@@ -204,7 +204,7 @@ class WxPushTimeModal extends React.Component {
})(<InputNumber disabled={!getFieldValue('renew_remind')} min={0} max={99} />)}
<span className="ant-form-text">(),推送续费通知</span>
</FormItem>
<FormItem className={pageStyle.firstItem} {...formItemModalLineLayout}>
<FormItem className={pageStyle.firstItem} {...formItemModalLineLayout} extra="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;设置后将同步首页续费提醒课时数 ">
<div className={pageStyle.formText}><span className={pageStyle.teacherTip}>老师</span>课时数小于等于</div>
{getFieldDecorator('teacher_min_times', {
initialValue: wxConfig[2].renew_remind_teacher_less_than,
......
import { connect } from 'dva';
import React from 'react';
import { Icon, Button, message, Row, Col, Input, Select, Checkbox, Table, Modal, Form, Radio, RadioGroup, Alert } from 'antd';
import pageStyle from './index.less';
import { pageIn, hasBtnPower } from '../../utils/index';
const { Option } = Select;
const { TextArea } = Input;
class AddCourseModalForm extends React.Component {
state = {
textLength: 0,
}
componentDidMount() { // 挂载
pageIn('课程管理');
}
componentWillUnmount() { // 卸载
}
close=() => {
const { close, form } = this.props;
this.setState({
textLength: 0,
});
form.resetFields();
close();
}
titleChange = (e) => {
const { editCourseInfo } = this.props;
this.setState({
textLength: e.target.value.length - editCourseInfo.title.length,
});
}
save = (e) => {
const { dispatch, save, form } = this.props;
e.preventDefault();
this.props.form.validateFields((err, values) => {
if (!err) {
const {
title,
mode_time,
mode_interval,
mode_class,
rule_leave,
rule_absent,
} = values;
if (mode_time == false && mode_interval == false && mode_class == false) {
message.warn('请选择至少一个课程规则', 1);
return;
}
save({
title,
mode_time: mode_time ? 1 : 2,
mode_interval: mode_interval ? 1 : 2,
mode_class: mode_class ? 1 : 2,
rule_leave,
rule_absent,
callBack: () => {
this.setState({
textLength: 0,
});
form.resetFields();
},
});
}
});
}
chooseColor = (color) => {
const { chooseColor } = this.props;
chooseColor({
color,
});
}
render() {
const { getFieldDecorator } = this.props.form;
const {
editCourseInfo,
visible,
courseSubmiting,
colorList,
isEdit,
} = this.props;
const { textLength } = this.state;
const { title } = editCourseInfo;
const selectBefore = (
<div>{title.length + textLength}/20</div>
);
return (
<Modal
visible={visible}
title={isEdit ? '编辑课程' : '新增课程'}
okText="确定"
onCancel={this.close}
onOk={this.save}
confirmLoading={courseSubmiting}
centered
width={586}
destroyOnClose
>
<Form labelAlign="left">
<Form.Item
label="课程名称"
labelCol={{
xs: { span: 24 },
sm: { span: 4 },
}}
wrapperCol={{
xs: { span: 24 },
sm: { span: 20 },
}}
>
{getFieldDecorator('title', {
initialValue: editCourseInfo.title,
rules: [
{
required: true,
message: '请输入课程名称',
},
{
max: 20,
message: '课程名称最多20个字符',
},
],
})(<Input style={{ width: 200 }} onChange={e => this.titleChange(e)} addonAfter={selectBefore} maxLength={20} placeholder="输入课程名称" />)}
</Form.Item>
<Form.Item
label={<span>&nbsp;&nbsp;课表颜色</span>}
labelCol={{
xs: { span: 24 },
sm: { span: 4 },
}}
wrapperCol={{
xs: { span: 24 },
sm: { span: 20 },
}}
>
{getFieldDecorator('color', {
})(
<div className={pageStyle.colorCircleLine}>
{
colorList.map(item => (
<div key={item.color} className={`${pageStyle.colorCircleBox} ${editCourseInfo.color == item.value ? pageStyle.colorCircleBoxSelect : ''}`} onClick={() => this.chooseColor(item)}>
<div className={pageStyle.colorCircle} style={{ backgroundColor: item.color }}></div>
</div>
))}
</div>,
)}
</Form.Item>
<Row>
<Col xs={{ span: 24 }} sm={{ span: 4 }} style={{ height: 39, textAlign: 'left', lineHeight: '39px' }}>&nbsp;&nbsp;课程规则:</Col>
<Col xs={{ span: 24 }} sm={{ span: 20 }}>
<Row>
<Col span={6}>
<Form.Item>
{getFieldDecorator('mode_time', {
initialValue: editCourseInfo.mode_time == 1,
valuePropName: 'checked',
})(
<Checkbox>按课时</Checkbox>,
)}
</Form.Item>
</Col>
<Col span={6}>
<Form.Item>
<span style={{ paddingLeft: 45 }}></span>
{getFieldDecorator('mode_interval', {
initialValue: editCourseInfo.mode_interval == 1,
valuePropName: 'checked',
})(
<Checkbox >按时段</Checkbox>,
)}
</Form.Item>
</Col>
<Col span={6}>
<Form.Item>
<span style={{ paddingLeft: 45 }}></span>
{getFieldDecorator('mode_class', {
initialValue: editCourseInfo.mode_class == 1,
valuePropName: 'checked',
})(
<Checkbox >按班级</Checkbox>,
)}
</Form.Item>
</Col>
</Row>
</Col>
</Row>
<Form.Item
label="扣课时规则"
labelCol={{
xs: { span: 24 },
sm: { span: 4 },
}}
wrapperCol={{
xs: { span: 24 },
sm: { span: 20 },
}}
>
<span>请假是否扣课时:</span>
{getFieldDecorator('rule_leave', {
initialValue: editCourseInfo.rule_leave,
rules: [
{
required: false,
message: '请选择请假扣课时规则',
},
],
})(
<Radio.Group>
<Radio value={1}></Radio>
<Radio value={2}>不扣</Radio>
</Radio.Group>,
)}
</Form.Item>
<Form.Item
label={<span>&nbsp;</span>}
hasFeedback={false}
colon={false}
labelCol={{
xs: { span: 24 },
sm: { span: 4 },
}}
wrapperCol={{
xs: { span: 24 },
sm: { span: 20 },
}}
>
<span>旷课是否扣课时:</span>
{getFieldDecorator('rule_absent', {
initialValue: editCourseInfo.rule_absent,
rules: [
{
required: false,
message: '请选择旷课扣课时规则',
},
],
})(
<Radio.Group>
<Radio value={1}></Radio>
<Radio value={2}>不扣</Radio>
</Radio.Group>,
)}
</Form.Item>
<Row>
<Col sm={{ span: 20, offset: 4 }} xs={{ span: 24, offset: 0 }}>
<div className={pageStyle.notice}>默认扣除课时数按照每个班级设置的课次消耗扣除</div>
</Col>
</Row>
</Form>
</Modal>
);
}
}
AddCourseModalForm.propTypes = {
};
const AddCourseModal = Form.create()(AddCourseModalForm);
export default AddCourseModal;
This diff is collapsed.
This diff is collapsed.
......@@ -91,6 +91,8 @@
}
.makeitembox {
padding: 5px 24px;
display: flex;
flex-wrap: wrap;
}
.makeitem {
cursor: pointer;
......@@ -101,10 +103,14 @@
align-items: center;
justify-content: center;
color: #FFFFFF;
width: 48%;
.makeitemLeft {
display: flex;
align-items: center;
}
&:nth-child(2n+1) {
margin-right: 10px;
}
&:nth-child(1) {
background:rgba(255,184,121,1);
}
......@@ -123,6 +129,24 @@
&:nth-child(3):hover {
box-shadow:0px 0px 10px 0px #24CACC;
}
&:nth-child(4) {
background:#50C666;
}
&:nth-child(4):hover {
box-shadow:0px 0px 10px 0px #50C666;
}
&:nth-child(5) {
background:#FFB532;
}
&:nth-child(5):hover {
box-shadow:0px 0px 10px 0px #FFB532;
}
&:nth-child(6) {
background:#FF586F;
}
&:nth-child(6):hover {
box-shadow:0px 0px 10px 0px #FF586F;
}
}
.themeicon {
img {
......
......@@ -855,7 +855,7 @@ class StudentMgt extends React.Component {
let dom = null;
switch (item.source_type) {
case 1:
return <div className={pageStyle.logitem}>{item.created_at} 老师:<span className={pageStyle.logTeacherName}>{item.data.teacher_name || '-'}</span> <span className={pageStyle.logAction}>点名学员</span><span className={pageStyle.logTeacherName}>{item.data.student_name || '-'}</span> 状态: <span className={pageStyle.logAction}>{item.data.type == 1 && '到课'}{item.data.type == 3 && '请假'}{item.data.type == 2 && '迟到'}{item.data.type == 4 && '未到'}</span> {item.data.course_mode == 1 && `扣除课时${item.data.expend}课时`}</div>;
return <div className={pageStyle.logitem}>{item.created_at} 老师:<span className={pageStyle.logTeacherName}>{item.data.teacher_name || '-'}</span> <span className={pageStyle.logAction}>点名学员</span><span className={pageStyle.logTeacherName}>{item.data.student_name || '-'}</span> 状态: <span className={pageStyle.logAction}>{item.data.type == 1 && '到课'}{item.data.type == 3 && '请假'}{item.data.type == 2 && '迟到'}{item.data.type == 4 && '未到'}</span> {item.data.course_mode == 1 && `扣除课时${item.data.expend}课时`} {item.data.class_title && <span>班级:<span className={pageStyle.logTeacherName}>{item.data.class_title || '-'}</span> </span>} {item.data.course_title && <span>课程:<span className={pageStyle.logTeacherName}>{item.data.course_title || '-'}</span></span>}</div>;
case 2:
if (item.data.mode_type == 1) {
dom = <div className={pageStyle.logitem}>{item.created_at} 老师:<span className={pageStyle.logTeacherName}>{item.data.teacher_name || '-'}</span> 为学员:<span className={pageStyle.logTeacherName}>{item.data.student_name || '-'}</span> <span className={pageStyle.logAction}>购买课程</span> <span className={pageStyle.logTeacherName}>{item.data.course_title || '-'}</span> 收费模式:按课时, 购买课时:{item.data.buy || '-'}课时, 赠送课时:{item.data.give ? `${item.data.give}课时` : '-'},备注:{item.data.remark || '-'}</div>;
......@@ -887,7 +887,7 @@ class StudentMgt extends React.Component {
case 9:
return <div className={pageStyle.logitem}>{item.created_at} 老师:<span className={pageStyle.logTeacherName}>{item.data.teacher_name || '-'}</span> 为学员:<span className={pageStyle.logTeacherName}>{item.data.student_name || '-'}</span> <span className={pageStyle.logAction}>消除{item.data.course_type && Number(item.data.course_type) === 1 && '付费'}{item.data.course_type && Number(item.data.course_type) === 2 && '赠送'}课时</span>:{item.data.expend || '-'}{item.data.mode_type == 2 && '天'} (<span className={pageStyle.logTeacherName}>{item.data.course_title || '-'}</span> ){item.data.remark ? `,备注:${item.data.remark}` : ''}</div>;
case 10:
return <div className={pageStyle.logitem}>{item.created_at} 老师:<span className={pageStyle.logTeacherName}>{item.data.teacher_name || '-'}</span> <span className={pageStyle.logAction}>点名学员</span><span className={pageStyle.logTeacherName}>{item.data.student_name || '-'}</span> 状态: <span className={pageStyle.logAction}>{item.data.type == 1 && '到课'}{item.data.type == 3 && '请假'}{item.data.type == 2 && '迟到'}{item.data.type == 4 && '未到'}</span> {item.data.course_mode == 1 && `扣除课时${item.data.expend}课时`}</div>;
return <div className={pageStyle.logitem}>{item.created_at} 老师:<span className={pageStyle.logTeacherName}>{item.data.teacher_name || '-'}</span> <span className={pageStyle.logAction}>点名学员</span><span className={pageStyle.logTeacherName}>{item.data.student_name || '-'}</span> 状态: <span className={pageStyle.logAction}>{item.data.type == 1 && '到课'}{item.data.type == 3 && '请假'}{item.data.type == 2 && '迟到'}{item.data.type == 4 && '未到'}</span> {item.data.course_mode == 1 && `扣除课时${item.data.expend}课时`} {item.data.class_title && <span>班级:<span className={pageStyle.logTeacherName}>{item.data.class_title || '-'}</span> </span>} {item.data.course_title && <span>课程:<span className={pageStyle.logTeacherName}>{item.data.course_title || '-'}</span></span>}</div>;
case 11:
return <div className={pageStyle.logitem}> {item.created_at} 老师:<span className={pageStyle.logTeacherName}>{item.data.teacher_name || '-'}</span> 为学员:<span className={pageStyle.logTeacherName}>{item.data.student_name || '-'}</span>转为<span className={pageStyle.logAction}>历史在读学员</span> &nbsp;{Number(item.data.stat_time_status) === 1 ? '没有清除' : '并清除'}<span className={pageStyle.logTeacherName}>{item.data.student_name || '-'}</span>在机构中的历史课程数据</div>;
case 12:
......
......@@ -4,6 +4,7 @@ import moment from 'moment';
import { Table, Row, Col, Form, Select, DatePicker, Button, Pagination, Divider, message, Modal, Icon } from 'antd';
import pageStyle from './index.less';
import { pageIn } from '../../utils/index';
import QrcodeShow from '../../components/qrcodeShow';
const { Option } = Select;
class ThemeMgt extends React.Component {
componentDidMount() { // 挂载
......@@ -191,6 +192,24 @@ class ThemeMgt extends React.Component {
},
});
}
lookClockMgt = (record) => {
const { dispatch } = this.props;
dispatch({
type: 'thememgt/getCode',
payload: {
record,
},
});
}
closeQrcodeShow = () => {
const { dispatch } = this.props;
dispatch({
type: 'thememgt/updateState',
payload: {
previewQrcodeShow: false,
},
});
}
render() {
const {
themeTotal,
......@@ -200,6 +219,9 @@ class ThemeMgt extends React.Component {
startTime,
endTime,
endOpen,
previewQrcodeShow,
previewQrcode,
downloadTitle,
} = this.props;
const columns = [
{
......@@ -296,6 +318,8 @@ class ThemeMgt extends React.Component {
<Divider type="vertical" />
<span className="hreflink" onClick={() => this.copyClockMgt(record, 1)}>复制</span>
<Divider type="vertical" />
<span className="hreflink" onClick={() => this.lookClockMgt(record)}>扫码查看</span>
<Divider type="vertical" />
<span className="hreflink" onClick={() => this.goClockMgt(record)}>点评</span>
<Divider type="vertical" />
<span className="hreflink" onClick={() => this.deleteTheme(record)}>删除</span>
......@@ -398,6 +422,14 @@ class ThemeMgt extends React.Component {
rowKey={record => Number(record.id)}
bordered={false}
/>
<QrcodeShow
previewQrcodeShow={previewQrcodeShow}
closeQrcodeShow={this.closeQrcodeShow}
previewQrcode={previewQrcode}
title="扫码查看"
hrefType={1}
downloadTitle={downloadTitle}
/>
</div>
);
}
......@@ -415,6 +447,9 @@ function mapStateToProps(state) {
startTime,
endTime,
endOpen,
previewQrcodeShow,
previewQrcode,
downloadTitle,
} = state.thememgt;
// eslint-disable-next-line no-empty-pattern
const {} = state.createtheme;
......@@ -426,6 +461,9 @@ function mapStateToProps(state) {
startTime,
endTime,
endOpen,
previewQrcodeShow,
previewQrcode,
downloadTitle,
};
}
export default connect(mapStateToProps)(ThemeMgt);
......
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