This commit is contained in:
扫地僧 2026-06-15 23:44:00 +08:00
commit fa2dd8548c
12 changed files with 2656 additions and 509 deletions

View File

@ -6,7 +6,7 @@
"scripts": {
"dev": "vite --open",
"clean": "node scripts/clean-dist.mjs",
"build": "vite build",
"build": "node --max-old-space-size=4096 ./node_modules/vite/bin/vite.js build",
"preview": "vite preview"
},
"dependencies": {

View File

@ -51,6 +51,38 @@ export function updateAccountPoolRemark(module, data) {
});
}
export function setAccountPoolUnavailable(module, data) {
return request({
url: `${base(module)}/setUnavailable`,
method: 'post',
data,
});
}
export function updateAccountPoolUsable(module, data) {
return request({
url: `${base(module)}/updateUsable`,
method: 'post',
data,
});
}
export function updateAccountPoolPlatform(module, data) {
return request({
url: `${base(module)}/updatePlatform`,
method: 'post',
data,
});
}
export function unextractAccountPool(module, data) {
return request({
url: `${base(module)}/unextract`,
method: 'post',
data,
});
}
export function replenishAccountPool(module, data) {
return request({
url: `${base(module)}/replenish`,

View File

@ -14,7 +14,6 @@
<!-- 菜单主体 -->
<el-menu
v-else
:collapse="isCollapse"
:collapse-transition="false"
:background-color="asideBgColor"
@ -23,6 +22,7 @@
:active-background-color="activeBgColor"
class="el-menu-vertical-demo"
:unique-opened="true"
:default-openeds="defaultOpeneds"
@select="handleMenuSelect"
:default-active="route.path"
>
@ -284,10 +284,29 @@ const currentModule = computed(() => {
});
const displayMenus = computed(() => {
//
// ""
return list.value;
});
const findOpenMenuPaths = (menus, targetPath, ancestors = []) => {
for (const menu of menus) {
const currentPath = menu.path || menu.id.toString();
if (menu.path && (targetPath === menu.path || targetPath.startsWith(menu.path + "/"))) {
return [...ancestors, currentPath];
}
if (menu.children && menu.children.length > 0) {
const found = findOpenMenuPaths(menu.children, targetPath, [...ancestors, currentPath]);
if (found) return found;
}
}
return null;
};
const defaultOpeneds = computed(() => {
const result = findOpenMenuPaths(displayMenus.value, route.path);
return result || [];
});
const asideTitle = computed(() => {
if (isCollapse.value) return "管理";
return "菜单";
@ -311,7 +330,7 @@ const processMenus = (menus) => {
.map((menu) => ({
id: menu.id,
path: menu.path,
icon: menu.icon || "Document",
icon: menu.icon || null,
title: menu.title,
route: menu.path,
component_path: menu.component_path,
@ -541,13 +560,13 @@ h3 {
//
.el-menu-item.is-active {
html:not(.dark) & {
background-color: rgba(57, 115, 255, 0.3) !important;
background-color: rgba(255, 255, 255, 0.2) !important;
border-left: 3px solid #ffffff;
}
html.dark & {
background-color: rgba(60, 60, 60, 0.8) !important;
}
color: #ffffff !important;
border-left: 3px solid #4f84ff;
margin-left: -3px;
.menu-icon {
@ -574,12 +593,17 @@ h3 {
}
&.is-opened .el-sub-menu__title {
background: rgba(255, 255, 255, 0.08) !important;
background: rgba(255, 255, 255, 0.12) !important;
margin-left: -3px;
}
.el-menu-item {
padding-left: 48px !important;
font-size: 13px;
&.is-active {
background: rgba(255, 255, 255, 0.18) !important;
}
}
}
@ -604,6 +628,10 @@ h3 {
.el-sub-menu.is-opened .el-sub-menu__title {
background: rgba(64, 158, 255, 0.08) !important;
}
.el-sub-menu .el-menu-item.is-active {
background: rgba(64, 158, 255, 0.15) !important;
}
}
}

View File

@ -1,6 +1,6 @@
<script setup>
import { computed, ref, watch } from 'vue';
import { ElMessage } from 'element-plus';
import { computed, reactive, ref, watch } from "vue";
import { ElMessage } from "element-plus";
const props = defineProps({
modelValue: {
@ -17,69 +17,171 @@ const props = defineProps({
},
});
const emit = defineEmits(['update:modelValue', 'save-remark']);
const remarkText = ref('');
const emit = defineEmits(["update:modelValue", "save-remark", "detail-action"]);
const remarkText = ref("");
const remarkDialogVisible = ref(false);
const platformDialogVisible = ref(false);
const unavailableDialogVisible = ref(false);
const usableDialogVisible = ref(false);
const unextractDialogVisible = ref(false);
const platformForm = reactive({ platform: "local" });
const usableForm = reactive({ usable: 1 });
function typeText(type) {
if (type === 'account') return '账号密码';
if (type === 'account_tk') return '账号密码+Token';
return 'Token';
}
const PLATFORM_MAP = {
local: { label: '本地', type: 'info' },
xianyu: { label: '闲鱼', type: 'warning' },
taobao: { label: '淘宝', type: 'info' },
pinduoduo: { label: '拼多多', type: 'danger' },
jingdong: { label: '京东', type: 'primary' },
douyin: { label: '抖音', type: 'success' },
ziyoushangcheng: { label: '自有商城', type: 'warning' },
const TYPE_MAP = {
account: { label: "账号密码", type: "success" },
account_tk: { label: "账号密码+Token", type: "primary" },
tk: { label: "Token", type: "warning" },
};
const platformLabel = computed(() => {
if (!props.row?.extractedPlatform) return '-';
return PLATFORM_MAP[props.row.extractedPlatform]?.label || props.row.extractedPlatform;
const PLATFORM_MAP = {
local: { label: "本地", type: "info" },
xianyu: { label: "闲鱼", type: "warning" },
taobao: { label: "淘宝", type: "info" },
pinduoduo: { label: "拼多多", type: "danger" },
jingdong: { label: "京东", type: "primary" },
douyin: { label: "抖音", type: "success" },
ziyoushangcheng: { label: "自有商城", type: "warning" },
};
const statusInfo = computed(() => {
const status = Number(props.row?.extractStatus || 0);
if (status === 2) return { label: "补号", type: "warning" };
if (status === 3) return { label: "续杯", type: "primary" };
if (props.row?.extracted) return { label: "已提取", type: "success" };
return { label: "未提取", type: "info" };
});
const platformType = computed(() => {
if (!props.row?.extractedPlatform) return 'info';
return PLATFORM_MAP[props.row.extractedPlatform]?.type || 'info';
const typeInfo = computed(() => {
return (
TYPE_MAP[props.row?.type] || { label: props.row?.type || "-", type: "info" }
);
});
const platformInfo = computed(() => {
const key = props.row?.extractedPlatform;
if (!key) return { label: "-", type: "info" };
return PLATFORM_MAP[key] || { label: key, type: "info" };
});
const isUsedInfo = computed(() => {
const raw = props.row?.isUsed;
if (raw === null || raw === undefined || raw === "") {
return { label: "未探测", type: "info" };
}
const n = Number(raw);
if (n === 1) return { label: "可用", type: "success" };
if (n === 0) return { label: "已用完", type: "danger" };
return { label: String(raw), type: "info" };
});
const hasAccountPassword = computed(
() => !!(props.row?.account || props.row?.password),
);
const hasToken = computed(() => !!props.row?.token);
watch(
() => props.row,
(row) => {
remarkText.value = row?.remark || '';
remarkText.value = row?.remark || "";
platformForm.platform = row?.extractedPlatform || "local";
const raw = row?.isUsed;
if (raw === null || raw === undefined || raw === "") {
usableForm.usable = 1;
} else {
usableForm.usable = Number(raw) === 0 ? 0 : 1;
}
},
{ immediate: true }
{ immediate: true },
);
function closeDialog() {
emit("update:modelValue", false);
}
function openRemarkDialog() {
remarkText.value = props.row?.remark || "";
remarkDialogVisible.value = true;
}
function onSaveRemark() {
if (!props.row?.id) return;
emit('save-remark', { id: props.row.id, remark: remarkText.value || '' });
emit("save-remark", { id: props.row.id, remark: remarkText.value || "" });
remarkDialogVisible.value = false;
}
function onSetUnavailable() {
if (!props.row?.id) return;
emit("detail-action", { action: "unavailable", id: props.row.id });
unavailableDialogVisible.value = false;
}
function openUsableDialog() {
const raw = props.row?.isUsed;
if (raw === null || raw === undefined || raw === "") {
usableForm.usable = 1;
} else {
usableForm.usable = Number(raw) === 0 ? 0 : 1;
}
usableDialogVisible.value = true;
}
function onUpdateUsable() {
if (!props.row?.id) return;
emit("detail-action", {
action: "usable",
id: props.row.id,
usable: usableForm.usable,
});
usableDialogVisible.value = false;
}
function onUpdatePlatform() {
if (!props.row?.id) return;
emit("detail-action", {
action: "platform",
id: props.row.id,
platform: platformForm.platform,
});
platformDialogVisible.value = false;
}
function onUnextract() {
if (!props.row?.id) return;
emit("detail-action", { action: "unextract", id: props.row.id });
unextractDialogVisible.value = false;
}
async function copyText(text, successText) {
const val = String(text || "").trim();
if (!val) {
ElMessage.warning("暂无可复制内容");
return;
}
try {
await navigator.clipboard.writeText(val);
ElMessage.success(successText || "已复制");
} catch {
ElMessage.error("复制失败,请检查浏览器权限");
}
}
function copyAccountPassword() {
const account = props.row?.account || '';
const password = props.row?.password || '';
if (!account && !password) {
ElMessage.warning('暂无账号密码可复制');
return;
}
navigator.clipboard.writeText(`${account}\n${password}`.trim()).then(() => {
ElMessage.success('已复制账号+密码');
});
const parts = [];
if (props.row?.account) parts.push(props.row.account);
if (props.row?.password) parts.push(props.row.password);
copyText(parts.join("\n"), "已复制账号+密码");
}
function copyToken() {
const token = props.row?.token || '';
if (!token) {
ElMessage.warning('暂无 Token 可复制');
return;
}
navigator.clipboard.writeText(token).then(() => {
ElMessage.success('已复制 Token');
});
copyText(props.row?.token, "已复制 Token");
}
function copyAll() {
const parts = [];
if (props.row?.account) parts.push(`账号:${props.row.account}`);
if (props.row?.password) parts.push(`密码:${props.row.password}`);
if (props.row?.token) parts.push(`Token${props.row.token}`);
copyText(parts.join("\n"), "已复制完整账号信息");
}
</script>
@ -87,84 +189,431 @@ function copyToken() {
<el-dialog
class="pool-detail-dialog"
:model-value="modelValue"
title="账号详情"
width="90%"
width="760px"
destroy-on-close
:show-close="false"
@update:model-value="(v) => emit('update:modelValue', v)"
>
<el-descriptions :column="1" border v-if="row">
<el-descriptions-item label="ID">{{ row.id }}</el-descriptions-item>
<el-descriptions-item label="账号类型">{{ typeText(row.type) }}</el-descriptions-item>
<el-descriptions-item label="账号">{{ row.account || '-' }}</el-descriptions-item>
<el-descriptions-item label="密码">{{ row.password || '-' }}</el-descriptions-item>
<el-descriptions-item label="Token">
<span class="token-text">{{ row.token || '-' }}</span>
</el-descriptions-item>
<el-descriptions-item label="提取状态">
{{
row.extractStatus === 2 ? '补号' : row.extracted ? '已提取' : '未提取'
}}
</el-descriptions-item>
<el-descriptions-item label="探测可用">
{{
row.isUsed === null || row.isUsed === undefined
? '未探测'
: Number(row.isUsed) === 1
? '可用'
: Number(row.isUsed) === 0
? '已用完'
: String(row.isUsed)
}}
</el-descriptions-item>
<el-descriptions-item label="提取时间">{{ row.extractedAt || '-' }}</el-descriptions-item>
<el-descriptions-item label="提取平台">
<el-tag v-if="row.extractedPlatform" :type="platformType" size="small">
{{ platformLabel }}
</el-tag>
<span v-else>-</span>
</el-descriptions-item>
<el-descriptions-item label="复制">
<div class="copy-actions">
<el-button size="small" @click="copyAccountPassword">账号+密码</el-button>
<el-button size="small" type="primary" @click="copyToken">Token</el-button>
<template #header>
<div class="detail-header">
<div>
<div class="detail-title">账号详情</div>
<div class="detail-subtitle">
通过弹窗执行账号状态平台备注等维护操作
</div>
</div>
</el-descriptions-item>
<el-descriptions-item label="备注">
<div class="remark-edit-wrap">
<el-input v-model="remarkText" type="textarea" :rows="3" placeholder="请输入备注" />
<el-button type="primary" size="small" :loading="saveLoading" @click="onSaveRemark">
保存备注
<div class="header-actions">
<el-button circle plain @click="closeDialog">×</el-button>
</div>
</div>
</template>
<div v-if="row" class="detail-body">
<div class="info-grid">
<div class="info-card">
<div class="info-label">ID</div>
<div class="info-value">{{ row?.id || "-" }}</div>
</div>
<div class="info-card">
<div class="info-label">账号类型</div>
<div class="info-value">
<el-tag :type="typeInfo.type" round>{{ typeInfo.label }}</el-tag>
</div>
</div>
<div class="info-card">
<div class="info-label">提取状态</div>
<div class="info-value">
<el-tag :type="statusInfo.type" effect="dark" round>
{{ statusInfo.label }}
</el-tag>
</div>
</div>
<div class="info-card">
<div class="info-label">提取平台</div>
<div class="info-value">
<el-tag
v-if="row.extractedPlatform"
:type="platformInfo.type"
size="small"
>
{{ platformInfo.label }}
</el-tag>
<span v-else>-</span>
</div>
</div>
<div class="info-card">
<div class="info-label">提取时间</div>
<div class="info-value">{{ row.extractedAt || "-" }}</div>
</div>
<div class="info-card">
<div class="info-label">可用检测</div>
<div class="info-value">
<el-tag :type="isUsedInfo.type" round>
{{ isUsedInfo.label }}
</el-tag>
</div>
</div>
<div class="info-card">
<div class="info-label">账号</div>
<div class="info-value">{{ row.account || "-" }}</div>
</div>
<div class="info-card">
<div class="info-label">密码</div>
<div class="info-value">{{ row.password || "-" }}</div>
</div>
</div>
<div class="section-card">
<div class="section-head">
<div>
<div class="section-title">Token</div>
<div class="section-subtitle">
Token 已做自动换行便于检查与复制
</div>
</div>
<el-button
size="small"
type="primary"
plain
:disabled="!hasToken"
@click="copyToken"
>
复制 Token
</el-button>
</div>
</el-descriptions-item>
</el-descriptions>
<pre class="token-box">{{ row.token || "暂无 Token" }}</pre>
</div>
<div class="section-card">
<div class="section-head">
<div>
<div class="section-title">快捷功能</div>
<div class="section-subtitle">按使用场景复制账号信息</div>
</div>
</div>
<div class="copy-actions">
<el-button
:disabled="!hasAccountPassword"
@click="copyAccountPassword"
>
复制账号+密码
</el-button>
<el-button
type="primary"
plain
:disabled="!hasToken"
@click="copyToken"
>
复制 Token
</el-button>
<el-button
type="success"
plain
:disabled="!hasAccountPassword && !hasToken"
@click="copyAll"
>
复制全部
</el-button>
</div>
</div>
<div class="section-card">
<div class="section-head">
<div>
<div class="section-title">维护操作</div>
<div class="section-subtitle">
点击按钮后打开确认/编辑弹窗再执行对应操作
</div>
</div>
</div>
<div class="copy-actions">
<el-button type="success" plain @click="openUsableDialog">
改可用状态
</el-button>
<el-button
type="danger"
plain
@click="unavailableDialogVisible = true"
>
改不可用
</el-button>
<el-button
type="warning"
plain
@click="platformDialogVisible = true"
>
改平台
</el-button>
<el-button type="info" plain @click="unextractDialogVisible = true">
反提取
</el-button>
<el-button type="primary" plain @click="openRemarkDialog">
改备注
</el-button>
</div>
</div>
<div class="section-card">
<div class="section-head">
<div>
<div class="section-title">备注</div>
<div class="section-subtitle">备注改为弹窗编辑当前仅展示</div>
</div>
</div>
<div class="remark-display">{{ row.remark || "暂无备注" }}</div>
</div>
</div>
</el-dialog>
<el-dialog
v-model="usableDialogVisible"
title="改可用状态"
width="420px"
append-to-body
>
<el-form label-width="84px">
<el-form-item label="可用状态">
<el-radio-group v-model="usableForm.usable">
<el-radio :value="1">可用</el-radio>
<el-radio :value="0">不可用</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<template #footer>
<el-button @click="usableDialogVisible = false">取消</el-button>
<el-button type="primary" :loading="saveLoading" @click="onUpdateUsable">
确认修改
</el-button>
</template>
</el-dialog>
<el-dialog
v-model="unavailableDialogVisible"
title="改不可用"
width="420px"
append-to-body
>
<el-alert type="warning" :closable="false">
确认将当前账号标记为不可用/已用完
</el-alert>
<template #footer>
<el-button @click="unavailableDialogVisible = false">取消</el-button>
<el-button type="danger" :loading="saveLoading" @click="onSetUnavailable">
确认改不可用
</el-button>
</template>
</el-dialog>
<el-dialog
v-model="platformDialogVisible"
title="改平台"
width="420px"
append-to-body
>
<el-form label-width="84px">
<el-form-item label="提取平台">
<el-select v-model="platformForm.platform" style="width: 100%">
<el-option
v-for="(v, k) in PLATFORM_MAP"
:key="k"
:label="v.label"
:value="k"
/>
</el-select>
</el-form-item>
</el-form>
<template #footer>
<el-button @click="platformDialogVisible = false">取消</el-button>
<el-button type="primary" :loading="saveLoading" @click="onUpdatePlatform">
确认修改
</el-button>
</template>
</el-dialog>
<el-dialog
v-model="unextractDialogVisible"
title="反提取"
width="420px"
append-to-body
>
<el-alert type="warning" :closable="false">
反提取会把账号恢复为未提取并清空提取时间与提取平台
</el-alert>
<template #footer>
<el-button @click="unextractDialogVisible = false">取消</el-button>
<el-button type="warning" :loading="saveLoading" @click="onUnextract">
确认反提取
</el-button>
</template>
</el-dialog>
<el-dialog
v-model="remarkDialogVisible"
title="改备注"
width="520px"
append-to-body
>
<el-input
v-model="remarkText"
type="textarea"
:rows="5"
resize="none"
placeholder="请输入备注"
/>
<template #footer>
<el-button @click="remarkDialogVisible = false">取消</el-button>
<el-button type="primary" :loading="saveLoading" @click="onSaveRemark">
保存备注
</el-button>
</template>
</el-dialog>
</template>
<style scoped>
.token-text {
word-break: break-all;
white-space: pre-wrap;
line-height: 1.6;
:deep(.pool-detail-dialog) {
max-width: calc(100vw - 28px);
border-radius: 18px;
overflow: hidden;
}
.remark-edit-wrap {
:deep(.pool-detail-dialog .el-dialog__header) {
padding: 18px 22px;
margin: 0;
border-bottom: 1px solid #eef0f5;
}
:deep(.pool-detail-dialog .el-dialog__body) {
padding: 18px 22px 22px;
background: #f6f8fb;
}
:deep(.el-tag) {
border-radius: 4px !important;
}
.detail-header,
.header-actions,
.section-head,
.copy-actions {
display: flex;
align-items: center;
}
.detail-header {
justify-content: space-between;
gap: 14px;
}
.detail-title {
font-size: 18px;
font-weight: 700;
color: #1f2937;
}
.detail-subtitle,
.section-subtitle {
margin-top: 4px;
font-size: 12px;
color: #909399;
}
.header-actions {
gap: 10px;
}
.header-actions .el-button {
font-size: 18px;
font-weight: 300;
}
.detail-body {
display: flex;
flex-direction: column;
gap: 8px;
gap: 14px;
}
.section-card,
.info-card {
background: #fff;
border: 1px solid #edf0f6;
box-shadow: 0 10px 28px rgba(31, 41, 55, 0.06);
}
.info-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 12px;
}
.info-card {
border-radius: 14px;
padding: 14px;
min-width: 0;
}
.info-label {
color: #909399;
font-size: 12px;
margin-bottom: 8px;
}
.info-value {
color: #303133;
font-size: 14px;
font-weight: 600;
word-break: break-all;
min-height: 20px;
}
.section-card {
border-radius: 16px;
padding: 16px;
}
.section-head {
justify-content: space-between;
gap: 12px;
margin-bottom: 12px;
}
.section-title {
font-size: 15px;
font-weight: 700;
color: #303133;
}
.token-box {
margin: 0;
padding: 14px;
max-height: 220px;
overflow: auto;
border-radius: 12px;
background: #111827;
color: #d1e7ff;
font-size: 12px;
line-height: 1.7;
white-space: pre-wrap;
word-break: break-all;
}
.copy-actions {
display: flex;
flex-wrap: wrap;
gap: 8px;
gap: 10px;
}
.remark-edit-wrap .el-button {
align-self: flex-start;
.copy-actions .el-button {
margin: 0;
}
:deep(.pool-detail-dialog) {
max-width: 560px;
.remark-display {
padding: 12px;
min-height: 42px;
border-radius: 10px;
background: #f8fafc;
color: #303133;
line-height: 1.6;
white-space: pre-wrap;
word-break: break-all;
}
@media (max-width: 768px) {
@ -173,21 +622,32 @@ function copyToken() {
margin: 0 auto;
}
:deep(.pool-detail-dialog .el-dialog__header) {
padding: 14px 14px;
}
:deep(.pool-detail-dialog .el-dialog__body) {
padding: 12px;
max-height: 70vh;
max-height: 76vh;
overflow-y: auto;
}
:deep(.pool-detail-dialog .el-descriptions__label) {
width: 72px;
word-break: break-all;
white-space: normal;
.detail-header,
.section-head {
align-items: flex-start;
}
.remark-edit-wrap .el-button {
.section-head {
flex-direction: column;
}
.info-grid {
grid-template-columns: 1fr;
}
.copy-actions .el-button,
.section-head .el-button {
width: 100%;
align-self: stretch;
}
}
</style>

View File

@ -1,5 +1,6 @@
<script setup>
import { computed, reactive, watch } from "vue";
import { ElMessage } from "element-plus";
const props = defineProps({
modelValue: {
@ -90,8 +91,8 @@ function parseBatchRows() {
const [account, password, token] = line
.split(",")
.map((x) => (x || "").trim());
if (!account || !password || !token) {
errors.push(`${index + 1} 行格式错误,应为 account,password,token`);
if (!account || !token) {
errors.push(`${index + 1} 行格式错误,应为 account,password,tokenpassword 可为空)`);
return;
}
parsed.push({
@ -139,7 +140,8 @@ function handleSubmit() {
}
if (form.type === "account_tk") {
if (!form.account || !form.password || !form.token) {
if (!form.account || !form.token) {
ElMessage.warning("请输入账号和 Token密码可为空");
return;
}
emit("submit", {
@ -177,6 +179,7 @@ function handleSubmit() {
const { parsed, errors } = parseBatchRows();
if (errors.length || parsed.length === 0) {
ElMessage.warning(errors[0] || "请填写批量内容");
return;
}
emit("submit", {

View File

@ -1,6 +1,7 @@
<script setup>
import { computed, h, nextTick, onMounted, onUnmounted, reactive, ref, watch } from "vue";
import { ElMessage, ElMessageBox } from "element-plus";
import { Loading } from "@element-plus/icons-vue";
import Edit from "./components/edit.vue";
import DetailDialog from "./components/detail.vue";
import ExtractDialog from "./components/extract.vue";
@ -12,11 +13,44 @@ import {
getAccountPoolDetail,
getAccountPoolList,
updateAccountPoolRemark,
setAccountPoolUnavailable,
updateAccountPoolUsable,
updateAccountPoolPlatform,
unextractAccountPool,
replenishAccountPool,
probeAccountPoolToken,
} from "@/api/accountPool";
const moduleKey = "cursor";
const PAGINATION_STORAGE_KEY = `accountPool:${moduleKey}:pagination`;
function loadStoredPagination() {
try {
const raw = sessionStorage.getItem(PAGINATION_STORAGE_KEY);
if (!raw) return { page: 1, pageSize: 20 };
const saved = JSON.parse(raw);
const pageSize = Number(saved.pageSize);
const page = Number(saved.page);
return {
page: Number.isFinite(page) && page >= 1 ? page : 1,
pageSize: [20, 50, 100].includes(pageSize) ? pageSize : 20,
};
} catch {
return { page: 1, pageSize: 20 };
}
}
function savePagination() {
sessionStorage.setItem(
PAGINATION_STORAGE_KEY,
JSON.stringify({
page: pagination.page,
pageSize: pagination.pageSize,
}),
);
}
const storedPagination = loadStoredPagination();
const loading = ref(false);
const editVisible = ref(false);
@ -32,8 +66,11 @@ const apiDocVisible = ref(false);
const patchVisible = ref(false);
const query = reactive({
keyword: "",
account: "",
token: "",
remark: "",
status: "",
platform: "",
usable: "",
});
const activeTypeTab = ref("all");
@ -52,10 +89,24 @@ const selectedRows = ref([]);
const detailRow = ref(null);
const detailRemarkSaving = ref(false);
const probeLoadingId = ref(null);
const batchProbeDialogVisible = ref(false);
const batchProbePhase = ref("running");
const batchProbeProgress = reactive({
total: 0,
current: 0,
currentId: null,
percent: 0,
});
const batchProbeSummary = reactive({
total: 0,
available: 0,
unavailable: 0,
skipped: 0,
});
const isMobile = ref(false);
const pagination = reactive({
page: 1,
pageSize: 20,
page: storedPagination.page,
pageSize: storedPagination.pageSize,
});
/** 跳转未提取末页时跳过 watcher避免先被重置到第 1 页 */
@ -64,8 +115,11 @@ const skipWatchFetchDuringUnusedJump = ref(false);
const pagedList = computed(() => tableData.value);
function resetQuery() {
query.keyword = "";
query.account = "";
query.token = "";
query.remark = "";
query.status = "";
query.platform = "";
query.usable = "";
}
@ -79,7 +133,7 @@ const typeTabs = computed(() => {
});
watch(
() => [query.keyword, query.status, query.usable, activeTypeTab.value],
() => [query.account, query.token, query.remark, query.status, query.platform, query.usable, activeTypeTab.value],
() => {
if (skipWatchFetchDuringUnusedJump.value) return;
pagination.page = 1;
@ -90,6 +144,7 @@ watch(
watch(
() => [pagination.page, pagination.pageSize],
() => {
savePagination();
if (skipWatchFetchDuringUnusedJump.value) return;
fetchList();
},
@ -248,6 +303,46 @@ async function handleSaveRemark(payload) {
}
}
async function refreshDetailRow(id) {
if (!id) return;
const res = await getAccountPoolDetail(moduleKey, id);
if (res?.code === 200) {
detailRow.value = normalizeRow(res.data || {});
}
}
async function handleDetailAction(payload) {
if (!payload?.id || !payload?.action) return;
detailRemarkSaving.value = true;
try {
let res;
if (payload.action === "unavailable") {
res = await setAccountPoolUnavailable(moduleKey, { id: payload.id });
} else if (payload.action === "usable") {
res = await updateAccountPoolUsable(moduleKey, {
id: payload.id,
usable: payload.usable,
});
} else if (payload.action === "platform") {
res = await updateAccountPoolPlatform(moduleKey, {
id: payload.id,
platform: payload.platform,
});
} else if (payload.action === "unextract") {
res = await unextractAccountPool(moduleKey, { id: payload.id });
}
if (res?.code !== 200) {
ElMessage.error(res?.msg || "操作失败");
return;
}
ElMessage.success("操作成功");
await refreshDetailRow(payload.id);
await fetchList();
} finally {
detailRemarkSaving.value = false;
}
}
function markExtractForSelected() {
if (!selectedRows.value.length) {
ElMessage.warning("请先选择数据");
@ -285,7 +380,7 @@ async function handleBatchExtract() {
const text = succeeded.map(rowToText).filter(Boolean).join("\n");
navigator.clipboard.writeText(text).catch(() => {});
}
fetchList();
await fetchList();
} finally {
loading.value = false;
}
@ -321,12 +416,14 @@ function typeText(type) {
function extractStatusLabel(row) {
if (row?.extractStatus === 2) return "补号";
if (row?.extractStatus === 3) return "续杯";
if (row?.extracted) return "已提取";
return "未提取";
}
function extractStatusTagType(row) {
if (row?.extractStatus === 2) return "warning";
if (row?.extractStatus === 3) return "primary";
if (row?.extracted) return "success";
return "info";
}
@ -477,8 +574,11 @@ async function fetchList() {
const res = await getAccountPoolList(moduleKey, {
page: pagination.page,
pageSize: pagination.pageSize,
keyword: query.keyword || undefined,
account: query.account || undefined,
token: query.token || undefined,
remark: query.remark || undefined,
status: query.status || undefined,
platform: query.platform || undefined,
usable: query.usable === "1" || query.usable === "0" ? query.usable : undefined,
type: activeTypeTab.value === "all" ? undefined : activeTypeTab.value,
});
@ -489,18 +589,24 @@ async function fetchList() {
const list = Array.isArray(res?.data?.list) ? res.data.list : [];
tableData.value = list.map(normalizeRow);
total.value = Number(res?.data?.total || 0);
const maxPage = Math.max(1, Math.ceil(total.value / pagination.pageSize));
if (pagination.page > maxPage) {
pagination.page = maxPage;
}
} finally {
loading.value = false;
}
}
/** 筛选「未提取」并翻到该条件下的最后一页(当前关键词、账号类型 tab 不变) */
/** 筛选「未提取」并翻到该条件下的最后一页(当前搜索条件、账号类型 tab 不变) */
async function jumpToLastUnusedPage() {
const type = activeTypeTab.value === "all" ? undefined : activeTypeTab.value;
const res = await getAccountPoolList(moduleKey, {
page: 1,
pageSize: pagination.pageSize,
keyword: query.keyword || undefined,
account: query.account || undefined,
token: query.token || undefined,
remark: query.remark || undefined,
status: "unused",
usable: query.usable === "1" || query.usable === "0" ? query.usable : undefined,
type,
@ -632,6 +738,35 @@ function formatCursorProbeDialogText(d) {
return '该TOKEN可用';
}
function formatCursorProbeDetail(d) {
if (!d) return '';
const parts = [];
//
if (d.httpStatus) parts.push(`HTTP状态: ${d.httpStatus}`);
if (d.endpoint) parts.push(`接口: ${d.endpoint}`);
if (d.probeMessage) parts.push(`探测方式: ${d.probeMessage}`);
if (d.bytesRead) parts.push(`响应大小: ${d.bytesRead} 字节`);
if (d.streamProtocol) parts.push(`协议: ${d.streamProtocol}`);
//
if (d.detail) {
//
const matchPrefix = '流中匹配:';
if (d.detail.includes(matchPrefix)) {
const matchStart = d.detail.indexOf(matchPrefix);
const matchEnd = d.detail.indexOf('', matchStart);
const matchText = matchEnd > 0 ? d.detail.substring(matchStart, matchEnd) : d.detail.substring(matchStart);
parts.push(`检测结论: ${matchText}`);
} else {
parts.push(`检测结论: ${d.detail}`);
}
}
return parts.join('\n');
}
async function handleProbeToken(row) {
if (!row?.token) {
ElMessage.warning('该行无 Token');
@ -649,10 +784,43 @@ async function handleProbeToken(row) {
}
const d = res?.data || {};
const text = formatCursorProbeDialogText(d);
const isOk = d.ok === true;
//
const detailItems = [];
if (d.httpStatus) detailItems.push(`HTTP状态: ${d.httpStatus}`);
if (d.endpoint) detailItems.push(`接口: ${d.endpoint}`);
if (d.probeMessage) detailItems.push(`探测方式: ${d.probeMessage}`);
if (d.bytesRead) detailItems.push(`响应大小: ${d.bytesRead} 字节`);
if (d.streamProtocol) detailItems.push(`协议: ${d.streamProtocol}`);
// detail
if (d.detail) {
const matchPrefix = '流中匹配:';
if (d.detail.includes(matchPrefix)) {
const matchStart = d.detail.indexOf(matchPrefix);
const matchEnd = d.detail.indexOf('', matchStart);
const matchText = matchEnd > 0 ? d.detail.substring(matchStart, matchEnd) : d.detail.substring(matchStart);
detailItems.push(`检测结论: ${matchText}`);
} else {
detailItems.push(`检测结论: ${d.detail}`);
}
}
try {
await ElMessageBox({
title: '检测结果',
message: h('div', { class: 'cursor-probe-result' }, text),
title: isOk ? '检测结果 - 可用' : '检测结果 - 不可用',
message: h('div', { class: 'cursor-probe-result cursor-expire-result' }, [
h('div', {
style: `text-align:center;font-size:18px;font-weight:700;margin-bottom:12px;color:${isOk ? '#67c23a' : '#f56c6c'}`
}, text),
detailItems.length > 0 ? h('div', {
style: 'text-align:left;font-size:13px;color:#606266;margin-bottom:8px;line-height:1.8'
}, detailItems.map(item => h('div', null, `${item}`))) : null,
d.streamNote ? h('div', {
style: 'text-align:left;font-size:12px;color:#909399;margin-top:8px;padding:8px;background:#f5f7fa;border-radius:4px;white-space:pre-wrap;line-height:1.6;'
}, d.streamNote) : null,
]),
confirmButtonText: '关闭',
customClass: 'cursor-probe-dialog',
closeOnClickModal: true,
@ -690,36 +858,61 @@ async function handleBatchProbe() {
} catch {
return;
}
loading.value = true;
let ok = 0;
let fail = 0;
let available = 0;
let unavailable = 0;
batchProbePhase.value = "running";
batchProbeProgress.total = rows.length;
batchProbeProgress.current = 0;
batchProbeProgress.currentId = null;
batchProbeProgress.percent = 0;
batchProbeDialogVisible.value = true;
await nextTick();
try {
for (const row of rows) {
for (let i = 0; i < rows.length; i += 1) {
const row = rows[i];
batchProbeProgress.current = i + 1;
batchProbeProgress.currentId = row.id;
batchProbeProgress.percent = Math.round((i / rows.length) * 100);
await nextTick();
try {
const res = await probeAccountPoolToken(moduleKey, {
id: row.id,
accessToken: row.token,
});
if (res?.code === 200) {
ok += 1;
if (res?.code === 200 && res?.data?.ok === true) {
available += 1;
} else {
fail += 1;
unavailable += 1;
}
} catch {
fail += 1;
unavailable += 1;
}
batchProbeProgress.percent = Math.round(((i + 1) / rows.length) * 100);
await nextTick();
}
if (fail > 0) {
ElMessage.warning(`批量检测完成:成功 ${ok} 条,失败 ${fail}`);
} else {
ElMessage.success(`批量检测完成:共 ${ok}`);
}
batchProbeSummary.total = rows.length;
batchProbeSummary.available = available;
batchProbeSummary.unavailable = unavailable;
batchProbeSummary.skipped = skipped;
batchProbePhase.value = "done";
await fetchList();
} finally {
loading.value = false;
} catch {
batchProbeDialogVisible.value = false;
ElMessage.error("批量检测异常");
}
}
function closeBatchProbeDialog() {
batchProbeDialogVisible.value = false;
batchProbePhase.value = "running";
}
// async function handleBatchProbeExpireTime() {
// if (!selectedRows.value.length) {
// ElMessage.warning("");
@ -785,10 +978,22 @@ async function handleBatchProbe() {
<div class="toolbar">
<div class="toolbar-left">
<el-input
v-model="query.keyword"
placeholder="搜索账号 / token / 备注"
v-model="query.account"
placeholder="搜索账号"
clearable
class="w-260"
class="w-180"
/>
<el-input
v-model="query.token"
placeholder="搜索 Token"
clearable
class="w-180"
/>
<el-input
v-model="query.remark"
placeholder="搜索备注"
clearable
class="w-180"
/>
<el-select
v-model="query.status"
@ -798,6 +1003,21 @@ async function handleBatchProbe() {
>
<el-option label="未提取" value="unused" />
<el-option label="已提取" value="extracted" />
<el-option label="补号" value="replenished" />
<el-option label="续杯" value="renewed" />
</el-select>
<el-select
v-model="query.platform"
placeholder="提取平台"
clearable
class="w-140"
>
<el-option
v-for="(v, k) in PLATFORM_MAP"
:key="k"
:value="k"
:label="v.label"
/>
</el-select>
<el-select
v-model="query.usable"
@ -811,7 +1031,7 @@ async function handleBatchProbe() {
<el-button
type="primary"
plain
title="按当前搜索与账号类型,筛选未提取并跳到最后一页"
title="按当前搜索条件与账号类型,筛选未提取并跳到最后一页"
@click="jumpToLastUnusedPage"
>
未提取末页
@ -822,7 +1042,7 @@ async function handleBatchProbe() {
<el-button type="primary" @click="openAddDialog('single')">添加账号</el-button>
<el-button type="success" @click="openAddDialog('batch')">批量添加</el-button>
<el-button @click="replenishVisible = true">补号</el-button>
<el-button @click="markExtractForSelected">批量标记提取</el-button>
<el-button @click="markExtractForSelected">批量提取</el-button>
<el-button plain @click="handleBatchProbe">批量检测</el-button>
<!-- <el-button type="info" plain @click="handleBatchProbeExpireTime">批量时间检测</el-button> -->
<el-button @click="apiDocVisible = true">接口说明</el-button>
@ -855,8 +1075,8 @@ async function handleBatchProbe() {
<el-tag>{{ typeText(row.type) }}</el-tag>
</template>
</el-table-column>
<!-- <el-table-column prop="account" label="账号" min-width="180" show-overflow-tooltip :tooltip-options="tooltipOpts" />
<el-table-column prop="password" label="密码" min-width="160" show-overflow-tooltip :tooltip-options="tooltipOpts">
<el-table-column prop="account" label="账号" min-width="180" show-overflow-tooltip :tooltip-options="tooltipOpts" />
<!-- <el-table-column prop="password" label="密码" min-width="160" show-overflow-tooltip :tooltip-options="tooltipOpts">
<template #default="{ row }">{{ row.password || '-' }}</template>
</el-table-column>
<el-table-column label="Token" min-width="200" show-overflow-tooltip :tooltip-options="tooltipOpts">
@ -876,13 +1096,13 @@ async function handleBatchProbe() {
</el-tag>
</template>
</el-table-column>
<el-table-column label="accessToken失效时间" width="190" align="center">
<!-- <el-table-column label="accessToken失效时间" width="190" align="center">
<template #default="{ row }">
<el-tag :type="accessTokenExpireTagType(row.accessTokenExpireStatus)" size="small">
{{ row.accessTokenExpireText || "-" }}
</el-tag>
</template>
</el-table-column>
</el-table-column> -->
<el-table-column label="提取平台" width="120">
<template #default="{ row }">
<el-tag
@ -934,7 +1154,7 @@ async function handleBatchProbe() {
v-model:current-page="pagination.page"
v-model:page-size="pagination.pageSize"
background
:layout="isMobile ? 'prev, pager, next' : 'total, prev, pager, next, jumper'"
layout="total, sizes, prev, pager, next, jumper"
:page-sizes="[20, 50, 100]"
:total="total"
/>
@ -948,6 +1168,7 @@ async function handleBatchProbe() {
:row="detailRow"
:save-loading="detailRemarkSaving"
@save-remark="handleSaveRemark"
@detail-action="handleDetailAction"
/>
<ExtractDialog
@ -977,6 +1198,99 @@ async function handleBatchProbe() {
@confirm="handleReplenish"
/>
<el-dialog
v-model="batchExtractVisible"
class="pool-batch-extract-dialog"
title="批量提取"
width="90%"
destroy-on-close
>
<el-alert type="info" :closable="false" style="margin-bottom: 12px">
将对已选的 <strong>{{ selectedRows.length }}</strong> 条记录执行提取并标记为已提取
</el-alert>
<el-form label-width="84px">
<el-form-item label="提取平台">
<el-select v-model="batchExtractForm.platform" style="width: 100%">
<el-option
v-for="(v, k) in PLATFORM_MAP"
:key="k"
:value="k"
:label="v.label"
/>
</el-select>
</el-form-item>
<el-form-item label="备注">
<el-input
v-model="batchExtractForm.remark"
type="textarea"
:rows="3"
placeholder="提取备注(可选)"
/>
</el-form-item>
</el-form>
<template #footer>
<el-button @click="batchExtractVisible = false">取消</el-button>
<el-button type="primary" :loading="loading" @click="handleBatchExtract">
确认提取
</el-button>
</template>
</el-dialog>
<el-dialog
v-model="batchProbeDialogVisible"
:title="batchProbePhase === 'running' ? '批量检测中' : '批量检测结果'"
width="440px"
align-center
:close-on-click-modal="false"
:close-on-press-escape="false"
:show-close="batchProbePhase === 'done'"
@close="closeBatchProbeDialog"
>
<div v-if="batchProbePhase === 'running'" class="batch-probe-progress">
<div class="batch-probe-icon">
<el-icon class="is-loading" :size="36" color="#409eff">
<Loading />
</el-icon>
</div>
<el-progress
:percentage="batchProbeProgress.percent"
:stroke-width="14"
striped
striped-flow
:duration="8"
/>
<div class="batch-probe-status">
正在检测第 {{ batchProbeProgress.current }} / {{ batchProbeProgress.total }}
</div>
<div v-if="batchProbeProgress.currentId" class="batch-probe-id">
当前 ID{{ batchProbeProgress.currentId }}
</div>
</div>
<div v-else class="batch-probe-summary">
<div class="batch-probe-summary-title">检测完成</div>
<div class="batch-probe-summary-grid">
<div class="summary-item">
<span class="summary-label">共检测</span>
<span class="summary-value">{{ batchProbeSummary.total }} </span>
</div>
<div class="summary-item available">
<span class="summary-label">可用</span>
<span class="summary-value">{{ batchProbeSummary.available }} </span>
</div>
<div class="summary-item unavailable">
<span class="summary-label">失效</span>
<span class="summary-value">{{ batchProbeSummary.unavailable }} </span>
</div>
</div>
<div v-if="batchProbeSummary.skipped > 0" class="batch-probe-skipped">
已跳过无 Token {{ batchProbeSummary.skipped }}
</div>
</div>
<template v-if="batchProbePhase === 'done'" #footer>
<el-button type="primary" @click="closeBatchProbeDialog">关闭</el-button>
</template>
</el-dialog>
<!-- 接口说明抽屉 -->
<el-drawer
v-model="apiDocVisible"
@ -1129,6 +1443,10 @@ async function handleBatchProbe() {
min-width: 980px;
}
:deep(.pool-batch-extract-dialog) {
max-width: 600px;
}
@media (max-width: 768px) {
.account-pool-page {
padding: 8px;
@ -1164,6 +1482,36 @@ async function handleBatchProbe() {
justify-content: center;
}
.pager :deep(.el-pagination) {
flex-wrap: wrap;
justify-content: center;
row-gap: 8px;
}
:deep(.pool-batch-extract-dialog) {
width: calc(100vw - 24px) !important;
margin: 0 auto;
}
:deep(.pool-batch-extract-dialog .el-dialog__body) {
padding: 12px;
}
:deep(.pool-batch-extract-dialog .el-form-item__label) {
width: 74px !important;
}
:deep(.pool-batch-extract-dialog .el-dialog__footer .el-button) {
width: calc(50% - 6px);
margin: 0;
}
:deep(.pool-batch-extract-dialog .el-dialog__footer) {
display: flex;
gap: 12px;
padding: 8px 12px 12px;
}
}
/* 接口说明抽屉 */
@ -1267,6 +1615,88 @@ async function handleBatchProbe() {
font-size: 12px;
color: #409eff;
}
.batch-probe-progress {
padding: 8px 4px 4px;
text-align: center;
}
.batch-probe-icon {
margin-bottom: 18px;
}
.batch-probe-status {
margin-top: 16px;
font-size: 15px;
font-weight: 600;
color: #303133;
}
.batch-probe-id {
margin-top: 8px;
font-size: 13px;
color: #909399;
}
.batch-probe-summary {
padding: 8px 4px 4px;
text-align: center;
}
.batch-probe-summary-title {
font-size: 18px;
font-weight: 700;
color: #303133;
margin-bottom: 18px;
}
.batch-probe-summary-grid {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 12px;
}
.summary-item {
padding: 14px 10px;
border-radius: 12px;
background: #f5f7fa;
}
.summary-item.available {
background: #f0f9eb;
}
.summary-item.unavailable {
background: #fef0f0;
}
.summary-label {
display: block;
font-size: 12px;
color: #909399;
margin-bottom: 6px;
}
.summary-value {
display: block;
font-size: 20px;
font-weight: 700;
color: #303133;
}
.summary-item.available .summary-value {
color: #67c23a;
}
.summary-item.unavailable .summary-value {
color: #f56c6c;
}
.batch-probe-skipped {
margin-top: 14px;
font-size: 12px;
color: #909399;
}
</style>
<style>
@ -1282,6 +1712,7 @@ async function handleBatchProbe() {
/* Cursor 探测结果弹窗teleport 到 body需非 scoped */
.cursor-probe-dialog .el-message-box__message {
padding: 12px 8px 4px;
width: 100%;
}
.cursor-probe-dialog .cursor-probe-result {
margin: 0;

View File

@ -1,76 +1,159 @@
<script setup>
import { computed, ref, watch } from 'vue';
import { ElMessage } from 'element-plus';
import { computed, reactive, ref, watch } from "vue";
import { ElMessage } from "element-plus";
const props = defineProps({
modelValue: { type: Boolean, default: false },
row: { type: Object, default: null },
saveLoading: { type: Boolean, default: false },
modelValue: {
type: Boolean,
default: false,
},
row: {
type: Object,
default: null,
},
saveLoading: {
type: Boolean,
default: false,
},
});
const emit = defineEmits(['update:modelValue', 'save-remark']);
const remarkText = ref('');
const emit = defineEmits(["update:modelValue", "save-remark", "detail-action"]);
const remarkText = ref("");
const remarkDialogVisible = ref(false);
const platformDialogVisible = ref(false);
const unavailableDialogVisible = ref(false);
const unextractDialogVisible = ref(false);
const platformForm = reactive({ platform: "local" });
function typeText(type) {
if (type === 'account') return '账号密码';
if (type === 'account_tk') return '账号密码+Token';
return 'Token';
}
const PLATFORM_MAP = {
local: { label: '本地', type: 'info' },
xianyu: { label: '闲鱼', type: 'warning' },
taobao: { label: '淘宝', type: 'info' },
pinduoduo: { label: '拼多多', type: 'danger' },
jingdong: { label: '京东', type: 'primary' },
douyin: { label: '抖音', type: 'success' },
ziyoushangcheng: { label: '自有商城', type: 'warning' },
const TYPE_MAP = {
account: { label: "账号密码", type: "success" },
account_tk: { label: "账号密码+Token", type: "primary" },
tk: { label: "Token", type: "warning" },
};
const platformLabel = computed(() => {
if (!props.row?.extractedPlatform) return '-';
return PLATFORM_MAP[props.row.extractedPlatform]?.label || props.row.extractedPlatform;
const PLATFORM_MAP = {
local: { label: "本地", type: "info" },
xianyu: { label: "闲鱼", type: "warning" },
taobao: { label: "淘宝", type: "info" },
pinduoduo: { label: "拼多多", type: "danger" },
jingdong: { label: "京东", type: "primary" },
douyin: { label: "抖音", type: "success" },
ziyoushangcheng: { label: "自有商城", type: "warning" },
};
const statusInfo = computed(() => {
const status = Number(props.row?.extractStatus || 0);
if (status === 2) return { label: "补号", type: "warning" };
if (status === 3) return { label: "续杯", type: "primary" };
if (props.row?.extracted) return { label: "已提取", type: "success" };
return { label: "未提取", type: "info" };
});
const platformType = computed(() => {
if (!props.row?.extractedPlatform) return 'info';
return PLATFORM_MAP[props.row.extractedPlatform]?.type || 'info';
const typeInfo = computed(() => {
return (
TYPE_MAP[props.row?.type] || { label: props.row?.type || "-", type: "info" }
);
});
const platformInfo = computed(() => {
const key = props.row?.extractedPlatform;
if (!key) return { label: "-", type: "info" };
return PLATFORM_MAP[key] || { label: key, type: "info" };
});
const isUsedInfo = computed(() => {
const raw = props.row?.isUsed;
if (raw === null || raw === undefined || raw === "") {
return { label: "未探测", type: "info" };
}
const n = Number(raw);
if (n === 1) return { label: "可用", type: "success" };
if (n === 0) return { label: "已用完", type: "danger" };
return { label: String(raw), type: "info" };
});
const hasAccountPassword = computed(
() => !!(props.row?.account || props.row?.password),
);
const hasToken = computed(() => !!props.row?.token);
watch(
() => props.row,
(row) => {
remarkText.value = row?.remark || '';
remarkText.value = row?.remark || "";
platformForm.platform = row?.extractedPlatform || "local";
},
{ immediate: true }
{ immediate: true },
);
function closeDialog() {
emit("update:modelValue", false);
}
function openRemarkDialog() {
remarkText.value = props.row?.remark || "";
remarkDialogVisible.value = true;
}
function onSaveRemark() {
if (!props.row?.id) return;
emit('save-remark', { id: props.row.id, remark: remarkText.value || '' });
emit("save-remark", { id: props.row.id, remark: remarkText.value || "" });
remarkDialogVisible.value = false;
}
function onSetUnavailable() {
if (!props.row?.id) return;
emit("detail-action", { action: "unavailable", id: props.row.id });
unavailableDialogVisible.value = false;
}
function onUpdatePlatform() {
if (!props.row?.id) return;
emit("detail-action", {
action: "platform",
id: props.row.id,
platform: platformForm.platform,
});
platformDialogVisible.value = false;
}
function onUnextract() {
if (!props.row?.id) return;
emit("detail-action", { action: "unextract", id: props.row.id });
unextractDialogVisible.value = false;
}
async function copyText(text, successText) {
const val = String(text || "").trim();
if (!val) {
ElMessage.warning("暂无可复制内容");
return;
}
try {
await navigator.clipboard.writeText(val);
ElMessage.success(successText || "已复制");
} catch {
ElMessage.error("复制失败,请检查浏览器权限");
}
}
function copyAccountPassword() {
const account = props.row?.account || '';
const password = props.row?.password || '';
if (!account && !password) {
ElMessage.warning('暂无账号密码可复制');
return;
}
navigator.clipboard.writeText(`${account}\n${password}`.trim()).then(() => {
ElMessage.success('已复制账号+密码');
});
const parts = [];
if (props.row?.account) parts.push(props.row.account);
if (props.row?.password) parts.push(props.row.password);
copyText(parts.join("\n"), "已复制账号+密码");
}
function copyToken() {
const token = props.row?.token || '';
if (!token) {
ElMessage.warning('暂无 Token 可复制');
return;
}
navigator.clipboard.writeText(token).then(() => {
ElMessage.success('已复制 Token');
});
copyText(props.row?.token, "已复制 Token");
}
function copyAll() {
const parts = [];
if (props.row?.account) parts.push(`账号:${props.row.account}`);
if (props.row?.password) parts.push(`密码:${props.row.password}`);
if (props.row?.token) parts.push(`Token${props.row.token}`);
copyText(parts.join("\n"), "已复制完整账号信息");
}
</script>
@ -78,69 +161,406 @@ function copyToken() {
<el-dialog
class="pool-detail-dialog"
:model-value="modelValue"
title="账号详情"
width="90%"
width="760px"
destroy-on-close
:show-close="false"
@update:model-value="(v) => emit('update:modelValue', v)"
>
<el-descriptions :column="1" border v-if="row">
<el-descriptions-item label="ID">{{ row.id }}</el-descriptions-item>
<el-descriptions-item label="账号类型">{{ typeText(row.type) }}</el-descriptions-item>
<el-descriptions-item label="账号">{{ row.account || '-' }}</el-descriptions-item>
<el-descriptions-item label="密码">{{ row.password || '-' }}</el-descriptions-item>
<el-descriptions-item label="Token">
<span class="token-text">{{ row.token || '-' }}</span>
</el-descriptions-item>
<el-descriptions-item label="提取状态">{{
row.extractStatus === 2 ? '补号' : row.extracted ? '已提取' : '未提取'
}}</el-descriptions-item>
<el-descriptions-item label="提取时间">{{ row.extractedAt || '-' }}</el-descriptions-item>
<el-descriptions-item label="提取平台">
<el-tag v-if="row.extractedPlatform" :type="platformType" size="small">{{ platformLabel }}</el-tag>
<span v-else>-</span>
</el-descriptions-item>
<el-descriptions-item label="复制">
<div class="copy-actions">
<el-button size="small" @click="copyAccountPassword">账号+密码</el-button>
<el-button size="small" type="primary" @click="copyToken">Token</el-button>
<template #header>
<div class="detail-header">
<div>
<div class="detail-title">账号详情</div>
<div class="detail-subtitle">
通过弹窗执行账号状态平台备注等维护操作
</div>
</div>
</el-descriptions-item>
<el-descriptions-item label="备注">
<div class="remark-edit-wrap">
<el-input v-model="remarkText" type="textarea" :rows="3" placeholder="请输入备注" />
<el-button type="primary" size="small" :loading="saveLoading" @click="onSaveRemark">
保存备注
<div class="header-actions">
<el-button circle plain @click="closeDialog">×</el-button>
</div>
</div>
</template>
<div v-if="row" class="detail-body">
<div class="info-grid">
<div class="info-card">
<div class="info-label">ID</div>
<div class="info-value">{{ row?.id || "-" }}</div>
</div>
<div class="info-card">
<div class="info-label">账号类型</div>
<div class="info-value">
<el-tag :type="typeInfo.type" round>{{ typeInfo.label }}</el-tag>
</div>
</div>
<div class="info-card">
<div class="info-label">提取状态</div>
<div class="info-value">
<el-tag :type="statusInfo.type" effect="dark" round>
{{ statusInfo.label }}
</el-tag>
</div>
</div>
<div class="info-card">
<div class="info-label">提取平台</div>
<div class="info-value">
<el-tag
v-if="row.extractedPlatform"
:type="platformInfo.type"
size="small"
>
{{ platformInfo.label }}
</el-tag>
<span v-else>-</span>
</div>
</div>
<div class="info-card">
<div class="info-label">提取时间</div>
<div class="info-value">{{ row.extractedAt || "-" }}</div>
</div>
<div class="info-card">
<div class="info-label">可用检测</div>
<div class="info-value">
<el-tag :type="isUsedInfo.type" round>
{{ isUsedInfo.label }}
</el-tag>
</div>
</div>
<div class="info-card">
<div class="info-label">账号</div>
<div class="info-value">{{ row.account || "-" }}</div>
</div>
<div class="info-card">
<div class="info-label">密码</div>
<div class="info-value">{{ row.password || "-" }}</div>
</div>
</div>
<div class="section-card">
<div class="section-head">
<div>
<div class="section-title">Token</div>
<div class="section-subtitle">
Token 已做自动换行便于检查与复制
</div>
</div>
<el-button
size="small"
type="primary"
plain
:disabled="!hasToken"
@click="copyToken"
>
复制 Token
</el-button>
</div>
</el-descriptions-item>
</el-descriptions>
<pre class="token-box">{{ row.token || "暂无 Token" }}</pre>
</div>
<div class="section-card">
<div class="section-head">
<div>
<div class="section-title">快捷功能</div>
<div class="section-subtitle">按使用场景复制账号信息</div>
</div>
</div>
<div class="copy-actions">
<el-button
:disabled="!hasAccountPassword"
@click="copyAccountPassword"
>
复制账号+密码
</el-button>
<el-button
type="primary"
plain
:disabled="!hasToken"
@click="copyToken"
>
复制 Token
</el-button>
<el-button
type="success"
plain
:disabled="!hasAccountPassword && !hasToken"
@click="copyAll"
>
复制全部
</el-button>
</div>
</div>
<div class="section-card">
<div class="section-head">
<div>
<div class="section-title">维护操作</div>
<div class="section-subtitle">
点击按钮后打开确认/编辑弹窗再执行对应操作
</div>
</div>
</div>
<div class="copy-actions">
<el-button
type="danger"
plain
@click="unavailableDialogVisible = true"
>
改不可用
</el-button>
<el-button
type="warning"
plain
@click="platformDialogVisible = true"
>
改平台
</el-button>
<el-button type="info" plain @click="unextractDialogVisible = true">
反提取
</el-button>
<el-button type="primary" plain @click="openRemarkDialog">
改备注
</el-button>
</div>
</div>
<div class="section-card">
<div class="section-head">
<div>
<div class="section-title">备注</div>
<div class="section-subtitle">备注改为弹窗编辑当前仅展示</div>
</div>
</div>
<div class="remark-display">{{ row.remark || "暂无备注" }}</div>
</div>
</div>
</el-dialog>
<el-dialog
v-model="unavailableDialogVisible"
title="改不可用"
width="420px"
append-to-body
>
<el-alert type="warning" :closable="false">
确认将当前账号标记为不可用/已用完
</el-alert>
<template #footer>
<el-button @click="unavailableDialogVisible = false">取消</el-button>
<el-button type="danger" :loading="saveLoading" @click="onSetUnavailable">
确认改不可用
</el-button>
</template>
</el-dialog>
<el-dialog
v-model="platformDialogVisible"
title="改平台"
width="420px"
append-to-body
>
<el-form label-width="84px">
<el-form-item label="提取平台">
<el-select v-model="platformForm.platform" style="width: 100%">
<el-option
v-for="(v, k) in PLATFORM_MAP"
:key="k"
:label="v.label"
:value="k"
/>
</el-select>
</el-form-item>
</el-form>
<template #footer>
<el-button @click="platformDialogVisible = false">取消</el-button>
<el-button type="primary" :loading="saveLoading" @click="onUpdatePlatform">
确认修改
</el-button>
</template>
</el-dialog>
<el-dialog
v-model="unextractDialogVisible"
title="反提取"
width="420px"
append-to-body
>
<el-alert type="warning" :closable="false">
反提取会把账号恢复为未提取并清空提取时间与提取平台
</el-alert>
<template #footer>
<el-button @click="unextractDialogVisible = false">取消</el-button>
<el-button type="warning" :loading="saveLoading" @click="onUnextract">
确认反提取
</el-button>
</template>
</el-dialog>
<el-dialog
v-model="remarkDialogVisible"
title="改备注"
width="520px"
append-to-body
>
<el-input
v-model="remarkText"
type="textarea"
:rows="5"
resize="none"
placeholder="请输入备注"
/>
<template #footer>
<el-button @click="remarkDialogVisible = false">取消</el-button>
<el-button type="primary" :loading="saveLoading" @click="onSaveRemark">
保存备注
</el-button>
</template>
</el-dialog>
</template>
<style scoped>
.token-text {
word-break: break-all;
white-space: pre-wrap;
line-height: 1.6;
:deep(.pool-detail-dialog) {
max-width: calc(100vw - 28px);
border-radius: 18px;
overflow: hidden;
}
.remark-edit-wrap {
:deep(.pool-detail-dialog .el-dialog__header) {
padding: 18px 22px;
margin: 0;
border-bottom: 1px solid #eef0f5;
}
:deep(.pool-detail-dialog .el-dialog__body) {
padding: 18px 22px 22px;
background: #f6f8fb;
}
:deep(.el-tag) {
border-radius: 4px !important;
}
.detail-header,
.header-actions,
.section-head,
.copy-actions {
display: flex;
align-items: center;
}
.detail-header {
justify-content: space-between;
gap: 14px;
}
.detail-title {
font-size: 18px;
font-weight: 700;
color: #1f2937;
}
.detail-subtitle,
.section-subtitle {
margin-top: 4px;
font-size: 12px;
color: #909399;
}
.header-actions {
gap: 10px;
}
.header-actions .el-button {
font-size: 18px;
font-weight: 300;
}
.detail-body {
display: flex;
flex-direction: column;
gap: 8px;
gap: 14px;
}
.section-card,
.info-card {
background: #fff;
border: 1px solid #edf0f6;
box-shadow: 0 10px 28px rgba(31, 41, 55, 0.06);
}
.info-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 12px;
}
.info-card {
border-radius: 14px;
padding: 14px;
min-width: 0;
}
.info-label {
color: #909399;
font-size: 12px;
margin-bottom: 8px;
}
.info-value {
color: #303133;
font-size: 14px;
font-weight: 600;
word-break: break-all;
min-height: 20px;
}
.section-card {
border-radius: 16px;
padding: 16px;
}
.section-head {
justify-content: space-between;
gap: 12px;
margin-bottom: 12px;
}
.section-title {
font-size: 15px;
font-weight: 700;
color: #303133;
}
.token-box {
margin: 0;
padding: 14px;
max-height: 220px;
overflow: auto;
border-radius: 12px;
background: #111827;
color: #d1e7ff;
font-size: 12px;
line-height: 1.7;
white-space: pre-wrap;
word-break: break-all;
}
.copy-actions {
display: flex;
flex-wrap: wrap;
gap: 8px;
gap: 10px;
}
.remark-edit-wrap .el-button {
align-self: flex-start;
.copy-actions .el-button {
margin: 0;
}
:deep(.pool-detail-dialog) {
max-width: 560px;
.remark-display {
padding: 12px;
min-height: 42px;
border-radius: 10px;
background: #f8fafc;
color: #303133;
line-height: 1.6;
white-space: pre-wrap;
word-break: break-all;
}
@media (max-width: 768px) {
@ -149,21 +569,32 @@ function copyToken() {
margin: 0 auto;
}
:deep(.pool-detail-dialog .el-dialog__header) {
padding: 14px 14px;
}
:deep(.pool-detail-dialog .el-dialog__body) {
padding: 12px;
max-height: 70vh;
max-height: 76vh;
overflow-y: auto;
}
:deep(.pool-detail-dialog .el-descriptions__label) {
width: 72px;
word-break: break-all;
white-space: normal;
.detail-header,
.section-head {
align-items: flex-start;
}
.remark-edit-wrap .el-button {
.section-head {
flex-direction: column;
}
.info-grid {
grid-template-columns: 1fr;
}
.copy-actions .el-button,
.section-head .el-button {
width: 100%;
align-self: stretch;
}
}
</style>

View File

@ -1,5 +1,6 @@
<script setup>
import { computed, reactive, watch } from 'vue';
import { ElMessage } from 'element-plus';
const props = defineProps({
modelValue: {
@ -90,8 +91,8 @@ function parseBatchRows() {
const [account, password, token] = line
.split(',')
.map((x) => (x || '').trim());
if (!account || !password || !token) {
errors.push(`${index + 1} 行格式错误,应为 account,password,token`);
if (!account || !token) {
errors.push(`${index + 1} 行格式错误,应为 account,password,tokenpassword 可为空)`);
return;
}
parsed.push({
@ -139,7 +140,8 @@ function handleSubmit() {
}
if (form.type === 'account_tk') {
if (!form.account || !form.password || !form.token) {
if (!form.account || !form.token) {
ElMessage.warning('请输入账号和 Token密码可为空');
return;
}
emit('submit', {
@ -177,6 +179,7 @@ function handleSubmit() {
const { parsed, errors } = parseBatchRows();
if (errors.length || parsed.length === 0) {
ElMessage.warning(errors[0] || '请填写批量内容');
return;
}
emit('submit', {

View File

@ -1,11 +1,19 @@
<script setup>
import { computed, nextTick, onMounted, onUnmounted, reactive, ref, watch } from 'vue';
import { ElMessage } from 'element-plus';
import Edit from './components/edit.vue';
import DetailDialog from './components/detail.vue';
import ExtractDialog from './components/extract.vue';
import ReplenishDialog from './components/replenish.vue';
import PatchDialog from '../components/patch.vue';
import {
computed,
nextTick,
onMounted,
onUnmounted,
reactive,
ref,
watch,
} from "vue";
import { ElMessage } from "element-plus";
import Edit from "./components/edit.vue";
import DetailDialog from "./components/detail.vue";
import ExtractDialog from "./components/extract.vue";
import ReplenishDialog from "./components/replenish.vue";
import PatchDialog from "../components/patch.vue";
import {
addAccountPool,
batchAddAccountPool,
@ -13,9 +21,12 @@ import {
getAccountPoolDetail,
getAccountPoolList,
updateAccountPoolRemark,
setAccountPoolUnavailable,
updateAccountPoolPlatform,
unextractAccountPool,
replenishAccountPool,
probeAccountPoolToken,
} from '@/api/accountPool';
} from "@/api/accountPool";
const moduleKey = "krio";
@ -26,16 +37,21 @@ const detailVisible = ref(false);
const extractVisible = ref(false);
const extractTargetRow = ref(null);
const batchExtractVisible = ref(false);
const batchExtractForm = reactive({ platform: 'local', remark: '' });
const batchExtractForm = reactive({ platform: "local", remark: "" });
const replenishVisible = ref(false);
const replenishForm = reactive({ type: 'tk', platform: 'local', remark: '' });
const replenishForm = reactive({ type: "tk", platform: "local", remark: "" });
const apiDocVisible = ref(false);
const patchVisible = ref(false);
const query = reactive({ keyword: "", status: "" });
const query = reactive({ keyword: "", status: "", platform: "" });
const activeTypeTab = ref("all");
const extractForm = reactive({ platform: 'local', type: 'account', remark: '', replenish: false });
const extractForm = reactive({
platform: "local",
type: "account",
remark: "",
replenish: false,
});
const tableData = ref([]);
const total = ref(0);
@ -53,6 +69,7 @@ const pagedList = computed(() => tableData.value);
function resetQuery() {
query.keyword = "";
query.status = "";
query.platform = "";
}
const typeTabs = computed(() => [
@ -63,7 +80,7 @@ const typeTabs = computed(() => [
]);
watch(
() => [query.keyword, query.status, activeTypeTab.value],
() => [query.keyword, query.status, query.platform, activeTypeTab.value],
() => {
if (skipWatchFetchDuringUnusedJump.value) return;
pagination.page = 1;
@ -129,7 +146,7 @@ function openExtractByRow(row) {
extractTargetRow.value = row;
extractForm.platform = "local";
extractForm.type = row.type;
extractForm.remark = row.remark || '';
extractForm.remark = row.remark || "";
extractForm.replenish = false;
extractVisible.value = true;
}
@ -143,17 +160,20 @@ function buildCopyTextByRow(row) {
if (row?.account) parts.push(row.account);
if (row?.password) parts.push(row.password);
if (row?.token) parts.push(row.token);
return parts.join('\n');
return parts.join("\n");
}
async function copyToClipboard(text) {
if (!text) { ElMessage.warning('无可复制内容'); return false; }
if (!text) {
ElMessage.warning("无可复制内容");
return false;
}
try {
await navigator.clipboard.writeText(text);
ElMessage.success('已复制');
ElMessage.success("已复制");
return true;
} catch (e) {
ElMessage.error('复制失败,请检查浏览器权限');
ElMessage.error("复制失败,请检查浏览器权限");
return false;
}
}
@ -162,15 +182,21 @@ async function handleExtract() {
loading.value = true;
try {
const target = extractTargetRow.value;
if (!target) { ElMessage.warning("未找到提取目标"); return; }
if (!target) {
ElMessage.warning("未找到提取目标");
return;
}
const res = await extractAccountPool(moduleKey, {
id: target.id,
type: target.type,
platform: extractForm.platform,
remark: extractForm.remark || '',
remark: extractForm.remark || "",
replenish: !!extractForm.replenish,
});
if (res?.code !== 200) { ElMessage.error(res?.msg || "提取失败"); return; }
if (res?.code !== 200) {
ElMessage.error(res?.msg || "提取失败");
return;
}
ElMessage.success("提取成功");
extractVisible.value = false;
const row = normalizeRow(res.data || {});
@ -186,19 +212,62 @@ async function handleSaveRemark(payload) {
detailRemarkSaving.value = true;
try {
const res = await updateAccountPoolRemark(moduleKey, payload);
if (res?.code !== 200) { ElMessage.error(res?.msg || '备注更新失败'); return; }
ElMessage.success('备注已更新');
if (res?.code !== 200) {
ElMessage.error(res?.msg || "备注更新失败");
return;
}
ElMessage.success("备注已更新");
if (detailRow.value?.id === payload.id) {
detailRow.value = { ...detailRow.value, remark: payload.remark || '' };
detailRow.value = { ...detailRow.value, remark: payload.remark || "" };
}
await fetchList();
} finally { detailRemarkSaving.value = false; }
} finally {
detailRemarkSaving.value = false;
}
}
async function refreshDetailRow(id) {
if (!id) return;
const res = await getAccountPoolDetail(moduleKey, id);
if (res?.code === 200) {
detailRow.value = normalizeRow(res.data || {});
}
}
async function handleDetailAction(payload) {
if (!payload?.id || !payload?.action) return;
detailRemarkSaving.value = true;
try {
let res;
if (payload.action === "unavailable") {
res = await setAccountPoolUnavailable(moduleKey, { id: payload.id });
} else if (payload.action === "platform") {
res = await updateAccountPoolPlatform(moduleKey, {
id: payload.id,
platform: payload.platform,
});
} else if (payload.action === "unextract") {
res = await unextractAccountPool(moduleKey, { id: payload.id });
}
if (res?.code !== 200) {
ElMessage.error(res?.msg || "操作失败");
return;
}
ElMessage.success("操作成功");
await refreshDetailRow(payload.id);
await fetchList();
} finally {
detailRemarkSaving.value = false;
}
}
function markExtractForSelected() {
if (!selectedRows.value.length) { ElMessage.warning("请先选择数据"); return; }
batchExtractForm.platform = 'local';
batchExtractForm.remark = '';
if (!selectedRows.value.length) {
ElMessage.warning("请先选择数据");
return;
}
batchExtractForm.platform = "local";
batchExtractForm.remark = "";
batchExtractVisible.value = true;
}
@ -208,13 +277,16 @@ async function handleBatchExtract() {
const results = await Promise.all(
selectedRows.value.map((row) =>
extractAccountPool(moduleKey, {
id: row.id, type: row.type,
id: row.id,
type: row.type,
platform: batchExtractForm.platform,
remark: batchExtractForm.remark || '',
remark: batchExtractForm.remark || "",
}),
),
);
const succeeded = results.filter((r) => r?.code === 200).map((r) => normalizeRow(r.data || {}));
const succeeded = results
.filter((r) => r?.code === 200)
.map((r) => normalizeRow(r.data || {}));
const failCount = results.length - succeeded.length;
if (failCount > 0) {
ElMessage.warning(`${succeeded.length} 条成功,${failCount} 条失败`);
@ -223,7 +295,7 @@ async function handleBatchExtract() {
}
batchExtractVisible.value = false;
if (succeeded.length) {
const text = succeeded.map(rowToText).filter(Boolean).join('\n');
const text = succeeded.map(rowToText).filter(Boolean).join("\n");
navigator.clipboard.writeText(text).catch(() => {});
}
fetchList();
@ -237,7 +309,7 @@ function rowToText(row) {
if (row.account) parts.push(row.account);
if (row.password) parts.push(row.password);
if (row.token) parts.push(row.token);
return parts.join(' / ');
return parts.join(" / ");
}
async function handleReplenish() {
@ -246,10 +318,13 @@ async function handleReplenish() {
const res = await replenishAccountPool(moduleKey, {
type: replenishForm.type,
platform: replenishForm.platform,
remark: replenishForm.remark || '',
remark: replenishForm.remark || "",
});
if (res?.code !== 200) { ElMessage.error(res?.msg || '补号失败'); return; }
ElMessage.success('补号成功,已复制到剪贴板');
if (res?.code !== 200) {
ElMessage.error(res?.msg || "补号失败");
return;
}
ElMessage.success("补号成功,已复制到剪贴板");
replenishVisible.value = false;
const row = normalizeRow(res.data || {});
navigator.clipboard.writeText(rowToText(row)).catch(() => {});
@ -266,16 +341,20 @@ function typeText(type) {
}
const tooltipOpts = {
popperClass: 'pool-tooltip',
popperStyle: { maxWidth: '600px', wordBreak: 'break-all', whiteSpace: 'pre-wrap' },
popperClass: "pool-tooltip",
popperStyle: {
maxWidth: "600px",
wordBreak: "break-all",
whiteSpace: "pre-wrap",
},
};
const PLATFORM_MAP = {
local: { label: '本地', type: 'info' },
xianyu: { label: '闲鱼', type: 'warning' },
pinduoduo: { label: '拼多多', type: 'danger' },
jingdong: { label: '京东', type: 'primary' },
douyin: { label: '抖音', type: 'success' },
local: { label: "本地", type: "info" },
xianyu: { label: "闲鱼", type: "warning" },
pinduoduo: { label: "拼多多", type: "danger" },
jingdong: { label: "京东", type: "primary" },
douyin: { label: "抖音", type: "success" },
};
function platformText(platform) {
@ -324,12 +403,14 @@ function normalizeRow(raw) {
function extractStatusLabel(row) {
if (row?.extractStatus === 2) return "补号";
if (row?.extractStatus === 3) return "续杯";
if (row?.extracted) return "已提取";
return "未提取";
}
function extractStatusTagType(row) {
if (row?.extractStatus === 2) return "warning";
if (row?.extractStatus === 3) return "primary";
if (row?.extracted) return "success";
return "info";
}
@ -342,6 +423,7 @@ async function fetchList() {
pageSize: pagination.pageSize,
keyword: query.keyword || undefined,
status: query.status || undefined,
platform: query.platform || undefined,
type: activeTypeTab.value === "all" ? undefined : activeTypeTab.value,
});
if (res?.code !== 200) {
@ -384,23 +466,40 @@ async function jumpToLastUnusedPage() {
ElMessage.success(`已跳转未提取第 ${lastPage} 页(共 ${cnt} 条)`);
}
onMounted(() => { fetchList(); });
onMounted(() => {
fetchList();
});
// ---- ----
const BASE_URL = "https://api.yunzer.cn";
const paramDocs = [
{ name: 'type', required: true, desc: '来源平台,用于标记本次提取来自哪个渠道', values: 'xianyu / pinduoduo / jingdong / douyin / local' },
{ name: 'module', required: true, desc: '号池模块,指定从哪个产品的号池提取', values: 'cursor / windsurf / krio' },
{ name: 'data_type', required: false, desc: '账号类型,不传则提取任意类型', values: 'account / tk / account_tk' },
{
name: "type",
required: true,
desc: "来源平台,用于标记本次提取来自哪个渠道",
values: "xianyu / pinduoduo / jingdong / douyin / local",
},
{
name: "module",
required: true,
desc: "号池模块,指定从哪个产品的号池提取",
values: "cursor / windsurf / krio",
},
{
name: "data_type",
required: false,
desc: "账号类型,不传则提取任意类型",
values: "account / tk / account_tk",
},
];
const platformDocs = [
{ value: 'xianyu', label: '闲鱼', desc: '闲鱼平台发货调用' },
{ value: 'pinduoduo', label: '拼多多', desc: '拼多多平台发货调用' },
{ value: 'jingdong', label: '京东', desc: '京东平台发货调用' },
{ value: 'douyin', label: '抖音', desc: '抖音平台发货调用' },
{ value: 'local', label: '本地', desc: '本地手动调用' },
{ value: "xianyu", label: "闲鱼", desc: "闲鱼平台发货调用" },
{ value: "pinduoduo", label: "拼多多", desc: "拼多多平台发货调用" },
{ value: "jingdong", label: "京东", desc: "京东平台发货调用" },
{ value: "douyin", label: "抖音", desc: "抖音平台发货调用" },
{ value: "local", label: "本地", desc: "本地手动调用" },
];
const moduleDocs = [
@ -444,7 +543,9 @@ const errorResp = `// 无可用卡密
{ "code": 400, "msg": "缺少参数 type来源平台" }`;
function copyText(text) {
navigator.clipboard.writeText(text).then(() => { ElMessage.success('已复制'); });
navigator.clipboard.writeText(text).then(() => {
ElMessage.success("已复制");
});
}
function copyCardInfo(row) {
@ -452,35 +553,39 @@ function copyCardInfo(row) {
if (row.account) parts.push(row.account);
if (row.password) parts.push(row.password);
if (row.token) parts.push(row.token);
if (!parts.length) { ElMessage.warning('无可复制内容'); return; }
navigator.clipboard.writeText(parts.join('\n')).then(() => { ElMessage.success('已复制'); });
if (!parts.length) {
ElMessage.warning("无可复制内容");
return;
}
navigator.clipboard.writeText(parts.join("\n")).then(() => {
ElMessage.success("已复制");
});
}
async function handleProbeToken(row) {
if (!row?.token) {
ElMessage.warning('该行无 Token');
ElMessage.warning("该行无 Token");
return;
}
probeLoadingId.value = row.id;
try {
const res = await probeAccountPoolToken(moduleKey, { id: row.id });
if (res?.code !== 200) {
ElMessage.error(res?.msg || '探测失败');
ElMessage.error(res?.msg || "探测失败");
return;
}
const d = res?.data || {};
if (d.ok) {
ElMessage.success(d.detail || '官方接口响应正常');
ElMessage.success(d.detail || "官方接口响应正常");
} else {
ElMessage.error(d.detail || '不可用或校验失败');
ElMessage.error(d.detail || "不可用或校验失败");
}
} catch {
ElMessage.error('探测请求失败');
ElMessage.error("探测请求失败");
} finally {
probeLoadingId.value = null;
}
}
</script>
<template>
@ -506,6 +611,21 @@ async function handleProbeToken(row) {
>
<el-option label="未提取" value="unused" />
<el-option label="已提取" value="extracted" />
<el-option label="补号" value="replenished" />
<el-option label="续杯" value="renewed" />
</el-select>
<el-select
v-model="query.platform"
placeholder="提取平台"
clearable
class="w-140"
>
<el-option
v-for="(v, k) in PLATFORM_MAP"
:key="k"
:value="k"
:label="v.label"
/>
</el-select>
<el-button
type="primary"
@ -518,10 +638,16 @@ async function handleProbeToken(row) {
<el-button @click="resetQuery">重置</el-button>
</div>
<div class="toolbar-right">
<el-button type="primary" @click="openAddDialog('single')">添加账号</el-button>
<el-button type="success" @click="openAddDialog('batch')">批量添加</el-button>
<el-button type="warning" @click="replenishVisible = true">补号</el-button>
<el-button @click="markExtractForSelected">批量标记提取</el-button>
<el-button type="primary" @click="openAddDialog('single')"
>添加账号</el-button
>
<el-button type="success" @click="openAddDialog('batch')"
>批量添加</el-button
>
<el-button type="warning" @click="replenishVisible = true"
>补号</el-button
>
<el-button @click="markExtractForSelected">批量提取</el-button>
<el-button @click="apiDocVisible = true">接口说明</el-button>
</div>
</div>
@ -536,69 +662,106 @@ async function handleProbeToken(row) {
</el-tabs>
<div class="table-scroll">
<el-table :data="pagedList" border stripe style="width: 100%" :loading="loading" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="52" />
<el-table-column prop="id" label="ID" width="80" />
<el-table-column label="账号类型" width="160" align="center">
<template #default="{ row }"><el-tag>{{ typeText(row.type) }}</el-tag></template>
</el-table-column>
<el-table-column prop="account" label="账号" min-width="180" show-overflow-tooltip :tooltip-options="tooltipOpts" />
<el-table-column prop="password" label="密码" min-width="160" show-overflow-tooltip :tooltip-options="tooltipOpts">
<template #default="{ row }">{{ row.password || '-' }}</template>
</el-table-column>
<el-table-column label="Token" min-width="200" show-overflow-tooltip :tooltip-options="tooltipOpts">
<template #default="{ row }">{{ row.token || '-' }}</template>
</el-table-column>
<el-table-column prop="remark" label="备注" min-width="140" show-overflow-tooltip :tooltip-options="tooltipOpts" />
<el-table-column label="提取状态" width="100">
<template #default="{ row }">
<el-tag :type="extractStatusTagType(row)">{{
extractStatusLabel(row)
}}</el-tag>
</template>
</el-table-column>
<el-table-column prop="extractedAt" label="提取时间" width="180" />
<el-table-column label="提取平台" width="110">
<template #default="{ row }">
<el-tag
v-if="row.extractedPlatform"
:type="platformTagType(row.extractedPlatform)"
size="small"
<el-table
:data="pagedList"
border
stripe
style="width: 100%"
:loading="loading"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="52" />
<el-table-column prop="id" label="ID" width="80" />
<el-table-column label="账号类型" width="160" align="center">
<template #default="{ row }"
><el-tag>{{ typeText(row.type) }}</el-tag></template
>
{{ platformText(row.extractedPlatform) }}
</el-tag>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="操作" width="300" fixed="right" align="center">
<template #default="{ row }">
<el-button link type="primary" @click="openDetail(row)"
>详情</el-button
>
<el-button
v-if="row.token"
link
type="info"
:loading="probeLoadingId === row.id"
@click="handleProbeToken(row)"
>查可用</el-button
>
<el-button
v-if="!row.extractedAt && !row.extracted"
link
type="warning"
@click="openExtractByRow(row)"
>提取</el-button
>
<el-button
v-if="row.extracted"
link
type="success"
@click="copyCardInfo(row)"
>复制</el-button
>
</template>
</el-table-column>
</el-table-column>
<el-table-column
prop="account"
label="账号"
min-width="180"
show-overflow-tooltip
:tooltip-options="tooltipOpts"
/>
<el-table-column
prop="password"
label="密码"
min-width="160"
show-overflow-tooltip
:tooltip-options="tooltipOpts"
>
<template #default="{ row }">{{ row.password || "-" }}</template>
</el-table-column>
<el-table-column
label="Token"
min-width="200"
show-overflow-tooltip
:tooltip-options="tooltipOpts"
>
<template #default="{ row }">{{ row.token || "-" }}</template>
</el-table-column>
<el-table-column
prop="remark"
label="备注"
min-width="140"
show-overflow-tooltip
:tooltip-options="tooltipOpts"
/>
<el-table-column label="提取状态" width="100">
<template #default="{ row }">
<el-tag :type="extractStatusTagType(row)">{{
extractStatusLabel(row)
}}</el-tag>
</template>
</el-table-column>
<el-table-column prop="extractedAt" label="提取时间" width="180" />
<el-table-column label="提取平台" width="110">
<template #default="{ row }">
<el-tag
v-if="row.extractedPlatform"
:type="platformTagType(row.extractedPlatform)"
size="small"
>
{{ platformText(row.extractedPlatform) }}
</el-tag>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column
label="操作"
width="300"
fixed="right"
align="center"
>
<template #default="{ row }">
<el-button link type="primary" @click="openDetail(row)"
>详情</el-button
>
<el-button
v-if="row.token"
link
type="info"
:loading="probeLoadingId === row.id"
@click="handleProbeToken(row)"
>查可用</el-button
>
<el-button
v-if="!row.extractedAt && !row.extracted"
link
type="warning"
@click="openExtractByRow(row)"
>提取</el-button
>
<el-button
v-if="row.extracted"
link
type="success"
@click="copyCardInfo(row)"
>复制</el-button
>
</template>
</el-table-column>
</el-table>
</div>
@ -607,7 +770,9 @@ async function handleProbeToken(row) {
v-model:current-page="pagination.page"
v-model:page-size="pagination.pageSize"
background
:layout="isMobile ? 'prev, pager, next' : 'total, prev, pager, next, jumper'"
:layout="
isMobile ? 'prev, pager, next' : 'total, prev, pager, next, jumper'
"
:page-sizes="[30, 50, 100]"
:total="total"
/>
@ -621,6 +786,7 @@ async function handleProbeToken(row) {
:row="detailRow"
:save-loading="detailRemarkSaving"
@save-remark="handleSaveRemark"
@detail-action="handleDetailAction"
/>
<ExtractDialog
@ -732,40 +898,141 @@ async function handleProbeToken(row) {
</template>
<style scoped>
.account-pool-page { padding: 12px; }
.card-header { display: flex; align-items: center; justify-content: space-between; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.w-260 { width: 260px; }
.w-140 { width: 140px; }
.type-tabs { margin-bottom: 12px; }
.pager { display: flex; justify-content: flex-end; margin-top: 14px; }
.table-scroll { width: 100%; overflow-x: hidden; }
.pool-table { min-width: 980px; }
.account-pool-page {
padding: 12px;
}
.card-header {
display: flex;
align-items: center;
justify-content: space-between;
}
.toolbar {
display: flex;
justify-content: space-between;
align-items: center;
gap: 12px;
flex-wrap: wrap;
margin-bottom: 12px;
}
.toolbar-left,
.toolbar-right {
display: flex;
align-items: center;
gap: 8px;
flex-wrap: wrap;
}
.w-260 {
width: 260px;
}
.w-140 {
width: 140px;
}
.type-tabs {
margin-bottom: 12px;
}
.pager {
display: flex;
justify-content: flex-end;
margin-top: 14px;
}
.table-scroll {
width: 100%;
overflow-x: hidden;
}
.pool-table {
min-width: 980px;
}
@media (max-width: 768px) {
.account-pool-page { padding: 8px; }
.toolbar { gap: 8px; }
.toolbar-left, .toolbar-right { width: 100%; gap: 8px; }
.w-260, .w-140 { width: 100%; }
.account-pool-page {
padding: 8px;
}
.toolbar {
gap: 8px;
}
.toolbar-left,
.toolbar-right {
width: 100%;
gap: 8px;
}
.w-260,
.w-140 {
width: 100%;
}
.toolbar-right .el-button {
flex: 1 1 calc(50% - 8px);
min-width: 120px;
margin: 0;
}
.type-tabs :deep(.el-tabs__nav-wrap) { overflow-x: auto; overflow-y: hidden; }
.pager { justify-content: center; }
.type-tabs :deep(.el-tabs__nav-wrap) {
overflow-x: auto;
overflow-y: hidden;
}
.pager {
justify-content: center;
}
}
.api-doc {
padding: 0 4px;
font-size: 13px;
}
.doc-section {
margin-bottom: 24px;
}
.doc-title {
font-weight: 600;
font-size: 14px;
margin-bottom: 10px;
color: #303133;
border-left: 3px solid #409eff;
padding-left: 8px;
}
.method-tag {
margin-right: 8px;
vertical-align: middle;
}
.url-code {
background: #f5f7fa;
padding: 4px 10px;
border-radius: 4px;
font-size: 13px;
color: #e6a23c;
word-break: break-all;
}
.example-item {
margin-bottom: 10px;
}
.example-label {
font-size: 12px;
color: #909399;
margin-bottom: 4px;
}
.example-url-wrap {
display: flex;
align-items: center;
gap: 8px;
background: #f5f7fa;
padding: 6px 10px;
border-radius: 4px;
}
.example-url {
flex: 1;
font-size: 12px;
color: #409eff;
word-break: break-all;
}
.code-block {
background: #1e1e1e;
color: #d4d4d4;
padding: 12px 16px;
border-radius: 6px;
font-size: 12px;
line-height: 1.6;
overflow-x: auto;
white-space: pre-wrap;
word-break: break-all;
margin: 0;
}
.api-doc { padding: 0 4px; font-size: 13px; }
.doc-section { margin-bottom: 24px; }
.doc-title { font-weight: 600; font-size: 14px; margin-bottom: 10px; color: #303133; border-left: 3px solid #409eff; padding-left: 8px; }
.method-tag { margin-right: 8px; vertical-align: middle; }
.url-code { background: #f5f7fa; padding: 4px 10px; border-radius: 4px; font-size: 13px; color: #e6a23c; word-break: break-all; }
.example-item { margin-bottom: 10px; }
.example-label { font-size: 12px; color: #909399; margin-bottom: 4px; }
.example-url-wrap { display: flex; align-items: center; gap: 8px; background: #f5f7fa; padding: 6px 10px; border-radius: 4px; }
.example-url { flex: 1; font-size: 12px; color: #409eff; word-break: break-all; }
.code-block { background: #1e1e1e; color: #d4d4d4; padding: 12px 16px; border-radius: 6px; font-size: 12px; line-height: 1.6; overflow-x: auto; white-space: pre-wrap; word-break: break-all; margin: 0; }
</style>
<style>

View File

@ -1,76 +1,159 @@
<script setup>
import { computed, ref, watch } from 'vue';
import { ElMessage } from 'element-plus';
import { computed, reactive, ref, watch } from "vue";
import { ElMessage } from "element-plus";
const props = defineProps({
modelValue: { type: Boolean, default: false },
row: { type: Object, default: null },
saveLoading: { type: Boolean, default: false },
modelValue: {
type: Boolean,
default: false,
},
row: {
type: Object,
default: null,
},
saveLoading: {
type: Boolean,
default: false,
},
});
const emit = defineEmits(['update:modelValue', 'save-remark']);
const remarkText = ref('');
const emit = defineEmits(["update:modelValue", "save-remark", "detail-action"]);
const remarkText = ref("");
const remarkDialogVisible = ref(false);
const platformDialogVisible = ref(false);
const unavailableDialogVisible = ref(false);
const unextractDialogVisible = ref(false);
const platformForm = reactive({ platform: "local" });
function typeText(type) {
if (type === 'account') return '账号密码';
if (type === 'account_tk') return '账号密码+Token';
return 'Token';
}
const PLATFORM_MAP = {
local: { label: '本地', type: 'info' },
xianyu: { label: '闲鱼', type: 'warning' },
taobao: { label: '淘宝', type: 'info' },
pinduoduo: { label: '拼多多', type: 'danger' },
jingdong: { label: '京东', type: 'primary' },
douyin: { label: '抖音', type: 'success' },
ziyoushangcheng: { label: '自有商城', type: 'warning' },
const TYPE_MAP = {
account: { label: "账号密码", type: "success" },
account_tk: { label: "账号密码+Token", type: "primary" },
tk: { label: "Token", type: "warning" },
};
const platformLabel = computed(() => {
if (!props.row?.extractedPlatform) return '-';
return PLATFORM_MAP[props.row.extractedPlatform]?.label || props.row.extractedPlatform;
const PLATFORM_MAP = {
local: { label: "本地", type: "info" },
xianyu: { label: "闲鱼", type: "warning" },
taobao: { label: "淘宝", type: "info" },
pinduoduo: { label: "拼多多", type: "danger" },
jingdong: { label: "京东", type: "primary" },
douyin: { label: "抖音", type: "success" },
ziyoushangcheng: { label: "自有商城", type: "warning" },
};
const statusInfo = computed(() => {
const status = Number(props.row?.extractStatus || 0);
if (status === 2) return { label: "补号", type: "warning" };
if (status === 3) return { label: "续杯", type: "primary" };
if (props.row?.extracted) return { label: "已提取", type: "success" };
return { label: "未提取", type: "info" };
});
const platformType = computed(() => {
if (!props.row?.extractedPlatform) return 'info';
return PLATFORM_MAP[props.row.extractedPlatform]?.type || 'info';
const typeInfo = computed(() => {
return (
TYPE_MAP[props.row?.type] || { label: props.row?.type || "-", type: "info" }
);
});
const platformInfo = computed(() => {
const key = props.row?.extractedPlatform;
if (!key) return { label: "-", type: "info" };
return PLATFORM_MAP[key] || { label: key, type: "info" };
});
const isUsedInfo = computed(() => {
const raw = props.row?.isUsed;
if (raw === null || raw === undefined || raw === "") {
return { label: "未探测", type: "info" };
}
const n = Number(raw);
if (n === 1) return { label: "可用", type: "success" };
if (n === 0) return { label: "已用完", type: "danger" };
return { label: String(raw), type: "info" };
});
const hasAccountPassword = computed(
() => !!(props.row?.account || props.row?.password),
);
const hasToken = computed(() => !!props.row?.token);
watch(
() => props.row,
(row) => {
remarkText.value = row?.remark || '';
remarkText.value = row?.remark || "";
platformForm.platform = row?.extractedPlatform || "local";
},
{ immediate: true }
{ immediate: true },
);
function closeDialog() {
emit("update:modelValue", false);
}
function openRemarkDialog() {
remarkText.value = props.row?.remark || "";
remarkDialogVisible.value = true;
}
function onSaveRemark() {
if (!props.row?.id) return;
emit('save-remark', { id: props.row.id, remark: remarkText.value || '' });
emit("save-remark", { id: props.row.id, remark: remarkText.value || "" });
remarkDialogVisible.value = false;
}
function onSetUnavailable() {
if (!props.row?.id) return;
emit("detail-action", { action: "unavailable", id: props.row.id });
unavailableDialogVisible.value = false;
}
function onUpdatePlatform() {
if (!props.row?.id) return;
emit("detail-action", {
action: "platform",
id: props.row.id,
platform: platformForm.platform,
});
platformDialogVisible.value = false;
}
function onUnextract() {
if (!props.row?.id) return;
emit("detail-action", { action: "unextract", id: props.row.id });
unextractDialogVisible.value = false;
}
async function copyText(text, successText) {
const val = String(text || "").trim();
if (!val) {
ElMessage.warning("暂无可复制内容");
return;
}
try {
await navigator.clipboard.writeText(val);
ElMessage.success(successText || "已复制");
} catch {
ElMessage.error("复制失败,请检查浏览器权限");
}
}
function copyAccountPassword() {
const account = props.row?.account || '';
const password = props.row?.password || '';
if (!account && !password) {
ElMessage.warning('暂无账号密码可复制');
return;
}
navigator.clipboard.writeText(`${account}\n${password}`.trim()).then(() => {
ElMessage.success('已复制账号+密码');
});
const parts = [];
if (props.row?.account) parts.push(props.row.account);
if (props.row?.password) parts.push(props.row.password);
copyText(parts.join("\n"), "已复制账号+密码");
}
function copyToken() {
const token = props.row?.token || '';
if (!token) {
ElMessage.warning('暂无 Token 可复制');
return;
}
navigator.clipboard.writeText(token).then(() => {
ElMessage.success('已复制 Token');
});
copyText(props.row?.token, "已复制 Token");
}
function copyAll() {
const parts = [];
if (props.row?.account) parts.push(`账号:${props.row.account}`);
if (props.row?.password) parts.push(`密码:${props.row.password}`);
if (props.row?.token) parts.push(`Token${props.row.token}`);
copyText(parts.join("\n"), "已复制完整账号信息");
}
</script>
@ -78,69 +161,406 @@ function copyToken() {
<el-dialog
class="pool-detail-dialog"
:model-value="modelValue"
title="账号详情"
width="90%"
width="760px"
destroy-on-close
:show-close="false"
@update:model-value="(v) => emit('update:modelValue', v)"
>
<el-descriptions :column="1" border v-if="row">
<el-descriptions-item label="ID">{{ row.id }}</el-descriptions-item>
<el-descriptions-item label="账号类型">{{ typeText(row.type) }}</el-descriptions-item>
<el-descriptions-item label="账号">{{ row.account || '-' }}</el-descriptions-item>
<el-descriptions-item label="密码">{{ row.password || '-' }}</el-descriptions-item>
<el-descriptions-item label="Token">
<span class="token-text">{{ row.token || '-' }}</span>
</el-descriptions-item>
<el-descriptions-item label="提取状态">{{
row.extractStatus === 2 ? '补号' : row.extracted ? '已提取' : '未提取'
}}</el-descriptions-item>
<el-descriptions-item label="提取时间">{{ row.extractedAt || '-' }}</el-descriptions-item>
<el-descriptions-item label="提取平台">
<el-tag v-if="row.extractedPlatform" :type="platformType" size="small">{{ platformLabel }}</el-tag>
<span v-else>-</span>
</el-descriptions-item>
<el-descriptions-item label="复制">
<div class="copy-actions">
<el-button size="small" @click="copyAccountPassword">账号+密码</el-button>
<el-button size="small" type="primary" @click="copyToken">Token</el-button>
<template #header>
<div class="detail-header">
<div>
<div class="detail-title">账号详情</div>
<div class="detail-subtitle">
通过弹窗执行账号状态平台备注等维护操作
</div>
</div>
</el-descriptions-item>
<el-descriptions-item label="备注">
<div class="remark-edit-wrap">
<el-input v-model="remarkText" type="textarea" :rows="3" placeholder="请输入备注" />
<el-button type="primary" size="small" :loading="saveLoading" @click="onSaveRemark">
保存备注
<div class="header-actions">
<el-button circle plain @click="closeDialog">×</el-button>
</div>
</div>
</template>
<div v-if="row" class="detail-body">
<div class="info-grid">
<div class="info-card">
<div class="info-label">ID</div>
<div class="info-value">{{ row?.id || "-" }}</div>
</div>
<div class="info-card">
<div class="info-label">账号类型</div>
<div class="info-value">
<el-tag :type="typeInfo.type" round>{{ typeInfo.label }}</el-tag>
</div>
</div>
<div class="info-card">
<div class="info-label">提取状态</div>
<div class="info-value">
<el-tag :type="statusInfo.type" effect="dark" round>
{{ statusInfo.label }}
</el-tag>
</div>
</div>
<div class="info-card">
<div class="info-label">提取平台</div>
<div class="info-value">
<el-tag
v-if="row.extractedPlatform"
:type="platformInfo.type"
size="small"
>
{{ platformInfo.label }}
</el-tag>
<span v-else>-</span>
</div>
</div>
<div class="info-card">
<div class="info-label">提取时间</div>
<div class="info-value">{{ row.extractedAt || "-" }}</div>
</div>
<div class="info-card">
<div class="info-label">可用检测</div>
<div class="info-value">
<el-tag :type="isUsedInfo.type" round>
{{ isUsedInfo.label }}
</el-tag>
</div>
</div>
<div class="info-card">
<div class="info-label">账号</div>
<div class="info-value">{{ row.account || "-" }}</div>
</div>
<div class="info-card">
<div class="info-label">密码</div>
<div class="info-value">{{ row.password || "-" }}</div>
</div>
</div>
<div class="section-card">
<div class="section-head">
<div>
<div class="section-title">Token</div>
<div class="section-subtitle">
Token 已做自动换行便于检查与复制
</div>
</div>
<el-button
size="small"
type="primary"
plain
:disabled="!hasToken"
@click="copyToken"
>
复制 Token
</el-button>
</div>
</el-descriptions-item>
</el-descriptions>
<pre class="token-box">{{ row.token || "暂无 Token" }}</pre>
</div>
<div class="section-card">
<div class="section-head">
<div>
<div class="section-title">快捷功能</div>
<div class="section-subtitle">按使用场景复制账号信息</div>
</div>
</div>
<div class="copy-actions">
<el-button
:disabled="!hasAccountPassword"
@click="copyAccountPassword"
>
复制账号+密码
</el-button>
<el-button
type="primary"
plain
:disabled="!hasToken"
@click="copyToken"
>
复制 Token
</el-button>
<el-button
type="success"
plain
:disabled="!hasAccountPassword && !hasToken"
@click="copyAll"
>
复制全部
</el-button>
</div>
</div>
<div class="section-card">
<div class="section-head">
<div>
<div class="section-title">维护操作</div>
<div class="section-subtitle">
点击按钮后打开确认/编辑弹窗再执行对应操作
</div>
</div>
</div>
<div class="copy-actions">
<el-button
type="danger"
plain
@click="unavailableDialogVisible = true"
>
改不可用
</el-button>
<el-button
type="warning"
plain
@click="platformDialogVisible = true"
>
改平台
</el-button>
<el-button type="info" plain @click="unextractDialogVisible = true">
反提取
</el-button>
<el-button type="primary" plain @click="openRemarkDialog">
改备注
</el-button>
</div>
</div>
<div class="section-card">
<div class="section-head">
<div>
<div class="section-title">备注</div>
<div class="section-subtitle">备注改为弹窗编辑当前仅展示</div>
</div>
</div>
<div class="remark-display">{{ row.remark || "暂无备注" }}</div>
</div>
</div>
</el-dialog>
<el-dialog
v-model="unavailableDialogVisible"
title="改不可用"
width="420px"
append-to-body
>
<el-alert type="warning" :closable="false">
确认将当前账号标记为不可用/已用完
</el-alert>
<template #footer>
<el-button @click="unavailableDialogVisible = false">取消</el-button>
<el-button type="danger" :loading="saveLoading" @click="onSetUnavailable">
确认改不可用
</el-button>
</template>
</el-dialog>
<el-dialog
v-model="platformDialogVisible"
title="改平台"
width="420px"
append-to-body
>
<el-form label-width="84px">
<el-form-item label="提取平台">
<el-select v-model="platformForm.platform" style="width: 100%">
<el-option
v-for="(v, k) in PLATFORM_MAP"
:key="k"
:label="v.label"
:value="k"
/>
</el-select>
</el-form-item>
</el-form>
<template #footer>
<el-button @click="platformDialogVisible = false">取消</el-button>
<el-button type="primary" :loading="saveLoading" @click="onUpdatePlatform">
确认修改
</el-button>
</template>
</el-dialog>
<el-dialog
v-model="unextractDialogVisible"
title="反提取"
width="420px"
append-to-body
>
<el-alert type="warning" :closable="false">
反提取会把账号恢复为未提取并清空提取时间与提取平台
</el-alert>
<template #footer>
<el-button @click="unextractDialogVisible = false">取消</el-button>
<el-button type="warning" :loading="saveLoading" @click="onUnextract">
确认反提取
</el-button>
</template>
</el-dialog>
<el-dialog
v-model="remarkDialogVisible"
title="改备注"
width="520px"
append-to-body
>
<el-input
v-model="remarkText"
type="textarea"
:rows="5"
resize="none"
placeholder="请输入备注"
/>
<template #footer>
<el-button @click="remarkDialogVisible = false">取消</el-button>
<el-button type="primary" :loading="saveLoading" @click="onSaveRemark">
保存备注
</el-button>
</template>
</el-dialog>
</template>
<style scoped>
.token-text {
word-break: break-all;
white-space: pre-wrap;
line-height: 1.6;
:deep(.pool-detail-dialog) {
max-width: calc(100vw - 28px);
border-radius: 18px;
overflow: hidden;
}
.remark-edit-wrap {
:deep(.pool-detail-dialog .el-dialog__header) {
padding: 18px 22px;
margin: 0;
border-bottom: 1px solid #eef0f5;
}
:deep(.pool-detail-dialog .el-dialog__body) {
padding: 18px 22px 22px;
background: #f6f8fb;
}
:deep(.el-tag) {
border-radius: 4px !important;
}
.detail-header,
.header-actions,
.section-head,
.copy-actions {
display: flex;
align-items: center;
}
.detail-header {
justify-content: space-between;
gap: 14px;
}
.detail-title {
font-size: 18px;
font-weight: 700;
color: #1f2937;
}
.detail-subtitle,
.section-subtitle {
margin-top: 4px;
font-size: 12px;
color: #909399;
}
.header-actions {
gap: 10px;
}
.header-actions .el-button {
font-size: 18px;
font-weight: 300;
}
.detail-body {
display: flex;
flex-direction: column;
gap: 8px;
gap: 14px;
}
.section-card,
.info-card {
background: #fff;
border: 1px solid #edf0f6;
box-shadow: 0 10px 28px rgba(31, 41, 55, 0.06);
}
.info-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 12px;
}
.info-card {
border-radius: 14px;
padding: 14px;
min-width: 0;
}
.info-label {
color: #909399;
font-size: 12px;
margin-bottom: 8px;
}
.info-value {
color: #303133;
font-size: 14px;
font-weight: 600;
word-break: break-all;
min-height: 20px;
}
.section-card {
border-radius: 16px;
padding: 16px;
}
.section-head {
justify-content: space-between;
gap: 12px;
margin-bottom: 12px;
}
.section-title {
font-size: 15px;
font-weight: 700;
color: #303133;
}
.token-box {
margin: 0;
padding: 14px;
max-height: 220px;
overflow: auto;
border-radius: 12px;
background: #111827;
color: #d1e7ff;
font-size: 12px;
line-height: 1.7;
white-space: pre-wrap;
word-break: break-all;
}
.copy-actions {
display: flex;
flex-wrap: wrap;
gap: 8px;
gap: 10px;
}
.remark-edit-wrap .el-button {
align-self: flex-start;
.copy-actions .el-button {
margin: 0;
}
:deep(.pool-detail-dialog) {
max-width: 560px;
.remark-display {
padding: 12px;
min-height: 42px;
border-radius: 10px;
background: #f8fafc;
color: #303133;
line-height: 1.6;
white-space: pre-wrap;
word-break: break-all;
}
@media (max-width: 768px) {
@ -149,21 +569,32 @@ function copyToken() {
margin: 0 auto;
}
:deep(.pool-detail-dialog .el-dialog__header) {
padding: 14px 14px;
}
:deep(.pool-detail-dialog .el-dialog__body) {
padding: 12px;
max-height: 70vh;
max-height: 76vh;
overflow-y: auto;
}
:deep(.pool-detail-dialog .el-descriptions__label) {
width: 72px;
word-break: break-all;
white-space: normal;
.detail-header,
.section-head {
align-items: flex-start;
}
.remark-edit-wrap .el-button {
.section-head {
flex-direction: column;
}
.info-grid {
grid-template-columns: 1fr;
}
.copy-actions .el-button,
.section-head .el-button {
width: 100%;
align-self: stretch;
}
}
</style>

View File

@ -1,5 +1,6 @@
<script setup>
import { computed, reactive, watch } from 'vue';
import { ElMessage } from 'element-plus';
const props = defineProps({
modelValue: {
@ -90,8 +91,8 @@ function parseBatchRows() {
const [account, password, token] = line
.split(',')
.map((x) => (x || '').trim());
if (!account || !password || !token) {
errors.push(`${index + 1} 行格式错误,应为 account,password,token`);
if (!account || !token) {
errors.push(`${index + 1} 行格式错误,应为 account,password,tokenpassword 可为空)`);
return;
}
parsed.push({
@ -139,7 +140,8 @@ function handleSubmit() {
}
if (form.type === 'account_tk') {
if (!form.account || !form.password || !form.token) {
if (!form.account || !form.token) {
ElMessage.warning('请输入账号和 Token密码可为空');
return;
}
emit('submit', {
@ -177,6 +179,7 @@ function handleSubmit() {
const { parsed, errors } = parseBatchRows();
if (errors.length || parsed.length === 0) {
ElMessage.warning(errors[0] || '请填写批量内容');
return;
}
emit('submit', {

View File

@ -12,6 +12,9 @@ import {
getAccountPoolDetail,
getAccountPoolList,
updateAccountPoolRemark,
setAccountPoolUnavailable,
updateAccountPoolPlatform,
unextractAccountPool,
replenishAccountPool,
probeAccountPoolToken,
} from '@/api/accountPool';
@ -31,7 +34,7 @@ const replenishForm = reactive({ type: 'tk', platform: 'local', remark: '' });
const apiDocVisible = ref(false);
const patchVisible = ref(false);
const query = reactive({ keyword: "", status: "" });
const query = reactive({ keyword: "", status: "", platform: "" });
const activeTypeTab = ref("all");
const extractForm = reactive({ platform: 'local', type: 'account', remark: '', replenish: false });
@ -52,6 +55,7 @@ const pagedList = computed(() => tableData.value);
function resetQuery() {
query.keyword = "";
query.status = "";
query.platform = "";
}
const typeTabs = computed(() => [
@ -62,7 +66,7 @@ const typeTabs = computed(() => [
]);
watch(
() => [query.keyword, query.status, activeTypeTab.value],
() => [query.keyword, query.status, query.platform, activeTypeTab.value],
() => {
if (skipWatchFetchDuringUnusedJump.value) return;
pagination.page = 1;
@ -194,6 +198,41 @@ async function handleSaveRemark(payload) {
} finally { detailRemarkSaving.value = false; }
}
async function refreshDetailRow(id) {
if (!id) return;
const res = await getAccountPoolDetail(moduleKey, id);
if (res?.code === 200) {
detailRow.value = normalizeRow(res.data || {});
}
}
async function handleDetailAction(payload) {
if (!payload?.id || !payload?.action) return;
detailRemarkSaving.value = true;
try {
let res;
if (payload.action === 'unavailable') {
res = await setAccountPoolUnavailable(moduleKey, { id: payload.id });
} else if (payload.action === 'platform') {
res = await updateAccountPoolPlatform(moduleKey, {
id: payload.id,
platform: payload.platform,
});
} else if (payload.action === 'unextract') {
res = await unextractAccountPool(moduleKey, { id: payload.id });
}
if (res?.code !== 200) {
ElMessage.error(res?.msg || '操作失败');
return;
}
ElMessage.success('操作成功');
await refreshDetailRow(payload.id);
await fetchList();
} finally {
detailRemarkSaving.value = false;
}
}
function markExtractForSelected() {
if (!selectedRows.value.length) { ElMessage.warning("请先选择数据"); return; }
batchExtractForm.platform = 'local';
@ -323,12 +362,14 @@ function normalizeRow(raw) {
function extractStatusLabel(row) {
if (row?.extractStatus === 2) return "补号";
if (row?.extractStatus === 3) return "续杯";
if (row?.extracted) return "已提取";
return "未提取";
}
function extractStatusTagType(row) {
if (row?.extractStatus === 2) return "warning";
if (row?.extractStatus === 3) return "primary";
if (row?.extracted) return "success";
return "info";
}
@ -341,6 +382,7 @@ async function fetchList() {
pageSize: pagination.pageSize,
keyword: query.keyword || undefined,
status: query.status || undefined,
platform: query.platform || undefined,
type: activeTypeTab.value === "all" ? undefined : activeTypeTab.value,
});
if (res?.code !== 200) {
@ -505,6 +547,21 @@ async function handleProbeToken(row) {
>
<el-option label="未提取" value="unused" />
<el-option label="已提取" value="extracted" />
<el-option label="补号" value="replenished" />
<el-option label="续杯" value="renewed" />
</el-select>
<el-select
v-model="query.platform"
placeholder="提取平台"
clearable
class="w-140"
>
<el-option
v-for="(v, k) in PLATFORM_MAP"
:key="k"
:value="k"
:label="v.label"
/>
</el-select>
<el-button
type="primary"
@ -520,7 +577,7 @@ async function handleProbeToken(row) {
<el-button type="primary" @click="openAddDialog('single')">添加账号</el-button>
<el-button type="success" @click="openAddDialog('batch')">批量添加</el-button>
<el-button type="warning" @click="replenishVisible = true">补号</el-button>
<el-button @click="markExtractForSelected">批量标记提取</el-button>
<el-button @click="markExtractForSelected">批量提取</el-button>
<el-button @click="apiDocVisible = true">接口说明</el-button>
</div>
</div>
@ -620,6 +677,7 @@ async function handleProbeToken(row) {
:row="detailRow"
:save-loading="detailRemarkSaving"
@save-remark="handleSaveRemark"
@detail-action="handleDetailAction"
/>
<ExtractDialog