From 05bc6c36ba89c6aa66285a63f9a2c7cf9e1c0280 Mon Sep 17 00:00:00 2001 From: al Date: Tue, 21 Jan 2025 14:45:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AD=97=E6=AE=B5=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HotManage/components/BannerList/index.jsx | 43 ++- .../HotManage/components/HotList/index.jsx | 343 ++++++++++-------- src/pages/HotManage/index.jsx | 2 +- 3 files changed, 231 insertions(+), 157 deletions(-) diff --git a/src/pages/HotManage/components/BannerList/index.jsx b/src/pages/HotManage/components/BannerList/index.jsx index 5dff803..d99fc96 100644 --- a/src/pages/HotManage/components/BannerList/index.jsx +++ b/src/pages/HotManage/components/BannerList/index.jsx @@ -67,7 +67,7 @@ const BannerList = (props) => {

{hyperlink.action === "outward" - ? "外部链接:" + ? "打开新的浏览器页面:" : hyperlink.action === "webViewHeaderInward" ? "应用内打开内链(带头):" : hyperlink.action === "webViewHeaderOutward" @@ -80,7 +80,12 @@ const BannerList = (props) => { ? "H5:" : "App:"}

- {hyperlink.url} + + {hyperlink.url} +
))} @@ -202,10 +207,13 @@ const BannerList = (props) => { @@ -241,7 +249,7 @@ const BannerList = (props) => { formRef.current.submit(); }; //提交表单 - const handleSubmit = async (value) => { + const handleSubmit = async (value, type) => { const { action, status, @@ -288,7 +296,7 @@ const BannerList = (props) => { }, ]; } - if (!id) { + if (typeof id !== "number") { if (!status && new Date(st).getTime() < new Date().getTime()) { messageApi.open({ type: "warning", @@ -322,10 +330,16 @@ const BannerList = (props) => { image: image?.images ? image : { image_ids: displayImageId }, user_id: "", }; - if (id) { + if (typeof id === "number") { delete dataObj.st; delete dataObj.et; } + if ( + type === "stopStart" || + dataObj.priority === selectedStreamer?.priority + ) { + delete dataObj.priority; + } const base = baseRequest(); const body = JSON.stringify({ ...dataObj, @@ -350,7 +364,7 @@ const BannerList = (props) => { handleCancelModal(); getData(); } catch (error) { - message.error("服务器错误"); + message.error("出现问题了"); } }; //获取数据 @@ -474,7 +488,7 @@ const BannerList = (props) => { .filter((it) => it.inward_action_type === "app")[0] .url.split("=")[1] : ""; - const action = hyperlinks.length > 1 ? "inward" : "outward"; + const action = hyperlinks.length > 1 ? "inward" : hyperlinks[0]?.action; const link = action === "inward" ? "" : hyperlinks[0].url; const isCurrentPagePath = pagesOptions.filter( @@ -485,6 +499,8 @@ const BannerList = (props) => { setPathMethod(action); setCurrentItem(data); setDisplayImageId(data.image.image_ids); + setSelectedStreamer(data); + await handleSearchMid(user_id); form.setFieldsValue({ ...data, st: newSt, @@ -500,7 +516,7 @@ const BannerList = (props) => { }); }; const handleStopAndStart = (data) => { - handleSubmit({ ...data, status: 1 }); + handleSubmit({ ...data, status: data.status === 0 ? 1 : 0 }, "stopStart"); }; const handleDeleteItem = async (id) => { try { @@ -620,7 +636,7 @@ const BannerList = (props) => { } return list; - }, [currentPageName, pathMethod]); + }, [currentPageName, pathMethod, selectedStreamer]); //搜索空间 const handleSearchMid = async (mid) => { // const mid = form.getFieldValue("mid"); @@ -885,12 +901,17 @@ const BannerList = (props) => { // setSelectedStreamer(null); // } if (currentIt) { + form.setFieldValue("mid", currentIt.mid); setSelectedStreamer({ ...currentIt, mid: currentIt.mid, }); } }} + onClear={() => { + setSelectedStreamer(null); + setZones(null); + }} filterOption={false} onSearch={debounce(handleSearchMid, 1000)} notFoundContent={ diff --git a/src/pages/HotManage/components/HotList/index.jsx b/src/pages/HotManage/components/HotList/index.jsx index f880bd3..713264e 100644 --- a/src/pages/HotManage/components/HotList/index.jsx +++ b/src/pages/HotManage/components/HotList/index.jsx @@ -60,6 +60,7 @@ const HotList = (props) => { key: "text", }, { + with: 120, title: "跳转链接", dataIndex: "hyperlinks", key: "hyperlinks", @@ -69,7 +70,7 @@ const HotList = (props) => {

{hyperlink.action === "outward" - ? "外部链接:" + ? "打开新的浏览器页面:" : hyperlink.action === "webViewHeaderInward" ? "应用内打开内链(带头):" : hyperlink.action === "webViewHeaderOutward" @@ -83,11 +84,18 @@ const HotList = (props) => { : "App:"}

{hyperlink.action === "outward" ? ( - + {hyperlink.url} ) : ( - {hyperlink.url} +

+ {hyperlink.url} +

)}
))} @@ -191,7 +199,10 @@ const HotList = (props) => {