整合数据
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
|
||||
<script setup>
|
||||
import { reactive, ref, watch } from 'vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
|
||||
@@ -22,8 +22,10 @@ const remarkText = ref("");
|
||||
const remarkDialogVisible = ref(false);
|
||||
const platformDialogVisible = ref(false);
|
||||
const unavailableDialogVisible = ref(false);
|
||||
const usableDialogVisible = ref(false);
|
||||
const unextractDialogVisible = ref(false);
|
||||
const platformForm = reactive({ platform: "local" });
|
||||
const usableForm = reactive({ usable: 1 });
|
||||
|
||||
const TYPE_MAP = {
|
||||
account: { label: "账号密码", type: "success" },
|
||||
@@ -82,6 +84,12 @@ watch(
|
||||
(row) => {
|
||||
remarkText.value = row?.remark || "";
|
||||
platformForm.platform = row?.extractedPlatform || "local";
|
||||
const raw = row?.isUsed;
|
||||
if (raw === null || raw === undefined || raw === "") {
|
||||
usableForm.usable = 1;
|
||||
} else {
|
||||
usableForm.usable = Number(raw) === 0 ? 0 : 1;
|
||||
}
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
@@ -107,6 +115,26 @@ function onSetUnavailable() {
|
||||
unavailableDialogVisible.value = false;
|
||||
}
|
||||
|
||||
function openUsableDialog() {
|
||||
const raw = props.row?.isUsed;
|
||||
if (raw === null || raw === undefined || raw === "") {
|
||||
usableForm.usable = 1;
|
||||
} else {
|
||||
usableForm.usable = Number(raw) === 0 ? 0 : 1;
|
||||
}
|
||||
usableDialogVisible.value = true;
|
||||
}
|
||||
|
||||
function onUpdateUsable() {
|
||||
if (!props.row?.id) return;
|
||||
emit("detail-action", {
|
||||
action: "usable",
|
||||
id: props.row.id,
|
||||
usable: usableForm.usable,
|
||||
});
|
||||
usableDialogVisible.value = false;
|
||||
}
|
||||
|
||||
function onUpdatePlatform() {
|
||||
if (!props.row?.id) return;
|
||||
emit("detail-action", {
|
||||
@@ -299,6 +327,9 @@ function copyAll() {
|
||||
</div>
|
||||
</div>
|
||||
<div class="copy-actions">
|
||||
<el-button type="success" plain @click="openUsableDialog">
|
||||
改可用状态
|
||||
</el-button>
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
@@ -334,6 +365,28 @@ function copyAll() {
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog
|
||||
v-model="usableDialogVisible"
|
||||
title="改可用状态"
|
||||
width="420px"
|
||||
append-to-body
|
||||
>
|
||||
<el-form label-width="84px">
|
||||
<el-form-item label="可用状态">
|
||||
<el-radio-group v-model="usableForm.usable">
|
||||
<el-radio :value="1">可用</el-radio>
|
||||
<el-radio :value="0">不可用</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="usableDialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" :loading="saveLoading" @click="onUpdateUsable">
|
||||
确认修改
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog
|
||||
v-model="unavailableDialogVisible"
|
||||
title="改不可用"
|
||||
|
||||
@@ -1,15 +1,7 @@
|
||||
<script setup>
|
||||
import {
|
||||
computed,
|
||||
h,
|
||||
nextTick,
|
||||
onMounted,
|
||||
onUnmounted,
|
||||
reactive,
|
||||
ref,
|
||||
watch,
|
||||
} from "vue";
|
||||
import { computed, h, nextTick, onMounted, onUnmounted, reactive, ref, watch } from "vue";
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
import { Loading } from "@element-plus/icons-vue";
|
||||
import Edit from "./components/edit.vue";
|
||||
import DetailDialog from "./components/detail.vue";
|
||||
import ExtractDialog from "./components/extract.vue";
|
||||
@@ -22,6 +14,7 @@ import {
|
||||
getAccountPoolList,
|
||||
updateAccountPoolRemark,
|
||||
setAccountPoolUnavailable,
|
||||
updateAccountPoolUsable,
|
||||
updateAccountPoolPlatform,
|
||||
unextractAccountPool,
|
||||
replenishAccountPool,
|
||||
@@ -29,6 +22,35 @@ import {
|
||||
} from "@/api/accountPool";
|
||||
|
||||
const moduleKey = "cursor";
|
||||
const PAGINATION_STORAGE_KEY = `accountPool:${moduleKey}:pagination`;
|
||||
|
||||
function loadStoredPagination() {
|
||||
try {
|
||||
const raw = sessionStorage.getItem(PAGINATION_STORAGE_KEY);
|
||||
if (!raw) return { page: 1, pageSize: 20 };
|
||||
const saved = JSON.parse(raw);
|
||||
const pageSize = Number(saved.pageSize);
|
||||
const page = Number(saved.page);
|
||||
return {
|
||||
page: Number.isFinite(page) && page >= 1 ? page : 1,
|
||||
pageSize: [20, 50, 100].includes(pageSize) ? pageSize : 20,
|
||||
};
|
||||
} catch {
|
||||
return { page: 1, pageSize: 20 };
|
||||
}
|
||||
}
|
||||
|
||||
function savePagination() {
|
||||
sessionStorage.setItem(
|
||||
PAGINATION_STORAGE_KEY,
|
||||
JSON.stringify({
|
||||
page: pagination.page,
|
||||
pageSize: pagination.pageSize,
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
const storedPagination = loadStoredPagination();
|
||||
|
||||
const loading = ref(false);
|
||||
const editVisible = ref(false);
|
||||
@@ -67,10 +89,24 @@ const selectedRows = ref([]);
|
||||
const detailRow = ref(null);
|
||||
const detailRemarkSaving = ref(false);
|
||||
const probeLoadingId = ref(null);
|
||||
const batchProbeDialogVisible = ref(false);
|
||||
const batchProbePhase = ref("running");
|
||||
const batchProbeProgress = reactive({
|
||||
total: 0,
|
||||
current: 0,
|
||||
currentId: null,
|
||||
percent: 0,
|
||||
});
|
||||
const batchProbeSummary = reactive({
|
||||
total: 0,
|
||||
available: 0,
|
||||
unavailable: 0,
|
||||
skipped: 0,
|
||||
});
|
||||
const isMobile = ref(false);
|
||||
const pagination = reactive({
|
||||
page: 1,
|
||||
pageSize: 20,
|
||||
page: storedPagination.page,
|
||||
pageSize: storedPagination.pageSize,
|
||||
});
|
||||
|
||||
/** 跳转未提取末页时跳过 watcher,避免先被重置到第 1 页 */
|
||||
@@ -97,15 +133,7 @@ const typeTabs = computed(() => {
|
||||
});
|
||||
|
||||
watch(
|
||||
() => [
|
||||
query.account,
|
||||
query.token,
|
||||
query.remark,
|
||||
query.status,
|
||||
query.platform,
|
||||
query.usable,
|
||||
activeTypeTab.value,
|
||||
],
|
||||
() => [query.account, query.token, query.remark, query.status, query.platform, query.usable, activeTypeTab.value],
|
||||
() => {
|
||||
if (skipWatchFetchDuringUnusedJump.value) return;
|
||||
pagination.page = 1;
|
||||
@@ -116,6 +144,7 @@ watch(
|
||||
watch(
|
||||
() => [pagination.page, pagination.pageSize],
|
||||
() => {
|
||||
savePagination();
|
||||
if (skipWatchFetchDuringUnusedJump.value) return;
|
||||
fetchList();
|
||||
},
|
||||
@@ -200,7 +229,7 @@ function buildCopyTextByRow(row) {
|
||||
if (row?.account) parts.push(row.account);
|
||||
if (row?.password) parts.push(row.password);
|
||||
if (row?.token) parts.push(row.token);
|
||||
return parts.join("\n");
|
||||
return parts.join('\n');
|
||||
}
|
||||
|
||||
function rowToText(row) {
|
||||
@@ -208,20 +237,20 @@ function rowToText(row) {
|
||||
if (row?.account) parts.push(row.account);
|
||||
if (row?.password) parts.push(row.password);
|
||||
if (row?.token) parts.push(row.token);
|
||||
return parts.join(" / ");
|
||||
return parts.join(' / ');
|
||||
}
|
||||
|
||||
async function copyToClipboard(text) {
|
||||
if (!text) {
|
||||
ElMessage.warning("无可复制内容");
|
||||
ElMessage.warning('无可复制内容');
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
await navigator.clipboard.writeText(text);
|
||||
ElMessage.success("已复制");
|
||||
ElMessage.success('已复制');
|
||||
return true;
|
||||
} catch (e) {
|
||||
ElMessage.error("复制失败,请检查浏览器权限");
|
||||
ElMessage.error('复制失败,请检查浏览器权限');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -289,6 +318,11 @@ async function handleDetailAction(payload) {
|
||||
let res;
|
||||
if (payload.action === "unavailable") {
|
||||
res = await setAccountPoolUnavailable(moduleKey, { id: payload.id });
|
||||
} else if (payload.action === "usable") {
|
||||
res = await updateAccountPoolUsable(moduleKey, {
|
||||
id: payload.id,
|
||||
usable: payload.usable,
|
||||
});
|
||||
} else if (payload.action === "platform") {
|
||||
res = await updateAccountPoolPlatform(moduleKey, {
|
||||
id: payload.id,
|
||||
@@ -395,20 +429,16 @@ function extractStatusTagType(row) {
|
||||
}
|
||||
|
||||
const tooltipOpts = {
|
||||
popperClass: "pool-tooltip",
|
||||
popperStyle: {
|
||||
maxWidth: "600px",
|
||||
wordBreak: "break-all",
|
||||
whiteSpace: "pre-wrap",
|
||||
},
|
||||
popperClass: 'pool-tooltip',
|
||||
popperStyle: { maxWidth: '600px', wordBreak: 'break-all', whiteSpace: 'pre-wrap' },
|
||||
};
|
||||
|
||||
const PLATFORM_MAP = {
|
||||
local: { label: "本地", type: "info" },
|
||||
xianyu: { label: "闲鱼", type: "warning" },
|
||||
pinduoduo: { label: "拼多多", type: "danger" },
|
||||
jingdong: { label: "京东", type: "primary" },
|
||||
douyin: { label: "抖音", type: "success" },
|
||||
local: { label: '本地', type: 'info' },
|
||||
xianyu: { label: '闲鱼', type: 'warning' },
|
||||
pinduoduo: { label: '拼多多', type: 'danger' },
|
||||
jingdong: { label: '京东', type: 'primary' },
|
||||
douyin: { label: '抖音', type: 'success' },
|
||||
};
|
||||
|
||||
function platformText(platform) {
|
||||
@@ -437,17 +467,12 @@ function isUsedTagType(isUsed) {
|
||||
function decodeJwtPayload(rawToken) {
|
||||
const token = String(rawToken || "").trim();
|
||||
if (!token) return null;
|
||||
const pureToken = token.includes("::")
|
||||
? token.split("::").pop().trim()
|
||||
: token;
|
||||
const pureToken = token.includes("::") ? token.split("::").pop().trim() : token;
|
||||
const parts = pureToken.split(".");
|
||||
if (parts.length < 2) return null;
|
||||
try {
|
||||
const base64 = parts[1].replace(/-/g, "+").replace(/_/g, "/");
|
||||
const padded = base64.padEnd(
|
||||
base64.length + ((4 - (base64.length % 4)) % 4),
|
||||
"=",
|
||||
);
|
||||
const padded = base64.padEnd(base64.length + ((4 - (base64.length % 4)) % 4), "=");
|
||||
const json = decodeURIComponent(
|
||||
atob(padded)
|
||||
.split("")
|
||||
@@ -554,8 +579,7 @@ async function fetchList() {
|
||||
remark: query.remark || 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,
|
||||
});
|
||||
if (res?.code !== 200) {
|
||||
@@ -565,6 +589,10 @@ async function fetchList() {
|
||||
const list = Array.isArray(res?.data?.list) ? res.data.list : [];
|
||||
tableData.value = list.map(normalizeRow);
|
||||
total.value = Number(res?.data?.total || 0);
|
||||
const maxPage = Math.max(1, Math.ceil(total.value / pagination.pageSize));
|
||||
if (pagination.page > maxPage) {
|
||||
pagination.page = maxPage;
|
||||
}
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
@@ -580,8 +608,7 @@ async function jumpToLastUnusedPage() {
|
||||
token: query.token || undefined,
|
||||
remark: query.remark || undefined,
|
||||
status: "unused",
|
||||
usable:
|
||||
query.usable === "1" || query.usable === "0" ? query.usable : undefined,
|
||||
usable: query.usable === "1" || query.usable === "0" ? query.usable : undefined,
|
||||
type,
|
||||
});
|
||||
if (res?.code !== 200) {
|
||||
@@ -609,44 +636,29 @@ function updateDeviceType() {
|
||||
|
||||
onMounted(() => {
|
||||
updateDeviceType();
|
||||
window.addEventListener("resize", updateDeviceType);
|
||||
window.addEventListener('resize', updateDeviceType);
|
||||
fetchList();
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
window.removeEventListener("resize", updateDeviceType);
|
||||
window.removeEventListener('resize', updateDeviceType);
|
||||
});
|
||||
|
||||
// ---- 接口说明数据 ----
|
||||
const BASE_URL = "https://api.yunzer.cn";
|
||||
|
||||
const paramDocs = [
|
||||
{
|
||||
name: "type",
|
||||
required: true,
|
||||
desc: "来源平台,用于标记本次提取来自哪个渠道",
|
||||
values: "xianyu / taobao / pinduoduo / jingdong / local",
|
||||
},
|
||||
{
|
||||
name: "module",
|
||||
required: true,
|
||||
desc: "号池模块,指定从哪个产品的号池提取",
|
||||
values: "cursor / windsurf / krio",
|
||||
},
|
||||
{
|
||||
name: "data_type",
|
||||
required: false,
|
||||
desc: "账号类型,不传则提取任意类型",
|
||||
values: "account / tk / account_tk",
|
||||
},
|
||||
{ name: 'type', required: true, desc: '来源平台,用于标记本次提取来自哪个渠道', values: 'xianyu / taobao / pinduoduo / jingdong / local' },
|
||||
{ name: 'module', required: true, desc: '号池模块,指定从哪个产品的号池提取', values: 'cursor / windsurf / krio' },
|
||||
{ name: 'data_type', required: false, desc: '账号类型,不传则提取任意类型', values: 'account / tk / account_tk' },
|
||||
];
|
||||
|
||||
const platformDocs = [
|
||||
{ value: "xianyu", label: "闲鱼", desc: "闲鱼平台发货调用" },
|
||||
{ value: "pinduoduo", label: "拼多多", desc: "拼多多平台发货调用" },
|
||||
{ value: "jingdong", label: "京东", desc: "京东平台发货调用" },
|
||||
{ value: "douyin", label: "抖音", desc: "抖音平台发货调用" },
|
||||
{ value: "local", label: "本地", desc: "本地手动调用" },
|
||||
{ value: 'xianyu', label: '闲鱼', desc: '闲鱼平台发货调用' },
|
||||
{ value: 'pinduoduo', label: '拼多多', desc: '拼多多平台发货调用' },
|
||||
{ value: 'jingdong', label: '京东', desc: '京东平台发货调用' },
|
||||
{ value: 'douyin', label: '抖音', desc: '抖音平台发货调用' },
|
||||
{ value: 'local', label: '本地', desc: '本地手动调用' },
|
||||
];
|
||||
|
||||
const moduleDocs = [
|
||||
@@ -700,48 +712,64 @@ function copyCardInfo(row) {
|
||||
if (row.account) parts.push(row.account);
|
||||
if (row.password) parts.push(row.password);
|
||||
if (row.token) parts.push(row.token);
|
||||
if (!parts.length) {
|
||||
ElMessage.warning("无可复制内容");
|
||||
return;
|
||||
}
|
||||
navigator.clipboard.writeText(parts.join("\n")).then(() => {
|
||||
ElMessage.success("已复制");
|
||||
if (!parts.length) { ElMessage.warning('无可复制内容'); return; }
|
||||
navigator.clipboard.writeText(parts.join('\n')).then(() => {
|
||||
ElMessage.success('已复制');
|
||||
});
|
||||
}
|
||||
|
||||
const CURSOR_PRO_LIMIT_TEXT =
|
||||
"Get Cursor Pro for more Agent usage, unlimited Tab, and more.";
|
||||
const CURSOR_PRO_LIMIT_TEXT = 'Get Cursor Pro for more Agent usage, unlimited Tab, and more.';
|
||||
|
||||
function formatCursorProbeDialogText(d) {
|
||||
const detail = String(d?.detail || "").trim();
|
||||
const rawPreview = String(d?.rawPreview || "").trim();
|
||||
const serverOutput = detail || rawPreview;
|
||||
|
||||
// 1. 优先以新版后端的 ok 字段(也就是底层探针的交叉判定结论)为核心准则
|
||||
if (d && typeof d.ok === "boolean") {
|
||||
if (d.ok) {
|
||||
return serverOutput || "该TOKEN可用";
|
||||
}
|
||||
return `该TOKEN已用完 (${detail || rawPreview || "额度枯竭"})`;
|
||||
if (d && typeof d.ok === 'boolean') {
|
||||
return d.ok ? '该TOKEN可用' : `该TOKEN已用完 (${d.detail || '额度枯竭'})`;
|
||||
}
|
||||
|
||||
// 2. 兼容旧数据的兜底检测
|
||||
const CURSOR_PRO_LIMIT_TEXT =
|
||||
"Get Cursor Pro for more Agent usage, unlimited Tab, and more.";
|
||||
|
||||
if (
|
||||
detail.includes(CURSOR_PRO_LIMIT_TEXT) ||
|
||||
rawPreview.includes(CURSOR_PRO_LIMIT_TEXT)
|
||||
) {
|
||||
return `该TOKEN已用完 (${detail || rawPreview})`;
|
||||
const CURSOR_PRO_LIMIT_TEXT = 'Get Cursor Pro for more Agent usage, unlimited Tab, and more.';
|
||||
const detail = String(d?.detail || '');
|
||||
const rawPreview = String(d?.rawPreview || '');
|
||||
|
||||
if (detail.includes(CURSOR_PRO_LIMIT_TEXT) || rawPreview.includes(CURSOR_PRO_LIMIT_TEXT)) {
|
||||
return '该TOKEN已用完';
|
||||
}
|
||||
|
||||
return '该TOKEN可用';
|
||||
}
|
||||
|
||||
return serverOutput || "该TOKEN可用";
|
||||
function formatCursorProbeDetail(d) {
|
||||
if (!d) return '';
|
||||
|
||||
const parts = [];
|
||||
|
||||
// 提取关键信息
|
||||
if (d.httpStatus) parts.push(`HTTP状态: ${d.httpStatus}`);
|
||||
if (d.endpoint) parts.push(`接口: ${d.endpoint}`);
|
||||
if (d.probeMessage) parts.push(`探测方式: ${d.probeMessage}`);
|
||||
if (d.bytesRead) parts.push(`响应大小: ${d.bytesRead} 字节`);
|
||||
if (d.streamProtocol) parts.push(`协议: ${d.streamProtocol}`);
|
||||
|
||||
// 提取检测结论
|
||||
if (d.detail) {
|
||||
// 解析流匹配信息
|
||||
const matchPrefix = '流中匹配:';
|
||||
if (d.detail.includes(matchPrefix)) {
|
||||
const matchStart = d.detail.indexOf(matchPrefix);
|
||||
const matchEnd = d.detail.indexOf(';', matchStart);
|
||||
const matchText = matchEnd > 0 ? d.detail.substring(matchStart, matchEnd) : d.detail.substring(matchStart);
|
||||
parts.push(`检测结论: ${matchText}`);
|
||||
} else {
|
||||
parts.push(`检测结论: ${d.detail}`);
|
||||
}
|
||||
}
|
||||
|
||||
return parts.join('\n');
|
||||
}
|
||||
|
||||
async function handleProbeToken(row) {
|
||||
if (!row?.token) {
|
||||
ElMessage.warning("该行无 Token");
|
||||
ElMessage.warning('该行无 Token');
|
||||
return;
|
||||
}
|
||||
probeLoadingId.value = row.id;
|
||||
@@ -751,17 +779,50 @@ async function handleProbeToken(row) {
|
||||
accessToken: row.token,
|
||||
});
|
||||
if (res?.code !== 200) {
|
||||
ElMessage.error(res?.msg || "探测失败");
|
||||
ElMessage.error(res?.msg || '探测失败');
|
||||
return;
|
||||
}
|
||||
const d = res?.data || {};
|
||||
const text = formatCursorProbeDialogText(d);
|
||||
const isOk = d.ok === true;
|
||||
|
||||
// 构建详细信息
|
||||
const detailItems = [];
|
||||
if (d.httpStatus) detailItems.push(`HTTP状态: ${d.httpStatus}`);
|
||||
if (d.endpoint) detailItems.push(`接口: ${d.endpoint}`);
|
||||
if (d.probeMessage) detailItems.push(`探测方式: ${d.probeMessage}`);
|
||||
if (d.bytesRead) detailItems.push(`响应大小: ${d.bytesRead} 字节`);
|
||||
if (d.streamProtocol) detailItems.push(`协议: ${d.streamProtocol}`);
|
||||
|
||||
// 提取检测结论(从 detail 字段)
|
||||
if (d.detail) {
|
||||
const matchPrefix = '流中匹配:';
|
||||
if (d.detail.includes(matchPrefix)) {
|
||||
const matchStart = d.detail.indexOf(matchPrefix);
|
||||
const matchEnd = d.detail.indexOf(';', matchStart);
|
||||
const matchText = matchEnd > 0 ? d.detail.substring(matchStart, matchEnd) : d.detail.substring(matchStart);
|
||||
detailItems.push(`检测结论: ${matchText}`);
|
||||
} else {
|
||||
detailItems.push(`检测结论: ${d.detail}`);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
await ElMessageBox({
|
||||
title: "检测结果",
|
||||
message: h("div", { class: "cursor-probe-result" }, text),
|
||||
confirmButtonText: "关闭",
|
||||
customClass: "cursor-probe-dialog",
|
||||
title: isOk ? '检测结果 - 可用' : '检测结果 - 不可用',
|
||||
message: h('div', { class: 'cursor-probe-result cursor-expire-result' }, [
|
||||
h('div', {
|
||||
style: `text-align:center;font-size:18px;font-weight:700;margin-bottom:12px;color:${isOk ? '#67c23a' : '#f56c6c'}`
|
||||
}, text),
|
||||
detailItems.length > 0 ? h('div', {
|
||||
style: 'text-align:left;font-size:13px;color:#606266;margin-bottom:8px;line-height:1.8'
|
||||
}, detailItems.map(item => h('div', null, `• ${item}`))) : null,
|
||||
d.streamNote ? h('div', {
|
||||
style: 'text-align:left;font-size:12px;color:#909399;margin-top:8px;padding:8px;background:#f5f7fa;border-radius:4px;white-space:pre-wrap;line-height:1.6;'
|
||||
}, d.streamNote) : null,
|
||||
]),
|
||||
confirmButtonText: '关闭',
|
||||
customClass: 'cursor-probe-dialog',
|
||||
closeOnClickModal: true,
|
||||
});
|
||||
} catch {
|
||||
@@ -769,7 +830,7 @@ async function handleProbeToken(row) {
|
||||
}
|
||||
await fetchList();
|
||||
} catch {
|
||||
ElMessage.error("探测请求失败");
|
||||
ElMessage.error('探测请求失败');
|
||||
} finally {
|
||||
probeLoadingId.value = null;
|
||||
}
|
||||
@@ -786,7 +847,8 @@ async function handleBatchProbe() {
|
||||
return;
|
||||
}
|
||||
const skipped = selectedRows.value.length - rows.length;
|
||||
const skipHint = skipped > 0 ? `(已跳过 ${skipped} 条无 Token)` : "";
|
||||
const skipHint =
|
||||
skipped > 0 ? `(已跳过 ${skipped} 条无 Token)` : "";
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
`将对 ${rows.length} 条 Token进行检测,是否继续?${skipHint}`,
|
||||
@@ -796,36 +858,61 @@ async function handleBatchProbe() {
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
loading.value = true;
|
||||
let ok = 0;
|
||||
let fail = 0;
|
||||
|
||||
let available = 0;
|
||||
let unavailable = 0;
|
||||
|
||||
batchProbePhase.value = "running";
|
||||
batchProbeProgress.total = rows.length;
|
||||
batchProbeProgress.current = 0;
|
||||
batchProbeProgress.currentId = null;
|
||||
batchProbeProgress.percent = 0;
|
||||
batchProbeDialogVisible.value = true;
|
||||
await nextTick();
|
||||
|
||||
try {
|
||||
for (const row of rows) {
|
||||
for (let i = 0; i < rows.length; i += 1) {
|
||||
const row = rows[i];
|
||||
batchProbeProgress.current = i + 1;
|
||||
batchProbeProgress.currentId = row.id;
|
||||
batchProbeProgress.percent = Math.round((i / rows.length) * 100);
|
||||
await nextTick();
|
||||
|
||||
try {
|
||||
const res = await probeAccountPoolToken(moduleKey, {
|
||||
id: row.id,
|
||||
accessToken: row.token,
|
||||
});
|
||||
if (res?.code === 200) {
|
||||
ok += 1;
|
||||
if (res?.code === 200 && res?.data?.ok === true) {
|
||||
available += 1;
|
||||
} else {
|
||||
fail += 1;
|
||||
unavailable += 1;
|
||||
}
|
||||
} catch {
|
||||
fail += 1;
|
||||
unavailable += 1;
|
||||
}
|
||||
|
||||
batchProbeProgress.percent = Math.round(((i + 1) / rows.length) * 100);
|
||||
await nextTick();
|
||||
}
|
||||
if (fail > 0) {
|
||||
ElMessage.warning(`批量检测完成:成功 ${ok} 条,失败 ${fail} 条`);
|
||||
} else {
|
||||
ElMessage.success(`批量检测完成:共 ${ok} 条`);
|
||||
}
|
||||
|
||||
batchProbeSummary.total = rows.length;
|
||||
batchProbeSummary.available = available;
|
||||
batchProbeSummary.unavailable = unavailable;
|
||||
batchProbeSummary.skipped = skipped;
|
||||
batchProbePhase.value = "done";
|
||||
await fetchList();
|
||||
} finally {
|
||||
loading.value = false;
|
||||
} catch {
|
||||
batchProbeDialogVisible.value = false;
|
||||
ElMessage.error("批量检测异常");
|
||||
}
|
||||
}
|
||||
|
||||
function closeBatchProbeDialog() {
|
||||
batchProbeDialogVisible.value = false;
|
||||
batchProbePhase.value = "running";
|
||||
}
|
||||
|
||||
// async function handleBatchProbeExpireTime() {
|
||||
// if (!selectedRows.value.length) {
|
||||
// ElMessage.warning("请先选择数据");
|
||||
@@ -876,6 +963,7 @@ async function handleBatchProbe() {
|
||||
// closeOnClickModal: true,
|
||||
// });
|
||||
// }
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -951,12 +1039,8 @@ async function handleBatchProbe() {
|
||||
<el-button @click="resetQuery">重置</el-button>
|
||||
</div>
|
||||
<div class="toolbar-right">
|
||||
<el-button type="primary" @click="openAddDialog('single')"
|
||||
>添加账号</el-button
|
||||
>
|
||||
<el-button type="success" @click="openAddDialog('batch')"
|
||||
>批量添加</el-button
|
||||
>
|
||||
<el-button type="primary" @click="openAddDialog('single')">添加账号</el-button>
|
||||
<el-button type="success" @click="openAddDialog('batch')">批量添加</el-button>
|
||||
<el-button @click="replenishVisible = true">补号</el-button>
|
||||
<el-button @click="markExtractForSelected">批量提取</el-button>
|
||||
<el-button plain @click="handleBatchProbe">批量检测</el-button>
|
||||
@@ -984,108 +1068,84 @@ async function handleBatchProbe() {
|
||||
:loading="loading"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" width="52" />
|
||||
<el-table-column prop="id" label="ID" width="80" />
|
||||
<el-table-column label="账号类型" width="160" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag>{{ typeText(row.type) }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="account"
|
||||
label="账号"
|
||||
min-width="180"
|
||||
show-overflow-tooltip
|
||||
:tooltip-options="tooltipOpts"
|
||||
/>
|
||||
<!-- <el-table-column prop="password" label="密码" min-width="160" show-overflow-tooltip :tooltip-options="tooltipOpts">
|
||||
<el-table-column type="selection" width="52" />
|
||||
<el-table-column prop="id" label="ID" width="80" />
|
||||
<el-table-column label="账号类型" width="160" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag>{{ typeText(row.type) }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="account" label="账号" min-width="180" show-overflow-tooltip :tooltip-options="tooltipOpts" />
|
||||
<!-- <el-table-column prop="password" label="密码" min-width="160" show-overflow-tooltip :tooltip-options="tooltipOpts">
|
||||
<template #default="{ row }">{{ row.password || '-' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="Token" min-width="200" show-overflow-tooltip :tooltip-options="tooltipOpts">
|
||||
<template #default="{ row }">{{ row.token || '-' }}</template>
|
||||
</el-table-column> -->
|
||||
<el-table-column label="提取状态" width="100">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="extractStatusTagType(row)">
|
||||
{{ extractStatusLabel(row) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="探测可用" width="100" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="isUsedTagType(row.isUsed)" size="small">
|
||||
{{ isUsedLabel(row.isUsed) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column
|
||||
label="accessToken失效时间"
|
||||
width="190"
|
||||
align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-tag
|
||||
:type="accessTokenExpireTagType(row.accessTokenExpireStatus)"
|
||||
size="small"
|
||||
>
|
||||
{{ row.accessTokenExpireText || "-" }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<el-table-column label="提取平台" width="120">
|
||||
<template #default="{ row }">
|
||||
<el-tag
|
||||
v-if="row.extractedPlatform"
|
||||
:type="platformTagType(row.extractedPlatform)"
|
||||
size="small"
|
||||
>
|
||||
{{ platformText(row.extractedPlatform) }}
|
||||
</el-tag>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="extractedAt" label="提取时间" width="180" />
|
||||
<el-table-column
|
||||
prop="remark"
|
||||
label="备注"
|
||||
min-width="140"
|
||||
show-overflow-tooltip
|
||||
:tooltip-options="tooltipOpts"
|
||||
/>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
width="300"
|
||||
fixed="right"
|
||||
align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
v-if="row.token"
|
||||
link
|
||||
type="info"
|
||||
:loading="probeLoadingId === row.id"
|
||||
@click="handleProbeToken(row)"
|
||||
>检测</el-button
|
||||
>
|
||||
<el-button link type="primary" @click="openDetail(row)"
|
||||
>详情</el-button
|
||||
>
|
||||
<el-button
|
||||
v-if="!row.extractedAt && !row.extracted"
|
||||
link
|
||||
type="warning"
|
||||
@click="openExtractByRow(row)"
|
||||
>提取</el-button
|
||||
>
|
||||
<el-button
|
||||
v-if="row.extracted"
|
||||
link
|
||||
type="success"
|
||||
@click="copyCardInfo(row)"
|
||||
>复制</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="提取状态" width="100">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="extractStatusTagType(row)">
|
||||
{{ extractStatusLabel(row) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="探测可用" width="100" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="isUsedTagType(row.isUsed)" size="small">
|
||||
{{ isUsedLabel(row.isUsed) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="accessToken失效时间" width="190" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="accessTokenExpireTagType(row.accessTokenExpireStatus)" size="small">
|
||||
{{ row.accessTokenExpireText || "-" }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<el-table-column label="提取平台" width="120">
|
||||
<template #default="{ row }">
|
||||
<el-tag
|
||||
v-if="row.extractedPlatform"
|
||||
:type="platformTagType(row.extractedPlatform)"
|
||||
size="small"
|
||||
>
|
||||
{{ platformText(row.extractedPlatform) }}
|
||||
</el-tag>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="extractedAt" label="提取时间" width="180" />
|
||||
<el-table-column prop="remark" label="备注" min-width="140" show-overflow-tooltip :tooltip-options="tooltipOpts" />
|
||||
<el-table-column label="操作" width="300" fixed="right" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
v-if="row.token"
|
||||
link
|
||||
type="info"
|
||||
:loading="probeLoadingId === row.id"
|
||||
@click="handleProbeToken(row)"
|
||||
>检测</el-button
|
||||
>
|
||||
<el-button link type="primary" @click="openDetail(row)"
|
||||
>详情</el-button
|
||||
>
|
||||
<el-button
|
||||
v-if="!row.extractedAt && !row.extracted"
|
||||
link
|
||||
type="warning"
|
||||
@click="openExtractByRow(row)"
|
||||
>提取</el-button
|
||||
>
|
||||
<el-button
|
||||
v-if="row.extracted"
|
||||
link
|
||||
type="success"
|
||||
@click="copyCardInfo(row)"
|
||||
>复制</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
@@ -1094,9 +1154,7 @@ async function handleBatchProbe() {
|
||||
v-model:current-page="pagination.page"
|
||||
v-model:page-size="pagination.pageSize"
|
||||
background
|
||||
:layout="
|
||||
isMobile ? 'prev, pager, next' : 'total, prev, pager, next, jumper'
|
||||
"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:page-sizes="[20, 50, 100]"
|
||||
:total="total"
|
||||
/>
|
||||
@@ -1148,9 +1206,7 @@ async function handleBatchProbe() {
|
||||
destroy-on-close
|
||||
>
|
||||
<el-alert type="info" :closable="false" style="margin-bottom: 12px">
|
||||
将对已选的
|
||||
<strong>{{ selectedRows.length }}</strong>
|
||||
条记录执行提取并标记为已提取。
|
||||
将对已选的 <strong>{{ selectedRows.length }}</strong> 条记录执行提取并标记为已提取。
|
||||
</el-alert>
|
||||
<el-form label-width="84px">
|
||||
<el-form-item label="提取平台">
|
||||
@@ -1174,16 +1230,67 @@ async function handleBatchProbe() {
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="batchExtractVisible = false">取消</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
:loading="loading"
|
||||
@click="handleBatchExtract"
|
||||
>
|
||||
<el-button type="primary" :loading="loading" @click="handleBatchExtract">
|
||||
确认提取
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog
|
||||
v-model="batchProbeDialogVisible"
|
||||
:title="batchProbePhase === 'running' ? '批量检测中' : '批量检测结果'"
|
||||
width="440px"
|
||||
align-center
|
||||
:close-on-click-modal="false"
|
||||
:close-on-press-escape="false"
|
||||
:show-close="batchProbePhase === 'done'"
|
||||
@close="closeBatchProbeDialog"
|
||||
>
|
||||
<div v-if="batchProbePhase === 'running'" class="batch-probe-progress">
|
||||
<div class="batch-probe-icon">
|
||||
<el-icon class="is-loading" :size="36" color="#409eff">
|
||||
<Loading />
|
||||
</el-icon>
|
||||
</div>
|
||||
<el-progress
|
||||
:percentage="batchProbeProgress.percent"
|
||||
:stroke-width="14"
|
||||
striped
|
||||
striped-flow
|
||||
:duration="8"
|
||||
/>
|
||||
<div class="batch-probe-status">
|
||||
正在检测第 {{ batchProbeProgress.current }} / {{ batchProbeProgress.total }} 条
|
||||
</div>
|
||||
<div v-if="batchProbeProgress.currentId" class="batch-probe-id">
|
||||
当前 ID:{{ batchProbeProgress.currentId }}
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="batch-probe-summary">
|
||||
<div class="batch-probe-summary-title">检测完成</div>
|
||||
<div class="batch-probe-summary-grid">
|
||||
<div class="summary-item">
|
||||
<span class="summary-label">共检测</span>
|
||||
<span class="summary-value">{{ batchProbeSummary.total }} 条</span>
|
||||
</div>
|
||||
<div class="summary-item available">
|
||||
<span class="summary-label">可用</span>
|
||||
<span class="summary-value">{{ batchProbeSummary.available }} 条</span>
|
||||
</div>
|
||||
<div class="summary-item unavailable">
|
||||
<span class="summary-label">失效</span>
|
||||
<span class="summary-value">{{ batchProbeSummary.unavailable }} 条</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="batchProbeSummary.skipped > 0" class="batch-probe-skipped">
|
||||
已跳过无 Token {{ batchProbeSummary.skipped }} 条
|
||||
</div>
|
||||
</div>
|
||||
<template v-if="batchProbePhase === 'done'" #footer>
|
||||
<el-button type="primary" @click="closeBatchProbeDialog">关闭</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 接口说明抽屉 -->
|
||||
<el-drawer
|
||||
v-model="apiDocVisible"
|
||||
@@ -1337,7 +1444,7 @@ async function handleBatchProbe() {
|
||||
}
|
||||
|
||||
:deep(.pool-batch-extract-dialog) {
|
||||
max-width: 420px;
|
||||
max-width: 600px;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
@@ -1375,6 +1482,12 @@ async function handleBatchProbe() {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.pager :deep(.el-pagination) {
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
row-gap: 8px;
|
||||
}
|
||||
|
||||
:deep(.pool-batch-extract-dialog) {
|
||||
width: calc(100vw - 24px) !important;
|
||||
margin: 0 auto;
|
||||
@@ -1398,6 +1511,7 @@ async function handleBatchProbe() {
|
||||
gap: 12px;
|
||||
padding: 8px 12px 12px;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* 接口说明抽屉 */
|
||||
@@ -1501,6 +1615,88 @@ async function handleBatchProbe() {
|
||||
font-size: 12px;
|
||||
color: #409eff;
|
||||
}
|
||||
|
||||
.batch-probe-progress {
|
||||
padding: 8px 4px 4px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.batch-probe-icon {
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
|
||||
.batch-probe-status {
|
||||
margin-top: 16px;
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.batch-probe-id {
|
||||
margin-top: 8px;
|
||||
font-size: 13px;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
.batch-probe-summary {
|
||||
padding: 8px 4px 4px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.batch-probe-summary-title {
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
color: #303133;
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
|
||||
.batch-probe-summary-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.summary-item {
|
||||
padding: 14px 10px;
|
||||
border-radius: 12px;
|
||||
background: #f5f7fa;
|
||||
}
|
||||
|
||||
.summary-item.available {
|
||||
background: #f0f9eb;
|
||||
}
|
||||
|
||||
.summary-item.unavailable {
|
||||
background: #fef0f0;
|
||||
}
|
||||
|
||||
.summary-label {
|
||||
display: block;
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
.summary-value {
|
||||
display: block;
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.summary-item.available .summary-value {
|
||||
color: #67c23a;
|
||||
}
|
||||
|
||||
.summary-item.unavailable .summary-value {
|
||||
color: #f56c6c;
|
||||
}
|
||||
|
||||
.batch-probe-skipped {
|
||||
margin-top: 14px;
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style>
|
||||
@@ -1516,16 +1712,14 @@ async function handleBatchProbe() {
|
||||
/* Cursor 探测结果弹窗(teleport 到 body,需非 scoped) */
|
||||
.cursor-probe-dialog .el-message-box__message {
|
||||
padding: 12px 8px 4px;
|
||||
width: 100%;
|
||||
}
|
||||
.cursor-probe-dialog .cursor-probe-result {
|
||||
margin: 0;
|
||||
max-height: 420px;
|
||||
overflow: auto;
|
||||
text-align: left;
|
||||
font-size: 14px;
|
||||
text-align: center;
|
||||
font-size: 16px;
|
||||
line-height: 1.6;
|
||||
font-weight: 500;
|
||||
white-space: pre-wrap;
|
||||
font-weight: 600;
|
||||
word-break: break-all;
|
||||
}
|
||||
.cursor-probe-dialog .cursor-expire-result {
|
||||
|
||||
Reference in New Issue
Block a user