Initial import of WebUp Cloud
Verify control plane / verify (push) Canceled after 0s

This commit is contained in:
WebUp Cloud committed 2026-11-07 13:31:14 +08:00
commit db82325ed7
216 files changed
+33718

No files matched your search

+191
View File
@@ -0,0 +1,191 @@
<script setup lang="ts">
import { onMounted, ref } from "vue";
import { api, body } from "../api";
import { useSession } from "../store";
const store = useSession(),
sites = ref<any[]>([]),
search = ref(""),
status = ref("ALL"),
error = ref(""),
success = ref(""),
busy = ref(false),
operations = ref<any[]>([]);
const labels: Record<string, string> = {
PENDING: "待审核",
APPROVED: "审核通过",
REJECTED: "已驳回",
BANNED: "已封禁",
};
async function load() {
busy.value = true;
try {
sites.value = await api(
"/admin/sites?search=" +
encodeURIComponent(search.value) +
"&status=" +
status.value,
);
} catch (e) {
error.value = (e as Error).message;
} finally {
busy.value = false;
}
}
async function review(p: any, next: string) {
const reason = prompt(
"将「" + p.name + "」设为“" + labels[next] + "”,请填写原因:",
);
if (!reason) return;
if (
next === "BANNED" &&
!confirm("确认封禁?将阻止发布与恢复,并排队暂停运行。")
)
return;
try {
const r = await api("/admin/sites/" + p.id + "/review", {
method: "POST",
body: body({ status: next, reason }),
});
success.value = r.message;
await load();
} catch (e) {
error.value = (e as Error).message;
}
}
async function history(p: any) {
try {
operations.value = await api("/admin/sites/" + p.id + "/operations");
} catch (e) {
error.value = (e as Error).message;
}
}
onMounted(load);
</script>
<template>
<div class="page-heading">
<div>
<span class="eyebrow">WEBSITE MODERATION</span>
<h1>网站管理与人工审核</h1>
<p>查看用户网站、审核发布资格、封禁与解除封禁,全部保留审计。</p>
</div>
<button class="secondary" :disabled="busy" @click="load">刷新</button>
</div>
<div v-if="error" class="alert error">{{ error }}</div>
<div v-if="success" class="alert success">{{ success }}</div>
<form class="toolbar" @submit.prevent="load">
<input
v-model="search"
placeholder="搜索网站或用户邮箱"
maxlength="200"
/><select v-model="status" @change="load">
<option value="ALL">全部状态</option>
<option v-for="(label, key) in labels" :key="key" :value="key">
{{ label }}
</option></select
><button class="primary" :disabled="busy">查询</button>
</form>
<section class="panel table-panel">
<div class="table-scroll">
<table>
<thead>
<tr>
<th>网站项目</th>
<th>所属用户</th>
<th>审核状态</th>
<th>发布 / 套餐</th>
<th>运行操作</th>
<th>审核原因</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr v-for="p in sites" :key="p.id">
<td>
{{ p.name
}}<small class="block"
>{{ p.stack }} · {{ p.services }} 服务</small
>
</td>
<td>
{{ p.display_name }}<small class="block">{{ p.email }}</small>
</td>
<td>
<span
class="status"
:class="{ danger: p.review_status === 'BANNED' }"
>{{ labels[p.review_status] }}</span
>
</td>
<td>
{{ p.active_deployments ? "有发布版本" : "未发布"
}}<small class="block">{{
p.subscription_status || "无套餐"
}}</small>
</td>
<td>{{ p.operation_status || "—" }}</td>
<td class="audit-detail">{{ p.review_reason || "—" }}</td>
<td>
<div
class="table-actions"
v-if="store.user?.permissions.includes('moderation:write')"
>
<button
v-if="p.review_status !== 'APPROVED'"
class="link"
@click="review(p, 'APPROVED')"
>
{{
p.review_status === "BANNED" ? "解除封禁" : "通过"
}}</button
><button
v-if="p.review_status === 'PENDING'"
class="link"
@click="review(p, 'REJECTED')"
>
驳回</button
><button
v-if="p.review_status !== 'BANNED'"
class="link danger"
@click="review(p, 'BANNED')"
>
封禁</button
><button class="link" @click="history(p)">执行记录</button>
</div>
</td>
</tr>
<tr v-if="!sites.length">
<td colspan="7" class="empty">暂无匹配的网站项目</td>
</tr>
</tbody>
</table>
</div>
</section>
<div class="alert info">
封禁不删除项目数据。审核状态与实际暂停执行状态分别记录,未连接运行网关时不会伪造已下线。
</div>
<section v-if="operations.length" class="panel table-panel">
<div class="panel-heading"><h3>运行操作记录</h3></div>
<div class="table-scroll">
<table>
<thead>
<tr>
<th>动作</th>
<th>状态</th>
<th>原因</th>
<th>错误</th>
<th>时间</th>
</tr>
</thead>
<tbody>
<tr v-for="o in operations" :key="o.id">
<td>{{ o.action }}</td>
<td>{{ o.status }}</td>
<td>{{ o.reason }}</td>
<td>{{ o.error || "—" }}</td>
<td>{{ new Date(o.created_at).toLocaleString() }}</td>
</tr>
</tbody>
</table>
</div>
</section>
</template>