From de9e8e747efd9f413aa63ff0cfc34958ec88c77c Mon Sep 17 00:00:00 2001
From: al
Date: Wed, 6 Nov 2024 14:19:26 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/login/page.js | 4 --
.../completeStreamerInformation/page.jsx | 47 ++++--------------
app/space/[id]/page.js | 12 ++---
.../editStreamerMedia/page.jsx | 49 +++++--------------
components/AddToHome/index.jsx | 16 +++---
components/OwnInput/index.js | 4 +-
components/UploadImgs/index.js | 8 ++-
utils/tools/handleFuns.js | 1 +
8 files changed, 48 insertions(+), 93 deletions(-)
diff --git a/app/login/page.js b/app/login/page.js
index 3efcd14..5acf906 100644
--- a/app/login/page.js
+++ b/app/login/page.js
@@ -299,7 +299,6 @@ function Login({ handleLogin }) {
*/}
{
diff --git a/app/my/streamerVerification/completeStreamerInformation/page.jsx b/app/my/streamerVerification/completeStreamerInformation/page.jsx
index 16b0261..835ead9 100644
--- a/app/my/streamerVerification/completeStreamerInformation/page.jsx
+++ b/app/my/streamerVerification/completeStreamerInformation/page.jsx
@@ -36,6 +36,7 @@ import requireAPI from "@/utils/requireAPI";
import { get } from "@/utils/storeInfo";
import UploadImgs from "@/components/UploadImgs";
import { multiUploadImage } from "@/utils/upload";
+import { getVideoBase64 } from "@/utils/tools";
const constellations = [
{ label: "白羊座", value: "白羊座" },
{ label: "金牛座", value: "金牛座" },
@@ -480,41 +481,19 @@ export default function CompleteStreamerInformation() {
],
}));
} else {
- creatVideoCanvas(file);
- setFormData((old) => ({
- ...old,
- displayVideo: [
- {
- url: frameImageUrl,
+ const url = URL.createObjectURL(file);
+ getVideoBase64(url).then((src) => {
+ setFrameImageUrl(src);
+ setFormData((old) => ({
+ ...old,
+ displayVideo: {
+ url: src,
file: Array.from(e.target.files),
},
- ],
- }));
+ }));
+ });
}
};
- const creatVideoCanvas = (file) => {
- if (typeof window == "undefined") return;
- const videoD = document.getElementById("video_complete");
- const url = URL.createObjectURL(file);
- videoD.src = url;
- videoD.addEventListener("loadeddata", function () {
- videoD.pause();
- videoD.currentTime = 1;
- });
- videoD.addEventListener("seeked", function () {
- const canvas = document.createElement("canvas");
- canvas.width = videoD.videoWidth;
- canvas.height = videoD.videoHeight;
- canvas
- .getContext("2d")
- .drawImage(videoD, 0, 0, canvas.width, canvas.height);
- const canvasImg = canvas.toDataURL();
- setFrameImageUrl(canvasImg);
-
- // 释放URL对象
- URL.revokeObjectURL(url);
- });
- };
//审核中的情况
if (isWaitingReview) {
return (
@@ -1131,12 +1110,6 @@ export default function CompleteStreamerInformation() {
-
-
-
);
}
diff --git a/app/space/[id]/page.js b/app/space/[id]/page.js
index 9283ece..7e3e100 100644
--- a/app/space/[id]/page.js
+++ b/app/space/[id]/page.js
@@ -281,7 +281,7 @@ export default function PersonSpace() {
-
setMaskVisible({ visible: true, type: "weChat" })
}
@@ -298,7 +298,7 @@ export default function PersonSpace() {
placeholder=""
/>
-
查看微信
+ 查看微信
-
+
{streamerInfo?.is_ironfanship_unlocked === 1
? "已是铁粉"
: "成为铁粉"}
@@ -362,7 +362,7 @@ export default function PersonSpace() {
placeholder=""
/>
-
+
{streamerInfo?.is_superfanship_unlocked === 1
? "尊贵超粉"
: "成为超粉"}
@@ -387,7 +387,7 @@ export default function PersonSpace() {
placeholder=""
/>
-
举报
+ 举报
{streamerInfo?.visitor_role === 3 && (
- 审核未通过
+ 审核未通过
)}
diff --git a/app/space/setting/spaceIntroSetting/editStreamerMedia/page.jsx b/app/space/setting/spaceIntroSetting/editStreamerMedia/page.jsx
index 9f75d8c..2e65d9f 100644
--- a/app/space/setting/spaceIntroSetting/editStreamerMedia/page.jsx
+++ b/app/space/setting/spaceIntroSetting/editStreamerMedia/page.jsx
@@ -7,6 +7,7 @@ import { faAngleRight, faAngleLeft } from "@fortawesome/free-solid-svg-icons";
import UploadImgs from "@/components/UploadImgs";
import requireAPI from "@/utils/requireAPI";
import { multiUploadImage } from "@/utils/upload";
+import { getVideoBase64 } from "@/utils/tools";
export default function EditStreamerMedia() {
const router = useRouter();
//保存封面图
@@ -92,14 +93,17 @@ export default function EditStreamerMedia() {
},
}));
} else {
- creatVideoCanvas(file);
- setFormData((old) => ({
- ...old,
- displayVideo: {
- url: frameImageUrl,
- file: Array.from(e.target.files),
- },
- }));
+ const url = URL.createObjectURL(file);
+ getVideoBase64(url).then((src) => {
+ setFrameImageUrl(src);
+ setFormData((old) => ({
+ ...old,
+ displayVideo: {
+ url: src,
+ file: Array.from(e.target.files),
+ },
+ }));
+ });
}
setLoading(false);
};
@@ -189,29 +193,6 @@ export default function EditStreamerMedia() {
}
};
- const creatVideoCanvas = (file) => {
- if (typeof window == "undefined") return;
- const videoD = document.getElementById("video_edit_streamer");
- const url = URL.createObjectURL(file);
- videoD.src = url;
- videoD.addEventListener("loadeddata", function () {
- videoD.pause();
- videoD.currentTime = 1;
- });
- videoD.addEventListener("seeked", function () {
- const canvas = document.createElement("canvas");
- canvas.width = videoD.videoWidth;
- canvas.height = videoD.videoHeight;
- canvas
- .getContext("2d")
- .drawImage(videoD, 0, 0, canvas.width, canvas.height);
- const canvasImg = canvas.toDataURL();
- setFrameImageUrl(canvasImg);
-
- // 释放URL对象
- URL.revokeObjectURL(url);
- });
- };
useEffect(() => {
setFormData((old) => ({ ...old, imageAssets: oldPhotos }));
}, [oldPhotos]);
@@ -364,12 +345,6 @@ export default function EditStreamerMedia() {
-
-
-
);
}
diff --git a/components/AddToHome/index.jsx b/components/AddToHome/index.jsx
index eceaaa4..eb1fc6b 100644
--- a/components/AddToHome/index.jsx
+++ b/components/AddToHome/index.jsx
@@ -2,7 +2,7 @@
import React, { useState, useEffect } from "react";
import { Image } from "antd-mobile";
-import { get,save } from "@/utils/storeInfo";
+import { get, save } from "@/utils/storeInfo";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faAngleUp, faClose } from "@fortawesome/free-solid-svg-icons";
export default function AddToHome() {
@@ -24,7 +24,7 @@ export default function AddToHome() {
fit="cover"
className="rounded-md mr-3"
// src={process.env.NEXT_PUBLIC_WEB_ASSETS_URL+"/icons/nodata.png"}
- src={process.env.NEXT_PUBLIC_WEB_ASSETS_URL+"/images/icon.png"}
+ src={process.env.NEXT_PUBLIC_WEB_ASSETS_URL + "/images/icon.png"}
placeholder=""
width={46}
height={46}
@@ -34,11 +34,11 @@ export default function AddToHome() {
建议您添加铁粉空间
到手机桌面
- 以便随时关注圈子动态
+ 以便随时关注空间动态
setFirstLogin((old) => ({ ...old, second: true }))}
>
去添加
@@ -66,7 +66,9 @@ export default function AddToHome() {
+
),
diff --git a/utils/tools/handleFuns.js b/utils/tools/handleFuns.js
index ea67ffd..9bae6a3 100644
--- a/utils/tools/handleFuns.js
+++ b/utils/tools/handleFuns.js
@@ -85,6 +85,7 @@ export const handleShowVideo = (video) => {
{/* */}