first commit
This commit is contained in:
@@ -0,0 +1,204 @@
|
||||
<script setup>
|
||||
import { reactive, ref, watch } from 'vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { extractAccountPool } from '@/api/accountPool';
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
/** cursor / windsurf / krio */
|
||||
module: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
platformMap: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
/** 打开弹窗时的默认账号类型(与列表 Tab 对齐:全部时用 account) */
|
||||
defaultAccountType: {
|
||||
type: String,
|
||||
default: 'account',
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(['update:modelValue', 'success']);
|
||||
|
||||
const confirmLoading = ref(false);
|
||||
const copiedText = ref('');
|
||||
const form = reactive({
|
||||
platform: 'local',
|
||||
type: 'account',
|
||||
remark: '',
|
||||
});
|
||||
|
||||
function normalizeRow(raw) {
|
||||
const pick = (...keys) => {
|
||||
for (const key of keys) {
|
||||
if (raw?.[key] !== undefined && raw?.[key] !== null) return raw[key];
|
||||
}
|
||||
return '';
|
||||
};
|
||||
const pickNullable = (...keys) => {
|
||||
for (const key of keys) {
|
||||
if (raw?.[key] !== undefined) return raw[key] ?? null;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
const formatTime = (val) => {
|
||||
if (!val) return '';
|
||||
const d = new Date(val);
|
||||
if (isNaN(d)) return val;
|
||||
const p = (v) => String(v).padStart(2, '0');
|
||||
return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}:${p(d.getSeconds())}`;
|
||||
};
|
||||
const st = Number(pick('is_extracted', 'isExtracted', 'IsExtracted'));
|
||||
const extractStatus = Number.isFinite(st) ? st : 0;
|
||||
return {
|
||||
id: pick('id', 'Id', 'ID'),
|
||||
type: pick('data_type', 'dataType', 'type'),
|
||||
account: pick('account', 'Account'),
|
||||
password: pick('password', 'Password'),
|
||||
token: pick('token', 'Token'),
|
||||
remark: pick('remark', 'Remark'),
|
||||
extractStatus,
|
||||
extracted: extractStatus !== 0,
|
||||
extractedAt: formatTime(pickNullable('extracted_time', 'extractedAt')),
|
||||
extractedPlatform: pickNullable('extracted_platform', 'extractedPlatform'),
|
||||
createdAt: formatTime(pick('create_time', 'createdAt')),
|
||||
};
|
||||
}
|
||||
|
||||
function buildCopyTextByRow(row) {
|
||||
const parts = [];
|
||||
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');
|
||||
}
|
||||
|
||||
async function copyToClipboard(text) {
|
||||
if (!text) {
|
||||
ElMessage.warning('无可复制内容');
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
await navigator.clipboard.writeText(text);
|
||||
ElMessage.success('已复制');
|
||||
return true;
|
||||
} catch (e) {
|
||||
ElMessage.error('复制失败,请检查浏览器权限');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function resetWhenOpen() {
|
||||
form.platform = 'local';
|
||||
form.type = props.defaultAccountType || 'account';
|
||||
form.remark = '';
|
||||
copiedText.value = '';
|
||||
}
|
||||
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
(visible) => {
|
||||
if (visible) resetWhenOpen();
|
||||
}
|
||||
);
|
||||
|
||||
function close() {
|
||||
emit('update:modelValue', false);
|
||||
}
|
||||
|
||||
async function handleConfirm() {
|
||||
confirmLoading.value = true;
|
||||
try {
|
||||
const res = await extractAccountPool(props.module, {
|
||||
id: 0,
|
||||
type: form.type,
|
||||
platform: form.platform,
|
||||
remark: form.remark || '',
|
||||
});
|
||||
if (res?.code !== 200) {
|
||||
ElMessage.error(res?.msg || '补卡失败');
|
||||
return;
|
||||
}
|
||||
const extractedRow = normalizeRow(res?.data || {});
|
||||
const text = buildCopyTextByRow(extractedRow);
|
||||
copiedText.value = text;
|
||||
const copied = await copyToClipboard(text);
|
||||
emit('success');
|
||||
if (copied) close();
|
||||
} finally {
|
||||
confirmLoading.value = false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<el-dialog
|
||||
:model-value="modelValue"
|
||||
title="补卡"
|
||||
width="520px"
|
||||
:close-on-click-modal="false"
|
||||
@update:model-value="emit('update:modelValue', $event)"
|
||||
>
|
||||
<el-form label-width="92px">
|
||||
<el-form-item label="账号类型">
|
||||
<el-select v-model="form.type" placeholder="请选择账号类型" class="field-full">
|
||||
<el-option label="账号密码" value="account" />
|
||||
<el-option label="账号密码+Token" value="account_tk" />
|
||||
<el-option label="Token" value="tk" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="提取平台">
|
||||
<el-select v-model="form.platform" placeholder="请选择平台" class="field-full">
|
||||
<el-option
|
||||
v-for="(meta, key) in platformMap"
|
||||
:key="key"
|
||||
:label="meta.label"
|
||||
:value="key"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注">
|
||||
<el-input
|
||||
v-model="form.remark"
|
||||
class="field-full"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
placeholder="可选"
|
||||
maxlength="200"
|
||||
show-word-limit
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="copiedText" label="复制内容">
|
||||
<el-input v-model="copiedText" type="textarea" :rows="4" readonly />
|
||||
<div class="patch-copy-actions">
|
||||
<el-button @click="copyToClipboard(copiedText)">复制</el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="close">取消</el-button>
|
||||
<el-button type="primary" :loading="confirmLoading" @click="handleConfirm">
|
||||
确定并复制
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.field-full {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.patch-copy-actions {
|
||||
margin-top: 8px;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,600 @@
|
||||
<script setup>
|
||||
import { computed, reactive, ref, watch } from "vue";
|
||||
import { ElMessage } from "element-plus";
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
row: {
|
||||
type: Object,
|
||||
default: null,
|
||||
},
|
||||
saveLoading: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(["update:modelValue", "save-remark", "detail-action"]);
|
||||
const remarkText = ref("");
|
||||
const remarkDialogVisible = ref(false);
|
||||
const platformDialogVisible = ref(false);
|
||||
const unavailableDialogVisible = ref(false);
|
||||
const unextractDialogVisible = ref(false);
|
||||
const platformForm = reactive({ platform: "local" });
|
||||
|
||||
const TYPE_MAP = {
|
||||
account: { label: "账号密码", type: "success" },
|
||||
account_tk: { label: "账号密码+Token", type: "primary" },
|
||||
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 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 typeInfo = computed(() => {
|
||||
return (
|
||||
TYPE_MAP[props.row?.type] || { label: props.row?.type || "-", type: "info" }
|
||||
);
|
||||
});
|
||||
|
||||
const platformInfo = computed(() => {
|
||||
const key = props.row?.extractedPlatform;
|
||||
if (!key) return { label: "-", type: "info" };
|
||||
return PLATFORM_MAP[key] || { label: key, type: "info" };
|
||||
});
|
||||
|
||||
const isUsedInfo = computed(() => {
|
||||
const raw = props.row?.isUsed;
|
||||
if (raw === null || raw === undefined || raw === "") {
|
||||
return { label: "未探测", type: "info" };
|
||||
}
|
||||
const n = Number(raw);
|
||||
if (n === 1) return { label: "可用", type: "success" };
|
||||
if (n === 0) return { label: "已用完", type: "danger" };
|
||||
return { label: String(raw), type: "info" };
|
||||
});
|
||||
|
||||
const hasAccountPassword = computed(
|
||||
() => !!(props.row?.account || props.row?.password),
|
||||
);
|
||||
const hasToken = computed(() => !!props.row?.token);
|
||||
|
||||
watch(
|
||||
() => props.row,
|
||||
(row) => {
|
||||
remarkText.value = row?.remark || "";
|
||||
platformForm.platform = row?.extractedPlatform || "local";
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
function closeDialog() {
|
||||
emit("update:modelValue", false);
|
||||
}
|
||||
|
||||
function openRemarkDialog() {
|
||||
remarkText.value = props.row?.remark || "";
|
||||
remarkDialogVisible.value = true;
|
||||
}
|
||||
|
||||
function onSaveRemark() {
|
||||
if (!props.row?.id) return;
|
||||
emit("save-remark", { id: props.row.id, remark: remarkText.value || "" });
|
||||
remarkDialogVisible.value = false;
|
||||
}
|
||||
|
||||
function onSetUnavailable() {
|
||||
if (!props.row?.id) return;
|
||||
emit("detail-action", { action: "unavailable", id: props.row.id });
|
||||
unavailableDialogVisible.value = false;
|
||||
}
|
||||
|
||||
function onUpdatePlatform() {
|
||||
if (!props.row?.id) return;
|
||||
emit("detail-action", {
|
||||
action: "platform",
|
||||
id: props.row.id,
|
||||
platform: platformForm.platform,
|
||||
});
|
||||
platformDialogVisible.value = false;
|
||||
}
|
||||
|
||||
function onUnextract() {
|
||||
if (!props.row?.id) return;
|
||||
emit("detail-action", { action: "unextract", id: props.row.id });
|
||||
unextractDialogVisible.value = false;
|
||||
}
|
||||
|
||||
async function copyText(text, successText) {
|
||||
const val = String(text || "").trim();
|
||||
if (!val) {
|
||||
ElMessage.warning("暂无可复制内容");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await navigator.clipboard.writeText(val);
|
||||
ElMessage.success(successText || "已复制");
|
||||
} catch {
|
||||
ElMessage.error("复制失败,请检查浏览器权限");
|
||||
}
|
||||
}
|
||||
|
||||
function copyAccountPassword() {
|
||||
const parts = [];
|
||||
if (props.row?.account) parts.push(props.row.account);
|
||||
if (props.row?.password) parts.push(props.row.password);
|
||||
copyText(parts.join("\n"), "已复制账号+密码");
|
||||
}
|
||||
|
||||
function copyToken() {
|
||||
copyText(props.row?.token, "已复制 Token");
|
||||
}
|
||||
|
||||
function copyAll() {
|
||||
const parts = [];
|
||||
if (props.row?.account) parts.push(`账号:${props.row.account}`);
|
||||
if (props.row?.password) parts.push(`密码:${props.row.password}`);
|
||||
if (props.row?.token) parts.push(`Token:${props.row.token}`);
|
||||
copyText(parts.join("\n"), "已复制完整账号信息");
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<el-dialog
|
||||
class="pool-detail-dialog"
|
||||
:model-value="modelValue"
|
||||
width="760px"
|
||||
destroy-on-close
|
||||
:show-close="false"
|
||||
@update:model-value="(v) => emit('update:modelValue', v)"
|
||||
>
|
||||
<template #header>
|
||||
<div class="detail-header">
|
||||
<div>
|
||||
<div class="detail-title">账号详情</div>
|
||||
<div class="detail-subtitle">
|
||||
通过弹窗执行账号状态、平台、备注等维护操作
|
||||
</div>
|
||||
</div>
|
||||
<div class="header-actions">
|
||||
<el-button circle plain @click="closeDialog">×</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div v-if="row" class="detail-body">
|
||||
<div class="info-grid">
|
||||
<div class="info-card">
|
||||
<div class="info-label">ID</div>
|
||||
<div class="info-value">{{ row?.id || "-" }}</div>
|
||||
</div>
|
||||
<div class="info-card">
|
||||
<div class="info-label">账号类型</div>
|
||||
<div class="info-value">
|
||||
<el-tag :type="typeInfo.type" round>{{ typeInfo.label }}</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
<div class="info-card">
|
||||
<div class="info-label">提取状态</div>
|
||||
<div class="info-value">
|
||||
<el-tag :type="statusInfo.type" effect="dark" round>
|
||||
{{ statusInfo.label }}
|
||||
</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
<div class="info-card">
|
||||
<div class="info-label">提取平台</div>
|
||||
<div class="info-value">
|
||||
<el-tag
|
||||
v-if="row.extractedPlatform"
|
||||
:type="platformInfo.type"
|
||||
size="small"
|
||||
>
|
||||
{{ platformInfo.label }}
|
||||
</el-tag>
|
||||
<span v-else>-</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="info-card">
|
||||
<div class="info-label">提取时间</div>
|
||||
<div class="info-value">{{ row.extractedAt || "-" }}</div>
|
||||
</div>
|
||||
<div class="info-card">
|
||||
<div class="info-label">可用检测</div>
|
||||
<div class="info-value">
|
||||
<el-tag :type="isUsedInfo.type" round>
|
||||
{{ isUsedInfo.label }}
|
||||
</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
<div class="info-card">
|
||||
<div class="info-label">账号</div>
|
||||
<div class="info-value">{{ row.account || "-" }}</div>
|
||||
</div>
|
||||
<div class="info-card">
|
||||
<div class="info-label">密码</div>
|
||||
<div class="info-value">{{ row.password || "-" }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="section-card">
|
||||
<div class="section-head">
|
||||
<div>
|
||||
<div class="section-title">Token</div>
|
||||
<div class="section-subtitle">
|
||||
长 Token 已做自动换行,便于检查与复制
|
||||
</div>
|
||||
</div>
|
||||
<el-button
|
||||
size="small"
|
||||
type="primary"
|
||||
plain
|
||||
:disabled="!hasToken"
|
||||
@click="copyToken"
|
||||
>
|
||||
复制 Token
|
||||
</el-button>
|
||||
</div>
|
||||
<pre class="token-box">{{ row.token || "暂无 Token" }}</pre>
|
||||
</div>
|
||||
|
||||
<div class="section-card">
|
||||
<div class="section-head">
|
||||
<div>
|
||||
<div class="section-title">快捷功能</div>
|
||||
<div class="section-subtitle">按使用场景复制账号信息</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="copy-actions">
|
||||
<el-button
|
||||
:disabled="!hasAccountPassword"
|
||||
@click="copyAccountPassword"
|
||||
>
|
||||
复制账号+密码
|
||||
</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
:disabled="!hasToken"
|
||||
@click="copyToken"
|
||||
>
|
||||
复制 Token
|
||||
</el-button>
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
:disabled="!hasAccountPassword && !hasToken"
|
||||
@click="copyAll"
|
||||
>
|
||||
复制全部
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="section-card">
|
||||
<div class="section-head">
|
||||
<div>
|
||||
<div class="section-title">维护操作</div>
|
||||
<div class="section-subtitle">
|
||||
点击按钮后打开确认/编辑弹窗,再执行对应操作
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="copy-actions">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
@click="unavailableDialogVisible = true"
|
||||
>
|
||||
改不可用
|
||||
</el-button>
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
@click="platformDialogVisible = true"
|
||||
>
|
||||
改平台
|
||||
</el-button>
|
||||
<el-button type="info" plain @click="unextractDialogVisible = true">
|
||||
反提取
|
||||
</el-button>
|
||||
<el-button type="primary" plain @click="openRemarkDialog">
|
||||
改备注
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="section-card">
|
||||
<div class="section-head">
|
||||
<div>
|
||||
<div class="section-title">备注</div>
|
||||
<div class="section-subtitle">备注改为弹窗编辑,当前仅展示</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="remark-display">{{ row.remark || "暂无备注" }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog
|
||||
v-model="unavailableDialogVisible"
|
||||
title="改不可用"
|
||||
width="420px"
|
||||
append-to-body
|
||||
>
|
||||
<el-alert type="warning" :closable="false">
|
||||
确认将当前账号标记为不可用/已用完?
|
||||
</el-alert>
|
||||
<template #footer>
|
||||
<el-button @click="unavailableDialogVisible = false">取消</el-button>
|
||||
<el-button type="danger" :loading="saveLoading" @click="onSetUnavailable">
|
||||
确认改不可用
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog
|
||||
v-model="platformDialogVisible"
|
||||
title="改平台"
|
||||
width="420px"
|
||||
append-to-body
|
||||
>
|
||||
<el-form label-width="84px">
|
||||
<el-form-item label="提取平台">
|
||||
<el-select v-model="platformForm.platform" style="width: 100%">
|
||||
<el-option
|
||||
v-for="(v, k) in PLATFORM_MAP"
|
||||
:key="k"
|
||||
:label="v.label"
|
||||
:value="k"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="platformDialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" :loading="saveLoading" @click="onUpdatePlatform">
|
||||
确认修改
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog
|
||||
v-model="unextractDialogVisible"
|
||||
title="反提取"
|
||||
width="420px"
|
||||
append-to-body
|
||||
>
|
||||
<el-alert type="warning" :closable="false">
|
||||
反提取会把账号恢复为未提取,并清空提取时间与提取平台。
|
||||
</el-alert>
|
||||
<template #footer>
|
||||
<el-button @click="unextractDialogVisible = false">取消</el-button>
|
||||
<el-button type="warning" :loading="saveLoading" @click="onUnextract">
|
||||
确认反提取
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog
|
||||
v-model="remarkDialogVisible"
|
||||
title="改备注"
|
||||
width="520px"
|
||||
append-to-body
|
||||
>
|
||||
<el-input
|
||||
v-model="remarkText"
|
||||
type="textarea"
|
||||
:rows="5"
|
||||
resize="none"
|
||||
placeholder="请输入备注"
|
||||
/>
|
||||
<template #footer>
|
||||
<el-button @click="remarkDialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" :loading="saveLoading" @click="onSaveRemark">
|
||||
保存备注
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
:deep(.pool-detail-dialog) {
|
||||
max-width: calc(100vw - 28px);
|
||||
border-radius: 18px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
:deep(.pool-detail-dialog .el-dialog__header) {
|
||||
padding: 18px 22px;
|
||||
margin: 0;
|
||||
border-bottom: 1px solid #eef0f5;
|
||||
}
|
||||
|
||||
:deep(.pool-detail-dialog .el-dialog__body) {
|
||||
padding: 18px 22px 22px;
|
||||
background: #f6f8fb;
|
||||
}
|
||||
|
||||
:deep(.el-tag) {
|
||||
border-radius: 4px !important;
|
||||
}
|
||||
|
||||
.detail-header,
|
||||
.header-actions,
|
||||
.section-head,
|
||||
.copy-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.detail-header {
|
||||
justify-content: space-between;
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
.detail-title {
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
color: #1f2937;
|
||||
}
|
||||
|
||||
.detail-subtitle,
|
||||
.section-subtitle {
|
||||
margin-top: 4px;
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
.header-actions {
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.header-actions .el-button {
|
||||
font-size: 18px;
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
.detail-body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 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 {
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.copy-actions .el-button {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.remark-display {
|
||||
padding: 12px;
|
||||
min-height: 42px;
|
||||
border-radius: 10px;
|
||||
background: #f8fafc;
|
||||
color: #303133;
|
||||
line-height: 1.6;
|
||||
white-space: pre-wrap;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
:deep(.pool-detail-dialog) {
|
||||
width: calc(100vw - 24px) !important;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
:deep(.pool-detail-dialog .el-dialog__header) {
|
||||
padding: 14px 14px;
|
||||
}
|
||||
|
||||
:deep(.pool-detail-dialog .el-dialog__body) {
|
||||
padding: 12px;
|
||||
max-height: 76vh;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.detail-header,
|
||||
.section-head {
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.section-head {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.info-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.copy-actions .el-button,
|
||||
.section-head .el-button {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,267 @@
|
||||
<script setup>
|
||||
import { computed, reactive, watch } from "vue";
|
||||
import { ElMessage } from "element-plus";
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
mode: {
|
||||
type: String,
|
||||
default: "single", // single | batch
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(["update:modelValue", "submit"]);
|
||||
|
||||
const form = reactive({
|
||||
type: "tk", // account | tk | account_tk
|
||||
account: "",
|
||||
password: "",
|
||||
token: "",
|
||||
batchText: "",
|
||||
remark: "",
|
||||
});
|
||||
|
||||
const isBatch = computed(() => props.mode === "batch");
|
||||
|
||||
const dialogTitle = computed(() => {
|
||||
return isBatch.value ? "批量添加账号" : "添加账号";
|
||||
});
|
||||
|
||||
const formatExample = computed(() => {
|
||||
if (form.type === "account") {
|
||||
return "account,password";
|
||||
}
|
||||
if (form.type === "account_tk") {
|
||||
return "account,password,token";
|
||||
}
|
||||
return "token";
|
||||
});
|
||||
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
(visible) => {
|
||||
if (!visible) return;
|
||||
resetForm();
|
||||
},
|
||||
);
|
||||
|
||||
function closeDialog() {
|
||||
emit("update:modelValue", false);
|
||||
}
|
||||
|
||||
function resetForm() {
|
||||
form.type = "tk";
|
||||
form.account = "";
|
||||
form.password = "";
|
||||
form.token = "";
|
||||
form.batchText = "";
|
||||
form.remark = "";
|
||||
}
|
||||
|
||||
function parseBatchRows() {
|
||||
const rows = form.batchText
|
||||
.split(/\r?\n/)
|
||||
.map((line) => line.trim())
|
||||
.filter(Boolean);
|
||||
|
||||
const parsed = [];
|
||||
const errors = [];
|
||||
|
||||
rows.forEach((line, index) => {
|
||||
if (form.type === "account") {
|
||||
const [account, password] = line.split(",").map((x) => (x || "").trim());
|
||||
if (!account || !password) {
|
||||
errors.push(`第 ${index + 1} 行格式错误,应为 account,password`);
|
||||
return;
|
||||
}
|
||||
parsed.push({
|
||||
type: "account",
|
||||
account,
|
||||
password,
|
||||
token: "",
|
||||
remark: form.remark,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (form.type === "account_tk") {
|
||||
const [account, password, token] = line
|
||||
.split(",")
|
||||
.map((x) => (x || "").trim());
|
||||
if (!account || !token) {
|
||||
errors.push(`第 ${index + 1} 行格式错误,应为 account,password,token(password 可为空)`);
|
||||
return;
|
||||
}
|
||||
parsed.push({
|
||||
type: "account_tk",
|
||||
account,
|
||||
password,
|
||||
token,
|
||||
remark: form.remark,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
parsed.push({
|
||||
type: "tk",
|
||||
account: "",
|
||||
password: "",
|
||||
token: line,
|
||||
remark: form.remark,
|
||||
});
|
||||
});
|
||||
|
||||
return { parsed, errors };
|
||||
}
|
||||
|
||||
function handleSubmit() {
|
||||
if (!isBatch.value) {
|
||||
if (form.type === "account") {
|
||||
if (!form.account || !form.password) {
|
||||
return;
|
||||
}
|
||||
emit("submit", {
|
||||
mode: "single",
|
||||
rows: [
|
||||
{
|
||||
type: "account",
|
||||
account: form.account.trim(),
|
||||
password: form.password.trim(),
|
||||
token: "",
|
||||
remark: form.remark.trim(),
|
||||
},
|
||||
],
|
||||
});
|
||||
closeDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
if (form.type === "account_tk") {
|
||||
if (!form.account || !form.token) {
|
||||
ElMessage.warning("请输入账号和 Token,密码可为空");
|
||||
return;
|
||||
}
|
||||
emit("submit", {
|
||||
mode: "single",
|
||||
rows: [
|
||||
{
|
||||
type: "account_tk",
|
||||
account: form.account.trim(),
|
||||
password: form.password.trim(),
|
||||
token: form.token.trim(),
|
||||
remark: form.remark.trim(),
|
||||
},
|
||||
],
|
||||
});
|
||||
closeDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!form.token) return;
|
||||
emit("submit", {
|
||||
mode: "single",
|
||||
rows: [
|
||||
{
|
||||
type: "tk",
|
||||
account: "",
|
||||
password: "",
|
||||
token: form.token.trim(),
|
||||
remark: form.remark.trim(),
|
||||
},
|
||||
],
|
||||
});
|
||||
closeDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
const { parsed, errors } = parseBatchRows();
|
||||
if (errors.length || parsed.length === 0) {
|
||||
ElMessage.warning(errors[0] || "请填写批量内容");
|
||||
return;
|
||||
}
|
||||
emit("submit", {
|
||||
mode: "batch",
|
||||
rows: parsed,
|
||||
});
|
||||
closeDialog();
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<el-dialog
|
||||
:model-value="modelValue"
|
||||
:title="dialogTitle"
|
||||
width="640px"
|
||||
@close="closeDialog"
|
||||
@update:model-value="(v) => emit('update:modelValue', v)"
|
||||
>
|
||||
<el-form label-width="96px">
|
||||
<el-form-item label="账号类型">
|
||||
<el-radio-group v-model="form.type">
|
||||
<el-radio value="tk">Token</el-radio>
|
||||
<el-radio value="account">账号密码</el-radio>
|
||||
<el-radio value="account_tk">账号密码+Token</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
|
||||
<template v-if="!isBatch">
|
||||
<template v-if="form.type === 'account' || form.type === 'account_tk'">
|
||||
<el-form-item label="账号">
|
||||
<el-input
|
||||
v-model="form.account"
|
||||
placeholder="请输入账号"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="密码">
|
||||
<el-input
|
||||
v-model="form.password"
|
||||
placeholder="请输入密码"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="form.type === 'account_tk'" label="Token">
|
||||
<el-input
|
||||
v-model="form.token"
|
||||
type="textarea"
|
||||
:rows="4"
|
||||
placeholder="请输入 token"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
</template>
|
||||
<el-form-item v-else label="Token">
|
||||
<el-input
|
||||
v-model="form.token"
|
||||
type="textarea"
|
||||
:rows="4"
|
||||
placeholder="请输入 token"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
</template>
|
||||
|
||||
<el-form-item v-else label="批量内容">
|
||||
<el-input
|
||||
v-model="form.batchText"
|
||||
type="textarea"
|
||||
:rows="12"
|
||||
:placeholder="`每行一条,格式:${formatExample}`"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="备注">
|
||||
<el-input v-model="form.remark" placeholder="可选备注" clearable />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<template #footer>
|
||||
<el-button @click="closeDialog">取消</el-button>
|
||||
<el-button type="primary" @click="handleSubmit">确认</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
@@ -0,0 +1,131 @@
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
loading: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
default: 'account',
|
||||
},
|
||||
platform: {
|
||||
type: String,
|
||||
default: 'local',
|
||||
},
|
||||
remark: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
replenish: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
platformMap: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits([
|
||||
'update:modelValue',
|
||||
'update:platform',
|
||||
'update:remark',
|
||||
'update:replenish',
|
||||
'confirm',
|
||||
]);
|
||||
|
||||
function typeText(type) {
|
||||
if (type === 'account') return '账号密码';
|
||||
if (type === 'account_tk') return '账号密码+Token';
|
||||
return 'Token';
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<el-dialog
|
||||
class="pool-extract-dialog"
|
||||
:model-value="modelValue"
|
||||
title="提取账号"
|
||||
width="90%"
|
||||
@update:model-value="(v) => emit('update:modelValue', v)"
|
||||
>
|
||||
<el-form label-width="84px">
|
||||
<el-form-item label="提取类型">
|
||||
<el-input :model-value="typeText(type)" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否补号">
|
||||
<el-switch
|
||||
:model-value="replenish"
|
||||
active-text="是"
|
||||
inactive-text="否"
|
||||
@update:model-value="(v) => emit('update:replenish', v)"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="提取平台">
|
||||
<el-select
|
||||
:model-value="platform"
|
||||
style="width: 100%"
|
||||
@update:model-value="(v) => emit('update:platform', v)"
|
||||
>
|
||||
<el-option
|
||||
v-for="(v, k) in platformMap"
|
||||
:key="k"
|
||||
:value="k"
|
||||
:label="v.label"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注">
|
||||
<el-input
|
||||
:model-value="remark"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
placeholder="提取备注(可选)"
|
||||
@update:model-value="(v) => emit('update:remark', v)"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="emit('update:modelValue', false)">取消</el-button>
|
||||
<el-button type="primary" :loading="loading" @click="emit('confirm')">
|
||||
确认提取
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
:deep(.pool-extract-dialog) {
|
||||
max-width: 420px;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
:deep(.pool-extract-dialog) {
|
||||
width: calc(100vw - 24px) !important;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
:deep(.pool-extract-dialog .el-dialog__body) {
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
:deep(.pool-extract-dialog .el-form-item__label) {
|
||||
width: 74px !important;
|
||||
}
|
||||
|
||||
:deep(.pool-extract-dialog .el-dialog__footer .el-button) {
|
||||
width: calc(50% - 6px);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
:deep(.pool-extract-dialog .el-dialog__footer) {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
padding: 8px 12px 12px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,49 @@
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
modelValue: { type: Boolean, default: false },
|
||||
loading: { type: Boolean, default: false },
|
||||
type: { type: String, default: 'tk' },
|
||||
platform: { type: String, default: 'local' },
|
||||
remark: { type: String, default: '' },
|
||||
platformMap: { type: Object, default: () => ({}) },
|
||||
});
|
||||
|
||||
const emit = defineEmits(['update:modelValue', 'update:type', 'update:platform', 'update:remark', 'confirm']);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<el-dialog
|
||||
:model-value="modelValue"
|
||||
title="补号"
|
||||
width="420px"
|
||||
@update:model-value="(v) => emit('update:modelValue', v)"
|
||||
>
|
||||
<el-form label-width="84px">
|
||||
<el-form-item label="账号类型">
|
||||
<el-select :model-value="type" style="width: 100%" @update:model-value="(v) => emit('update:type', v)">
|
||||
<el-option label="Token" value="tk" />
|
||||
<el-option label="账号密码" value="account" />
|
||||
<el-option label="账号密码+Token" value="account_tk" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="提取平台">
|
||||
<el-select :model-value="platform" style="width: 100%" @update:model-value="(v) => emit('update:platform', v)">
|
||||
<el-option v-for="(v, k) in platformMap" :key="k" :value="k" :label="v.label" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注">
|
||||
<el-input
|
||||
:model-value="remark"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
placeholder="提取备注(可选)"
|
||||
@update:model-value="(v) => emit('update:remark', v)"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="emit('update:modelValue', false)">取消</el-button>
|
||||
<el-button type="warning" :loading="loading" @click="emit('confirm')">确认补号</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,11 @@
|
||||
<script setup>
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<router-view />
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -0,0 +1,600 @@
|
||||
<script setup>
|
||||
import { computed, reactive, ref, watch } from "vue";
|
||||
import { ElMessage } from "element-plus";
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
row: {
|
||||
type: Object,
|
||||
default: null,
|
||||
},
|
||||
saveLoading: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(["update:modelValue", "save-remark", "detail-action"]);
|
||||
const remarkText = ref("");
|
||||
const remarkDialogVisible = ref(false);
|
||||
const platformDialogVisible = ref(false);
|
||||
const unavailableDialogVisible = ref(false);
|
||||
const unextractDialogVisible = ref(false);
|
||||
const platformForm = reactive({ platform: "local" });
|
||||
|
||||
const TYPE_MAP = {
|
||||
account: { label: "账号密码", type: "success" },
|
||||
account_tk: { label: "账号密码+Token", type: "primary" },
|
||||
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 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 typeInfo = computed(() => {
|
||||
return (
|
||||
TYPE_MAP[props.row?.type] || { label: props.row?.type || "-", type: "info" }
|
||||
);
|
||||
});
|
||||
|
||||
const platformInfo = computed(() => {
|
||||
const key = props.row?.extractedPlatform;
|
||||
if (!key) return { label: "-", type: "info" };
|
||||
return PLATFORM_MAP[key] || { label: key, type: "info" };
|
||||
});
|
||||
|
||||
const isUsedInfo = computed(() => {
|
||||
const raw = props.row?.isUsed;
|
||||
if (raw === null || raw === undefined || raw === "") {
|
||||
return { label: "未探测", type: "info" };
|
||||
}
|
||||
const n = Number(raw);
|
||||
if (n === 1) return { label: "可用", type: "success" };
|
||||
if (n === 0) return { label: "已用完", type: "danger" };
|
||||
return { label: String(raw), type: "info" };
|
||||
});
|
||||
|
||||
const hasAccountPassword = computed(
|
||||
() => !!(props.row?.account || props.row?.password),
|
||||
);
|
||||
const hasToken = computed(() => !!props.row?.token);
|
||||
|
||||
watch(
|
||||
() => props.row,
|
||||
(row) => {
|
||||
remarkText.value = row?.remark || "";
|
||||
platformForm.platform = row?.extractedPlatform || "local";
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
function closeDialog() {
|
||||
emit("update:modelValue", false);
|
||||
}
|
||||
|
||||
function openRemarkDialog() {
|
||||
remarkText.value = props.row?.remark || "";
|
||||
remarkDialogVisible.value = true;
|
||||
}
|
||||
|
||||
function onSaveRemark() {
|
||||
if (!props.row?.id) return;
|
||||
emit("save-remark", { id: props.row.id, remark: remarkText.value || "" });
|
||||
remarkDialogVisible.value = false;
|
||||
}
|
||||
|
||||
function onSetUnavailable() {
|
||||
if (!props.row?.id) return;
|
||||
emit("detail-action", { action: "unavailable", id: props.row.id });
|
||||
unavailableDialogVisible.value = false;
|
||||
}
|
||||
|
||||
function onUpdatePlatform() {
|
||||
if (!props.row?.id) return;
|
||||
emit("detail-action", {
|
||||
action: "platform",
|
||||
id: props.row.id,
|
||||
platform: platformForm.platform,
|
||||
});
|
||||
platformDialogVisible.value = false;
|
||||
}
|
||||
|
||||
function onUnextract() {
|
||||
if (!props.row?.id) return;
|
||||
emit("detail-action", { action: "unextract", id: props.row.id });
|
||||
unextractDialogVisible.value = false;
|
||||
}
|
||||
|
||||
async function copyText(text, successText) {
|
||||
const val = String(text || "").trim();
|
||||
if (!val) {
|
||||
ElMessage.warning("暂无可复制内容");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await navigator.clipboard.writeText(val);
|
||||
ElMessage.success(successText || "已复制");
|
||||
} catch {
|
||||
ElMessage.error("复制失败,请检查浏览器权限");
|
||||
}
|
||||
}
|
||||
|
||||
function copyAccountPassword() {
|
||||
const parts = [];
|
||||
if (props.row?.account) parts.push(props.row.account);
|
||||
if (props.row?.password) parts.push(props.row.password);
|
||||
copyText(parts.join("\n"), "已复制账号+密码");
|
||||
}
|
||||
|
||||
function copyToken() {
|
||||
copyText(props.row?.token, "已复制 Token");
|
||||
}
|
||||
|
||||
function copyAll() {
|
||||
const parts = [];
|
||||
if (props.row?.account) parts.push(`账号:${props.row.account}`);
|
||||
if (props.row?.password) parts.push(`密码:${props.row.password}`);
|
||||
if (props.row?.token) parts.push(`Token:${props.row.token}`);
|
||||
copyText(parts.join("\n"), "已复制完整账号信息");
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<el-dialog
|
||||
class="pool-detail-dialog"
|
||||
:model-value="modelValue"
|
||||
width="760px"
|
||||
destroy-on-close
|
||||
:show-close="false"
|
||||
@update:model-value="(v) => emit('update:modelValue', v)"
|
||||
>
|
||||
<template #header>
|
||||
<div class="detail-header">
|
||||
<div>
|
||||
<div class="detail-title">账号详情</div>
|
||||
<div class="detail-subtitle">
|
||||
通过弹窗执行账号状态、平台、备注等维护操作
|
||||
</div>
|
||||
</div>
|
||||
<div class="header-actions">
|
||||
<el-button circle plain @click="closeDialog">×</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div v-if="row" class="detail-body">
|
||||
<div class="info-grid">
|
||||
<div class="info-card">
|
||||
<div class="info-label">ID</div>
|
||||
<div class="info-value">{{ row?.id || "-" }}</div>
|
||||
</div>
|
||||
<div class="info-card">
|
||||
<div class="info-label">账号类型</div>
|
||||
<div class="info-value">
|
||||
<el-tag :type="typeInfo.type" round>{{ typeInfo.label }}</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
<div class="info-card">
|
||||
<div class="info-label">提取状态</div>
|
||||
<div class="info-value">
|
||||
<el-tag :type="statusInfo.type" effect="dark" round>
|
||||
{{ statusInfo.label }}
|
||||
</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
<div class="info-card">
|
||||
<div class="info-label">提取平台</div>
|
||||
<div class="info-value">
|
||||
<el-tag
|
||||
v-if="row.extractedPlatform"
|
||||
:type="platformInfo.type"
|
||||
size="small"
|
||||
>
|
||||
{{ platformInfo.label }}
|
||||
</el-tag>
|
||||
<span v-else>-</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="info-card">
|
||||
<div class="info-label">提取时间</div>
|
||||
<div class="info-value">{{ row.extractedAt || "-" }}</div>
|
||||
</div>
|
||||
<div class="info-card">
|
||||
<div class="info-label">可用检测</div>
|
||||
<div class="info-value">
|
||||
<el-tag :type="isUsedInfo.type" round>
|
||||
{{ isUsedInfo.label }}
|
||||
</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
<div class="info-card">
|
||||
<div class="info-label">账号</div>
|
||||
<div class="info-value">{{ row.account || "-" }}</div>
|
||||
</div>
|
||||
<div class="info-card">
|
||||
<div class="info-label">密码</div>
|
||||
<div class="info-value">{{ row.password || "-" }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="section-card">
|
||||
<div class="section-head">
|
||||
<div>
|
||||
<div class="section-title">Token</div>
|
||||
<div class="section-subtitle">
|
||||
长 Token 已做自动换行,便于检查与复制
|
||||
</div>
|
||||
</div>
|
||||
<el-button
|
||||
size="small"
|
||||
type="primary"
|
||||
plain
|
||||
:disabled="!hasToken"
|
||||
@click="copyToken"
|
||||
>
|
||||
复制 Token
|
||||
</el-button>
|
||||
</div>
|
||||
<pre class="token-box">{{ row.token || "暂无 Token" }}</pre>
|
||||
</div>
|
||||
|
||||
<div class="section-card">
|
||||
<div class="section-head">
|
||||
<div>
|
||||
<div class="section-title">快捷功能</div>
|
||||
<div class="section-subtitle">按使用场景复制账号信息</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="copy-actions">
|
||||
<el-button
|
||||
:disabled="!hasAccountPassword"
|
||||
@click="copyAccountPassword"
|
||||
>
|
||||
复制账号+密码
|
||||
</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
:disabled="!hasToken"
|
||||
@click="copyToken"
|
||||
>
|
||||
复制 Token
|
||||
</el-button>
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
:disabled="!hasAccountPassword && !hasToken"
|
||||
@click="copyAll"
|
||||
>
|
||||
复制全部
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="section-card">
|
||||
<div class="section-head">
|
||||
<div>
|
||||
<div class="section-title">维护操作</div>
|
||||
<div class="section-subtitle">
|
||||
点击按钮后打开确认/编辑弹窗,再执行对应操作
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="copy-actions">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
@click="unavailableDialogVisible = true"
|
||||
>
|
||||
改不可用
|
||||
</el-button>
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
@click="platformDialogVisible = true"
|
||||
>
|
||||
改平台
|
||||
</el-button>
|
||||
<el-button type="info" plain @click="unextractDialogVisible = true">
|
||||
反提取
|
||||
</el-button>
|
||||
<el-button type="primary" plain @click="openRemarkDialog">
|
||||
改备注
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="section-card">
|
||||
<div class="section-head">
|
||||
<div>
|
||||
<div class="section-title">备注</div>
|
||||
<div class="section-subtitle">备注改为弹窗编辑,当前仅展示</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="remark-display">{{ row.remark || "暂无备注" }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog
|
||||
v-model="unavailableDialogVisible"
|
||||
title="改不可用"
|
||||
width="420px"
|
||||
append-to-body
|
||||
>
|
||||
<el-alert type="warning" :closable="false">
|
||||
确认将当前账号标记为不可用/已用完?
|
||||
</el-alert>
|
||||
<template #footer>
|
||||
<el-button @click="unavailableDialogVisible = false">取消</el-button>
|
||||
<el-button type="danger" :loading="saveLoading" @click="onSetUnavailable">
|
||||
确认改不可用
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog
|
||||
v-model="platformDialogVisible"
|
||||
title="改平台"
|
||||
width="420px"
|
||||
append-to-body
|
||||
>
|
||||
<el-form label-width="84px">
|
||||
<el-form-item label="提取平台">
|
||||
<el-select v-model="platformForm.platform" style="width: 100%">
|
||||
<el-option
|
||||
v-for="(v, k) in PLATFORM_MAP"
|
||||
:key="k"
|
||||
:label="v.label"
|
||||
:value="k"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="platformDialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" :loading="saveLoading" @click="onUpdatePlatform">
|
||||
确认修改
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog
|
||||
v-model="unextractDialogVisible"
|
||||
title="反提取"
|
||||
width="420px"
|
||||
append-to-body
|
||||
>
|
||||
<el-alert type="warning" :closable="false">
|
||||
反提取会把账号恢复为未提取,并清空提取时间与提取平台。
|
||||
</el-alert>
|
||||
<template #footer>
|
||||
<el-button @click="unextractDialogVisible = false">取消</el-button>
|
||||
<el-button type="warning" :loading="saveLoading" @click="onUnextract">
|
||||
确认反提取
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog
|
||||
v-model="remarkDialogVisible"
|
||||
title="改备注"
|
||||
width="520px"
|
||||
append-to-body
|
||||
>
|
||||
<el-input
|
||||
v-model="remarkText"
|
||||
type="textarea"
|
||||
:rows="5"
|
||||
resize="none"
|
||||
placeholder="请输入备注"
|
||||
/>
|
||||
<template #footer>
|
||||
<el-button @click="remarkDialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" :loading="saveLoading" @click="onSaveRemark">
|
||||
保存备注
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
:deep(.pool-detail-dialog) {
|
||||
max-width: calc(100vw - 28px);
|
||||
border-radius: 18px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
:deep(.pool-detail-dialog .el-dialog__header) {
|
||||
padding: 18px 22px;
|
||||
margin: 0;
|
||||
border-bottom: 1px solid #eef0f5;
|
||||
}
|
||||
|
||||
:deep(.pool-detail-dialog .el-dialog__body) {
|
||||
padding: 18px 22px 22px;
|
||||
background: #f6f8fb;
|
||||
}
|
||||
|
||||
:deep(.el-tag) {
|
||||
border-radius: 4px !important;
|
||||
}
|
||||
|
||||
.detail-header,
|
||||
.header-actions,
|
||||
.section-head,
|
||||
.copy-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.detail-header {
|
||||
justify-content: space-between;
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
.detail-title {
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
color: #1f2937;
|
||||
}
|
||||
|
||||
.detail-subtitle,
|
||||
.section-subtitle {
|
||||
margin-top: 4px;
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
.header-actions {
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.header-actions .el-button {
|
||||
font-size: 18px;
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
.detail-body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 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 {
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.copy-actions .el-button {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.remark-display {
|
||||
padding: 12px;
|
||||
min-height: 42px;
|
||||
border-radius: 10px;
|
||||
background: #f8fafc;
|
||||
color: #303133;
|
||||
line-height: 1.6;
|
||||
white-space: pre-wrap;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
:deep(.pool-detail-dialog) {
|
||||
width: calc(100vw - 24px) !important;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
:deep(.pool-detail-dialog .el-dialog__header) {
|
||||
padding: 14px 14px;
|
||||
}
|
||||
|
||||
:deep(.pool-detail-dialog .el-dialog__body) {
|
||||
padding: 12px;
|
||||
max-height: 76vh;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.detail-header,
|
||||
.section-head {
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.section-head {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.info-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.copy-actions .el-button,
|
||||
.section-head .el-button {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,259 @@
|
||||
<script setup>
|
||||
import { computed, reactive, watch } from 'vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
mode: {
|
||||
type: String,
|
||||
default: 'single', // single | batch
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(['update:modelValue', 'submit']);
|
||||
|
||||
const form = reactive({
|
||||
type: 'account', // account | tk | account_tk
|
||||
account: '',
|
||||
password: '',
|
||||
token: '',
|
||||
batchText: '',
|
||||
remark: '',
|
||||
});
|
||||
|
||||
const isBatch = computed(() => props.mode === 'batch');
|
||||
|
||||
const dialogTitle = computed(() => {
|
||||
return isBatch.value ? '批量添加账号' : '添加账号';
|
||||
});
|
||||
|
||||
const formatExample = computed(() => {
|
||||
if (form.type === 'account') {
|
||||
return 'account,password';
|
||||
}
|
||||
if (form.type === 'account_tk') {
|
||||
return 'account,password,token';
|
||||
}
|
||||
return 'token';
|
||||
});
|
||||
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
(visible) => {
|
||||
if (!visible) return;
|
||||
resetForm();
|
||||
}
|
||||
);
|
||||
|
||||
function closeDialog() {
|
||||
emit('update:modelValue', false);
|
||||
}
|
||||
|
||||
function resetForm() {
|
||||
form.type = 'account';
|
||||
form.account = '';
|
||||
form.password = '';
|
||||
form.token = '';
|
||||
form.batchText = '';
|
||||
form.remark = '';
|
||||
}
|
||||
|
||||
function parseBatchRows() {
|
||||
const rows = form.batchText
|
||||
.split(/\r?\n/)
|
||||
.map((line) => line.trim())
|
||||
.filter(Boolean);
|
||||
|
||||
const parsed = [];
|
||||
const errors = [];
|
||||
|
||||
rows.forEach((line, index) => {
|
||||
if (form.type === 'account') {
|
||||
const [account, password] = line.split(',').map((x) => (x || '').trim());
|
||||
if (!account || !password) {
|
||||
errors.push(`第 ${index + 1} 行格式错误,应为 account,password`);
|
||||
return;
|
||||
}
|
||||
parsed.push({
|
||||
type: 'account',
|
||||
account,
|
||||
password,
|
||||
token: '',
|
||||
remark: form.remark,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (form.type === 'account_tk') {
|
||||
const [account, password, token] = line
|
||||
.split(',')
|
||||
.map((x) => (x || '').trim());
|
||||
if (!account || !token) {
|
||||
errors.push(`第 ${index + 1} 行格式错误,应为 account,password,token(password 可为空)`);
|
||||
return;
|
||||
}
|
||||
parsed.push({
|
||||
type: 'account_tk',
|
||||
account,
|
||||
password,
|
||||
token,
|
||||
remark: form.remark,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
parsed.push({
|
||||
type: 'tk',
|
||||
account: '',
|
||||
password: '',
|
||||
token: line,
|
||||
remark: form.remark,
|
||||
});
|
||||
});
|
||||
|
||||
return { parsed, errors };
|
||||
}
|
||||
|
||||
function handleSubmit() {
|
||||
if (!isBatch.value) {
|
||||
if (form.type === 'account') {
|
||||
if (!form.account || !form.password) {
|
||||
return;
|
||||
}
|
||||
emit('submit', {
|
||||
mode: 'single',
|
||||
rows: [
|
||||
{
|
||||
type: 'account',
|
||||
account: form.account.trim(),
|
||||
password: form.password.trim(),
|
||||
token: '',
|
||||
remark: form.remark.trim(),
|
||||
},
|
||||
],
|
||||
});
|
||||
closeDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
if (form.type === 'account_tk') {
|
||||
if (!form.account || !form.token) {
|
||||
ElMessage.warning('请输入账号和 Token,密码可为空');
|
||||
return;
|
||||
}
|
||||
emit('submit', {
|
||||
mode: 'single',
|
||||
rows: [
|
||||
{
|
||||
type: 'account_tk',
|
||||
account: form.account.trim(),
|
||||
password: form.password.trim(),
|
||||
token: form.token.trim(),
|
||||
remark: form.remark.trim(),
|
||||
},
|
||||
],
|
||||
});
|
||||
closeDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!form.token) return;
|
||||
emit('submit', {
|
||||
mode: 'single',
|
||||
rows: [
|
||||
{
|
||||
type: 'tk',
|
||||
account: '',
|
||||
password: '',
|
||||
token: form.token.trim(),
|
||||
remark: form.remark.trim(),
|
||||
},
|
||||
],
|
||||
});
|
||||
closeDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
const { parsed, errors } = parseBatchRows();
|
||||
if (errors.length || parsed.length === 0) {
|
||||
ElMessage.warning(errors[0] || '请填写批量内容');
|
||||
return;
|
||||
}
|
||||
emit('submit', {
|
||||
mode: 'batch',
|
||||
rows: parsed,
|
||||
});
|
||||
closeDialog();
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<el-dialog
|
||||
:model-value="modelValue"
|
||||
:title="dialogTitle"
|
||||
width="640px"
|
||||
@close="closeDialog"
|
||||
@update:model-value="(v) => emit('update:modelValue', v)"
|
||||
>
|
||||
<el-form label-width="96px">
|
||||
<el-form-item label="账号类型">
|
||||
<el-radio-group v-model="form.type">
|
||||
<el-radio value="account">账号密码</el-radio>
|
||||
<el-radio value="account_tk">账号密码+Token</el-radio>
|
||||
<el-radio value="tk">Token</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
|
||||
<template v-if="!isBatch">
|
||||
<template v-if="form.type === 'account' || form.type === 'account_tk'">
|
||||
<el-form-item label="账号">
|
||||
<el-input v-model="form.account" placeholder="请输入账号" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="密码">
|
||||
<el-input v-model="form.password" placeholder="请输入密码" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item v-if="form.type === 'account_tk'" label="Token">
|
||||
<el-input
|
||||
v-model="form.token"
|
||||
type="textarea"
|
||||
:rows="4"
|
||||
placeholder="请输入 token"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
</template>
|
||||
<el-form-item v-else label="Token">
|
||||
<el-input
|
||||
v-model="form.token"
|
||||
type="textarea"
|
||||
:rows="4"
|
||||
placeholder="请输入 token"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
</template>
|
||||
|
||||
<el-form-item v-else label="批量内容">
|
||||
<el-input
|
||||
v-model="form.batchText"
|
||||
type="textarea"
|
||||
:rows="12"
|
||||
:placeholder="`每行一条,格式:${formatExample}`"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="备注">
|
||||
<el-input v-model="form.remark" placeholder="可选备注" clearable />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<template #footer>
|
||||
<el-button @click="closeDialog">取消</el-button>
|
||||
<el-button type="primary" @click="handleSubmit">确认</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
@@ -0,0 +1,103 @@
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
modelValue: { type: Boolean, default: false },
|
||||
loading: { type: Boolean, default: false },
|
||||
type: { type: String, default: 'account' },
|
||||
platform: { type: String, default: 'local' },
|
||||
remark: { type: String, default: '' },
|
||||
replenish: { type: Boolean, default: false },
|
||||
platformMap: { type: Object, default: () => ({}) },
|
||||
});
|
||||
|
||||
const emit = defineEmits([
|
||||
'update:modelValue',
|
||||
'update:platform',
|
||||
'update:remark',
|
||||
'update:replenish',
|
||||
'confirm',
|
||||
]);
|
||||
|
||||
function typeText(type) {
|
||||
if (type === 'account') return '账号密码';
|
||||
if (type === 'account_tk') return '账号密码+Token';
|
||||
return 'Token';
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<el-dialog
|
||||
class="pool-extract-dialog"
|
||||
:model-value="modelValue"
|
||||
title="提取账号"
|
||||
width="90%"
|
||||
@update:model-value="(v) => emit('update:modelValue', v)"
|
||||
>
|
||||
<el-form label-width="84px">
|
||||
<el-form-item label="提取类型">
|
||||
<el-input :model-value="typeText(type)" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否补号">
|
||||
<el-switch
|
||||
:model-value="replenish"
|
||||
active-text="是"
|
||||
inactive-text="否"
|
||||
@update:model-value="(v) => emit('update:replenish', v)"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="提取平台">
|
||||
<el-select
|
||||
:model-value="platform"
|
||||
style="width: 100%"
|
||||
@update:model-value="(v) => emit('update:platform', v)"
|
||||
>
|
||||
<el-option v-for="(v, k) in platformMap" :key="k" :value="k" :label="v.label" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注">
|
||||
<el-input
|
||||
:model-value="remark"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
placeholder="提取备注(可选)"
|
||||
@update:model-value="(v) => emit('update:remark', v)"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="emit('update:modelValue', false)">取消</el-button>
|
||||
<el-button type="primary" :loading="loading" @click="emit('confirm')">确认提取</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
:deep(.pool-extract-dialog) {
|
||||
max-width: 420px;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
:deep(.pool-extract-dialog) {
|
||||
width: calc(100vw - 24px) !important;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
:deep(.pool-extract-dialog .el-dialog__body) {
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
:deep(.pool-extract-dialog .el-form-item__label) {
|
||||
width: 74px !important;
|
||||
}
|
||||
|
||||
:deep(.pool-extract-dialog .el-dialog__footer .el-button) {
|
||||
width: calc(50% - 6px);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
:deep(.pool-extract-dialog .el-dialog__footer) {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
padding: 8px 12px 12px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,49 @@
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
modelValue: { type: Boolean, default: false },
|
||||
loading: { type: Boolean, default: false },
|
||||
type: { type: String, default: 'tk' },
|
||||
platform: { type: String, default: 'local' },
|
||||
remark: { type: String, default: '' },
|
||||
platformMap: { type: Object, default: () => ({}) },
|
||||
});
|
||||
|
||||
const emit = defineEmits(['update:modelValue', 'update:type', 'update:platform', 'update:remark', 'confirm']);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<el-dialog
|
||||
:model-value="modelValue"
|
||||
title="补号"
|
||||
width="420px"
|
||||
@update:model-value="(v) => emit('update:modelValue', v)"
|
||||
>
|
||||
<el-form label-width="84px">
|
||||
<el-form-item label="账号类型">
|
||||
<el-select :model-value="type" style="width: 100%" @update:model-value="(v) => emit('update:type', v)">
|
||||
<el-option label="Token" value="tk" />
|
||||
<el-option label="账号密码" value="account" />
|
||||
<el-option label="账号密码+Token" value="account_tk" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="提取平台">
|
||||
<el-select :model-value="platform" style="width: 100%" @update:model-value="(v) => emit('update:platform', v)">
|
||||
<el-option v-for="(v, k) in platformMap" :key="k" :value="k" :label="v.label" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注">
|
||||
<el-input
|
||||
:model-value="remark"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
placeholder="提取备注(可选)"
|
||||
@update:model-value="(v) => emit('update:remark', v)"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="emit('update:modelValue', false)">取消</el-button>
|
||||
<el-button type="warning" :loading="loading" @click="emit('confirm')">确认补号</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,600 @@
|
||||
<script setup>
|
||||
import { computed, reactive, ref, watch } from "vue";
|
||||
import { ElMessage } from "element-plus";
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
row: {
|
||||
type: Object,
|
||||
default: null,
|
||||
},
|
||||
saveLoading: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(["update:modelValue", "save-remark", "detail-action"]);
|
||||
const remarkText = ref("");
|
||||
const remarkDialogVisible = ref(false);
|
||||
const platformDialogVisible = ref(false);
|
||||
const unavailableDialogVisible = ref(false);
|
||||
const unextractDialogVisible = ref(false);
|
||||
const platformForm = reactive({ platform: "local" });
|
||||
|
||||
const TYPE_MAP = {
|
||||
account: { label: "账号密码", type: "success" },
|
||||
account_tk: { label: "账号密码+Token", type: "primary" },
|
||||
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 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 typeInfo = computed(() => {
|
||||
return (
|
||||
TYPE_MAP[props.row?.type] || { label: props.row?.type || "-", type: "info" }
|
||||
);
|
||||
});
|
||||
|
||||
const platformInfo = computed(() => {
|
||||
const key = props.row?.extractedPlatform;
|
||||
if (!key) return { label: "-", type: "info" };
|
||||
return PLATFORM_MAP[key] || { label: key, type: "info" };
|
||||
});
|
||||
|
||||
const isUsedInfo = computed(() => {
|
||||
const raw = props.row?.isUsed;
|
||||
if (raw === null || raw === undefined || raw === "") {
|
||||
return { label: "未探测", type: "info" };
|
||||
}
|
||||
const n = Number(raw);
|
||||
if (n === 1) return { label: "可用", type: "success" };
|
||||
if (n === 0) return { label: "已用完", type: "danger" };
|
||||
return { label: String(raw), type: "info" };
|
||||
});
|
||||
|
||||
const hasAccountPassword = computed(
|
||||
() => !!(props.row?.account || props.row?.password),
|
||||
);
|
||||
const hasToken = computed(() => !!props.row?.token);
|
||||
|
||||
watch(
|
||||
() => props.row,
|
||||
(row) => {
|
||||
remarkText.value = row?.remark || "";
|
||||
platformForm.platform = row?.extractedPlatform || "local";
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
function closeDialog() {
|
||||
emit("update:modelValue", false);
|
||||
}
|
||||
|
||||
function openRemarkDialog() {
|
||||
remarkText.value = props.row?.remark || "";
|
||||
remarkDialogVisible.value = true;
|
||||
}
|
||||
|
||||
function onSaveRemark() {
|
||||
if (!props.row?.id) return;
|
||||
emit("save-remark", { id: props.row.id, remark: remarkText.value || "" });
|
||||
remarkDialogVisible.value = false;
|
||||
}
|
||||
|
||||
function onSetUnavailable() {
|
||||
if (!props.row?.id) return;
|
||||
emit("detail-action", { action: "unavailable", id: props.row.id });
|
||||
unavailableDialogVisible.value = false;
|
||||
}
|
||||
|
||||
function onUpdatePlatform() {
|
||||
if (!props.row?.id) return;
|
||||
emit("detail-action", {
|
||||
action: "platform",
|
||||
id: props.row.id,
|
||||
platform: platformForm.platform,
|
||||
});
|
||||
platformDialogVisible.value = false;
|
||||
}
|
||||
|
||||
function onUnextract() {
|
||||
if (!props.row?.id) return;
|
||||
emit("detail-action", { action: "unextract", id: props.row.id });
|
||||
unextractDialogVisible.value = false;
|
||||
}
|
||||
|
||||
async function copyText(text, successText) {
|
||||
const val = String(text || "").trim();
|
||||
if (!val) {
|
||||
ElMessage.warning("暂无可复制内容");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await navigator.clipboard.writeText(val);
|
||||
ElMessage.success(successText || "已复制");
|
||||
} catch {
|
||||
ElMessage.error("复制失败,请检查浏览器权限");
|
||||
}
|
||||
}
|
||||
|
||||
function copyAccountPassword() {
|
||||
const parts = [];
|
||||
if (props.row?.account) parts.push(props.row.account);
|
||||
if (props.row?.password) parts.push(props.row.password);
|
||||
copyText(parts.join("\n"), "已复制账号+密码");
|
||||
}
|
||||
|
||||
function copyToken() {
|
||||
copyText(props.row?.token, "已复制 Token");
|
||||
}
|
||||
|
||||
function copyAll() {
|
||||
const parts = [];
|
||||
if (props.row?.account) parts.push(`账号:${props.row.account}`);
|
||||
if (props.row?.password) parts.push(`密码:${props.row.password}`);
|
||||
if (props.row?.token) parts.push(`Token:${props.row.token}`);
|
||||
copyText(parts.join("\n"), "已复制完整账号信息");
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<el-dialog
|
||||
class="pool-detail-dialog"
|
||||
:model-value="modelValue"
|
||||
width="760px"
|
||||
destroy-on-close
|
||||
:show-close="false"
|
||||
@update:model-value="(v) => emit('update:modelValue', v)"
|
||||
>
|
||||
<template #header>
|
||||
<div class="detail-header">
|
||||
<div>
|
||||
<div class="detail-title">账号详情</div>
|
||||
<div class="detail-subtitle">
|
||||
通过弹窗执行账号状态、平台、备注等维护操作
|
||||
</div>
|
||||
</div>
|
||||
<div class="header-actions">
|
||||
<el-button circle plain @click="closeDialog">×</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div v-if="row" class="detail-body">
|
||||
<div class="info-grid">
|
||||
<div class="info-card">
|
||||
<div class="info-label">ID</div>
|
||||
<div class="info-value">{{ row?.id || "-" }}</div>
|
||||
</div>
|
||||
<div class="info-card">
|
||||
<div class="info-label">账号类型</div>
|
||||
<div class="info-value">
|
||||
<el-tag :type="typeInfo.type" round>{{ typeInfo.label }}</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
<div class="info-card">
|
||||
<div class="info-label">提取状态</div>
|
||||
<div class="info-value">
|
||||
<el-tag :type="statusInfo.type" effect="dark" round>
|
||||
{{ statusInfo.label }}
|
||||
</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
<div class="info-card">
|
||||
<div class="info-label">提取平台</div>
|
||||
<div class="info-value">
|
||||
<el-tag
|
||||
v-if="row.extractedPlatform"
|
||||
:type="platformInfo.type"
|
||||
size="small"
|
||||
>
|
||||
{{ platformInfo.label }}
|
||||
</el-tag>
|
||||
<span v-else>-</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="info-card">
|
||||
<div class="info-label">提取时间</div>
|
||||
<div class="info-value">{{ row.extractedAt || "-" }}</div>
|
||||
</div>
|
||||
<div class="info-card">
|
||||
<div class="info-label">可用检测</div>
|
||||
<div class="info-value">
|
||||
<el-tag :type="isUsedInfo.type" round>
|
||||
{{ isUsedInfo.label }}
|
||||
</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
<div class="info-card">
|
||||
<div class="info-label">账号</div>
|
||||
<div class="info-value">{{ row.account || "-" }}</div>
|
||||
</div>
|
||||
<div class="info-card">
|
||||
<div class="info-label">密码</div>
|
||||
<div class="info-value">{{ row.password || "-" }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="section-card">
|
||||
<div class="section-head">
|
||||
<div>
|
||||
<div class="section-title">Token</div>
|
||||
<div class="section-subtitle">
|
||||
长 Token 已做自动换行,便于检查与复制
|
||||
</div>
|
||||
</div>
|
||||
<el-button
|
||||
size="small"
|
||||
type="primary"
|
||||
plain
|
||||
:disabled="!hasToken"
|
||||
@click="copyToken"
|
||||
>
|
||||
复制 Token
|
||||
</el-button>
|
||||
</div>
|
||||
<pre class="token-box">{{ row.token || "暂无 Token" }}</pre>
|
||||
</div>
|
||||
|
||||
<div class="section-card">
|
||||
<div class="section-head">
|
||||
<div>
|
||||
<div class="section-title">快捷功能</div>
|
||||
<div class="section-subtitle">按使用场景复制账号信息</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="copy-actions">
|
||||
<el-button
|
||||
:disabled="!hasAccountPassword"
|
||||
@click="copyAccountPassword"
|
||||
>
|
||||
复制账号+密码
|
||||
</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
:disabled="!hasToken"
|
||||
@click="copyToken"
|
||||
>
|
||||
复制 Token
|
||||
</el-button>
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
:disabled="!hasAccountPassword && !hasToken"
|
||||
@click="copyAll"
|
||||
>
|
||||
复制全部
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="section-card">
|
||||
<div class="section-head">
|
||||
<div>
|
||||
<div class="section-title">维护操作</div>
|
||||
<div class="section-subtitle">
|
||||
点击按钮后打开确认/编辑弹窗,再执行对应操作
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="copy-actions">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
@click="unavailableDialogVisible = true"
|
||||
>
|
||||
改不可用
|
||||
</el-button>
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
@click="platformDialogVisible = true"
|
||||
>
|
||||
改平台
|
||||
</el-button>
|
||||
<el-button type="info" plain @click="unextractDialogVisible = true">
|
||||
反提取
|
||||
</el-button>
|
||||
<el-button type="primary" plain @click="openRemarkDialog">
|
||||
改备注
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="section-card">
|
||||
<div class="section-head">
|
||||
<div>
|
||||
<div class="section-title">备注</div>
|
||||
<div class="section-subtitle">备注改为弹窗编辑,当前仅展示</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="remark-display">{{ row.remark || "暂无备注" }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog
|
||||
v-model="unavailableDialogVisible"
|
||||
title="改不可用"
|
||||
width="420px"
|
||||
append-to-body
|
||||
>
|
||||
<el-alert type="warning" :closable="false">
|
||||
确认将当前账号标记为不可用/已用完?
|
||||
</el-alert>
|
||||
<template #footer>
|
||||
<el-button @click="unavailableDialogVisible = false">取消</el-button>
|
||||
<el-button type="danger" :loading="saveLoading" @click="onSetUnavailable">
|
||||
确认改不可用
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog
|
||||
v-model="platformDialogVisible"
|
||||
title="改平台"
|
||||
width="420px"
|
||||
append-to-body
|
||||
>
|
||||
<el-form label-width="84px">
|
||||
<el-form-item label="提取平台">
|
||||
<el-select v-model="platformForm.platform" style="width: 100%">
|
||||
<el-option
|
||||
v-for="(v, k) in PLATFORM_MAP"
|
||||
:key="k"
|
||||
:label="v.label"
|
||||
:value="k"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="platformDialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" :loading="saveLoading" @click="onUpdatePlatform">
|
||||
确认修改
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog
|
||||
v-model="unextractDialogVisible"
|
||||
title="反提取"
|
||||
width="420px"
|
||||
append-to-body
|
||||
>
|
||||
<el-alert type="warning" :closable="false">
|
||||
反提取会把账号恢复为未提取,并清空提取时间与提取平台。
|
||||
</el-alert>
|
||||
<template #footer>
|
||||
<el-button @click="unextractDialogVisible = false">取消</el-button>
|
||||
<el-button type="warning" :loading="saveLoading" @click="onUnextract">
|
||||
确认反提取
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog
|
||||
v-model="remarkDialogVisible"
|
||||
title="改备注"
|
||||
width="520px"
|
||||
append-to-body
|
||||
>
|
||||
<el-input
|
||||
v-model="remarkText"
|
||||
type="textarea"
|
||||
:rows="5"
|
||||
resize="none"
|
||||
placeholder="请输入备注"
|
||||
/>
|
||||
<template #footer>
|
||||
<el-button @click="remarkDialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" :loading="saveLoading" @click="onSaveRemark">
|
||||
保存备注
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
:deep(.pool-detail-dialog) {
|
||||
max-width: calc(100vw - 28px);
|
||||
border-radius: 18px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
:deep(.pool-detail-dialog .el-dialog__header) {
|
||||
padding: 18px 22px;
|
||||
margin: 0;
|
||||
border-bottom: 1px solid #eef0f5;
|
||||
}
|
||||
|
||||
:deep(.pool-detail-dialog .el-dialog__body) {
|
||||
padding: 18px 22px 22px;
|
||||
background: #f6f8fb;
|
||||
}
|
||||
|
||||
:deep(.el-tag) {
|
||||
border-radius: 4px !important;
|
||||
}
|
||||
|
||||
.detail-header,
|
||||
.header-actions,
|
||||
.section-head,
|
||||
.copy-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.detail-header {
|
||||
justify-content: space-between;
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
.detail-title {
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
color: #1f2937;
|
||||
}
|
||||
|
||||
.detail-subtitle,
|
||||
.section-subtitle {
|
||||
margin-top: 4px;
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
.header-actions {
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.header-actions .el-button {
|
||||
font-size: 18px;
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
.detail-body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 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 {
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.copy-actions .el-button {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.remark-display {
|
||||
padding: 12px;
|
||||
min-height: 42px;
|
||||
border-radius: 10px;
|
||||
background: #f8fafc;
|
||||
color: #303133;
|
||||
line-height: 1.6;
|
||||
white-space: pre-wrap;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
:deep(.pool-detail-dialog) {
|
||||
width: calc(100vw - 24px) !important;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
:deep(.pool-detail-dialog .el-dialog__header) {
|
||||
padding: 14px 14px;
|
||||
}
|
||||
|
||||
:deep(.pool-detail-dialog .el-dialog__body) {
|
||||
padding: 12px;
|
||||
max-height: 76vh;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.detail-header,
|
||||
.section-head {
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.section-head {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.info-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.copy-actions .el-button,
|
||||
.section-head .el-button {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,259 @@
|
||||
<script setup>
|
||||
import { computed, reactive, watch } from 'vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
mode: {
|
||||
type: String,
|
||||
default: 'single', // single | batch
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(['update:modelValue', 'submit']);
|
||||
|
||||
const form = reactive({
|
||||
type: 'account', // account | tk | account_tk
|
||||
account: '',
|
||||
password: '',
|
||||
token: '',
|
||||
batchText: '',
|
||||
remark: '',
|
||||
});
|
||||
|
||||
const isBatch = computed(() => props.mode === 'batch');
|
||||
|
||||
const dialogTitle = computed(() => {
|
||||
return isBatch.value ? '批量添加账号' : '添加账号';
|
||||
});
|
||||
|
||||
const formatExample = computed(() => {
|
||||
if (form.type === 'account') {
|
||||
return 'account,password';
|
||||
}
|
||||
if (form.type === 'account_tk') {
|
||||
return 'account,password,token';
|
||||
}
|
||||
return 'token';
|
||||
});
|
||||
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
(visible) => {
|
||||
if (!visible) return;
|
||||
resetForm();
|
||||
}
|
||||
);
|
||||
|
||||
function closeDialog() {
|
||||
emit('update:modelValue', false);
|
||||
}
|
||||
|
||||
function resetForm() {
|
||||
form.type = 'account';
|
||||
form.account = '';
|
||||
form.password = '';
|
||||
form.token = '';
|
||||
form.batchText = '';
|
||||
form.remark = '';
|
||||
}
|
||||
|
||||
function parseBatchRows() {
|
||||
const rows = form.batchText
|
||||
.split(/\r?\n/)
|
||||
.map((line) => line.trim())
|
||||
.filter(Boolean);
|
||||
|
||||
const parsed = [];
|
||||
const errors = [];
|
||||
|
||||
rows.forEach((line, index) => {
|
||||
if (form.type === 'account') {
|
||||
const [account, password] = line.split(',').map((x) => (x || '').trim());
|
||||
if (!account || !password) {
|
||||
errors.push(`第 ${index + 1} 行格式错误,应为 account,password`);
|
||||
return;
|
||||
}
|
||||
parsed.push({
|
||||
type: 'account',
|
||||
account,
|
||||
password,
|
||||
token: '',
|
||||
remark: form.remark,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (form.type === 'account_tk') {
|
||||
const [account, password, token] = line
|
||||
.split(',')
|
||||
.map((x) => (x || '').trim());
|
||||
if (!account || !token) {
|
||||
errors.push(`第 ${index + 1} 行格式错误,应为 account,password,token(password 可为空)`);
|
||||
return;
|
||||
}
|
||||
parsed.push({
|
||||
type: 'account_tk',
|
||||
account,
|
||||
password,
|
||||
token,
|
||||
remark: form.remark,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
parsed.push({
|
||||
type: 'tk',
|
||||
account: '',
|
||||
password: '',
|
||||
token: line,
|
||||
remark: form.remark,
|
||||
});
|
||||
});
|
||||
|
||||
return { parsed, errors };
|
||||
}
|
||||
|
||||
function handleSubmit() {
|
||||
if (!isBatch.value) {
|
||||
if (form.type === 'account') {
|
||||
if (!form.account || !form.password) {
|
||||
return;
|
||||
}
|
||||
emit('submit', {
|
||||
mode: 'single',
|
||||
rows: [
|
||||
{
|
||||
type: 'account',
|
||||
account: form.account.trim(),
|
||||
password: form.password.trim(),
|
||||
token: '',
|
||||
remark: form.remark.trim(),
|
||||
},
|
||||
],
|
||||
});
|
||||
closeDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
if (form.type === 'account_tk') {
|
||||
if (!form.account || !form.token) {
|
||||
ElMessage.warning('请输入账号和 Token,密码可为空');
|
||||
return;
|
||||
}
|
||||
emit('submit', {
|
||||
mode: 'single',
|
||||
rows: [
|
||||
{
|
||||
type: 'account_tk',
|
||||
account: form.account.trim(),
|
||||
password: form.password.trim(),
|
||||
token: form.token.trim(),
|
||||
remark: form.remark.trim(),
|
||||
},
|
||||
],
|
||||
});
|
||||
closeDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!form.token) return;
|
||||
emit('submit', {
|
||||
mode: 'single',
|
||||
rows: [
|
||||
{
|
||||
type: 'tk',
|
||||
account: '',
|
||||
password: '',
|
||||
token: form.token.trim(),
|
||||
remark: form.remark.trim(),
|
||||
},
|
||||
],
|
||||
});
|
||||
closeDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
const { parsed, errors } = parseBatchRows();
|
||||
if (errors.length || parsed.length === 0) {
|
||||
ElMessage.warning(errors[0] || '请填写批量内容');
|
||||
return;
|
||||
}
|
||||
emit('submit', {
|
||||
mode: 'batch',
|
||||
rows: parsed,
|
||||
});
|
||||
closeDialog();
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<el-dialog
|
||||
:model-value="modelValue"
|
||||
:title="dialogTitle"
|
||||
width="640px"
|
||||
@close="closeDialog"
|
||||
@update:model-value="(v) => emit('update:modelValue', v)"
|
||||
>
|
||||
<el-form label-width="96px">
|
||||
<el-form-item label="账号类型">
|
||||
<el-radio-group v-model="form.type">
|
||||
<el-radio value="account">账号密码</el-radio>
|
||||
<el-radio value="account_tk">账号密码+Token</el-radio>
|
||||
<el-radio value="tk">Token</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
|
||||
<template v-if="!isBatch">
|
||||
<template v-if="form.type === 'account' || form.type === 'account_tk'">
|
||||
<el-form-item label="账号">
|
||||
<el-input v-model="form.account" placeholder="请输入账号" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="密码">
|
||||
<el-input v-model="form.password" placeholder="请输入密码" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item v-if="form.type === 'account_tk'" label="Token">
|
||||
<el-input
|
||||
v-model="form.token"
|
||||
type="textarea"
|
||||
:rows="4"
|
||||
placeholder="请输入 token"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
</template>
|
||||
<el-form-item v-else label="Token">
|
||||
<el-input
|
||||
v-model="form.token"
|
||||
type="textarea"
|
||||
:rows="4"
|
||||
placeholder="请输入 token"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
</template>
|
||||
|
||||
<el-form-item v-else label="批量内容">
|
||||
<el-input
|
||||
v-model="form.batchText"
|
||||
type="textarea"
|
||||
:rows="12"
|
||||
:placeholder="`每行一条,格式:${formatExample}`"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="备注">
|
||||
<el-input v-model="form.remark" placeholder="可选备注" clearable />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<template #footer>
|
||||
<el-button @click="closeDialog">取消</el-button>
|
||||
<el-button type="primary" @click="handleSubmit">确认</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
@@ -0,0 +1,103 @@
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
modelValue: { type: Boolean, default: false },
|
||||
loading: { type: Boolean, default: false },
|
||||
type: { type: String, default: 'account' },
|
||||
platform: { type: String, default: 'local' },
|
||||
remark: { type: String, default: '' },
|
||||
replenish: { type: Boolean, default: false },
|
||||
platformMap: { type: Object, default: () => ({}) },
|
||||
});
|
||||
|
||||
const emit = defineEmits([
|
||||
'update:modelValue',
|
||||
'update:platform',
|
||||
'update:remark',
|
||||
'update:replenish',
|
||||
'confirm',
|
||||
]);
|
||||
|
||||
function typeText(type) {
|
||||
if (type === 'account') return '账号密码';
|
||||
if (type === 'account_tk') return '账号密码+Token';
|
||||
return 'Token';
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<el-dialog
|
||||
class="pool-extract-dialog"
|
||||
:model-value="modelValue"
|
||||
title="提取账号"
|
||||
width="90%"
|
||||
@update:model-value="(v) => emit('update:modelValue', v)"
|
||||
>
|
||||
<el-form label-width="84px">
|
||||
<el-form-item label="提取类型">
|
||||
<el-input :model-value="typeText(type)" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否补号">
|
||||
<el-switch
|
||||
:model-value="replenish"
|
||||
active-text="是"
|
||||
inactive-text="否"
|
||||
@update:model-value="(v) => emit('update:replenish', v)"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="提取平台">
|
||||
<el-select
|
||||
:model-value="platform"
|
||||
style="width: 100%"
|
||||
@update:model-value="(v) => emit('update:platform', v)"
|
||||
>
|
||||
<el-option v-for="(v, k) in platformMap" :key="k" :value="k" :label="v.label" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注">
|
||||
<el-input
|
||||
:model-value="remark"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
placeholder="提取备注(可选)"
|
||||
@update:model-value="(v) => emit('update:remark', v)"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="emit('update:modelValue', false)">取消</el-button>
|
||||
<el-button type="primary" :loading="loading" @click="emit('confirm')">确认提取</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
:deep(.pool-extract-dialog) {
|
||||
max-width: 420px;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
:deep(.pool-extract-dialog) {
|
||||
width: calc(100vw - 24px) !important;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
:deep(.pool-extract-dialog .el-dialog__body) {
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
:deep(.pool-extract-dialog .el-form-item__label) {
|
||||
width: 74px !important;
|
||||
}
|
||||
|
||||
:deep(.pool-extract-dialog .el-dialog__footer .el-button) {
|
||||
width: calc(50% - 6px);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
:deep(.pool-extract-dialog .el-dialog__footer) {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
padding: 8px 12px 12px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,49 @@
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
modelValue: { type: Boolean, default: false },
|
||||
loading: { type: Boolean, default: false },
|
||||
type: { type: String, default: 'tk' },
|
||||
platform: { type: String, default: 'local' },
|
||||
remark: { type: String, default: '' },
|
||||
platformMap: { type: Object, default: () => ({}) },
|
||||
});
|
||||
|
||||
const emit = defineEmits(['update:modelValue', 'update:type', 'update:platform', 'update:remark', 'confirm']);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<el-dialog
|
||||
:model-value="modelValue"
|
||||
title="补号"
|
||||
width="420px"
|
||||
@update:model-value="(v) => emit('update:modelValue', v)"
|
||||
>
|
||||
<el-form label-width="84px">
|
||||
<el-form-item label="账号类型">
|
||||
<el-select :model-value="type" style="width: 100%" @update:model-value="(v) => emit('update:type', v)">
|
||||
<el-option label="Token" value="tk" />
|
||||
<el-option label="账号密码" value="account" />
|
||||
<el-option label="账号密码+Token" value="account_tk" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="提取平台">
|
||||
<el-select :model-value="platform" style="width: 100%" @update:model-value="(v) => emit('update:platform', v)">
|
||||
<el-option v-for="(v, k) in platformMap" :key="k" :value="k" :label="v.label" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注">
|
||||
<el-input
|
||||
:model-value="remark"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
placeholder="提取备注(可选)"
|
||||
@update:model-value="(v) => emit('update:remark', v)"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="emit('update:modelValue', false)">取消</el-button>
|
||||
<el-button type="warning" :loading="loading" @click="emit('confirm')">确认补号</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
@@ -0,0 +1,834 @@
|
||||
<script setup>
|
||||
import { computed, nextTick, onMounted, onUnmounted, reactive, ref, watch } from 'vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import Edit from './components/edit.vue';
|
||||
import DetailDialog from './components/detail.vue';
|
||||
import ExtractDialog from './components/extract.vue';
|
||||
import ReplenishDialog from './components/replenish.vue';import PatchDialog from '../components/patch.vue';
|
||||
import {
|
||||
addAccountPool,
|
||||
batchAddAccountPool,
|
||||
extractAccountPool,
|
||||
getAccountPoolDetail,
|
||||
getAccountPoolList,
|
||||
updateAccountPoolRemark,
|
||||
setAccountPoolUnavailable,
|
||||
updateAccountPoolPlatform,
|
||||
unextractAccountPool,
|
||||
replenishAccountPool,
|
||||
probeAccountPoolToken,
|
||||
} from '@/api/accountPool';
|
||||
|
||||
const moduleKey = "windsurf";
|
||||
|
||||
const loading = ref(false);
|
||||
const editVisible = ref(false);
|
||||
const editMode = ref("single");
|
||||
const detailVisible = ref(false);
|
||||
const extractVisible = ref(false);
|
||||
const extractTargetRow = ref(null);
|
||||
const batchExtractVisible = ref(false);
|
||||
const batchExtractForm = reactive({ platform: 'local', remark: '' });
|
||||
const replenishVisible = ref(false);
|
||||
const replenishForm = reactive({ type: 'tk', platform: 'local', remark: '' });
|
||||
const apiDocVisible = ref(false);
|
||||
const patchVisible = ref(false);
|
||||
|
||||
const query = reactive({ keyword: "", status: "", platform: "" });
|
||||
const activeTypeTab = ref("all");
|
||||
|
||||
const extractForm = reactive({ platform: 'local', type: 'account', remark: '', replenish: false });
|
||||
|
||||
const tableData = ref([]);
|
||||
const total = ref(0);
|
||||
const selectedRows = ref([]);
|
||||
const detailRow = ref(null);
|
||||
const detailRemarkSaving = ref(false);
|
||||
const probeLoadingId = ref(null);
|
||||
const isMobile = ref(false);
|
||||
const pagination = reactive({ page: 1, pageSize: 30 });
|
||||
|
||||
const skipWatchFetchDuringUnusedJump = ref(false);
|
||||
|
||||
const pagedList = computed(() => tableData.value);
|
||||
|
||||
function resetQuery() {
|
||||
query.keyword = "";
|
||||
query.status = "";
|
||||
query.platform = "";
|
||||
}
|
||||
|
||||
const typeTabs = computed(() => [
|
||||
{ label: "全部", value: "all" },
|
||||
{ label: "账号密码", value: "account" },
|
||||
{ label: "账号密码+Token", value: "account_tk" },
|
||||
{ label: "Token", value: "tk" },
|
||||
]);
|
||||
|
||||
watch(
|
||||
() => [query.keyword, query.status, query.platform, activeTypeTab.value],
|
||||
() => {
|
||||
if (skipWatchFetchDuringUnusedJump.value) return;
|
||||
pagination.page = 1;
|
||||
fetchList();
|
||||
},
|
||||
);
|
||||
watch(
|
||||
() => [pagination.page, pagination.pageSize],
|
||||
() => {
|
||||
if (skipWatchFetchDuringUnusedJump.value) return;
|
||||
fetchList();
|
||||
},
|
||||
);
|
||||
|
||||
function openAddDialog(mode = "single") {
|
||||
editMode.value = mode;
|
||||
editVisible.value = true;
|
||||
}
|
||||
|
||||
async function saveRows(rows) {
|
||||
if (!rows.length) return;
|
||||
if (rows.length === 1) {
|
||||
await addAccountPool(moduleKey, rows[0]);
|
||||
return;
|
||||
}
|
||||
await batchAddAccountPool(moduleKey, rows);
|
||||
}
|
||||
|
||||
async function handleEditSubmit(payload) {
|
||||
loading.value = true;
|
||||
try {
|
||||
await saveRows(payload.rows || []);
|
||||
ElMessage.success(
|
||||
payload.mode === "batch" ? "批量添加成功" : "账号添加成功",
|
||||
);
|
||||
await fetchList();
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function handleSelectionChange(rows) {
|
||||
selectedRows.value = rows;
|
||||
}
|
||||
|
||||
function openDetail(row) {
|
||||
loading.value = true;
|
||||
getAccountPoolDetail(moduleKey, row.id)
|
||||
.then((res) => {
|
||||
if (res?.code !== 200) {
|
||||
ElMessage.error(res?.msg || "获取详情失败");
|
||||
return;
|
||||
}
|
||||
detailRow.value = normalizeRow(res.data || {});
|
||||
detailVisible.value = true;
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
function openExtractByRow(row) {
|
||||
extractTargetRow.value = row;
|
||||
extractForm.platform = "local";
|
||||
extractForm.type = row.type;
|
||||
extractForm.remark = row.remark || '';
|
||||
extractForm.replenish = false;
|
||||
extractVisible.value = true;
|
||||
}
|
||||
|
||||
function openPatchDialog() {
|
||||
patchVisible.value = true;
|
||||
}
|
||||
|
||||
function buildCopyTextByRow(row) {
|
||||
const parts = [];
|
||||
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');
|
||||
}
|
||||
|
||||
async function copyToClipboard(text) {
|
||||
if (!text) { ElMessage.warning('无可复制内容'); return false; }
|
||||
try {
|
||||
await navigator.clipboard.writeText(text);
|
||||
ElMessage.success('已复制');
|
||||
return true;
|
||||
} catch (e) {
|
||||
ElMessage.error('复制失败,请检查浏览器权限');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
async function handleExtract() {
|
||||
loading.value = true;
|
||||
try {
|
||||
const target = extractTargetRow.value;
|
||||
if (!target) { ElMessage.warning("未找到提取目标"); return; }
|
||||
const res = await extractAccountPool(moduleKey, {
|
||||
id: target.id,
|
||||
type: target.type,
|
||||
platform: extractForm.platform,
|
||||
remark: extractForm.remark || '',
|
||||
replenish: !!extractForm.replenish,
|
||||
});
|
||||
if (res?.code !== 200) { ElMessage.error(res?.msg || "提取失败"); return; }
|
||||
ElMessage.success("提取成功");
|
||||
extractVisible.value = false;
|
||||
const row = normalizeRow(res.data || {});
|
||||
navigator.clipboard.writeText(rowToText(row)).catch(() => {});
|
||||
await fetchList();
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function handleSaveRemark(payload) {
|
||||
if (!payload?.id) return;
|
||||
detailRemarkSaving.value = true;
|
||||
try {
|
||||
const res = await updateAccountPoolRemark(moduleKey, payload);
|
||||
if (res?.code !== 200) { ElMessage.error(res?.msg || '备注更新失败'); return; }
|
||||
ElMessage.success('备注已更新');
|
||||
if (detailRow.value?.id === payload.id) {
|
||||
detailRow.value = { ...detailRow.value, remark: payload.remark || '' };
|
||||
}
|
||||
await fetchList();
|
||||
} finally { detailRemarkSaving.value = false; }
|
||||
}
|
||||
|
||||
async function refreshDetailRow(id) {
|
||||
if (!id) return;
|
||||
const res = await getAccountPoolDetail(moduleKey, id);
|
||||
if (res?.code === 200) {
|
||||
detailRow.value = normalizeRow(res.data || {});
|
||||
}
|
||||
}
|
||||
|
||||
async function handleDetailAction(payload) {
|
||||
if (!payload?.id || !payload?.action) return;
|
||||
detailRemarkSaving.value = true;
|
||||
try {
|
||||
let res;
|
||||
if (payload.action === 'unavailable') {
|
||||
res = await setAccountPoolUnavailable(moduleKey, { id: payload.id });
|
||||
} else if (payload.action === 'platform') {
|
||||
res = await updateAccountPoolPlatform(moduleKey, {
|
||||
id: payload.id,
|
||||
platform: payload.platform,
|
||||
});
|
||||
} else if (payload.action === 'unextract') {
|
||||
res = await unextractAccountPool(moduleKey, { id: payload.id });
|
||||
}
|
||||
if (res?.code !== 200) {
|
||||
ElMessage.error(res?.msg || '操作失败');
|
||||
return;
|
||||
}
|
||||
ElMessage.success('操作成功');
|
||||
await refreshDetailRow(payload.id);
|
||||
await fetchList();
|
||||
} finally {
|
||||
detailRemarkSaving.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function markExtractForSelected() {
|
||||
if (!selectedRows.value.length) { ElMessage.warning("请先选择数据"); return; }
|
||||
batchExtractForm.platform = 'local';
|
||||
batchExtractForm.remark = '';
|
||||
batchExtractVisible.value = true;
|
||||
}
|
||||
|
||||
async function handleBatchExtract() {
|
||||
loading.value = true;
|
||||
try {
|
||||
const results = await Promise.all(
|
||||
selectedRows.value.map((row) =>
|
||||
extractAccountPool(moduleKey, {
|
||||
id: row.id, type: row.type,
|
||||
platform: batchExtractForm.platform,
|
||||
remark: batchExtractForm.remark || '',
|
||||
}),
|
||||
),
|
||||
);
|
||||
const succeeded = results.filter((r) => r?.code === 200).map((r) => normalizeRow(r.data || {}));
|
||||
const failCount = results.length - succeeded.length;
|
||||
if (failCount > 0) {
|
||||
ElMessage.warning(`${succeeded.length} 条成功,${failCount} 条失败`);
|
||||
} else {
|
||||
ElMessage.success("批量提取成功");
|
||||
}
|
||||
batchExtractVisible.value = false;
|
||||
if (succeeded.length) {
|
||||
const text = succeeded.map(rowToText).filter(Boolean).join('\n');
|
||||
navigator.clipboard.writeText(text).catch(() => {});
|
||||
}
|
||||
fetchList();
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function rowToText(row) {
|
||||
const parts = [];
|
||||
if (row.account) parts.push(row.account);
|
||||
if (row.password) parts.push(row.password);
|
||||
if (row.token) parts.push(row.token);
|
||||
return parts.join(' / ');
|
||||
}
|
||||
|
||||
async function handleReplenish() {
|
||||
loading.value = true;
|
||||
try {
|
||||
const res = await replenishAccountPool(moduleKey, {
|
||||
type: replenishForm.type,
|
||||
platform: replenishForm.platform,
|
||||
remark: replenishForm.remark || '',
|
||||
});
|
||||
if (res?.code !== 200) { ElMessage.error(res?.msg || '补号失败'); return; }
|
||||
ElMessage.success('补号成功,已复制到剪贴板');
|
||||
replenishVisible.value = false;
|
||||
const row = normalizeRow(res.data || {});
|
||||
navigator.clipboard.writeText(rowToText(row)).catch(() => {});
|
||||
await fetchList();
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function typeText(type) {
|
||||
if (type === "account") return "账号密码";
|
||||
if (type === "account_tk") return "账号密码+Token";
|
||||
return "Token";
|
||||
}
|
||||
|
||||
const tooltipOpts = {
|
||||
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' },
|
||||
};
|
||||
|
||||
function platformText(platform) {
|
||||
return PLATFORM_MAP[platform]?.label || platform || "-";
|
||||
}
|
||||
function platformTagType(platform) {
|
||||
return PLATFORM_MAP[platform]?.type || "info";
|
||||
}
|
||||
|
||||
function normalizeRow(raw) {
|
||||
const pick = (...keys) => {
|
||||
for (const key of keys) {
|
||||
if (raw?.[key] !== undefined && raw?.[key] !== null) return raw[key];
|
||||
}
|
||||
return "";
|
||||
};
|
||||
const pickNullable = (...keys) => {
|
||||
for (const key of keys) {
|
||||
if (raw?.[key] !== undefined) return raw[key] ?? null;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
const formatTime = (val) => {
|
||||
if (!val) return "";
|
||||
const d = new Date(val);
|
||||
if (isNaN(d)) return val;
|
||||
const p = (v) => String(v).padStart(2, "0");
|
||||
return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}:${p(d.getSeconds())}`;
|
||||
};
|
||||
const st = Number(pick("is_extracted", "isExtracted", "IsExtracted"));
|
||||
const extractStatus = Number.isFinite(st) ? st : 0;
|
||||
return {
|
||||
id: pick("id", "Id", "ID"),
|
||||
type: pick("data_type", "dataType", "type"),
|
||||
account: pick("account", "Account"),
|
||||
password: pick("password", "Password"),
|
||||
token: pick("token", "Token"),
|
||||
remark: pick("remark", "Remark"),
|
||||
extractStatus,
|
||||
extracted: extractStatus !== 0,
|
||||
extractedAt: formatTime(pickNullable("extracted_time", "extractedAt")),
|
||||
extractedPlatform: pickNullable("extracted_platform", "extractedPlatform"),
|
||||
createdAt: formatTime(pick("create_time", "createdAt")),
|
||||
};
|
||||
}
|
||||
|
||||
function extractStatusLabel(row) {
|
||||
if (row?.extractStatus === 2) return "补号";
|
||||
if (row?.extractStatus === 3) return "续杯";
|
||||
if (row?.extracted) return "已提取";
|
||||
return "未提取";
|
||||
}
|
||||
|
||||
function extractStatusTagType(row) {
|
||||
if (row?.extractStatus === 2) return "warning";
|
||||
if (row?.extractStatus === 3) return "primary";
|
||||
if (row?.extracted) return "success";
|
||||
return "info";
|
||||
}
|
||||
|
||||
async function fetchList() {
|
||||
loading.value = true;
|
||||
try {
|
||||
const res = await getAccountPoolList(moduleKey, {
|
||||
page: pagination.page,
|
||||
pageSize: pagination.pageSize,
|
||||
keyword: query.keyword || undefined,
|
||||
status: query.status || undefined,
|
||||
platform: query.platform || undefined,
|
||||
type: activeTypeTab.value === "all" ? undefined : activeTypeTab.value,
|
||||
});
|
||||
if (res?.code !== 200) {
|
||||
ElMessage.error(res?.msg || "获取列表失败");
|
||||
return;
|
||||
}
|
||||
const list = Array.isArray(res?.data?.list) ? res.data.list : [];
|
||||
tableData.value = list.map(normalizeRow);
|
||||
total.value = Number(res?.data?.total || 0);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function jumpToLastUnusedPage() {
|
||||
const type = activeTypeTab.value === 'all' ? undefined : activeTypeTab.value;
|
||||
const res = await getAccountPoolList(moduleKey, {
|
||||
page: 1,
|
||||
pageSize: pagination.pageSize,
|
||||
keyword: query.keyword || undefined,
|
||||
status: 'unused',
|
||||
type,
|
||||
});
|
||||
if (res?.code !== 200) {
|
||||
ElMessage.error(res?.msg || '获取列表失败');
|
||||
return;
|
||||
}
|
||||
const cnt = Number(res?.data?.total || 0);
|
||||
if (cnt === 0) {
|
||||
ElMessage.warning('暂无未提取数据');
|
||||
return;
|
||||
}
|
||||
const lastPage = Math.max(1, Math.ceil(cnt / pagination.pageSize));
|
||||
skipWatchFetchDuringUnusedJump.value = true;
|
||||
pagination.page = lastPage;
|
||||
query.status = 'unused';
|
||||
await nextTick();
|
||||
skipWatchFetchDuringUnusedJump.value = false;
|
||||
await fetchList();
|
||||
ElMessage.success(`已跳转未提取第 ${lastPage} 页(共 ${cnt} 条)`);
|
||||
}
|
||||
|
||||
onMounted(() => { fetchList(); });
|
||||
|
||||
// ---- 接口说明数据 ----
|
||||
const BASE_URL = "https://api.yunzer.cn";
|
||||
|
||||
const paramDocs = [
|
||||
{ name: 'type', required: true, desc: '来源平台,用于标记本次提取来自哪个渠道', values: 'xianyu / pinduoduo / jingdong / douyin / local' },
|
||||
{ name: 'module', required: true, desc: '号池模块,指定从哪个产品的号池提取', values: 'cursor / windsurf / krio' },
|
||||
{ name: 'data_type', required: false, desc: '账号类型,不传则提取任意类型', values: 'account / tk / account_tk' },
|
||||
];
|
||||
|
||||
const platformDocs = [
|
||||
{ value: 'xianyu', label: '闲鱼', desc: '闲鱼平台发货调用' },
|
||||
{ value: 'pinduoduo', label: '拼多多', desc: '拼多多平台发货调用' },
|
||||
{ value: 'jingdong', label: '京东', desc: '京东平台发货调用' },
|
||||
{ value: 'douyin', label: '抖音', desc: '抖音平台发货调用' },
|
||||
{ value: 'local', label: '本地', desc: '本地手动调用' },
|
||||
];
|
||||
|
||||
const moduleDocs = [
|
||||
{ value: "cursor", label: "Cursor", desc: "Cursor 号池" },
|
||||
{ value: "windsurf", label: "Windsurf", desc: "Windsurf 号池" },
|
||||
{ value: "krio", label: "Krio", desc: "Krio 号池" },
|
||||
];
|
||||
|
||||
const examples = [
|
||||
{
|
||||
label: "闲鱼 · 提取 Windsurf Token",
|
||||
url: `${BASE_URL}/api/getcard?type=xianyu&module=windsurf&data_type=tk`,
|
||||
},
|
||||
{
|
||||
label: "拼多多 · 提取 Windsurf 账号密码",
|
||||
url: `${BASE_URL}/api/getcard?type=pinduoduo&module=windsurf&data_type=account`,
|
||||
},
|
||||
{
|
||||
label: "京东 · 提取 Cursor 任意类型",
|
||||
url: `${BASE_URL}/api/getcard?type=jingdong&module=cursor`,
|
||||
},
|
||||
{
|
||||
label: "抖音 · 提取 Krio Token",
|
||||
url: `${BASE_URL}/api/getcard?type=douyin&module=krio&data_type=tk`,
|
||||
},
|
||||
];
|
||||
|
||||
const successResp = `// 纯 Token 类型(data_type=tk)
|
||||
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
|
||||
|
||||
// 账号密码类型(data_type=account)
|
||||
账号:user@example.com / 密码:your_password
|
||||
|
||||
// 账号密码+Token 类型(data_type=account_tk)
|
||||
账号:user@example.com / 密码:your_password / Token:eyJhbGciOiJIUzI1NiIs...`;
|
||||
|
||||
const errorResp = `// 无可用卡密
|
||||
{ "code": 404, "msg": "暂无可用卡密" }
|
||||
|
||||
// 参数错误
|
||||
{ "code": 400, "msg": "缺少参数 type(来源平台)" }`;
|
||||
|
||||
function copyText(text) {
|
||||
navigator.clipboard.writeText(text).then(() => { ElMessage.success('已复制'); });
|
||||
}
|
||||
|
||||
function copyCardInfo(row) {
|
||||
const parts = [];
|
||||
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('已复制'); });
|
||||
}
|
||||
|
||||
async function handleProbeToken(row) {
|
||||
if (!row?.token) {
|
||||
ElMessage.warning('该行无 Token');
|
||||
return;
|
||||
}
|
||||
probeLoadingId.value = row.id;
|
||||
try {
|
||||
const res = await probeAccountPoolToken(moduleKey, { id: row.id });
|
||||
if (res?.code !== 200) {
|
||||
ElMessage.error(res?.msg || '探测失败');
|
||||
return;
|
||||
}
|
||||
const d = res?.data || {};
|
||||
if (d.ok) {
|
||||
ElMessage.success(d.detail || '官方接口响应正常');
|
||||
} else {
|
||||
ElMessage.error(d.detail || '不可用或校验失败');
|
||||
}
|
||||
} catch {
|
||||
ElMessage.error('探测请求失败');
|
||||
} finally {
|
||||
probeLoadingId.value = null;
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="account-pool-page">
|
||||
<el-card shadow="never">
|
||||
<template #header>
|
||||
<div class="card-header"><span>号池管理(Windsurf)</span></div>
|
||||
</template>
|
||||
|
||||
<div class="toolbar">
|
||||
<div class="toolbar-left">
|
||||
<el-input
|
||||
v-model="query.keyword"
|
||||
placeholder="搜索账号 / token / 备注"
|
||||
clearable
|
||||
class="w-260"
|
||||
/>
|
||||
<el-select
|
||||
v-model="query.status"
|
||||
placeholder="提取状态"
|
||||
clearable
|
||||
class="w-140"
|
||||
>
|
||||
<el-option label="未提取" value="unused" />
|
||||
<el-option label="已提取" value="extracted" />
|
||||
<el-option label="补号" value="replenished" />
|
||||
<el-option label="续杯" value="renewed" />
|
||||
</el-select>
|
||||
<el-select
|
||||
v-model="query.platform"
|
||||
placeholder="提取平台"
|
||||
clearable
|
||||
class="w-140"
|
||||
>
|
||||
<el-option
|
||||
v-for="(v, k) in PLATFORM_MAP"
|
||||
:key="k"
|
||||
:value="k"
|
||||
:label="v.label"
|
||||
/>
|
||||
</el-select>
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
title="按当前搜索与账号类型,筛选未提取并跳到最后一页"
|
||||
@click="jumpToLastUnusedPage"
|
||||
>
|
||||
未提取末页
|
||||
</el-button>
|
||||
<el-button @click="resetQuery">重置</el-button>
|
||||
</div>
|
||||
<div class="toolbar-right">
|
||||
<el-button type="primary" @click="openAddDialog('single')">添加账号</el-button>
|
||||
<el-button type="success" @click="openAddDialog('batch')">批量添加</el-button>
|
||||
<el-button type="warning" @click="replenishVisible = true">补号</el-button>
|
||||
<el-button @click="markExtractForSelected">批量提取</el-button>
|
||||
<el-button @click="apiDocVisible = true">接口说明</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-tabs v-model="activeTypeTab" class="type-tabs">
|
||||
<el-tab-pane
|
||||
v-for="tab in typeTabs"
|
||||
:key="tab.value"
|
||||
:label="tab.label"
|
||||
:name="tab.value"
|
||||
/>
|
||||
</el-tabs>
|
||||
|
||||
<div class="table-scroll">
|
||||
<el-table :data="pagedList" border stripe style="width: 100%" :loading="loading" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="52" />
|
||||
<el-table-column prop="id" label="ID" width="80" />
|
||||
<el-table-column label="账号类型" width="160" align="center">
|
||||
<template #default="{ row }"><el-tag>{{ typeText(row.type) }}</el-tag></template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="account" label="账号" min-width="180" show-overflow-tooltip :tooltip-options="tooltipOpts" />
|
||||
<el-table-column prop="password" label="密码" min-width="160" show-overflow-tooltip :tooltip-options="tooltipOpts">
|
||||
<template #default="{ row }">{{ row.password || '-' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="Token" min-width="200" show-overflow-tooltip :tooltip-options="tooltipOpts">
|
||||
<template #default="{ row }">{{ row.token || '-' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="remark" label="备注" min-width="140" show-overflow-tooltip :tooltip-options="tooltipOpts" />
|
||||
<el-table-column label="提取状态" width="100">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="extractStatusTagType(row)">{{
|
||||
extractStatusLabel(row)
|
||||
}}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="extractedAt" label="提取时间" width="180" />
|
||||
<el-table-column label="提取平台" width="110">
|
||||
<template #default="{ row }">
|
||||
<el-tag
|
||||
v-if="row.extractedPlatform"
|
||||
:type="platformTagType(row.extractedPlatform)"
|
||||
size="small"
|
||||
>
|
||||
{{ platformText(row.extractedPlatform) }}
|
||||
</el-tag>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="300" fixed="right" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" @click="openDetail(row)"
|
||||
>详情</el-button
|
||||
>
|
||||
<el-button
|
||||
v-if="row.token"
|
||||
link
|
||||
type="info"
|
||||
:loading="probeLoadingId === row.id"
|
||||
@click="handleProbeToken(row)"
|
||||
>查可用</el-button
|
||||
>
|
||||
<el-button
|
||||
v-if="!row.extractedAt && !row.extracted"
|
||||
link
|
||||
type="warning"
|
||||
@click="openExtractByRow(row)"
|
||||
>提取</el-button
|
||||
>
|
||||
<el-button
|
||||
v-if="row.extracted"
|
||||
link
|
||||
type="success"
|
||||
@click="copyCardInfo(row)"
|
||||
>复制</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
<div class="pager">
|
||||
<el-pagination
|
||||
v-model:current-page="pagination.page"
|
||||
v-model:page-size="pagination.pageSize"
|
||||
background
|
||||
:layout="isMobile ? 'prev, pager, next' : 'total, prev, pager, next, jumper'"
|
||||
:page-sizes="[30, 50, 100]"
|
||||
:total="total"
|
||||
/>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<Edit v-model="editVisible" :mode="editMode" @submit="handleEditSubmit" />
|
||||
|
||||
<DetailDialog
|
||||
v-model="detailVisible"
|
||||
:row="detailRow"
|
||||
:save-loading="detailRemarkSaving"
|
||||
@save-remark="handleSaveRemark"
|
||||
@detail-action="handleDetailAction"
|
||||
/>
|
||||
|
||||
<ExtractDialog
|
||||
v-model="extractVisible"
|
||||
:loading="loading"
|
||||
:type="extractForm.type"
|
||||
:platform="extractForm.platform"
|
||||
:remark="extractForm.remark"
|
||||
:replenish="extractForm.replenish"
|
||||
:platform-map="PLATFORM_MAP"
|
||||
@update:platform="(v) => (extractForm.platform = v)"
|
||||
@update:remark="(v) => (extractForm.remark = v)"
|
||||
@update:replenish="(v) => (extractForm.replenish = v)"
|
||||
@confirm="handleExtract"
|
||||
/>
|
||||
|
||||
<ReplenishDialog
|
||||
v-model="replenishVisible"
|
||||
:loading="loading"
|
||||
:type="replenishForm.type"
|
||||
:platform="replenishForm.platform"
|
||||
:remark="replenishForm.remark"
|
||||
:platform-map="PLATFORM_MAP"
|
||||
@update:type="(v) => (replenishForm.type = v)"
|
||||
@update:platform="(v) => (replenishForm.platform = v)"
|
||||
@update:remark="(v) => (replenishForm.remark = v)"
|
||||
@confirm="handleReplenish"
|
||||
/>
|
||||
|
||||
<!-- 接口说明抽屉 -->
|
||||
<el-drawer
|
||||
v-model="apiDocVisible"
|
||||
title="提卡接口说明"
|
||||
size="560px"
|
||||
direction="rtl"
|
||||
>
|
||||
<div class="api-doc">
|
||||
<el-alert type="info" :closable="false" style="margin-bottom: 16px">
|
||||
该接口为对外公开接口,无需登录认证,每次调用自动提取一条未使用的卡密并标记为已提取(不可重复)。
|
||||
</el-alert>
|
||||
<div class="doc-section">
|
||||
<div class="doc-title">接口地址</div>
|
||||
<el-tag type="success" class="method-tag">GET</el-tag>
|
||||
<code class="url-code">https://api.yunzer.cn/api/getcard</code>
|
||||
</div>
|
||||
<div class="doc-section">
|
||||
<div class="doc-title">请求参数</div>
|
||||
<el-table :data="paramDocs" border size="small">
|
||||
<el-table-column prop="name" label="参数名" width="120" />
|
||||
<el-table-column
|
||||
prop="required"
|
||||
label="必填"
|
||||
width="60"
|
||||
align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="row.required ? 'danger' : 'info'" size="small">{{
|
||||
row.required ? "是" : "否"
|
||||
}}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="desc" label="说明" />
|
||||
<el-table-column prop="values" label="可选值" min-width="160" />
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="doc-section">
|
||||
<div class="doc-title">调用示例</div>
|
||||
<div v-for="ex in examples" :key="ex.label" class="example-item">
|
||||
<div class="example-label">{{ ex.label }}</div>
|
||||
<div class="example-url-wrap">
|
||||
<code class="example-url">{{ ex.url }}</code>
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="copyText(ex.url)"
|
||||
>复制</el-button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="doc-section">
|
||||
<div class="doc-title">成功响应</div>
|
||||
<pre class="code-block">{{ successResp }}</pre>
|
||||
</div>
|
||||
<div class="doc-section">
|
||||
<div class="doc-title">失败响应</div>
|
||||
<pre class="code-block">{{ errorResp }}</pre>
|
||||
</div>
|
||||
<div class="doc-section">
|
||||
<div class="doc-title">支持的平台(type 参数)</div>
|
||||
<el-table :data="platformDocs" border size="small">
|
||||
<el-table-column prop="value" label="type 值" width="130" />
|
||||
<el-table-column prop="label" label="平台" width="100" />
|
||||
<el-table-column prop="desc" label="说明" />
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="doc-section">
|
||||
<div class="doc-title">支持的号池(module 参数)</div>
|
||||
<el-table :data="moduleDocs" border size="small">
|
||||
<el-table-column prop="value" label="module 值" width="130" />
|
||||
<el-table-column prop="label" label="号池" width="100" />
|
||||
<el-table-column prop="desc" label="说明" />
|
||||
</el-table>
|
||||
</div>
|
||||
</div>
|
||||
</el-drawer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.account-pool-page { padding: 12px; }
|
||||
.card-header { display: flex; align-items: center; justify-content: space-between; }
|
||||
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
|
||||
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
|
||||
.w-260 { width: 260px; }
|
||||
.w-140 { width: 140px; }
|
||||
.type-tabs { margin-bottom: 12px; }
|
||||
.pager { display: flex; justify-content: flex-end; margin-top: 14px; }
|
||||
.table-scroll { width: 100%; overflow-x: hidden; }
|
||||
.pool-table { min-width: 980px; }
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.account-pool-page { padding: 8px; }
|
||||
.toolbar { gap: 8px; }
|
||||
.toolbar-left, .toolbar-right { width: 100%; gap: 8px; }
|
||||
.w-260, .w-140 { width: 100%; }
|
||||
.toolbar-right .el-button {
|
||||
flex: 1 1 calc(50% - 8px);
|
||||
min-width: 120px;
|
||||
margin: 0;
|
||||
}
|
||||
.type-tabs :deep(.el-tabs__nav-wrap) { overflow-x: auto; overflow-y: hidden; }
|
||||
.pager { justify-content: center; }
|
||||
}
|
||||
.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>
|
||||
.pool-tooltip.el-popper {
|
||||
max-width: 600px;
|
||||
white-space: pre-wrap;
|
||||
word-break: break-all;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user