Skip to content

Let's use AI to Earn!

delete

bulaienaofutuojiesenzhanga5e4852613c7
diff --git a/src/components/PublishDialog/compoents/PlatParamsSetting/plats/README.md b/src/components/PublishDialog/compoents/PlatParamsSetting/plats/README.md
deleted file mode 100644
index 7255cd61..00000000
--- a/src/components/PublishDialog/compoents/PlatParamsSetting/plats/README.md
+++ /dev/null
@@ -1,127 +0,0 @@
-# TikTokParams 组件
-
-## 概述
-
-TikTokParams 组件是专门为 TikTok 平台设计的发布参数设置组件,完全符合 TikTok 的 Content Posting API 开发指南要求。
-
-## 功能特性
-
-### 1. 创作者信息显示
-- 自动调用 `/api/plat/tiktok/creator/info/{tiktok_account_id}` API
-- 显示创作者头像、昵称和用户名
-- 根据 API 返回的 `max_video_post_duration_sec` 验证视频时长
-
-### 2. 隐私级别设置
-- 支持从 API 返回的 `privacy_level_options` 中选择
-- 选项包括:
- - `PUBLIC_TO_EVERYONE` - 公开
- - `MUTUAL_FOLLOW_FRIENDS` - 朋友
- - `SELF_ONLY` - 仅自己
-- 用户必须手动选择,无默认值
-
-### 3. 用户交互权限
-- **评论权限** (`comment_disabled`)
-- **合拍权限** (`duet_disabled`)
-- **拼接权限** (`stitch_disabled`)
-- 根据 API 返回的禁用状态自动禁用相应选项
-- 用户必须手动开启,无默认选中
-
-### 4. 商业内容披露
-- 商业内容披露开关
-- 两个选项:
- - **您的品牌** (`brand_organic_toggle`) - 推广自己或自己的业务
- - **品牌内容** (`brand_content_toggle`) - 推广其他品牌或第三方
-- 至少选择一个选项才能发布
-
-### 5. 合规声明
-根据选择的商业内容类型显示不同的合规声明:
-
-- **默认情况**:发布即表示您同意 TikTok 的音乐使用确认
-- **仅选择"您的品牌"**:发布即表示您同意 TikTok 的音乐使用确认
-- **仅选择"品牌内容"**:发布即表示您同意 TikTok 的品牌内容政策音乐使用确认
-- **同时选择两者**:发布即表示您同意 TikTok 的品牌内容政策音乐使用确认
-
-## API 接口
-
-### 获取创作者信息
-```
-GET /api/plat/tiktok/creator/info/{tiktok_account_id}
-```
-
-**响应格式:**
-```json
-{
- "data": {
- "max_video_post_duration_sec": 3600,
- "privacy_level_options": ["PUBLIC_TO_EVERYONE", "MUTUAL_FOLLOW_FRIENDS", "SELF_ONLY"],
- "stitch_disabled": false,
- "comment_disabled": false,
- "creator_avatar_url": "https://...",
- "creator_nickname": "straydog",
- "creator_username": "__straydog__",
- "duet_disabled": false
- },
- "code": 0,
- "message": "请求成功"
-}
-```
-
-## 多语言支持
-
-组件支持中英文双语:
-
-### 中文 (zh-CN)
-- 创作者信息
-- 谁可以观看此视频
-- 允许用户
-- 披露视频内容
-- 合规声明
-
-### 英文 (en)
-- Creator Info
-- Who can view this video
-- Allow users to
-- Disclose video content
-- Compliance declarations
-
-## 使用方法
-
-```tsx
-import TikTokParams from '@/components/PublishDialog/compoents/PlatParamsSetting/plats/TikTokParams';
-
-<TikTokParams pubItem={pubItem} />
-```
-
-## 参数结构
-
-```typescript
-interface TikTokOption {
- privacy_level: string;
- comment_disabled: boolean;
- duet_disabled: boolean;
- stitch_disabled: boolean;
- brand_organic_toggle: boolean;
- brand_content_toggle: boolean;
-}
-```
-
-## 符合 TikTok 开发指南
-
-本组件完全符合 [TikTok Content Sharing Guidelines](https://developers.tiktok.com/doc/content-sharing-guidelines#required_ux_implementation_in_your_app) 的要求:
-
-1. ✅ 显示创作者昵称和头像
-2. ✅ 检查创作者发布限制
-3. ✅ 验证视频时长限制
-4. ✅ 隐私级别手动选择
-5. ✅ 交互权限手动设置
-6. ✅ 商业内容披露功能
-7. ✅ 合规声明显示
-8. ✅ 无默认值设置
-9. ✅ 用户完全控制发布内容
-
-## 注意事项
-
-1. 组件会自动初始化 TikTok 参数,如果不存在则创建默认值
-2. API 调用失败时会静默处理,不影响组件正常使用
-3. 所有用户交互都有相应的状态管理和参数更新
-4. 组件支持响应式设计,适配不同屏幕尺寸
diff --git a/src/components/PublishDialog/compoents/PlatParamsSetting/plats/TikTokParams.debug.tsx b/src/components/PublishDialog/compoents/PlatParamsSetting/plats/TikTokParams.debug.tsx
deleted file mode 100644
index dc89817a..00000000
--- a/src/components/PublishDialog/compoents/PlatParamsSetting/plats/TikTokParams.debug.tsx
+++ /dev/null
@@ -1,87 +0,0 @@
-import React, { useState } from 'react';
-import { Switch, Button } from 'antd';
-
-// 简单的 Switch 测试组件
-const TikTokSwitchDebug = () => {
- const [brandOrganicToggle, setBrandOrganicToggle] = useState(false);
- const [brandContentToggle, setBrandContentToggle] = useState(false);
-
- const isSwitchChecked = brandOrganicToggle || brandContentToggle;
-
- const handleSwitchChange = (checked: boolean) => {
- console.log('Switch changed to:', checked);
- if (!checked) {
- setBrandOrganicToggle(false);
- setBrandContentToggle(false);
- } else {
- setBrandOrganicToggle(true);
- setBrandContentToggle(false);
- }
- };
-
- const handleBrandOrganicChange = (checked: boolean) => {
- console.log('Brand organic changed to:', checked);
- setBrandOrganicToggle(checked);
- };
-
- const handleBrandContentChange = (checked: boolean) => {
- console.log('Brand content changed to:', checked);
- setBrandContentToggle(checked);
- };
-
- return (
- <div style={{ padding: '20px', border: '1px solid #ddd', margin: '20px' }}>
- <h3>TikTok Switch 调试</h3>
-
- <div style={{ marginBottom: '20px' }}>
- <p>当前状态:</p>
- <ul>
- <li>brand_organic_toggle: {brandOrganicToggle.toString()}</li>
- <li>brand_content_toggle: {brandContentToggle.toString()}</li>
- <li>Switch checked: {isSwitchChecked.toString()}</li>
- </ul>
- </div>
-
- <div style={{ marginBottom: '20px' }}>
- <label>商业内容披露开关:</label>
- <Switch
- checked={isSwitchChecked}
- onChange={handleSwitchChange}
- />
- <span style={{ marginLeft: '8px' }}>开启以披露此视频推广商品或服务以换取价值</span>
- </div>
-
- {isSwitchChecked && (
- <div style={{ marginBottom: '20px' }}>
- <div style={{ marginBottom: '10px' }}>
- <Switch
- checked={brandOrganicToggle}
- onChange={handleBrandOrganicChange}
- />
- <span style={{ marginLeft: '8px' }}>您的品牌</span>
- </div>
- <div>
- <Switch
- checked={brandContentToggle}
- onChange={handleBrandContentChange}
- />
- <span style={{ marginLeft: '8px' }}>品牌内容</span>
- </div>
- </div>
- )}
-
- <div>
- <Button
- onClick={() => {
- setBrandOrganicToggle(false);
- setBrandContentToggle(false);
- }}
- >
- 重置状态
- </Button>
- </div>
- </div>
- );
-};
-
-export default TikTokSwitchDebug;
diff --git a/src/components/PublishDialog/compoents/PlatParamsSetting/plats/TikTokParams.example.tsx b/src/components/PublishDialog/compoents/PlatParamsSetting/plats/TikTokParams.example.tsx
deleted file mode 100644
index b7391336..00000000
--- a/src/components/PublishDialog/compoents/PlatParamsSetting/plats/TikTokParams.example.tsx
+++ /dev/null
@@ -1,98 +0,0 @@
-import React from 'react';
-import TikTokParams from './TikTokParams';
-import { PubItem } from '@/components/PublishDialog/publishDialog.type';
-
-// 示例:如何使用 TikTokParams 组件
-const TikTokParamsExample = () => {
- // 模拟 TikTok 账户数据
- const mockPubItem: PubItem = {
- account: {
- id: 'tiktok-account-1',
- account: '68a83465c85b7303d5e4b76e', // TikTok 账户 ID
- type: 'tiktok',
- name: 'TikTok Account',
- avatar: 'https://example.com/avatar.jpg',
- status: 'active',
- platform: 'tiktok',
- },
- params: {
- des: '这是一个测试视频描述',
- title: '测试视频标题',
- option: {
- tiktok: {
- privacy_level: '',
- comment_disabled: false,
- duet_disabled: false,
- stitch_disabled: false,
- brand_organic_toggle: false,
- brand_content_toggle: false,
- },
- },
- },
- };
-
- return (
- <div style={{ padding: '20px', maxWidth: '600px' }}>
- <h2>TikTok 发布参数设置示例</h2>
- <p>这个组件展示了 TikTok 发布时的所有必要参数设置:</p>
-
- <ul>
- <li>✅ 创作者信息显示(头像、昵称、用户名)</li>
- <li>✅ 隐私级别选择(公开、朋友、仅自己)</li>
- <li>✅ 用户交互权限(评论、合拍、拼接)</li>
- <li>✅ 商业内容披露(您的品牌、品牌内容)</li>
- <li>✅ 合规声明显示</li>
- </ul>
-
- <div style={{ border: '1px solid #ddd', borderRadius: '8px', padding: '16px' }}>
- <TikTokParams pubItem={mockPubItem} />
- </div>
-
- <div style={{ marginTop: '20px', padding: '16px', background: '#f5f5f5', borderRadius: '8px' }}>
- <h3>API 接口说明</h3>
- <p><strong>获取创作者信息:</strong></p>
- <code>GET /api/plat/tiktok/creator/info/{tiktok_account_id}</code>
-
- <h4>响应示例:</h4>
- <pre style={{ background: '#fff', padding: '10px', borderRadius: '4px', overflow: 'auto' }}>
-{`{
- "data": {
- "max_video_post_duration_sec": 3600,
- "privacy_level_options": [
- "PUBLIC_TO_EVERYONE",
- "MUTUAL_FOLLOW_FRIENDS",
- "SELF_ONLY"
- ],
- "stitch_disabled": false,
- "comment_disabled": false,
- "creator_avatar_url": "https://...",
- "creator_nickname": "straydog",
- "creator_username": "__straydog__",
- "duet_disabled": false
- },
- "code": 0,
- "message": "请求成功"
-}`}
- </pre>
- </div>
-
- <div style={{ marginTop: '20px', padding: '16px', background: '#e6f7ff', borderRadius: '8px' }}>
- <h3>符合 TikTok 开发指南</h3>
- <p>本组件完全符合 <a href="https://developers.tiktok.com/doc/content-sharing-guidelines#required_ux_implementation_in_your_app" target="_blank" rel="noopener noreferrer">TikTok Content Sharing Guidelines</a> 的要求:</p>
- <ul>
- <li>✅ 显示创作者昵称和头像</li>
- <li>✅ 检查创作者发布限制</li>
- <li>✅ 验证视频时长限制</li>
- <li>✅ 隐私级别手动选择</li>
- <li>✅ 交互权限手动设置</li>
- <li>✅ 商业内容披露功能</li>
- <li>✅ 合规声明显示</li>
- <li>✅ 无默认值设置</li>
- <li>✅ 用户完全控制发布内容</li>
- </ul>
- </div>
- </div>
- );
-};
-
-export default TikTokParamsExample;
diff --git a/src/components/PublishDialog/compoents/PlatParamsSetting/plats/TikTokParams.fix.md b/src/components/PublishDialog/compoents/PlatParamsSetting/plats/TikTokParams.fix.md
deleted file mode 100644
index 544ece6b..00000000
--- a/src/components/PublishDialog/compoents/PlatParamsSetting/plats/TikTokParams.fix.md
+++ /dev/null
@@ -1,94 +0,0 @@
-# TikTokParams Switch 开关问题修复
-
-## 问题描述
-
-用户反馈 TikTokParams 组件中的商业内容披露 Switch 开关无法打开。
-
-## 问题分析
-
-1. **API 数据正常**:接口返回的数据结构正确,包含了所有必要的字段
-2. **初始化问题**:Switch 的 `checked` 属性基于 `brand_organic_toggle || brand_content_toggle`,初始值都是 `false`
-3. **状态更新问题**:直接修改 `pubItem.params.option` 对象可能导致 React 状态更新问题
-
-## 修复方案
-
-### 1. 改进状态更新逻辑
-
-**修复前:**
-```typescript
-const option = pubItem.params.option;
-option.tiktok!.brand_organic_toggle = true;
-setOnePubParams({ option }, pubItem.account.id);
-```
-
-**修复后:**
-```typescript
-const option = { ...pubItem.params.option };
-if (!option.tiktok) {
- option.tiktok = {
- privacy_level: '',
- comment_disabled: false,
- duet_disabled: false,
- stitch_disabled: false,
- brand_organic_toggle: false,
- brand_content_toggle: false,
- };
-}
-option.tiktok.brand_organic_toggle = true;
-setOnePubParams({ option }, pubItem.account.id);
-```
-
-### 2. 添加调试信息
-
-添加了详细的控制台日志和状态显示,帮助调试:
-
-```typescript
-// 显示当前状态
-<div style={{ fontSize: '12px', color: '#666', marginBottom: '4px' }}>
- 当前状态: {JSON.stringify({
- brand_organic_toggle: pubItem.params.option.tiktok?.brand_organic_toggle,
- brand_content_toggle: pubItem.params.option.tiktok?.brand_content_toggle,
- switch_checked: pubItem.params.option.tiktok?.brand_organic_toggle || pubItem.params.option.tiktok?.brand_content_toggle
- })}
-</div>
-
-// 控制台日志
-console.log('TikTok Switch changed:', checked);
-console.log('TikTok options after change:', option.tiktok);
-```
-
-### 3. 改进 Switch 行为
-
-**修复前:**
-- 点击 Switch 时,如果 `checked` 为 `true`,会进入 `if (!checked)` 分支
-- 导致两个值都被设置为 `false`,Switch 无法打开
-
-**修复后:**
-- 明确处理开启和关闭两种情况
-- 开启时默认选择"您的品牌"选项
-- 关闭时清空所有商业内容选项
-
-## 修复的文件
-
-- `src/components/PublishDialog/compoents/PlatParamsSetting/plats/TikTokParams.tsx`
-
-## 测试方法
-
-1. 打开浏览器开发者工具的控制台
-2. 在发布对话框中选择 TikTok 账户
-3. 查看商业内容披露 Switch 的状态显示
-4. 点击 Switch 开关,观察控制台日志
-5. 验证 Switch 能够正常开启和关闭
-
-## 预期结果
-
-- Switch 开关能够正常响应点击事件
-- 开启时显示"您的品牌"和"品牌内容"选项
-- 关闭时隐藏所有商业内容选项
-- 控制台显示详细的状态变化日志
-
-## 注意事项
-
-1. 调试信息会在生产环境中移除
-2. 状态更新使用对象展开操作符确保 React 能正确检测变化
-3. 所有 TikTok 相关的状态更新都使用相同的模式
diff --git a/src/components/PublishDialog/compoents/PlatParamsSetting/plats/TikTokParams.test.tsx b/src/components/PublishDialog/compoents/PlatParamsSetting/plats/TikTokParams.test.tsx
deleted file mode 100644
index df1ccc33..00000000
--- a/src/components/PublishDialog/compoents/PlatParamsSetting/plats/TikTokParams.test.tsx
+++ /dev/null
@@ -1,108 +0,0 @@
-import React from 'react';
-import { render, screen } from '@testing-library/react';
-import TikTokParams from './TikTokParams';
-
-// Mock the dependencies
-jest.mock('@/app/i18n/client', () => ({
- useTransClient: () => ({
- t: (key: string) => key,
- }),
-}));
-
-jest.mock('@/components/PublishDialog/compoents/PlatParamsSetting/hooks/usePlatParamsCoomon', () => ({
- __esModule: true,
- default: () => ({
- pubParmasTextareaCommonParams: {},
- setOnePubParams: jest.fn(),
- }),
-}));
-
-jest.mock('@/utils/request', () => ({
- __esModule: true,
- default: {
- get: jest.fn().mockResolvedValue({
- code: 0,
- data: {
- max_video_post_duration_sec: 3600,
- privacy_level_options: ['PUBLIC_TO_EVERYONE', 'MUTUAL_FOLLOW_FRIENDS', 'SELF_ONLY'],
- stitch_disabled: false,
- comment_disabled: false,
- creator_avatar_url: 'https://example.com/avatar.jpg',
- creator_nickname: 'Test User',
- creator_username: 'testuser',
- duet_disabled: false,
- },
- }),
- },
-}));
-
-// Mock PubParmasTextarea component
-jest.mock('@/components/PublishDialog/compoents/PubParmasTextarea', () => {
- return function MockPubParmasTextarea({ extend }: { extend: React.ReactNode }) {
- return <div data-testid="pub-params-textarea">{extend}</div>;
- };
-});
-
-// Mock CommonTitleInput component
-jest.mock('@/components/PublishDialog/compoents/PlatParamsSetting/common/CommonTitleInput', () => {
- return function MockCommonTitleInput() {
- return <div data-testid="common-title-input">Title Input</div>;
- };
-});
-
-describe('TikTokParams', () => {
- const mockPubItem = {
- account: {
- id: 'test-account-id',
- account: 'test-tiktok-account',
- type: 'tiktok',
- },
- params: {
- option: {
- tiktok: {
- privacy_level: '',
- comment_disabled: false,
- duet_disabled: false,
- stitch_disabled: false,
- brand_organic_toggle: false,
- brand_content_toggle: false,
- },
- },
- },
- };
-
- it('renders TikTokParams component', () => {
- render(<TikTokParams pubItem={mockPubItem} />);
-
- expect(screen.getByTestId('pub-params-textarea')).toBeInTheDocument();
- expect(screen.getByTestId('common-title-input')).toBeInTheDocument();
- });
-
- it('displays creator info section', () => {
- render(<TikTokParams pubItem={mockPubItem} />);
-
- // Check if creator info label is present
- expect(screen.getByText('tiktok.creatorInfo')).toBeInTheDocument();
- });
-
- it('displays privacy level section', () => {
- render(<TikTokParams pubItem={mockPubItem} />);
-
- // Check if privacy level label is present
- expect(screen.getByText('tiktok.privacy.title')).toBeInTheDocument();
- });
-
- it('displays interactions section', () => {
- render(<TikTokParams pubItem={mockPubItem} />);
-
- // Check if interactions label is present
- expect(screen.getByText('tiktok.interactions.title')).toBeInTheDocument();
- });
-
- it('displays commercial content section', () => {
- render(<TikTokParams pubItem={mockPubItem} />);
-
- // Check if commercial content label is present
- expect(screen.getByText('tiktok.commercial.title')).toBeInTheDocument();
- });
-});