-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[义诊] 根据接诊时间计算目前是否正在接诊并显示 #76
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
e4b8f1b
[义诊] 计算是否正在接诊并显示标签
c04514d
[义诊] 调整接诊标签位置及样式
a2fb928
Merge branch 'dev' into yuannnh/clinic-live
TechQuery e14cce7
Update source/page/Clinic/index.tsx
TechQuery eab2ce9
Update source/page/Clinic/index.tsx
TechQuery fbc2ed0
Update source/page/Clinic/time.ts
TechQuery 8374b5d
Update source/page/Clinic/time.ts
TechQuery File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.clinic-card__live-label { | ||
display: flex; | ||
justify-content: center ; | ||
justify-items: center; | ||
width: 60px; | ||
height: 20px; | ||
background-color: #00fa9a; | ||
font-size: 12px; | ||
color:white; | ||
border-radius: 2px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,64 @@ | ||
import { component, createCell } from 'web-cell'; | ||
import { observer } from 'mobx-web-cell'; | ||
|
||
import { Card, CardFooter } from 'boot-cell/source/Content/Card'; | ||
import { BGIcon } from 'boot-cell/source/Reminder/FAIcon'; | ||
|
||
import { CardsPage, AuditBar } from '../../component'; | ||
import { clinic, Clinic } from '../../model'; | ||
|
||
@observer | ||
@component({ | ||
tagName: 'clinic-list', | ||
renderTarget: 'children' | ||
}) | ||
export class ClinicList extends CardsPage<Clinic> { | ||
scope = 'clinic'; | ||
model = clinic; | ||
name = '义诊服务'; | ||
|
||
renderItem = ({ | ||
url, | ||
name, | ||
startTime, | ||
endTime, | ||
contacts, | ||
remark, | ||
...rest | ||
}: Clinic) => ( | ||
<Card | ||
className="mx-auto mb-4 mx-sm-1" | ||
style={{ minWidth: '20rem', maxWidth: '20rem' }} | ||
title={ | ||
url ? ( | ||
<a target="_blank" href={url}> | ||
{name} | ||
</a> | ||
) : ( | ||
name | ||
) | ||
} | ||
> | ||
<p> | ||
每日接诊起止时间:{startTime} ~ {endTime} | ||
</p> | ||
{contacts[0] && ( | ||
<ol className="list-unstyled"> | ||
{contacts.map(({ name, phone }) => ( | ||
<li> | ||
<a href={'tel:' + phone}> | ||
<BGIcon | ||
type="square" | ||
name="phone" | ||
color="primary" | ||
className="d-inline-block" | ||
/>{' '} | ||
{name}:{phone} | ||
</a> | ||
</li> | ||
))} | ||
</ol> | ||
)} | ||
{remark && <p className="text-muted">{remark}</p>} | ||
<CardFooter> | ||
<AuditBar scope="clinic" model={clinic} {...rest} /> | ||
</CardFooter> | ||
</Card> | ||
); | ||
} | ||
import { component, createCell } from 'web-cell'; | ||
import { observer } from 'mobx-web-cell'; | ||
|
||
import { Card, CardFooter } from 'boot-cell/source/Content/Card'; | ||
|
||
import { CardsPage, AuditBar } from '../../component'; | ||
import { clinic, Clinic } from '../../model'; | ||
import { getIsLive } from './time'; | ||
import './index.css' | ||
|
||
@observer | ||
@component({ | ||
tagName: 'clinic-list', | ||
renderTarget: 'children' | ||
}) | ||
export class ClinicList extends CardsPage<Clinic> { | ||
scope = 'clinic'; | ||
model = clinic; | ||
name = '义诊服务'; | ||
|
||
renderItem = ({ | ||
url, | ||
name, | ||
startTime, | ||
endTime, | ||
contacts, | ||
remark, | ||
...rest | ||
}: Clinic) => ( | ||
<Card | ||
className="mx-auto mb-4 mx-sm-1" | ||
style={{ minWidth: '20rem', maxWidth: '20rem' }} | ||
title={ | ||
url ? ( | ||
<a target="_blank" href={url}> | ||
{name} | ||
</a> | ||
) : ( | ||
name | ||
) | ||
} | ||
> | ||
{getIsLive(startTime, endTime) && <div className="clinic-card__live-label">正在接诊</div>} | ||
<p> | ||
每日接诊起止时间:{startTime} ~ {endTime} | ||
</p> | ||
{contacts[0] && ( | ||
<ol className="list-unstyled"> | ||
{contacts.map(({ name, phone }) => ( | ||
<li> | ||
<a href={'tel:' + phone}> | ||
<i className="fa fa-phone d-inline-block bg-primary text-white p-1 rounded" />{' '} | ||
{name}:{phone} | ||
</a> | ||
</li> | ||
))} | ||
</ol> | ||
)} | ||
{remark && <p className="text-muted">{remark}</p>} | ||
|
||
<AuditBar scope="clinic" model={clinic} {...rest} /> | ||
</Card> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// 目前的时间格式为 hh:mm 的 String, 该方法将其转化为当天的该时间 | ||
export const getTimeFromTimeStr = (timeStr: string) => | ||
new Date(new Date().toJSON().split('T')[0] + 'T' + timeStr); | ||
|
||
// 计算当前时间是否介于起始与结束算出时间内 | ||
export const getIsLive = (startTimeStr: string, endTimeStr: string) => { | ||
const now = Date.now(), | ||
startTime = +getTimeFromTimeStr(startTimeStr), | ||
endTime = +getTimeFromTimeStr(endTimeStr); | ||
|
||
return now > startTime && now < endTime; | ||
} | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
本项目支持 CSS modules