Skip to content
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

Fixed paly video time ui optimize #32

Open
wants to merge 2 commits into
base: added-jump-incoming-token
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion web/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
FROM node:16-alpine AS build

WORKDIR /web

COPY package.json ./

RUN yarn install

COPY . .

RUN yarn build

FROM nginx:stable-alpine
COPY /build /usr/share/nginx/html

COPY --from=build /web/build /usr/share/nginx/html

RUN sed -i '12a error_page 404 /index.html;' /etc/nginx/conf.d/default.conf

Expand All @@ -8,4 +21,5 @@ RUN sed -i '/^http {/a \
gzip_static on;' /etc/nginx/nginx.conf

EXPOSE 80

CMD ["nginx", "-g", "daemon off;"]
14 changes: 6 additions & 8 deletions web/src/pages/components/video-playback/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -425,13 +425,13 @@ export const VideoPlayback = (props: {
</div>
<div className="w-full flex">
{item.timeList.map((item, i) => {
const startTime = dayjs(warningDetails.startTime).utc();
const startTime = dayjs(warningDetails.startTime);

const endTime = startTime
.add(Number(warningDetails.duration ?? 0), "second")
.add(5, "minute");

return endTime < dayjs(item[0]).utc() ? (
return endTime < dayjs(item[0]) ? (
<div className="w-1/4 flex flex-col" key={i} />
) : (
<div className="w-1/4 flex flex-col" key={i}>
Expand All @@ -458,15 +458,13 @@ export const VideoPlayback = (props: {
className={`w-1/5 h-max relative`}
>
<div className="text-start text-[#5F6279] font-semibold text-[0.875rem] text-nowrap absolute top-[-16px]">
{index === 0 || index === 4
{index / 4 === 0
? dayjs(time).format("hh:mm A")
: ""}
</div>
<div
className={`relative h-2 w-px bg-[#ccc] ${
index === 0 || index === 4
? "h-3"
: "h-2 "
index / 4 === 0 ? "h-3" : "h-2 "
}`}
/>
<span
Expand All @@ -478,8 +476,8 @@ export const VideoPlayback = (props: {
</div>
);

return endTimeIndex ? (
index <= endTimeIndex ? (
return endTimeIndex >= 0 ? (
index <= endTimeIndex + 2 ? (
node
) : (
<div
Expand Down
6 changes: 4 additions & 2 deletions web/src/pages/warning/component/equipment/hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ export const useAction = () => {
// 回調獲取導出視頻url

const handelGetVideoPlayBackData = (id: string) => {
let playbackTimer: NodeJS.Timeout | null = null;

if (isPlayBackCallBackData) return;

id &&
Expand All @@ -104,12 +106,12 @@ export const useAction = () => {
handelDownloadUrl(generateUrl);
setIsPlayBackCallBackData(true);

return;
playbackTimer && clearTimeout(playbackTimer);
}
})
.catch(() => {});

setTimeout(() => {
playbackTimer = setTimeout(() => {
handelGetVideoPlayBackData(id);
}, 5000);
};
Expand Down