修改一些样式功能

This commit is contained in:
al 2024-07-24 13:53:12 +08:00
parent 66a2fad67e
commit f5bd3d47e7
6 changed files with 236 additions and 209 deletions

View File

@ -131,11 +131,15 @@ function Login({ handleLogin }) {
code: veriCode,
};
try {
const data = await requireAPI("POST", `/api/login/${
const data = await requireAPI(
"POST",
`/api/login/${
type === "password" ? "login_by_pswd" : "login_by_veri_code"
}`, {
}`,
{
body,
});
}
);
if (data.ret === -1) {
Toast.show({
icon: "fail",
@ -149,7 +153,11 @@ function Login({ handleLogin }) {
signIn(data);
handleLogin({ isSignin: true, userToken: data.data.token });
router.push(!data?.data?.is_enabled ? "/":"/my/setting/editPassword?is_enabled="+data?.data?.is_enabled);
router.push(
!data?.data?.is_enabled
? "/"
: "/my/setting/editPassword?is_enabled=" + data?.data?.is_enabled
);
} catch (error) {
console.error(error);
}
@ -198,7 +206,7 @@ function Login({ handleLogin }) {
};
return (
<div className="h-full flex justify-center items-center">
<div className={`lg:max-w-[450px] overflow-hidden`}>
<div className={`lg:max-w-[450px] overflow-hidden mt-12`}>
<Image
src={process.env.NEXT_PUBLIC_CDN_URL + "/public/images/slogan.png"}
alt=""
@ -251,7 +259,11 @@ function Login({ handleLogin }) {
setLoginInfo({ ...loginInfo, mobilePhone: value })
}
value={loginInfo.mobilePhone}
style={{ "--color": "#FFFFFF", "--font-size": "16px","--placeholder-color": "#FFFFFF80", }}
style={{
"--color": "#FFFFFF",
"--font-size": "16px",
"--placeholder-color": "#FFFFFF80",
}}
/>
</div>
<Divider />
@ -305,7 +317,11 @@ function Login({ handleLogin }) {
setLoginInfo({ ...loginInfo, mobilePhone: value })
}
value={loginInfo.mobilePhone}
style={{ "--color": "#FFFFFF", "--font-size": "16px","--placeholder-color": "#FFFFFF80", }}
style={{
"--color": "#FFFFFF",
"--font-size": "16px",
"--placeholder-color": "#FFFFFF80",
}}
/>
</div>
<Divider />
@ -367,14 +383,18 @@ const LoginBtn = ({ loginInfo, setLoginInfo, type, handleSubmit }) => {
<span className="text-[#FFFFFF80] font-medium text-xs ml-2">
我已阅读并同意
<span
onClick={() => router.push(`webView/${encodeURIComponent("/doc/useragreement")}`)}
onClick={() =>
router.push(`webView/${encodeURIComponent("/doc/useragreement")}`)
}
className="text-[#FF669E] text-xs"
>
用户协议
</span>
<span
onClick={() => router.push(`webView/${encodeURIComponent("/doc/privatypolicy")}`)}
onClick={() =>
router.push(`webView/${encodeURIComponent("/doc/privatypolicy")}`)
}
className="text-[#FF669E] text-xs"
>
隐私政策

View File

@ -7,6 +7,8 @@ import { faAngleLeft } from "@fortawesome/free-solid-svg-icons";
import { useRouter } from "next/navigation";
import UploadImgs from "@/components/UploadImgs";
import { get } from "@/utils/storeInfo";
import {multiUploadImage} from "@/utils/upload";
import requireAPI from "@/utils/requireAPI";
export default function Feedback() {
const [value, setValue] = useState();
const [assets, setAssets] = useState([]);
@ -22,40 +24,41 @@ export default function Feedback() {
});
return;
}
//提交数据
setIsSubmitting(true);
// const media = await multiUpload(assets);
console.log("media",{image_ids:assets,video_ids:[]})
// //提交数据
// setIsSubmitting(true);
// const media = await multiUpload(assets);
// const account = await get("account");
// try {
// const data = await requireAPI("POST", `/api/feedback/create`, {
// body: {
// mid: account.mid,
// discription: value,
// credentials: media,
// },
// });
// if (data.ret === -1) {
// Toast.show({
// icon: "fail",
// content: data.msg,
// position: "top",
// });
// return;
// }
// //提交成功后显示Toast并返回上一页
// Toast.show({
// icon: "success",
// content: "反馈提交成功",
// position: "top",
// });
// router.goBack();
// } catch (error) {
// console.error(error);
// } finally {
// setIsSubmitting(false);
// }
const media = await multiUploadImage(assets);
console.log("media",media)
const account = await get("account");
try {
const data = await requireAPI("POST", `/api/feedback/create`, {
body: {
mid: account.mid,
discription: value,
credentials: media,
},
});
if (data.ret === -1) {
Toast.show({
icon: "fail",
content: data.msg,
position: "top",
});
return;
}
//提交成功后显示Toast并返回上一页
Toast.show({
icon: "success",
content: "反馈提交成功",
position: "top",
});
router.back();
} catch (error) {
console.error(error);
} finally {
setIsSubmitting(false);
}
};
return (
<div>
@ -84,7 +87,7 @@ export default function Feedback() {
<p className="text-base font-medium text-white mt-4 mb-1">
截图最多9张
</p>
<UploadImgs getImgs={setAssets} />
<UploadImgs assets={assets} getImgs={setAssets} />
<div className="mt-16">
<Button
shape="rounded"

View File

@ -95,11 +95,8 @@ export default function Wallet() {
// title: "充值中心",
// uri: process.env.EXPO_PUBLIC_WEB_URL + "/pay",
// })
router.replace(
process.env.NEXT_PUBLIC_WEB_URL +
"/pay?base=" +
encodeURIComponent(JSON.stringify(base))
router.push(
`/webView/${encodeURIComponent(`pay?mid=${encodeURIComponent(JSON.stringify(base))}`)}`
)
}
className="flex justify-between items-center py-4 w-full"
@ -145,8 +142,8 @@ export default function Wallet() {
</div>
<div
onClick={() =>
router.replace(
`/webView/${encodeURIComponent(`withdrawal?mid=${data?.mid}&mobile_phone=${mobilePhone}&token=${temToken}`)}`
window && window.open(
`${process.env.NEXT_PUBLIC_WEB_URL}/withdrawal?mid=${data?.mid}&mobile_phone=${mobilePhone}&token=${temToken}`
)
}
className="flex justify-between items-center py-4"

View File

@ -22,10 +22,12 @@ export default function PersonSpace() {
<p className="text-base text-center leading-9"></p>
</div>
{/* 内容 */}
<div className="mt-12">
<iframe
src={`${process.env.NEXT_PUBLIC_WEB_URL}/` + decodeURIComponent(src)}
className="w-full h-[100vh]"
/>
</div>
</div>
);
}

View File

@ -3,23 +3,24 @@ import { DotLoading, Image, ImageViewer } from "antd-mobile";
import { uploadImage, uploadVideo } from "@/utils/upload";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faAdd, faClose } from "@fortawesome/free-solid-svg-icons";
export default function UploadImgs({ getImgs }) {
export default function UploadImgs({assets, getImgs }) {
const maxCount = 6;
const [fileList, setFileList] = useState([]);
const [loading, setLoading] = useState(false);
const handleUploadImage = async (e) => {
let file = e.target.files[0];
if (!file) return;
setLoading(true);
if (file.type.indexOf("image/") != -1) {
// const image = await uploadImage(file);
// getImgs((old) => [...old, image.id]);
const assets = [
...fileList,
{ type: "img", src: URL.createObjectURL(file) },
const newFiles = [
...assets,
file,
];
setFileList(assets);
const newAssets = newFiles.map(item=>({ type: "img", src: URL.createObjectURL(item) }));
setFileList(newAssets);
getImgs(newFiles);
} else if (file.type.indexOf("video/") != -1) {
const videoD = document.getElementById("videoD");
const videoC = document.getElementById("videoC");
@ -42,11 +43,12 @@ export default function UploadImgs({ getImgs }) {
// const video = await uploadVideo(file);
// getImgs((old) => [...old, video.id]);
// setFileList((old) => [...old, video]);
const assets = [
...fileList,
{ type: "video", src: URL.createObjectURL(file) },
const newFiles = [
...assets,
file,
];
setFileList(assets);
const newAssets = newFiles.map(item=>({ type: "video", src: URL.createObjectURL(item) }));
setFileList(newAssets);
}
setLoading(false);
@ -124,7 +126,7 @@ export default function UploadImgs({ getImgs }) {
onChange={handleUploadImage}
/>
</div>
<div>
<div className="hidden">
<video id="videoD">
<source src={fileList[0]?.src} />
您的浏览器不支持 Video 标签

View File

@ -126,8 +126,9 @@ async function getFailId() {
//上传单张图片
export async function uploadImage(asset) {
console.log("uploadResponse",asset)
const auth = await getAuth(1);
console.log("auth",auth)
try {
const formData = new FormData();
formData.append("name", auth.filename);
@ -137,11 +138,12 @@ export async function uploadImage(asset) {
formData.append("signature", auth.signature);
formData.append("key", auth.directory + "/" + auth.filename);
formData.append("file", asset);
console.log("formData",...formData)
const uploadResponse = await fetch(auth.host, {
method: "POST",
body: formData,
});
console.log("uploadResponse",uploadResponse)
if (uploadResponse.status === 200) {
// console.log(asset);
// debugger
@ -285,8 +287,9 @@ export async function multiUploadImage(assets) {
console.log("assets",assets)
let ids = { image_ids: [], video_ids: [] };
await Promise.all(
assets.forEach(async (asset) => {
const id = await uploadImage(asset);
assets.map(async (asset) => {
const id = await uploadImage(asset.src);
debugger;
ids.image_ids.push(id);
})
);