mirror of
https://github.com/Funkoala14/CreatorCenter_OOIN.git
synced 2025-06-07 22:58:14 +08:00
Compare commits
2 Commits
930c21ff2f
...
4653afdefe
Author | SHA1 | Date | |
---|---|---|---|
4653afdefe | |||
6fd9458d07 |
@ -4,6 +4,7 @@ import { fetchBrands } from '../store/slices/brandsSlice';
|
|||||||
import { Card } from 'react-bootstrap';
|
import { Card } from 'react-bootstrap';
|
||||||
import { Folders, Hash, Link, Users } from 'lucide-react';
|
import { Folders, Hash, Link, Users } from 'lucide-react';
|
||||||
import SpinningComponent from './SpinningComponent';
|
import SpinningComponent from './SpinningComponent';
|
||||||
|
import { getBrandSourceName } from '../lib/utils';
|
||||||
|
|
||||||
export default function BrandsList({ openBrandDetail }) {
|
export default function BrandsList({ openBrandDetail }) {
|
||||||
const { brands, status, error } = useSelector((state) => state.brands);
|
const { brands, status, error } = useSelector((state) => state.brands);
|
||||||
@ -37,7 +38,7 @@ export default function BrandsList({ openBrandDetail }) {
|
|||||||
<Folders size={16} />
|
<Folders size={16} />
|
||||||
Category
|
Category
|
||||||
</span>
|
</span>
|
||||||
<span className='card-text-content'>{brand.category}</span>
|
<span className='card-text-content'>{brand.category || '--'}</span>
|
||||||
</Card.Text>
|
</Card.Text>
|
||||||
<Card.Text className=''>
|
<Card.Text className=''>
|
||||||
<span className='card-text-title'>
|
<span className='card-text-title'>
|
||||||
@ -58,7 +59,7 @@ export default function BrandsList({ openBrandDetail }) {
|
|||||||
<Link size={16} />
|
<Link size={16} />
|
||||||
Source
|
Source
|
||||||
</span>
|
</span>
|
||||||
<span className='card-text-content'>{brand.source}</span>
|
<span className='card-text-content'>{getBrandSourceName(brand.source)}</span>
|
||||||
</Card.Text>
|
</Card.Text>
|
||||||
</Card.Body>
|
</Card.Body>
|
||||||
</div>
|
</div>
|
||||||
|
@ -70,7 +70,6 @@ export default function DiscoveryList() {
|
|||||||
function SeesionResultModal({ session, show, onHide }) {
|
function SeesionResultModal({ session, show, onHide }) {
|
||||||
if (!show) return null;
|
if (!show) return null;
|
||||||
const { creators } = session || {};
|
const { creators } = session || {};
|
||||||
console.log(creators);
|
|
||||||
return (
|
return (
|
||||||
<Modal show={show} onHide={onHide} size={creators.length > 0 ? 'xl' : ''}>
|
<Modal show={show} onHide={onHide} size={creators.length > 0 ? 'xl' : ''}>
|
||||||
<Modal.Header closeButton>
|
<Modal.Header closeButton>
|
||||||
@ -134,7 +133,7 @@ function SeesionResultModal({ session, show, onHide }) {
|
|||||||
</td>
|
</td>
|
||||||
<td className='text-center'>
|
<td className='text-center'>
|
||||||
<span className={`category-pill ${getCategoryClassName(creator.category)}`}>
|
<span className={`category-pill ${getCategoryClassName(creator.category)}`}>
|
||||||
{creator.category}
|
{creator.category || '--'}
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td className='text-center'>
|
<td className='text-center'>
|
||||||
|
@ -68,7 +68,7 @@ export default function InboxList() {
|
|||||||
<div className='list-content'>
|
<div className='list-content'>
|
||||||
{status === 'loading' && <div>Loading...</div>}
|
{status === 'loading' && <div>Loading...</div>}
|
||||||
{status === 'failed' && <div>Error: {error}</div>}
|
{status === 'failed' && <div>Error: {error}</div>}
|
||||||
{status === 'succeeded' && inboxList.length > 0 &&
|
{status === 'succeeded' && (inboxList.length > 0 ?
|
||||||
inboxList.map((item) => (
|
inboxList.map((item) => (
|
||||||
<div
|
<div
|
||||||
key={item.id}
|
key={item.id}
|
||||||
@ -91,7 +91,7 @@ export default function InboxList() {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
))}
|
)) : <div className='list-item-empty'>No Chats Found</div>)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -97,7 +97,7 @@ export default function ProductsList({ products, onShowProductDetail, type = 'de
|
|||||||
<tbody>
|
<tbody>
|
||||||
{products?.length === 0 ? (
|
{products?.length === 0 ? (
|
||||||
<tr>
|
<tr>
|
||||||
<td colSpan='10' className='text-center py-4'>
|
<td colSpan='11' className='text-center py-4'>
|
||||||
No products found for this brand.
|
No products found for this brand.
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
export default function SessionResult() {
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<h1>Session Result</h1>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +1,11 @@
|
|||||||
import { Copy, Edit, FileText, LayoutTemplate } from 'lucide-react';
|
import { Copy, Edit, FileText, LayoutTemplate } from 'lucide-react';
|
||||||
import { Button } from 'react-bootstrap';
|
import { Button } from 'react-bootstrap';
|
||||||
import { useSelector } from 'react-redux';
|
import { useSelector, useDispatch } from 'react-redux';
|
||||||
import Spinning from './SpinningComponent';
|
import Spinning from './SpinningComponent';
|
||||||
|
import { getTemplateDetail } from '../store/slices/inboxSlice';
|
||||||
|
|
||||||
export default function TemplateList({ activeTab, openModal, setFormData }) {
|
export default function TemplateList({ activeTab, openModal, setFormData }) {
|
||||||
|
const dispatch = useDispatch();
|
||||||
const { templates, templatesStatus } = useSelector((state) => state.inbox);
|
const { templates, templatesStatus } = useSelector((state) => state.inbox);
|
||||||
// 如果正在加载,显示加载中
|
// 如果正在加载,显示加载中
|
||||||
if (templatesStatus === 'loading') {
|
if (templatesStatus === 'loading') {
|
||||||
@ -16,13 +18,14 @@ export default function TemplateList({ activeTab, openModal, setFormData }) {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const handleEdit = (template) => {
|
const handleEdit = async (template) => {
|
||||||
|
await dispatch(getTemplateDetail(template.id)).unwrap();
|
||||||
setFormData({
|
setFormData({
|
||||||
id: template.id,
|
id: template.id,
|
||||||
mission: template.type,
|
mission: template.type,
|
||||||
platform: template.platform,
|
platform: template.platform,
|
||||||
service: template.service,
|
service: template.service,
|
||||||
content: template.preview,
|
content: template?.content || template.preview,
|
||||||
title: template.title,
|
title: template.title,
|
||||||
category: template.category,
|
category: template.category,
|
||||||
collaboration_type: template.collaboration_type,
|
collaboration_type: template.collaboration_type,
|
||||||
|
@ -145,7 +145,6 @@ export const CREATOR_CATEGORIES = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
export const TEMPLATE_MISSIONS = [
|
export const TEMPLATE_MISSIONS = [
|
||||||
{ value: 'all', name: '全部' },
|
|
||||||
{ value: 'initial_contact', name: '初步建联' },
|
{ value: 'initial_contact', name: '初步建联' },
|
||||||
{ value: 'negotiation', name: '砍价邮件' },
|
{ value: 'negotiation', name: '砍价邮件' },
|
||||||
{ value: 'script', name: '脚本邮件' },
|
{ value: 'script', name: '脚本邮件' },
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import { BRAND_SOURCES } from "./constant";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 格式化日期
|
* 格式化日期
|
||||||
* @param {Date} date - 要格式化的日期对象
|
* @param {Date} date - 要格式化的日期对象
|
||||||
@ -51,3 +53,11 @@ export const getCategoryClassName = (category) => {
|
|||||||
|
|
||||||
return categoryMap[category] || '';
|
return categoryMap[category] || '';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const getBrandSourceName = (source) => {
|
||||||
|
return BRAND_SOURCES.find(item => item.value === source)?.name || source;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getTemplateMissionName = (mission) => {
|
||||||
|
return TEMPLATE_MISSIONS.find(item => item.value === mission)?.name || mission;
|
||||||
|
};
|
@ -120,6 +120,9 @@ function AddBrandModal({ show, onHide }) {
|
|||||||
</Form.Group>
|
</Form.Group>
|
||||||
<Form.Group className='mb-3' controlId='formBasicCampaignId'>
|
<Form.Group className='mb-3' controlId='formBasicCampaignId'>
|
||||||
<Form.Label>Campaign ID</Form.Label>
|
<Form.Label>Campaign ID</Form.Label>
|
||||||
|
<Form.Text className='text-muted'>
|
||||||
|
这个活动ID没必要在新增品牌的时候添加吧?
|
||||||
|
</Form.Text>
|
||||||
<Form.Control
|
<Form.Control
|
||||||
type='text'
|
type='text'
|
||||||
required
|
required
|
||||||
|
@ -238,6 +238,19 @@ export const addTemplateThunk = createAsyncThunk(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export const getTemplateDetail = createAsyncThunk('inbox/getTemplateDetail', async (id, { rejectWithValue }) => {
|
||||||
|
try {
|
||||||
|
const response = await api.get(`/template/${id}/`);
|
||||||
|
if (response.code === 200) {
|
||||||
|
return response.data;
|
||||||
|
} else {
|
||||||
|
throw new Error(response.message);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
return rejectWithValue(error.response.data.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const initialState = {
|
const initialState = {
|
||||||
inboxList: [],
|
inboxList: [],
|
||||||
inboxStatus: 'idle', // 'idle' | 'loading' | 'succeeded' | 'failed'
|
inboxStatus: 'idle', // 'idle' | 'loading' | 'succeeded' | 'failed'
|
||||||
@ -321,7 +334,13 @@ const inboxSlice = createSlice({
|
|||||||
.addCase(addTemplateThunk.rejected, (state, action) => {
|
.addCase(addTemplateThunk.rejected, (state, action) => {
|
||||||
state.templatesStatus = 'failed';
|
state.templatesStatus = 'failed';
|
||||||
state.error = action.payload;
|
state.error = action.payload;
|
||||||
});
|
})
|
||||||
|
.addCase(getTemplateDetail.fulfilled, (state, action) => {
|
||||||
|
const template = state.templates.find(item => item.id === action.payload.id);
|
||||||
|
if (template) {
|
||||||
|
Object.assign(template, action.payload);
|
||||||
|
}
|
||||||
|
})
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -365,9 +365,6 @@
|
|||||||
grid-template-columns: repeat(2, 1fr);
|
grid-template-columns: repeat(2, 1fr);
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
margin-top: 1rem;
|
margin-top: 1rem;
|
||||||
overflow-y: auto;
|
|
||||||
max-height: calc(100% - 85px);
|
|
||||||
padding-bottom: 1rem;
|
|
||||||
|
|
||||||
.template-item {
|
.template-item {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
|
Loading…
Reference in New Issue
Block a user