修改vebview跳转

This commit is contained in:
al 2025-01-17 18:25:20 +08:00
parent 4852719e40
commit 23edcea925
3 changed files with 144 additions and 71 deletions

View File

@ -53,7 +53,7 @@ const BannerList = (props) => {
title: "标题",
dataIndex: "title",
key: "title",
width: 240,
width: 140,
},
{
title: "跳转链接",
@ -65,7 +65,21 @@ const BannerList = (props) => {
{data &&
data.map((hyperlink, index) => (
<div key={index}>
<p className="text-[#00000080]">{index ? "H5:" : "App:"}</p>
<p className="text-[#00000080]">
{hyperlink.action === "outward"
? "外部链接:"
: hyperlink.action === "webViewHeaderInward"
? "应用内打开内链(带头):"
: hyperlink.action === "webViewHeaderOutward"
? "应用内打开外链(带头):"
: hyperlink.action === "webViewWithOutHeaderInward"
? "应用内打开内链(不带头):"
: hyperlink.action === "webViewWithOutHeaderOutward"
? "应用内打开外链(不带头):"
: index
? "H5:"
: "App:"}
</p>
<span>{hyperlink.url}</span>
</div>
))}
@ -147,6 +161,9 @@ const BannerList = (props) => {
filterMode: "tree",
onFilter: (value, record) => record.status == value,
sorter: (a, b) => a.status - b.status,
defaultSortOrder: "ascend",
sortDirections: ["ascend", "descend"],
render: (item) => {
return (
<span>
@ -732,7 +749,7 @@ const BannerList = (props) => {
<Select
placeholder="选择跳转形式"
style={{
width: 140,
width: 240,
}}
// value={formData.action}
onChange={(e) => {
@ -748,19 +765,27 @@ const BannerList = (props) => {
options={[
{
value: "inward",
label: "内部跳转",
label: "达人空间跳转",
},
{
value: "outward",
label: "外部浏览器跳转",
label: "打开新的浏览器页面",
},
{
value: "webViewHeader",
label: "带头的WebView",
value: "webViewHeaderOutward",
label: "应用内打开外链(带头)",
},
{
value: "webViewWithOutHeader",
label: "不带头的WebView",
value: "webViewHeaderInward",
label: "应用内打开内链(带头)",
},
{
value: "webViewWithOutHeaderOutward",
label: "应用内打开外链(不带头)",
},
{
value: "webViewWithOutHeaderInward",
label: "应用内打开内链(不带头)",
},
]}
/>
@ -770,13 +795,14 @@ const BannerList = (props) => {
<div>
<div
style={{
display: pathMethod == "outward" ? "block" : "none",
display:
pathMethod !== "inward" && pathMethod ? "block" : "none",
}}
>
<Form.Item
rules={[
{
required: pathMethod == "outward",
required: pathMethod !== "inward" && pathMethod,
message: "请填写具体链接地址",
pattern: /^(https?:\/\/).*$/,
},
@ -792,7 +818,7 @@ const BannerList = (props) => {
direction="vertical"
className="w-full"
style={{
display: pathMethod !== "inward" ? "block" : "none",
display: pathMethod == "inward" ? "block" : "none",
}}
>
<label>
@ -805,7 +831,7 @@ const BannerList = (props) => {
className="mb-2"
rules={[
{
required: pathMethod !== "inward",
required: pathMethod == "inward",
message: `请选择页面`,
},
]}
@ -895,24 +921,24 @@ const BannerList = (props) => {
<Form.Item
name={it}
className="mb-2"
// rules={[
// {
// required: pathMethod == "inward",
// message: `${it}`,
// },
// ]}
rules={[
{
required: pathMethod == "inward",
message: `请填写${it}的值`,
},
]}
>
<div className="px-2 py-1 rounded bg-[#93939340]">
{it}{selectedStreamer?.mid}
</div>
{/* {selectedStreamer?.mid} */}
{/* <Input
<Input
disabled
className="bg-gray-200"
className="bg-gray-200 hidden"
placeholder="参数值"
prefix={<span>{it}</span>}
value={selectedStreamer?.mid}
/> */}
/>
</Form.Item>
))}
</Space>

View File

@ -70,9 +70,17 @@ const HotList = (props) => {
<p className="text-[#00000080]">
{hyperlink.action === "outward"
? "外部链接:"
: hyperlink.action === "webViewHeaderInward"
? "应用内打开内链(带头):"
: hyperlink.action === "webViewHeaderOutward"
? "应用内打开外链(带头):"
: hyperlink.action === "webViewWithOutHeaderInward"
? "应用内打开内链(不带头):"
: hyperlink.action === "webViewWithOutHeaderOutward"
? "应用内打开外链(不带头):"
: index
? "App:"
: "H5:"}
? "H5:"
: "App:"}
</p>
{hyperlink.action === "outward" ? (
<a href={hyperlink.url} target="_blank">
@ -146,7 +154,9 @@ const HotList = (props) => {
],
filterMode: "tree",
onFilter: (value, record) => record.status == value,
sorter: (a, b) => a.status - b.status,
defaultSortOrder: "ascend",
sortDirections: ["ascend", "descend"],
render: (item) => {
return (
<span>
@ -237,6 +247,7 @@ const HotList = (props) => {
link,
ueser_id,
id,
mid,
} = value;
let newHyperlinks = [];
@ -306,6 +317,7 @@ const HotList = (props) => {
hyperlinks: newHyperlinks,
image: image?.images ? image : { image_ids: displayImageId },
user_id: "",
mid: selectedStreamer?.inputType === "outter" ? mid : null,
};
if (id) {
delete dataObj.st;
@ -756,22 +768,27 @@ const HotList = (props) => {
label="ID"
name="mid"
layout="horizontal"
style={{ margin: 0 }}
style={{
margin: 0,
display:
selectedStreamer?.inputType === "inner" ? "none" : "block",
}}
>
<Select
// style={{
// width: 240,
// }}
disabled={currentStatus}
disabled={selectedStreamer?.inputType === "inner"}
className="w-full"
showSearch
allowClear
placeholder="通过ID搜索主播"
// optionFilterProp="label"
onChange={(v) => {
if (selectedStreamer?.inputType === "inner") return;
const currentIt = zones?.filter((it) => it.mid == v)[0];
if (currentIt) {
setSelectedStreamer(currentIt);
setSelectedStreamer({ ...currentIt, inputType: "outter" });
setDisplayImageId(currentIt.streamer_ext.avatar.image_ids);
form.setFieldsValue({
mid: v,
@ -898,7 +915,7 @@ const HotList = (props) => {
<Select
placeholder="选择跳转形式"
style={{
width: 120,
width: 240,
}}
value={formData.action}
onChange={(e) => {
@ -914,19 +931,27 @@ const HotList = (props) => {
options={[
{
value: "inward",
label: "内部跳转",
label: "达人空间跳转",
},
{
value: "outward",
label: "外部浏览器跳转",
label: "打开新的浏览器页面",
},
{
value: "webViewHeader",
label: "带头的WebView",
value: "webViewHeaderOutward",
label: "应用内打开外链(带头)",
},
{
value: "webViewWithOutHeader",
label: "不带头的WebView",
value: "webViewHeaderInward",
label: "应用内打开内链(带头)",
},
{
value: "webViewWithOutHeaderOutward",
label: "应用内打开外链(不带头)",
},
{
value: "webViewWithOutHeaderInward",
label: "应用内打开内链(不带头)",
},
]}
/>
@ -936,13 +961,14 @@ const HotList = (props) => {
<div>
<div
style={{
display: pathMethod == "outward" ? "block" : "none",
display:
pathMethod !== "inward" && pathMethod ? "block" : "none",
}}
>
<Form.Item
rules={[
{
required: pathMethod == "outward",
required: pathMethod !== "inward" && pathMethod,
message: "请填写具体链接地址",
pattern: /^(https?:\/\/).*$/,
},
@ -958,7 +984,7 @@ const HotList = (props) => {
direction="vertical"
className="w-full"
style={{
display: pathMethod !== "inward" ? "block" : "none",
display: pathMethod == "inward" ? "block" : "none",
}}
>
<label>
@ -971,7 +997,7 @@ const HotList = (props) => {
className="mb-2"
rules={[
{
required: pathMethod !== "inward",
required: pathMethod == "inward",
message: `请选择页面`,
},
]}
@ -1010,12 +1036,18 @@ const HotList = (props) => {
// width: 240,
// }}
className="w-full"
style={{ display: selectedStreamer ? "none" : "block" }}
style={{
display:
selectedStreamer?.inputType === "outter"
? "none"
: "block",
}}
showSearch
allowClear
placeholder="通过ID搜索主播"
// optionFilterProp="label"
onChange={(v) => {
if (selectedStreamer?.inputType === "outter") return;
const currentIt = zones?.filter(
(it) => it.mid == v
)[0];
@ -1025,8 +1057,10 @@ const HotList = (props) => {
// setSelectedStreamer(null);
// }
if (currentIt) {
form.setFieldValue("mid", currentIt.mid);
setSelectedStreamer({
...currentIt,
inputType: "inner",
mid: currentIt.mid,
});
}
@ -1061,24 +1095,24 @@ const HotList = (props) => {
<Form.Item
name={it}
className="mb-2"
// rules={[
// {
// required: pathMethod == "inward",
// message: `${it}`,
// },
// ]}
rules={[
{
required: pathMethod == "inward",
message: `请填写${it}的值`,
},
]}
>
<div className="px-2 py-1 rounded bg-[#93939340]">
{it}{selectedStreamer?.mid}
</div>
{/* {selectedStreamer?.mid} */}
{/* <Input
<Input
disabled
className="bg-gray-200"
className="bg-gray-200 hidden"
placeholder="参数值"
prefix={<span>{it}</span>}
value={selectedStreamer?.mid}
/> */}
/>
</Form.Item>
))}
</Space>

View File

@ -137,10 +137,14 @@ const NoticesContent = (props) => {
<p className="text-[#00000080]">
{hyperlink.action === "outward"
? "外部链接:"
: hyperlink.action === "webViewHeader"
? "带头的WebView"
: hyperlink.action === "webViewWithOutHeader"
? "不带头的WebView"
: hyperlink.action === "webViewHeaderInward"
? "应用内打开内链(带头):"
: hyperlink.action === "webViewHeaderOutward"
? "应用内打开外链(带头):"
: hyperlink.action === "webViewWithOutHeaderInward"
? "应用内打开内链(不带头):"
: hyperlink.action === "webViewWithOutHeaderOutward"
? "应用内打开外链(不带头):"
: index
? "H5:"
: "App:"}
@ -859,7 +863,7 @@ const NoticesContent = (props) => {
placeholder="选择跳转形式"
allowClear
style={{
width: 120,
width: 240,
}}
onChange={(e) => {
form.setFieldsValue({
@ -874,19 +878,27 @@ const NoticesContent = (props) => {
options={[
{
value: "inward",
label: "内部跳转",
label: "达人空间跳转",
},
{
value: "outward",
label: "外部浏览器跳转",
label: "打开新的浏览器页面",
},
{
value: "webViewHeader",
label: "带头的WebView",
value: "webViewHeaderOutward",
label: "应用内打开外链(带头)",
},
{
value: "webViewWithOutHeader",
label: "不带头的WebView",
value: "webViewHeaderInward",
label: "应用内打开内链(带头)",
},
{
value: "webViewWithOutHeaderOutward",
label: "应用内打开外链(不带头)",
},
{
value: "webViewWithOutHeaderInward",
label: "应用内打开内链(不带头)",
},
]}
/>
@ -896,13 +908,14 @@ const NoticesContent = (props) => {
<div>
<div
style={{
display: pathMethod !== "inward" ? "block" : "none",
display:
pathMethod !== "inward" && pathMethod ? "block" : "none",
}}
>
<Form.Item
rules={[
{
required: pathMethod !== "inward",
required: pathMethod !== "inward" && pathMethod,
message: "请填写具体链接地址",
pattern: /^(https?:\/\/).*$/,
},
@ -1025,23 +1038,23 @@ const NoticesContent = (props) => {
<Form.Item
name={it}
className="mb-2"
// rules={[
// {
// // required: pathMethod == "inward",
// message: `${it}`,
// },
// ]}
rules={[
{
required: pathMethod == "inward",
message: `请填写${it}的值`,
},
]}
>
<div className="px-2 py-1 rounded bg-[#93939340]">
{it}{selectedStreamer?.mid}
</div>
{/* <Input
<Input
disabled
className="bg-gray-200"
className="bg-gray-200 hidden"
placeholder="参数值"
prefix={<span>{it}</span>}
value={selectedStreamer?.mid}
/> */}
/>
</Form.Item>
))}
</Space>