|
@@ -88,12 +88,9 @@
|
|
|
:value="platform.value"
|
|
:value="platform.value"
|
|
|
/>
|
|
/>
|
|
|
</el-select>
|
|
</el-select>
|
|
|
|
|
+ <!-- 排序统一按发布时间倒序,这里仅保留一个选项以避免误解 -->
|
|
|
<el-select v-model="sortBy" style="width: 160px">
|
|
<el-select v-model="sortBy" style="width: 160px">
|
|
|
- <el-option label="按发布时间顺序排列" value="publish_desc" />
|
|
|
|
|
- <el-option label="按发布时间倒序排列" value="publish_asc" />
|
|
|
|
|
- <el-option label="按阅读量排序" value="views_desc" />
|
|
|
|
|
- <el-option label="按点赞量排序" value="likes_desc" />
|
|
|
|
|
- <el-option label="按评论量排序" value="comments_desc" />
|
|
|
|
|
|
|
+ <el-option label="按发布时间倒序排列" value="publish_desc" />
|
|
|
</el-select>
|
|
</el-select>
|
|
|
<el-input
|
|
<el-input
|
|
|
v-model="searchKeyword"
|
|
v-model="searchKeyword"
|
|
@@ -145,11 +142,13 @@
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
|
|
+ <!-- 类型列暂时不展示
|
|
|
<el-table-column prop="workType" label="类型" width="80" align="center">
|
|
<el-table-column prop="workType" label="类型" width="80" align="center">
|
|
|
<template #default="{ row }">
|
|
<template #default="{ row }">
|
|
|
<span>{{ row.workType || '动态' }}</span>
|
|
<span>{{ row.workType || '动态' }}</span>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
|
|
+ -->
|
|
|
<el-table-column prop="publishTime" label="发布时间" width="160" align="center">
|
|
<el-table-column prop="publishTime" label="发布时间" width="160" align="center">
|
|
|
<template #default="{ row }">
|
|
<template #default="{ row }">
|
|
|
<span class="publish-time">{{ formatTime(row.publishTime) }}</span>
|
|
<span class="publish-time">{{ formatTime(row.publishTime) }}</span>
|
|
@@ -247,8 +246,6 @@ import { ElMessage } from 'element-plus';
|
|
|
import dayjs from 'dayjs';
|
|
import dayjs from 'dayjs';
|
|
|
import request from '@/api/request';
|
|
import request from '@/api/request';
|
|
|
|
|
|
|
|
-const PYTHON_API_URL = 'http://localhost:5005';
|
|
|
|
|
-
|
|
|
|
|
const authStore = useAuthStore();
|
|
const authStore = useAuthStore();
|
|
|
const loading = ref(false);
|
|
const loading = ref(false);
|
|
|
|
|
|
|
@@ -396,10 +393,17 @@ function handleQuery() {
|
|
|
async function loadAccountList() {
|
|
async function loadAccountList() {
|
|
|
try {
|
|
try {
|
|
|
const res = await request.get('/api/accounts');
|
|
const res = await request.get('/api/accounts');
|
|
|
- if (res.data.success) {
|
|
|
|
|
- accountList.value = (res.data.data || []).map((a: any) => ({
|
|
|
|
|
|
|
+ // 新接口:request 已经解包,res 就是账号数组
|
|
|
|
|
+ if (Array.isArray(res)) {
|
|
|
|
|
+ accountList.value = res.map((a: any) => ({
|
|
|
id: a.id,
|
|
id: a.id,
|
|
|
- nickname: a.nickname || a.username,
|
|
|
|
|
|
|
+ nickname: a.accountName || a.nickname || a.username,
|
|
|
|
|
+ }));
|
|
|
|
|
+ } else if ((res as any)?.data?.data) {
|
|
|
|
|
+ // 兼容旧格式 { data: { data: [] } }
|
|
|
|
|
+ accountList.value = (res as any).data.data.map((a: any) => ({
|
|
|
|
|
+ id: a.id,
|
|
|
|
|
+ nickname: a.accountName || a.nickname || a.username,
|
|
|
}));
|
|
}));
|
|
|
}
|
|
}
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
@@ -427,40 +431,53 @@ async function loadData() {
|
|
|
loading.value = true;
|
|
loading.value = true;
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
- const queryParams = new URLSearchParams({
|
|
|
|
|
- user_id: userId.toString(),
|
|
|
|
|
- start_date: startDate.value,
|
|
|
|
|
- end_date: endDate.value,
|
|
|
|
|
- page: currentPage.value.toString(),
|
|
|
|
|
- page_size: pageSize.value.toString(),
|
|
|
|
|
- sort_by: sortBy.value,
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
|
|
+ const params: Record<string, any> = {
|
|
|
|
|
+ startDate: startDate.value,
|
|
|
|
|
+ endDate: endDate.value,
|
|
|
|
|
+ page: currentPage.value,
|
|
|
|
|
+ pageSize: pageSize.value,
|
|
|
|
|
+ sortBy: sortBy.value,
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
if (selectedPlatform.value) {
|
|
if (selectedPlatform.value) {
|
|
|
- queryParams.append('platform', selectedPlatform.value);
|
|
|
|
|
|
|
+ params.platform = selectedPlatform.value;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if (selectedAccounts.value.length > 0) {
|
|
if (selectedAccounts.value.length > 0) {
|
|
|
- queryParams.append('account_ids', selectedAccounts.value.join(','));
|
|
|
|
|
|
|
+ params.accountIds = selectedAccounts.value.join(',');
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if (searchKeyword.value) {
|
|
if (searchKeyword.value) {
|
|
|
- queryParams.append('keyword', searchKeyword.value);
|
|
|
|
|
|
|
+ params.keyword = searchKeyword.value;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- const response = await fetch(`${PYTHON_API_URL}/work_day_statistics/works?${queryParams}`);
|
|
|
|
|
- const result = await response.json();
|
|
|
|
|
-
|
|
|
|
|
- if (result.success && result.data) {
|
|
|
|
|
- workList.value = result.data.works || [];
|
|
|
|
|
- totalWorks.value = result.data.total || 0;
|
|
|
|
|
-
|
|
|
|
|
- if (result.data.summary) {
|
|
|
|
|
- summaryData.value = result.data.summary;
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if (selectedGroup.value) {
|
|
|
|
|
+ params.groupId = selectedGroup.value;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const data = await request.get('/api/work-day-statistics/works', {
|
|
|
|
|
+ params,
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ if (data) {
|
|
|
|
|
+ workList.value = (data.works || []) as WorkData[];
|
|
|
|
|
+ totalWorks.value = data.total || 0;
|
|
|
|
|
+
|
|
|
|
|
+ if (data.summary) {
|
|
|
|
|
+ summaryData.value = {
|
|
|
|
|
+ totalWorks: data.summary.totalWorks || 0,
|
|
|
|
|
+ recommendCount: data.summary.recommendCount || 0,
|
|
|
|
|
+ viewsCount: data.summary.viewsCount || 0,
|
|
|
|
|
+ commentsCount: data.summary.commentsCount || 0,
|
|
|
|
|
+ sharesCount: data.summary.sharesCount || 0,
|
|
|
|
|
+ collectsCount: data.summary.collectsCount || 0,
|
|
|
|
|
+ likesCount: data.summary.likesCount || 0,
|
|
|
|
|
+ };
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
console.error('加载作品数据失败:', error);
|
|
console.error('加载作品数据失败:', error);
|
|
|
|
|
+ ElMessage.error('加载作品数据失败,请稍后重试');
|
|
|
} finally {
|
|
} finally {
|
|
|
loading.value = false;
|
|
loading.value = false;
|
|
|
}
|
|
}
|