+
@@ -147,5 +137,3 @@ const LoadingSkeleton: FC<{ num: number }> = ({ num = 0 }) => {
>
);
};
-
-//todo:修改获取数据的方式
diff --git a/src/routers/video/masonryItem.tsx b/src/routers/video/masonryItem.tsx
deleted file mode 100644
index 9fe05c6..0000000
--- a/src/routers/video/masonryItem.tsx
+++ /dev/null
@@ -1,156 +0,0 @@
-import { ImageBasic } from "@components/image";
-import { FC } from "react";
-import SlowMotionVideoSharpIcon from "@mui/icons-material/SlowMotionVideoSharp";
-import SubjectSharpIcon from "@mui/icons-material/SubjectSharp";
-import ThumbUpSharpIcon from "@mui/icons-material/ThumbUpSharp";
-import FavoriteSharpIcon from "@mui/icons-material/FavoriteSharp";
-import { Link, Avatar } from "@mui/material";
-import { VideoRouterImageCardType } from "./videotype";
-import getrealtiveTime, { getVideoTime } from "@utils/time";
-import styles from "./video.module.less";
-import { Omit, Pick } from "@utils/index";
-import getFixedNumber from "../../utils/number/index";
-import { useScreenMatchSize } from "@utils/hooks/match";
-import { useScreenSize } from "@components/proview/screenSize";
-
-export const VideoRouterImageCard: FC<{ data: VideoRouterImageCardType }> = ({
- data,
-}) => {
- const { pic, bvid } = data;
- return (
-
- );
-};
-const VideoData: FC<
- Pick
-> = (props) => {
- const { view, danmaku, duration } = props;
- const { sm } = useScreenSize();
- return (
-
-
-
-
- {getFixedNumber(view)}
-
- {sm && (
-
-
- {getFixedNumber(danmaku)}
-
- )}
-
-
{getVideoTime(duration)}
-
- );
-};
-const VideoInfo: FC<
- Pick<
- VideoRouterImageCardType,
- | "title"
- | "name"
- | "updated_at"
- | "bvid"
- | "coin"
- | "favorite"
- | "like"
- | "face"
- >
-> = (props) => {
- const { title, name, bvid, updated_at, coin, like, favorite, face } = props;
- const matchsmSize = useScreenMatchSize("sm");
- return (
-
-
-
- {title}
-
-
-
- {matchsmSize &&
}
-
-
-
{name}
- {matchsmSize &&
{getrealtiveTime(updated_at * 1000)}}
-
- {matchsmSize && (
-
-
- {" "}
- {getFixedNumber(like)}
-
-
- {getFixedNumber(coin)}
-
-
- {" "}
- {getFixedNumber(favorite)}
-
-
- )}
-
-
-
- );
-};
-
-export const CoinIcon: FC<{
- height: number | string;
- width?: number | string;
-}> = ({ height, width = height }) => (
-
-);
diff --git a/src/routers/video/video.module.less b/src/routers/video/video.module.less
index 29f8010..b30f277 100644
--- a/src/routers/video/video.module.less
+++ b/src/routers/video/video.module.less
@@ -1,143 +1,13 @@
-.video-section {
- height: 100%;
+.skeleton-img {
+ aspect-ratio: 16/9;
+ max-width: 100%;
+ height: auto !important;
+}
+
+.skeleton-content {
display: flex;
- flex-flow: column nowrap;
- &>:first-child {
+ .skeleton-info {
flex: 1;
}
-
- .video-data {
- transition: opacity .3s linear;
-
- *:hover+& {
- opacity: 0;
- }
-
- position: absolute;
- left: 0;
- bottom: 0;
- width: 100%;
- box-sizing: border-box;
- padding: 16px 8px 6px;
- border-bottom-left-radius: 8px;
- border-bottom-right-radius: 8px;
- display: flex;
- justify-content: space-between;
- align-items: center;
- color: #fff;
- font-size: 13px;
- font-weight: 400;
- background-image: linear-gradient(180deg,
- rgba(0, 0, 0, 0) 0%,
- rgba(0, 0, 0, .8) 100%);
-
- &-left {
- flex: 1;
- display: flex;
- align-items: center;
-
- &>span {
- font-size: 13px;
- display: flex;
- align-items: center;
-
- }
-
- &>span:not(:last-of-type) {
- margin-right: 12px;
- }
- }
- }
-
- .video-info {
-
- &>*:not(:first-child) {
- margin-top: 5px;
- }
-
- &>p {
- color: #18191c;
- font-size: 15px;
- cursor: pointer;
- transition: color .2s linear;
- height: 40px;
- overflow: hidden;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- text-overflow: ellipsis;
- line-break: anywhere;
- -webkit-line-clamp: 2;
- word-wrap: break-all;
-
- &:hover,
- &:active {
- color: #00aeec;
- }
-
- &>a {
- line-height: 1.25;
- }
- }
-
- .video-up {
- display: flex;
- align-items: stretch;
-
- &>*:not(:first-child) {
- margin-left: 5px;
- }
-
- &-desc {
- font-size: 13px;
- display: flex;
- flex-flow: column nowrap;
- justify-content: space-between;
- cursor: default;
-
- &-data {
- display: flex;
- flex-flow: row nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
-
- &>span {
- white-space: nowrap;
- display: flex;
- align-items: center;
-
- &:not(:first-of-type) {
- margin-left: 10px;
- }
- }
- }
-
-
- a {
-
- color: rgb(148, 153, 160);
- cursor: pointer;
- transition: color .2s linear;
-
- &:hover,
- &:active {
- color: #00aeec;
- }
-
- &>span {
- overflow: hidden;
- text-overflow: ellipsis;
- word-break: break-all;
-
- &:not(:first-of-type)::before {
- content: '·';
- margin: 0 4px;
- }
-
- }
- }
- }
-
- }
- }
}
\ No newline at end of file
diff --git a/vite.config.ts b/vite.config.ts
index 40ef216..d68ac50 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -1,10 +1,12 @@
-import { defineConfig } from "vite";
+import { defineConfig, splitVendorChunkPlugin } from "vite";
import path from "path";
import react from "@vitejs/plugin-react-swc";
// 可视化打包文件
import { visualizer } from "rollup-plugin-visualizer";
// gzip
import viteCompression from "vite-plugin-compression";
+// polyfill
+import legacy from "@vitejs/plugin-legacy";
// https://vitejs.dev/config/
export default defineConfig({
resolve: {
@@ -15,9 +17,21 @@ export default defineConfig({
"@routers": path.resolve(__dirname, "src/routers"),
},
},
- plugins: [react(), visualizer(), viteCompression()],
+ plugins: [
+ react(),
+ visualizer(),
+ viteCompression(),
+ legacy({
+ // 设置目标浏览器,browserslist 配置语法
+ targets: [
+ "defaults",
+ "iOS >= 9, Android >= 4.4, last 2 versions, > 0.2%, not dead",
+ ],
+ }),
+ splitVendorChunkPlugin(),
+ ],
build: {
- target: "es2015",
+ // target: "es2015",
minify: "esbuild",
rollupOptions: {
output: {