更新前端
This commit is contained in:
parent
f25aaaa028
commit
1b78ad1626
@ -50,3 +50,11 @@ export function updateAccountPoolRemark(module, data) {
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
export function replenishAccountPool(module, data) {
|
||||
return request({
|
||||
url: `${base(module)}/replenish`,
|
||||
method: 'post',
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<script setup>
|
||||
import { computed, reactive, watch } from 'vue';
|
||||
import { computed, reactive, watch } from "vue";
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
@ -8,35 +8,35 @@ const props = defineProps({
|
||||
},
|
||||
mode: {
|
||||
type: String,
|
||||
default: 'single', // single | batch
|
||||
default: "single", // single | batch
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(['update:modelValue', 'submit']);
|
||||
const emit = defineEmits(["update:modelValue", "submit"]);
|
||||
|
||||
const form = reactive({
|
||||
type: 'account', // account | tk | account_tk
|
||||
account: '',
|
||||
password: '',
|
||||
token: '',
|
||||
batchText: '',
|
||||
remark: '',
|
||||
type: "tk", // account | tk | account_tk
|
||||
account: "",
|
||||
password: "",
|
||||
token: "",
|
||||
batchText: "",
|
||||
remark: "",
|
||||
});
|
||||
|
||||
const isBatch = computed(() => props.mode === 'batch');
|
||||
const isBatch = computed(() => props.mode === "batch");
|
||||
|
||||
const dialogTitle = computed(() => {
|
||||
return isBatch.value ? '批量添加账号' : '添加账号';
|
||||
return isBatch.value ? "批量添加账号" : "添加账号";
|
||||
});
|
||||
|
||||
const formatExample = computed(() => {
|
||||
if (form.type === 'account') {
|
||||
return 'account,password';
|
||||
if (form.type === "account") {
|
||||
return "account,password";
|
||||
}
|
||||
if (form.type === 'account_tk') {
|
||||
return 'account,password,token';
|
||||
if (form.type === "account_tk") {
|
||||
return "account,password,token";
|
||||
}
|
||||
return 'token';
|
||||
return "token";
|
||||
});
|
||||
|
||||
watch(
|
||||
@ -44,20 +44,20 @@ watch(
|
||||
(visible) => {
|
||||
if (!visible) return;
|
||||
resetForm();
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
function closeDialog() {
|
||||
emit('update:modelValue', false);
|
||||
emit("update:modelValue", false);
|
||||
}
|
||||
|
||||
function resetForm() {
|
||||
form.type = 'account';
|
||||
form.account = '';
|
||||
form.password = '';
|
||||
form.token = '';
|
||||
form.batchText = '';
|
||||
form.remark = '';
|
||||
form.type = "tk";
|
||||
form.account = "";
|
||||
form.password = "";
|
||||
form.token = "";
|
||||
form.batchText = "";
|
||||
form.remark = "";
|
||||
}
|
||||
|
||||
function parseBatchRows() {
|
||||
@ -70,32 +70,32 @@ function parseBatchRows() {
|
||||
const errors = [];
|
||||
|
||||
rows.forEach((line, index) => {
|
||||
if (form.type === 'account') {
|
||||
const [account, password] = line.split(',').map((x) => (x || '').trim());
|
||||
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',
|
||||
type: "account",
|
||||
account,
|
||||
password,
|
||||
token: '',
|
||||
token: "",
|
||||
remark: form.remark,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (form.type === 'account_tk') {
|
||||
if (form.type === "account_tk") {
|
||||
const [account, password, token] = line
|
||||
.split(',')
|
||||
.map((x) => (x || '').trim());
|
||||
.split(",")
|
||||
.map((x) => (x || "").trim());
|
||||
if (!account || !password || !token) {
|
||||
errors.push(`第 ${index + 1} 行格式错误,应为 account,password,token`);
|
||||
return;
|
||||
}
|
||||
parsed.push({
|
||||
type: 'account_tk',
|
||||
type: "account_tk",
|
||||
account,
|
||||
password,
|
||||
token,
|
||||
@ -105,9 +105,9 @@ function parseBatchRows() {
|
||||
}
|
||||
|
||||
parsed.push({
|
||||
type: 'tk',
|
||||
account: '',
|
||||
password: '',
|
||||
type: "tk",
|
||||
account: "",
|
||||
password: "",
|
||||
token: line,
|
||||
remark: form.remark,
|
||||
});
|
||||
@ -118,18 +118,18 @@ function parseBatchRows() {
|
||||
|
||||
function handleSubmit() {
|
||||
if (!isBatch.value) {
|
||||
if (form.type === 'account') {
|
||||
if (form.type === "account") {
|
||||
if (!form.account || !form.password) {
|
||||
return;
|
||||
}
|
||||
emit('submit', {
|
||||
mode: 'single',
|
||||
emit("submit", {
|
||||
mode: "single",
|
||||
rows: [
|
||||
{
|
||||
type: 'account',
|
||||
type: "account",
|
||||
account: form.account.trim(),
|
||||
password: form.password.trim(),
|
||||
token: '',
|
||||
token: "",
|
||||
remark: form.remark.trim(),
|
||||
},
|
||||
],
|
||||
@ -138,15 +138,15 @@ function handleSubmit() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (form.type === 'account_tk') {
|
||||
if (form.type === "account_tk") {
|
||||
if (!form.account || !form.password || !form.token) {
|
||||
return;
|
||||
}
|
||||
emit('submit', {
|
||||
mode: 'single',
|
||||
emit("submit", {
|
||||
mode: "single",
|
||||
rows: [
|
||||
{
|
||||
type: 'account_tk',
|
||||
type: "account_tk",
|
||||
account: form.account.trim(),
|
||||
password: form.password.trim(),
|
||||
token: form.token.trim(),
|
||||
@ -159,13 +159,13 @@ function handleSubmit() {
|
||||
}
|
||||
|
||||
if (!form.token) return;
|
||||
emit('submit', {
|
||||
mode: 'single',
|
||||
emit("submit", {
|
||||
mode: "single",
|
||||
rows: [
|
||||
{
|
||||
type: 'tk',
|
||||
account: '',
|
||||
password: '',
|
||||
type: "tk",
|
||||
account: "",
|
||||
password: "",
|
||||
token: form.token.trim(),
|
||||
remark: form.remark.trim(),
|
||||
},
|
||||
@ -179,8 +179,8 @@ function handleSubmit() {
|
||||
if (errors.length || parsed.length === 0) {
|
||||
return;
|
||||
}
|
||||
emit('submit', {
|
||||
mode: 'batch',
|
||||
emit("submit", {
|
||||
mode: "batch",
|
||||
rows: parsed,
|
||||
});
|
||||
closeDialog();
|
||||
@ -198,19 +198,27 @@ function handleSubmit() {
|
||||
<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 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-input
|
||||
v-model="form.account"
|
||||
placeholder="请输入账号"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="密码">
|
||||
<el-input v-model="form.password" placeholder="请输入密码" clearable />
|
||||
<el-input
|
||||
v-model="form.password"
|
||||
placeholder="请输入密码"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="form.type === 'account_tk'" label="Token">
|
||||
<el-input
|
||||
|
||||
49
src/views/accountpool/cursor/components/replenish.vue
Normal file
49
src/views/accountpool/cursor/components/replenish.vue
Normal file
@ -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>
|
||||
@ -1,27 +1,19 @@
|
||||
<script setup>
|
||||
<<<<<<< Updated upstream
|
||||
import { computed, onMounted, 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 { computed, onMounted, reactive, ref, watch } from "vue";
|
||||
import { ElMessage } from "element-plus";
|
||||
import Edit from "./components/edit.vue";
|
||||
>>>>>>> Stashed changes
|
||||
import DetailDialog from "./components/detail.vue";
|
||||
import ExtractDialog from "./components/extract.vue";
|
||||
import ReplenishDialog from "./components/replenish.vue";
|
||||
import {
|
||||
addAccountPool,
|
||||
batchAddAccountPool,
|
||||
extractAccountPool,
|
||||
getAccountPoolDetail,
|
||||
getAccountPoolList,
|
||||
<<<<<<< Updated upstream
|
||||
updateAccountPoolRemark,
|
||||
} from '@/api/accountPool';
|
||||
=======
|
||||
replenishAccountPool,
|
||||
} from "@/api/accountPool";
|
||||
>>>>>>> Stashed changes
|
||||
|
||||
const moduleKey = "cursor";
|
||||
|
||||
@ -31,6 +23,10 @@ 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 query = reactive({
|
||||
@ -40,14 +36,9 @@ const query = reactive({
|
||||
const activeTypeTab = ref("all");
|
||||
|
||||
const extractForm = reactive({
|
||||
<<<<<<< Updated upstream
|
||||
platform: 'local',
|
||||
type: 'account',
|
||||
remark: '',
|
||||
=======
|
||||
platform: "local",
|
||||
type: "account",
|
||||
>>>>>>> Stashed changes
|
||||
remark: "",
|
||||
});
|
||||
|
||||
const tableData = ref([]);
|
||||
@ -97,17 +88,12 @@ function openAddDialog(mode = "single") {
|
||||
editVisible.value = true;
|
||||
}
|
||||
|
||||
<<<<<<< Updated upstream
|
||||
=======
|
||||
function nowText() {
|
||||
const d = new Date();
|
||||
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())}`;
|
||||
return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}:${p(d.getSeconds())}`;
|
||||
}
|
||||
|
||||
>>>>>>> Stashed changes
|
||||
async function saveRows(rows) {
|
||||
if (!rows.length) return;
|
||||
if (rows.length === 1) {
|
||||
@ -150,8 +136,6 @@ function openDetail(row) {
|
||||
});
|
||||
}
|
||||
|
||||
<<<<<<< Updated upstream
|
||||
=======
|
||||
function openExtractDialog() {
|
||||
extractTargetRow.value = null;
|
||||
extractForm.platform = "local";
|
||||
@ -159,12 +143,11 @@ function openExtractDialog() {
|
||||
extractVisible.value = true;
|
||||
}
|
||||
|
||||
>>>>>>> Stashed changes
|
||||
function openExtractByRow(row) {
|
||||
extractTargetRow.value = row;
|
||||
extractForm.platform = "local";
|
||||
extractForm.type = row.type;
|
||||
extractForm.remark = row.remark || '';
|
||||
extractForm.remark = row.remark || "";
|
||||
extractVisible.value = true;
|
||||
}
|
||||
|
||||
@ -180,7 +163,7 @@ async function handleExtract() {
|
||||
id: target.id,
|
||||
type: target.type,
|
||||
platform: extractForm.platform,
|
||||
remark: extractForm.remark || '',
|
||||
remark: extractForm.remark || "",
|
||||
});
|
||||
if (res?.code !== 200) {
|
||||
ElMessage.error(res?.msg || "提取失败");
|
||||
@ -188,6 +171,8 @@ async function handleExtract() {
|
||||
}
|
||||
ElMessage.success("提取成功");
|
||||
extractVisible.value = false;
|
||||
const row = normalizeRow(res.data || {});
|
||||
navigator.clipboard.writeText(rowToText(row)).catch(() => {});
|
||||
await fetchList();
|
||||
} finally {
|
||||
loading.value = false;
|
||||
@ -200,12 +185,12 @@ async function handleSaveRemark(payload) {
|
||||
try {
|
||||
const res = await updateAccountPoolRemark(moduleKey, payload);
|
||||
if (res?.code !== 200) {
|
||||
ElMessage.error(res?.msg || '备注更新失败');
|
||||
ElMessage.error(res?.msg || "备注更新失败");
|
||||
return;
|
||||
}
|
||||
ElMessage.success('备注已更新');
|
||||
ElMessage.success("备注已更新");
|
||||
if (detailRow.value?.id === payload.id) {
|
||||
detailRow.value = { ...detailRow.value, remark: payload.remark || '' };
|
||||
detailRow.value = { ...detailRow.value, remark: payload.remark || "" };
|
||||
}
|
||||
await fetchList();
|
||||
} finally {
|
||||
@ -218,23 +203,42 @@ function markExtractForSelected() {
|
||||
ElMessage.warning("请先选择数据");
|
||||
return;
|
||||
}
|
||||
batchExtractForm.platform = "local";
|
||||
batchExtractForm.remark = "";
|
||||
batchExtractVisible.value = true;
|
||||
}
|
||||
|
||||
async function handleBatchExtract() {
|
||||
loading.value = true;
|
||||
Promise.all(
|
||||
try {
|
||||
const results = await Promise.all(
|
||||
selectedRows.value.map((row) =>
|
||||
extractAccountPool(moduleKey, {
|
||||
id: row.id,
|
||||
type: row.type,
|
||||
platform: "local",
|
||||
platform: batchExtractForm.platform,
|
||||
remark: batchExtractForm.remark || "",
|
||||
}),
|
||||
),
|
||||
)
|
||||
.then(() => {
|
||||
);
|
||||
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(() => {
|
||||
} finally {
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function typeText(type) {
|
||||
@ -420,6 +424,36 @@ function copyCardInfo(row) {
|
||||
ElMessage.success("已复制");
|
||||
});
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@ -451,6 +485,9 @@ function copyCardInfo(row) {
|
||||
<el-button @click="resetQuery">重置</el-button>
|
||||
</div>
|
||||
<div class="toolbar-right">
|
||||
<el-button type="warning" @click="replenishVisible = true"
|
||||
>补号</el-button
|
||||
>
|
||||
<el-button type="primary" @click="openAddDialog('single')"
|
||||
>添加账号</el-button
|
||||
>
|
||||
@ -574,7 +611,6 @@ function copyCardInfo(row) {
|
||||
|
||||
<Edit v-model="editVisible" :mode="editMode" @submit="handleEditSubmit" />
|
||||
|
||||
<<<<<<< Updated upstream
|
||||
<DetailDialog
|
||||
v-model="detailVisible"
|
||||
:row="detailRow"
|
||||
@ -593,53 +629,12 @@ function copyCardInfo(row) {
|
||||
@update:remark="(v) => (extractForm.remark = v)"
|
||||
@confirm="handleExtract"
|
||||
/>
|
||||
=======
|
||||
<el-dialog v-model="detailVisible" title="账号详情" width="560px">
|
||||
<el-descriptions :column="1" border v-if="detailRow">
|
||||
<el-descriptions-item label="ID">{{
|
||||
detailRow.id
|
||||
}}</el-descriptions-item>
|
||||
<el-descriptions-item label="提取状态">
|
||||
{{ detailRow.extracted ? "已提取" : "未提取" }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="提取平台">
|
||||
<el-tag
|
||||
v-if="detailRow.extractedPlatform"
|
||||
:type="platformTagType(detailRow.extractedPlatform)"
|
||||
size="small"
|
||||
>
|
||||
{{ platformText(detailRow.extractedPlatform) }}
|
||||
</el-tag>
|
||||
<span v-else>-</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="账号类型">
|
||||
{{ typeText(detailRow.type) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="账号">
|
||||
{{ detailRow.account || "-" }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="密码">
|
||||
{{ detailRow.password || "-" }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="Token">
|
||||
<span class="token-text">{{ detailRow.token || "-" }}</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="提取时间">
|
||||
{{ detailRow.extractedAt || "-" }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="备注">
|
||||
{{ detailRow.remark || "-" }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog v-model="extractVisible" title="提取账号" width="420px">
|
||||
<!-- 批量提取弹窗 -->
|
||||
<el-dialog v-model="batchExtractVisible" title="批量提取" width="420px">
|
||||
<el-form label-width="84px">
|
||||
<el-form-item label="提取类型">
|
||||
<el-input :model-value="typeText(extractForm.type)" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="提取平台">
|
||||
<el-select v-model="extractForm.platform" style="width: 100%">
|
||||
<el-select v-model="batchExtractForm.platform" style="width: 100%">
|
||||
<el-option
|
||||
v-for="(v, k) in PLATFORM_MAP"
|
||||
:key="k"
|
||||
@ -648,15 +643,40 @@ function copyCardInfo(row) {
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注">
|
||||
<el-input
|
||||
v-model="batchExtractForm.remark"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
placeholder="提取备注(可选)"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="extractVisible = false">取消</el-button>
|
||||
<el-button type="primary" :loading="loading" @click="handleExtract">
|
||||
<el-button @click="batchExtractVisible = false">取消</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
:loading="loading"
|
||||
@click="handleBatchExtract"
|
||||
>
|
||||
确认提取
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
>>>>>>> Stashed changes
|
||||
|
||||
<!-- 补号弹窗 -->
|
||||
<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
|
||||
@ -868,6 +888,35 @@ function copyCardInfo(row) {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.extract-result-item {
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.result-row {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 10px;
|
||||
padding: 6px 0;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.result-label {
|
||||
flex-shrink: 0;
|
||||
width: 44px;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
.result-val {
|
||||
flex: 1;
|
||||
word-break: break-all;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.token-val {
|
||||
font-family: monospace;
|
||||
font-size: 12px;
|
||||
color: #409eff;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style>
|
||||
|
||||
49
src/views/accountpool/kiro/components/replenish.vue
Normal file
49
src/views/accountpool/kiro/components/replenish.vue
Normal file
@ -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>
|
||||
@ -1,27 +1,19 @@
|
||||
<script setup>
|
||||
<<<<<<< Updated upstream
|
||||
import { computed, onMounted, 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 { computed, onMounted, reactive, ref, watch } from "vue";
|
||||
import { ElMessage } from "element-plus";
|
||||
import Edit from "./components/edit.vue";
|
||||
>>>>>>> Stashed changes
|
||||
import ReplenishDialog from './components/replenish.vue';
|
||||
import {
|
||||
addAccountPool,
|
||||
batchAddAccountPool,
|
||||
extractAccountPool,
|
||||
getAccountPoolDetail,
|
||||
getAccountPoolList,
|
||||
<<<<<<< Updated upstream
|
||||
updateAccountPoolRemark,
|
||||
replenishAccountPool,
|
||||
} from '@/api/accountPool';
|
||||
=======
|
||||
} from "@/api/accountPool";
|
||||
>>>>>>> Stashed changes
|
||||
|
||||
const moduleKey = "krio";
|
||||
|
||||
@ -31,16 +23,16 @@ 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 query = reactive({ keyword: "", status: "" });
|
||||
const activeTypeTab = ref("all");
|
||||
|
||||
<<<<<<< Updated upstream
|
||||
const extractForm = reactive({ platform: 'local', type: 'account', remark: '' });
|
||||
=======
|
||||
const extractForm = reactive({ platform: "local", type: "account" });
|
||||
>>>>>>> Stashed changes
|
||||
|
||||
const tableData = ref([]);
|
||||
const total = ref(0);
|
||||
@ -136,25 +128,15 @@ async function handleExtract() {
|
||||
loading.value = true;
|
||||
try {
|
||||
const target = extractTargetRow.value;
|
||||
if (!target) {
|
||||
ElMessage.warning("未找到提取目标");
|
||||
return;
|
||||
}
|
||||
if (!target) { ElMessage.warning("未找到提取目标"); return; }
|
||||
const res = await extractAccountPool(moduleKey, {
|
||||
<<<<<<< Updated upstream
|
||||
id: target.id, type: target.type, platform: extractForm.platform, remark: extractForm.remark || '',
|
||||
=======
|
||||
id: target.id,
|
||||
type: target.type,
|
||||
platform: extractForm.platform,
|
||||
>>>>>>> Stashed changes
|
||||
});
|
||||
if (res?.code !== 200) {
|
||||
ElMessage.error(res?.msg || "提取失败");
|
||||
return;
|
||||
}
|
||||
if (res?.code !== 200) { ElMessage.error(res?.msg || "提取失败"); return; }
|
||||
ElMessage.success("提取成功");
|
||||
extractVisible.value = false;
|
||||
const row = normalizeRow(res.data || {});
|
||||
navigator.clipboard.writeText(rowToText(row)).catch(() => {});
|
||||
await fetchList();
|
||||
} finally {
|
||||
loading.value = false;
|
||||
@ -176,27 +158,67 @@ async function handleSaveRemark(payload) {
|
||||
}
|
||||
|
||||
function markExtractForSelected() {
|
||||
if (!selectedRows.value.length) {
|
||||
ElMessage.warning("请先选择数据");
|
||||
return;
|
||||
if (!selectedRows.value.length) { ElMessage.warning("请先选择数据"); return; }
|
||||
batchExtractForm.platform = 'local';
|
||||
batchExtractForm.remark = '';
|
||||
batchExtractVisible.value = true;
|
||||
}
|
||||
|
||||
async function handleBatchExtract() {
|
||||
loading.value = true;
|
||||
Promise.all(
|
||||
try {
|
||||
const results = await Promise.all(
|
||||
selectedRows.value.map((row) =>
|
||||
extractAccountPool(moduleKey, {
|
||||
id: row.id,
|
||||
type: row.type,
|
||||
platform: "local",
|
||||
id: row.id, type: row.type,
|
||||
platform: batchExtractForm.platform,
|
||||
remark: batchExtractForm.remark || '',
|
||||
}),
|
||||
),
|
||||
)
|
||||
.then(() => {
|
||||
);
|
||||
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(() => {
|
||||
} 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) {
|
||||
@ -409,6 +431,7 @@ function copyCardInfo(row) {
|
||||
<el-button @click="resetQuery">重置</el-button>
|
||||
</div>
|
||||
<div class="toolbar-right">
|
||||
<el-button type="warning" @click="replenishVisible = true">补号</el-button>
|
||||
<el-button type="primary" @click="openAddDialog('single')"
|
||||
>添加账号</el-button
|
||||
>
|
||||
@ -532,7 +555,6 @@ function copyCardInfo(row) {
|
||||
|
||||
<Edit v-model="editVisible" :mode="editMode" @submit="handleEditSubmit" />
|
||||
|
||||
<<<<<<< Updated upstream
|
||||
<DetailDialog
|
||||
v-model="detailVisible"
|
||||
:row="detailRow"
|
||||
@ -551,70 +573,38 @@ function copyCardInfo(row) {
|
||||
@update:remark="(v) => (extractForm.remark = v)"
|
||||
@confirm="handleExtract"
|
||||
/>
|
||||
=======
|
||||
<el-dialog v-model="detailVisible" title="账号详情" width="560px">
|
||||
<el-descriptions :column="1" border v-if="detailRow">
|
||||
<el-descriptions-item label="ID">{{
|
||||
detailRow.id
|
||||
}}</el-descriptions-item>
|
||||
<el-descriptions-item label="账号类型">{{
|
||||
typeText(detailRow.type)
|
||||
}}</el-descriptions-item>
|
||||
<el-descriptions-item label="账号">{{
|
||||
detailRow.account || "-"
|
||||
}}</el-descriptions-item>
|
||||
<el-descriptions-item label="密码">{{
|
||||
detailRow.password || "-"
|
||||
}}</el-descriptions-item>
|
||||
<el-descriptions-item label="Token">
|
||||
<span class="token-text">{{ detailRow.token || "-" }}</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="提取状态">{{
|
||||
detailRow.extracted ? "已提取" : "未提取"
|
||||
}}</el-descriptions-item>
|
||||
<el-descriptions-item label="提取时间">{{
|
||||
detailRow.extractedAt || "-"
|
||||
}}</el-descriptions-item>
|
||||
<el-descriptions-item label="提取平台">
|
||||
<el-tag
|
||||
v-if="detailRow.extractedPlatform"
|
||||
:type="platformTagType(detailRow.extractedPlatform)"
|
||||
size="small"
|
||||
>
|
||||
{{ platformText(detailRow.extractedPlatform) }}
|
||||
</el-tag>
|
||||
<span v-else>-</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="备注">{{
|
||||
detailRow.remark || "-"
|
||||
}}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog v-model="extractVisible" title="提取账号" width="420px">
|
||||
<!-- 批量提取弹窗 -->
|
||||
<el-dialog v-model="batchExtractVisible" title="批量提取" width="420px">
|
||||
<el-form label-width="84px">
|
||||
<el-form-item label="提取类型">
|
||||
<el-input :model-value="typeText(extractForm.type)" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="提取平台">
|
||||
<el-select v-model="extractForm.platform" style="width: 100%">
|
||||
<el-option
|
||||
v-for="(v, k) in PLATFORM_MAP"
|
||||
:key="k"
|
||||
:value="k"
|
||||
:label="v.label"
|
||||
/>
|
||||
<el-select v-model="batchExtractForm.platform" style="width: 100%">
|
||||
<el-option v-for="(v, k) in PLATFORM_MAP" :key="k" :value="k" :label="v.label" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注">
|
||||
<el-input v-model="batchExtractForm.remark" type="textarea" :rows="3" placeholder="提取备注(可选)" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="extractVisible = false">取消</el-button>
|
||||
<el-button type="primary" :loading="loading" @click="handleExtract"
|
||||
>确认提取</el-button
|
||||
>
|
||||
<el-button @click="batchExtractVisible = false">取消</el-button>
|
||||
<el-button type="primary" :loading="loading" @click="handleBatchExtract">确认提取</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
>>>>>>> Stashed changes
|
||||
|
||||
<!-- 补号弹窗 -->
|
||||
<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
|
||||
@ -698,7 +688,6 @@ function copyCardInfo(row) {
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
<<<<<<< Updated upstream
|
||||
.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; }
|
||||
@ -717,111 +706,6 @@ function copyCardInfo(row) {
|
||||
.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; }
|
||||
=======
|
||||
.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;
|
||||
}
|
||||
.pagination-wrap {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
margin-top: 14px;
|
||||
}
|
||||
.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;
|
||||
}
|
||||
.token-text {
|
||||
word-break: break-all;
|
||||
white-space: pre-wrap;
|
||||
line-height: 1.6;
|
||||
}
|
||||
>>>>>>> Stashed changes
|
||||
</style>
|
||||
|
||||
<style>
|
||||
|
||||
49
src/views/accountpool/windsurf/components/replenish.vue
Normal file
49
src/views/accountpool/windsurf/components/replenish.vue
Normal file
@ -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>
|
||||
@ -1,27 +1,18 @@
|
||||
<script setup>
|
||||
<<<<<<< Updated upstream
|
||||
import { computed, onMounted, 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 { computed, onMounted, reactive, ref, watch } from "vue";
|
||||
import { ElMessage } from "element-plus";
|
||||
import Edit from "./components/edit.vue";
|
||||
>>>>>>> Stashed changes
|
||||
import {
|
||||
import ReplenishDialog from './components/replenish.vue';import {
|
||||
addAccountPool,
|
||||
batchAddAccountPool,
|
||||
extractAccountPool,
|
||||
getAccountPoolDetail,
|
||||
getAccountPoolList,
|
||||
<<<<<<< Updated upstream
|
||||
updateAccountPoolRemark,
|
||||
replenishAccountPool,
|
||||
} from '@/api/accountPool';
|
||||
=======
|
||||
} from "@/api/accountPool";
|
||||
>>>>>>> Stashed changes
|
||||
|
||||
const moduleKey = "windsurf";
|
||||
|
||||
@ -31,16 +22,16 @@ 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 query = reactive({ keyword: "", status: "" });
|
||||
const activeTypeTab = ref("all");
|
||||
|
||||
<<<<<<< Updated upstream
|
||||
const extractForm = reactive({ platform: 'local', type: 'account', remark: '' });
|
||||
=======
|
||||
const extractForm = reactive({ platform: "local", type: "account" });
|
||||
>>>>>>> Stashed changes
|
||||
|
||||
const tableData = ref([]);
|
||||
const total = ref(0);
|
||||
@ -136,25 +127,15 @@ async function handleExtract() {
|
||||
loading.value = true;
|
||||
try {
|
||||
const target = extractTargetRow.value;
|
||||
if (!target) {
|
||||
ElMessage.warning("未找到提取目标");
|
||||
return;
|
||||
}
|
||||
if (!target) { ElMessage.warning("未找到提取目标"); return; }
|
||||
const res = await extractAccountPool(moduleKey, {
|
||||
<<<<<<< Updated upstream
|
||||
id: target.id, type: target.type, platform: extractForm.platform, remark: extractForm.remark || '',
|
||||
=======
|
||||
id: target.id,
|
||||
type: target.type,
|
||||
platform: extractForm.platform,
|
||||
>>>>>>> Stashed changes
|
||||
});
|
||||
if (res?.code !== 200) {
|
||||
ElMessage.error(res?.msg || "提取失败");
|
||||
return;
|
||||
}
|
||||
if (res?.code !== 200) { ElMessage.error(res?.msg || "提取失败"); return; }
|
||||
ElMessage.success("提取成功");
|
||||
extractVisible.value = false;
|
||||
const row = normalizeRow(res.data || {});
|
||||
navigator.clipboard.writeText(rowToText(row)).catch(() => {});
|
||||
await fetchList();
|
||||
} finally {
|
||||
loading.value = false;
|
||||
@ -176,27 +157,67 @@ async function handleSaveRemark(payload) {
|
||||
}
|
||||
|
||||
function markExtractForSelected() {
|
||||
if (!selectedRows.value.length) {
|
||||
ElMessage.warning("请先选择数据");
|
||||
return;
|
||||
if (!selectedRows.value.length) { ElMessage.warning("请先选择数据"); return; }
|
||||
batchExtractForm.platform = 'local';
|
||||
batchExtractForm.remark = '';
|
||||
batchExtractVisible.value = true;
|
||||
}
|
||||
|
||||
async function handleBatchExtract() {
|
||||
loading.value = true;
|
||||
Promise.all(
|
||||
try {
|
||||
const results = await Promise.all(
|
||||
selectedRows.value.map((row) =>
|
||||
extractAccountPool(moduleKey, {
|
||||
id: row.id,
|
||||
type: row.type,
|
||||
platform: "local",
|
||||
id: row.id, type: row.type,
|
||||
platform: batchExtractForm.platform,
|
||||
remark: batchExtractForm.remark || '',
|
||||
}),
|
||||
),
|
||||
)
|
||||
.then(() => {
|
||||
);
|
||||
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(() => {
|
||||
} 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) {
|
||||
@ -409,6 +430,7 @@ function copyCardInfo(row) {
|
||||
<el-button @click="resetQuery">重置</el-button>
|
||||
</div>
|
||||
<div class="toolbar-right">
|
||||
<el-button type="warning" @click="replenishVisible = true">补号</el-button>
|
||||
<el-button type="primary" @click="openAddDialog('single')"
|
||||
>添加账号</el-button
|
||||
>
|
||||
@ -532,7 +554,6 @@ function copyCardInfo(row) {
|
||||
|
||||
<Edit v-model="editVisible" :mode="editMode" @submit="handleEditSubmit" />
|
||||
|
||||
<<<<<<< Updated upstream
|
||||
<DetailDialog
|
||||
v-model="detailVisible"
|
||||
:row="detailRow"
|
||||
@ -551,70 +572,38 @@ function copyCardInfo(row) {
|
||||
@update:remark="(v) => (extractForm.remark = v)"
|
||||
@confirm="handleExtract"
|
||||
/>
|
||||
=======
|
||||
<el-dialog v-model="detailVisible" title="账号详情" width="560px">
|
||||
<el-descriptions :column="1" border v-if="detailRow">
|
||||
<el-descriptions-item label="ID">{{
|
||||
detailRow.id
|
||||
}}</el-descriptions-item>
|
||||
<el-descriptions-item label="提取状态">{{
|
||||
detailRow.extracted ? "已提取" : "未提取"
|
||||
}}</el-descriptions-item>
|
||||
<el-descriptions-item label="提取平台">
|
||||
<el-tag
|
||||
v-if="detailRow.extractedPlatform"
|
||||
:type="platformTagType(detailRow.extractedPlatform)"
|
||||
size="small"
|
||||
>
|
||||
{{ platformText(detailRow.extractedPlatform) }}
|
||||
</el-tag>
|
||||
<span v-else>-</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="账号类型">{{
|
||||
typeText(detailRow.type)
|
||||
}}</el-descriptions-item>
|
||||
<el-descriptions-item label="账号">{{
|
||||
detailRow.account || "-"
|
||||
}}</el-descriptions-item>
|
||||
<el-descriptions-item label="密码">{{
|
||||
detailRow.password || "-"
|
||||
}}</el-descriptions-item>
|
||||
<el-descriptions-item label="Token">
|
||||
<span class="token-text">{{ detailRow.token || "-" }}</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="提取时间">{{
|
||||
detailRow.extractedAt || "-"
|
||||
}}</el-descriptions-item>
|
||||
<el-descriptions-item label="备注">{{
|
||||
detailRow.remark || "-"
|
||||
}}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog v-model="extractVisible" title="提取账号" width="420px">
|
||||
<!-- 批量提取弹窗 -->
|
||||
<el-dialog v-model="batchExtractVisible" title="批量提取" width="420px">
|
||||
<el-form label-width="84px">
|
||||
<el-form-item label="提取类型">
|
||||
<el-input :model-value="typeText(extractForm.type)" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="提取平台">
|
||||
<el-select v-model="extractForm.platform" style="width: 100%">
|
||||
<el-option
|
||||
v-for="(v, k) in PLATFORM_MAP"
|
||||
:key="k"
|
||||
:value="k"
|
||||
:label="v.label"
|
||||
/>
|
||||
<el-select v-model="batchExtractForm.platform" style="width: 100%">
|
||||
<el-option v-for="(v, k) in PLATFORM_MAP" :key="k" :value="k" :label="v.label" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注">
|
||||
<el-input v-model="batchExtractForm.remark" type="textarea" :rows="3" placeholder="提取备注(可选)" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="extractVisible = false">取消</el-button>
|
||||
<el-button type="primary" :loading="loading" @click="handleExtract"
|
||||
>确认提取</el-button
|
||||
>
|
||||
<el-button @click="batchExtractVisible = false">取消</el-button>
|
||||
<el-button type="primary" :loading="loading" @click="handleBatchExtract">确认提取</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
>>>>>>> Stashed changes
|
||||
|
||||
<!-- 补号弹窗 -->
|
||||
<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
|
||||
@ -698,7 +687,6 @@ function copyCardInfo(row) {
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
<<<<<<< Updated upstream
|
||||
.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; }
|
||||
@ -717,111 +705,6 @@ function copyCardInfo(row) {
|
||||
.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; }
|
||||
=======
|
||||
.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;
|
||||
}
|
||||
.pagination-wrap {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
margin-top: 14px;
|
||||
}
|
||||
.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;
|
||||
}
|
||||
.token-text {
|
||||
word-break: break-all;
|
||||
white-space: pre-wrap;
|
||||
line-height: 1.6;
|
||||
}
|
||||
>>>>>>> Stashed changes
|
||||
</style>
|
||||
|
||||
<style>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user