@funhub/platform 0.2.11 → 0.2.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/biz.d.mts +5 -5
- package/dist/biz.mjs +1 -1
- package/dist/components/biz/business/advertisement/ad-match.d.mts +4 -19
- package/dist/components/biz/business/advertisement/ad-match.mjs +1 -1
- package/dist/components/biz/business/advertisement/ad-provider.d.mts +0 -3
- package/dist/components/biz/business/advertisement/ad-provider.mjs +1 -1
- package/dist/components/biz/business/advertisement/ad-query.d.mts +0 -1
- package/dist/components/biz/business/advertisement/ad-query.mjs +1 -1
- package/dist/components/biz/business/advertisement/ad-runtime-provider.d.mts +2 -4
- package/dist/components/biz/business/advertisement/ad-runtime-provider.mjs +1 -1
- package/dist/components/biz/business/advertisement/banner-ad/client.mjs +1 -1
- package/dist/components/biz/business/advertisement/banner-ad/material.d.mts +3 -2
- package/dist/components/biz/business/advertisement/banner-ad/material.mjs +1 -1
- package/dist/components/biz/business/advertisement/banner-ad/schema.d.mts +6 -9
- package/dist/components/biz/business/advertisement/banner-ad/schema.mjs +1 -1
- package/dist/components/biz/business/advertisement/banner-ad/server.mjs +1 -1
- package/dist/components/biz/business/advertisement/feed-ad/index.d.mts +31 -1
- package/dist/components/biz/business/advertisement/feed-ad/index.mjs +1 -1
- package/dist/components/biz/business/advertisement/floating-ad/client.d.mts +4 -4
- package/dist/components/biz/business/advertisement/floating-ad/client.mjs +1 -1
- package/dist/components/biz/business/advertisement/floating-ad/index.d.mts +1 -1
- package/dist/components/biz/business/advertisement/floating-ad/material.d.mts +0 -5
- package/dist/components/biz/business/advertisement/floating-ad/schema.d.mts +10 -21
- package/dist/components/biz/business/advertisement/floating-ad/schema.mjs +1 -1
- package/dist/components/biz/business/advertisement/floating-ad/server.mjs +1 -1
- package/dist/components/biz/business/advertisement/icon-ad/client.mjs +1 -1
- package/dist/components/biz/business/advertisement/icon-ad/material.d.mts +2 -1
- package/dist/components/biz/business/advertisement/icon-ad/material.mjs +1 -1
- package/dist/components/biz/business/advertisement/icon-ad/schema.d.mts +2 -7
- package/dist/components/biz/business/advertisement/icon-ad/schema.mjs +1 -1
- package/dist/components/biz/business/advertisement/icon-ad/server.mjs +1 -1
- package/dist/components/biz/business/advertisement/index.d.mts +4 -4
- package/dist/components/biz/business/advertisement/popup-ad/client.mjs +3 -3
- package/dist/components/biz/business/advertisement/popup-ad/index.d.mts +1 -1
- package/dist/components/biz/business/advertisement/popup-ad/material.d.mts +2 -2
- package/dist/components/biz/business/advertisement/popup-ad/schema.d.mts +15 -14
- package/dist/components/biz/business/advertisement/popup-ad/schema.mjs +1 -1
- package/dist/components/biz/business/advertisement/popup-ad/server.mjs +1 -1
- package/dist/components/biz/business/advertisement/text-ad/client.mjs +1 -1
- package/dist/components/biz/business/advertisement/text-ad/material.d.mts +2 -1
- package/dist/components/biz/business/advertisement/text-ad/material.mjs +1 -1
- package/dist/components/biz/business/advertisement/text-ad/schema.d.mts +3 -5
- package/dist/components/biz/business/advertisement/text-ad/schema.mjs +1 -1
- package/dist/components/biz/business/advertisement/text-ad/server.mjs +1 -1
- package/dist/components/biz/business/detail/shared/runtime-context-provider.mjs +1 -1
- package/dist/components/biz/business/detail/shared/video-hero.mjs +1 -1
- package/dist/components/biz/business/header-search/header-avatar-logo-search/schema.mjs +1 -1
- package/dist/components/biz/business/header-search/shared/logo.mjs +1 -1
- package/dist/components/biz/business/home-recommend/home-recommend-grid/client.mjs +1 -1
- package/dist/components/biz/business/home-recommend/home-recommend-grid/inspector-schema.d.mts +24 -4
- package/dist/components/biz/business/home-recommend/home-recommend-grid/inspector-schema.mjs +1 -1
- package/dist/components/biz/business/home-recommend/home-recommend-grid/material.d.mts +22 -2
- package/dist/components/biz/business/home-recommend/home-recommend-grid/server.mjs +1 -1
- package/dist/components/biz/business/home-recommend/home-recommend-waterfall/client.mjs +1 -1
- package/dist/components/biz/business/home-recommend/home-recommend-waterfall/inspector-schema.d.mts +24 -4
- package/dist/components/biz/business/home-recommend/home-recommend-waterfall/inspector-schema.mjs +1 -1
- package/dist/components/biz/business/home-recommend/home-recommend-waterfall/material.d.mts +22 -2
- package/dist/components/biz/business/home-recommend/home-recommend-waterfall/server.mjs +1 -1
- package/dist/components/biz/business/home-recommend/shared/home-recommend-base.mjs +1 -1
- package/dist/components/biz/business/home-recommend/shared/home-recommend-default-config.mjs +1 -1
- package/dist/components/biz/business/home-recommend/shared/home-recommend-preview.mjs +1 -1
- package/dist/components/biz/business/home-recommend/shared/home-recommend-runtime-props.mjs +1 -1
- package/dist/components/biz/business/home-recommend/shared/home-recommend-server-data.mjs +1 -1
- package/dist/components/biz/business/home-recommend/shared/home-recommend-smart-layout.mjs +2 -0
- package/dist/components/biz/business/hot-recommend/client.mjs +1 -1
- package/dist/components/biz/business/hot-recommend/material.d.mts +1 -0
- package/dist/components/biz/business/hot-recommend/schema.d.mts +1 -0
- package/dist/components/biz/business/hot-recommend/schema.mjs +1 -1
- package/dist/components/biz/business/image-text-recommend/client.d.mts +1 -1
- package/dist/components/biz/business/image-text-recommend/client.mjs +1 -1
- package/dist/components/biz/business/image-text-recommend/material.d.mts +7 -7
- package/dist/components/biz/business/image-text-recommend/schema.d.mts +30 -25
- package/dist/components/biz/business/image-text-recommend/schema.mjs +1 -1
- package/dist/components/biz/business/image-text-recommend/server.mjs +1 -1
- package/dist/components/biz/business/image-text-recommend/shared/query.mjs +1 -1
- package/dist/components/biz/business/index.d.mts +4 -4
- package/dist/components/biz/business/large-feature-grid/schema.mjs +1 -1
- package/dist/components/biz/business/marquee/client.mjs +1 -1
- package/dist/components/biz/business/marquee/material.d.mts +5 -6
- package/dist/components/biz/business/marquee/schema.d.mts +5 -6
- package/dist/components/biz/business/marquee/schema.mjs +1 -1
- package/dist/components/biz/business/tab-bar/client.d.mts +2 -0
- package/dist/components/biz/business/tab-bar/client.mjs +1 -1
- package/dist/components/biz/business/text-recommend/client.mjs +1 -1
- package/dist/components/biz/business/text-recommend/material.d.mts +1 -0
- package/dist/components/biz/business/text-recommend/schema.d.mts +1 -0
- package/dist/components/biz/business/text-recommend/schema.mjs +1 -1
- package/dist/components/common/video-player/index.d.mts +2 -1
- package/dist/components/common/video-player/video-blind-ad-overlay.mjs +2 -0
- package/dist/components/common/video-player/video-player-ref-context.mjs +2 -0
- package/dist/components/ui/badge.d.mts +1 -1
- package/dist/components/ui/button.d.mts +2 -2
- package/dist/components/ui/empty.d.mts +1 -1
- package/dist/components/ui/item.d.mts +1 -1
- package/dist/hooks/use-is-client.d.mts +10 -0
- package/dist/hooks/use-is-client.mjs +2 -0
- package/dist/hooks.d.mts +2 -1
- package/dist/hooks.mjs +1 -1
- package/dist/service/advertisement.d.mts +1 -13
- package/dist/service/advertisement.mjs +1 -1
- package/dist/service/generated/client.d.mts +10 -2
- package/dist/service/generated/client.mjs +1 -1
- package/dist/service/generated/tanstack.d.mts +12 -2
- package/dist/service/generated/tanstack.mjs +1 -1
- package/dist/service.d.mts +3 -3
- package/dist/service.mjs +1 -1
- package/dist/store/modules/blind-spot-ad-store.d.mts +116 -0
- package/dist/store/modules/blind-spot-ad-store.mjs +2 -0
- package/dist/store/modules/user-store.d.mts +1 -1
- package/dist/store/modules/user-store.mjs +1 -1
- package/dist/store/modules/video-player-ref-store.d.mts +21 -0
- package/dist/store/modules/video-player-ref-store.mjs +2 -0
- package/dist/store.d.mts +3 -1
- package/dist/store.mjs +1 -1
- package/dist/types.d.mts +171 -1
- package/dist/utils/browser-fingerprint.d.mts +13 -0
- package/dist/utils/browser-fingerprint.mjs +2 -0
- package/dist/utils/device-id.d.mts +2 -2
- package/dist/utils/device-id.mjs +1 -1
- package/dist/utils/http.mjs +1 -1
- package/dist/utils/request-user-id.d.mts +12 -0
- package/dist/utils/request-user-id.mjs +2 -0
- package/dist/utils/schema/inspector.d.mts +2 -2
- package/dist/utils.d.mts +3 -1
- package/dist/utils.mjs +1 -1
- package/package.json +2 -1
- package/dist/assets/icons/search/video.mjs +0 -2
- package/dist/components/biz/business/marquee/marquee.module.mjs +0 -24
|
@@ -11,15 +11,27 @@ import * as zod_v4_core0 from "zod/v4/core";
|
|
|
11
11
|
declare const homeRecommendGridMaterial: DefineMaterialOption<typeof HomeRecommendGrid, typeof HomeRecommendGridClient, zod.ZodObject<{
|
|
12
12
|
readonly rows: zod.ZodNumber & SchemaHasDefaultValue;
|
|
13
13
|
readonly columns: zod.ZodNumber & SchemaHasDefaultValue;
|
|
14
|
-
readonly smartTagEnabled: zod.ZodBoolean & SchemaHasDefaultValue;
|
|
15
14
|
readonly title: zod.ZodString & SchemaHasDefaultValue;
|
|
16
15
|
readonly showPlayCount: zod.ZodBoolean & SchemaHasDefaultValue;
|
|
17
16
|
readonly playCountDelta: zod.ZodNumber & SchemaHasDefaultValue;
|
|
18
17
|
readonly showEpisode: zod.ZodBoolean & SchemaHasDefaultValue;
|
|
19
18
|
readonly enableInfinite: zod.ZodOptional<zod.ZodBoolean> & SchemaHasDefaultValue;
|
|
20
19
|
readonly moreLink: zod.ZodOptional<zod.ZodString> & SchemaHasDefaultValue;
|
|
21
|
-
readonly
|
|
20
|
+
readonly recommendContentConfig: zod.ZodOptional<zod.ZodObject<{
|
|
21
|
+
enabled: zod.ZodOptional<zod.ZodBoolean>;
|
|
22
|
+
categories: zod.ZodOptional<zod.ZodArray<zod.ZodAny>>;
|
|
23
|
+
tags: zod.ZodOptional<zod.ZodArray<zod.ZodAny>>;
|
|
24
|
+
sortRule: zod.ZodOptional<zod.ZodString>;
|
|
25
|
+
contentForms: zod.ZodOptional<zod.ZodArray<zod.ZodString>>;
|
|
26
|
+
}, zod_v4_core0.$loose>>;
|
|
22
27
|
readonly catId: zod.ZodOptional<zod.ZodString> & SchemaHasDefaultValue;
|
|
28
|
+
readonly smartLayout: zod.ZodOptional<zod.ZodObject<{
|
|
29
|
+
enabled: zod.ZodOptional<zod.ZodBoolean>;
|
|
30
|
+
categories: zod.ZodOptional<zod.ZodArray<zod.ZodAny>>;
|
|
31
|
+
tags: zod.ZodOptional<zod.ZodArray<zod.ZodAny>>;
|
|
32
|
+
sortRule: zod.ZodOptional<zod.ZodString>;
|
|
33
|
+
contentForms: zod.ZodOptional<zod.ZodArray<zod.ZodString>>;
|
|
34
|
+
}, zod_v4_core0.$loose>>;
|
|
23
35
|
readonly items: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
|
|
24
36
|
contentId: zod.ZodString;
|
|
25
37
|
coverMode: zod.ZodOptional<zod.ZodEnum<{
|
|
@@ -28,6 +40,14 @@ declare const homeRecommendGridMaterial: DefineMaterialOption<typeof HomeRecomme
|
|
|
28
40
|
}>>;
|
|
29
41
|
coverUrl: zod.ZodOptional<zod.ZodString>;
|
|
30
42
|
is_ad: zod.ZodOptional<zod.ZodBoolean>;
|
|
43
|
+
ad: zod.ZodOptional<zod.ZodObject<{
|
|
44
|
+
ad_code: zod.ZodOptional<zod.ZodString>;
|
|
45
|
+
ad_advertise_url: zod.ZodOptional<zod.ZodString>;
|
|
46
|
+
ad_advertise_icon: zod.ZodOptional<zod.ZodString>;
|
|
47
|
+
ad_advertise_type: zod.ZodOptional<zod.ZodNumber>;
|
|
48
|
+
ad_advertise_desc: zod.ZodOptional<zod.ZodString>;
|
|
49
|
+
ad_ext_data: zod.ZodOptional<zod.ZodString>;
|
|
50
|
+
}, zod_v4_core0.$strip>>;
|
|
31
51
|
ad_advertise_url: zod.ZodOptional<zod.ZodString>;
|
|
32
52
|
ad_advertise_icon: zod.ZodOptional<zod.ZodString>;
|
|
33
53
|
badge_url: zod.ZodOptional<zod.ZodString>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
import e from"./client.mjs";import{normalizeHomeRecommendRuntimeProps as t}from"../shared/home-recommend-runtime-props.mjs";import{resolveHomeRecommendServerData as n}from"../shared/home-recommend-server-data.mjs";import{jsx as r}from"react/jsx-runtime";function i({rows:e,columns:t,
|
|
2
|
+
import e from"./client.mjs";import{normalizeHomeRecommendRuntimeProps as t}from"../shared/home-recommend-runtime-props.mjs";import{resolveHomeRecommendServerData as n}from"../shared/home-recommend-server-data.mjs";import{jsx as r}from"react/jsx-runtime";function i({rows:e,columns:t,smartLayout:n,enableInfinite:r,items:i}){if(r===!0)return 16;let a=Array.isArray(i)?i.length:0;if(n?.enabled!==!0&&a>0)return a;let o=Number(e),s=Number(t);if(!Number.isFinite(o)||!Number.isFinite(s))return 16;let c=Math.floor(o)*Math.floor(s);return!Number.isFinite(c)||c<=0?16:c}async function a(a){let{mode:o=`renderer`,...s}=a,c=t(s);if(o!==`renderer`)return r(e,{...c,mode:o});console.log(`HomeRecommendGrid`,c);let l=await n({enableInfinite:c.enableInfinite,pageSize:i(c),items:c.items,smartLayout:c.smartLayout});return r(e,{...c,prefetchData:l.data,mode:o})}export{a as HomeRecommendGrid};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{buildHomeRecommendEditorPreviewData as e}from"../shared/home-recommend-preview.mjs";import t from"../shared/home-recommend-base.mjs";import{useMemo as n}from"react";import{jsx as r}from"react/jsx-runtime";function i({prefetchData:i,mode:a=`renderer`,...o}){let s=a===`editor`,c=o,l=n(()=>s?e({variant:`waterfall`,schemaTitle:c.title,enableInfinite:c.enableInfinite,
|
|
2
|
+
"use client";import{buildHomeRecommendEditorPreviewData as e}from"../shared/home-recommend-preview.mjs";import t from"../shared/home-recommend-base.mjs";import{useMemo as n}from"react";import{jsx as r}from"react/jsx-runtime";function i({prefetchData:i,mode:a=`renderer`,...o}){let s=a===`editor`,c=o,l=n(()=>s?e({variant:`waterfall`,schemaTitle:c.title,enableInfinite:c.enableInfinite,dynamicRecommendEnabled:c.smartLayout?.enabled===!0,items:c.items}):i,[s,i,c.enableInfinite,c.items,c.smartLayout?.enabled,c.title]);return r(`div`,{className:s?`pointer-events-none`:void 0,children:r(t,{variant:`waterfall`,props:c,data:l,mode:a})})}export{i as default};
|
package/dist/components/biz/business/home-recommend/home-recommend-waterfall/inspector-schema.d.mts
CHANGED
|
@@ -9,15 +9,27 @@ import z$1 from "zod";
|
|
|
9
9
|
* HomeRecommendWaterfall 物料属性 schema 定义。
|
|
10
10
|
*/
|
|
11
11
|
declare const homeRecommendWaterfallInspectorPropsSchema: z$1.ZodObject<{
|
|
12
|
-
readonly smartTagEnabled: z$1.ZodBoolean & SchemaHasDefaultValue;
|
|
13
12
|
readonly title: z$1.ZodString & SchemaHasDefaultValue;
|
|
14
13
|
readonly showPlayCount: z$1.ZodBoolean & SchemaHasDefaultValue;
|
|
15
14
|
readonly playCountDelta: z$1.ZodNumber & SchemaHasDefaultValue;
|
|
16
15
|
readonly showEpisode: z$1.ZodBoolean & SchemaHasDefaultValue;
|
|
17
16
|
readonly enableInfinite: z$1.ZodBoolean & SchemaHasDefaultValue;
|
|
18
17
|
readonly moreLink: z$1.ZodOptional<z$1.ZodString> & SchemaHasDefaultValue;
|
|
19
|
-
readonly
|
|
18
|
+
readonly recommendContentConfig: z$1.ZodOptional<z$1.ZodObject<{
|
|
19
|
+
enabled: z$1.ZodOptional<z$1.ZodBoolean>;
|
|
20
|
+
categories: z$1.ZodOptional<z$1.ZodArray<z$1.ZodAny>>;
|
|
21
|
+
tags: z$1.ZodOptional<z$1.ZodArray<z$1.ZodAny>>;
|
|
22
|
+
sortRule: z$1.ZodOptional<z$1.ZodString>;
|
|
23
|
+
contentForms: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
|
|
24
|
+
}, z$1.core.$loose>>;
|
|
20
25
|
readonly catId: z$1.ZodOptional<z$1.ZodString> & SchemaHasDefaultValue;
|
|
26
|
+
readonly smartLayout: z$1.ZodOptional<z$1.ZodObject<{
|
|
27
|
+
enabled: z$1.ZodOptional<z$1.ZodBoolean>;
|
|
28
|
+
categories: z$1.ZodOptional<z$1.ZodArray<z$1.ZodAny>>;
|
|
29
|
+
tags: z$1.ZodOptional<z$1.ZodArray<z$1.ZodAny>>;
|
|
30
|
+
sortRule: z$1.ZodOptional<z$1.ZodString>;
|
|
31
|
+
contentForms: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
|
|
32
|
+
}, z$1.core.$loose>>;
|
|
21
33
|
readonly items: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
|
|
22
34
|
contentId: z$1.ZodString;
|
|
23
35
|
coverMode: z$1.ZodOptional<z$1.ZodEnum<{
|
|
@@ -26,6 +38,14 @@ declare const homeRecommendWaterfallInspectorPropsSchema: z$1.ZodObject<{
|
|
|
26
38
|
}>>;
|
|
27
39
|
coverUrl: z$1.ZodOptional<z$1.ZodString>;
|
|
28
40
|
is_ad: z$1.ZodOptional<z$1.ZodBoolean>;
|
|
41
|
+
ad: z$1.ZodOptional<z$1.ZodObject<{
|
|
42
|
+
ad_code: z$1.ZodOptional<z$1.ZodString>;
|
|
43
|
+
ad_advertise_url: z$1.ZodOptional<z$1.ZodString>;
|
|
44
|
+
ad_advertise_icon: z$1.ZodOptional<z$1.ZodString>;
|
|
45
|
+
ad_advertise_type: z$1.ZodOptional<z$1.ZodNumber>;
|
|
46
|
+
ad_advertise_desc: z$1.ZodOptional<z$1.ZodString>;
|
|
47
|
+
ad_ext_data: z$1.ZodOptional<z$1.ZodString>;
|
|
48
|
+
}, z$1.core.$strip>>;
|
|
29
49
|
ad_advertise_url: z$1.ZodOptional<z$1.ZodString>;
|
|
30
50
|
ad_advertise_icon: z$1.ZodOptional<z$1.ZodString>;
|
|
31
51
|
badge_url: z$1.ZodOptional<z$1.ZodString>;
|
|
@@ -45,9 +65,9 @@ declare const homeRecommendWaterfallInspectorPropsSchema: z$1.ZodObject<{
|
|
|
45
65
|
}>>;
|
|
46
66
|
}, z$1.core.$strip>;
|
|
47
67
|
declare const homeRecommendWaterfallInspectorDefaultProps: {
|
|
48
|
-
smartTagIds: never[];
|
|
49
68
|
items: never[];
|
|
50
|
-
|
|
69
|
+
recommendContentConfig: undefined;
|
|
70
|
+
smartLayout: undefined;
|
|
51
71
|
title: string;
|
|
52
72
|
showPlayCount: boolean;
|
|
53
73
|
playCountDelta: number;
|
package/dist/components/biz/business/home-recommend/home-recommend-waterfall/inspector-schema.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
import{defineComponentPropsSchema as e,getSchemaDefaultProps as t}from"../../../../../utils/schema/schema.mjs";import{HOME_RECOMMEND_DEFAULT_ENABLE_INFINITE as n,HOME_RECOMMEND_DEFAULT_PLAY_COUNT_DELTA as r,HOME_RECOMMEND_DEFAULT_SHOW_EPISODE as i,HOME_RECOMMEND_DEFAULT_SHOW_PLAY_COUNT as a,
|
|
2
|
+
import{defineComponentPropsSchema as e,getSchemaDefaultProps as t}from"../../../../../utils/schema/schema.mjs";import{HOME_RECOMMEND_DEFAULT_ENABLE_INFINITE as n,HOME_RECOMMEND_DEFAULT_PLAY_COUNT_DELTA as r,HOME_RECOMMEND_DEFAULT_SHOW_EPISODE as i,HOME_RECOMMEND_DEFAULT_SHOW_PLAY_COUNT as a,HOME_RECOMMEND_DEFAULT_TITLE as o}from"../shared/home-recommend-default-config.mjs";import{homeRecommendSmartLayoutSchema as s}from"../shared/home-recommend-smart-layout.mjs";import c from"zod";const l=e(e=>({title:e.string(o,{label:`推荐位名称`}),showPlayCount:e.boolean(a,{fieldType:`switch`,label:`显示播放量`}),playCountDelta:e.number(r,{label:`播放量浮动`}),showEpisode:e.boolean(i,{fieldType:`switch`,label:`显示集数`}),enableInfinite:e.boolean(n,{fieldType:`switch`,label:`无限下拉`}),moreLink:e.string(``,{label:`更多`,description:``,required:!1}),recommendContentConfig:s.optional(),catId:e.string(``,{label:`分类 ID`,description:`透传热门接口 cat_id`,required:!1}),smartLayout:s.optional(),items:c.array(c.object({contentId:c.string(),coverMode:c.enum([`upload`,`content`]).optional(),coverUrl:c.string().optional(),is_ad:c.boolean().optional(),ad:c.object({ad_code:c.string().optional(),ad_advertise_url:c.string().optional(),ad_advertise_icon:c.string().optional(),ad_advertise_type:c.number().optional(),ad_advertise_desc:c.string().optional(),ad_ext_data:c.string().optional()}).optional(),ad_advertise_url:c.string().optional(),ad_advertise_icon:c.string().optional(),badge_url:c.string().optional(),titleMode:c.enum([`custom`,`content`]).optional(),title:c.string().optional(),showPlayCount:c.boolean().optional(),playCountDelta:c.number().optional(),showEpisode:c.boolean().optional()})).optional()})),u={...t(l),items:[],recommendContentConfig:void 0,smartLayout:void 0},d={title:{type:`string`,title:`推荐位名称`,default:u.title},showPlayCount:{type:`boolean`,title:`显示播放量`,default:u.showPlayCount},playCountDelta:{type:`number`,title:`播放量浮动`,default:u.playCountDelta},showEpisode:{type:`boolean`,title:`显示集数`,default:u.showEpisode},enableInfinite:{type:`boolean`,title:`无限下拉`,default:u.enableInfinite},moreLink:{type:`string`,title:`更多`,description:``,default:u.moreLink},recommendContentConfig:{type:`object`,title:`推荐内容配置`,description:`频道下发的筛选与排序;enabled 为 true 时走动态列表`,default:u.recommendContentConfig},catId:{type:`string`,title:`分类 ID`,description:`透传热门接口 cat_id`,default:u.catId},smartLayout:{type:`object`,title:`智能筛选配置`,description:`enabled 为 true 时使用最新视频列表接口;categories/tags 取 id 透传 cat_ids、tags`,default:u.smartLayout},items:{type:`array`,title:`推荐项`,default:u.items,items:{type:`object`,title:`推荐项`,properties:{contentId:{type:`string`,title:`内容 ID`},coverMode:{type:`string`,title:`封面模式`},coverUrl:{type:`string`,title:`封面地址`},is_ad:{type:`boolean`,title:`是否广告`},ad:{type:`object`,title:`广告对象`,properties:{ad_code:{type:`string`,title:`广告业务编码`},ad_advertise_url:{type:`string`,title:`广告跳转地址`},ad_advertise_icon:{type:`string`,title:`广告素材地址`},ad_advertise_type:{type:`number`,title:`广告类型`},ad_advertise_desc:{type:`string`,title:`广告文案描述`},ad_ext_data:{type:`string`,title:`广告扩展信息`}}},ad_advertise_url:{type:`string`,title:`广告跳转地址`},ad_advertise_icon:{type:`string`,title:`广告素材地址`},badge_url:{type:`string`,title:`角标地址`},titleMode:{type:`string`,title:`标题模式`},title:{type:`string`,title:`标题`},showPlayCount:{type:`boolean`,title:`显示播放量`},playCountDelta:{type:`number`,title:`播放量浮动`},showEpisode:{type:`boolean`,title:`显示集数`}}}}};export{u as homeRecommendWaterfallInspectorDefaultProps,l as homeRecommendWaterfallInspectorPropsSchema,d as homeRecommendWaterfallPropsSchema};
|
|
@@ -9,15 +9,27 @@ import * as zod_v4_core0 from "zod/v4/core";
|
|
|
9
9
|
|
|
10
10
|
//#region components/biz/business/home-recommend/home-recommend-waterfall/material.d.ts
|
|
11
11
|
declare const homeRecommendWaterfallMaterial: DefineMaterialOption<typeof HomeRecommendWaterfall, typeof HomeRecommendWaterfallClient, zod.ZodObject<{
|
|
12
|
-
readonly smartTagEnabled: zod.ZodBoolean & SchemaHasDefaultValue;
|
|
13
12
|
readonly title: zod.ZodString & SchemaHasDefaultValue;
|
|
14
13
|
readonly showPlayCount: zod.ZodBoolean & SchemaHasDefaultValue;
|
|
15
14
|
readonly playCountDelta: zod.ZodNumber & SchemaHasDefaultValue;
|
|
16
15
|
readonly showEpisode: zod.ZodBoolean & SchemaHasDefaultValue;
|
|
17
16
|
readonly enableInfinite: zod.ZodBoolean & SchemaHasDefaultValue;
|
|
18
17
|
readonly moreLink: zod.ZodOptional<zod.ZodString> & SchemaHasDefaultValue;
|
|
19
|
-
readonly
|
|
18
|
+
readonly recommendContentConfig: zod.ZodOptional<zod.ZodObject<{
|
|
19
|
+
enabled: zod.ZodOptional<zod.ZodBoolean>;
|
|
20
|
+
categories: zod.ZodOptional<zod.ZodArray<zod.ZodAny>>;
|
|
21
|
+
tags: zod.ZodOptional<zod.ZodArray<zod.ZodAny>>;
|
|
22
|
+
sortRule: zod.ZodOptional<zod.ZodString>;
|
|
23
|
+
contentForms: zod.ZodOptional<zod.ZodArray<zod.ZodString>>;
|
|
24
|
+
}, zod_v4_core0.$loose>>;
|
|
20
25
|
readonly catId: zod.ZodOptional<zod.ZodString> & SchemaHasDefaultValue;
|
|
26
|
+
readonly smartLayout: zod.ZodOptional<zod.ZodObject<{
|
|
27
|
+
enabled: zod.ZodOptional<zod.ZodBoolean>;
|
|
28
|
+
categories: zod.ZodOptional<zod.ZodArray<zod.ZodAny>>;
|
|
29
|
+
tags: zod.ZodOptional<zod.ZodArray<zod.ZodAny>>;
|
|
30
|
+
sortRule: zod.ZodOptional<zod.ZodString>;
|
|
31
|
+
contentForms: zod.ZodOptional<zod.ZodArray<zod.ZodString>>;
|
|
32
|
+
}, zod_v4_core0.$loose>>;
|
|
21
33
|
readonly items: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
|
|
22
34
|
contentId: zod.ZodString;
|
|
23
35
|
coverMode: zod.ZodOptional<zod.ZodEnum<{
|
|
@@ -26,6 +38,14 @@ declare const homeRecommendWaterfallMaterial: DefineMaterialOption<typeof HomeRe
|
|
|
26
38
|
}>>;
|
|
27
39
|
coverUrl: zod.ZodOptional<zod.ZodString>;
|
|
28
40
|
is_ad: zod.ZodOptional<zod.ZodBoolean>;
|
|
41
|
+
ad: zod.ZodOptional<zod.ZodObject<{
|
|
42
|
+
ad_code: zod.ZodOptional<zod.ZodString>;
|
|
43
|
+
ad_advertise_url: zod.ZodOptional<zod.ZodString>;
|
|
44
|
+
ad_advertise_icon: zod.ZodOptional<zod.ZodString>;
|
|
45
|
+
ad_advertise_type: zod.ZodOptional<zod.ZodNumber>;
|
|
46
|
+
ad_advertise_desc: zod.ZodOptional<zod.ZodString>;
|
|
47
|
+
ad_ext_data: zod.ZodOptional<zod.ZodString>;
|
|
48
|
+
}, zod_v4_core0.$strip>>;
|
|
29
49
|
ad_advertise_url: zod.ZodOptional<zod.ZodString>;
|
|
30
50
|
ad_advertise_icon: zod.ZodOptional<zod.ZodString>;
|
|
31
51
|
badge_url: zod.ZodOptional<zod.ZodString>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
import e from"./client.mjs";import{normalizeHomeRecommendRuntimeProps as t}from"../shared/home-recommend-runtime-props.mjs";import{resolveHomeRecommendServerData as n}from"../shared/home-recommend-server-data.mjs";import{jsx as r}from"react/jsx-runtime";function i(e,t){if(e===!0)return 16;let n=Array.isArray(t)?t.length:0;return n<=0?16:n}async function a(a){let{mode:o=`renderer`,...s}=a,c=t(s);if(o!==`renderer`)return r(e,{...c,mode:o});let l=await n({
|
|
2
|
+
import e from"./client.mjs";import{normalizeHomeRecommendRuntimeProps as t}from"../shared/home-recommend-runtime-props.mjs";import{resolveHomeRecommendServerData as n}from"../shared/home-recommend-server-data.mjs";import{jsx as r}from"react/jsx-runtime";function i(e,t){if(e===!0)return 16;let n=Array.isArray(t)?t.length:0;return n<=0?16:n}async function a(a){let{mode:o=`renderer`,...s}=a,c=t(s);if(o!==`renderer`)return r(e,{...c,mode:o});let l=await n({enableInfinite:c.enableInfinite,pageSize:i(c.enableInfinite,c.items),items:c.items,smartLayout:c.smartLayout});return r(e,{...c,prefetchData:l.data,mode:o})}export{a as HomeRecommendWaterfall};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{pContentGetPopularVideoList as e}from"../../../../../service/generated/client.mjs";import{Image as t}from"../../../../ui/image.mjs";import{Box as n}from"../../../../ui/box.mjs";import{Text as r}from"../../../../ui/text.mjs";import i from"../../../../ui/loading.mjs";import a from"../../../../ui/link.mjs";import{useGridFirstRowHeight as o,useWaterfallFirstRowHeight as s}from"../../../../../hooks/use-first-row-height.mjs";import{useMinDurationLoading as c}from"../../../../../hooks/use-min-duration-loading.mjs";import l from"../../../../../assets/icons/common/right_arrow.mjs";import u from"../../../../../assets/icons/common/right_arrow_thin.mjs";import ee from"../../../../../assets/icons/detail/video_flag.mjs";import{RECOMMEND_BADGE_IMAGE_CLASS_NAME as d,RECOMMEND_TOP_LEFT_BADGE_WRAPPER_CLASS_NAME as te,normalizeRecommendBadgeUrl as f}from"../../../../common/list/waterfall-recommend/recommend-badge-style.mjs";import{WATERFALL_SHORT_CARD_ASPECT_RATIO as p,WATERFALL_TALL_CARD_ASPECT_RATIO as ne,buildWaterfallRecommendLegacyDisplay as m}from"../../../../common/list/waterfall-recommend/waterfall-recommend-display.mjs";import{WaterfallRecommend as re}from"../../../../common/list/waterfall-recommend/waterfall-recommend.mjs";import{HOME_RECOMMEND_DEFAULT_GRID_COLUMNS as ie,HOME_RECOMMEND_DEFAULT_GRID_ROWS as h,HOME_RECOMMEND_DEFAULT_PLAY_COUNT_DELTA as ae,HOME_RECOMMEND_DEFAULT_SHOW_EPISODE as oe,HOME_RECOMMEND_DEFAULT_SHOW_PLAY_COUNT as g,HOME_RECOMMEND_DEFAULT_TITLE as se,HOME_RECOMMEND_MAX_GRID_COLUMNS as ce,HOME_RECOMMEND_MAX_GRID_ROWS as le}from"./home-recommend-default-config.mjs";import{buildHomeRecommendHeatText as _,resolveHomeRecommendBrowseCount as v}from"./home-recommend-play-count.mjs";import{HOME_RECOMMEND_CARD_CONFIG_FIELD as ue}from"./home-recommend-preview.mjs";import{limitPopularVideoPageItems as de}from"./home-recommend-smart-tag.mjs";import{enrichHomeRecommendItemsWithVideoDetails as fe}from"./home-recommend-video-detail.mjs";import{useCallback as pe,useEffect as y,useLayoutEffect as me,useMemo as b,useRef as x,useState as S}from"react";import{Fragment as he,jsx as C,jsxs as w}from"react/jsx-runtime";const ge={backgroundImage:`var(--gradient-card-mask-medium)`},_e={},ve={list:[]},T=new Map,E=[];function ye(e){if(e)return T.get(e)}function be(e,t){if(!e||(T.has(e)||E.push(e),T.set(e,{items:[...t.items],cursor:t.cursor}),E.length<=120))return;let n=E.shift();n&&T.delete(n)}function xe({variant:t,props:ee=_e,data:d=ve,mode:te=`renderer`}){let f=te===`editor`,{list:p,title:ne,cursor:m}=d,_=b(()=>Array.isArray(p)?p:[],[p]),v=b(()=>Array.isArray(d.icons)?d.icons:[],[d.icons]),{rows:ue,columns:ge,moreLink:T,title:E,smartTagEnabled:xe,smartTagIds:D,catId:O,showPlayCount:k,playCountDelta:Ee,showEpisode:A,enableInfinite:j,items:M}=ee,N=xe===!0,P=j===!0&&N,F=!f&&P&&_.length>=16,I=b(()=>Array.isArray(D)?D.map(e=>String(e||``).trim()).filter(Boolean):[],[D]),L=typeof O==`string`?O.trim():``,R=b(()=>N||!Array.isArray(M)?``:M.map(e=>String(e?.contentId||``).trim()).filter(Boolean).join(`,`),[N,M]),[z,ke]=S(0),[je,B]=S(_),[Me,Ne]=S(v),[Pe,V]=S(()=>typeof m==`string`?m:void 0),[Fe,Ie]=S(!1),Le=x(null),Re=x(null),H=x(null),ze=x([]),U=x({left:null,right:null}),W=x(!1),G=x(``),{isLoading:Be,show:Ve,hide:He}=c(600),Ue=we(ue,h,le),K=we(ge,ie,ce),q=P?16:t===`grid`?Ue*K:16,J=b(()=>[t,N?`smart`:`manual:${R}`,I.join(`,`),L,String(q)].join(`|`),[N,R,L,q,I,t]);y(()=>{B(_),Ne(v),V(typeof m==`string`?m:void 0)},[m,v,_]);let We=Ue*K,Ge=f&&t===`grid`,Y=Ge?je.slice(0,We):je,Ke=Ge?Me.slice(0,We):Me,qe=t===`waterfall`?6:4,Je=Y.length>0?Math.max(0,Y.length-qe):-1,Ye=!!Pe,Xe=E&&E.trim()||ne||se,X=k??g,Z=Number(Ee??ae),Q=A??oe,Ze=`flex-1 min-w-0 text-[18px] leading-[24px] font-medium line-clamp-1 text-text2`,Qe=t===`grid`?u:f?l:u,$e=Ce(T),et=(t===`waterfall`||!P)&&!!$e,tt=et?$e:``,nt=t===`grid`?`flex size-[24px] shrink-0 items-center justify-center ${f?`opacity-100`:`opacity-50`}`:`ml-[8px] flex size-[24px] shrink-0 items-center justify-center ${f?`opacity-100`:`opacity-50`}`,rt=`size-[16px] text-text1`,it=o({enabled:!f&&t===`grid`,containerRef:Re,firstRowItemRef:ze,columns:K,itemsCount:Y.length,deps:[t]}),at=s({enabled:!f&&t===`waterfall`,containerRef:Le,firstRowRef:U,deps:[t,Y.length]}),ot=t===`grid`?it:at,st=pe(async()=>{if(f||G.current===J)return;let t=ye(J);if(t){B(t.items),N&&V(t.cursor);return}if(N||R){G.current=J;try{if(Ve(),!N){if(!R)return;let e=await fe(_);B(e),be(J,{items:e});return}let t=await e({page_size:q,tags:I.length>0?I:void 0,cat_id:L||void 0},{cache:`no-store`}),n=de(t.data?.videos,q),r=t.data?.cursor;B(n),V(r),be(J,{items:n,cursor:r})}catch(e){console.error(`推荐位刷新首屏失败(client)`,e)}finally{G.current===J&&(G.current=``),He()}}},[He,_,f,N,R,J,L,q,I,Ve]);y(()=>{st()},[st]);let ct=pe(async()=>{let t=Pe;if(!(!F||!t||W.current)){W.current=!0,Ie(!0);try{let n=await e({cursor:t,page_size:q,tags:I.length>0?I:void 0,cat_id:L||void 0}),r=Array.isArray(n.data?.videos)?n.data.videos:[],i=n.data?.cursor;r.length>0&&B(e=>e.concat(r)),V(e=>{if(!(!r.length||!i))return i===e?void 0:i})}catch(e){console.error(`推荐位加载下一页失败(client)`,e),V(void 0)}finally{W.current=!1,Ie(!1)}}},[Pe,L,q,I,F]);y(()=>{let e=H.current;if(!e||!F||!Ye)return;let t=new IntersectionObserver(e=>{!e[0]?.isIntersecting||Fe||ct()},{root:null,threshold:0});return t.observe(e),()=>{t.disconnect()}},[ct,Ye,Fe,Y.length,q,F,Je]),me(()=>{let e=Le.current;if(!e||t!==`waterfall`)return;let n=()=>{let t=e.clientWidth||0;ke(t>0?(t-15)/2:0)};n();let r=new ResizeObserver(n);return r.observe(e),()=>{r.disconnect()}},[t]);let $=b(()=>t===`waterfall`?Oe(Y,Ke,z):{left:[],right:[]},[z,Ke,Y,t]),lt=b(()=>t===`waterfall`?{left:$.left.map(e=>De(e,X,Z,Q)),right:$.right.map(e=>De(e,X,Z,Q))}:{left:[],right:[]},[Z,Q,X,t,$.left,$.right]);if(y(()=>{t===`waterfall`&&($.left.length||(U.current.left=null),$.right.length||(U.current.right=null))},[t,$.left.length,$.right.length]),!Y.length)return null;let ut=!f&&Be,dt=!f&&Fe,ft=ot>0?ot/2:160;return w(n,{className:`w-full mt-[16px]`,children:[t===`grid`&&w(n,{className:`flex items-center justify-between pl-[16px] pr-0 mb-[16px]`,children:[C(r,{className:Ze,children:Xe}),et&&C(a,{href:tt,"aria-label":`更多`,className:nt,children:C(Qe,{className:rt})})]}),t===`grid`&&w(n,{ref:Re,className:`relative flex w-full flex-wrap items-start gap-[16px] px-[16px]`,children:[Y.map((e,t)=>{let n=Ke[t],r=Te(e);return C(`div`,{ref:e=>{t===Je&&(H.current=e),t<K&&(ze.current[t]=e)},className:`w-[calc((100%-16px)/2)]`,children:C(Se,{item:e,icon:n,index:t,showPlayCount:X&&(r?.showPlayCount??!0),playCountDelta:r?.playCountDelta??Z,showEpisode:r?.showEpisode??Q,widthStyle:{width:`100%`}})},Ae(e,t))}),ut&&C(n,{className:`absolute inset-0 z-10 bg-black/15 backdrop-blur-[1px] dark:bg-white/10`,"aria-hidden":!0}),ut&&C(n,{className:`absolute left-1/2 -translate-x-1/2 -translate-y-1/2 z-20 pointer-events-none`,style:{top:ft},"aria-hidden":!0,children:C(i,{size:`large`,showLabel:!1,className:`text-theme5`})})]}),t===`waterfall`&&C(re,{title:Xe,moreHref:tt||void 0,moreIcon:et?C(Qe,{className:rt}):void 0,titleClassName:Ze,moreLinkClassName:nt,columns:lt,containerClassName:`relative flex w-full gap-[15px] px-[16px]`,getItemRef:({item:e,column:t,columnIndex:n})=>r=>{e.sourceIndex===Je&&(H.current=r),n===0&&(U.current[t]=r)},overlay:ut?w(he,{children:[C(n,{className:`absolute inset-0 z-10 bg-black/15 backdrop-blur-[1px] dark:bg-white/10`,"aria-hidden":!0}),C(n,{className:`absolute left-1/2 -translate-x-1/2 -translate-y-1/2 z-20 pointer-events-none`,style:{top:ft},"aria-hidden":!0,children:C(i,{size:`large`,showLabel:!1,className:`text-theme5`})})]}):void 0}),dt&&C(n,{className:`w-full flex justify-center py-[12px]`,children:C(i,{size:`medium`,showLabel:!1,className:`text-theme5`})})]})}function Se({item:e,icon:t,index:n,showPlayCount:r,playCountDelta:i,showEpisode:a,widthStyle:o}){return C(D,{item:e,icon:t,index:n,showPlayCount:r,playCountDelta:i,showEpisode:a,widthStyle:o})}function D({item:e,icon:i,index:o,showPlayCount:s,playCountDelta:c,showEpisode:l,widthStyle:u}){let re=A(e),ie=re===`short`?p:ne,h=j(e,re),ae=e.name||e?.title||``,oe=e.id?O(e):`#`,g=m({title:ae,badgeImageUrl:z(e,i,o),episodeText:F(e,l),heatText:s?_(v(e),c):``,score:N(e.score)}),se=f(g.topLeftBadgeImageUrl);return C(a,{href:oe,className:`block w-full`,style:u,children:w(he,{children:[w(n,{className:`relative w-full overflow-hidden rounded-[8px] bg-bg3`,style:{aspectRatio:ie},children:[h&&C(t,{src:h,alt:ae||`推荐封面`,fill:!0,objectFit:`cover`,className:`object-cover object-top`}),C(n,{className:`pointer-events-none absolute inset-0 rounded-[8px]`,style:ge,"aria-hidden":!0}),se&&C(n,{className:te,children:C(t,{src:se,alt:`角标`,width:96,height:18,className:d})}),g.topRightScoreText&&C(r,{as:`span`,className:`absolute right-[8px] top-[8px] z-10 shrink-0 text-[14px] leading-[22px] font-semibold text-[#FFC24B]`,children:g.topRightScoreText}),w(n,{className:`absolute left-[8px] right-[8px] bottom-[8px] z-10 flex items-end justify-between gap-[8px]`,children:[C(n,{className:`flex min-w-0 items-center gap-[4px]`,children:g.bottomLeftHeatText&&w(he,{children:[C(ee,{className:`h-[16px] w-[16px] shrink-0 text-white`}),C(r,{as:`span`,className:`min-w-0 truncate text-[14px] leading-[20px] text-white`,children:g.bottomLeftHeatText})]})}),g.bottomRightEpisodeText&&C(r,{as:`span`,className:`shrink-0 text-[14px] leading-[20px] text-white`,children:g.bottomRightEpisodeText})]})]}),C(n,{className:`mt-[8px] overflow-hidden`,children:C(r,{as:`h3`,className:`line-clamp-2 text-[16px] leading-[22px] text-[--color-text-white80]`,children:g.title})})]})})}function O(e){let t=encodeURIComponent(e.name||``);return`/video/${e.id||``}/${t}/episode/1`}function Ce(e){return e?e.trim():``}function we(e,t,n){let r=Number(e);return!Number.isFinite(r)||r<=0?t:Math.min(n,Math.floor(r))}function Te(e){return e[ue]}function k(e){return typeof e==`string`?e:``}function Ee(e){return typeof e==`string`?e.trim():``}function A(e){return Ee(e.img_type).toLowerCase()===`long`?`short`:`tall`}function j(e,t){return t===`short`?e.img_x||e.img_y||e?.coverUrl:e.img_y||e.img_x||e?.coverUrl}function M(e,t){return(e.tags?.map(e=>e.name).filter(Boolean).join(` · `)??``)||(t?P(e,!0):``)}function N(e){let t=Number(e);if(!(!Number.isFinite(t)||t<=0))return t>10&&t<=100?t/10:Math.min(t,10)}function P(e,t){return t?I(e)||R(Number(e.duration||0)):``}function F(e,t){return t?I(e):``}function I(e){if(!L(e))return``;let t=e.update_status===`0`,n=Number(e.episode_cnt||e.links?.length||0);return n>0?`${t?`更新至`:`全`}${n}集`:``}function L(e){if(Number(e.type??0)===2)return!0;let t=Number(e.episode_cnt||e.links?.length||0);return Number.isFinite(t)&&t>1}function R(e){if(!Number.isFinite(e)||e<=0)return``;let t=Math.floor(e),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60,a=e=>String(e).padStart(2,`0`);return n>0?`${a(n)}:${a(r)}:${a(i)}`:`${a(r)}:${a(i)}`}function z(e,t,n){return k(e.badge_url)||k(t?.material_url)||``}function De(e,t,n,r){let i=A(e.item),a=j(e.item,i),o=e.item.name||e.item?.title||``,s=e.item.id?O(e.item):`#`,c=z(e.item,e.icon,e.index),l=P(e.item,r),u=M(e.item,r),ee=t?_(v(e.item),n):``,d=N(e.item.score);return{key:Ae(e.item,e.index),sourceIndex:e.index,href:s,cardKind:i,coverUrl:a,title:o,badgeImageUrl:c,episodeText:l,metaPrimaryText:u,heatText:ee,score:d}}function Oe(e,t,n){let r=[],i=[],a=n<=0,o=0,s=0;return e.forEach((e,c)=>{let l=t[c];if(a){c%2==0?r.push({item:e,icon:l,index:c}):i.push({item:e,icon:l,index:c});return}let u=ke(n,e);o<=s?(r.push({item:e,icon:l,index:c}),o+=u):(i.push({item:e,icon:l,index:c}),s+=u)}),{left:r,right:i}}function ke(e,t){return e?(A(t)===`tall`?216:142)+16:0}function Ae(e,t){return e.id?`home-recommend-${e.id}`:`home-recommend-${t}`}export{xe as default};
|
|
2
|
+
"use client";import{pContentGetNewstVideoList as e,pContentGetPopularVideoList as t}from"../../../../../service/generated/client.mjs";import{Image as n}from"../../../../ui/image.mjs";import{Box as r}from"../../../../ui/box.mjs";import{Text as i}from"../../../../ui/text.mjs";import a from"../../../../ui/loading.mjs";import o from"../../../../ui/link.mjs";import{useGridFirstRowHeight as s,useWaterfallFirstRowHeight as c}from"../../../../../hooks/use-first-row-height.mjs";import{useMinDurationLoading as l}from"../../../../../hooks/use-min-duration-loading.mjs";import u from"../../../../../assets/icons/common/right_arrow.mjs";import d from"../../../../../assets/icons/common/right_arrow_thin.mjs";import f from"../../../../../assets/icons/detail/video_flag.mjs";import{RECOMMEND_BADGE_IMAGE_CLASS_NAME as p,RECOMMEND_TOP_LEFT_BADGE_WRAPPER_CLASS_NAME as ee,normalizeRecommendBadgeUrl as m}from"../../../../common/list/waterfall-recommend/recommend-badge-style.mjs";import{WATERFALL_SHORT_CARD_ASPECT_RATIO as h,WATERFALL_TALL_CARD_ASPECT_RATIO as te,buildWaterfallRecommendLegacyDisplay as g}from"../../../../common/list/waterfall-recommend/waterfall-recommend-display.mjs";import{WaterfallRecommend as ne}from"../../../../common/list/waterfall-recommend/waterfall-recommend.mjs";import{HOME_RECOMMEND_DEFAULT_GRID_COLUMNS as re,HOME_RECOMMEND_DEFAULT_GRID_ROWS as ie,HOME_RECOMMEND_DEFAULT_PLAY_COUNT_DELTA as ae,HOME_RECOMMEND_DEFAULT_SHOW_EPISODE as _,HOME_RECOMMEND_DEFAULT_SHOW_PLAY_COUNT as v,HOME_RECOMMEND_DEFAULT_TITLE as oe,HOME_RECOMMEND_MAX_GRID_COLUMNS as se,HOME_RECOMMEND_MAX_GRID_ROWS as ce}from"./home-recommend-default-config.mjs";import{buildHomeRecommendHeatText as y,resolveHomeRecommendBrowseCount as b}from"./home-recommend-play-count.mjs";import{HOME_RECOMMEND_CARD_CONFIG_FIELD as le}from"./home-recommend-preview.mjs";import{limitPopularVideoPageItems as ue}from"./home-recommend-smart-tag.mjs";import{enrichHomeRecommendItemsWithVideoDetails as de}from"./home-recommend-video-detail.mjs";import{useCallback as fe,useEffect as x,useLayoutEffect as pe,useMemo as S,useRef as C,useState as w}from"react";import{Fragment as me,jsx as T,jsxs as E}from"react/jsx-runtime";const he={backgroundImage:`var(--gradient-card-mask-medium)`},ge={},_e={list:[]},D=new Map,O=[];function ve(e){if(e)return D.get(e)}function ye(e,t){if(!e||(D.has(e)||O.push(e),D.set(e,{items:[...t.items],cursor:t.cursor}),O.length<=120))return;let n=O.shift();n&&D.delete(n)}function be({variant:n,props:f=ge,data:p=_e,mode:ee=`renderer`}){let m=ee===`editor`,{list:h,title:te,cursor:g}=p,y=S(()=>Array.isArray(h)?h:[],[h]),b=S(()=>Array.isArray(p.icons)?p.icons:[],[p.icons]),{rows:le,columns:he,moreLink:D,title:O,showPlayCount:be,playCountDelta:Se,showEpisode:k,enableInfinite:Ee,items:A,smartLayout:j}=f,M=j?.enabled===!0,N=M&&isHomeRecommendLatestSortRule(j?.sortRule),P=Ee===!0&&M,F=!m&&P&&y.length>=16,I=S(()=>M||!Array.isArray(A)?``:A.map(e=>String(e?.contentId||``).trim()).filter(Boolean).join(`,`),[M,A]),[L,De]=w(0),[R,z]=w(y),[Ae,Me]=w(b),[Ne,B]=w(()=>typeof g==`string`?g:void 0),[V,Pe]=w(!1),Fe=C(null),Ie=C(null),H=C(null),Le=C([]),U=C({left:null,right:null}),W=C(!1),G=C(``),{isLoading:Re,show:ze,hide:Be}=l(600),Ve=we(le,ie,ce),K=we(he,re,se),q=P?16:n===`grid`?Ve*K:16,J=S(()=>[n,(()=>{if(!M||!j)return`manual:${I}`;if(N)return`smart:newest:${j.tagIds.join(`,`)}:${j.catIds.join(`,`)}`;let e=String(j.sortRule??``);return`smart:popular:${j.tagIds.join(`,`)}:${j.catIds.join(`,`)}:sr:${e}`})(),String(q)].join(`|`),[M,I,q,j,N,n]);x(()=>{z(y),Me(b),B(typeof g==`string`?g:void 0)},[g,b,y]);let He=Ve*K,Ue=m&&n===`grid`,Y=Ue?R.slice(0,He):R,We=Ue?Ae.slice(0,He):Ae,Ge=n===`waterfall`?6:4,Ke=Y.length>0?Math.max(0,Y.length-Ge):-1,qe=!!Ne,Je=O&&O.trim()||te||oe,X=be??v,Z=Number(Se??ae),Q=k??_,Ye=`flex-1 min-w-0 text-[18px] leading-[24px] font-medium line-clamp-1 text-text2`,Xe=n===`grid`?d:m?u:d,Ze=Ce(D),Qe=(n===`waterfall`||!P)&&!!Ze,$e=Qe?Ze:``,et=n===`grid`?`flex size-[24px] shrink-0 items-center justify-center ${m?`opacity-100`:`opacity-50`}`:`ml-[8px] flex size-[24px] shrink-0 items-center justify-center ${m?`opacity-100`:`opacity-50`}`,tt=`size-[16px] text-text1`,nt=s({enabled:!m&&n===`grid`,containerRef:Ie,firstRowItemRef:Le,columns:K,itemsCount:Y.length,deps:[n]}),rt=c({enabled:!m&&n===`waterfall`,containerRef:Fe,firstRowRef:U,deps:[n,Y.length]}),it=n===`grid`?nt:rt,at=fe(async()=>{if(m||G.current===J)return;let e=ve(J);if(e){z(e.items),M&&B(e.cursor);return}if(M||I){G.current=J;try{if(ze(),!M){if(!I)return;let e=await de(y);z(e),ye(J,{items:e});return}if(!j)return;let e=await t({page_size:q,tags:j.tagIds.length>0?j.tagIds:void 0,cat_ids:j.catIds.length>0?j.catIds:void 0},{cache:`no-store`}),n=ue(e.data?.videos,q),r=e.data?.cursor;z(n),B(r),ye(J,{items:n,cursor:r})}catch(e){console.error(`推荐位刷新首屏失败(client)`,e)}finally{G.current===J&&(G.current=``),Be()}}},[Be,y,m,M,I,J,q,ze,j,N]);x(()=>{at()},[at]);let ot=fe(async()=>{let n=Ne;if(!(!F||!n||W.current)){W.current=!0,Pe(!0);try{if(!j)return;let r={cursor:n,page_size:q,tags:j.tagIds.length>0?j.tagIds:void 0,cat_ids:j.catIds.length>0?j.catIds:void 0},i=N?await e(r):await t(r),a=Array.isArray(i.data?.videos)?i.data.videos:[],o=i.data?.cursor;a.length>0&&z(e=>e.concat(a)),B(e=>{if(!(!a.length||!o))return o===e?void 0:o})}catch(e){console.error(`推荐位加载下一页失败(client)`,e),B(void 0)}finally{W.current=!1,Pe(!1)}}},[Ne,q,F,j,N]);x(()=>{let e=H.current;if(!e||!F||!qe)return;let t=new IntersectionObserver(e=>{!e[0]?.isIntersecting||V||ot()},{root:null,threshold:0});return t.observe(e),()=>{t.disconnect()}},[ot,qe,V,Y.length,q,F,Ke]),pe(()=>{let e=Fe.current;if(!e||n!==`waterfall`)return;let t=()=>{let t=e.clientWidth||0;De(t>0?(t-15)/2:0)};t();let r=new ResizeObserver(t);return r.observe(e),()=>{r.disconnect()}},[n]);let $=S(()=>n===`waterfall`?ke(Y,We,L):{left:[],right:[]},[L,We,Y,n]),st=S(()=>n===`waterfall`?{left:$.left.map(e=>Oe(e,X,Z,Q)),right:$.right.map(e=>Oe(e,X,Z,Q))}:{left:[],right:[]},[Z,Q,X,n,$.left,$.right]);if(x(()=>{n===`waterfall`&&($.left.length||(U.current.left=null),$.right.length||(U.current.right=null))},[n,$.left.length,$.right.length]),!Y.length)return null;let ct=!m&&Re,lt=!m&&V,ut=it>0?it/2:160;return E(r,{className:`w-full mt-[16px]`,children:[n===`grid`&&E(r,{className:`flex items-center justify-between pl-[16px] pr-0 mb-[16px]`,children:[T(i,{className:Ye,children:Je}),Qe&&T(o,{href:$e,"aria-label":`更多`,className:et,children:T(Xe,{className:tt})})]}),n===`grid`&&E(r,{ref:Ie,className:`relative flex w-full flex-wrap items-start gap-[16px] px-[16px]`,children:[Y.map((e,t)=>{let n=We[t],r=Te(e);return T(`div`,{ref:e=>{t===Ke&&(H.current=e),t<K&&(Le.current[t]=e)},className:`w-[calc((100%-16px)/2)]`,children:T(xe,{item:e,icon:n,index:t,showPlayCount:X&&(r?.showPlayCount??!0),playCountDelta:r?.playCountDelta??Z,showEpisode:r?.showEpisode??Q,widthStyle:{width:`100%`}})},je(e,t))}),ct&&T(r,{className:`absolute inset-0 z-10 bg-black/15 backdrop-blur-[1px] dark:bg-white/10`,"aria-hidden":!0}),ct&&T(r,{className:`absolute left-1/2 -translate-x-1/2 -translate-y-1/2 z-20 pointer-events-none`,style:{top:ut},"aria-hidden":!0,children:T(a,{size:`large`,showLabel:!1,className:`text-theme5`})})]}),n===`waterfall`&&T(ne,{title:Je,moreHref:$e||void 0,moreIcon:Qe?T(Xe,{className:tt}):void 0,titleClassName:Ye,moreLinkClassName:et,columns:st,containerClassName:`relative flex w-full gap-[15px] px-[16px]`,getItemRef:({item:e,column:t,columnIndex:n})=>r=>{e.sourceIndex===Ke&&(H.current=r),n===0&&(U.current[t]=r)},overlay:ct?E(me,{children:[T(r,{className:`absolute inset-0 z-10 bg-black/15 backdrop-blur-[1px] dark:bg-white/10`,"aria-hidden":!0}),T(r,{className:`absolute left-1/2 -translate-x-1/2 -translate-y-1/2 z-20 pointer-events-none`,style:{top:ut},"aria-hidden":!0,children:T(a,{size:`large`,showLabel:!1,className:`text-theme5`})})]}):void 0}),lt&&T(r,{className:`w-full flex justify-center py-[12px]`,children:T(a,{size:`medium`,showLabel:!1,className:`text-theme5`})})]})}function xe({item:e,icon:t,index:n,showPlayCount:r,playCountDelta:i,showEpisode:a,widthStyle:o}){return T(Se,{item:e,icon:t,index:n,showPlayCount:r,playCountDelta:i,showEpisode:a,widthStyle:o})}function Se({item:e,icon:t,index:a,showPlayCount:s,playCountDelta:c,showEpisode:l,widthStyle:u}){let d=j(e),ne=d===`short`?h:te,re=M(e,d),ie=e.name||e?.title||``,ae=e.id?k(e):`#`,_=g({title:ie,badgeImageUrl:z(e,t,a),episodeText:I(e,l),heatText:s?y(b(e),c):``,score:P(e.score)}),v=m(_.topLeftBadgeImageUrl);return T(o,{href:ae,className:`block w-full`,style:u,children:E(me,{children:[E(r,{className:`relative w-full overflow-hidden rounded-[8px] bg-bg3`,style:{aspectRatio:ne},children:[re&&T(n,{src:re,alt:ie||`推荐封面`,fill:!0,objectFit:`cover`,className:`object-cover object-top`}),T(r,{className:`pointer-events-none absolute inset-0 rounded-[8px]`,style:he,"aria-hidden":!0}),v&&T(r,{className:ee,children:T(n,{src:v,alt:`角标`,width:96,height:18,className:p})}),_.topRightScoreText&&T(i,{as:`span`,className:`absolute right-[8px] top-[8px] z-10 shrink-0 text-[14px] leading-[22px] font-semibold text-[#FFC24B]`,children:_.topRightScoreText}),E(r,{className:`absolute left-[8px] right-[8px] bottom-[8px] z-10 flex items-end justify-between gap-[8px]`,children:[T(r,{className:`flex min-w-0 items-center gap-[4px]`,children:_.bottomLeftHeatText&&E(me,{children:[T(f,{className:`h-[16px] w-[16px] shrink-0 text-white`}),T(i,{as:`span`,className:`min-w-0 truncate text-[14px] leading-[20px] text-white`,children:_.bottomLeftHeatText})]})}),_.bottomRightEpisodeText&&T(i,{as:`span`,className:`shrink-0 text-[14px] leading-[20px] text-white`,children:_.bottomRightEpisodeText})]})]}),T(r,{className:`mt-[8px] overflow-hidden`,children:T(i,{as:`h3`,className:`line-clamp-2 text-[16px] leading-[22px] text-[--color-text-white80]`,children:_.title})})]})})}function k(e){let t=encodeURIComponent(e.name||``);return`/video/${e.id||``}/${t}/episode/1`}function Ce(e){return e?e.trim():``}function we(e,t,n){let r=Number(e);return!Number.isFinite(r)||r<=0?t:Math.min(n,Math.floor(r))}function Te(e){return e[le]}function Ee(e){return typeof e==`string`?e:``}function A(e){return typeof e==`string`?e.trim():``}function j(e){return A(e.img_type).toLowerCase()===`long`?`short`:`tall`}function M(e,t){return t===`short`?e.img_x||e.img_y||e?.coverUrl:e.img_y||e.img_x||e?.coverUrl}function N(e,t){return(e.tags?.map(e=>e.name).filter(Boolean).join(` · `)??``)||(t?F(e,!0):``)}function P(e){let t=Number(e);if(!(!Number.isFinite(t)||t<=0))return t>10&&t<=100?t/10:Math.min(t,10)}function F(e,t){return t?L(e)||R(Number(e.duration||0)):``}function I(e,t){return t?L(e):``}function L(e){if(!De(e))return``;let t=e.update_status===`0`,n=Number(e.episode_cnt||e.links?.length||0);return n>0?`${t?`更新至`:`全`}${n}集`:``}function De(e){if(Number(e.type??0)===2)return!0;let t=Number(e.episode_cnt||e.links?.length||0);return Number.isFinite(t)&&t>1}function R(e){if(!Number.isFinite(e)||e<=0)return``;let t=Math.floor(e),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60,a=e=>String(e).padStart(2,`0`);return n>0?`${a(n)}:${a(r)}:${a(i)}`:`${a(r)}:${a(i)}`}function z(e,t,n){return Ee(e.badge_url)||Ee(t?.material_url)||``}function Oe(e,t,n,r){let i=j(e.item),a=M(e.item,i),o=e.item.name||e.item?.title||``,s=e.item.id?k(e.item):`#`,c=z(e.item,e.icon,e.index),l=F(e.item,r),u=N(e.item,r),d=t?y(b(e.item),n):``,f=P(e.item.score);return{key:je(e.item,e.index),sourceIndex:e.index,href:s,cardKind:i,coverUrl:a,title:o,badgeImageUrl:c,episodeText:l,metaPrimaryText:u,heatText:d,score:f}}function ke(e,t,n){let r=[],i=[],a=n<=0,o=0,s=0;return e.forEach((e,c)=>{let l=t[c];if(a){c%2==0?r.push({item:e,icon:l,index:c}):i.push({item:e,icon:l,index:c});return}let u=Ae(n,e);o<=s?(r.push({item:e,icon:l,index:c}),o+=u):(i.push({item:e,icon:l,index:c}),s+=u)}),{left:r,right:i}}function Ae(e,t){return e?(j(t)===`tall`?216:142)+16:0}function je(e,t){return e.id?`home-recommend-${e.id}-${t}`:`home-recommend-${t}`}export{be as default};
|
package/dist/components/biz/business/home-recommend/shared/home-recommend-default-config.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
const e=`推荐`,t=1,n=2,r=10,i=6,a=!
|
|
2
|
+
const e=`推荐`,t=1,n=2,r=10,i=6,a=!0,o=0,s=!0,c=!1;function l(e){return e===!0?`manual-with-video-detail`:`popular`}export{c as HOME_RECOMMEND_DEFAULT_ENABLE_INFINITE,n as HOME_RECOMMEND_DEFAULT_GRID_COLUMNS,t as HOME_RECOMMEND_DEFAULT_GRID_ROWS,o as HOME_RECOMMEND_DEFAULT_PLAY_COUNT_DELTA,s as HOME_RECOMMEND_DEFAULT_SHOW_EPISODE,a as HOME_RECOMMEND_DEFAULT_SHOW_PLAY_COUNT,e as HOME_RECOMMEND_DEFAULT_TITLE,i as HOME_RECOMMEND_MAX_GRID_COLUMNS,r as HOME_RECOMMEND_MAX_GRID_ROWS,l as resolveHomeRecommendFeedMode};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
import{HOME_RECOMMEND_DEFAULT_GRID_COLUMNS as e,HOME_RECOMMEND_DEFAULT_GRID_ROWS as t,HOME_RECOMMEND_DEFAULT_TITLE as n,HOME_RECOMMEND_MAX_GRID_COLUMNS as r,HOME_RECOMMEND_MAX_GRID_ROWS as i}from"./home-recommend-default-config.mjs";const a=`/static/components-thumb/items_cover.png`,o=`__homeRecommendCardConfig`,s=[`东野圭吾作品:11字谜案`,`诡异纸嫁衣:深夜回魂`,`夜行者档案:无声证词`,`狐面新娘:冥婚谜局`,`赤焰长歌:风雪诛心`,`山海禁术:九尾秘闻`],c=[`烧脑悬疑`,`民俗怪谈`,`悬疑推理`,`东方奇幻`,`古风权谋`,`奇诡冒险`],l=[8.9,9.1,8.7,9.3,8.8,9],u=[``,`独播`,``,`巅峰榜·历史上榜`,``,`独播`],d=Array.from({length:60},(e,t)=>{let n=t%2==0,r=s[t%s.length],i=c[t%c.length],o=l[t%l.length],d=u[t%u.length],f=d?[{id:`preview-tag-${t+1}`,name:d}]:void 0,p={browse_cnt:2242e4+t*186e3};return{id:`preview-recommend-${t+1}`,name:r,img_y:a,img_x:a,img_type:t%3==1?`long`:`short`,cat_name:i,score:o,tags:f,type:n?2:1,duration:n?0:60*(18+t),episode_cnt:n?24+t%3*6:0,static:p}});function f({variant:e,enableInfinite:t,rows:n,columns:r,items:i}){let a=Array.isArray(i)?i.length:0;return e===`grid`?a>0?a:Math.max(g(n,r),2,a):t?Math.max(8,a):e===`waterfall`?Math.max(4,a):Math.max(2,a)}function p(e){let t=Math.max(1,Math.floor(e));return Array.from({length:t},(e,t)=>{let n=d[t%d.length];return{...n,id:`preview-recommend-${t+1}`,name:n.name}})}function m(e,t,n){return t.length?e.map((e,r)=>{let i=t[r];if(!i)return e;let a=(i.contentId?n.get(i.contentId):void 0)||e,s=i.titleMode===`custom`?i.title?.trim()||a.name||e.name||``:a.name||e.name||``,c=i.coverUrl?.trim()||``,l=i.coverMode===`content`,u=l?a.img_y||a.img_x||e.img_y||e.img_x||c||``:c||a.img_y||a.img_x||e.img_y||e.img_x||``,d=l?a.img_x||a.img_y||e.img_x||e.img_y||c||``:c||a.img_x||a.img_y||e.img_x||e.img_y||``,f=a.badge_url||e.badge_url||``,p=i.badge_url??f,m=h(i,a),g=i.is_ad===!0;return{...e,...a,id:a.id||e.id||`preview-recommend-${r+1}`,name:s,img_y:u,img_x:d,is_ad:g,ad_advertise_url:g?i.ad_advertise_url?.trim()||``:void 0,ad_advertise_icon:g?i.ad_advertise_icon?.trim()||u||d||``:void 0,badge_url:p||void 0,[o]:m}}):e}function h(e,t){let n=t[o],r={showPlayCount:e.showPlayCount??n?.showPlayCount,playCountDelta:e.playCountDelta??n?.playCountDelta,showEpisode:e.showEpisode??n?.showEpisode};if(!(r.showPlayCount===void 0&&r.playCountDelta===void 0&&r.showEpisode===void 0))return r}function g(n,a){return _(n,t,1,i)*_(a,e,1,r)}function _(e,t,n,r){let i=Number(e);return Number.isFinite(i)?Math.min(r,Math.max(n,Math.floor(i))):t}function v({variant:e,schemaTitle:t,enableInfinite:r,
|
|
2
|
+
import{HOME_RECOMMEND_DEFAULT_GRID_COLUMNS as e,HOME_RECOMMEND_DEFAULT_GRID_ROWS as t,HOME_RECOMMEND_DEFAULT_TITLE as n,HOME_RECOMMEND_MAX_GRID_COLUMNS as r,HOME_RECOMMEND_MAX_GRID_ROWS as i}from"./home-recommend-default-config.mjs";const a=`/static/components-thumb/items_cover.png`,o=`__homeRecommendCardConfig`,s=[`东野圭吾作品:11字谜案`,`诡异纸嫁衣:深夜回魂`,`夜行者档案:无声证词`,`狐面新娘:冥婚谜局`,`赤焰长歌:风雪诛心`,`山海禁术:九尾秘闻`],c=[`烧脑悬疑`,`民俗怪谈`,`悬疑推理`,`东方奇幻`,`古风权谋`,`奇诡冒险`],l=[8.9,9.1,8.7,9.3,8.8,9],u=[``,`独播`,``,`巅峰榜·历史上榜`,``,`独播`],d=Array.from({length:60},(e,t)=>{let n=t%2==0,r=s[t%s.length],i=c[t%c.length],o=l[t%l.length],d=u[t%u.length],f=d?[{id:`preview-tag-${t+1}`,name:d}]:void 0,p={browse_cnt:2242e4+t*186e3};return{id:`preview-recommend-${t+1}`,name:r,img_y:a,img_x:a,img_type:t%3==1?`long`:`short`,cat_name:i,score:o,tags:f,type:n?2:1,duration:n?0:60*(18+t),episode_cnt:n?24+t%3*6:0,static:p}});function f({variant:e,enableInfinite:t,rows:n,columns:r,items:i}){let a=Array.isArray(i)?i.length:0;return e===`grid`?a>0?a:Math.max(g(n,r),2,a):t?Math.max(8,a):e===`waterfall`?Math.max(4,a):Math.max(2,a)}function p(e){let t=Math.max(1,Math.floor(e));return Array.from({length:t},(e,t)=>{let n=d[t%d.length];return{...n,id:`preview-recommend-${t+1}`,name:n.name}})}function m(e,t,n){return t.length?e.map((e,r)=>{let i=t[r];if(!i)return e;let a=(i.contentId?n.get(i.contentId):void 0)||e,s=i.titleMode===`custom`?i.title?.trim()||a.name||e.name||``:a.name||e.name||``,c=i.coverUrl?.trim()||``,l=i.coverMode===`content`,u=l?a.img_y||a.img_x||e.img_y||e.img_x||c||``:c||a.img_y||a.img_x||e.img_y||e.img_x||``,d=l?a.img_x||a.img_y||e.img_x||e.img_y||c||``:c||a.img_x||a.img_y||e.img_x||e.img_y||``,f=a.badge_url||e.badge_url||``,p=i.badge_url??f,m=h(i,a),g=i.is_ad===!0;return{...e,...a,id:a.id||e.id||`preview-recommend-${r+1}`,name:s,img_y:u,img_x:d,is_ad:g,ad_advertise_url:g?i.ad_advertise_url?.trim()||``:void 0,ad_advertise_icon:g?i.ad_advertise_icon?.trim()||u||d||``:void 0,badge_url:p||void 0,[o]:m}}):e}function h(e,t){let n=t[o],r={showPlayCount:e.showPlayCount??n?.showPlayCount,playCountDelta:e.playCountDelta??n?.playCountDelta,showEpisode:e.showEpisode??n?.showEpisode};if(!(r.showPlayCount===void 0&&r.playCountDelta===void 0&&r.showEpisode===void 0))return r}function g(n,a){return _(n,t,1,i)*_(a,e,1,r)}function _(e,t,n,r){let i=Number(e);return Number.isFinite(i)?Math.min(r,Math.max(n,Math.floor(i))):t}function v({variant:e,schemaTitle:t,enableInfinite:r,dynamicRecommendEnabled:i,rows:a,columns:o,items:s}){let c=new Map,l=i?[]:Array.isArray(s)?s.filter(Boolean):[],u=m(p(f({variant:e,enableInfinite:r,rows:a,columns:o,items:l})),l,c);return{title:t&&t.trim()||n,list:u,icons:[],cursor:``,show_style:void 0}}export{o as HOME_RECOMMEND_CARD_CONFIG_FIELD,v as buildHomeRecommendEditorPreviewData};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
function e(e){if(typeof e==`boolean`)return e;if(typeof e==`number`)return e===1;if(typeof e==`string`){let t=e.trim().toLowerCase();return t===`true`||t===`1`||t===`y`||t===`yes`||t===`on`}return!1}function
|
|
2
|
+
import{normalizeHomeRecommendSmartLayout as e}from"./home-recommend-smart-layout.mjs";function t(e){let t=e;if(t.smartLayout!==void 0&&t.smartLayout!==null)return t.smartLayout;let n=t.recommendContentConfig;if(typeof n==`object`&&n)return n;let r=t.enabled,i=t.categories,a=t.tags;if(typeof r==`boolean`&&Array.isArray(i)&&Array.isArray(a))return t}function n(e){if(typeof e==`boolean`)return e;if(typeof e==`number`)return e===1;if(typeof e==`string`){let t=e.trim().toLowerCase();return t===`true`||t===`1`||t===`y`||t===`yes`||t===`on`}return!1}function r(r){let i=typeof r.catId==`string`?r.catId.trim():``,a=Array.isArray(r.items)?r.items.filter(Boolean):r.items,o=e(t(r)),s=o?.enabled===!0?n(r.enableInfinite):!1;return{...r,catId:i,enableInfinite:s,items:a,smartLayout:o}}export{r as normalizeHomeRecommendRuntimeProps};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
import{pContentGetPopularVideoList as
|
|
2
|
+
import{pContentGetNewstVideoList as e,pContentGetPopularVideoList as t}from"../../../../../service/generated/client.mjs";import{resolveHomeRecommendFeedMode as n}from"./home-recommend-default-config.mjs";import{HOME_RECOMMEND_CARD_CONFIG_FIELD as r}from"./home-recommend-preview.mjs";import{limitPopularVideoPageItems as i,resolvePopularVideoPageSize as a}from"./home-recommend-smart-tag.mjs";import{batchGetHomeRecommendVideoDetailMap as o}from"./home-recommend-video-detail.mjs";function s(e){return typeof e==`string`?e.trim():``}function c(e){return typeof e==`string`?e.trim():``}function l(e){return Array.isArray(e)?e.map(e=>c(e)).filter(Boolean):[]}function u(e){let t=Number(e);if(!(!Number.isFinite(t)||t<0))return t}function d(e,t){let n=e,r=s(n.video_id||e.id||e.mid)||t,i=u(n.play_count)??u(e.browse_count),a=u(n.like_count),o=u(n.collect_count),c=(Array.isArray(n.episodes)?n.episodes.length:0)||(Array.isArray(e.video_episodes)?e.video_episodes.length:0)||(Array.isArray(e.links)?e.links.length:0),l=i!==void 0||a!==void 0||o!==void 0?{browse_cnt:i,like_cnt:a,collect_cnt:o}:void 0;return{id:r,mid:s(e.mid),name:e.name||``,img_x:e.img_x||``,img_y:e.img_y||``,img_type:e.img_type,cat_id:e.cat_id,cat_name:e.cat_name,status:e.status,status_text:e.status_text,show_at:e.show_at,update_status:e.update_status,description:e.description,language:e.language,director:e.director,issue_date:e.issue_date,actor:e.actor,up_user:e.up_user,time:e.time,money:e.money,source_username:e.source_username,task_id:e.task_id,error_msg:e.error_msg,file_status:e.file_status,score:u(e.score)??void 0,duration:u(e.duration)??void 0,episode_cnt:c>0?c:void 0,type:e.is_more_link?2:1,static:l}}function f(e){let t={showPlayCount:e.showPlayCount,playCountDelta:e.playCountDelta,showEpisode:e.showEpisode};if(!(t.showPlayCount===void 0&&t.playCountDelta===void 0&&t.showEpisode===void 0))return t}function p(e,t){let n=c(t.coverUrl),i=t.coverMode===`content`?e.img_y||e.img_x||n||``:n||e.img_y||e.img_x||``,a=c(t.title),o=t.titleMode===`custom`||a&&t.titleMode!==`content`?a:e.name||``,s=c(t.description),l=c(t.badge_url),u=f(t);return{...e,name:o||e.name,img_y:i||e.img_y||e.img_x,img_x:i||e.img_x||e.img_y,description:s||e.description,badge_url:l||e.badge_url,[r]:u}}function m(e){let t=s(e.contentId),n=c(e.coverUrl),r=c(e.title),i=c(e.description);return{id:t,mid:t,name:r||``,img_x:n,img_y:n,description:i,type:1}}async function h(e){let t=(Array.isArray(e)?e:[]).map(e=>({...e,contentId:s(e.contentId)})),n=t.filter(e=>!!e.contentId).map(e=>({id:e.contentId})),r=n.length?await o(n):new Map;return t.map(e=>{let t=e.contentId?r.get(e.contentId):void 0;return p(t?d(t,e.contentId||``):m(e),e)})}async function g(e){let t=(Array.isArray(e)?e:[]).map(e=>({...e,contentId:s(e.contentId)})).filter(e=>!!e.contentId);if(!t.length)return[];let n=await o(t.map(e=>({id:e.contentId})));return t.map(e=>{let t=n.get(e.contentId||``);return p(t?d(t,e.contentId||``):m(e),e)})}async function _(t,n,r){let i=a(t),o=l(n),u=(Array.isArray(r)?r:[]).map(e=>c(e)).filter(Boolean);try{let t=[],n=new Set,r=new Set,a=``;for(;t.length<i;){let c=a||`__first__`;if(r.has(c))break;r.add(c);let l=await e({cursor:a||void 0,page_size:i-t.length,tags:o.length>0?o:void 0,cat_ids:u.length>0?u:void 0}),d=Array.isArray(l.data?.videos)?l.data.videos:[];d.forEach(e=>{let r=s(e?.id||e?.mid);r&&n.has(r)||(r&&n.add(r),t.push(e))});let f=l.data?.cursor??``;if(!f||!d.length){a=``;break}a=f}return{videos:t.slice(0,i),nextCursor:a,loaded:!0}}catch(e){return console.error(`推荐位获取最新视频失败(server)`,e),{videos:[],nextCursor:``,loaded:!1}}}async function v(e,n,r){let a=Math.max(1,Math.floor(Number(e)||16)),o=l(n),u=(Array.isArray(r)?r:[]).map(e=>c(e)).filter(Boolean);try{let e=[],n=new Set,r=new Set,c=``;for(;e.length<a;){let i=c||`__first__`;if(r.has(i))break;r.add(i);let l=await t({cursor:c||void 0,page_size:a-e.length,tags:o.length>0?o:void 0,cat_ids:u.length>0?u:void 0}),d=Array.isArray(l.data?.videos)?l.data.videos:[];d.forEach(t=>{let r=s(t?.id||t?.mid);r&&n.has(r)||(r&&n.add(r),e.push(t))});let f=l.data?.cursor??``;if(!f||!d.length){c=``;break}c=f}return{videos:i(e,a),nextCursor:c,loaded:!0}}catch(e){return console.error(`推荐位获取热门视频失败(server)`,e),{videos:[],nextCursor:``,loaded:!1}}}async function y({enableInfinite:e,pageSize:t=16,items:r=[],smartLayout:i}){let a=i?.enabled===!0,o=n(a),s=Array.isArray(r)&&r.length>0,c={list:[],icons:[],title:``,cursor:``,show_style:void 0};if(!a)return s?{feedMode:o,data:{...c,list:await h(r),cursor:``}}:{feedMode:o,data:{...c,list:[],cursor:``}};if(o===`manual-with-video-detail`&&i){let n=isHomeRecommendLatestSortRule(i.sortRule)?await _(t,i.tagIds,i.catIds):await v(t,i.tagIds,i.catIds);if(n.loaded){let t=e===!0;return{feedMode:o,data:{...c,list:n.videos,cursor:t?n.nextCursor:``}}}try{let e=await g(r);return{feedMode:o,data:{...c,list:e,cursor:``}}}catch(e){return console.error(`推荐位智能铺设补齐视频详情失败(server)`,e),{feedMode:o,data:{...c,list:[],cursor:``}}}}return{feedMode:o,data:c}}export{y as resolveHomeRecommendServerData};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
|
|
2
|
+
import e from"zod";const t=e.object({enabled:e.boolean().optional(),categories:e.array(e.any()).optional(),tags:e.array(e.any()).optional(),sortRule:e.string().optional(),contentForms:e.array(e.string()).optional()}).passthrough();function n(e){return String(e??``).trim().toLowerCase()===`latest`}function r(e){if(!e||typeof e!=`object`)return``;let t=e,n=t.ID!==void 0&&t.ID!==null?t.ID:t.id;return n==null?``:String(n).trim()}function i(e){if(!e||typeof e!=`object`)return``;let t=e.name;return t==null?``:String(t).trim()}function a(e){if(e==null)return;let n=e;if(typeof e==`string`){let t=e.trim();if(!t)return;try{n=JSON.parse(t)}catch{return}}if(typeof n!=`object`||!n||Array.isArray(n))return;let a=t.safeParse(n);if(!a.success)return;let o=a.data,s=Array.isArray(o.categories)?o.categories.map(r).filter(Boolean):[],c=Array.isArray(o.tags)?o.tags.map(i).filter(Boolean):[];return{enabled:o.enabled===!0,tagIds:c,catIds:s,sortRule:typeof o.sortRule==`string`?o.sortRule:void 0,contentForms:Array.isArray(o.contentForms)?o.contentForms.map(e=>String(e||``).trim()).filter(Boolean):void 0}}export{t as homeRecommendSmartLayoutSchema,n as isHomeRecommendLatestSortRule,a as normalizeHomeRecommendSmartLayout};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{useRouter as e}from"../../../../utils/use-compatible-router.mjs";import{Box as t}from"../../../ui/box.mjs";import{Text as n}from"../../../ui/text.mjs";import{useCallback as r,useId as i,useMemo as a,useRef as o,useState as s}from"react";import{jsx as c,jsxs as l}from"react/jsx-runtime";import{usePathname as u,useSearchParams as d}from"next/navigation";const f=[];function p(e,t){if(e.length<=t)return[...e];let n=[...e];for(let e=0;e<t;e++){let t=e+Math.floor(Math.random()*(n.length-e));[n[e],n[t]]=[n[t],n[e]]}return n.slice(0,t)}function m({className:e=``}){let t=i().replace(/:/g,``);return l(`svg`,{viewBox:`0 0 62.4481 14.192`,fill:`none`,"aria-hidden":!0,className:e,children:[l(`g`,{children:[c(`path`,{d:`M50.7201 4V3.04H47.9841V0.768H50.7201V0H53.3281V0.768H57.1201V0H59.7441V0.768H62.4481V3.04H59.7441V4H57.1201V3.04H53.3281V4H50.7201ZM48.1281 8.32C48.4587 8.32 48.8054 8.27733 49.1681 8.192C49.5307 8.096 49.8934 7.968 50.2561 7.808C50.6294 7.63733 50.9867 7.43467 51.3281 7.2C51.6801 6.95467 52.0054 6.688 52.3041 6.4H48.3041V4.464H53.5681C53.7067 4.112 53.7761 3.72267 53.7761 3.296H56.4641C56.4641 3.68 56.4107 4.06933 56.3041 4.464H62.1121V6.4H55.5041C55.4401 6.51733 55.3707 6.62933 55.2961 6.736C55.2321 6.832 55.1574 6.93867 55.0721 7.056H61.1841V7.536C61.1841 7.94133 61.1147 8.33067 60.9761 8.704C60.8481 9.07733 60.5921 9.39733 60.2081 9.664H62.3041V11.488H59.2801V11.696C59.2801 12.1653 59.2267 12.5547 59.1201 12.864C59.0134 13.1733 58.8534 13.4187 58.6401 13.6C58.4267 13.792 58.1601 13.9253 57.8401 14C57.5201 14.0747 57.1521 14.112 56.7361 14.112H54.7361V12.432H55.2481C55.5894 12.4213 55.8561 12.4 56.0481 12.368C56.2507 12.336 56.4001 12.288 56.4961 12.224C56.6027 12.16 56.6721 12.0853 56.7041 12C56.7361 11.9147 56.7521 11.8133 56.7521 11.696V11.488H53.2161V9.664H56.7521V9.44C57.2321 9.44 57.6267 9.39733 57.9361 9.312C58.2454 9.216 58.4747 9.04 58.6241 8.784H54.4641V7.856C54.1547 8.208 53.8187 8.544 53.4561 8.864C53.1041 9.17333 52.7254 9.456 52.3201 9.712V14.176H49.7761V10.784C49.2534 10.912 48.7041 10.976 48.1281 10.976V8.32Z`,fill:`url(#${t})`}),c(`path`,{d:`M40.3361 0.0159912C40.3361 0.805325 40.2614 1.53066 40.1121 2.19199H46.3841V4.28799H44.3361V5.45599H46.1601V7.31199H44.3361V8.47999H46.1601V10.352H44.3361V11.648H46.4961V13.968H40.1121V14.192H37.5681V5.63199C37.3441 5.69599 37.1201 5.72799 36.8961 5.72799V2.92799C37.2694 2.92799 37.5361 2.68799 37.6961 2.20799C37.8561 1.72799 37.9361 0.997325 37.9361 0.0159912H40.3361ZM33.2641 0.0159912H35.6641V2.20799H36.6721V4.57599H35.6641V6.20799L36.6881 6.09599V8.47999L35.6641 8.62399V10.992C35.6641 11.408 35.6427 11.8027 35.6001 12.176C35.5574 12.56 35.4507 12.8907 35.2801 13.168C35.1201 13.456 34.8801 13.68 34.5601 13.84C34.2401 14.0107 33.8081 14.096 33.2641 14.096H32.1921V11.872H32.6241C32.9014 11.872 33.0774 11.7973 33.1521 11.648C33.2267 11.488 33.2641 11.184 33.2641 10.736V8.97599L31.9841 9.15199V6.63999L33.2641 6.49599V4.57599H32.0641V2.20799H33.2641V0.0159912ZM41.6001 0.0159912H44.4161L44.4641 1.90399H41.6481L41.6001 0.0159912ZM40.1121 5.45599H41.8881V4.28799H40.1121V5.45599ZM40.1121 8.47999H41.8881V7.31199H40.1121V8.47999ZM40.1121 11.648H41.8881V10.352H40.1121V11.648Z`,fill:`url(#${t})`}),c(`path`,{d:`M16.6721 2.49599L16.6081 0.0159912H19.8401L19.9041 2.49599H16.6721ZM24.9601 14.192V11.68H25.7121C26.0427 11.68 26.2987 11.6587 26.4801 11.616C26.6721 11.5733 26.8161 11.4987 26.9121 11.392C27.0081 11.2747 27.0667 11.12 27.0881 10.928C27.1094 10.736 27.1201 10.4907 27.1201 10.192V2.68799H20.8001V0.175991H29.9521V10.448C29.9521 11.2267 29.8827 11.8613 29.7441 12.352C29.6161 12.8427 29.3921 13.2213 29.0721 13.488C28.7521 13.7653 28.3201 13.952 27.7761 14.048C27.2321 14.144 26.5494 14.192 25.7281 14.192H24.9601ZM16.5441 14.192V3.23199H19.3761V14.192H16.5441Z`,fill:`url(#${t})`}),c(`path`,{d:`M6.48499e-05 7.18399V5.10399L1.87206 5.02399V3.82399H0.176065V1.45599H1.87206V0.0159912H4.25607V1.45599H6.00007V3.82399H4.25607V4.91199L5.84007 4.84799V6.92799L4.25607 6.99199V8.36799C4.25607 8.73066 4.22407 9.06132 4.16007 9.35999C4.09607 9.65866 3.97873 9.91466 3.80806 10.128C3.64807 10.3413 3.41873 10.5067 3.12007 10.624C2.83207 10.7413 2.45873 10.8 2.00006 10.8H0.592065V8.68799H1.05606C1.24806 8.68799 1.3974 8.66666 1.50406 8.62399C1.6214 8.58132 1.70673 8.52266 1.76006 8.44799C1.8134 8.36266 1.8454 8.26666 1.85606 8.15999C1.86673 8.04266 1.87206 7.91999 1.87206 7.79199V7.10399L6.48499e-05 7.18399ZM13.8081 10.864C12.7627 10.864 12.0054 10.624 11.5361 10.144C11.0774 9.66399 10.8481 8.86933 10.8481 7.75999V3.82399H9.84007V4.87999V5.02399H10.5121V6.68799H9.76007C9.6854 7.46666 9.55206 8.12266 9.36006 8.65599C9.17873 9.18932 8.9174 9.62133 8.57607 9.95199C8.2454 10.2827 7.8294 10.5227 7.32807 10.672C6.82673 10.8213 6.2294 10.896 5.53607 10.896V8.79999C5.8774 8.79999 6.1654 8.76799 6.40007 8.70399C6.6454 8.63999 6.84273 8.52799 6.99207 8.36799C7.1414 8.20799 7.25873 7.99466 7.34407 7.72799C7.4294 7.45066 7.48807 7.10399 7.52007 6.68799H6.35207V5.02399H7.58406V4.84799V3.82399H6.44807V1.45599H7.60007V0.0159912H9.85606V1.45599H13.2321V7.24799C13.2321 7.66399 13.2747 7.92533 13.3601 8.03199C13.4561 8.13866 13.6321 8.19199 13.8881 8.19199H14.3521V10.864H13.8081ZM0.144065 14.192L0.256065 11.232H3.21606L3.10406 14.192H0.144065ZM11.3921 14.192L11.2481 11.232H14.2241L14.3681 14.192H11.3921ZM4.17606 14.192L4.03207 11.296H6.73607L6.86407 14.192H4.17606ZM7.77607 14.192L7.63207 11.296H10.3841L10.5121 14.192H7.77607Z`,fill:`url(#${t})`})]}),c(`defs`,{children:l(`linearGradient`,{id:t,x1:`33.7161`,y1:`-4.59601`,x2:`60.7161`,y2:`18.404`,gradientUnits:`userSpaceOnUse`,children:[c(`stop`,{stopColor:`#E914E9`}),c(`stop`,{offset:`1`,stopColor:`#6C43EE`})]})})]})}function h({className:e=``}){return c(`svg`,{viewBox:`0 0 16.6667 16.6667`,fill:`none`,"aria-hidden":!0,className:e,children:c(`path`,{d:`M8.33333 1.66667C6.04287 1.66667 4.0209 2.82188 2.82036 4.58333H5V6.25H0V1.25H1.66667V3.3328C3.18651 1.30972 5.60637 0 8.33333 0C12.9357 0 16.6667 3.73096 16.6667 8.33333H15C15 4.65143 12.0152 1.66667 8.33333 1.66667ZM1.66667 8.33333C1.66667 12.0152 4.65143 15 8.33333 15C10.6238 15 12.6458 13.8447 13.8463 12.0833H11.6667V10.4167H16.6667V15.4167H15V13.3338C13.4802 15.3569 11.0603 16.6667 8.33333 16.6667C3.73096 16.6667 0 12.9357 0 8.33333H1.66667Z`,fill:`currentColor`})})}function g({variant:e,className:t=``}){let n=i().replace(/:/g,``),r=e===`gold`?`#FFF047`:`#D7D7D7`;return l(`svg`,{viewBox:`0 0 10 8`,fill:`none`,"aria-hidden":!0,className:t,children:[c(`path`,{d:`M0.72289 1.44405L2.67531 2.6057L4.62168 0.173795C4.77092 -0.0126857 5.06132 -0.0558774 5.27027 0.0773202C5.31202 0.103935 5.34852 0.136533 5.37837 0.173795L7.32476 2.6057L9.27714 1.44405C9.49083 1.31693 9.77946 1.36845 9.92192 1.55913C9.98315 1.64113 10.0097 1.73991 9.99682 1.83779L9.23283 7.63352C9.20526 7.84249 9.00682 8 8.77105 8H1.22899C0.99323 8 0.794784 7.84249 0.767236 7.63352L0.00322932 1.83779C-0.0267734 1.61019 0.155642 1.40398 0.410663 1.3772C0.520333 1.36569 0.631013 1.38938 0.72289 1.44405ZM5.00005 5.51033C5.51357 5.51033 5.92993 5.13878 5.92993 4.68043C5.92993 4.22209 5.51357 3.85054 5.00005 3.85054C4.48647 3.85054 4.07016 4.22209 4.07016 4.68043C4.07016 5.13878 4.48647 5.51033 5.00005 5.51033Z`,fill:`url(#${n})`}),c(`defs`,{children:l(`linearGradient`,{id:n,x1:`5`,y1:`0`,x2:`5`,y2:`8`,gradientUnits:`userSpaceOnUse`,children:[c(`stop`,{stopColor:r}),c(`stop`,{offset:`1`,stopColor:r,stopOpacity:`0`})]})})]})}function _(i){let{title:_,displayCount:v=4,items:y=f,onItemClick:b,mode:x=`renderer`}=i,S=x===`editor`,C=e(),w=u(),T=d(),E=_.trim()||`热门推荐`,D=Math.max(1,v||0),[O,k]=s(0),[A,j]=s(!1),M=o(null),N=r(()=>{A||(j(!0),M.current&&clearTimeout(M.current),M.current=setTimeout(()=>{k(e=>e+1),j(!1),M.current=null},500))},[A]),P=a(()=>p(y,D),[D,y,O]);if(y.length===0)return null;let F=e=>{if(b){b(e);return}let t=new URLSearchParams(T.toString());t.set(`q`,e);let n=w.includes(`/search-result`)?w:`/search-result`;C.push(`${n}?${t.toString()}`)};return l(t,{className:`relative mx-[16px] mt-[24px] overflow-hidden rounded-[12px] bg-black${S?` pointer-events-none`:``}`,children:[c(t,{className:`pointer-events-none absolute inset-0 rounded-[12px]`,style:{background:`linear-gradient(180deg, #9756E3 0%, #6C43EE 100%), linear-gradient(180deg, rgba(255,30,255,0.7) 0%, rgba(108,67,238,0) 100%)`,padding:`0.5px`,WebkitMask:`linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)`,WebkitMaskComposite:`xor`,mask:`linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)`,maskComposite:`exclude`}}),c(t,{className:`pointer-events-none absolute inset-x-0 top-0 rounded-t-[12px] mix-blend-plus-lighter`,style:{height:`259px`,background:`linear-gradient(180deg, rgba(151,86,227,0.4) 0%, rgba(151,86,227,0) 85%)`}}),l(t,{className:`relative px-[24px] pb-[18px] pt-[22px]`,children:[l(t,{className:`flex items-center justify-between`,children:[E===`热门推荐`?c(m,{className:`h-[14.192px] w-[62.448px] shrink-0`}):c(n,{className:`shrink-0 bg-[linear-gradient(90deg,#E914E9_0%,#6C43EE_100%)] bg-clip-text font-["PingFang_SC"] text-[16px] font-semibold leading-none text-transparent`,children:E}),c(`button`,{type:`button`,"aria-label":`刷新`,className:`flex h-[20px] w-[20px] shrink-0 items-center justify-center text-white/40 transition-opacity active:opacity-70`,onClick:N,children:c(h,{className:`h-[16.6667px] w-[16.6667px] ${A?`animate-spin`:``}`})})]}),c(t,{className:`mt-[7px]`,children:P.map((e,r)=>{let i=r<3,a=r<2,o=i?`text-[#C922EF]`:`text-white/70`,s=i?`text-white/90`:`text-white/70`;return l(t,{children:[l(`button`,{type:`button`,className:`flex h-[48px] w-full items-center gap-[4px] text-left transition-opacity active:opacity-70`,onClick:()=>F(e.label),children:[l(t,{className:`relative flex h-[24px] w-[20px] shrink-0 items-end justify-center`,children:[a?c(g,{variant:r===0?`gold`:`silver`,className:`absolute left-1/2 top-0 h-[8px] w-[10px] -translate-x-1/2`}):null,c(n,{className:`font-['DIN_Black'] text-[14px] font-normal not-italic leading-[24px] ${o}`,children:r+1})]}),c(n,{className:`min-w-0 flex-1 truncate font-['PingFang_SC'] text-[14px] font-normal not-italic leading-[24px] ${s}`,children:e.label})]}),r<P.length-1?c(t,{className:`h-px w-full bg-white/[0.08]`}):null]},`${e.label}-${r}`)})})]})]})}export{_ as HotRecommendClient};
|
|
2
|
+
"use client";import{useUserStore as e}from"../../../../store/modules/user-store.mjs";import{gContentGetRecommendSearchList as t}from"../../../../service/generated/client.mjs";import{useRouter as n}from"../../../../utils/use-compatible-router.mjs";import{Box as r}from"../../../ui/box.mjs";import{Text as i}from"../../../ui/text.mjs";import{useRequest as a}from"../../../../hooks/query/use-query.mjs";import{useCallback as o,useId as s,useMemo as c,useRef as l,useState as u}from"react";import{jsx as d,jsxs as f}from"react/jsx-runtime";import{usePathname as p,useSearchParams as m}from"next/navigation";import{useShallow as h}from"zustand/react/shallow";function g(e,t){if(e.length<=t)return[...e];let n=[...e];for(let e=0;e<t;e++){let t=e+Math.floor(Math.random()*(n.length-e));[n[e],n[t]]=[n[t],n[e]]}return n.slice(0,t)}function _({className:e=``}){let t=s().replace(/:/g,``);return f(`svg`,{viewBox:`0 0 62.4481 14.192`,fill:`none`,"aria-hidden":!0,className:e,children:[f(`g`,{children:[d(`path`,{d:`M50.7201 4V3.04H47.9841V0.768H50.7201V0H53.3281V0.768H57.1201V0H59.7441V0.768H62.4481V3.04H59.7441V4H57.1201V3.04H53.3281V4H50.7201ZM48.1281 8.32C48.4587 8.32 48.8054 8.27733 49.1681 8.192C49.5307 8.096 49.8934 7.968 50.2561 7.808C50.6294 7.63733 50.9867 7.43467 51.3281 7.2C51.6801 6.95467 52.0054 6.688 52.3041 6.4H48.3041V4.464H53.5681C53.7067 4.112 53.7761 3.72267 53.7761 3.296H56.4641C56.4641 3.68 56.4107 4.06933 56.3041 4.464H62.1121V6.4H55.5041C55.4401 6.51733 55.3707 6.62933 55.2961 6.736C55.2321 6.832 55.1574 6.93867 55.0721 7.056H61.1841V7.536C61.1841 7.94133 61.1147 8.33067 60.9761 8.704C60.8481 9.07733 60.5921 9.39733 60.2081 9.664H62.3041V11.488H59.2801V11.696C59.2801 12.1653 59.2267 12.5547 59.1201 12.864C59.0134 13.1733 58.8534 13.4187 58.6401 13.6C58.4267 13.792 58.1601 13.9253 57.8401 14C57.5201 14.0747 57.1521 14.112 56.7361 14.112H54.7361V12.432H55.2481C55.5894 12.4213 55.8561 12.4 56.0481 12.368C56.2507 12.336 56.4001 12.288 56.4961 12.224C56.6027 12.16 56.6721 12.0853 56.7041 12C56.7361 11.9147 56.7521 11.8133 56.7521 11.696V11.488H53.2161V9.664H56.7521V9.44C57.2321 9.44 57.6267 9.39733 57.9361 9.312C58.2454 9.216 58.4747 9.04 58.6241 8.784H54.4641V7.856C54.1547 8.208 53.8187 8.544 53.4561 8.864C53.1041 9.17333 52.7254 9.456 52.3201 9.712V14.176H49.7761V10.784C49.2534 10.912 48.7041 10.976 48.1281 10.976V8.32Z`,fill:`url(#${t})`}),d(`path`,{d:`M40.3361 0.0159912C40.3361 0.805325 40.2614 1.53066 40.1121 2.19199H46.3841V4.28799H44.3361V5.45599H46.1601V7.31199H44.3361V8.47999H46.1601V10.352H44.3361V11.648H46.4961V13.968H40.1121V14.192H37.5681V5.63199C37.3441 5.69599 37.1201 5.72799 36.8961 5.72799V2.92799C37.2694 2.92799 37.5361 2.68799 37.6961 2.20799C37.8561 1.72799 37.9361 0.997325 37.9361 0.0159912H40.3361ZM33.2641 0.0159912H35.6641V2.20799H36.6721V4.57599H35.6641V6.20799L36.6881 6.09599V8.47999L35.6641 8.62399V10.992C35.6641 11.408 35.6427 11.8027 35.6001 12.176C35.5574 12.56 35.4507 12.8907 35.2801 13.168C35.1201 13.456 34.8801 13.68 34.5601 13.84C34.2401 14.0107 33.8081 14.096 33.2641 14.096H32.1921V11.872H32.6241C32.9014 11.872 33.0774 11.7973 33.1521 11.648C33.2267 11.488 33.2641 11.184 33.2641 10.736V8.97599L31.9841 9.15199V6.63999L33.2641 6.49599V4.57599H32.0641V2.20799H33.2641V0.0159912ZM41.6001 0.0159912H44.4161L44.4641 1.90399H41.6481L41.6001 0.0159912ZM40.1121 5.45599H41.8881V4.28799H40.1121V5.45599ZM40.1121 8.47999H41.8881V7.31199H40.1121V8.47999ZM40.1121 11.648H41.8881V10.352H40.1121V11.648Z`,fill:`url(#${t})`}),d(`path`,{d:`M16.6721 2.49599L16.6081 0.0159912H19.8401L19.9041 2.49599H16.6721ZM24.9601 14.192V11.68H25.7121C26.0427 11.68 26.2987 11.6587 26.4801 11.616C26.6721 11.5733 26.8161 11.4987 26.9121 11.392C27.0081 11.2747 27.0667 11.12 27.0881 10.928C27.1094 10.736 27.1201 10.4907 27.1201 10.192V2.68799H20.8001V0.175991H29.9521V10.448C29.9521 11.2267 29.8827 11.8613 29.7441 12.352C29.6161 12.8427 29.3921 13.2213 29.0721 13.488C28.7521 13.7653 28.3201 13.952 27.7761 14.048C27.2321 14.144 26.5494 14.192 25.7281 14.192H24.9601ZM16.5441 14.192V3.23199H19.3761V14.192H16.5441Z`,fill:`url(#${t})`}),d(`path`,{d:`M6.48499e-05 7.18399V5.10399L1.87206 5.02399V3.82399H0.176065V1.45599H1.87206V0.0159912H4.25607V1.45599H6.00007V3.82399H4.25607V4.91199L5.84007 4.84799V6.92799L4.25607 6.99199V8.36799C4.25607 8.73066 4.22407 9.06132 4.16007 9.35999C4.09607 9.65866 3.97873 9.91466 3.80806 10.128C3.64807 10.3413 3.41873 10.5067 3.12007 10.624C2.83207 10.7413 2.45873 10.8 2.00006 10.8H0.592065V8.68799H1.05606C1.24806 8.68799 1.3974 8.66666 1.50406 8.62399C1.6214 8.58132 1.70673 8.52266 1.76006 8.44799C1.8134 8.36266 1.8454 8.26666 1.85606 8.15999C1.86673 8.04266 1.87206 7.91999 1.87206 7.79199V7.10399L6.48499e-05 7.18399ZM13.8081 10.864C12.7627 10.864 12.0054 10.624 11.5361 10.144C11.0774 9.66399 10.8481 8.86933 10.8481 7.75999V3.82399H9.84007V4.87999V5.02399H10.5121V6.68799H9.76007C9.6854 7.46666 9.55206 8.12266 9.36006 8.65599C9.17873 9.18932 8.9174 9.62133 8.57607 9.95199C8.2454 10.2827 7.8294 10.5227 7.32807 10.672C6.82673 10.8213 6.2294 10.896 5.53607 10.896V8.79999C5.8774 8.79999 6.1654 8.76799 6.40007 8.70399C6.6454 8.63999 6.84273 8.52799 6.99207 8.36799C7.1414 8.20799 7.25873 7.99466 7.34407 7.72799C7.4294 7.45066 7.48807 7.10399 7.52007 6.68799H6.35207V5.02399H7.58406V4.84799V3.82399H6.44807V1.45599H7.60007V0.0159912H9.85606V1.45599H13.2321V7.24799C13.2321 7.66399 13.2747 7.92533 13.3601 8.03199C13.4561 8.13866 13.6321 8.19199 13.8881 8.19199H14.3521V10.864H13.8081ZM0.144065 14.192L0.256065 11.232H3.21606L3.10406 14.192H0.144065ZM11.3921 14.192L11.2481 11.232H14.2241L14.3681 14.192H11.3921ZM4.17606 14.192L4.03207 11.296H6.73607L6.86407 14.192H4.17606ZM7.77607 14.192L7.63207 11.296H10.3841L10.5121 14.192H7.77607Z`,fill:`url(#${t})`})]}),d(`defs`,{children:f(`linearGradient`,{id:t,x1:`33.7161`,y1:`-4.59601`,x2:`60.7161`,y2:`18.404`,gradientUnits:`userSpaceOnUse`,children:[d(`stop`,{stopColor:`#E914E9`}),d(`stop`,{offset:`1`,stopColor:`#6C43EE`})]})})]})}function v({className:e=``}){return d(`svg`,{viewBox:`0 0 16.6667 16.6667`,fill:`none`,"aria-hidden":!0,className:e,children:d(`path`,{d:`M8.33333 1.66667C6.04287 1.66667 4.0209 2.82188 2.82036 4.58333H5V6.25H0V1.25H1.66667V3.3328C3.18651 1.30972 5.60637 0 8.33333 0C12.9357 0 16.6667 3.73096 16.6667 8.33333H15C15 4.65143 12.0152 1.66667 8.33333 1.66667ZM1.66667 8.33333C1.66667 12.0152 4.65143 15 8.33333 15C10.6238 15 12.6458 13.8447 13.8463 12.0833H11.6667V10.4167H16.6667V15.4167H15V13.3338C13.4802 15.3569 11.0603 16.6667 8.33333 16.6667C3.73096 16.6667 0 12.9357 0 8.33333H1.66667Z`,fill:`currentColor`})})}function y({variant:e,className:t=``}){let n=s().replace(/:/g,``),r=e===`gold`?`#FFF047`:`#D7D7D7`;return f(`svg`,{viewBox:`0 0 10 8`,fill:`none`,"aria-hidden":!0,className:t,children:[d(`path`,{d:`M0.72289 1.44405L2.67531 2.6057L4.62168 0.173795C4.77092 -0.0126857 5.06132 -0.0558774 5.27027 0.0773202C5.31202 0.103935 5.34852 0.136533 5.37837 0.173795L7.32476 2.6057L9.27714 1.44405C9.49083 1.31693 9.77946 1.36845 9.92192 1.55913C9.98315 1.64113 10.0097 1.73991 9.99682 1.83779L9.23283 7.63352C9.20526 7.84249 9.00682 8 8.77105 8H1.22899C0.99323 8 0.794784 7.84249 0.767236 7.63352L0.00322932 1.83779C-0.0267734 1.61019 0.155642 1.40398 0.410663 1.3772C0.520333 1.36569 0.631013 1.38938 0.72289 1.44405ZM5.00005 5.51033C5.51357 5.51033 5.92993 5.13878 5.92993 4.68043C5.92993 4.22209 5.51357 3.85054 5.00005 3.85054C4.48647 3.85054 4.07016 4.22209 4.07016 4.68043C4.07016 5.13878 4.48647 5.51033 5.00005 5.51033Z`,fill:`url(#${n})`}),d(`defs`,{children:f(`linearGradient`,{id:n,x1:`5`,y1:`0`,x2:`5`,y2:`8`,gradientUnits:`userSpaceOnUse`,children:[d(`stop`,{stopColor:r}),d(`stop`,{offset:`1`,stopColor:r,stopOpacity:`0`})]})})]})}function b(s){let{title:b,displayCount:x=4,showRefresh:S=!1,onItemClick:C,mode:w=`renderer`}=s,T=w===`editor`,E=n(),D=p(),O=m(),k=b.trim()||`热门推荐`,A=Math.max(1,x||0),[j,M]=u(0),[N,P]=u(!1),F=l(null),{userInfo:I}=e(h(e=>({userInfo:e.userInfo}))),L=I?.user_id||`guest`,{data:R}=a([`hot-recommend-keyword-list`,L],()=>t({user_id:L}),{enabled:!T}),z=c(()=>(R?.data?.recommend_list??[]).map(e=>({label:e.title??``})).filter(e=>e.label),[R]),B=o(()=>{N||(P(!0),F.current&&clearTimeout(F.current),F.current=setTimeout(()=>{M(e=>e+1),P(!1),F.current=null},500))},[N]),V=c(()=>T?Array.from({length:A},(e,t)=>({label:`推荐搜索${t+1}`})):z,[T,z,A]),H=c(()=>g(V,A),[A,V,j]);if(!T&&z.length<2)return null;let U=e=>{if(C){C(e);return}let t=new URLSearchParams(O.toString());t.set(`q`,e);let n=D.includes(`/search-result`)?D:`/search-result`;E.push(`${n}?${t.toString()}`)};return f(r,{className:`relative mx-[16px] mt-[24px] overflow-hidden rounded-[12px] bg-black${T?` pointer-events-none`:``}`,children:[d(r,{className:`pointer-events-none absolute inset-0 rounded-[12px]`,style:{background:`linear-gradient(180deg, #9756E3 0%, #6C43EE 100%), linear-gradient(180deg, rgba(255,30,255,0.7) 0%, rgba(108,67,238,0) 100%)`,padding:`0.5px`,WebkitMask:`linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)`,WebkitMaskComposite:`xor`,mask:`linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)`,maskComposite:`exclude`}}),d(r,{className:`pointer-events-none absolute inset-x-0 top-0 rounded-t-[12px] mix-blend-plus-lighter`,style:{height:`259px`,background:`linear-gradient(180deg, rgba(151,86,227,0.4) 0%, rgba(151,86,227,0) 85%)`}}),f(r,{className:`relative px-[24px] pb-[18px] pt-[22px]`,children:[f(r,{className:`flex items-center justify-between`,children:[k===`热门推荐`?d(_,{className:`h-[14.192px] w-[62.448px] shrink-0`}):d(i,{className:`shrink-0 bg-[linear-gradient(90deg,#E914E9_0%,#6C43EE_100%)] bg-clip-text font-["PingFang_SC"] text-[16px] font-semibold leading-none text-transparent`,children:k}),S&&d(`button`,{type:`button`,"aria-label":`刷新`,className:`flex h-[20px] w-[20px] shrink-0 items-center justify-center text-white/40 transition-opacity active:opacity-70`,onClick:B,children:d(v,{className:`h-[16.6667px] w-[16.6667px] ${N?`animate-spin`:``}`})})]}),d(r,{className:`mt-[7px]`,children:H.map((e,t)=>{let n=t<3,a=t<2,o=n?`text-[#C922EF]`:`text-white/70`,s=n?`text-white/90`:`text-white/70`;return f(r,{children:[f(`button`,{type:`button`,className:`flex h-[48px] w-full items-center gap-[4px] text-left transition-opacity active:opacity-70`,onClick:()=>U(e.label),children:[f(r,{className:`relative flex h-[24px] w-[20px] shrink-0 items-end justify-center`,children:[a?d(y,{variant:t===0?`gold`:`silver`,className:`absolute left-1/2 top-0 h-[8px] w-[10px] -translate-x-1/2`}):null,d(i,{className:`font-['DIN_Black'] text-[14px] font-normal not-italic leading-[24px] ${o}`,children:t+1})]}),d(i,{className:`min-w-0 flex-1 truncate font-['PingFang_SC'] text-[14px] font-normal not-italic leading-[24px] ${s}`,children:e.label})]}),t<H.length-1?d(r,{className:`h-px w-full bg-white/[0.08]`}):null]},`${e.label}-${t}`)})})]})]})}export{b as HotRecommendClient};
|
|
@@ -11,6 +11,7 @@ import * as zod_v4_core0 from "zod/v4/core";
|
|
|
11
11
|
declare const hotRecommendMaterial: DefineMaterialOption<typeof HotRecommendServer, typeof HotRecommendClient, zod.ZodObject<{
|
|
12
12
|
readonly title: zod.ZodString & SchemaHasDefaultValue;
|
|
13
13
|
readonly displayCount: zod.ZodNumber & SchemaHasDefaultValue;
|
|
14
|
+
readonly showRefresh: zod.ZodBoolean & SchemaHasDefaultValue;
|
|
14
15
|
readonly items: zod.ZodArray<zod.ZodObject<{
|
|
15
16
|
label: zod.ZodString & SchemaHasDefaultValue;
|
|
16
17
|
}, zod_v4_core0.$strip>> & SchemaHasDefaultValue;
|
|
@@ -10,6 +10,7 @@ import { z } from "zod";
|
|
|
10
10
|
declare const hotRecommendInspectorPropsSchema: z.ZodObject<{
|
|
11
11
|
readonly title: z.ZodString & SchemaHasDefaultValue;
|
|
12
12
|
readonly displayCount: z.ZodNumber & SchemaHasDefaultValue;
|
|
13
|
+
readonly showRefresh: z.ZodBoolean & SchemaHasDefaultValue;
|
|
13
14
|
readonly items: z.ZodArray<z.ZodObject<{
|
|
14
15
|
label: z.ZodString & SchemaHasDefaultValue;
|
|
15
16
|
}, z.core.$strip>> & SchemaHasDefaultValue;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
import{defineComponentPropsSchema as e}from"../../../../utils/schema/schema.mjs";import{z as t}from"zod";const n=e(e=>({title:e.string(`热门推荐`,{label:`标题名称`,description:`支持输入,中/英/数/符,6个字符`}),displayCount:e.number(4,{label:`展示数`}),items:e.array(t.object({label:e.string(
|
|
2
|
+
import{defineComponentPropsSchema as e}from"../../../../utils/schema/schema.mjs";import{z as t}from"zod";const n=e(e=>({title:e.string(`热门推荐`,{label:`标题名称`,description:`支持输入,中/英/数/符,6个字符`}),displayCount:e.number(4,{label:`展示数`}),showRefresh:e.boolean(!1,{label:`是否展示换一批`,fieldType:`switch`}),items:e.array(t.object({label:e.string(``,{label:`热词`})}),{label:`关键词列表`,defaultValue:[]})}));export{n as hotRecommendInspectorPropsSchema};
|
|
@@ -9,7 +9,7 @@ type ImageTextRecommendProps = InferSchemaProps<typeof imageTextRecommendInspect
|
|
|
9
9
|
interface ClientProps extends ImageTextRecommendProps {}
|
|
10
10
|
/**
|
|
11
11
|
* 图文推荐物料组件 - 客户端部分
|
|
12
|
-
* -
|
|
12
|
+
* - 智能推荐开启:按 layout(与首页宫格智能筛选形态一致)调用热门或最新列表,T+1 自动更新
|
|
13
13
|
* - 智能铺设关闭:按配置的内容 ID 取数;超过 8 个时分批拉取(每批 8 个),滚动到倒数第二个时触发下一批
|
|
14
14
|
*/
|
|
15
15
|
declare function ImageTextRecommendClient(props: ClientProps): react_jsx_runtime0.JSX.Element | null;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import e from"../../../../utils/get-res-url.mjs";import{pContentBatchGetVideoDetail as t,pContentGetPopularVideoList as
|
|
2
|
+
"use client";import e from"../../../../utils/get-res-url.mjs";import{pContentBatchGetVideoDetail as t,pContentGetNewstVideoList as n,pContentGetPopularVideoList as r}from"../../../../service/generated/client.mjs";import{pContentBatchGetVideoDetailKey as i,pContentGetNewstVideoListKey as a,pContentGetPopularVideoListKey as o}from"../../../../service/generated/tanstack.mjs";import{Image as s}from"../../../ui/image.mjs";import{Box as c}from"../../../ui/box.mjs";import{Text as l}from"../../../ui/text.mjs";import{IMAGE_TEXT_RECOMMEND_FIXED_BATCH_SIZE as u,buildImageTextRecommendRemoteMap as d,getImageTextRecommendFixedIds as f,resolveImageTextRecommendVideoId as ee}from"../../../../hooks/image-text-recommend.mjs";import{useRequest as p}from"../../../../hooks/query/use-query.mjs";import{normalizeHomeRecommendSmartLayout as te}from"../home-recommend/shared/home-recommend-smart-layout.mjs";import ne from"../../../../assets/images/frame.mjs";import re from"../../../../assets/images/subscript.mjs";import{buildImageTextSmartListBody as m,resolveImageTextSmartListKind as ie}from"./shared/query.mjs";import{useCallback as h,useEffect as g,useMemo as _,useRef as ae,useState as v}from"react";import{Fragment as oe,jsx as y,jsxs as b}from"react/jsx-runtime";import{useTranslations as se}from"next-intl";import ce from"next/link";const x=[];function S(e){return typeof e==`string`?e:e.src}function le(t,n){if(!t||!t.trim())return S(n);if(t.startsWith(`http`)||t.startsWith(`//`)||t.startsWith(`data:`))return t;let r=e();return r?`${r}${t.startsWith(`/`)?t:`/${t}`}`:t}function C(e){if(e==null)return``;let t=e;return t.img_y||t.media?.img_y||``}function w(e){return e==null?``:e.name||``}function T(e,t=!1){let n=e,r=t?n.type:n.content_type;return typeof r==`number`?r:n.is_more_link===!0||Number(n.episode_cnt||n.episode_count||n.episodes?.length||n.links?.length||0)>1?2:1}function E(e){if(!Number.isFinite(e)||e<=0)return``;let t=Math.floor(e),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60,a=e=>String(e).padStart(2,`0`);return n>0?`${a(n)}:${a(r)}:${a(i)}`:`${a(r)}:${a(i)}`}function D(e,t){let n=e,r=n?.links?.length??0;if(!Number.isFinite(r)||r<=0)return``;let i=n.update_status;return t(r,i===0||i===`0`)}function ue(e,t,n){return e?T(e,n)===2&&t?D(e,t):E(Number(e.duration??e.detail?.duration??0)):``}function de(e,t){if(!(e??``).trim())return``;let n=encodeURIComponent((t??``).trim()||``);return`/video/${e.trim()}/${n}/episode/1`}function fe(e,t){if(!e)return``;let n=e,r=t?Number(n.static?.browse_count??0):Number(n.browse_count??0);if(!Number.isFinite(r)||r<=0)return``;if(r>=1e6){let e=(r/1e6).toFixed(1);return e.endsWith(`.0`)?`${e.slice(0,-2)}M`:`${e}M`}if(r>=1e3){let e=(r/1e3).toFixed(1);return e.endsWith(`.0`)?`${e.slice(0,-2)}k`:`${e}k`}return Math.floor(r).toString()}function pe(){let e=new Date,t=new Date(e);return t.setHours(24,0,0,0),t.getTime()-e.getTime()}function O(e){let{title:T,items:E=x,commonPlayCount:D,commonEpisodes:O,layout:k,mode:A=`renderer`}=e,j=se(`components.biz.business.imageTextRecommend`),M=A===`renderer`,N=A===`editor`,[P,F]=v({}),[I,L]=v([]),[R,z]=v(0),[B,V]=v(void 0),H=ae(null),U=_(()=>te(k),[k]),W=U?.enabled===!0,G=_(()=>ie(U?.sortRule),[U?.sortRule]),K=E?.length??0,q=_(()=>f(E,W),[W,E]),J=_(()=>q.slice(0,u),[q]),Y=_(()=>{if(U?.enabled)return m(U,{targetCount:K})},[U,K]),{data:X}=p(_(()=>!Y||!W?[`image-text-recommend`,`smart-idle`]:G===`newest`?a(Y):o(Y),[Y,W,G]),async()=>!Y||!W?{data:{videos:[],cursor:``}}:G===`newest`?n(Y):r(Y),{enabled:M&&!N&&W&&E.length>0&&!!Y,staleTime:1/0}),{data:me}=p(i({ids:J}),()=>t({ids:J}),{enabled:M&&!N&&!W&&J.length>0,staleTime:1/0}),Z=_(()=>W&&K>u?Math.ceil(K/u):q.length>0?Math.ceil(q.length/u):0,[W,K,q.length]),Q=h((e,t)=>j(t?`updatedTo`:`allEpisodes`,{count:e}),[j]),he=h(async(e,n)=>{if(e.length===0)return;let r=d((await t({ids:e})).data?.videos??[]);F(e=>n?{...e,...r}:r)},[]);g(()=>{if(N)return;if(W){let e=X?.data?.videos??[];K>u?(L(e.slice(0,u)),V(X?.data?.cursor),z(e.length>0?1:0)):(L(e.slice(0,K)),z(0)),F({});return}if(J.length===0){F({}),L([]),z(0),V(void 0);return}let e=me?.data?.videos??[];F(d(e)),L([]),V(void 0),z(e.length>0?1:0)},[N,W,X,me,J,K]),g(()=>{if(N||Z<1||R<1||R>=Z)return;let e=H.current;if(!e)return;let t=new IntersectionObserver(e=>{let[t]=e;if(!t?.isIntersecting)return;let i=R;if(W&&U){let e=m(U,{targetCount:K,cursor:B,pageSize:u});(G===`newest`?n:r)(e).then(e=>{let t=e.data?.videos??[];L(e=>[...e,...t.slice(0,u)]),V(e.data?.cursor),z(i+1)}).catch(()=>{})}else{let e=i*u,t=q.slice(e,e+u);t.length>0&&(he(t,!0),z(i+1))}},{root:null,rootMargin:`0px`,threshold:0});return t.observe(e),()=>t.disconnect()},[N,W,U,G,q,R,Z,K,B,he]),g(()=>{if(N||!W||!U||K<=0)return;let e=U,t,i=!1;function a(){t=window.setTimeout(()=>{let t=m(e,{targetCount:K,pageSize:Math.max(20,K*10)});(G===`newest`?n:r)(t).then(e=>{i||L((e.data?.videos??[]).slice(0,K))}).catch(()=>{i||L([])}).finally(()=>{i||a()})},pe())}return a(),()=>{i=!0,t!==void 0&&window.clearTimeout(t)}},[N,W,U,G,K]);let $=_(()=>!E||E.length===0?x:N?E:W&&K>u?E.slice(0,I.length):E,[E,N,W,K,I.length]),ge=_(()=>$.length?$.map((e,t)=>{let n=String(e?.contentId??``).trim(),r=W?I[t]:n?P[n]:void 0,i=W?r?w(r):(e?.title??``).trim():(e?.title??``).trim()||(r?w(r):``),a=(e?.cover??``).trim(),o=W?C(r)||a:a||(e?.useVideoPoster?C(r):``),s=W&&String(r?.description??r?.content_description??``).trim()||(e?.contentDescription??``).trim(),c=ue(r,Q,W),l=fe(r,W);return{...e,contentId:n||(r?ee(r):``),title:i,cover:o,contentDescription:s,episodeOrDurationText:c,playCountText:l}}):x,[Q,W,$,P,I]);if(!E||E.length===0)return null;let _e=R>=1&&R<Z?W?I.length-2:R*u-2:-1;return b(c,{className:N?`bg-bg1 px-3 py-3 pointer-events-none`:`bg-bg1 px-3 py-3`,children:[T&&y(c,{className:`mb-3 flex items-center justify-between`,children:y(l,{className:`text-[18px] font-bold text-text1 leading-[26px]`,children:T})}),y(c,{className:`flex overflow-x-auto pb-2 scrollbar-hide space-x-2`,children:ge.map((e,t)=>{let n=W?D:e.showPlayCount??!1,r=(e.playCountText??``).trim(),i=r!==``,a=W?O:e.showEpisodes??!1,o=(e.episodeOrDurationText??``).trim(),u=a&&o!==``,d=A===`renderer`?de(e.contentId??``,e.title??``):``,f=b(oe,{children:[b(c,{className:`relative rounded-lg overflow-hidden bg-bg2 w-[116px] h-[134px]`,children:[N||e.cover?y(s,{src:le(e.cover,ne),alt:e.title??``,fill:!0,className:`object-cover`}):y(c,{className:`w-full h-full flex items-center justify-center`,children:y(l,{className:`text-text3 text-xs`,children:j(`noCover`)})}),!W&&(e.badge??``).trim()?y(c,{className:`absolute top-0 right-0 w-8 h-8`,children:y(s,{src:(e.badge??``).trim()||S(re),alt:``,fill:!0,sizes:`32px`,className:`object-contain object-right-top`,unoptimized:!0})}):null,b(c,{className:`absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/80 to-transparent pb-1 pt-3 px-1 flex justify-between items-center gap-1`,children:[y(c,{className:`flex items-center min-w-0 shrink`,children:n&&i?b(c,{className:`flex items-center gap-1 rounded bg-overlay px-1 py-0`,children:[y(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`10`,viewBox:`0 0 12 10`,fill:`none`,className:`shrink-0`,"aria-hidden":!0,children:y(`path`,{d:`M7.56 5.18437L5.013 6.56737C4.893 6.63337 4.761 6.66937 4.638 6.66937C4.269 6.66937 4.002 6.38737 4.002 5.99737V3.28237C4.002 2.89237 4.269 2.61037 4.638 2.61037C4.764 2.61037 4.893 2.64637 5.013 2.70937L7.572 4.09237C7.803 4.21837 7.938 4.41637 7.938 4.63237C7.938 4.85137 7.8 5.05537 7.56 5.18437ZM9.807 9.27637L2.133 8.52937C0.954 8.52937 0 7.57537 0 6.39637V2.79937C0 1.62037 0.954 0.666368 2.133 0.666368L9.81 0.000367165C10.989 0.000367165 11.943 0.954367 11.943 2.13337V7.14337C11.9422 7.70935 11.7168 8.25188 11.3163 8.65181C10.9158 9.05174 10.373 9.27637 9.807 9.27637ZM10.875 2.13337C10.875 1.99351 10.8475 1.85502 10.7939 1.72581C10.7404 1.5966 10.662 1.47919 10.5631 1.3803C10.4642 1.2814 10.3468 1.20296 10.2176 1.14944C10.0883 1.09591 9.94986 1.06837 9.81 1.06837L2.133 1.73437C1.99314 1.73437 1.85465 1.76191 1.72544 1.81544C1.59623 1.86896 1.47883 1.9474 1.37993 2.0463C1.28104 2.14519 1.20259 2.2626 1.14907 2.39181C1.09555 2.52102 1.068 2.65951 1.068 2.79937V6.39637C1.068 6.67882 1.1802 6.94971 1.37993 7.14944C1.57966 7.34916 1.85054 7.46137 2.133 7.46137L9.807 8.20837C9.94686 8.20837 10.0853 8.18082 10.2146 8.1273C10.3438 8.07378 10.4612 7.99533 10.5601 7.89644C10.659 7.79754 10.7374 7.68014 10.7909 7.55093C10.8445 7.42171 10.872 7.28323 10.872 7.14337V2.13337H10.875Z`,fill:`white`})}),y(l,{className:`text-white text-[12px] leading-[20px]`,children:r})]}):null}),y(c,{className:`flex items-center shrink-0`,children:u?y(l,{className:`text-white text-[12px] leading-[20px]`,children:o}):null})]})]}),y(c,{className:`mt-2 py-2`,children:y(l,{className:`text-[16px] text-text1 font-bold leading-[24px] line-clamp-1`,children:e.title})})]});return y(c,{ref:t===_e?H:void 0,className:`flex-shrink-0 w-[116px]`,children:d?y(ce,{href:d,className:`block`,children:f}):f},t)})})]})}export{O as ImageTextRecommendClient};
|
|
@@ -14,13 +14,13 @@ import * as zod_v4_core0 from "zod/v4/core";
|
|
|
14
14
|
declare const imageTextRecommendMaterial: DefineMaterialOption<typeof ImageTextRecommendServer, typeof ImageTextRecommendClient, zod.ZodObject<{
|
|
15
15
|
readonly title: zod.ZodString & SchemaHasDefaultValue;
|
|
16
16
|
readonly moduleCount: zod.ZodNumber & SchemaHasDefaultValue;
|
|
17
|
-
readonly layout: zod.ZodObject<{
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}, zod_v4_core0.$
|
|
17
|
+
readonly layout: zod.ZodOptional<zod.ZodObject<{
|
|
18
|
+
enabled: zod.ZodOptional<zod.ZodBoolean>;
|
|
19
|
+
categories: zod.ZodOptional<zod.ZodArray<zod.ZodAny>>;
|
|
20
|
+
tags: zod.ZodOptional<zod.ZodArray<zod.ZodAny>>;
|
|
21
|
+
sortRule: zod.ZodOptional<zod.ZodString>;
|
|
22
|
+
contentForms: zod.ZodOptional<zod.ZodArray<zod.ZodString>>;
|
|
23
|
+
}, zod_v4_core0.$loose>>;
|
|
24
24
|
readonly commonPlayCount: zod.ZodBoolean & SchemaHasDefaultValue;
|
|
25
25
|
readonly commonEpisodes: zod.ZodBoolean & SchemaHasDefaultValue;
|
|
26
26
|
readonly items: zod.ZodArray<zod.ZodObject<{
|
|
@@ -1,39 +1,44 @@
|
|
|
1
1
|
|
|
2
2
|
import { SchemaHasDefaultValue } from "../../../../utils/schema/schema.mjs";
|
|
3
3
|
import "../../../../utils.mjs";
|
|
4
|
-
import
|
|
4
|
+
import * as zod from "zod";
|
|
5
|
+
import * as zod_v4_core0 from "zod/v4/core";
|
|
5
6
|
|
|
6
7
|
//#region components/biz/business/image-text-recommend/schema.d.ts
|
|
7
8
|
/**
|
|
8
9
|
* 图文推荐物料属性定义
|
|
9
10
|
*/
|
|
10
|
-
declare const imageTextRecommendInspectorPropsSchema:
|
|
11
|
-
readonly title:
|
|
12
|
-
readonly moduleCount:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
readonly
|
|
28
|
-
readonly
|
|
29
|
-
readonly
|
|
30
|
-
readonly
|
|
31
|
-
|
|
11
|
+
declare const imageTextRecommendInspectorPropsSchema: zod.ZodObject<{
|
|
12
|
+
readonly title: zod.ZodString & SchemaHasDefaultValue;
|
|
13
|
+
readonly moduleCount: zod.ZodNumber & SchemaHasDefaultValue;
|
|
14
|
+
/**
|
|
15
|
+
* 智能推荐配置(与首页宫格 smartLayout / recommendContentConfig 字段形态一致)。
|
|
16
|
+
* enabled 为 true 时走热门或最新列表;categories → cat_ids,tags 取项的 name 透传 tags。
|
|
17
|
+
*/
|
|
18
|
+
readonly layout: zod.ZodOptional<zod.ZodObject<{
|
|
19
|
+
enabled: zod.ZodOptional<zod.ZodBoolean>;
|
|
20
|
+
categories: zod.ZodOptional<zod.ZodArray<zod.ZodAny>>;
|
|
21
|
+
tags: zod.ZodOptional<zod.ZodArray<zod.ZodAny>>;
|
|
22
|
+
sortRule: zod.ZodOptional<zod.ZodString>;
|
|
23
|
+
contentForms: zod.ZodOptional<zod.ZodArray<zod.ZodString>>;
|
|
24
|
+
}, zod_v4_core0.$loose>>;
|
|
25
|
+
readonly commonPlayCount: zod.ZodBoolean & SchemaHasDefaultValue;
|
|
26
|
+
readonly commonEpisodes: zod.ZodBoolean & SchemaHasDefaultValue;
|
|
27
|
+
readonly items: zod.ZodArray<zod.ZodObject<{
|
|
28
|
+
readonly contentId: zod.ZodString & SchemaHasDefaultValue;
|
|
29
|
+
readonly title: zod.ZodString & SchemaHasDefaultValue;
|
|
30
|
+
readonly contentDescription: zod.ZodString & SchemaHasDefaultValue;
|
|
31
|
+
readonly cover: zod.ZodString & SchemaHasDefaultValue;
|
|
32
|
+
readonly useVideoPoster: zod.ZodBoolean & SchemaHasDefaultValue;
|
|
33
|
+
readonly showPlayCount: zod.ZodBoolean & SchemaHasDefaultValue;
|
|
34
|
+
readonly showEpisodes: zod.ZodBoolean & SchemaHasDefaultValue;
|
|
35
|
+
readonly badge: zod.ZodString & SchemaHasDefaultValue;
|
|
36
|
+
}, zod_v4_core0.$strip>> & SchemaHasDefaultValue;
|
|
32
37
|
} & {
|
|
33
|
-
mode:
|
|
38
|
+
mode: zod.ZodOptional<zod.ZodEnum<{
|
|
34
39
|
renderer: "renderer";
|
|
35
40
|
editor: "editor";
|
|
36
41
|
}>>;
|
|
37
|
-
},
|
|
42
|
+
}, zod_v4_core0.$strip>;
|
|
38
43
|
//#endregion
|
|
39
44
|
export { imageTextRecommendInspectorPropsSchema };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
import{defineComponentPropsSchema as e}from"../../../../utils/schema/schema.mjs";import{
|
|
2
|
+
import{defineComponentPropsSchema as e}from"../../../../utils/schema/schema.mjs";import{homeRecommendSmartLayoutSchema as t}from"../home-recommend/shared/home-recommend-smart-layout.mjs";const n=e(e=>({title:e.string(`推荐视频`,{label:`推荐位名称`}),moduleCount:e.number(1,{label:`推荐模块数`}),layout:t.optional(),commonPlayCount:e.boolean(!0,{fieldType:`switch`,label:`通用播放量`}),commonEpisodes:e.boolean(!0,{fieldType:`switch`,label:`通用集数`}),items:e.array(e.object({contentId:e.string(``,{label:`推荐位内容`}),title:e.string(`视频标题`,{label:`推荐位内容名称`}),contentDescription:e.string(``,{label:`内容说明简介`}),cover:e.string(``,{label:`推荐位封面`}),useVideoPoster:e.boolean(!0,{fieldType:`switch`,label:`沿用视频海报`}),showPlayCount:e.boolean(!1,{fieldType:`switch`,label:`播放量显示`}),showEpisodes:e.boolean(!0,{fieldType:`switch`,label:`集数展示`}),badge:e.string(``,{label:`推荐位角标`,description:`角标图片地址,可通过低代码平台配置上传;留空则使用默认角标图`})}),{label:`推荐位模块`,defaultValue:[{contentId:`d6a35ba3279e6f0d`,title:`视频标题 1`,contentDescription:``,cover:``,useVideoPoster:!0,showPlayCount:!0,showEpisodes:!0,badge:``},{contentId:`eaf60eab4938489d`,title:`视频标题 2`,contentDescription:``,cover:``,useVideoPoster:!0,showPlayCount:!0,showEpisodes:!0,badge:``},{contentId:`c45fe58f91d1c986`,title:`视频标题 3`,contentDescription:``,cover:``,useVideoPoster:!0,showPlayCount:!0,showEpisodes:!0,badge:``}]})}));export{n as imageTextRecommendInspectorPropsSchema};
|