Commit e7202770 by chenshu

feat:初始化

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