Commit e7202770 by chenshu

feat:初始化

parent 64c4f679
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
import domtoimage from 'dom-to-image' import domtoimage from 'dom-to-image'
import { Popover } from 'antd' import { Popover } from 'antd'
import React from 'react' import React from 'react'
import $ from 'jquery';
// 时间控件优化方法 // 时间控件优化方法
window.setCorrectDate = date => { window.setCorrectDate = date => {
......
...@@ -1305,7 +1305,6 @@ input:focus { ...@@ -1305,7 +1305,6 @@ input:focus {
.ant-modal-content { .ant-modal-content {
.ant-modal-body { .ant-modal-body {
min-height: 130px; min-height: 130px;
max-height: 600px;
overflow: auto; overflow: auto;
// padding-top:0px!important; // padding-top:0px!important;
.xm-page-control { .xm-page-control {
......
...@@ -954,10 +954,10 @@ class AddOfflineCourse extends React.Component { ...@@ -954,10 +954,10 @@ class AddOfflineCourse extends React.Component {
<span className="switch-label">报名日期:</span> <span className="switch-label">报名日期:</span>
<RangePicker <RangePicker
id="course_date_picker" id="course_date_picker"
showTime={true} showTime={{ showTime: 'HH:mm' }}
allowClear={false} allowClear={false}
value={startTimeApply ? [moment(startTimeApply), moment(endTimeApply)] : null } value={startTimeApply ? [moment(startTimeApply), moment(endTimeApply)] : null }
format={"YYYY-MM-DD"} format={"YYYY-MM-DD HH:mm"}
onChange={(dates) => { this.handleChangeDates(dates) }} onChange={(dates) => { this.handleChangeDates(dates) }}
style={{ width: "calc(100% - 70px)" }} style={{ width: "calc(100% - 70px)" }}
/> />
...@@ -968,7 +968,8 @@ class AddOfflineCourse extends React.Component { ...@@ -968,7 +968,8 @@ class AddOfflineCourse extends React.Component {
value={quota} value={quota}
style={{ margin: '0 4px' }} style={{ margin: '0 4px' }}
onChange={(value) => { onChange={(value) => {
this.setState({ quota: value }) const number = (value + '').replace(/[^\d]/g, '');
this.setState({ quota: number })
}} }}
/> />
<span className="switch-label"></span> <span className="switch-label"></span>
...@@ -988,7 +989,7 @@ class AddOfflineCourse extends React.Component { ...@@ -988,7 +989,7 @@ class AddOfflineCourse extends React.Component {
style={{ display: 'inline-block' }} style={{ display: 'inline-block' }}
value={signInType} value={signInType}
onChange={(e) => { onChange={(e) => {
this.setState({ offlineCourseType: e.target.value }); this.setState({ signInType: e.target.value });
}} }}
className="mt5" className="mt5"
> >
...@@ -1006,7 +1007,8 @@ class AddOfflineCourse extends React.Component { ...@@ -1006,7 +1007,8 @@ class AddOfflineCourse extends React.Component {
value={signInTimeNum} value={signInTimeNum}
style={{ margin: '0 4px' }} style={{ margin: '0 4px' }}
onChange={(value) => { onChange={(value) => {
this.setState({ signInTimeNum: value }); const number = (value + '').replace(/[^\d]/g, '');
this.setState({ signInTimeNum: number });
}} }}
/> />
<Select <Select
...@@ -1054,10 +1056,17 @@ class AddOfflineCourse extends React.Component { ...@@ -1054,10 +1056,17 @@ class AddOfflineCourse extends React.Component {
<InputNumber <InputNumber
value={signOutStartTimeNum} value={signOutStartTimeNum}
style={{ margin: '0 4px' }} style={{ margin: '0 4px' }}
onChange={(value) => {
const number = (value + '').replace(/[^\d]/g, '');
this.setState({ signOutStartTimeNum: number });
}}
/> />
<Select <Select
style={{ width: 72, marginRight: 4 }} style={{ width: 72, marginRight: 4 }}
value={signOutStartTimeUnit} value={signOutStartTimeUnit}
onChange={(value) => {
this.setState({ signOutStartTimeUnit: value });
}}
> >
{unitList.map(item => ( {unitList.map(item => (
<Option value={item.key} key={item.key}>{item.value}</Option> <Option value={item.key} key={item.key}>{item.value}</Option>
...@@ -1067,10 +1076,17 @@ class AddOfflineCourse extends React.Component { ...@@ -1067,10 +1076,17 @@ class AddOfflineCourse extends React.Component {
<InputNumber <InputNumber
value={signOutEndTimeNum} value={signOutEndTimeNum}
style={{ margin: '0 4px' }} style={{ margin: '0 4px' }}
onChange={(value) => {
const number = (value + '').replace(/[^\d]/g, '');
this.setState({ signOutEndTimeNum: number });
}}
/> />
<Select <Select
style={{ width: 72, marginRight: 4 }} style={{ width: 72, marginRight: 4 }}
value={signOutEndTimeUnit} value={signOutEndTimeUnit}
onChange={(value) => {
this.setState({ signOutEndTimeUnit: value });
}}
> >
{unitList.map(item => ( {unitList.map(item => (
<Option value={item.key} key={item.key}>{item.value}</Option> <Option value={item.key} key={item.key}>{item.value}</Option>
......
...@@ -69,6 +69,7 @@ class OfflineCourseList extends React.Component { ...@@ -69,6 +69,7 @@ class OfflineCourseList extends React.Component {
render: (val, record) => { render: (val, record) => {
const { courseMediaVOS, courseName, offlinePlace, calendarTime, startTime, endTime } = record; const { courseMediaVOS, courseName, offlinePlace, calendarTime, startTime, endTime } = record;
const coverUrl = (_.find(courseMediaVOS, data => data.contentType === 'COVER') || {}).mediaUrl; const coverUrl = (_.find(courseMediaVOS, data => data.contentType === 'COVER') || {}).mediaUrl;
const time = `${calendarTime.map(item => moment(item).format('MM-DD')).join('、')} ${moment(startTime).format('HH:mm')} ~ ${moment(endTime).format('HH:mm')}`;
return ( return (
<div className="record__item"> <div className="record__item">
<img className="course-cover" src={coverUrl || defaultCoverUrl} /> <img className="course-cover" src={coverUrl || defaultCoverUrl} />
...@@ -76,8 +77,12 @@ class OfflineCourseList extends React.Component { ...@@ -76,8 +77,12 @@ class OfflineCourseList extends React.Component {
<Tooltip title={courseName}> <Tooltip title={courseName}>
<div className="course-name">{courseName}</div> <div className="course-name">{courseName}</div>
</Tooltip> </Tooltip>
<div className="course-text">地点:{offlinePlace}</div> <Tooltip title={`地点:${offlinePlace}`}>
<div className="course-text">{calendarTime.map(item => moment(item).format('MM-DD')).join('、')} {moment(startTime).format('HH:mm')} ~ {moment(endTime).format('HH:mm')}</div> <div className="course-text">地点:{offlinePlace}</div>
</Tooltip>
<Tooltip title={time}>
<div className="course-text">{time}</div>
</Tooltip>
</div> </div>
</div> </div>
) )
......
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
.course-name { .course-name {
color: #333; color: #333;
max-width:262px; max-width: ~'calc(100% - 32px)';
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
.course-text { .course-text {
color: #666; color: #666;
max-width:262px; max-width: ~'calc(100% - 32px)';
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
......
...@@ -58,7 +58,7 @@ class OfflineCoursePage extends React.Component { ...@@ -58,7 +58,7 @@ class OfflineCoursePage extends React.Component {
/> />
{/* 操作模块 */} {/* 操作模块 */}
<OfflineCourseOpt /> {window.ctx.xmState.storeUserPermissionList.includes('AddOfflineClass') && <OfflineCourseOpt />}
{/* 线下课列表模块 */} {/* 线下课列表模块 */}
<OfflineCourseList <OfflineCourseList
......
import React from 'react'; import React from 'react';
import { Button, Modal, Select } from 'antd'; import { Button, Modal, Select } from 'antd';
import moment from 'moment'; import moment from 'moment';
import html2canvas from 'html2canvas';
import { LIVE_SHARE } from "@/domains/course-domain/constants"; import { LIVE_SHARE } from "@/domains/course-domain/constants";
import QRCode from '../../../../libs/qrcode/qrcode'; import QRCode from '../../../../libs/qrcode/qrcode';
import User from '@/common/js/user'; import User from '@/common/js/user';
...@@ -30,7 +31,6 @@ export default class QRCodeModal extends React.Component { ...@@ -30,7 +31,6 @@ export default class QRCodeModal extends React.Component {
if (data.whetherSetSignIn === 'YES') { if (data.whetherSetSignIn === 'YES') {
const qrcodeWrapDom = document.querySelector('#qrcodeWrap1'); const qrcodeWrapDom = document.querySelector('#qrcodeWrap1');
const htmlUrl = `${LIVE_SHARE}sign_in?id=${User.getCustomerStoreId() || User.getStoreId()}&userId=${User.getUserId()}&calendar=${selectedDate}&courseId=${data.courseId}&from=work_weixin`; const htmlUrl = `${LIVE_SHARE}sign_in?id=${User.getCustomerStoreId() || User.getStoreId()}&userId=${User.getUserId()}&calendar=${selectedDate}&courseId=${data.courseId}&from=work_weixin`;
console.log(htmlUrl, 666666)
Service.Sales('public/businessShow/convertShortUrls', { Service.Sales('public/businessShow/convertShortUrls', {
urls: [htmlUrl] urls: [htmlUrl]
}).then((res) => { }).then((res) => {
...@@ -79,6 +79,24 @@ export default class QRCodeModal extends React.Component { ...@@ -79,6 +79,24 @@ export default class QRCodeModal extends React.Component {
}); });
} }
downloadQRCode = () => {
const domList = document.querySelectorAll('.image-box');
for (let index = 0; index < domList.length; index++) {
const dom = domList[index];
html2canvas(dom, {
useCORS: true,
}).then(canvas => {
this.downloadImg(canvas, '二维码');
});
}
}
downloadImg = (canvas, type) => {
const dataUrl = canvas.toDataURL('image/png');
const fileName = `${type}.png`;
window.downloadFile(dataUrl, fileName);
}
render() { render() {
const { visible, onCancel } = this.props; const { visible, onCancel } = this.props;
const { selectedDate, data = {} } = this.state; const { selectedDate, data = {} } = this.state;
...@@ -110,6 +128,9 @@ export default class QRCodeModal extends React.Component { ...@@ -110,6 +128,9 @@ export default class QRCodeModal extends React.Component {
<Button <Button
type="primary" type="primary"
style={{ marginLeft: 8 }} style={{ marginLeft: 8 }}
onClick={() => {
this.downloadQRCode();
}}
>下载二维码</Button> >下载二维码</Button>
</div> </div>
{whetherSetSignIn === 'YES' && <div className="image-box"> {whetherSetSignIn === 'YES' && <div className="image-box">
......
...@@ -35,7 +35,7 @@ export const menuList: any = [ ...@@ -35,7 +35,7 @@ export const menuList: any = [
}, },
{ {
groupName: "线下课", groupName: "线下课",
groupCode: "GraphicLesson", groupCode: "OfflineClass",
link: '/offline-course' link: '/offline-course'
}, },
] ]
......
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