添加价格审核,解决视频自动播放

This commit is contained in:
al 2024-11-04 16:21:56 +08:00
parent 79892672ce
commit 3db34b9ad2
5 changed files with 73 additions and 4 deletions

View File

@ -498,6 +498,7 @@ export default function CompleteStreamerInformation() {
const url = URL.createObjectURL(file);
videoD.src = url;
videoD.addEventListener("loadeddata", function () {
videoD.pause();
videoD.currentTime = 1;
});
videoD.addEventListener("seeked", function () {

View File

@ -56,6 +56,44 @@ export default function CreateImagePost() {
console.error(error);
}
};
//
const handleSavePaymentSetting = ({ price, imageVisibleRange }) => {
const intPrice = parseFloat(price);
if (intPrice < 0) {
Toast.show({
icon: "fail",
content: "请输入正确区间的价格",
position: "top",
});
return;
}
if (intPrice > 0 && intPrice * 100 < 100) {
Toast.show({
icon: "fail",
content: "请输入正确区间的价格",
position: "top",
});
return;
}
if (intPrice * 100 > 300000) {
Toast.show({
icon: "fail",
content: "请输入正确区间的价格",
position: "top",
});
return;
}
if (imageVisibleRange < 0 || imageVisibleRange > 3) {
Toast.show({
icon: "fail",
content: "请输入正确区间的可预览图片张数",
position: "top",
});
return;
}
setPriceEdit(false);
setFormData((old) => ({ ...old, ...priceEditData }));
};
//
const handleSubmit = async () => {
if (formData.content == "") {
@ -387,8 +425,7 @@ export default function CreateImagePost() {
<p
className="pt-4 text-center border-t border-[#ffffff40]"
onClick={() => {
setPriceEdit(false);
setFormData((old) => ({ ...old, ...priceEditData }));
handleSavePaymentSetting(priceEditData);
}}
>
保存

View File

@ -55,6 +55,36 @@ export default function CreateVideoPost() {
console.error(error);
}
};
//
const handleSavePaymentSetting = ({ price }) => {
const intPrice = parseFloat(price);
if (intPrice < 0) {
Toast.show({
icon: "fail",
content: "请输入正确区间的价格",
position: "top",
});
return;
}
if (intPrice > 0 && intPrice * 100 < 100) {
Toast.show({
icon: "fail",
content: "请输入正确区间的价格",
position: "top",
});
return;
}
if (intPrice * 100 > 300000) {
Toast.show({
icon: "fail",
content: "请输入正确区间的价格",
position: "top",
});
return;
}
setPriceEdit(false);
setFormData((old) => ({ ...old, ...priceEditData }));
};
//
const handleSubmit = async () => {
if (formData.content == "") {
@ -350,8 +380,7 @@ export default function CreateVideoPost() {
<p
className="pt-4 text-center border-t border-[#ffffff40]"
onClick={() => {
setPriceEdit(false);
setFormData((old) => ({ ...old, ...priceEditData }));
handleSavePaymentSetting(priceEditData);
}}
>
保存

View File

@ -195,6 +195,7 @@ export default function EditStreamerMedia() {
const url = URL.createObjectURL(file);
videoD.src = url;
videoD.addEventListener("loadeddata", function () {
videoD.pause();
videoD.currentTime = 1;
});
videoD.addEventListener("seeked", function () {

View File

@ -104,6 +104,7 @@ export default function UploadImgs({
const url = URL.createObjectURL(file);
videoD.src = url;
videoD.addEventListener("loadeddata", function () {
videoD.pause();
videoD.currentTime = 1;
});
videoD.addEventListener("seeked", function () {