更新若干界面

This commit is contained in:
李志强 2026-05-22 08:29:48 +08:00
parent d1847bfd26
commit 2d075e6548
11 changed files with 2187 additions and 481 deletions

View File

@ -6,7 +6,7 @@
"scripts": { "scripts": {
"dev": "vite --open", "dev": "vite --open",
"clean": "node scripts/clean-dist.mjs", "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" "preview": "vite preview"
}, },
"dependencies": { "dependencies": {

View File

@ -51,6 +51,30 @@ export function updateAccountPoolRemark(module, data) {
}); });
} }
export function setAccountPoolUnavailable(module, data) {
return request({
url: `${base(module)}/setUnavailable`,
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) { export function replenishAccountPool(module, data) {
return request({ return request({
url: `${base(module)}/replenish`, url: `${base(module)}/replenish`,

View File

@ -1,6 +1,6 @@
<script setup> <script setup>
import { computed, ref, watch } from 'vue'; import { computed, reactive, ref, watch } from "vue";
import { ElMessage } from 'element-plus'; import { ElMessage } from "element-plus";
const props = defineProps({ const props = defineProps({
modelValue: { modelValue: {
@ -17,69 +17,143 @@ const props = defineProps({
}, },
}); });
const emit = defineEmits(['update:modelValue', 'save-remark']); const emit = defineEmits(["update:modelValue", "save-remark", "detail-action"]);
const remarkText = ref(''); 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) { const TYPE_MAP = {
if (type === 'account') return '账号密码'; account: { label: "账号密码", type: "success" },
if (type === 'account_tk') return '账号密码+Token'; account_tk: { label: "账号密码+Token", type: "primary" },
return 'Token'; tk: { label: "Token", type: "warning" },
}
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 platformLabel = computed(() => { const PLATFORM_MAP = {
if (!props.row?.extractedPlatform) return '-'; local: { label: "本地", type: "info" },
return PLATFORM_MAP[props.row.extractedPlatform]?.label || props.row.extractedPlatform; 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(() => { const typeInfo = computed(() => {
if (!props.row?.extractedPlatform) return 'info'; return (
return PLATFORM_MAP[props.row.extractedPlatform]?.type || 'info'; 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( watch(
() => props.row, () => props.row,
(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() { function onSaveRemark() {
if (!props.row?.id) return; 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() { function copyAccountPassword() {
const account = props.row?.account || ''; const parts = [];
const password = props.row?.password || ''; if (props.row?.account) parts.push(props.row.account);
if (!account && !password) { if (props.row?.password) parts.push(props.row.password);
ElMessage.warning('暂无账号密码可复制'); copyText(parts.join("\n"), "已复制账号+密码");
return;
}
navigator.clipboard.writeText(`${account}\n${password}`.trim()).then(() => {
ElMessage.success('已复制账号+密码');
});
} }
function copyToken() { function copyToken() {
const token = props.row?.token || ''; copyText(props.row?.token, "已复制 Token");
if (!token) { }
ElMessage.warning('暂无 Token 可复制');
return; function copyAll() {
} const parts = [];
navigator.clipboard.writeText(token).then(() => { if (props.row?.account) parts.push(`账号:${props.row.account}`);
ElMessage.success('已复制 Token'); if (props.row?.password) parts.push(`密码:${props.row.password}`);
}); if (props.row?.token) parts.push(`Token${props.row.token}`);
copyText(parts.join("\n"), "已复制完整账号信息");
} }
</script> </script>
@ -87,84 +161,406 @@ function copyToken() {
<el-dialog <el-dialog
class="pool-detail-dialog" class="pool-detail-dialog"
:model-value="modelValue" :model-value="modelValue"
title="账号详情" width="760px"
width="90%" destroy-on-close
:show-close="false"
@update:model-value="(v) => emit('update:modelValue', v)" @update:model-value="(v) => emit('update:modelValue', v)"
> >
<el-descriptions :column="1" border v-if="row"> <template #header>
<el-descriptions-item label="ID">{{ row.id }}</el-descriptions-item> <div class="detail-header">
<el-descriptions-item label="账号类型">{{ typeText(row.type) }}</el-descriptions-item> <div>
<el-descriptions-item label="账号">{{ row.account || '-' }}</el-descriptions-item> <div class="detail-title">账号详情</div>
<el-descriptions-item label="密码">{{ row.password || '-' }}</el-descriptions-item> <div class="detail-subtitle">
<el-descriptions-item label="Token"> 通过弹窗执行账号状态平台备注等维护操作
<span class="token-text">{{ row.token || '-' }}</span> </div>
</el-descriptions-item> </div>
<el-descriptions-item label="提取状态"> <div class="header-actions">
{{ <el-button circle plain @click="closeDialog">×</el-button>
row.extractStatus === 2 ? '补号' : row.extracted ? '已提取' : '未提取' </div>
}} </div>
</el-descriptions-item> </template>
<el-descriptions-item label="探测可用">
{{ <div v-if="row" class="detail-body">
row.isUsed === null || row.isUsed === undefined <div class="info-grid">
? '未探测' <div class="info-card">
: Number(row.isUsed) === 1 <div class="info-label">ID</div>
? '可用' <div class="info-value">{{ row?.id || "-" }}</div>
: Number(row.isUsed) === 0 </div>
? '已用完' <div class="info-card">
: String(row.isUsed) <div class="info-label">账号类型</div>
}} <div class="info-value">
</el-descriptions-item> <el-tag :type="typeInfo.type" round>{{ typeInfo.label }}</el-tag>
<el-descriptions-item label="提取时间">{{ row.extractedAt || '-' }}</el-descriptions-item> </div>
<el-descriptions-item label="提取平台"> </div>
<el-tag v-if="row.extractedPlatform" :type="platformType" size="small"> <div class="info-card">
{{ platformLabel }} <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> </el-tag>
<span v-else>-</span> <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>
</div> </div>
</el-descriptions-item> </div>
<el-descriptions-item label="备注"> <div class="info-card">
<div class="remark-edit-wrap"> <div class="info-label">提取时间</div>
<el-input v-model="remarkText" type="textarea" :rows="3" placeholder="请输入备注" /> <div class="info-value">{{ row.extractedAt || "-" }}</div>
<el-button type="primary" size="small" :loading="saveLoading" @click="onSaveRemark"> </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> </el-button>
</div> </div>
</el-descriptions-item> <pre class="token-box">{{ row.token || "暂无 Token" }}</pre>
</el-descriptions> </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> </el-dialog>
</template> </template>
<style scoped> <style scoped>
.token-text { :deep(.pool-detail-dialog) {
word-break: break-all; max-width: calc(100vw - 28px);
white-space: pre-wrap; border-radius: 18px;
line-height: 1.6; 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; display: flex;
flex-direction: column; 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 { .copy-actions {
display: flex;
flex-wrap: wrap; flex-wrap: wrap;
gap: 8px; gap: 10px;
} }
.remark-edit-wrap .el-button { .copy-actions .el-button {
align-self: flex-start; margin: 0;
} }
:deep(.pool-detail-dialog) { .remark-display {
max-width: 560px; 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) { @media (max-width: 768px) {
@ -173,21 +569,32 @@ function copyToken() {
margin: 0 auto; margin: 0 auto;
} }
:deep(.pool-detail-dialog .el-dialog__header) {
padding: 14px 14px;
}
:deep(.pool-detail-dialog .el-dialog__body) { :deep(.pool-detail-dialog .el-dialog__body) {
padding: 12px; padding: 12px;
max-height: 70vh; max-height: 76vh;
overflow-y: auto; overflow-y: auto;
} }
:deep(.pool-detail-dialog .el-descriptions__label) { .detail-header,
width: 72px; .section-head {
word-break: break-all; align-items: flex-start;
white-space: normal;
} }
.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%; width: 100%;
align-self: stretch;
} }
} }
</style> </style>

View File

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

View File

@ -12,6 +12,9 @@ import {
getAccountPoolDetail, getAccountPoolDetail,
getAccountPoolList, getAccountPoolList,
updateAccountPoolRemark, updateAccountPoolRemark,
setAccountPoolUnavailable,
updateAccountPoolPlatform,
unextractAccountPool,
replenishAccountPool, replenishAccountPool,
probeAccountPoolToken, probeAccountPoolToken,
} from "@/api/accountPool"; } from "@/api/accountPool";
@ -32,8 +35,11 @@ const apiDocVisible = ref(false);
const patchVisible = ref(false); const patchVisible = ref(false);
const query = reactive({ const query = reactive({
keyword: "", account: "",
token: "",
remark: "",
status: "", status: "",
platform: "",
usable: "", usable: "",
}); });
const activeTypeTab = ref("all"); const activeTypeTab = ref("all");
@ -64,8 +70,11 @@ const skipWatchFetchDuringUnusedJump = ref(false);
const pagedList = computed(() => tableData.value); const pagedList = computed(() => tableData.value);
function resetQuery() { function resetQuery() {
query.keyword = ""; query.account = "";
query.token = "";
query.remark = "";
query.status = ""; query.status = "";
query.platform = "";
query.usable = ""; query.usable = "";
} }
@ -79,7 +88,7 @@ const typeTabs = computed(() => {
}); });
watch( 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; if (skipWatchFetchDuringUnusedJump.value) return;
pagination.page = 1; pagination.page = 1;
@ -248,6 +257,41 @@ 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 === "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() { function markExtractForSelected() {
if (!selectedRows.value.length) { if (!selectedRows.value.length) {
ElMessage.warning("请先选择数据"); ElMessage.warning("请先选择数据");
@ -321,12 +365,14 @@ function typeText(type) {
function extractStatusLabel(row) { function extractStatusLabel(row) {
if (row?.extractStatus === 2) return "补号"; if (row?.extractStatus === 2) return "补号";
if (row?.extractStatus === 3) return "续杯";
if (row?.extracted) return "已提取"; if (row?.extracted) return "已提取";
return "未提取"; return "未提取";
} }
function extractStatusTagType(row) { function extractStatusTagType(row) {
if (row?.extractStatus === 2) return "warning"; if (row?.extractStatus === 2) return "warning";
if (row?.extractStatus === 3) return "primary";
if (row?.extracted) return "success"; if (row?.extracted) return "success";
return "info"; return "info";
} }
@ -477,8 +523,11 @@ async function fetchList() {
const res = await getAccountPoolList(moduleKey, { const res = await getAccountPoolList(moduleKey, {
page: pagination.page, page: pagination.page,
pageSize: pagination.pageSize, pageSize: pagination.pageSize,
keyword: query.keyword || undefined, account: query.account || undefined,
token: query.token || undefined,
remark: query.remark || undefined,
status: query.status || undefined, status: query.status || undefined,
platform: query.platform || undefined,
usable: query.usable === "1" || query.usable === "0" ? query.usable : undefined, usable: query.usable === "1" || query.usable === "0" ? query.usable : undefined,
type: activeTypeTab.value === "all" ? undefined : activeTypeTab.value, type: activeTypeTab.value === "all" ? undefined : activeTypeTab.value,
}); });
@ -494,13 +543,15 @@ async function fetchList() {
} }
} }
/** 筛选「未提取」并翻到该条件下的最后一页(当前关键词、账号类型 tab 不变) */ /** 筛选「未提取」并翻到该条件下的最后一页(当前搜索条件、账号类型 tab 不变) */
async function jumpToLastUnusedPage() { async function jumpToLastUnusedPage() {
const type = activeTypeTab.value === "all" ? undefined : activeTypeTab.value; const type = activeTypeTab.value === "all" ? undefined : activeTypeTab.value;
const res = await getAccountPoolList(moduleKey, { const res = await getAccountPoolList(moduleKey, {
page: 1, page: 1,
pageSize: pagination.pageSize, pageSize: pagination.pageSize,
keyword: query.keyword || undefined, account: query.account || undefined,
token: query.token || undefined,
remark: query.remark || undefined,
status: "unused", status: "unused",
usable: query.usable === "1" || query.usable === "0" ? query.usable : undefined, usable: query.usable === "1" || query.usable === "0" ? query.usable : undefined,
type, type,
@ -776,10 +827,22 @@ async function handleBatchProbe() {
<div class="toolbar"> <div class="toolbar">
<div class="toolbar-left"> <div class="toolbar-left">
<el-input <el-input
v-model="query.keyword" v-model="query.account"
placeholder="搜索账号 / token / 备注" placeholder="搜索账号"
clearable 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 <el-select
v-model="query.status" v-model="query.status"
@ -789,6 +852,21 @@ async function handleBatchProbe() {
> >
<el-option label="未提取" value="unused" /> <el-option label="未提取" value="unused" />
<el-option label="已提取" value="extracted" /> <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>
<el-select <el-select
v-model="query.usable" v-model="query.usable"
@ -802,7 +880,7 @@ async function handleBatchProbe() {
<el-button <el-button
type="primary" type="primary"
plain plain
title="按当前搜索与账号类型,筛选未提取并跳到最后一页" title="按当前搜索条件与账号类型,筛选未提取并跳到最后一页"
@click="jumpToLastUnusedPage" @click="jumpToLastUnusedPage"
> >
未提取末页 未提取末页
@ -813,7 +891,7 @@ async function handleBatchProbe() {
<el-button type="primary" @click="openAddDialog('single')">添加账号</el-button> <el-button type="primary" @click="openAddDialog('single')">添加账号</el-button>
<el-button type="success" @click="openAddDialog('batch')">批量添加</el-button> <el-button type="success" @click="openAddDialog('batch')">批量添加</el-button>
<el-button @click="replenishVisible = true">补号</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 plain @click="handleBatchProbe">批量检测</el-button>
<!-- <el-button type="info" plain @click="handleBatchProbeExpireTime">批量时间检测</el-button> --> <!-- <el-button type="info" plain @click="handleBatchProbeExpireTime">批量时间检测</el-button> -->
<el-button @click="apiDocVisible = true">接口说明</el-button> <el-button @click="apiDocVisible = true">接口说明</el-button>
@ -846,8 +924,8 @@ async function handleBatchProbe() {
<el-tag>{{ typeText(row.type) }}</el-tag> <el-tag>{{ typeText(row.type) }}</el-tag>
</template> </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="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="password" label="密码" min-width="160" show-overflow-tooltip :tooltip-options="tooltipOpts">
<template #default="{ row }">{{ row.password || '-' }}</template> <template #default="{ row }">{{ row.password || '-' }}</template>
</el-table-column> </el-table-column>
<el-table-column label="Token" min-width="200" show-overflow-tooltip :tooltip-options="tooltipOpts"> <el-table-column label="Token" min-width="200" show-overflow-tooltip :tooltip-options="tooltipOpts">
@ -939,6 +1017,7 @@ async function handleBatchProbe() {
:row="detailRow" :row="detailRow"
:save-loading="detailRemarkSaving" :save-loading="detailRemarkSaving"
@save-remark="handleSaveRemark" @save-remark="handleSaveRemark"
@detail-action="handleDetailAction"
/> />
<ExtractDialog <ExtractDialog
@ -971,7 +1050,7 @@ async function handleBatchProbe() {
<el-dialog <el-dialog
v-model="batchExtractVisible" v-model="batchExtractVisible"
class="pool-batch-extract-dialog" class="pool-batch-extract-dialog"
title="批量标记提取" title="批量提取"
width="90%" width="90%"
destroy-on-close destroy-on-close
> >

View File

@ -1,76 +1,159 @@
<script setup> <script setup>
import { computed, ref, watch } from 'vue'; import { computed, reactive, ref, watch } from "vue";
import { ElMessage } from 'element-plus'; import { ElMessage } from "element-plus";
const props = defineProps({ const props = defineProps({
modelValue: { type: Boolean, default: false }, modelValue: {
row: { type: Object, default: null }, type: Boolean,
saveLoading: { type: Boolean, default: false }, default: false,
},
row: {
type: Object,
default: null,
},
saveLoading: {
type: Boolean,
default: false,
},
}); });
const emit = defineEmits(['update:modelValue', 'save-remark']); const emit = defineEmits(["update:modelValue", "save-remark", "detail-action"]);
const remarkText = ref(''); 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) { const TYPE_MAP = {
if (type === 'account') return '账号密码'; account: { label: "账号密码", type: "success" },
if (type === 'account_tk') return '账号密码+Token'; account_tk: { label: "账号密码+Token", type: "primary" },
return 'Token'; tk: { label: "Token", type: "warning" },
}
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 platformLabel = computed(() => { const PLATFORM_MAP = {
if (!props.row?.extractedPlatform) return '-'; local: { label: "本地", type: "info" },
return PLATFORM_MAP[props.row.extractedPlatform]?.label || props.row.extractedPlatform; 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(() => { const typeInfo = computed(() => {
if (!props.row?.extractedPlatform) return 'info'; return (
return PLATFORM_MAP[props.row.extractedPlatform]?.type || 'info'; 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( watch(
() => props.row, () => props.row,
(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() { function onSaveRemark() {
if (!props.row?.id) return; 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() { function copyAccountPassword() {
const account = props.row?.account || ''; const parts = [];
const password = props.row?.password || ''; if (props.row?.account) parts.push(props.row.account);
if (!account && !password) { if (props.row?.password) parts.push(props.row.password);
ElMessage.warning('暂无账号密码可复制'); copyText(parts.join("\n"), "已复制账号+密码");
return;
}
navigator.clipboard.writeText(`${account}\n${password}`.trim()).then(() => {
ElMessage.success('已复制账号+密码');
});
} }
function copyToken() { function copyToken() {
const token = props.row?.token || ''; copyText(props.row?.token, "已复制 Token");
if (!token) { }
ElMessage.warning('暂无 Token 可复制');
return; function copyAll() {
} const parts = [];
navigator.clipboard.writeText(token).then(() => { if (props.row?.account) parts.push(`账号:${props.row.account}`);
ElMessage.success('已复制 Token'); if (props.row?.password) parts.push(`密码:${props.row.password}`);
}); if (props.row?.token) parts.push(`Token${props.row.token}`);
copyText(parts.join("\n"), "已复制完整账号信息");
} }
</script> </script>
@ -78,69 +161,406 @@ function copyToken() {
<el-dialog <el-dialog
class="pool-detail-dialog" class="pool-detail-dialog"
:model-value="modelValue" :model-value="modelValue"
title="账号详情" width="760px"
width="90%" destroy-on-close
:show-close="false"
@update:model-value="(v) => emit('update:modelValue', v)" @update:model-value="(v) => emit('update:modelValue', v)"
> >
<el-descriptions :column="1" border v-if="row"> <template #header>
<el-descriptions-item label="ID">{{ row.id }}</el-descriptions-item> <div class="detail-header">
<el-descriptions-item label="账号类型">{{ typeText(row.type) }}</el-descriptions-item> <div>
<el-descriptions-item label="账号">{{ row.account || '-' }}</el-descriptions-item> <div class="detail-title">账号详情</div>
<el-descriptions-item label="密码">{{ row.password || '-' }}</el-descriptions-item> <div class="detail-subtitle">
<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>
</div> </div>
</el-descriptions-item> </div>
<el-descriptions-item label="备注"> <div class="header-actions">
<div class="remark-edit-wrap"> <el-button circle plain @click="closeDialog">×</el-button>
<el-input v-model="remarkText" type="textarea" :rows="3" placeholder="请输入备注" /> </div>
<el-button type="primary" size="small" :loading="saveLoading" @click="onSaveRemark"> </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> </el-button>
</div> </div>
</el-descriptions-item> <pre class="token-box">{{ row.token || "暂无 Token" }}</pre>
</el-descriptions> </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> </el-dialog>
</template> </template>
<style scoped> <style scoped>
.token-text { :deep(.pool-detail-dialog) {
word-break: break-all; max-width: calc(100vw - 28px);
white-space: pre-wrap; border-radius: 18px;
line-height: 1.6; 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; display: flex;
flex-direction: column; 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 { .copy-actions {
display: flex;
flex-wrap: wrap; flex-wrap: wrap;
gap: 8px; gap: 10px;
} }
.remark-edit-wrap .el-button { .copy-actions .el-button {
align-self: flex-start; margin: 0;
} }
:deep(.pool-detail-dialog) { .remark-display {
max-width: 560px; 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) { @media (max-width: 768px) {
@ -149,21 +569,32 @@ function copyToken() {
margin: 0 auto; margin: 0 auto;
} }
:deep(.pool-detail-dialog .el-dialog__header) {
padding: 14px 14px;
}
:deep(.pool-detail-dialog .el-dialog__body) { :deep(.pool-detail-dialog .el-dialog__body) {
padding: 12px; padding: 12px;
max-height: 70vh; max-height: 76vh;
overflow-y: auto; overflow-y: auto;
} }
:deep(.pool-detail-dialog .el-descriptions__label) { .detail-header,
width: 72px; .section-head {
word-break: break-all; align-items: flex-start;
white-space: normal;
} }
.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%; width: 100%;
align-self: stretch;
} }
} }
</style> </style>

View File

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

View File

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

View File

@ -1,76 +1,159 @@
<script setup> <script setup>
import { computed, ref, watch } from 'vue'; import { computed, reactive, ref, watch } from "vue";
import { ElMessage } from 'element-plus'; import { ElMessage } from "element-plus";
const props = defineProps({ const props = defineProps({
modelValue: { type: Boolean, default: false }, modelValue: {
row: { type: Object, default: null }, type: Boolean,
saveLoading: { type: Boolean, default: false }, default: false,
},
row: {
type: Object,
default: null,
},
saveLoading: {
type: Boolean,
default: false,
},
}); });
const emit = defineEmits(['update:modelValue', 'save-remark']); const emit = defineEmits(["update:modelValue", "save-remark", "detail-action"]);
const remarkText = ref(''); 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) { const TYPE_MAP = {
if (type === 'account') return '账号密码'; account: { label: "账号密码", type: "success" },
if (type === 'account_tk') return '账号密码+Token'; account_tk: { label: "账号密码+Token", type: "primary" },
return 'Token'; tk: { label: "Token", type: "warning" },
}
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 platformLabel = computed(() => { const PLATFORM_MAP = {
if (!props.row?.extractedPlatform) return '-'; local: { label: "本地", type: "info" },
return PLATFORM_MAP[props.row.extractedPlatform]?.label || props.row.extractedPlatform; 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(() => { const typeInfo = computed(() => {
if (!props.row?.extractedPlatform) return 'info'; return (
return PLATFORM_MAP[props.row.extractedPlatform]?.type || 'info'; 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( watch(
() => props.row, () => props.row,
(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() { function onSaveRemark() {
if (!props.row?.id) return; 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() { function copyAccountPassword() {
const account = props.row?.account || ''; const parts = [];
const password = props.row?.password || ''; if (props.row?.account) parts.push(props.row.account);
if (!account && !password) { if (props.row?.password) parts.push(props.row.password);
ElMessage.warning('暂无账号密码可复制'); copyText(parts.join("\n"), "已复制账号+密码");
return;
}
navigator.clipboard.writeText(`${account}\n${password}`.trim()).then(() => {
ElMessage.success('已复制账号+密码');
});
} }
function copyToken() { function copyToken() {
const token = props.row?.token || ''; copyText(props.row?.token, "已复制 Token");
if (!token) { }
ElMessage.warning('暂无 Token 可复制');
return; function copyAll() {
} const parts = [];
navigator.clipboard.writeText(token).then(() => { if (props.row?.account) parts.push(`账号:${props.row.account}`);
ElMessage.success('已复制 Token'); if (props.row?.password) parts.push(`密码:${props.row.password}`);
}); if (props.row?.token) parts.push(`Token${props.row.token}`);
copyText(parts.join("\n"), "已复制完整账号信息");
} }
</script> </script>
@ -78,69 +161,406 @@ function copyToken() {
<el-dialog <el-dialog
class="pool-detail-dialog" class="pool-detail-dialog"
:model-value="modelValue" :model-value="modelValue"
title="账号详情" width="760px"
width="90%" destroy-on-close
:show-close="false"
@update:model-value="(v) => emit('update:modelValue', v)" @update:model-value="(v) => emit('update:modelValue', v)"
> >
<el-descriptions :column="1" border v-if="row"> <template #header>
<el-descriptions-item label="ID">{{ row.id }}</el-descriptions-item> <div class="detail-header">
<el-descriptions-item label="账号类型">{{ typeText(row.type) }}</el-descriptions-item> <div>
<el-descriptions-item label="账号">{{ row.account || '-' }}</el-descriptions-item> <div class="detail-title">账号详情</div>
<el-descriptions-item label="密码">{{ row.password || '-' }}</el-descriptions-item> <div class="detail-subtitle">
<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>
</div> </div>
</el-descriptions-item> </div>
<el-descriptions-item label="备注"> <div class="header-actions">
<div class="remark-edit-wrap"> <el-button circle plain @click="closeDialog">×</el-button>
<el-input v-model="remarkText" type="textarea" :rows="3" placeholder="请输入备注" /> </div>
<el-button type="primary" size="small" :loading="saveLoading" @click="onSaveRemark"> </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> </el-button>
</div> </div>
</el-descriptions-item> <pre class="token-box">{{ row.token || "暂无 Token" }}</pre>
</el-descriptions> </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> </el-dialog>
</template> </template>
<style scoped> <style scoped>
.token-text { :deep(.pool-detail-dialog) {
word-break: break-all; max-width: calc(100vw - 28px);
white-space: pre-wrap; border-radius: 18px;
line-height: 1.6; 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; display: flex;
flex-direction: column; 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 { .copy-actions {
display: flex;
flex-wrap: wrap; flex-wrap: wrap;
gap: 8px; gap: 10px;
} }
.remark-edit-wrap .el-button { .copy-actions .el-button {
align-self: flex-start; margin: 0;
} }
:deep(.pool-detail-dialog) { .remark-display {
max-width: 560px; 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) { @media (max-width: 768px) {
@ -149,21 +569,32 @@ function copyToken() {
margin: 0 auto; margin: 0 auto;
} }
:deep(.pool-detail-dialog .el-dialog__header) {
padding: 14px 14px;
}
:deep(.pool-detail-dialog .el-dialog__body) { :deep(.pool-detail-dialog .el-dialog__body) {
padding: 12px; padding: 12px;
max-height: 70vh; max-height: 76vh;
overflow-y: auto; overflow-y: auto;
} }
:deep(.pool-detail-dialog .el-descriptions__label) { .detail-header,
width: 72px; .section-head {
word-break: break-all; align-items: flex-start;
white-space: normal;
} }
.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%; width: 100%;
align-self: stretch;
} }
} }
</style> </style>

View File

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

View File

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