Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 38f8fe9bd0 | |||
| 21eec1085a |
@@ -93,10 +93,5 @@ export default {
|
|||||||
revenueTime: 'Time',
|
revenueTime: 'Time',
|
||||||
close: 'Close',
|
close: 'Close',
|
||||||
selectPlaceholder: 'Please select',
|
selectPlaceholder: 'Please select',
|
||||||
countryEng: 'Country (EN)',
|
|
||||||
videoCount: 'Video Count',
|
|
||||||
heart: 'Likes',
|
|
||||||
signature: 'Bio Signature',
|
|
||||||
bioLink: 'Bio Link',
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,10 +93,5 @@
|
|||||||
revenueTime: '时间',
|
revenueTime: '时间',
|
||||||
close: '关闭',
|
close: '关闭',
|
||||||
selectPlaceholder: '请选择',
|
selectPlaceholder: '请选择',
|
||||||
countryEng: '国家(英文)',
|
|
||||||
videoCount: '视频数量',
|
|
||||||
heart: '点赞数',
|
|
||||||
signature: '主页签名',
|
|
||||||
bioLink: '主页链接',
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -129,16 +129,16 @@ export function usePythonBridge() {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 查询TK登录状态
|
||||||
// 查询主播列表
|
const getTkLoginStatus = () => {
|
||||||
const getHosts = (data) => {
|
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
if (!bridge.value) return resolve(null);
|
if (!bridge.value) return resolve(false);
|
||||||
callBridge('searchHosts', JSON.stringify(data), (result) => {
|
callBridge('getTkLoginStatus', (result) => {
|
||||||
resolve(result);
|
resolve(result);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// 在组件挂载时初始化桥接
|
// 在组件挂载时初始化桥接
|
||||||
onMounted(initBridge);
|
onMounted(initBridge);
|
||||||
|
|
||||||
@@ -153,6 +153,6 @@ export function usePythonBridge() {
|
|||||||
exportToExcel,
|
exportToExcel,
|
||||||
stopScript,
|
stopScript,
|
||||||
getVersion,
|
getVersion,
|
||||||
getHosts,
|
getTkLoginStatus,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
<div class="auth-left">
|
<div class="auth-left">
|
||||||
<div class="logo ">
|
<div class="logo ">
|
||||||
<img class="logo-image" src="@/assets/logo2.png" alt="">
|
<img class="logo-image" src="@/assets/logo2.png" alt="">
|
||||||
<span class="logo-title">TK主播数据助手(定制版)</span>
|
<span class="logo-title">TK主播数据助手</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="welcome">{{ $t('login.title') }}</div>
|
<div class="welcome">{{ $t('login.title') }}</div>
|
||||||
<div class="from">
|
<div class="from">
|
||||||
|
|||||||
@@ -4,54 +4,36 @@
|
|||||||
<header class="px-8 py-6 border-b border-slate-100 dark:border-slate-200/60 bg-white">
|
<header class="px-8 py-6 border-b border-slate-100 dark:border-slate-200/60 bg-white">
|
||||||
<div class="flex flex-wrap items-center gap-4">
|
<div class="flex flex-wrap items-center gap-4">
|
||||||
<div class="relative flex-1 min-w-[200px]">
|
<div class="relative flex-1 min-w-[200px]">
|
||||||
<select
|
<select v-model="searchForm.country"
|
||||||
v-model="searchForm.country"
|
class="w-full bg-slate-50 border-none rounded-xl py-3 pl-4 pr-10 text-sm text-slate-600 appearance-none focus:ring-2 focus:ring-primary/20 shadow-soft-inner outline-none">
|
||||||
class="w-full bg-slate-50 border-none rounded-xl py-3 pl-4 pr-10 text-sm text-slate-600 appearance-none focus:ring-2 focus:ring-primary/20 shadow-soft-inner outline-none"
|
|
||||||
>
|
|
||||||
<option value="">{{ $t('hostList.selectAll') }}</option>
|
<option value="">{{ $t('hostList.selectAll') }}</option>
|
||||||
<option v-for="item in options" :key="item.value" :value="item.value">{{ item.label }}</option>
|
<option v-for="item in options" :key="item.value" :value="item.value">{{ item.label }}</option>
|
||||||
</select>
|
</select>
|
||||||
<span class="material-icons-round absolute right-3 top-1/2 -translate-y-1/2 text-slate-400 pointer-events-none">expand_more</span>
|
<span
|
||||||
|
class="material-icons-round absolute right-3 top-1/2 -translate-y-1/2 text-slate-400 pointer-events-none">expand_more</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="relative flex-1 min-w-[200px]">
|
<div class="relative flex-1 min-w-[200px]">
|
||||||
<span class="material-icons-round absolute left-3 top-1/2 -translate-y-1/2 text-slate-400 text-sm pointer-events-none">calendar_today</span>
|
<span
|
||||||
<input
|
class="material-icons-round absolute left-3 top-1/2 -translate-y-1/2 text-slate-400 text-sm pointer-events-none">calendar_today</span>
|
||||||
ref="dateInput"
|
<input ref="dateInput" v-model="searchForm.createTime" type="date" @click="openDatePicker"
|
||||||
v-model="searchForm.createTime"
|
class="w-full bg-slate-50 border-none rounded-xl py-3 pl-10 pr-4 text-sm text-slate-600 focus:ring-2 focus:ring-primary/20 shadow-soft-inner outline-none cursor-pointer" />
|
||||||
type="date"
|
|
||||||
@click="openDatePicker"
|
|
||||||
class="w-full bg-slate-50 border-none rounded-xl py-3 pl-10 pr-4 text-sm text-slate-600 focus:ring-2 focus:ring-primary/20 shadow-soft-inner outline-none cursor-pointer"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="relative flex-[1.5] min-w-[240px]">
|
<div class="relative flex-[1.5] min-w-[240px]">
|
||||||
<input
|
<input v-model="searchForm.hostsId"
|
||||||
v-model="searchForm.hostsId"
|
class="w-full bg-slate-50 border-none rounded-xl py-3 px-4 text-sm text-slate-600 focus:ring-2 focus:ring-primary/20 shadow-soft-inner outline-none"
|
||||||
class="w-full bg-slate-50 border-none rounded-xl py-3 px-4 text-sm text-slate-600 focus:ring-2 focus:ring-primary/20 shadow-soft-inner outline-none"
|
:placeholder="$t('hostList.placeHostId')" />
|
||||||
:placeholder="$t('hostList.placeHostId')"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex items-center gap-2 ml-auto">
|
<div class="flex items-center gap-2 ml-auto">
|
||||||
<button
|
<button @click="serch"
|
||||||
@click="serch"
|
class="bg-primary hover:bg-blue-700 text-white px-8 py-3 rounded-xl font-medium text-sm transition-all shadow-lg shadow-primary/20 flex items-center gap-2">
|
||||||
class="bg-primary hover:bg-blue-700 text-white px-8 py-3 rounded-xl font-medium text-sm transition-all shadow-lg shadow-primary/20 flex items-center gap-2"
|
|
||||||
>
|
|
||||||
<span class="material-icons-round text-sm">search</span>
|
<span class="material-icons-round text-sm">search</span>
|
||||||
{{ $t('hostList.query') }}
|
{{ $t('hostList.query') }}
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button @click="filterdialogVisible = true"
|
||||||
@click="handleExport"
|
class="bg-slate-100 hover:bg-slate-200 text-slate-600 p-3 rounded-xl transition-all">
|
||||||
class="bg-emerald-500 hover:bg-emerald-600 text-white px-6 py-3 rounded-xl font-medium text-sm transition-all shadow-lg shadow-emerald-500/20 flex items-center gap-2"
|
|
||||||
>
|
|
||||||
<span class="material-icons-round text-sm">download</span>
|
|
||||||
{{ $t('hostList.export') }}
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
@click="filterdialogVisible = true"
|
|
||||||
class="bg-slate-100 hover:bg-slate-200 text-slate-600 p-3 rounded-xl transition-all"
|
|
||||||
>
|
|
||||||
<span class="material-icons-round">tune</span>
|
<span class="material-icons-round">tune</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -61,178 +43,174 @@
|
|||||||
<!-- Table -->
|
<!-- Table -->
|
||||||
<div class="flex-1 flex flex-col overflow-hidden relative" style="padding-left: 20px;">
|
<div class="flex-1 flex flex-col overflow-hidden relative" style="padding-left: 20px;">
|
||||||
<div v-if="loading" class="absolute inset-0 bg-white/50 z-30 flex items-center justify-center">
|
<div v-if="loading" class="absolute inset-0 bg-white/50 z-30 flex items-center justify-center">
|
||||||
<span class="material-icons-round animate-spin text-primary text-4xl">sync</span>
|
<span class="material-icons-round animate-spin text-primary text-4xl">sync</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Table with Fixed Layout -->
|
<!-- Table with Fixed Layout -->
|
||||||
<div class="flex-1 overflow-auto">
|
<div class="flex-1 overflow-auto">
|
||||||
<table class="w-full text-left" style="table-layout: fixed; min-width: 1000px;">
|
<table class="w-full text-left" style="table-layout: fixed; min-width: 1000px;">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col style="width: 10%;">
|
<col style="width: 12%;">
|
||||||
<col style="width: 4%;">
|
<col style="width: 5%;">
|
||||||
<col style="width: 6%;">
|
<col style="width: 8%;">
|
||||||
<col style="width: 6%;">
|
|
||||||
<col style="width: 8%;">
|
<col style="width: 8%;">
|
||||||
<col style="width: 6%;">
|
<col style="width: 6%;">
|
||||||
<col style="width: 5%;">
|
<col style="width: 10%;">
|
||||||
<col style="width: 5%;">
|
<col style="width: 8%;">
|
||||||
<col style="width: 5%;">
|
<col style="width: 8%;">
|
||||||
<col style="width: 5%;">
|
<col style="width: 7%;">
|
||||||
<col style="width: 15%;">
|
<col style="width: 7%;">
|
||||||
<col style="width: 15%;">
|
<col style="width: 7%;">
|
||||||
|
<col style="width: 7%;">
|
||||||
</colgroup>
|
</colgroup>
|
||||||
<thead class="bg-white sticky top-0 z-10">
|
<thead class="bg-white sticky top-0 z-10">
|
||||||
<tr class="text-slate-400 text-xs font-semibold uppercase tracking-wider border-b border-slate-100">
|
<tr class="text-slate-400 text-xs font-semibold uppercase tracking-wider border-b border-slate-100">
|
||||||
<th class="py-3 px-2 font-semibold bg-white">{{ $t('hostList.hostId') }}</th>
|
<th class="py-3 px-2 font-semibold bg-white">{{ $t('hostList.hostId') }}</th>
|
||||||
<th class="py-3 px-2 font-semibold bg-white">{{ $t('hostList.grade') }}</th>
|
<th class="py-3 px-2 font-semibold bg-white">{{ $t('hostList.grade') }}</th>
|
||||||
|
<th class="py-3 px-2 font-semibold bg-white">{{ $t('hostList.invitationType') }}</th>
|
||||||
|
<!-- <th class="py-3 px-2 font-semibold bg-white">{{ $t('hostList.liveSessions') }}/{{ $t('hostList.liveRevenue') }}</th> -->
|
||||||
|
<th class="py-3 px-2 font-semibold bg-white">{{ $t('hostList.liveSessions') }}</th>
|
||||||
<th class="py-3 px-2 font-semibold bg-white">{{ $t('hostList.country') }}</th>
|
<th class="py-3 px-2 font-semibold bg-white">{{ $t('hostList.country') }}</th>
|
||||||
<th class="py-3 px-2 font-semibold bg-white">{{ $t('hostList.countryEng') }}</th>
|
|
||||||
<th class="py-3 px-2 font-semibold bg-white">{{ $t('hostList.creationTime') }}</th>
|
<th class="py-3 px-2 font-semibold bg-white">{{ $t('hostList.creationTime') }}</th>
|
||||||
<th class="py-3 px-2 font-semibold bg-white">{{ $t('hostList.anchorcoins') }}</th>
|
<th class="py-3 px-2 font-semibold bg-white">{{ $t('hostList.anchorcoins') }}</th>
|
||||||
|
<th class="py-3 px-2 font-semibold bg-white">{{ $t('hostList.yesterdayGoldCoins') }}</th>
|
||||||
<th class="py-3 px-2 font-semibold bg-white">{{ $t('hostList.fansNum') }}</th>
|
<th class="py-3 px-2 font-semibold bg-white">{{ $t('hostList.fansNum') }}</th>
|
||||||
<th class="py-3 px-2 font-semibold bg-white">{{ $t('hostList.followersNum') }}</th>
|
<th class="py-3 px-2 font-semibold bg-white">{{ $t('hostList.followersNum') }}</th>
|
||||||
<th class="py-3 px-2 font-semibold bg-white">{{ $t('hostList.videoCount') }}</th>
|
<th class="py-3 px-2 font-semibold bg-white">{{ $t('hostList.onlineFans') }}</th>
|
||||||
<th class="py-3 px-2 font-semibold bg-white">{{ $t('hostList.heart') }}</th>
|
<th class="py-3 px-2 font-semibold bg-white">{{ $t('hostList.anchorType') }}</th>
|
||||||
<th class="py-3 px-2 font-semibold bg-white">{{ $t('hostList.signature') }}</th>
|
|
||||||
<th class="py-3 px-2 font-semibold bg-white">{{ $t('hostList.bioLink') }}</th>
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody class="text-sm text-slate-600">
|
<tbody class="text-sm text-slate-600">
|
||||||
<tr v-if="tableData.length === 0" class="text-center">
|
<tr v-if="tableData.length === 0" class="text-center">
|
||||||
<td colspan="14" class="py-10 text-slate-400">暂无数据</td>
|
<td colspan="14" class="py-10 text-slate-400">暂无数据</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr v-for="row in tableData" :key="row.hostId" class="group hover:bg-slate-50/80 transition-colors">
|
<tr v-for="row in tableData" :key="row.hostId" class="group hover:bg-slate-50/80 transition-colors">
|
||||||
|
|
||||||
|
|
||||||
<!-- Host ID -->
|
|
||||||
<td class="py-4 px-2 border-b border-slate-50 group-last:border-none">
|
|
||||||
<span
|
|
||||||
@click="openHTML(row.hostId)"
|
|
||||||
class="font-medium text-slate-900 border-b border-transparent group-hover:border-primary/30 transition-all cursor-pointer hover:text-primary"
|
|
||||||
>
|
|
||||||
{{ row.hostId }}
|
|
||||||
</span>
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<!-- Level -->
|
|
||||||
<td class="py-4 px-2 border-b border-slate-50 group-last:border-none">
|
|
||||||
{{ row.hostlevel }}
|
|
||||||
</td>
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Host ID -->
|
||||||
|
<td class="py-4 px-2 border-b border-slate-50 group-last:border-none">
|
||||||
|
<span @click="openHTML(row.hostId)"
|
||||||
|
class="font-medium text-slate-900 border-b border-transparent group-hover:border-primary/30 transition-all cursor-pointer hover:text-primary">
|
||||||
|
{{ row.hostId }}
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<!-- Level -->
|
||||||
<!-- Country -->
|
<td class="py-4 px-2 border-b border-slate-50 group-last:border-none">
|
||||||
<td class="py-4 px-2 border-b border-slate-50 group-last:border-none">
|
{{ row.hostlevel }}
|
||||||
{{ row.country }}
|
</td>
|
||||||
</td>
|
|
||||||
|
|
||||||
<!-- Country English -->
|
|
||||||
<td class="py-4 px-2 border-b border-slate-50 group-last:border-none">
|
|
||||||
{{ row.countryEng }}
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<!-- Time -->
|
|
||||||
<td class="py-4 px-2 border-b border-slate-50 group-last:border-none">
|
|
||||||
<div class="flex flex-col">
|
|
||||||
<span>{{ formatTimeOnlyDate(row.createTime) }}</span>
|
|
||||||
<span class="text-[10px] text-slate-400">{{ formatTimeOnlyTime(row.createTime) }}</span>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<!-- Coins -->
|
|
||||||
<td class="py-4 px-2 border-b border-slate-50 group-last:border-none font-semibold text-slate-900">
|
|
||||||
{{ row.hostsCoins }}
|
|
||||||
</td>
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Invitation Type -->
|
||||||
<!-- Fans -->
|
<td class="py-4 px-2 border-b border-slate-50 group-last:border-none">
|
||||||
<td class="py-4 px-2 border-b border-slate-50 group-last:border-none">
|
<span class="px-3 py-1 text-[10px] font-bold uppercase rounded-full"
|
||||||
{{ row.fans }}
|
:class="row.invitationType == 1 ? 'bg-green-50 text-green-600' : 'bg-amber-50 text-amber-600'">
|
||||||
</td>
|
{{ row.invitationType == 1 ? $t('hostList.invitationType1') : $t('hostList.invitationType2') }}
|
||||||
|
</span>
|
||||||
<!-- Followers -->
|
</td>
|
||||||
<td class="py-4 px-2 border-b border-slate-50 group-last:border-none">
|
|
||||||
{{ row.fllowernum }}
|
<!-- Data Buttons -->
|
||||||
</td>
|
<td class="py-4 px-2 border-b border-slate-50 group-last:border-none">
|
||||||
|
<div class="flex gap-2">
|
||||||
<!-- Video Count -->
|
<button
|
||||||
<td class="py-4 px-2 border-b border-slate-50 group-last:border-none">
|
@click="getliveHost(row.hostId)"
|
||||||
{{ row.videoCount }}
|
class="px-3 py-1.5 bg-blue-50 text-blue-600 hover:bg-blue-600 hover:text-white rounded-lg text-xs font-medium transition-all"
|
||||||
</td>
|
>
|
||||||
|
{{ $t('hostList.viewSessions') }}
|
||||||
<!-- Heart/Likes -->
|
</button>
|
||||||
<td class="py-4 px-2 border-b border-slate-50 group-last:border-none">
|
<!-- <button
|
||||||
{{ row.heart }}
|
@click="getRevenueStats(row.hostId)"
|
||||||
</td>
|
class="px-3 py-1.5 bg-sky-50 text-sky-600 hover:bg-sky-600 hover:text-white rounded-lg text-xs font-medium transition-all"
|
||||||
|
>
|
||||||
<!-- Signature -->
|
{{ $t('hostList.viewRevenue') }}
|
||||||
<td class="py-4 px-2 border-b border-slate-50 group-last:border-none">
|
</button> -->
|
||||||
<span class="truncate block max-w-[150px]" :title="row.signature">{{ row.signature }}</span>
|
</div>
|
||||||
</td>
|
|
||||||
|
|
||||||
<!-- Bio Link -->
|
|
||||||
<td class="py-4 px-2 border-b border-slate-50 group-last:border-none">
|
|
||||||
<a v-if="row.bioLink" :href="row.bioLink" target="_blank" class="text-primary hover:underline truncate block max-w-[150px]" :title="row.bioLink">
|
|
||||||
{{ row.bioLink }}
|
|
||||||
</a>
|
|
||||||
<span v-else>-</span>
|
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
</tr>
|
<!-- Country -->
|
||||||
</tbody>
|
<td class="py-4 px-2 border-b border-slate-50 group-last:border-none">
|
||||||
</table>
|
{{ row.country }}
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<!-- Time -->
|
||||||
|
<td class="py-4 px-2 border-b border-slate-50 group-last:border-none">
|
||||||
|
<div class="flex flex-col">
|
||||||
|
<span>{{ formatTimeOnlyDate(row.createTime) }}</span>
|
||||||
|
<span class="text-[10px] text-slate-400">{{ formatTimeOnlyTime(row.createTime) }}</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<!-- Coins -->
|
||||||
|
<td class="py-4 px-2 border-b border-slate-50 group-last:border-none font-semibold text-slate-900">
|
||||||
|
{{ row.hostsCoins }}
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<!-- Yesterday Coins -->
|
||||||
|
<td class="py-4 px-2 border-b border-slate-50 group-last:border-none">
|
||||||
|
{{ row.yesterdayCoins }}
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<!-- Fans -->
|
||||||
|
<td class="py-4 px-2 border-b border-slate-50 group-last:border-none">
|
||||||
|
{{ row.fans }}
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<!-- Followers -->
|
||||||
|
<td class="py-4 px-2 border-b border-slate-50 group-last:border-none">
|
||||||
|
{{ row.fllowernum }}
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<!-- Online Fans -->
|
||||||
|
<td class="py-4 px-2 border-b border-slate-50 group-last:border-none">
|
||||||
|
{{ row.onlineFans }}
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<!-- Host Kind -->
|
||||||
|
<td class="py-4 px-2 border-b border-slate-50 group-last:border-none">
|
||||||
|
{{ row.hostsKind }}
|
||||||
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Footer / Pagination -->
|
<!-- Footer / Pagination -->
|
||||||
<footer class="px-8 py-6 border-t border-slate-100 dark:border-slate-200/60 bg-white flex flex-wrap items-center justify-between gap-4">
|
<footer
|
||||||
|
class="px-8 py-6 border-t border-slate-100 dark:border-slate-200/60 bg-white flex flex-wrap items-center justify-between gap-4">
|
||||||
<div class="flex items-center gap-4">
|
<div class="flex items-center gap-4">
|
||||||
<div class="relative">
|
<div class="relative">
|
||||||
<select
|
<select v-model="pageSize" @change="handleSizeChange"
|
||||||
v-model="pageSize"
|
class="bg-slate-50 border-none rounded-lg py-2 pl-4 pr-10 text-sm text-slate-600 appearance-none focus:ring-2 focus:ring-primary/20 shadow-soft-inner outline-none">
|
||||||
@change="handleSizeChange"
|
|
||||||
class="bg-slate-50 border-none rounded-lg py-2 pl-4 pr-10 text-sm text-slate-600 appearance-none focus:ring-2 focus:ring-primary/20 shadow-soft-inner outline-none"
|
|
||||||
>
|
|
||||||
<option :value="10">10/page</option>
|
<option :value="10">10/page</option>
|
||||||
<option :value="20">20/page</option>
|
<option :value="20">20/page</option>
|
||||||
<option :value="50">50/page</option>
|
<option :value="50">50/page</option>
|
||||||
<option :value="100">100/page</option>
|
<option :value="100">100/page</option>
|
||||||
</select>
|
</select>
|
||||||
<span class="material-icons-round absolute right-2 top-1/2 -translate-y-1/2 text-slate-400 text-sm pointer-events-none">expand_more</span>
|
<span
|
||||||
|
class="material-icons-round absolute right-2 top-1/2 -translate-y-1/2 text-slate-400 text-sm pointer-events-none">expand_more</span>
|
||||||
</div>
|
</div>
|
||||||
<span class="text-xs text-slate-400 font-medium">总条数: <span class="text-primary">{{ total }}</span></span>
|
<span class="text-xs text-slate-400 font-medium">总条数: <span class="text-primary">{{ total }}</span></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex items-center gap-1">
|
<div class="flex items-center gap-1">
|
||||||
<button
|
<button @click="changePage(page - 1)" :disabled="page <= 1"
|
||||||
@click="changePage(page - 1)"
|
class="p-2 text-slate-400 hover:bg-slate-100 rounded-lg transition-colors disabled:opacity-50">
|
||||||
:disabled="page <= 1"
|
|
||||||
class="p-2 text-slate-400 hover:bg-slate-100 rounded-lg transition-colors disabled:opacity-50"
|
|
||||||
>
|
|
||||||
<span class="material-icons-round text-lg">chevron_left</span>
|
<span class="material-icons-round text-lg">chevron_left</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<!-- Page Numbers -->
|
<!-- Page Numbers -->
|
||||||
<template v-for="(p, index) in paginationPages" :key="index">
|
<template v-for="(p, index) in paginationPages" :key="index">
|
||||||
<span v-if="p === '...'" class="w-8 h-8 flex items-center justify-center text-slate-400 text-sm">...</span>
|
<span v-if="p === '...'" class="w-8 h-8 flex items-center justify-center text-slate-400 text-sm">...</span>
|
||||||
<button
|
<button v-else @click="changePage(p)" class="w-8 h-8 rounded-lg text-xs font-bold transition-all"
|
||||||
v-else
|
:class="p === page ? 'bg-slate-900 text-white shadow-md' : 'text-slate-600 hover:bg-slate-100'">
|
||||||
@click="changePage(p)"
|
|
||||||
class="w-8 h-8 rounded-lg text-xs font-bold transition-all"
|
|
||||||
:class="p === page ? 'bg-slate-900 text-white shadow-md' : 'text-slate-600 hover:bg-slate-100'"
|
|
||||||
>
|
|
||||||
{{ p }}
|
{{ p }}
|
||||||
</button>
|
</button>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<button
|
<button @click="changePage(page + 1)" :disabled="page >= totalPages"
|
||||||
@click="changePage(page + 1)"
|
class="p-2 text-slate-400 hover:bg-slate-100 rounded-lg transition-colors disabled:opacity-50">
|
||||||
:disabled="page >= totalPages"
|
|
||||||
class="p-2 text-slate-400 hover:bg-slate-100 rounded-lg transition-colors disabled:opacity-50"
|
|
||||||
>
|
|
||||||
<span class="material-icons-round text-lg">chevron_right</span>
|
<span class="material-icons-round text-lg">chevron_right</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -266,14 +244,16 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="10">
|
<el-col :span="10">
|
||||||
<div><label class="text-sm text-slate-500 mb-1 block">{{ $t('hostList.sortType') }}</label></div>
|
<div><label class="text-sm text-slate-500 mb-1 block">{{ $t('hostList.sortType') }}</label></div>
|
||||||
<el-select v-model="sortData.sortBy" filterable :placeholder="$t('hostList.selectPlaceholder')"
|
<el-select v-model="sortData.sortType" filterable :placeholder="$t('hostList.selectPlaceholder')"
|
||||||
class="w-full">
|
class="w-full">
|
||||||
<el-option v-for="item in sortNameOptions" :key="item.type" :label="item.label" :value="item.type" />
|
<el-option v-for="item in sortNameOptions" :key="item.type" :label="item.label" :value="item.type" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="10">
|
<el-col :span="10">
|
||||||
<div><label class="text-sm text-slate-500 mb-1 block">{{ $t('hostList.ascending') }}/{{ $t('hostList.descending') }}</label></div>
|
<div><label class="text-sm text-slate-500 mb-1 block">{{ $t('hostList.ascending') }}/{{
|
||||||
<el-select v-model="sortData.order" filterable :placeholder="$t('hostList.selectPlaceholder')"
|
$t('hostList.descending')
|
||||||
|
}}</label></div>
|
||||||
|
<el-select v-model="sortData.sortForm" filterable :placeholder="$t('hostList.selectPlaceholder')"
|
||||||
class="w-full">
|
class="w-full">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in [{ label: $t('hostList.ascending'), value: 'asc' }, { label: $t('hostList.descending'), value: 'desc' }]"
|
v-for="item in [{ label: $t('hostList.ascending'), value: 'asc' }, { label: $t('hostList.descending'), value: 'desc' }]"
|
||||||
@@ -295,25 +275,71 @@
|
|||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
<!-- Dialogs -->
|
<!-- Dialogs -->
|
||||||
<LiveRecordDialog v-model:modelValue="liveDetailDialogVisible" :rows="liveDetailRecords" @select="handleLiveSelect" />
|
<LiveRecordDialog v-model:modelValue="liveDetailDialogVisible" :rows="liveDetailRecords"
|
||||||
|
@select="handleLiveSelect" />
|
||||||
|
|
||||||
|
<el-dialog v-model="revenueDialogVisible" :title="$t('hostList.liveRevenue')" width="80vw" top="6vh"
|
||||||
|
:close-on-click-modal="false" destroy-on-close>
|
||||||
|
<el-table :data="revenueRecords" border height="62vh" style="width: 100%" v-loading="revenueLoading"
|
||||||
|
table-layout="auto">
|
||||||
|
<el-table-column prop="displayId" :label="$t('hostList.revenueHost')" />
|
||||||
|
<el-table-column prop="todayRevenue" :label="$t('hostList.todayRevenueUsd')" />
|
||||||
|
<el-table-column prop="totalRevenue" :label="$t('hostList.totalRevenueUsd')" />
|
||||||
|
<el-table-column prop="lastDaysCount" :label="$t('hostList.liveDays')" />
|
||||||
|
<el-table-column prop="history" :label="$t('hostList.historyRevenueUsd')">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-tooltip v-if="hasHistory(row.history)" effect="dark" placement="top">
|
||||||
|
<template #content>{{ buildHistoryTitle(row.history) }}</template>
|
||||||
|
<div class="history-sparkline-wrap">
|
||||||
|
<div class="history-sparkline-top">
|
||||||
|
<span class="history-sparkline-min-top">
|
||||||
|
{{ $t('hostList.revenueLow') }}: {{ formatRevenueValue(getHistoryMin(row.history)) }}
|
||||||
|
</span>
|
||||||
|
<span class="history-sparkline-max">
|
||||||
|
{{ $t('hostList.revenueHigh') }}: {{ formatRevenueValue(getHistoryMax(row.history)) }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<svg class="history-sparkline" viewBox="0 0 180 48" preserveAspectRatio="none">
|
||||||
|
<line x1="2" y1="46" x2="178" y2="46" stroke="#e6eef7" stroke-width="1" />
|
||||||
|
<polyline :points="buildSparklinePoints(row.history)" fill="none" stroke="#45a1ff" stroke-width="2" />
|
||||||
|
</svg>
|
||||||
|
<div class="history-sparkline-bottom">
|
||||||
|
<div class="history-sparkline-dates">
|
||||||
|
<span class="history-sparkline-date">{{ getHistoryStartDate(row.history) }}</span>
|
||||||
|
<span class="history-sparkline-date">{{ getHistoryEndDate(row.history) }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-tooltip>
|
||||||
|
<span v-else>-</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="createdAt" :label="$t('hostList.revenueTime')">
|
||||||
|
<template #default="scope">
|
||||||
|
{{ formatTimestamp(scope.row.createdAt) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<template #footer>
|
||||||
|
<el-button @click="revenueDialogVisible = false">{{ $t('hostList.close') }}</el-button>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { getCountryinfo, liveHostDetail, revenueStats } from '@/api/account';
|
import { tkhostdata, getCountryinfo, liveHostDetail, revenueStats } from '@/api/account';
|
||||||
import { usePythonBridge } from '@/utils/pythonBridge'
|
import { usePythonBridge } from '@/utils/pythonBridge'
|
||||||
import { getUser } from '@/utils/storage'
|
import { getUser } from '@/utils/storage'
|
||||||
import { ref, reactive, onMounted, computed } from 'vue';
|
import { ref, reactive, onMounted, computed } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import { ElMessageBox } from 'element-plus'
|
|
||||||
import LiveRecordDialog from '@/components/LiveRecordDialog.vue'
|
import LiveRecordDialog from '@/components/LiveRecordDialog.vue'
|
||||||
|
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const dateInput = ref(null)
|
const dateInput = ref(null)
|
||||||
const { givePyAnchorId, exportToExcel,getHosts } = usePythonBridge();
|
const { givePyAnchorId, exportToExcel } = usePythonBridge();
|
||||||
|
|
||||||
const userInfo = ref(getUser())
|
const userInfo = ref(getUser())
|
||||||
|
|
||||||
@@ -322,27 +348,34 @@ const searchForm = ref({
|
|||||||
country: '',
|
country: '',
|
||||||
createTime: '',
|
createTime: '',
|
||||||
hostsId: '',
|
hostsId: '',
|
||||||
hostsLevel: '',
|
fansMin: null, fansMax: null,
|
||||||
userId: '',
|
onlineFansMin: null, onlineFansMax: null,
|
||||||
min_fans: null, max_fans: null
|
hostsCoinsMin: null, hostsCoinsMax: null,
|
||||||
|
fllowernumMin: null, fllowernumMax: null
|
||||||
})
|
})
|
||||||
|
|
||||||
const fields = [
|
const fields = [
|
||||||
{ label: t('hostList.fansNum'), minModel: 'min_fans', maxModel: 'max_fans' }
|
{ label: t('hostList.fansNum'), minModel: 'fansMin', maxModel: 'fansMax' },
|
||||||
|
{ label: t('hostList.onlineFans'), minModel: 'onlineFansMin', maxModel: 'onlineFansMax' },
|
||||||
|
{ label: t('hostList.anchorcoins'), minModel: 'hostsCoinsMin', maxModel: 'hostsCoinsMax' },
|
||||||
|
{ label: t('hostList.followersNum'), minModel: 'fllowernumMin', maxModel: 'fllowernumMax' },
|
||||||
]
|
]
|
||||||
|
|
||||||
let sortData = ref({ order: 'desc', sortBy: "createTime" })
|
let sortData = ref({ sortForm: 'desc', sortType: "createTime" })
|
||||||
let sortNameOptions = ref([
|
let sortNameOptions = ref([
|
||||||
{ label: t('hostList.creationTime'), type: 'createTime' },
|
{ label: t('hostList.creationTime'), type: 'createTime' },
|
||||||
{ label: t('hostList.anchorcoins'), type: 'coins' },
|
{ label: t('hostList.anchorcoins'), type: 'hostsCoins' },
|
||||||
{ label: t('hostList.fansNum'), type: 'fans' },
|
{ label: t('hostList.fansNum'), type: 'fans' },
|
||||||
{ label: t('hostList.hostId'), type: 'hostsId' }
|
{ label: t('hostList.yesterdayGoldCoins'), type: 'yesterdayCoins' },
|
||||||
|
{ label: t('hostList.onlineFans'), type: 'onlineFans' },
|
||||||
|
{ label: t('hostList.followersNum'), type: 'fllowernum' },
|
||||||
])
|
])
|
||||||
|
|
||||||
let selectHostList = ref([])
|
let selectHostList = ref([])
|
||||||
let filterdialogVisible = ref(false)
|
let filterdialogVisible = ref(false)
|
||||||
let liveDetailDialogVisible = ref(false)
|
let liveDetailDialogVisible = ref(false)
|
||||||
let liveDetailRecords = ref([])
|
let liveDetailRecords = ref([])
|
||||||
|
let revenueDialogVisible = ref(false)
|
||||||
let revenueRecords = ref([])
|
let revenueRecords = ref([])
|
||||||
let revenueLoading = ref(false)
|
let revenueLoading = ref(false)
|
||||||
|
|
||||||
@@ -352,10 +385,8 @@ let total = ref(0)
|
|||||||
let options = ref([])
|
let options = ref([])
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
setTimeout(() => {
|
getCountry();
|
||||||
getCountry();
|
getlist();
|
||||||
getlist();
|
|
||||||
}, 1000);
|
|
||||||
})
|
})
|
||||||
|
|
||||||
function serch() {
|
function serch() {
|
||||||
@@ -395,7 +426,7 @@ const paginationPages = computed(() => {
|
|||||||
const current = page.value
|
const current = page.value
|
||||||
const totalP = totalPages.value
|
const totalP = totalPages.value
|
||||||
const pages = []
|
const pages = []
|
||||||
|
|
||||||
if (totalP <= 7) {
|
if (totalP <= 7) {
|
||||||
// 总页数小于等于7,显示全部
|
// 总页数小于等于7,显示全部
|
||||||
for (let i = 1; i <= totalP; i++) {
|
for (let i = 1; i <= totalP; i++) {
|
||||||
@@ -404,15 +435,15 @@ const paginationPages = computed(() => {
|
|||||||
} else {
|
} else {
|
||||||
// 总是显示第一页
|
// 总是显示第一页
|
||||||
pages.push(1)
|
pages.push(1)
|
||||||
|
|
||||||
if (current > 4) {
|
if (current > 4) {
|
||||||
pages.push('...')
|
pages.push('...')
|
||||||
}
|
}
|
||||||
|
|
||||||
// 计算中间页码范围
|
// 计算中间页码范围
|
||||||
let start = Math.max(2, current - 2)
|
let start = Math.max(2, current - 2)
|
||||||
let end = Math.min(totalP - 1, current + 2)
|
let end = Math.min(totalP - 1, current + 2)
|
||||||
|
|
||||||
// 调整范围确保显示足够的页码
|
// 调整范围确保显示足够的页码
|
||||||
if (current <= 4) {
|
if (current <= 4) {
|
||||||
end = Math.min(5, totalP - 1)
|
end = Math.min(5, totalP - 1)
|
||||||
@@ -420,59 +451,53 @@ const paginationPages = computed(() => {
|
|||||||
if (current >= totalP - 3) {
|
if (current >= totalP - 3) {
|
||||||
start = Math.max(totalP - 4, 2)
|
start = Math.max(totalP - 4, 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let i = start; i <= end; i++) {
|
for (let i = start; i <= end; i++) {
|
||||||
pages.push(i)
|
pages.push(i)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (current < totalP - 3) {
|
if (current < totalP - 3) {
|
||||||
pages.push('...')
|
pages.push('...')
|
||||||
}
|
}
|
||||||
|
|
||||||
// 总是显示最后一页
|
// 总是显示最后一页
|
||||||
if (totalP > 1) {
|
if (totalP > 1) {
|
||||||
pages.push(totalP)
|
pages.push(totalP)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return pages
|
return pages
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
const getlist = () => {
|
const getlist = () => {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
console.log('getlist', searchForm.value)
|
tkhostdata({
|
||||||
getHosts({
|
tenantId: Number(userInfo.value.tenantId),
|
||||||
page: page.value,
|
sort: sortData.value.sortForm,
|
||||||
limit: pageSize.value,
|
sortName: sortData.value.sortType,
|
||||||
order: sortData.value.order,
|
"current": page.value,
|
||||||
sortBy: sortData.value.sortBy,
|
"pageSize": pageSize.value,
|
||||||
country: searchForm.value.country || undefined,
|
...searchForm.value,
|
||||||
hostsId: searchForm.value.hostsId || undefined,
|
|
||||||
hostsLevel: searchForm.value.hostsLevel || undefined,
|
|
||||||
userId: searchForm.value.userId || undefined,
|
|
||||||
min_fans: searchForm.value.min_fans || undefined,
|
|
||||||
max_fans: searchForm.value.max_fans || undefined
|
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
if (res && res.data) {
|
if (res) {
|
||||||
console.log('主播列表', res)
|
console.log('主播列表', res)
|
||||||
console.error('返回主播列表', res)
|
total.value = Number(res.total)
|
||||||
|
tableData.value = res.records.map(item => ({
|
||||||
total.value = Number(res.data.pagination?.total || 0)
|
|
||||||
tableData.value = (res.data.list || []).map(item => ({
|
|
||||||
hostId: item.hostsId,
|
hostId: item.hostsId,
|
||||||
hostlevel: item.hostsLevel,
|
hostlevel: item.hostsLevel,
|
||||||
country: item.country,
|
country: item.country,
|
||||||
countryEng: item.countryEng,
|
|
||||||
createTime: item.createTime,
|
createTime: item.createTime,
|
||||||
fans: item.fans,
|
fans: item.fans,
|
||||||
fllowernum: item.fllowernum,
|
fllowernum: item.fllowernum,
|
||||||
hostsCoins: item.hostsCoins,
|
hostsCoins: item.hostsCoins,
|
||||||
videoCount: item.video_count,
|
hostsKind: item.hostsKind,
|
||||||
heart: item.heart,
|
onlineFans: item.onlineFans,
|
||||||
signature: item.signature,
|
yesterdayCoins: item.yesterdayCoins,
|
||||||
bioLink: item.bio_link,
|
belongBy: item.belongBy,
|
||||||
|
useable: item.useable,
|
||||||
|
invitationType: item.invitationType,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
@@ -485,63 +510,46 @@ function handelClick() {
|
|||||||
getlist()
|
getlist()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 导出Excel
|
|
||||||
function handleExport() {
|
|
||||||
ElMessageBox.confirm(
|
|
||||||
'请选择导出方式',
|
|
||||||
'导出数据',
|
|
||||||
{
|
|
||||||
confirmButtonText: '导出并删除',
|
|
||||||
cancelButtonText: '仅导出',
|
|
||||||
distinguishCancelAndClose: true,
|
|
||||||
type: 'info',
|
|
||||||
}
|
|
||||||
)
|
|
||||||
.then(() => {
|
|
||||||
// 点击"导出并删除"
|
|
||||||
doExport(true)
|
|
||||||
})
|
|
||||||
.catch((action) => {
|
|
||||||
if (action === 'cancel') {
|
|
||||||
// 点击"仅导出"
|
|
||||||
doExport(false)
|
|
||||||
}
|
|
||||||
// 点击关闭按钮则不做任何操作
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function doExport(isDelete) {
|
|
||||||
exportToExcel({
|
|
||||||
page: page.value,
|
|
||||||
limit: pageSize.value,
|
|
||||||
order: sortData.value.order,
|
|
||||||
sortBy: sortData.value.sortBy,
|
|
||||||
country: searchForm.value.country || undefined,
|
|
||||||
hostsId: searchForm.value.hostsId || undefined,
|
|
||||||
hostsLevel: searchForm.value.hostsLevel || undefined,
|
|
||||||
userId: searchForm.value.userId || undefined,
|
|
||||||
min_fans: searchForm.value.min_fans || undefined,
|
|
||||||
max_fans: searchForm.value.max_fans || undefined,
|
|
||||||
isDelete: isDelete
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function reset() {
|
function reset() {
|
||||||
searchForm.value.min_fans = null
|
searchForm.value.fansMin = null
|
||||||
searchForm.value.max_fans = null
|
searchForm.value.fansMax = null
|
||||||
|
searchForm.value.onlineFansMin = null
|
||||||
|
searchForm.value.onlineFansMax = null
|
||||||
|
searchForm.value.hostsCoinsMin = null
|
||||||
|
searchForm.value.hostsCoinsMax = null
|
||||||
|
searchForm.value.fllowernumMin = null
|
||||||
|
searchForm.value.fllowernumMax = null
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleClose(done) {
|
function handleClose(done) {
|
||||||
done()
|
done()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getliveHost(hostId) {
|
||||||
|
liveHostDetail({
|
||||||
|
"hostsId": hostId,
|
||||||
|
"tenantId": userInfo.value.tenantId
|
||||||
|
}).then(res => {
|
||||||
|
const detailList = Array.isArray(res) ? res : (res?.records || [])
|
||||||
|
liveDetailRecords.value = detailList
|
||||||
|
liveDetailDialogVisible.value = true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
function handleLiveSelect(row) {
|
function handleLiveSelect(row) {
|
||||||
liveDetailDialogVisible.value = false
|
liveDetailDialogVisible.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getRevenueStats(hostId) {
|
||||||
|
revenueLoading.value = true
|
||||||
|
revenueStats(hostId).then(res => {
|
||||||
|
const detailList = Array.isArray(res) ? res : (res?.records || [])
|
||||||
|
revenueRecords.value = detailList
|
||||||
|
revenueDialogVisible.value = true
|
||||||
|
}).finally(() => {
|
||||||
|
revenueLoading.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
function openHTML(id) {
|
function openHTML(id) {
|
||||||
givePyAnchorId(id)
|
givePyAnchorId(id)
|
||||||
@@ -558,13 +566,13 @@ function getCountry() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function formatTimeOnlyDate(val) {
|
function formatTimeOnlyDate(val) {
|
||||||
if(!val) return ''
|
if (!val) return ''
|
||||||
return val.split(' ')[0] || val
|
return val.split(' ')[0] || val
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatTimeOnlyTime(val) {
|
function formatTimeOnlyTime(val) {
|
||||||
if(!val) return ''
|
if (!val) return ''
|
||||||
return val.split(' ')[1] || ''
|
return val.split(' ')[1] || ''
|
||||||
}
|
}
|
||||||
|
|
||||||
// History parsing helpers (preserved from original)
|
// History parsing helpers (preserved from original)
|
||||||
@@ -576,9 +584,9 @@ function parseHistoryItems(history) {
|
|||||||
}
|
}
|
||||||
if (!Array.isArray(arr)) return []
|
if (!Array.isArray(arr)) return []
|
||||||
return arr.map((item, index) => {
|
return arr.map((item, index) => {
|
||||||
if (typeof item === 'number') return { date: `Day ${index + 1}`, value: item }
|
if (typeof item === 'number') return { date: `Day ${index + 1}`, value: item }
|
||||||
if (item && typeof item === 'object') return { date: item.date ? String(item.date) : '', value: Number(item.value ?? 0) }
|
if (item && typeof item === 'object') return { date: item.date ? String(item.date) : '', value: Number(item.value ?? 0) }
|
||||||
return null
|
return null
|
||||||
}).filter(Boolean)
|
}).filter(Boolean)
|
||||||
}
|
}
|
||||||
function hasHistory(history) { return parseHistoryItems(history).length > 0 }
|
function hasHistory(history) { return parseHistoryItems(history).length > 0 }
|
||||||
@@ -633,6 +641,7 @@ function formatTimestamp(value) {
|
|||||||
padding: 4px;
|
padding: 4px;
|
||||||
width: 190px;
|
width: 190px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.history-sparkline-top,
|
.history-sparkline-top,
|
||||||
.history-sparkline-bottom {
|
.history-sparkline-bottom {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -641,6 +650,7 @@ function formatTimestamp(value) {
|
|||||||
color: #64748b;
|
color: #64748b;
|
||||||
margin-bottom: 2px;
|
margin-bottom: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.history-sparkline {
|
.history-sparkline {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
|
|||||||
@@ -1,188 +1,285 @@
|
|||||||
<template>
|
<template>
|
||||||
<!-- 主容器 - 全屏高度布局 -->
|
<div class="grid grid-cols-1 lg:grid-cols-12 gap-4 mb-4">
|
||||||
<div class="flex flex-col h-full gap-6">
|
<!-- Stat Cards -->
|
||||||
|
<!-- 总数量 (较小) -->
|
||||||
<!-- 顶部统计区域 - 大数字展示 -->
|
<div
|
||||||
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
|
class="lg:col-span-2 bg-white dark:bg-slate-900 p-4 rounded-xl shadow-sm border border-slate-100 dark:border-slate-800">
|
||||||
<!-- 总数量 -->
|
<div class="flex items-center justify-between mb-1">
|
||||||
<div class="bg-gradient-to-br from-blue-500 to-blue-600 p-6 rounded-2xl shadow-lg shadow-blue-500/20 text-white relative overflow-hidden">
|
<span class="text-xs font-medium text-slate-500">{{ $t('workbenches.totalnumber') }}</span>
|
||||||
<div class="absolute top-0 right-0 w-32 h-32 bg-white/10 rounded-full -translate-y-1/2 translate-x-1/2"></div>
|
<span class="material-icons-round text-primary/40 text-lg">analytics</span>
|
||||||
<div class="relative z-10">
|
|
||||||
<div class="flex items-center gap-2 mb-2">
|
|
||||||
<span class="material-icons-round text-white/80">analytics</span>
|
|
||||||
<span class="text-sm font-medium text-white/80">{{ $t('workbenches.totalnumber') }}</span>
|
|
||||||
</div>
|
|
||||||
<div class="text-4xl font-bold tracking-tight">{{ hostData.totalCount.toLocaleString() }}</div>
|
|
||||||
<div class="mt-2 text-xs text-white/60">累计获取主播</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="text-xl font-bold text-slate-900 dark:text-white">{{ hostData.totalCount }}</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- 新建主播 -->
|
<!-- 新建主播 (较小) -->
|
||||||
<div class="bg-gradient-to-br from-emerald-500 to-emerald-600 p-6 rounded-2xl shadow-lg shadow-emerald-500/20 text-white relative overflow-hidden">
|
<div
|
||||||
<div class="absolute top-0 right-0 w-32 h-32 bg-white/10 rounded-full -translate-y-1/2 translate-x-1/2"></div>
|
class="lg:col-span-2 bg-white dark:bg-slate-900 p-4 rounded-xl shadow-sm border border-slate-100 dark:border-slate-800">
|
||||||
<div class="relative z-10">
|
<div class="flex items-center justify-between mb-1">
|
||||||
<div class="flex items-center gap-2 mb-2">
|
<span class="text-xs font-medium text-slate-500">{{ $t('workbenches.createHost') }}</span>
|
||||||
<span class="material-icons-round text-white/80">person_add</span>
|
<span class="material-icons-round text-secondary/40 text-lg">person_add</span>
|
||||||
<span class="text-sm font-medium text-white/80">{{ $t('workbenches.createHost') }}</span>
|
|
||||||
</div>
|
|
||||||
<div class="text-4xl font-bold tracking-tight">{{ hostData.validAnchorsCount.toLocaleString() }}</div>
|
|
||||||
<div class="mt-2 text-xs text-white/60">有效主播数量</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="text-xl font-bold text-slate-900 dark:text-white">{{ hostData.validAnchorsCount }}</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- 网络状态 -->
|
<!-- 查询 (较小) -->
|
||||||
<div class="bg-gradient-to-br from-violet-500 to-violet-600 p-6 rounded-2xl shadow-lg shadow-violet-500/20 text-white relative overflow-hidden">
|
<div
|
||||||
<div class="absolute top-0 right-0 w-32 h-32 bg-white/10 rounded-full -translate-y-1/2 translate-x-1/2"></div>
|
class="lg:col-span-2 bg-white dark:bg-slate-900 p-4 rounded-xl shadow-sm border border-slate-100 dark:border-slate-800">
|
||||||
<div class="relative z-10">
|
<div class="flex items-center justify-between mb-1">
|
||||||
<div class="flex items-center gap-2 mb-2">
|
<span class="text-xs font-medium text-slate-500">{{ $t('workbenches.query') }}</span>
|
||||||
<span class="material-icons-round text-white/80">public</span>
|
<span class="material-icons-round text-amber-400/60 text-lg">search</span>
|
||||||
<span class="text-sm font-medium text-white/80">{{ $t('workbenchesSetup.network') }}</span>
|
</div>
|
||||||
</div>
|
<div class="text-xl font-bold text-slate-900 dark:text-white">{{ hostData.checkedDataCount }}</div>
|
||||||
<div class="text-2xl font-bold tracking-tight">{{ locale == 'zh' ? countryData : countryDataEN }}</div>
|
</div>
|
||||||
<div class="mt-2 flex items-center gap-2">
|
|
||||||
<span class="w-2 h-2 rounded-full" :class="isWifi ? 'bg-red-400 animate-pulse' : 'bg-green-400'"></span>
|
<!-- 邀请 (较大,突出显示) -->
|
||||||
<span class="text-xs text-white/60">{{ isWifi ? 'VPN 断开' : 'VPN 已连接' }}</span>
|
<div
|
||||||
</div>
|
class="lg:col-span-3 bg-gradient-to-br from-primary to-blue-600 p-5 rounded-xl shadow-lg shadow-primary/20 text-white relative overflow-hidden">
|
||||||
|
<div class="absolute top-0 right-0 w-24 h-24 bg-white/10 rounded-full -translate-y-1/2 translate-x-1/2"></div>
|
||||||
|
<div class="flex items-center justify-between mb-2 relative z-10">
|
||||||
|
<span class="text-sm font-medium text-white/80">{{ $t('workbenches.invite') }}</span>
|
||||||
|
<span class="material-icons-round text-white/60">mail_outline</span>
|
||||||
|
</div>
|
||||||
|
<div class="text-3xl font-bold text-white relative z-10">{{ hostData.canInvitationCount }}</div>
|
||||||
|
<div class="text-xs text-white/60 mt-1">可邀请主播</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 运行时间 (较大) -->
|
||||||
|
<div
|
||||||
|
class="lg:col-span-3 bg-white dark:bg-slate-900 p-5 rounded-xl shadow-sm border border-slate-100 dark:border-slate-800 flex flex-col justify-center">
|
||||||
|
<div class="flex items-center justify-between">
|
||||||
|
<div>
|
||||||
|
<span class="text-xs font-semibold text-slate-400 uppercase tracking-wider block mb-1">{{
|
||||||
|
$t('workbenches.runTime') }}</span>
|
||||||
|
<div class="text-2xl font-mono font-bold text-primary">{{ formattedTime }}</div>
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<span class="w-4 h-4 rounded-full" :class="isTkLoggedIn ? 'bg-emerald-500' : 'bg-red-500'"></span>
|
||||||
|
<button @click="openTK"
|
||||||
|
class="bg-primary hover:bg-blue-700 text-white px-4 py-2 rounded-lg text-sm font-semibold shadow-lg shadow-primary/25">
|
||||||
|
{{ $t('workbenches.openTK') }}
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- 中央核心操作区 -->
|
<!-- Guild Accounts -->
|
||||||
<div class="flex-1 bg-white dark:bg-slate-900 rounded-3xl shadow-xl border border-slate-100 dark:border-slate-800 overflow-hidden">
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-4">
|
||||||
<div class="h-full flex flex-col">
|
<div v-for="(item, index) in 2" :key="index" class="bg-white border border-slate-100 p-5 rounded-xl shadow-sm">
|
||||||
|
<div class="flex justify-between items-center mb-6">
|
||||||
<!-- 运行时间 - 中央突出展示 -->
|
<div class="flex items-center gap-2">
|
||||||
<div class="bg-gradient-to-r from-slate-50 to-slate-100 dark:from-slate-800 dark:to-slate-900 p-8 text-center border-b border-slate-200 dark:border-slate-700">
|
<span class="w-4 h-4 rounded-full" :class="tkData[index].code == 1 ? 'bg-emerald-500' : 'bg-red-500'"></span>
|
||||||
<div class="inline-flex items-center gap-3 mb-4">
|
<h3 class="font-bold text-slate-800 dark:text-white">{{ $t('workbenches.guildAccount') }} {{ index === 0 ? 'A'
|
||||||
<span class="w-3 h-3 rounded-full animate-pulse" :class="!pyData.isStart ? 'bg-emerald-500' : 'bg-slate-300'"></span>
|
: 'B' }}</h3>
|
||||||
<span class="text-sm font-semibold text-slate-500 uppercase tracking-widest">{{ $t('workbenches.runTime') }}</span>
|
</div>
|
||||||
|
<span class=" text-slate-500" style="font-size: 17px;">{{ $t('workbenches.queriedNum') }}: {{
|
||||||
|
tkData[index].num }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="space-y-4">
|
||||||
|
<div class="grid grid-cols-2 gap-4">
|
||||||
|
<div>
|
||||||
|
<label class="text-xs font-semibold text-slate-500 mb-1 block">{{ $t('workbenches.guildAccount') }}</label>
|
||||||
|
<el-input v-model="tkData[index].account" :placeholder="$t('workbenches.guildAccountPlace')"
|
||||||
|
:disabled="!(tkData[index].code == 0 && !isLogin[index])" class="el-input-custom" />
|
||||||
</div>
|
</div>
|
||||||
<div class="text-6xl font-mono font-bold text-slate-900 dark:text-white tracking-wider mb-6">
|
<div>
|
||||||
{{ formattedTime }}
|
<label class="text-xs font-semibold text-slate-500 mb-1 block">{{ $t('workbenches.guildPass') }}</label>
|
||||||
|
<el-input v-model="tkData[index].password" type="password" show-password
|
||||||
|
:placeholder="$t('workbenches.guildPassPlace')" :disabled="!(tkData[index].code == 0 && !isLogin[index])"
|
||||||
|
class="el-input-custom" />
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<!-- 操作按钮组 -->
|
<button @click="loginTK(index)" :disabled="!(tkData[index].code == 0 && !isLogin[index])"
|
||||||
<div class="flex items-center justify-center gap-4">
|
class="w-full bg-slate-900 dark:bg-slate-700 hover:bg-black text-white py-2.5 rounded-lg font-medium transition-all disabled:opacity-50 disabled:cursor-not-allowed">
|
||||||
<button @click="openTK"
|
{{ $t('workbenches.loginBackend') }}
|
||||||
class="bg-slate-200 dark:bg-slate-700 hover:bg-slate-300 dark:hover:bg-slate-600 text-slate-700 dark:text-slate-200 px-6 py-3 rounded-xl text-sm font-semibold transition-all flex items-center gap-2">
|
</button>
|
||||||
<span class="material-icons-round text-lg">play_arrow</span>
|
</div>
|
||||||
{{ $t('workbenches.openTK') }}
|
</div>
|
||||||
</button>
|
</div>
|
||||||
|
|
||||||
<button v-if="pyData.isStart" @click="submit"
|
<!-- Configuration Panel -->
|
||||||
class="bg-gradient-to-r from-blue-500 to-blue-600 hover:from-blue-600 hover:to-blue-700 text-white px-10 py-4 rounded-xl font-bold text-lg shadow-xl shadow-blue-500/30 transition-all flex items-center gap-3 hover:scale-[1.02] active:scale-[0.98]">
|
<div
|
||||||
<span class="material-icons-round">bolt</span>
|
class="bg-white dark:bg-slate-900 rounded-2xl shadow-sm border border-slate-100 dark:border-slate-800 overflow-hidden">
|
||||||
{{ $t('workbenchesSetup.start') }}
|
<div class="p-6 border-b border-slate-100 dark:border-slate-800 flex justify-between items-center">
|
||||||
</button>
|
<div class="flex items-center gap-3">
|
||||||
<button v-else @click="unsubmit"
|
<div class="w-8 h-8 bg-slate-100 dark:bg-slate-800 rounded-lg flex items-center justify-center">
|
||||||
class="bg-gradient-to-r from-red-500 to-red-600 hover:from-red-600 hover:to-red-700 text-white px-10 py-4 rounded-xl font-bold text-lg shadow-xl shadow-red-500/30 transition-all flex items-center gap-3 hover:scale-[1.02] active:scale-[0.98] animate-pulse">
|
<span class="material-icons-round text-slate-600 dark:text-slate-400 text-lg">settings</span>
|
||||||
<span class="material-icons-round">stop</span>
|
</div>
|
||||||
{{ $t('workbenchesSetup.stop') }}
|
<h2 class="font-bold text-slate-800 dark:text-white">{{ $t('workbenchesSetup.workbenches') }}</h2>
|
||||||
</button>
|
</div>
|
||||||
|
<div class="flex items-center gap-4 text-sm">
|
||||||
|
<div class="text-slate-500">{{ $t('workbenchesSetup.network') }}: <span class="text-primary font-bold">{{ locale
|
||||||
|
== 'zh' ? countryData : countryDataEN }}</span></div>
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<span class="text-slate-500">指定国家:</span>
|
||||||
|
<select v-model="country_info"
|
||||||
|
class="bg-slate-50 dark:bg-slate-800 border-none rounded-lg text-xs font-medium focus:ring-0">
|
||||||
|
<option value="全部">全部</option>
|
||||||
|
<option v-for="(item, index) in country_Lst" :key="index" :value="item">{{ item }}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="p-6">
|
||||||
|
<div class="grid grid-cols-1 lg:grid-cols-4 gap-6 mb-6">
|
||||||
|
<!-- Coins -->
|
||||||
|
<div>
|
||||||
|
<h4 class="text-sm font-bold text-slate-800 dark:text-white mb-4 flex items-center gap-2">
|
||||||
|
<span class="w-1 h-4 bg-primary rounded-full"></span>
|
||||||
|
{{ $t('workbenchesSetup.setCoinsNum') }}
|
||||||
|
</h4>
|
||||||
|
<div class="space-y-3">
|
||||||
|
<div class="flex shadow-sm rounded-lg overflow-hidden border border-slate-200 dark:border-slate-700">
|
||||||
|
<span
|
||||||
|
class="bg-slate-50 dark:bg-slate-800 px-3 py-2 text-xs font-medium text-slate-500 w-28 flex items-center border-r border-slate-200 dark:border-slate-700">{{
|
||||||
|
$t('workbenchesSetup.minCoinsNum') }}</span>
|
||||||
|
<input
|
||||||
|
class="flex-1 px-4 py-2 text-sm bg-white dark:bg-slate-900 border-none outline-none focus:ring-0 disabled:bg-slate-100"
|
||||||
|
type="number" v-model="pyData.gold.min" :disabled="!pyData.isStart" />
|
||||||
|
</div>
|
||||||
|
<div class="flex shadow-sm rounded-lg overflow-hidden border border-slate-200 dark:border-slate-700">
|
||||||
|
<span
|
||||||
|
class="bg-slate-50 dark:bg-slate-800 px-3 py-2 text-xs font-medium text-slate-500 w-28 flex items-center border-r border-slate-200 dark:border-slate-700">{{
|
||||||
|
$t('workbenchesSetup.maxCoinsNum') }}</span>
|
||||||
|
<input
|
||||||
|
class="flex-1 px-4 py-2 text-sm bg-white dark:bg-slate-900 border-none outline-none focus:ring-0 disabled:bg-slate-100"
|
||||||
|
type="number" v-model="pyData.gold.max" :disabled="!pyData.isStart" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p class="mt-4 text-xs font-medium text-slate-400">
|
|
||||||
到期时间: <span class="text-emerald-600 dark:text-emerald-400">{{ timestampToTime(expiredTime) }}</span>
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 配置区域 - 左右两侧卡片 -->
|
<!-- Fans -->
|
||||||
<div class="flex-1 p-6">
|
<div>
|
||||||
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6 h-full">
|
<h4 class="text-sm font-bold text-slate-800 dark:text-white mb-4 flex items-center gap-2">
|
||||||
|
<span class="w-1 h-4 bg-secondary rounded-full"></span>
|
||||||
<!-- 左侧:金币设置 -->
|
{{ $t('workbenchesSetup.setFansNum') }}
|
||||||
<div class="bg-slate-50 dark:bg-slate-800/50 rounded-2xl p-5 border border-slate-200 dark:border-slate-700">
|
</h4>
|
||||||
<div class="flex items-center gap-3 mb-5">
|
<div class="space-y-3">
|
||||||
<div class="w-10 h-10 bg-gradient-to-br from-amber-400 to-orange-500 rounded-xl flex items-center justify-center shadow-lg shadow-amber-500/20">
|
<div class="flex shadow-sm rounded-lg overflow-hidden border border-slate-200 dark:border-slate-700">
|
||||||
<span class="material-icons-round text-white">monetization_on</span>
|
<span
|
||||||
</div>
|
class="bg-slate-50 dark:bg-slate-800 px-3 py-2 text-xs font-medium text-slate-500 w-28 flex items-center border-r border-slate-200 dark:border-slate-700">{{
|
||||||
<div>
|
$t('workbenchesSetup.minFansNum') }}</span>
|
||||||
<h4 class="font-bold text-slate-800 dark:text-white">{{ $t('workbenchesSetup.setCoinsNum') }}</h4>
|
<input
|
||||||
<p class="text-xs text-slate-400">设置金币筛选范围</p>
|
class="flex-1 px-4 py-2 text-sm bg-white dark:bg-slate-900 border-none outline-none focus:ring-0 disabled:bg-slate-100"
|
||||||
</div>
|
type="number" v-model="pyData.fans.min" :disabled="!pyData.isStart" />
|
||||||
</div>
|
|
||||||
<div class="space-y-3">
|
|
||||||
<div>
|
|
||||||
<label class="text-xs text-slate-500 mb-1.5 block">{{ $t('workbenchesSetup.minCoinsNum') }}</label>
|
|
||||||
<input
|
|
||||||
class="w-full px-4 py-3 text-sm bg-white dark:bg-slate-900 border border-slate-200 dark:border-slate-600 rounded-xl outline-none focus:border-amber-500 focus:ring-2 focus:ring-amber-500/20 transition-all disabled:bg-slate-100 disabled:cursor-not-allowed"
|
|
||||||
type="number" v-model="pyData.gold.min" :disabled="!pyData.isStart" placeholder="0" />
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<label class="text-xs text-slate-500 mb-1.5 block">{{ $t('workbenchesSetup.maxCoinsNum') }}</label>
|
|
||||||
<input
|
|
||||||
class="w-full px-4 py-3 text-sm bg-white dark:bg-slate-900 border border-slate-200 dark:border-slate-600 rounded-xl outline-none focus:border-amber-500 focus:ring-2 focus:ring-amber-500/20 transition-all disabled:bg-slate-100 disabled:cursor-not-allowed"
|
|
||||||
type="number" v-model="pyData.gold.max" :disabled="!pyData.isStart" placeholder="999999" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="flex shadow-sm rounded-lg overflow-hidden border border-slate-200 dark:border-slate-700">
|
||||||
<!-- 中间:国家设置 -->
|
<span
|
||||||
<div class="bg-slate-50 dark:bg-slate-800/50 rounded-2xl p-5 border border-slate-200 dark:border-slate-700">
|
class="bg-slate-50 dark:bg-slate-800 px-3 py-2 text-xs font-medium text-slate-500 w-28 flex items-center border-r border-slate-200 dark:border-slate-700">{{
|
||||||
<div class="flex items-center gap-3 mb-5">
|
$t('workbenchesSetup.maxFansNum') }}</span>
|
||||||
<div class="w-10 h-10 bg-gradient-to-br from-violet-400 to-purple-500 rounded-xl flex items-center justify-center shadow-lg shadow-violet-500/20">
|
<input
|
||||||
<span class="material-icons-round text-white">flag</span>
|
class="flex-1 px-4 py-2 text-sm bg-white dark:bg-slate-900 border-none outline-none focus:ring-0 disabled:bg-slate-100"
|
||||||
</div>
|
type="number" v-model="pyData.fans.max" :disabled="!pyData.isStart" />
|
||||||
<div>
|
|
||||||
<h4 class="font-bold text-slate-800 dark:text-white">指定国家</h4>
|
|
||||||
<p class="text-xs text-slate-400">选择爬取的目标国家</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="space-y-3">
|
|
||||||
<div>
|
|
||||||
<label class="text-xs text-slate-500 mb-1.5 block">目标国家</label>
|
|
||||||
<select v-model="country_info"
|
|
||||||
class="w-full px-4 py-3 text-sm bg-white dark:bg-slate-900 border border-slate-200 dark:border-slate-600 rounded-xl outline-none focus:border-violet-500 focus:ring-2 focus:ring-violet-500/20 transition-all disabled:bg-slate-100 appearance-none cursor-pointer"
|
|
||||||
:disabled="!pyData.isStart">
|
|
||||||
<option value="全部">全部国家</option>
|
|
||||||
<option v-for="(item, index) in country_Lst" :key="index" :value="item">{{ item }}</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="pt-2">
|
|
||||||
<div class="flex items-center justify-between text-xs text-slate-500 mb-2">
|
|
||||||
<span>当前IP所在地</span>
|
|
||||||
<span class="font-semibold text-slate-700 dark:text-slate-300">{{ locale == 'zh' ? countryData : countryDataEN }}</span>
|
|
||||||
</div>
|
|
||||||
<div class="h-1 bg-slate-200 dark:bg-slate-700 rounded-full overflow-hidden">
|
|
||||||
<div class="h-full bg-gradient-to-r from-violet-500 to-purple-500 rounded-full" style="width: 100%"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- 右侧:粉丝设置 -->
|
<!-- Frequency -->
|
||||||
<div class="bg-slate-50 dark:bg-slate-800/50 rounded-2xl p-5 border border-slate-200 dark:border-slate-700">
|
<div>
|
||||||
<div class="flex items-center gap-3 mb-5">
|
<h4 class="text-sm font-bold text-slate-800 dark:text-white mb-4 flex items-center gap-2">
|
||||||
<div class="w-10 h-10 bg-gradient-to-br from-pink-400 to-rose-500 rounded-xl flex items-center justify-center shadow-lg shadow-pink-500/20">
|
<span class="w-1 h-4 bg-emerald-500 rounded-full"></span>
|
||||||
<span class="material-icons-round text-white">favorite</span>
|
{{ $t('workbenchesSetup.setQuery') }}
|
||||||
</div>
|
</h4>
|
||||||
<div>
|
<div class="space-y-3">
|
||||||
<h4 class="font-bold text-slate-800 dark:text-white">{{ $t('workbenchesSetup.setFansNum') }}</h4>
|
<div class="flex shadow-sm rounded-lg overflow-hidden border border-slate-200 dark:border-slate-700">
|
||||||
<p class="text-xs text-slate-400">设置粉丝筛选范围</p>
|
<input
|
||||||
</div>
|
class="flex-1 px-4 py-2 text-sm bg-white dark:bg-slate-900 border-none outline-none focus:ring-0 disabled:bg-slate-100"
|
||||||
</div>
|
type="number" v-model="pyData.frequency.hour" :disabled="!pyData.isStart" />
|
||||||
<div class="space-y-3">
|
<span
|
||||||
<div>
|
class="bg-slate-100 dark:bg-slate-800 px-3 py-2 text-xs font-medium text-slate-500 w-24 flex items-center justify-center border-l border-slate-200 dark:border-slate-700">{{
|
||||||
<label class="text-xs text-slate-500 mb-1.5 block">{{ $t('workbenchesSetup.minFansNum') }}</label>
|
$t('workbenchesSetup.hour') }}</span>
|
||||||
<input
|
|
||||||
class="w-full px-4 py-3 text-sm bg-white dark:bg-slate-900 border border-slate-200 dark:border-slate-600 rounded-xl outline-none focus:border-pink-500 focus:ring-2 focus:ring-pink-500/20 transition-all disabled:bg-slate-100 disabled:cursor-not-allowed"
|
|
||||||
type="number" v-model="pyData.fans.min" :disabled="!pyData.isStart" placeholder="0" />
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<label class="text-xs text-slate-500 mb-1.5 block">{{ $t('workbenchesSetup.maxFansNum') }}</label>
|
|
||||||
<input
|
|
||||||
class="w-full px-4 py-3 text-sm bg-white dark:bg-slate-900 border border-slate-200 dark:border-slate-600 rounded-xl outline-none focus:border-pink-500 focus:ring-2 focus:ring-pink-500/20 transition-all disabled:bg-slate-100 disabled:cursor-not-allowed"
|
|
||||||
type="number" v-model="pyData.fans.max" :disabled="!pyData.isStart" placeholder="999999" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="flex shadow-sm rounded-lg overflow-hidden border border-slate-200 dark:border-slate-700">
|
||||||
|
<input
|
||||||
|
class="flex-1 px-4 py-2 text-sm bg-white dark:bg-slate-900 border-none outline-none focus:ring-0 disabled:bg-slate-100"
|
||||||
|
type="number" v-model="pyData.frequency.day" :disabled="!pyData.isStart" />
|
||||||
|
<span
|
||||||
|
class="bg-slate-100 dark:bg-slate-800 px-3 py-2 text-xs font-medium text-slate-500 w-24 flex items-center justify-center border-l border-slate-200 dark:border-slate-700">{{
|
||||||
|
$t('workbenchesSetup.hour24') }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Quantity Limit -->
|
||||||
|
<div>
|
||||||
|
<h4 class="text-sm font-bold text-slate-800 dark:text-white mb-4 flex items-center gap-2">
|
||||||
|
<span class="w-1 h-4 bg-orange-400 rounded-full"></span>
|
||||||
|
{{ $t('workbenchesSetup.setNum') }}
|
||||||
|
<span class="text-[10px] text-slate-400 font-normal ml-1">({{ $t('workbenchesSetup.prompt') }})</span>
|
||||||
|
</h4>
|
||||||
|
<div class="space-y-3">
|
||||||
|
<div class="flex gap-2">
|
||||||
|
<button @click="isLimit = true" :disabled="!pyData.isStart"
|
||||||
|
class="flex-1 px-3 py-2 text-xs font-semibold rounded-md border transition-colors"
|
||||||
|
:class="isLimit ? 'bg-primary text-white border-primary' : 'bg-white text-slate-600 border-slate-200 hover:border-primary/50'">
|
||||||
|
{{ $t('workbenchesSetup.setHostNum') }}
|
||||||
|
</button>
|
||||||
|
<button @click="isLimit = false" :disabled="!pyData.isStart"
|
||||||
|
class="flex-1 px-3 py-2 text-xs font-semibold rounded-md border transition-colors"
|
||||||
|
:class="!isLimit ? 'bg-slate-500 text-white border-slate-500' : 'bg-white text-slate-600 border-slate-200 hover:border-slate-400'">
|
||||||
|
{{ $t('workbenchesSetup.unlimitedQuantity') }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div v-if="isLimit"
|
||||||
|
class="flex shadow-sm rounded-lg overflow-hidden border border-slate-200 dark:border-slate-700">
|
||||||
|
<input
|
||||||
|
class="flex-1 px-4 py-2 text-sm bg-white dark:bg-slate-900 border-none outline-none focus:ring-0 disabled:bg-slate-100"
|
||||||
|
type="number" v-model="hostNum" :disabled="!pyData.isStart" />
|
||||||
|
<span
|
||||||
|
class="bg-slate-100 dark:bg-slate-800 px-3 py-2 text-xs font-medium text-slate-500 w-16 flex items-center justify-center border-l border-slate-200 dark:border-slate-700">{{
|
||||||
|
$t('workbenchesSetup.num') }}</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
|
<div
|
||||||
|
class="flex flex-col lg:flex-row items-center justify-between gap-6 pt-4 border-t border-slate-100 dark:border-slate-800">
|
||||||
|
<div class="flex items-center gap-6">
|
||||||
|
<div class="flex items-center gap-2 cursor-pointer group" @click="toggleFilter('filterGame')">
|
||||||
|
<span class="w-4 h-4 rounded border-2 flex items-center justify-center transition-all"
|
||||||
|
:class="pyData.filterGame ? 'bg-primary border-primary' : 'bg-white border-slate-300'">
|
||||||
|
<span v-if="pyData.filterGame" class="material-icons-round text-white text-xs">check</span>
|
||||||
|
</span>
|
||||||
|
<span
|
||||||
|
class="text-sm text-slate-600 dark:text-slate-400 group-hover:text-primary transition-colors">过滤游戏主播</span>
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center gap-2 cursor-pointer group" @click="toggleFilter('filterSelling')">
|
||||||
|
<span class="w-4 h-4 rounded border-2 flex items-center justify-center transition-all"
|
||||||
|
:class="pyData.filterSelling ? 'bg-primary border-primary' : 'bg-white border-slate-300'">
|
||||||
|
<span v-if="pyData.filterSelling" class="material-icons-round text-white text-xs">check</span>
|
||||||
|
</span>
|
||||||
|
<span
|
||||||
|
class="text-sm text-slate-600 dark:text-slate-400 group-hover:text-primary transition-colors">过滤带货主播</span>
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center gap-2 cursor-pointer group" @click="toggleFilter('rankingList')">
|
||||||
|
<span class="w-4 h-4 rounded border-2 flex items-center justify-center transition-all"
|
||||||
|
:class="pyData.rankingList ? 'bg-primary border-primary' : 'bg-white border-slate-300'">
|
||||||
|
<span v-if="pyData.rankingList" class="material-icons-round text-white text-xs">check</span>
|
||||||
|
</span>
|
||||||
|
<span
|
||||||
|
class="text-sm text-slate-600 dark:text-slate-400 group-hover:text-primary transition-colors">过滤排行榜单</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mt-6 text-center">
|
||||||
|
<button v-if="pyData.isStart" @click="submit"
|
||||||
|
class="bg-slate-900 dark:bg-primary hover:scale-[1.02] active:scale-[0.98] text-white px-10 py-3 rounded-xl font-bold text-lg shadow-xl shadow-slate-900/10 dark:shadow-primary/20 transition-all flex items-center gap-2 mx-auto">
|
||||||
|
<span class="material-icons-round">bolt</span>
|
||||||
|
{{ $t('workbenchesSetup.start') }}
|
||||||
|
</button>
|
||||||
|
<button v-else @click="unsubmit"
|
||||||
|
class="bg-red-500 hover:bg-red-600 hover:scale-[1.02] active:scale-[0.98] text-white px-12 py-4 rounded-xl font-bold text-lg shadow-xl shadow-red-500/20 transition-all flex items-center gap-3 mx-auto">
|
||||||
|
<span class="material-icons-round">stop</span>
|
||||||
|
{{ $t('workbenchesSetup.stop') }}
|
||||||
|
</button>
|
||||||
|
<p class="mt-4 text-xs font-medium text-emerald-600 dark:text-emerald-400">
|
||||||
|
到期时间: {{ timestampToTime(expiredTime) }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -196,7 +293,7 @@ import { tkaccountuseinfo, getExpiredTime } from '@/api/account'
|
|||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
const { locale } = useI18n()
|
const { locale } = useI18n()
|
||||||
//导入python交互方法
|
//导入python交互方法
|
||||||
const { fetchDataConfig, fetchDataCount, loginBackStage, loginTikTok, backStageloginStatus, backStageloginStatusCopy } = usePythonBridge();
|
const { fetchDataConfig, fetchDataCount, loginBackStage, loginTikTok, backStageloginStatus, backStageloginStatusCopy, getTkLoginStatus } = usePythonBridge();
|
||||||
|
|
||||||
|
|
||||||
//ip国家
|
//ip国家
|
||||||
@@ -213,13 +310,18 @@ let getNumTimer = ref(null);
|
|||||||
let hostData = ref({
|
let hostData = ref({
|
||||||
totalCount: 0,
|
totalCount: 0,
|
||||||
validAnchorsCount: 0,
|
validAnchorsCount: 0,
|
||||||
|
canInvitationCount: 0,
|
||||||
|
checkedDataCount: 0,
|
||||||
});
|
});
|
||||||
//是否开启tk
|
//是否开启tk
|
||||||
// let isTk = ref(true);
|
// let isTk = ref(true);
|
||||||
|
|
||||||
//账号是否登陆中
|
//账号是否登陆中
|
||||||
let isLogin = ref([false, false]);
|
let isLogin = ref([false, false]);
|
||||||
|
//TK登录状态
|
||||||
|
let isTkLoggedIn = ref(false);
|
||||||
|
//TK状态轮询定时器
|
||||||
|
let tkStatusTimer = ref(null);
|
||||||
//设置状态轮询定时器
|
//设置状态轮询定时器
|
||||||
let statusTimer = ref(null);
|
let statusTimer = ref(null);
|
||||||
let statusTimerCopy = ref(null);
|
let statusTimerCopy = ref(null);
|
||||||
@@ -376,7 +478,17 @@ const submit = () => {
|
|||||||
ElMessage.error('请输入正确的区间值');
|
ElMessage.error('请输入正确的区间值');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (Number(pyData.value.frequency.hour) <= 0 || Number(pyData.value.frequency.day) <= 0 || pyData.value.frequency.hour == '' || pyData.value.frequency.day == '') {
|
||||||
|
ElMessage.error('请输入正确的频率区间值');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//是否限制爬取数量
|
||||||
|
if (isLimit.value) {
|
||||||
|
if (hostNum.value <= 0) {
|
||||||
|
ElMessage.error('请输入正确的可邀请数量');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ElMessageBox.confirm(
|
ElMessageBox.confirm(
|
||||||
@@ -414,7 +526,12 @@ const submit = () => {
|
|||||||
getHostTimer.value = setInterval(() => {
|
getHostTimer.value = setInterval(() => {
|
||||||
fetchDataCount().then((res) => {
|
fetchDataCount().then((res) => {
|
||||||
hostData.value = JSON.parse(res);
|
hostData.value = JSON.parse(res);
|
||||||
|
if (isLimit.value) {
|
||||||
|
if (hostData.value.canInvitationCount >= hostNum.value) {
|
||||||
|
unsubmit();
|
||||||
|
alert('爬取完毕')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
}, 1000);
|
}, 1000);
|
||||||
@@ -480,8 +597,6 @@ const reset = () => {
|
|||||||
const toggleFilter = (filterName) => {
|
const toggleFilter = (filterName) => {
|
||||||
if (!pyData.value.isStart) return; // 如果已启动则不允许修改
|
if (!pyData.value.isStart) return; // 如果已启动则不允许修改
|
||||||
pyData.value[filterName] = !pyData.value[filterName];
|
pyData.value[filterName] = !pyData.value[filterName];
|
||||||
|
|
||||||
console.log(pyData.value)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -512,6 +627,22 @@ const openTK = () => {
|
|||||||
// console.log(isTk.value)
|
// console.log(isTk.value)
|
||||||
loginTikTok();
|
loginTikTok();
|
||||||
|
|
||||||
|
// 开始轮询TK登录状态
|
||||||
|
if (tkStatusTimer.value) {
|
||||||
|
clearInterval(tkStatusTimer.value);
|
||||||
|
}
|
||||||
|
tkStatusTimer.value = setInterval(() => {
|
||||||
|
checkTkLoginStatus();
|
||||||
|
}, 3000);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查TK登录状态
|
||||||
|
const checkTkLoginStatus = () => {
|
||||||
|
getTkLoginStatus().then((res) => {
|
||||||
|
isTkLoggedIn.value = res === true || res === 'true';
|
||||||
|
}).catch(() => {
|
||||||
|
isTkLoggedIn.value = false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getloginStatus() {
|
function getloginStatus() {
|
||||||
@@ -707,7 +838,40 @@ const checkVPN = async () => {
|
|||||||
We can keep specific overrides or custom animations here if needed.
|
We can keep specific overrides or custom animations here if needed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.text-size {
|
/* Element Plus 输入框统一样式 */
|
||||||
text-size: 50px !important;
|
.el-input-custom :deep(.el-input__wrapper) {
|
||||||
|
background-color: white;
|
||||||
|
border: 1px solid rgb(226, 232, 240);
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
padding: 0.5rem 1rem;
|
||||||
|
box-shadow: none;
|
||||||
|
transition: all 0.15s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-input-custom :deep(.el-input__wrapper:hover) {
|
||||||
|
border-color: rgb(203, 213, 225);
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-input-custom :deep(.el-input__wrapper.is-focus) {
|
||||||
|
border-color: var(--el-color-primary);
|
||||||
|
box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-input-custom :deep(.el-input__inner) {
|
||||||
|
font-size: 0.875rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-input-custom :deep(.el-input__wrapper.is-disabled) {
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 暗色模式支持 */
|
||||||
|
.dark .el-input-custom :deep(.el-input__wrapper) {
|
||||||
|
background-color: rgb(30, 41, 59);
|
||||||
|
border-color: rgb(51, 65, 85);
|
||||||
|
}
|
||||||
|
|
||||||
|
.dark .el-input-custom :deep(.el-input__wrapper:hover) {
|
||||||
|
border-color: rgb(71, 85, 105);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
872
src/views/hosts/workbenches1.vue
Normal file
872
src/views/hosts/workbenches1.vue
Normal file
@@ -0,0 +1,872 @@
|
|||||||
|
<template>
|
||||||
|
<div class="grid grid-cols-1 lg:grid-cols-4 gap-4 mb-4">
|
||||||
|
<!-- Stat Cards -->
|
||||||
|
<div class="bg-white dark:bg-slate-900 p-6 rounded-xl shadow-sm border border-slate-100 dark:border-slate-800">
|
||||||
|
<div class="flex items-center justify-between mb-2">
|
||||||
|
<span class="text-sm font-medium text-slate-500">{{ $t('workbenches.totalnumber') }}</span>
|
||||||
|
<span class="material-icons-round text-primary/40">analytics</span>
|
||||||
|
</div>
|
||||||
|
<div class="text-3xl font-bold text-slate-900 dark:text-white">{{ hostData.totalCount }}</div>
|
||||||
|
</div>
|
||||||
|
<div class="bg-white dark:bg-slate-900 p-6 rounded-xl shadow-sm border border-slate-100 dark:border-slate-800">
|
||||||
|
<div class="flex items-center justify-between mb-2">
|
||||||
|
<span class="text-sm font-medium text-slate-500">{{ $t('workbenches.createHost') }}</span>
|
||||||
|
<span class="material-icons-round text-secondary/40">person_add</span>
|
||||||
|
</div>
|
||||||
|
<div class="text-3xl font-bold text-slate-900 dark:text-white">{{ hostData.validAnchorsCount }}</div>
|
||||||
|
</div>
|
||||||
|
<div class="bg-white dark:bg-slate-900 p-6 rounded-xl shadow-sm border border-slate-100 dark:border-slate-800">
|
||||||
|
<div class="flex items-center justify-between mb-2">
|
||||||
|
<span class="text-sm font-medium text-slate-500">{{ $t('workbenches.query') }} / {{ $t('workbenches.invite')
|
||||||
|
}}</span>
|
||||||
|
<span class="material-icons-round text-slate-400">compare_arrows</span>
|
||||||
|
</div>
|
||||||
|
<div class="text-3xl font-bold text-slate-900 dark:text-white">{{ hostData.checkedDataCount }} <span
|
||||||
|
class="text-slate-300 text-lg mx-2">/</span> {{ hostData.canInvitationCount }}</div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="bg-white dark:bg-slate-900 p-6 rounded-xl shadow-sm border border-slate-100 dark:border-slate-800 flex flex-col justify-center">
|
||||||
|
<div class="flex items-center justify-between">
|
||||||
|
<div>
|
||||||
|
<span class="text-xs font-semibold text-slate-400 uppercase tracking-wider block mb-1">{{
|
||||||
|
$t('workbenches.runTime') }}</span>
|
||||||
|
<div class="text-2xl font-mono font-bold text-primary">{{ formattedTime }}</div>
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<span class="w-2 h-2 rounded-full" :class="isTkLoggedIn ? 'bg-emerald-500' : 'bg-red-500'"></span>
|
||||||
|
<button @click="openTK"
|
||||||
|
class="bg-primary hover:bg-blue-700 text-white px-4 py-2 rounded-lg text-sm font-semibold transition-all shadow-lg shadow-primary/25">
|
||||||
|
{{ $t('workbenches.openTK') }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Guild Accounts -->
|
||||||
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-4">
|
||||||
|
<div v-for="(item, index) in 2" :key="index" class="bg-white border border-slate-100 p-5 rounded-xl shadow-sm">
|
||||||
|
<div class="flex justify-between items-center mb-6">
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<span class="w-2 h-2 rounded-full" :class="tkData[index].code == 1 ? 'bg-emerald-500' : 'bg-red-500'"></span>
|
||||||
|
<h3 class="font-bold text-slate-800 dark:text-white">{{ $t('workbenches.guildAccount') }} {{ index === 0 ? 'A'
|
||||||
|
: 'B' }}</h3>
|
||||||
|
</div>
|
||||||
|
<span class="text-xs text-slate-500">{{ $t('workbenches.queriedNum') }}: {{ tkData[index].num }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="space-y-4">
|
||||||
|
<div class="grid grid-cols-2 gap-4">
|
||||||
|
<div>
|
||||||
|
<label class="text-xs font-semibold text-slate-500 mb-1 block">{{ $t('workbenches.guildAccount') }}</label>
|
||||||
|
<el-input
|
||||||
|
v-model="tkData[index].account"
|
||||||
|
:placeholder="$t('workbenches.guildAccountPlace')"
|
||||||
|
:disabled="!(tkData[index].code == 0 && !isLogin[index])"
|
||||||
|
class="el-input-custom"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label class="text-xs font-semibold text-slate-500 mb-1 block">{{ $t('workbenches.guildPass') }}</label>
|
||||||
|
<el-input
|
||||||
|
v-model="tkData[index].password"
|
||||||
|
type="password"
|
||||||
|
show-password
|
||||||
|
:placeholder="$t('workbenches.guildPassPlace')"
|
||||||
|
:disabled="!(tkData[index].code == 0 && !isLogin[index])"
|
||||||
|
class="el-input-custom"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<button @click="loginTK(index)" :disabled="!(tkData[index].code == 0 && !isLogin[index])"
|
||||||
|
class="w-full bg-slate-900 dark:bg-slate-700 hover:bg-black text-white py-2.5 rounded-lg font-medium transition-all disabled:opacity-50 disabled:cursor-not-allowed">
|
||||||
|
{{ $t('workbenches.loginBackend') }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Configuration Panel -->
|
||||||
|
<div
|
||||||
|
class="bg-white dark:bg-slate-900 rounded-2xl shadow-sm border border-slate-100 dark:border-slate-800 overflow-hidden">
|
||||||
|
<div class="p-6 border-b border-slate-100 dark:border-slate-800 flex justify-between items-center">
|
||||||
|
<div class="flex items-center gap-3">
|
||||||
|
<div class="w-8 h-8 bg-slate-100 dark:bg-slate-800 rounded-lg flex items-center justify-center">
|
||||||
|
<span class="material-icons-round text-slate-600 dark:text-slate-400 text-lg">settings</span>
|
||||||
|
</div>
|
||||||
|
<h2 class="font-bold text-slate-800 dark:text-white">{{ $t('workbenchesSetup.workbenches') }}</h2>
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center gap-4 text-sm">
|
||||||
|
<div class="text-slate-500">{{ $t('workbenchesSetup.network') }}: <span class="text-primary font-bold">{{ locale
|
||||||
|
== 'zh' ? countryData : countryDataEN }}</span></div>
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<span class="text-slate-500">指定国家:</span>
|
||||||
|
<select v-model="country_info"
|
||||||
|
class="bg-slate-50 dark:bg-slate-800 border-none rounded-lg text-xs font-medium focus:ring-0">
|
||||||
|
<option value="全部">全部</option>
|
||||||
|
<option v-for="(item, index) in country_Lst" :key="index" :value="item">{{ item }}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="p-6">
|
||||||
|
<div class="grid grid-cols-1 lg:grid-cols-4 gap-6 mb-6">
|
||||||
|
<!-- Coins -->
|
||||||
|
<div>
|
||||||
|
<h4 class="text-sm font-bold text-slate-800 dark:text-white mb-4 flex items-center gap-2">
|
||||||
|
<span class="w-1 h-4 bg-primary rounded-full"></span>
|
||||||
|
{{ $t('workbenchesSetup.setCoinsNum') }}
|
||||||
|
</h4>
|
||||||
|
<div class="space-y-3">
|
||||||
|
<div class="flex shadow-sm rounded-lg overflow-hidden border border-slate-200 dark:border-slate-700">
|
||||||
|
<span
|
||||||
|
class="bg-slate-50 dark:bg-slate-800 px-3 py-2 text-xs font-medium text-slate-500 w-28 flex items-center border-r border-slate-200 dark:border-slate-700">{{
|
||||||
|
$t('workbenchesSetup.minCoinsNum') }}</span>
|
||||||
|
<input
|
||||||
|
class="flex-1 px-4 py-2 text-sm bg-white dark:bg-slate-900 border-none outline-none focus:ring-0 disabled:bg-slate-100"
|
||||||
|
type="number" v-model="pyData.gold.min" :disabled="!pyData.isStart" />
|
||||||
|
</div>
|
||||||
|
<div class="flex shadow-sm rounded-lg overflow-hidden border border-slate-200 dark:border-slate-700">
|
||||||
|
<span
|
||||||
|
class="bg-slate-50 dark:bg-slate-800 px-3 py-2 text-xs font-medium text-slate-500 w-28 flex items-center border-r border-slate-200 dark:border-slate-700">{{
|
||||||
|
$t('workbenchesSetup.maxCoinsNum') }}</span>
|
||||||
|
<input
|
||||||
|
class="flex-1 px-4 py-2 text-sm bg-white dark:bg-slate-900 border-none outline-none focus:ring-0 disabled:bg-slate-100"
|
||||||
|
type="number" v-model="pyData.gold.max" :disabled="!pyData.isStart" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Fans -->
|
||||||
|
<div>
|
||||||
|
<h4 class="text-sm font-bold text-slate-800 dark:text-white mb-4 flex items-center gap-2">
|
||||||
|
<span class="w-1 h-4 bg-secondary rounded-full"></span>
|
||||||
|
{{ $t('workbenchesSetup.setFansNum') }}
|
||||||
|
</h4>
|
||||||
|
<div class="space-y-3">
|
||||||
|
<div class="flex shadow-sm rounded-lg overflow-hidden border border-slate-200 dark:border-slate-700">
|
||||||
|
<span
|
||||||
|
class="bg-slate-50 dark:bg-slate-800 px-3 py-2 text-xs font-medium text-slate-500 w-28 flex items-center border-r border-slate-200 dark:border-slate-700">{{
|
||||||
|
$t('workbenchesSetup.minFansNum') }}</span>
|
||||||
|
<input
|
||||||
|
class="flex-1 px-4 py-2 text-sm bg-white dark:bg-slate-900 border-none outline-none focus:ring-0 disabled:bg-slate-100"
|
||||||
|
type="number" v-model="pyData.fans.min" :disabled="!pyData.isStart" />
|
||||||
|
</div>
|
||||||
|
<div class="flex shadow-sm rounded-lg overflow-hidden border border-slate-200 dark:border-slate-700">
|
||||||
|
<span
|
||||||
|
class="bg-slate-50 dark:bg-slate-800 px-3 py-2 text-xs font-medium text-slate-500 w-28 flex items-center border-r border-slate-200 dark:border-slate-700">{{
|
||||||
|
$t('workbenchesSetup.maxFansNum') }}</span>
|
||||||
|
<input
|
||||||
|
class="flex-1 px-4 py-2 text-sm bg-white dark:bg-slate-900 border-none outline-none focus:ring-0 disabled:bg-slate-100"
|
||||||
|
type="number" v-model="pyData.fans.max" :disabled="!pyData.isStart" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Frequency -->
|
||||||
|
<div>
|
||||||
|
<h4 class="text-sm font-bold text-slate-800 dark:text-white mb-4 flex items-center gap-2">
|
||||||
|
<span class="w-1 h-4 bg-emerald-500 rounded-full"></span>
|
||||||
|
{{ $t('workbenchesSetup.setQuery') }}
|
||||||
|
</h4>
|
||||||
|
<div class="space-y-3">
|
||||||
|
<div class="flex shadow-sm rounded-lg overflow-hidden border border-slate-200 dark:border-slate-700">
|
||||||
|
<input
|
||||||
|
class="flex-1 px-4 py-2 text-sm bg-white dark:bg-slate-900 border-none outline-none focus:ring-0 disabled:bg-slate-100"
|
||||||
|
type="number" v-model="pyData.frequency.hour" :disabled="!pyData.isStart" />
|
||||||
|
<span
|
||||||
|
class="bg-slate-100 dark:bg-slate-800 px-3 py-2 text-xs font-medium text-slate-500 w-24 flex items-center justify-center border-l border-slate-200 dark:border-slate-700">{{
|
||||||
|
$t('workbenchesSetup.hour') }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="flex shadow-sm rounded-lg overflow-hidden border border-slate-200 dark:border-slate-700">
|
||||||
|
<input
|
||||||
|
class="flex-1 px-4 py-2 text-sm bg-white dark:bg-slate-900 border-none outline-none focus:ring-0 disabled:bg-slate-100"
|
||||||
|
type="number" v-model="pyData.frequency.day" :disabled="!pyData.isStart" />
|
||||||
|
<span
|
||||||
|
class="bg-slate-100 dark:bg-slate-800 px-3 py-2 text-xs font-medium text-slate-500 w-24 flex items-center justify-center border-l border-slate-200 dark:border-slate-700">{{
|
||||||
|
$t('workbenchesSetup.hour24') }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Quantity Limit -->
|
||||||
|
<div>
|
||||||
|
<h4 class="text-sm font-bold text-slate-800 dark:text-white mb-4 flex items-center gap-2">
|
||||||
|
<span class="w-1 h-4 bg-orange-400 rounded-full"></span>
|
||||||
|
{{ $t('workbenchesSetup.setNum') }}
|
||||||
|
<span class="text-[10px] text-slate-400 font-normal ml-1">({{ $t('workbenchesSetup.prompt') }})</span>
|
||||||
|
</h4>
|
||||||
|
<div class="space-y-3">
|
||||||
|
<div class="flex gap-2">
|
||||||
|
<button @click="isLimit = true" :disabled="!pyData.isStart"
|
||||||
|
class="flex-1 px-3 py-2 text-xs font-semibold rounded-md border transition-colors"
|
||||||
|
:class="isLimit ? 'bg-primary text-white border-primary' : 'bg-white text-slate-600 border-slate-200 hover:border-primary/50'">
|
||||||
|
{{ $t('workbenchesSetup.setHostNum') }}
|
||||||
|
</button>
|
||||||
|
<button @click="isLimit = false" :disabled="!pyData.isStart"
|
||||||
|
class="flex-1 px-3 py-2 text-xs font-semibold rounded-md border transition-colors"
|
||||||
|
:class="!isLimit ? 'bg-slate-500 text-white border-slate-500' : 'bg-white text-slate-600 border-slate-200 hover:border-slate-400'">
|
||||||
|
{{ $t('workbenchesSetup.unlimitedQuantity') }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div v-if="isLimit"
|
||||||
|
class="flex shadow-sm rounded-lg overflow-hidden border border-slate-200 dark:border-slate-700">
|
||||||
|
<input
|
||||||
|
class="flex-1 px-4 py-2 text-sm bg-white dark:bg-slate-900 border-none outline-none focus:ring-0 disabled:bg-slate-100"
|
||||||
|
type="number" v-model="hostNum" :disabled="!pyData.isStart" />
|
||||||
|
<span
|
||||||
|
class="bg-slate-100 dark:bg-slate-800 px-3 py-2 text-xs font-medium text-slate-500 w-16 flex items-center justify-center border-l border-slate-200 dark:border-slate-700">{{
|
||||||
|
$t('workbenchesSetup.num') }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
class="flex flex-col lg:flex-row items-center justify-between gap-6 pt-4 border-t border-slate-100 dark:border-slate-800">
|
||||||
|
<div class="flex items-center gap-6">
|
||||||
|
<div class="flex items-center gap-2 cursor-pointer group" @click="toggleFilter('filterGame')">
|
||||||
|
<span
|
||||||
|
class="w-4 h-4 rounded border-2 flex items-center justify-center transition-all"
|
||||||
|
:class="pyData.filterGame ? 'bg-primary border-primary' : 'bg-white border-slate-300'"
|
||||||
|
>
|
||||||
|
<span v-if="pyData.filterGame" class="material-icons-round text-white text-xs">check</span>
|
||||||
|
</span>
|
||||||
|
<span
|
||||||
|
class="text-sm text-slate-600 dark:text-slate-400 group-hover:text-primary transition-colors">过滤游戏主播</span>
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center gap-2 cursor-pointer group" @click="toggleFilter('filterSelling')">
|
||||||
|
<span
|
||||||
|
class="w-4 h-4 rounded border-2 flex items-center justify-center transition-all"
|
||||||
|
:class="pyData.filterSelling ? 'bg-primary border-primary' : 'bg-white border-slate-300'"
|
||||||
|
>
|
||||||
|
<span v-if="pyData.filterSelling" class="material-icons-round text-white text-xs">check</span>
|
||||||
|
</span>
|
||||||
|
<span
|
||||||
|
class="text-sm text-slate-600 dark:text-slate-400 group-hover:text-primary transition-colors">过滤带货主播</span>
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center gap-2 cursor-pointer group" @click="toggleFilter('rankingList')">
|
||||||
|
<span
|
||||||
|
class="w-4 h-4 rounded border-2 flex items-center justify-center transition-all"
|
||||||
|
:class="pyData.rankingList ? 'bg-primary border-primary' : 'bg-white border-slate-300'"
|
||||||
|
>
|
||||||
|
<span v-if="pyData.rankingList" class="material-icons-round text-white text-xs">check</span>
|
||||||
|
</span>
|
||||||
|
<span
|
||||||
|
class="text-sm text-slate-600 dark:text-slate-400 group-hover:text-primary transition-colors">过滤排行榜单</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mt-6 text-center">
|
||||||
|
<button v-if="pyData.isStart" @click="submit"
|
||||||
|
class="bg-slate-900 dark:bg-primary hover:scale-[1.02] active:scale-[0.98] text-white px-10 py-3 rounded-xl font-bold text-lg shadow-xl shadow-slate-900/10 dark:shadow-primary/20 transition-all flex items-center gap-2 mx-auto">
|
||||||
|
<span class="material-icons-round">bolt</span>
|
||||||
|
{{ $t('workbenchesSetup.start') }}
|
||||||
|
</button>
|
||||||
|
<button v-else @click="unsubmit"
|
||||||
|
class="bg-red-500 hover:bg-red-600 hover:scale-[1.02] active:scale-[0.98] text-white px-12 py-4 rounded-xl font-bold text-lg shadow-xl shadow-red-500/20 transition-all flex items-center gap-3 mx-auto">
|
||||||
|
<span class="material-icons-round">stop</span>
|
||||||
|
{{ $t('workbenchesSetup.stop') }}
|
||||||
|
</button>
|
||||||
|
<p class="mt-4 text-xs font-medium text-emerald-600 dark:text-emerald-400">
|
||||||
|
到期时间: {{ timestampToTime(expiredTime) }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, onMounted, computed } from 'vue';
|
||||||
|
import { usePythonBridge, } from '@/utils/pythonBridge'
|
||||||
|
import { setNumData, getNumData, getUser, setTkUser, getTkUser } from '@/utils/storage'
|
||||||
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
|
import { getCountryName } from '@/utils/countryUtil'
|
||||||
|
import { tkaccountuseinfo, getExpiredTime } from '@/api/account'
|
||||||
|
import { useI18n } from 'vue-i18n'
|
||||||
|
const { locale } = useI18n()
|
||||||
|
//导入python交互方法
|
||||||
|
const { fetchDataConfig, fetchDataCount, loginBackStage, loginTikTok, backStageloginStatus, backStageloginStatusCopy, getTkLoginStatus } = usePythonBridge();
|
||||||
|
|
||||||
|
|
||||||
|
//ip国家
|
||||||
|
let countryData = ref('');
|
||||||
|
//英文国家
|
||||||
|
let countryDataEN = ref('');
|
||||||
|
let country_info = ref('全部');
|
||||||
|
let country_Lst = ref();
|
||||||
|
//获取主播数量的定时器
|
||||||
|
let getHostTimer = ref(null);
|
||||||
|
//获取查询次数定时器
|
||||||
|
let getNumTimer = ref(null);
|
||||||
|
//获取的主播信息
|
||||||
|
let hostData = ref({
|
||||||
|
totalCount: 0,
|
||||||
|
validAnchorsCount: 0,
|
||||||
|
canInvitationCount: 0,
|
||||||
|
checkedDataCount: 0,
|
||||||
|
});
|
||||||
|
//是否开启tk
|
||||||
|
// let isTk = ref(true);
|
||||||
|
|
||||||
|
//TK登录状态
|
||||||
|
let isTkLoggedIn = ref(false);
|
||||||
|
//TK状态轮询定时器
|
||||||
|
let tkStatusTimer = ref(null);
|
||||||
|
|
||||||
|
//账号是否登陆中
|
||||||
|
let isLogin = ref([false, false]);
|
||||||
|
//设置状态轮询定时器
|
||||||
|
let statusTimer = ref(null);
|
||||||
|
let statusTimerCopy = ref(null);
|
||||||
|
|
||||||
|
//设置次数最大值
|
||||||
|
let maxCount = ref([
|
||||||
|
{
|
||||||
|
hourMax: 50,
|
||||||
|
dayMax: 300,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
hourMax: 100,
|
||||||
|
dayMax: 600,
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
//tk账号信息
|
||||||
|
let tkData = ref([
|
||||||
|
{
|
||||||
|
account: '',
|
||||||
|
password: '',
|
||||||
|
index: 1,
|
||||||
|
code: 0,
|
||||||
|
num: 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
account: '',
|
||||||
|
password: '',
|
||||||
|
index: 2,
|
||||||
|
code: 0,
|
||||||
|
num: 0
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
//python需要的数据
|
||||||
|
let pyData = ref({
|
||||||
|
gold: { min: 0, max: 0 },
|
||||||
|
fans: { min: 0, max: 0 },
|
||||||
|
frequency: { hour: 0, day: 0 },
|
||||||
|
isStart: true,
|
||||||
|
country: countryData.value,
|
||||||
|
filterSelling: false,
|
||||||
|
filterGame: false,
|
||||||
|
rankingList: false,
|
||||||
|
tenantId: getUser().tenantId,
|
||||||
|
userId: getUser().userId,
|
||||||
|
});
|
||||||
|
|
||||||
|
//是否限制查询数量
|
||||||
|
let isLimit = ref(false);
|
||||||
|
//需要查询的主播数
|
||||||
|
let hostNum = ref(0);
|
||||||
|
|
||||||
|
//按钮提交状态
|
||||||
|
let submitting = ref(true);
|
||||||
|
let expiredTime = ref(null);
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
//从缓存获取数据
|
||||||
|
if (getNumData()) {
|
||||||
|
pyData.value = getNumData();
|
||||||
|
}
|
||||||
|
if (getTkUser()) {
|
||||||
|
tkData.value = getTkUser();
|
||||||
|
tkData.value[0].code = 0;
|
||||||
|
tkData.value[1].code = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
tkaccountuse(tkData.value[0].account, 0)
|
||||||
|
tkaccountuse(tkData.value[1].account, 1)
|
||||||
|
|
||||||
|
getIpInfo()
|
||||||
|
setTimeout(() => {
|
||||||
|
getExpiredTime(getUser().tenantId).then((res) => {
|
||||||
|
console.log('time:', res);
|
||||||
|
expiredTime.value = res.expiredTime
|
||||||
|
})
|
||||||
|
}, 1000);
|
||||||
|
|
||||||
|
checkVPN()
|
||||||
|
setInterval(async () => {
|
||||||
|
await checkVPN()
|
||||||
|
}, 1000 * 20)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
const getIpInfo = async () => {
|
||||||
|
try {
|
||||||
|
const response = await fetch('https://ipapi.co/json/');
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error('请求失败');
|
||||||
|
}
|
||||||
|
const data = await response.json();
|
||||||
|
console.log('IP信息:', data.country);
|
||||||
|
countryDataEN.value = data.country_name
|
||||||
|
countryData.value = getCountryName(data.country);
|
||||||
|
|
||||||
|
const url = `https://datasave.api.yolozs.com/api/save_data/country_info?countryName=${countryData.value}`;
|
||||||
|
|
||||||
|
const res = await fetch(url);
|
||||||
|
|
||||||
|
const countryres = await res.json();
|
||||||
|
country_Lst.value = countryres.data
|
||||||
|
} catch (error) {
|
||||||
|
console.error('请求出错:', error);
|
||||||
|
ElMessageBox.prompt('请输入将要获取国家的中文名', '获取国家失败', {
|
||||||
|
confirmButtonText: '确认',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
showClose: false,
|
||||||
|
closeOnClickModal: false,
|
||||||
|
showCancelButton: false,
|
||||||
|
})
|
||||||
|
.then(async ({ value }) => {
|
||||||
|
countryData.value = value
|
||||||
|
|
||||||
|
const url = `https://datasave.api.yolozs.com/api/save_data/country_info?countryName=${countryData.value}`;
|
||||||
|
|
||||||
|
const res = await fetch(url);
|
||||||
|
|
||||||
|
const countryres = await res.json();
|
||||||
|
country_Lst.value = countryres.data
|
||||||
|
})
|
||||||
|
// .catch(() => {
|
||||||
|
// ElMessage({
|
||||||
|
// type: 'info',
|
||||||
|
// message: 'Input canceled',
|
||||||
|
// })
|
||||||
|
// })
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//提交数据到py
|
||||||
|
const submit = () => {
|
||||||
|
pyData.value.country = countryData.value;
|
||||||
|
console.log('提交的区间值:', pyData.value);
|
||||||
|
// if (tkData.value[0].account == '' && tkData.value[1].account == '') {
|
||||||
|
// ElMessage.error('请输入账号密码');
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// if (tkData.value[0].password == '' && tkData.value[1].password == '') {
|
||||||
|
// ElMessage.error('请输入账号密码');
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
if (((Number(pyData.value.gold.min) > Number(pyData.value.gold.max)) || (Number(pyData.value.fans.min) > Number(pyData.value.fans.max)))) {
|
||||||
|
ElMessage.error('请输入正确的区间值');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ((Number(pyData.value.gold.max) <= 0 || Number(pyData.value.fans.max <= 0)) || pyData.value.gold.max == '' || pyData.value.fans.max == '') {
|
||||||
|
ElMessage.error('请输入正确的区间值');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (Number(pyData.value.frequency.hour) <= 0 || Number(pyData.value.frequency.day) <= 0 || pyData.value.frequency.hour == '' || pyData.value.frequency.day == '') {
|
||||||
|
ElMessage.error('请输入正确的频率区间值');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//是否限制爬取数量
|
||||||
|
if (isLimit.value) {
|
||||||
|
if (hostNum.value <= 0) {
|
||||||
|
ElMessage.error('请输入正确的可邀请数量');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ElMessageBox.confirm(
|
||||||
|
'确认开始爬取数据?',
|
||||||
|
'开始',
|
||||||
|
{
|
||||||
|
confirmButtonText: '开始',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'success',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.then(() => {
|
||||||
|
// console.log('提交的区间值:', pyData.value.gold, pyData.value.fans, pyData.value.frequency);
|
||||||
|
//开始按钮的状态 改为禁用
|
||||||
|
submitting.value = true;
|
||||||
|
setNumData(pyData.value);
|
||||||
|
console.error('提交的区间值:', JSON.stringify(pyData.value));
|
||||||
|
|
||||||
|
fetchDataConfig(JSON.stringify({
|
||||||
|
gold: pyData.value.gold,
|
||||||
|
fans: pyData.value.fans,
|
||||||
|
frequency: pyData.value.frequency,
|
||||||
|
isStart: true,
|
||||||
|
filterSelling: pyData.value.filterSelling,
|
||||||
|
filterGame: pyData.value.filterGame,
|
||||||
|
rankingList: !pyData.value.rankingList,
|
||||||
|
country: countryData.value,
|
||||||
|
tenantId: getUser().tenantId,
|
||||||
|
userId: getUser().id,
|
||||||
|
crawl_single_nation: country_info.value == '全部' ? '' : country_info.value
|
||||||
|
})).then((res) => {
|
||||||
|
//开始计时器
|
||||||
|
startTimer();
|
||||||
|
//开启查询次数
|
||||||
|
getHostTimer.value = setInterval(() => {
|
||||||
|
fetchDataCount().then((res) => {
|
||||||
|
hostData.value = JSON.parse(res);
|
||||||
|
if (isLimit.value) {
|
||||||
|
if (hostData.value.canInvitationCount >= hostNum.value) {
|
||||||
|
unsubmit();
|
||||||
|
alert('爬取完毕')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
}, 1000);
|
||||||
|
getNumTimer.value = setInterval(() => {
|
||||||
|
tkaccountuse(tkData.value[0].account, 0)
|
||||||
|
tkaccountuse(tkData.value[1].account, 1)
|
||||||
|
}, 5000);
|
||||||
|
|
||||||
|
|
||||||
|
}).finally(() => {
|
||||||
|
setTimeout(() => {
|
||||||
|
pyData.value.isStart = false;
|
||||||
|
submitting.value = false;
|
||||||
|
}, 2000)
|
||||||
|
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
//停止
|
||||||
|
const unsubmit = () => {
|
||||||
|
fetchDataConfig(JSON.stringify({
|
||||||
|
gold: pyData.value.gold,
|
||||||
|
fans: pyData.value.fans,
|
||||||
|
frequency: pyData.value.frequency,
|
||||||
|
isStart: false,
|
||||||
|
filterSelling: pyData.value.filterSelling,
|
||||||
|
filterGame: pyData.value.filterGame,
|
||||||
|
rankingList: !pyData.value.rankingList,
|
||||||
|
country: countryData.value,
|
||||||
|
tenantId: getUser().tenantId,
|
||||||
|
userId: getUser().id,
|
||||||
|
crawl_single_nation: country_info.value == '全部' ? '' : country_info.value
|
||||||
|
|
||||||
|
})).then((res) => {
|
||||||
|
pauseTimer();
|
||||||
|
pyData.value.isStart = true;
|
||||||
|
clearInterval(getHostTimer.value);
|
||||||
|
getHostTimer.value = null;
|
||||||
|
clearInterval(getNumTimer.value);
|
||||||
|
getNumTimer.value = null;
|
||||||
|
|
||||||
|
// ElMessage.sussec('已停止')
|
||||||
|
}).catch((err) => {
|
||||||
|
// ElMessage.error('停止失败')
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
|
//重置
|
||||||
|
const reset = () => {
|
||||||
|
pyData.value.gold = { min: 0, max: 0 };
|
||||||
|
pyData.value.fans = { min: 0, max: 0 };
|
||||||
|
pyData.value.frequency = { hour: 0, day: 0 };
|
||||||
|
};
|
||||||
|
|
||||||
|
// 切换过滤选项 (用于Electron环境下的即时响应)
|
||||||
|
const toggleFilter = (filterName) => {
|
||||||
|
if (!pyData.value.isStart) return; // 如果已启动则不允许修改
|
||||||
|
pyData.value[filterName] = !pyData.value[filterName];
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const loginTK = (index) => {
|
||||||
|
setTkUser(tkData.value)
|
||||||
|
loginBackStage({
|
||||||
|
account: tkData.value[index].account,
|
||||||
|
password: tkData.value[index].password,
|
||||||
|
index: index
|
||||||
|
})
|
||||||
|
if (index == 0) {
|
||||||
|
isLogin.value[1] = true;
|
||||||
|
statusTimer = setInterval(() => {
|
||||||
|
getloginStatus();
|
||||||
|
}, 2000)
|
||||||
|
} else if (index == 1) {
|
||||||
|
isLogin.value[0] = true;
|
||||||
|
statusTimerCopy = setInterval(() => {
|
||||||
|
getloginStatusCopy();
|
||||||
|
}, 2000)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const openTK = () => {
|
||||||
|
// isTk.value = true;
|
||||||
|
// console.log(isTk.value)
|
||||||
|
loginTikTok();
|
||||||
|
|
||||||
|
// 开始轮询TK登录状态
|
||||||
|
if (tkStatusTimer.value) {
|
||||||
|
clearInterval(tkStatusTimer.value);
|
||||||
|
}
|
||||||
|
tkStatusTimer.value = setInterval(() => {
|
||||||
|
checkTkLoginStatus();
|
||||||
|
}, 3000);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查TK登录状态
|
||||||
|
const checkTkLoginStatus = () => {
|
||||||
|
getTkLoginStatus().then((res) => {
|
||||||
|
isTkLoggedIn.value = res === true || res === 'true';
|
||||||
|
}).catch(() => {
|
||||||
|
isTkLoggedIn.value = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function getloginStatus() {
|
||||||
|
backStageloginStatus().then((res) => {
|
||||||
|
const data = JSON.parse(res);
|
||||||
|
tkData.value[data.index].code = data.code
|
||||||
|
|
||||||
|
if (data.code == 1) {
|
||||||
|
clearInterval(statusTimer);
|
||||||
|
statusTimer = null;
|
||||||
|
submitting.value = false
|
||||||
|
isLogin.value[1] = false;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
function getloginStatusCopy() {
|
||||||
|
backStageloginStatusCopy().then((res) => {
|
||||||
|
const data = JSON.parse(res);
|
||||||
|
tkData.value[data.index].code = data.code
|
||||||
|
|
||||||
|
if (data.code == 1) {
|
||||||
|
clearInterval(statusTimer);
|
||||||
|
statusTimer = null;
|
||||||
|
submitting.value = false
|
||||||
|
isLogin.value[0] = false;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function tkaccountuse(id, index) {
|
||||||
|
let num = 0;
|
||||||
|
console.log(id, index, "查询次数")
|
||||||
|
if (!id || id == '') {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
tkaccountuseinfo(id).then((res) => {
|
||||||
|
console.log("查询返回", res)
|
||||||
|
num = res
|
||||||
|
tkData.value[index].num = num
|
||||||
|
setTkUser(tkData.value)
|
||||||
|
console.log('账号使用次数', tkData.value[index].num)
|
||||||
|
// ElMessage.error('账号使用次数', tkData.value[index].num);
|
||||||
|
}).catch((err) => {
|
||||||
|
console.log('账号使用次数', err)
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const isRunning = ref(false);
|
||||||
|
const totalSeconds = ref(0);
|
||||||
|
//定时器
|
||||||
|
let timerCrawl = null;
|
||||||
|
|
||||||
|
const startTimedata = ref(null);
|
||||||
|
//清空时间 并开始运行
|
||||||
|
const startTimer = () => {
|
||||||
|
resetTimer();
|
||||||
|
if (isRunning.value) return;
|
||||||
|
isRunning.value = true;
|
||||||
|
startTimedata.value = Date.now();
|
||||||
|
timerCrawl = setInterval(() => {
|
||||||
|
totalSeconds.value = Math.floor((Date.now() - startTimedata.value) / 1000);
|
||||||
|
}, 1000);
|
||||||
|
};
|
||||||
|
|
||||||
|
//结束运行 暂停
|
||||||
|
const pauseTimer = () => {
|
||||||
|
isRunning.value = false;
|
||||||
|
clearInterval(timerCrawl);
|
||||||
|
};
|
||||||
|
//清空时间
|
||||||
|
const resetTimer = () => {
|
||||||
|
isRunning.value = false;
|
||||||
|
clearInterval(timerCrawl);
|
||||||
|
totalSeconds.value = 0;
|
||||||
|
};
|
||||||
|
// 格式化时间为 HH:MM:SS
|
||||||
|
const formattedTime = computed(() => {
|
||||||
|
const hours = Math.floor(totalSeconds.value / 3600);
|
||||||
|
const minutes = Math.floor((totalSeconds.value % 3600) / 60);
|
||||||
|
const seconds = totalSeconds.value % 60;
|
||||||
|
|
||||||
|
return [
|
||||||
|
hours.toString().padStart(2, '0'),
|
||||||
|
minutes.toString().padStart(2, '0'),
|
||||||
|
seconds.toString().padStart(2, '0')
|
||||||
|
].join(':');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
function handleInputHour(value) {
|
||||||
|
console.log(value)
|
||||||
|
// 替换非数字字符为空字符串
|
||||||
|
let num = value.replace(/[^\d]/g, '');
|
||||||
|
// 如果值小于等于0,则设置为0
|
||||||
|
if (Number(num) <= 0) {
|
||||||
|
num = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((tkData.value[0].code == 1) && (tkData.value[1].code == 1)) {
|
||||||
|
if (Number(num) > maxCount.value[1].hourMax) {
|
||||||
|
num = maxCount.value[1].hourMax;
|
||||||
|
}
|
||||||
|
} else if ((tkData.value[0].code == 1) || (tkData.value[1].code == 1)) {
|
||||||
|
// 如果值大于最大值,则设置为最大值
|
||||||
|
if (Number(num) > maxCount.value[0].hourMax) {
|
||||||
|
num = maxCount.value[0].hourMax;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
ElMessage.error('请先登录tk后台');
|
||||||
|
num = 0;
|
||||||
|
}
|
||||||
|
// 更新模型
|
||||||
|
pyData.value.frequency.hour = num;
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleInputDay(value) {
|
||||||
|
console.log(value)
|
||||||
|
// 替换非数字字符为空字符串
|
||||||
|
let num = value.replace(/[^\d]/g, '');
|
||||||
|
// 如果值小于等于0,则设置为0
|
||||||
|
if (Number(num) <= 0) {
|
||||||
|
num = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((tkData.value[0].code == 1) && (tkData.value[1].code == 1)) {
|
||||||
|
if (Number(num) > maxCount.value[1].dayMax) {
|
||||||
|
num = maxCount.value[1].dayMax;
|
||||||
|
}
|
||||||
|
} else if ((tkData.value[0].code == 1) || (tkData.value[1].code == 1)) {
|
||||||
|
// 如果值大于最大值,则设置为最大值
|
||||||
|
if (Number(num) > maxCount.value[0].dayMax) {
|
||||||
|
num = maxCount.value[0].dayMax;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ElMessage.error('请先登录tk后台');
|
||||||
|
num = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 更新模型
|
||||||
|
pyData.value.frequency.day = num;
|
||||||
|
}
|
||||||
|
|
||||||
|
function timestampToTime(timestamp_ms) {
|
||||||
|
const date = new Date(timestamp_ms);
|
||||||
|
const year = date.getFullYear();
|
||||||
|
const month = (date.getMonth() + 1).toString().padStart(2, '0');
|
||||||
|
const day = date.getDate().toString().padStart(2, '0');
|
||||||
|
const hours = date.getHours().toString().padStart(2, '0');
|
||||||
|
const minutes = date.getMinutes().toString().padStart(2, '0');
|
||||||
|
const seconds = date.getSeconds().toString().padStart(2, '0');
|
||||||
|
const milliseconds = date.getMilliseconds().toString().padStart(3, '0');
|
||||||
|
|
||||||
|
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
let isWifi = ref(false);
|
||||||
|
const checkVPN = async () => {
|
||||||
|
try {
|
||||||
|
// 设置超时 5 秒钟
|
||||||
|
const timeout = new Promise((_, reject) =>
|
||||||
|
setTimeout(() => reject(new Error('请求超时')), 10000) // 10秒超时
|
||||||
|
);
|
||||||
|
|
||||||
|
// 使用 Promise.race 来进行超时控制
|
||||||
|
const response = await Promise.race([
|
||||||
|
fetch('https://www.google.com', { method: 'HEAD', mode: 'no-cors' }),
|
||||||
|
timeout
|
||||||
|
]);
|
||||||
|
|
||||||
|
// 判断 fetch 请求是否成功
|
||||||
|
if (response && response.type === 'opaque') {
|
||||||
|
// ElMessage.success('VPN连接正常!');
|
||||||
|
isWifi.value = false;
|
||||||
|
} else {
|
||||||
|
ElMessage.error('VPN连接失败,无法访问网络。');
|
||||||
|
isWifi.value = true;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
// 捕获超时错误或其他错误
|
||||||
|
ElMessage.error('VPN连接失败,无法访问网络。');
|
||||||
|
isWifi.value = true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
/*
|
||||||
|
Most styles are replaced by Tailwind utility classes.
|
||||||
|
We can keep specific overrides or custom animations here if needed.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Element Plus 输入框统一样式 */
|
||||||
|
.el-input-custom :deep(.el-input__wrapper) {
|
||||||
|
background-color: white;
|
||||||
|
border: 1px solid rgb(226, 232, 240);
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
padding: 0.5rem 1rem;
|
||||||
|
box-shadow: none;
|
||||||
|
transition: all 0.15s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-input-custom :deep(.el-input__wrapper:hover) {
|
||||||
|
border-color: rgb(203, 213, 225);
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-input-custom :deep(.el-input__wrapper.is-focus) {
|
||||||
|
border-color: var(--el-color-primary);
|
||||||
|
box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-input-custom :deep(.el-input__inner) {
|
||||||
|
font-size: 0.875rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-input-custom :deep(.el-input__wrapper.is-disabled) {
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 暗色模式支持 */
|
||||||
|
.dark .el-input-custom :deep(.el-input__wrapper) {
|
||||||
|
background-color: rgb(30, 41, 59);
|
||||||
|
border-color: rgb(51, 65, 85);
|
||||||
|
}
|
||||||
|
|
||||||
|
.dark .el-input-custom :deep(.el-input__wrapper:hover) {
|
||||||
|
border-color: rgb(71, 85, 105);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -80,18 +80,9 @@ body {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
||||||
|
|
||||||
-webkit-user-select: none; /* Chrome / Safari */
|
|
||||||
-moz-user-select: none; /* Firefox */
|
|
||||||
-ms-user-select: none; /* IE / Edge */
|
|
||||||
user-select: none; /* 标准 */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-container {
|
.nav-container {
|
||||||
transform-origin: center center;
|
transform-origin: center center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
Reference in New Issue
Block a user