Files
jczxw-pc/.output/server/chunks/build/users-R2tJfhAK.mjs
赵忠林 528fe28ffc feat(api): 添加多路由代理处理实现
- 新增api目录下多个接口路径代理处理文件,支持动态拼接目标URL
- 根据环境变量选择不同的后端服务地址(如dev和生产环境)
- 统一添加TenantId和Authorization请求头传递租户及身份信息
- 实现请求参数及搜索参数的完整转发
- 引入better-sqlite3及node内建模块支持服务端功能
- 新增专家详情页面,实现文章、成果及预约咨询功能展示
- 页面实现加载骨架屏、标签页切换及空状态提示优化体验
2026-04-28 13:50:27 +08:00

1121 lines
51 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { defineComponent, ref, reactive, resolveComponent, mergeProps, withCtx, unref, createTextVNode, createVNode, toDisplayString, createBlock, openBlock, Fragment, renderList, isRef, createCommentVNode, useSSRContext } from 'vue';
import { ssrRenderAttrs, ssrRenderComponent, ssrRenderList, ssrRenderClass, ssrInterpolate, ssrRenderStyle } from 'vue/server-renderer';
import { ReloadOutlined, UserOutlined } from '@ant-design/icons-vue';
import { message } from 'ant-design-vue';
import { p as pageUsers, u as updateUserStatus, a as updateUserPassword } from './index-fit_DIQT.mjs';
import { a as _export_sfc, c as useHead } from './server.mjs';
import './request-BIxQh2im.mjs';
import '../nitro/nitro.mjs';
import 'node:http';
import 'node:https';
import 'node:events';
import 'node:buffer';
import 'node:fs';
import 'node:path';
import 'node:crypto';
import 'node:url';
import 'better-sqlite3';
import 'vue-router';
import '@babel/runtime/helpers/esm/extends';
import 'stylis';
import 'dayjs';
import '../routes/renderer.mjs';
import 'vue-bundle-renderer/runtime';
import 'unhead/server';
import 'devalue';
import 'unhead/plugins';
import 'unhead/utils';
const _sfc_main = /* @__PURE__ */ defineComponent({
__name: "users",
__ssrInlineRender: true,
setup(__props) {
useHead({ title: "用户管理 - 平台管理" });
const loading = ref(false);
const users2 = ref([]);
const filterStatus = ref(void 0);
const searchKeyword = ref("");
const pagination = reactive({
current: 1,
pageSize: 20,
total: 0,
showSizeChanger: true,
showQuickJumper: true
});
const stats = reactive([
{ icon: "👥", label: "总用户数", value: 0, color: "blue" },
{ icon: "✅", label: "正常用户", value: 0, color: "green" },
{ icon: "🔒", label: "冻结用户", value: 0, color: "red" },
{ icon: "🛡️", label: "管理员", value: 0, color: "orange" }
]);
const columns = [
{ title: "用户信息", key: "userInfo", width: 220 },
{ title: "联系方式", key: "contact", width: 180 },
{ title: "账号状态", key: "status", width: 110 },
{ title: "余额/积分", key: "balance", width: 140 },
{ title: "注册时间", key: "createTime", width: 110 },
{ title: "操作", key: "action", width: 220 }
];
const showDetailModal = ref(false);
const currentUser = ref(null);
async function loadUsers() {
loading.value = true;
try {
const res = await pageUsers({
page: pagination.current,
limit: pagination.pageSize,
status: filterStatus.value,
keywords: searchKeyword.value || void 0
});
users2.value = res?.list || [];
pagination.total = res?.count || 0;
loadStats();
} catch {
message.error("加载用户列表失败");
} finally {
loading.value = false;
}
}
async function loadStats() {
try {
const [allRes, normalRes, frozenRes, adminRes] = await Promise.allSettled([
pageUsers({ page: 1, limit: 1 }),
pageUsers({ page: 1, limit: 1, status: 0 }),
pageUsers({ page: 1, limit: 1, status: 1 }),
pageUsers({ page: 1, limit: 1, isAdmin: 1 })
]);
if (allRes.status === "fulfilled") stats[0].value = allRes.value?.count || 0;
if (normalRes.status === "fulfilled") stats[1].value = normalRes.value?.count || 0;
if (frozenRes.status === "fulfilled") stats[2].value = frozenRes.value?.count || 0;
if (adminRes.status === "fulfilled") stats[3].value = adminRes.value?.count || 0;
} catch {
}
}
function handleSearch() {
pagination.current = 1;
loadUsers();
}
function handleTableChange(pag) {
pagination.current = pag.current;
pagination.pageSize = pag.pageSize;
loadUsers();
}
function handleView(record) {
currentUser.value = record;
showDetailModal.value = true;
}
async function handleToggleStatus(record) {
const newStatus = record.status === 0 ? 1 : 0;
try {
await updateUserStatus(record.userId, newStatus);
message.success(newStatus === 1 ? "用户已冻结" : "用户已解冻");
loadUsers();
} catch (e) {
message.error(e?.message || "操作失败");
}
}
async function handleResetPassword(record) {
try {
await updateUserPassword(record.userId, "123456");
message.success(`已重置「${record.nickname || record.username}」的密码为 123456`);
} catch (e) {
message.error(e?.message || "重置失败");
}
}
return (_ctx, _push, _parent, _attrs) => {
const _component_a_space = resolveComponent("a-space");
const _component_a_button = resolveComponent("a-button");
const _component_a_row = resolveComponent("a-row");
const _component_a_col = resolveComponent("a-col");
const _component_a_select = resolveComponent("a-select");
const _component_a_select_option = resolveComponent("a-select-option");
const _component_a_input_search = resolveComponent("a-input-search");
const _component_a_table = resolveComponent("a-table");
const _component_a_avatar = resolveComponent("a-avatar");
const _component_a_tag = resolveComponent("a-tag");
const _component_a_badge = resolveComponent("a-badge");
const _component_a_popconfirm = resolveComponent("a-popconfirm");
const _component_a_modal = resolveComponent("a-modal");
const _component_a_divider = resolveComponent("a-divider");
const _component_a_descriptions = resolveComponent("a-descriptions");
const _component_a_descriptions_item = resolveComponent("a-descriptions-item");
_push(`<div${ssrRenderAttrs(mergeProps({ class: "users-page" }, _attrs))} data-v-0c7d49a8><div class="page-header" data-v-0c7d49a8><div data-v-0c7d49a8><h2 class="page-title" data-v-0c7d49a8>👥 用户管理</h2><p class="page-desc" data-v-0c7d49a8>管理平台所有注册用户,可查看用户信息、调整状态</p></div>`);
_push(ssrRenderComponent(_component_a_space, null, {
default: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
_push2(ssrRenderComponent(_component_a_button, {
onClick: loadUsers,
loading: unref(loading)
}, {
icon: withCtx((_2, _push3, _parent3, _scopeId2) => {
if (_push3) {
_push3(ssrRenderComponent(unref(ReloadOutlined), null, null, _parent3, _scopeId2));
} else {
return [
createVNode(unref(ReloadOutlined))
];
}
}),
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
if (_push3) {
_push3(` 刷新 `);
} else {
return [
createTextVNode(" 刷新 ")
];
}
}),
_: 1
}, _parent2, _scopeId));
} else {
return [
createVNode(_component_a_button, {
onClick: loadUsers,
loading: unref(loading)
}, {
icon: withCtx(() => [
createVNode(unref(ReloadOutlined))
]),
default: withCtx(() => [
createTextVNode(" 刷新 ")
]),
_: 1
}, 8, ["loading"])
];
}
}),
_: 1
}, _parent));
_push(`</div>`);
_push(ssrRenderComponent(_component_a_row, {
gutter: [16, 16],
class: "mb-6"
}, {
default: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
_push2(`<!--[-->`);
ssrRenderList(unref(stats), (stat) => {
_push2(ssrRenderComponent(_component_a_col, {
xs: 12,
md: 6,
key: stat.label
}, {
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
if (_push3) {
_push3(`<div class="${ssrRenderClass([stat.color, "stat-card"])}" data-v-0c7d49a8${_scopeId2}><div class="stat-icon" data-v-0c7d49a8${_scopeId2}>${ssrInterpolate(stat.icon)}</div><div class="stat-info" data-v-0c7d49a8${_scopeId2}><div class="stat-value" data-v-0c7d49a8${_scopeId2}>${ssrInterpolate(stat.value)}</div><div class="stat-label" data-v-0c7d49a8${_scopeId2}>${ssrInterpolate(stat.label)}</div></div></div>`);
} else {
return [
createVNode("div", {
class: ["stat-card", stat.color]
}, [
createVNode("div", { class: "stat-icon" }, toDisplayString(stat.icon), 1),
createVNode("div", { class: "stat-info" }, [
createVNode("div", { class: "stat-value" }, toDisplayString(stat.value), 1),
createVNode("div", { class: "stat-label" }, toDisplayString(stat.label), 1)
])
], 2)
];
}
}),
_: 2
}, _parent2, _scopeId));
});
_push2(`<!--]-->`);
} else {
return [
(openBlock(true), createBlock(Fragment, null, renderList(unref(stats), (stat) => {
return openBlock(), createBlock(_component_a_col, {
xs: 12,
md: 6,
key: stat.label
}, {
default: withCtx(() => [
createVNode("div", {
class: ["stat-card", stat.color]
}, [
createVNode("div", { class: "stat-icon" }, toDisplayString(stat.icon), 1),
createVNode("div", { class: "stat-info" }, [
createVNode("div", { class: "stat-value" }, toDisplayString(stat.value), 1),
createVNode("div", { class: "stat-label" }, toDisplayString(stat.label), 1)
])
], 2)
]),
_: 2
}, 1024);
}), 128))
];
}
}),
_: 1
}, _parent));
_push(`<div class="panel" data-v-0c7d49a8><div class="panel-header" data-v-0c7d49a8><span class="panel-title" data-v-0c7d49a8>📋 用户列表</span>`);
_push(ssrRenderComponent(_component_a_space, { wrap: "" }, {
default: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
_push2(ssrRenderComponent(_component_a_select, {
value: unref(filterStatus),
"onUpdate:value": ($event) => isRef(filterStatus) ? filterStatus.value = $event : null,
style: { "width": "120px" },
onChange: handleSearch
}, {
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
if (_push3) {
_push3(ssrRenderComponent(_component_a_select_option, { value: void 0 }, {
default: withCtx((_3, _push4, _parent4, _scopeId3) => {
if (_push4) {
_push4(`全部状态`);
} else {
return [
createTextVNode("全部状态")
];
}
}),
_: 1
}, _parent3, _scopeId2));
_push3(ssrRenderComponent(_component_a_select_option, { value: 0 }, {
default: withCtx((_3, _push4, _parent4, _scopeId3) => {
if (_push4) {
_push4(`正常`);
} else {
return [
createTextVNode("正常")
];
}
}),
_: 1
}, _parent3, _scopeId2));
_push3(ssrRenderComponent(_component_a_select_option, { value: 1 }, {
default: withCtx((_3, _push4, _parent4, _scopeId3) => {
if (_push4) {
_push4(`已冻结`);
} else {
return [
createTextVNode("已冻结")
];
}
}),
_: 1
}, _parent3, _scopeId2));
} else {
return [
createVNode(_component_a_select_option, { value: void 0 }, {
default: withCtx(() => [
createTextVNode("全部状态")
]),
_: 1
}),
createVNode(_component_a_select_option, { value: 0 }, {
default: withCtx(() => [
createTextVNode("正常")
]),
_: 1
}),
createVNode(_component_a_select_option, { value: 1 }, {
default: withCtx(() => [
createTextVNode("已冻结")
]),
_: 1
})
];
}
}),
_: 1
}, _parent2, _scopeId));
_push2(ssrRenderComponent(_component_a_input_search, {
value: unref(searchKeyword),
"onUpdate:value": ($event) => isRef(searchKeyword) ? searchKeyword.value = $event : null,
placeholder: "搜索用户名/手机/邮箱",
style: { "width": "220px" },
onSearch: handleSearch
}, null, _parent2, _scopeId));
} else {
return [
createVNode(_component_a_select, {
value: unref(filterStatus),
"onUpdate:value": ($event) => isRef(filterStatus) ? filterStatus.value = $event : null,
style: { "width": "120px" },
onChange: handleSearch
}, {
default: withCtx(() => [
createVNode(_component_a_select_option, { value: void 0 }, {
default: withCtx(() => [
createTextVNode("全部状态")
]),
_: 1
}),
createVNode(_component_a_select_option, { value: 0 }, {
default: withCtx(() => [
createTextVNode("正常")
]),
_: 1
}),
createVNode(_component_a_select_option, { value: 1 }, {
default: withCtx(() => [
createTextVNode("已冻结")
]),
_: 1
})
]),
_: 1
}, 8, ["value", "onUpdate:value"]),
createVNode(_component_a_input_search, {
value: unref(searchKeyword),
"onUpdate:value": ($event) => isRef(searchKeyword) ? searchKeyword.value = $event : null,
placeholder: "搜索用户名/手机/邮箱",
style: { "width": "220px" },
onSearch: handleSearch
}, null, 8, ["value", "onUpdate:value"])
];
}
}),
_: 1
}, _parent));
_push(`</div>`);
_push(ssrRenderComponent(_component_a_table, {
columns,
"data-source": unref(users2),
loading: unref(loading),
pagination: unref(pagination),
"row-key": "userId",
onChange: handleTableChange,
size: "middle"
}, {
bodyCell: withCtx(({ column, record }, _push2, _parent2, _scopeId) => {
if (_push2) {
if (column.key === "userInfo") {
_push2(`<div class="user-info-cell" data-v-0c7d49a8${_scopeId}>`);
_push2(ssrRenderComponent(_component_a_avatar, {
size: 38,
src: record.avatar || record.avatarUrl
}, {
icon: withCtx((_, _push3, _parent3, _scopeId2) => {
if (_push3) {
_push3(ssrRenderComponent(unref(UserOutlined), null, null, _parent3, _scopeId2));
} else {
return [
createVNode(unref(UserOutlined))
];
}
}),
_: 2
}, _parent2, _scopeId));
_push2(`<div class="user-info-text" data-v-0c7d49a8${_scopeId}><div class="user-name" data-v-0c7d49a8${_scopeId}>${ssrInterpolate(record.nickname || record.username)} `);
if (record.isAdmin) {
_push2(ssrRenderComponent(_component_a_tag, {
color: "red",
style: { "margin-left": "6px", "font-size": "10px" }
}, {
default: withCtx((_, _push3, _parent3, _scopeId2) => {
if (_push3) {
_push3(`管理员`);
} else {
return [
createTextVNode("管理员")
];
}
}),
_: 2
}, _parent2, _scopeId));
} else {
_push2(`<!---->`);
}
_push2(`</div><div class="user-sub" data-v-0c7d49a8${_scopeId}>@${ssrInterpolate(record.username)}</div></div></div>`);
} else {
_push2(`<!---->`);
}
if (column.key === "contact") {
_push2(`<div style="${ssrRenderStyle({ "font-size": "13px" })}" data-v-0c7d49a8${_scopeId}>`);
if (record.phone || record.mobile) {
_push2(`<div data-v-0c7d49a8${_scopeId}>📱 ${ssrInterpolate(record.phone || record.mobile)}</div>`);
} else {
_push2(`<!---->`);
}
if (record.email) {
_push2(`<div style="${ssrRenderStyle({ "color": "rgba(0,0,0,0.45)", "font-size": "12px" })}" data-v-0c7d49a8${_scopeId}>${ssrInterpolate(record.email)}</div>`);
} else {
_push2(`<!---->`);
}
if (!record.phone && !record.mobile && !record.email) {
_push2(`<span class="text-gray-400" data-v-0c7d49a8${_scopeId}>-</span>`);
} else {
_push2(`<!---->`);
}
_push2(`</div>`);
} else {
_push2(`<!---->`);
}
if (column.key === "status") {
_push2(ssrRenderComponent(_component_a_badge, {
status: record.status === 0 ? "success" : "error",
text: record.status === 0 ? "正常" : "已冻结"
}, null, _parent2, _scopeId));
} else {
_push2(`<!---->`);
}
if (column.key === "balance") {
_push2(`<div style="${ssrRenderStyle({ "font-size": "13px" })}" data-v-0c7d49a8${_scopeId}>`);
if (record.balance !== void 0) {
_push2(`<div style="${ssrRenderStyle({ "color": "#059669" })}" data-v-0c7d49a8${_scopeId}>💰 ¥${ssrInterpolate((record.balance / 100).toFixed(2))}</div>`);
} else {
_push2(`<!---->`);
}
if (record.points !== void 0) {
_push2(`<div style="${ssrRenderStyle({ "color": "rgba(0,0,0,0.45)", "font-size": "12px" })}" data-v-0c7d49a8${_scopeId}>🏆 ${ssrInterpolate(record.points)} 积分</div>`);
} else {
_push2(`<!---->`);
}
_push2(`</div>`);
} else {
_push2(`<!---->`);
}
if (column.key === "createTime") {
_push2(`<span class="text-sm text-gray" data-v-0c7d49a8${_scopeId}>${ssrInterpolate(record.createTime?.substring(0, 10) || "-")}</span>`);
} else {
_push2(`<!---->`);
}
if (column.key === "action") {
_push2(ssrRenderComponent(_component_a_space, null, {
default: withCtx((_, _push3, _parent3, _scopeId2) => {
if (_push3) {
_push3(ssrRenderComponent(_component_a_button, {
type: "link",
size: "small",
onClick: ($event) => handleView(record)
}, {
default: withCtx((_2, _push4, _parent4, _scopeId3) => {
if (_push4) {
_push4(`详情`);
} else {
return [
createTextVNode("详情")
];
}
}),
_: 2
}, _parent3, _scopeId2));
_push3(ssrRenderComponent(_component_a_popconfirm, {
title: record.status === 0 ? "确认冻结此用户账号?" : "确认解冻此用户账号?",
onConfirm: ($event) => handleToggleStatus(record)
}, {
default: withCtx((_2, _push4, _parent4, _scopeId3) => {
if (_push4) {
_push4(ssrRenderComponent(_component_a_button, {
type: "link",
size: "small",
danger: record.status === 0
}, {
default: withCtx((_3, _push5, _parent5, _scopeId4) => {
if (_push5) {
_push5(`${ssrInterpolate(record.status === 0 ? "冻结" : "解冻")}`);
} else {
return [
createTextVNode(toDisplayString(record.status === 0 ? "冻结" : "解冻"), 1)
];
}
}),
_: 2
}, _parent4, _scopeId3));
} else {
return [
createVNode(_component_a_button, {
type: "link",
size: "small",
danger: record.status === 0
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(record.status === 0 ? "冻结" : "解冻"), 1)
]),
_: 2
}, 1032, ["danger"])
];
}
}),
_: 2
}, _parent3, _scopeId2));
_push3(ssrRenderComponent(_component_a_popconfirm, {
title: "确认重置密码为 123456",
onConfirm: ($event) => handleResetPassword(record)
}, {
default: withCtx((_2, _push4, _parent4, _scopeId3) => {
if (_push4) {
_push4(ssrRenderComponent(_component_a_button, {
type: "link",
size: "small"
}, {
default: withCtx((_3, _push5, _parent5, _scopeId4) => {
if (_push5) {
_push5(`重置密码`);
} else {
return [
createTextVNode("重置密码")
];
}
}),
_: 2
}, _parent4, _scopeId3));
} else {
return [
createVNode(_component_a_button, {
type: "link",
size: "small"
}, {
default: withCtx(() => [
createTextVNode("重置密码")
]),
_: 1
})
];
}
}),
_: 2
}, _parent3, _scopeId2));
} else {
return [
createVNode(_component_a_button, {
type: "link",
size: "small",
onClick: ($event) => handleView(record)
}, {
default: withCtx(() => [
createTextVNode("详情")
]),
_: 1
}, 8, ["onClick"]),
createVNode(_component_a_popconfirm, {
title: record.status === 0 ? "确认冻结此用户账号?" : "确认解冻此用户账号?",
onConfirm: ($event) => handleToggleStatus(record)
}, {
default: withCtx(() => [
createVNode(_component_a_button, {
type: "link",
size: "small",
danger: record.status === 0
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(record.status === 0 ? "冻结" : "解冻"), 1)
]),
_: 2
}, 1032, ["danger"])
]),
_: 2
}, 1032, ["title", "onConfirm"]),
createVNode(_component_a_popconfirm, {
title: "确认重置密码为 123456",
onConfirm: ($event) => handleResetPassword(record)
}, {
default: withCtx(() => [
createVNode(_component_a_button, {
type: "link",
size: "small"
}, {
default: withCtx(() => [
createTextVNode("重置密码")
]),
_: 1
})
]),
_: 1
}, 8, ["onConfirm"])
];
}
}),
_: 2
}, _parent2, _scopeId));
} else {
_push2(`<!---->`);
}
} else {
return [
column.key === "userInfo" ? (openBlock(), createBlock("div", {
key: 0,
class: "user-info-cell"
}, [
createVNode(_component_a_avatar, {
size: 38,
src: record.avatar || record.avatarUrl
}, {
icon: withCtx(() => [
createVNode(unref(UserOutlined))
]),
_: 1
}, 8, ["src"]),
createVNode("div", { class: "user-info-text" }, [
createVNode("div", { class: "user-name" }, [
createTextVNode(toDisplayString(record.nickname || record.username) + " ", 1),
record.isAdmin ? (openBlock(), createBlock(_component_a_tag, {
key: 0,
color: "red",
style: { "margin-left": "6px", "font-size": "10px" }
}, {
default: withCtx(() => [
createTextVNode("管理员")
]),
_: 1
})) : createCommentVNode("", true)
]),
createVNode("div", { class: "user-sub" }, "@" + toDisplayString(record.username), 1)
])
])) : createCommentVNode("", true),
column.key === "contact" ? (openBlock(), createBlock("div", {
key: 1,
style: { "font-size": "13px" }
}, [
record.phone || record.mobile ? (openBlock(), createBlock("div", { key: 0 }, "📱 " + toDisplayString(record.phone || record.mobile), 1)) : createCommentVNode("", true),
record.email ? (openBlock(), createBlock("div", {
key: 1,
style: { "color": "rgba(0,0,0,0.45)", "font-size": "12px" }
}, toDisplayString(record.email), 1)) : createCommentVNode("", true),
!record.phone && !record.mobile && !record.email ? (openBlock(), createBlock("span", {
key: 2,
class: "text-gray-400"
}, "-")) : createCommentVNode("", true)
])) : createCommentVNode("", true),
column.key === "status" ? (openBlock(), createBlock(_component_a_badge, {
key: 2,
status: record.status === 0 ? "success" : "error",
text: record.status === 0 ? "正常" : "已冻结"
}, null, 8, ["status", "text"])) : createCommentVNode("", true),
column.key === "balance" ? (openBlock(), createBlock("div", {
key: 3,
style: { "font-size": "13px" }
}, [
record.balance !== void 0 ? (openBlock(), createBlock("div", {
key: 0,
style: { "color": "#059669" }
}, "💰 ¥" + toDisplayString((record.balance / 100).toFixed(2)), 1)) : createCommentVNode("", true),
record.points !== void 0 ? (openBlock(), createBlock("div", {
key: 1,
style: { "color": "rgba(0,0,0,0.45)", "font-size": "12px" }
}, "🏆 " + toDisplayString(record.points) + " 积分", 1)) : createCommentVNode("", true)
])) : createCommentVNode("", true),
column.key === "createTime" ? (openBlock(), createBlock("span", {
key: 4,
class: "text-sm text-gray"
}, toDisplayString(record.createTime?.substring(0, 10) || "-"), 1)) : createCommentVNode("", true),
column.key === "action" ? (openBlock(), createBlock(_component_a_space, { key: 5 }, {
default: withCtx(() => [
createVNode(_component_a_button, {
type: "link",
size: "small",
onClick: ($event) => handleView(record)
}, {
default: withCtx(() => [
createTextVNode("详情")
]),
_: 1
}, 8, ["onClick"]),
createVNode(_component_a_popconfirm, {
title: record.status === 0 ? "确认冻结此用户账号?" : "确认解冻此用户账号?",
onConfirm: ($event) => handleToggleStatus(record)
}, {
default: withCtx(() => [
createVNode(_component_a_button, {
type: "link",
size: "small",
danger: record.status === 0
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(record.status === 0 ? "冻结" : "解冻"), 1)
]),
_: 2
}, 1032, ["danger"])
]),
_: 2
}, 1032, ["title", "onConfirm"]),
createVNode(_component_a_popconfirm, {
title: "确认重置密码为 123456",
onConfirm: ($event) => handleResetPassword(record)
}, {
default: withCtx(() => [
createVNode(_component_a_button, {
type: "link",
size: "small"
}, {
default: withCtx(() => [
createTextVNode("重置密码")
]),
_: 1
})
]),
_: 1
}, 8, ["onConfirm"])
]),
_: 2
}, 1024)) : createCommentVNode("", true)
];
}
}),
_: 1
}, _parent));
_push(`</div>`);
_push(ssrRenderComponent(_component_a_modal, {
open: unref(showDetailModal),
"onUpdate:open": ($event) => isRef(showDetailModal) ? showDetailModal.value = $event : null,
title: `用户详情:${unref(currentUser)?.nickname || unref(currentUser)?.username || ""}`,
width: "680px",
footer: null
}, {
default: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
if (unref(currentUser)) {
_push2(`<!--[--><div class="user-detail-header" data-v-0c7d49a8${_scopeId}>`);
_push2(ssrRenderComponent(_component_a_avatar, {
size: 64,
src: unref(currentUser).avatar || unref(currentUser).avatarUrl
}, {
icon: withCtx((_2, _push3, _parent3, _scopeId2) => {
if (_push3) {
_push3(ssrRenderComponent(unref(UserOutlined), null, null, _parent3, _scopeId2));
} else {
return [
createVNode(unref(UserOutlined))
];
}
}),
_: 1
}, _parent2, _scopeId));
_push2(`<div data-v-0c7d49a8${_scopeId}><div class="detail-name" data-v-0c7d49a8${_scopeId}>${ssrInterpolate(unref(currentUser).nickname || unref(currentUser).username)}</div><div class="detail-sub" data-v-0c7d49a8${_scopeId}>@${ssrInterpolate(unref(currentUser).username)}</div>`);
_push2(ssrRenderComponent(_component_a_space, { style: { "margin-top": "8px" } }, {
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
if (_push3) {
if (unref(currentUser).isAdmin) {
_push3(ssrRenderComponent(_component_a_tag, { color: "red" }, {
default: withCtx((_3, _push4, _parent4, _scopeId3) => {
if (_push4) {
_push4(`管理员`);
} else {
return [
createTextVNode("管理员")
];
}
}),
_: 1
}, _parent3, _scopeId2));
} else {
_push3(`<!---->`);
}
_push3(ssrRenderComponent(_component_a_badge, {
status: unref(currentUser).status === 0 ? "success" : "error",
text: unref(currentUser).status === 0 ? "账号正常" : "已冻结"
}, null, _parent3, _scopeId2));
} else {
return [
unref(currentUser).isAdmin ? (openBlock(), createBlock(_component_a_tag, {
key: 0,
color: "red"
}, {
default: withCtx(() => [
createTextVNode("管理员")
]),
_: 1
})) : createCommentVNode("", true),
createVNode(_component_a_badge, {
status: unref(currentUser).status === 0 ? "success" : "error",
text: unref(currentUser).status === 0 ? "账号正常" : "已冻结"
}, null, 8, ["status", "text"])
];
}
}),
_: 1
}, _parent2, _scopeId));
_push2(`</div></div>`);
_push2(ssrRenderComponent(_component_a_divider, null, null, _parent2, _scopeId));
_push2(ssrRenderComponent(_component_a_descriptions, {
column: 2,
size: "small"
}, {
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
if (_push3) {
_push3(ssrRenderComponent(_component_a_descriptions_item, { label: "用户ID" }, {
default: withCtx((_3, _push4, _parent4, _scopeId3) => {
if (_push4) {
_push4(`${ssrInterpolate(unref(currentUser).userId)}`);
} else {
return [
createTextVNode(toDisplayString(unref(currentUser).userId), 1)
];
}
}),
_: 1
}, _parent3, _scopeId2));
_push3(ssrRenderComponent(_component_a_descriptions_item, { label: "手机号" }, {
default: withCtx((_3, _push4, _parent4, _scopeId3) => {
if (_push4) {
_push4(`${ssrInterpolate(unref(currentUser).phone || unref(currentUser).mobile || "-")}`);
} else {
return [
createTextVNode(toDisplayString(unref(currentUser).phone || unref(currentUser).mobile || "-"), 1)
];
}
}),
_: 1
}, _parent3, _scopeId2));
_push3(ssrRenderComponent(_component_a_descriptions_item, { label: "邮箱" }, {
default: withCtx((_3, _push4, _parent4, _scopeId3) => {
if (_push4) {
_push4(`${ssrInterpolate(unref(currentUser).email || "-")}`);
} else {
return [
createTextVNode(toDisplayString(unref(currentUser).email || "-"), 1)
];
}
}),
_: 1
}, _parent3, _scopeId2));
_push3(ssrRenderComponent(_component_a_descriptions_item, { label: "性别" }, {
default: withCtx((_3, _push4, _parent4, _scopeId3) => {
if (_push4) {
_push4(`${ssrInterpolate(unref(currentUser).sex === "1" ? "男" : unref(currentUser).sex === "2" ? "女" : "-")}`);
} else {
return [
createTextVNode(toDisplayString(unref(currentUser).sex === "1" ? "男" : unref(currentUser).sex === "2" ? "女" : "-"), 1)
];
}
}),
_: 1
}, _parent3, _scopeId2));
_push3(ssrRenderComponent(_component_a_descriptions_item, { label: "余额" }, {
default: withCtx((_3, _push4, _parent4, _scopeId3) => {
if (_push4) {
_push4(`<span style="${ssrRenderStyle({ "color": "#059669" })}" data-v-0c7d49a8${_scopeId3}${ssrInterpolate(((unref(currentUser).balance || 0) / 100).toFixed(2))}</span>`);
} else {
return [
createVNode("span", { style: { "color": "#059669" } }, "¥" + toDisplayString(((unref(currentUser).balance || 0) / 100).toFixed(2)), 1)
];
}
}),
_: 1
}, _parent3, _scopeId2));
_push3(ssrRenderComponent(_component_a_descriptions_item, { label: "积分" }, {
default: withCtx((_3, _push4, _parent4, _scopeId3) => {
if (_push4) {
_push4(`${ssrInterpolate(unref(currentUser).points ?? "-")}`);
} else {
return [
createTextVNode(toDisplayString(unref(currentUser).points ?? "-"), 1)
];
}
}),
_: 1
}, _parent3, _scopeId2));
_push3(ssrRenderComponent(_component_a_descriptions_item, {
label: "注册时间",
span: 2
}, {
default: withCtx((_3, _push4, _parent4, _scopeId3) => {
if (_push4) {
_push4(`${ssrInterpolate(unref(currentUser).createTime || "-")}`);
} else {
return [
createTextVNode(toDisplayString(unref(currentUser).createTime || "-"), 1)
];
}
}),
_: 1
}, _parent3, _scopeId2));
if (unref(currentUser).address) {
_push3(ssrRenderComponent(_component_a_descriptions_item, {
label: "地址",
span: 2
}, {
default: withCtx((_3, _push4, _parent4, _scopeId3) => {
if (_push4) {
_push4(`${ssrInterpolate([unref(currentUser).province, unref(currentUser).city, unref(currentUser).region, unref(currentUser).address].filter(Boolean).join(" "))}`);
} else {
return [
createTextVNode(toDisplayString([unref(currentUser).province, unref(currentUser).city, unref(currentUser).region, unref(currentUser).address].filter(Boolean).join(" ")), 1)
];
}
}),
_: 1
}, _parent3, _scopeId2));
} else {
_push3(`<!---->`);
}
} else {
return [
createVNode(_component_a_descriptions_item, { label: "用户ID" }, {
default: withCtx(() => [
createTextVNode(toDisplayString(unref(currentUser).userId), 1)
]),
_: 1
}),
createVNode(_component_a_descriptions_item, { label: "手机号" }, {
default: withCtx(() => [
createTextVNode(toDisplayString(unref(currentUser).phone || unref(currentUser).mobile || "-"), 1)
]),
_: 1
}),
createVNode(_component_a_descriptions_item, { label: "邮箱" }, {
default: withCtx(() => [
createTextVNode(toDisplayString(unref(currentUser).email || "-"), 1)
]),
_: 1
}),
createVNode(_component_a_descriptions_item, { label: "性别" }, {
default: withCtx(() => [
createTextVNode(toDisplayString(unref(currentUser).sex === "1" ? "男" : unref(currentUser).sex === "2" ? "女" : "-"), 1)
]),
_: 1
}),
createVNode(_component_a_descriptions_item, { label: "余额" }, {
default: withCtx(() => [
createVNode("span", { style: { "color": "#059669" } }, "¥" + toDisplayString(((unref(currentUser).balance || 0) / 100).toFixed(2)), 1)
]),
_: 1
}),
createVNode(_component_a_descriptions_item, { label: "积分" }, {
default: withCtx(() => [
createTextVNode(toDisplayString(unref(currentUser).points ?? "-"), 1)
]),
_: 1
}),
createVNode(_component_a_descriptions_item, {
label: "注册时间",
span: 2
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(unref(currentUser).createTime || "-"), 1)
]),
_: 1
}),
unref(currentUser).address ? (openBlock(), createBlock(_component_a_descriptions_item, {
key: 0,
label: "地址",
span: 2
}, {
default: withCtx(() => [
createTextVNode(toDisplayString([unref(currentUser).province, unref(currentUser).city, unref(currentUser).region, unref(currentUser).address].filter(Boolean).join(" ")), 1)
]),
_: 1
})) : createCommentVNode("", true)
];
}
}),
_: 1
}, _parent2, _scopeId));
_push2(`<!--]-->`);
} else {
_push2(`<!---->`);
}
} else {
return [
unref(currentUser) ? (openBlock(), createBlock(Fragment, { key: 0 }, [
createVNode("div", { class: "user-detail-header" }, [
createVNode(_component_a_avatar, {
size: 64,
src: unref(currentUser).avatar || unref(currentUser).avatarUrl
}, {
icon: withCtx(() => [
createVNode(unref(UserOutlined))
]),
_: 1
}, 8, ["src"]),
createVNode("div", null, [
createVNode("div", { class: "detail-name" }, toDisplayString(unref(currentUser).nickname || unref(currentUser).username), 1),
createVNode("div", { class: "detail-sub" }, "@" + toDisplayString(unref(currentUser).username), 1),
createVNode(_component_a_space, { style: { "margin-top": "8px" } }, {
default: withCtx(() => [
unref(currentUser).isAdmin ? (openBlock(), createBlock(_component_a_tag, {
key: 0,
color: "red"
}, {
default: withCtx(() => [
createTextVNode("管理员")
]),
_: 1
})) : createCommentVNode("", true),
createVNode(_component_a_badge, {
status: unref(currentUser).status === 0 ? "success" : "error",
text: unref(currentUser).status === 0 ? "账号正常" : "已冻结"
}, null, 8, ["status", "text"])
]),
_: 1
})
])
]),
createVNode(_component_a_divider),
createVNode(_component_a_descriptions, {
column: 2,
size: "small"
}, {
default: withCtx(() => [
createVNode(_component_a_descriptions_item, { label: "用户ID" }, {
default: withCtx(() => [
createTextVNode(toDisplayString(unref(currentUser).userId), 1)
]),
_: 1
}),
createVNode(_component_a_descriptions_item, { label: "手机号" }, {
default: withCtx(() => [
createTextVNode(toDisplayString(unref(currentUser).phone || unref(currentUser).mobile || "-"), 1)
]),
_: 1
}),
createVNode(_component_a_descriptions_item, { label: "邮箱" }, {
default: withCtx(() => [
createTextVNode(toDisplayString(unref(currentUser).email || "-"), 1)
]),
_: 1
}),
createVNode(_component_a_descriptions_item, { label: "性别" }, {
default: withCtx(() => [
createTextVNode(toDisplayString(unref(currentUser).sex === "1" ? "男" : unref(currentUser).sex === "2" ? "女" : "-"), 1)
]),
_: 1
}),
createVNode(_component_a_descriptions_item, { label: "余额" }, {
default: withCtx(() => [
createVNode("span", { style: { "color": "#059669" } }, "¥" + toDisplayString(((unref(currentUser).balance || 0) / 100).toFixed(2)), 1)
]),
_: 1
}),
createVNode(_component_a_descriptions_item, { label: "积分" }, {
default: withCtx(() => [
createTextVNode(toDisplayString(unref(currentUser).points ?? "-"), 1)
]),
_: 1
}),
createVNode(_component_a_descriptions_item, {
label: "注册时间",
span: 2
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(unref(currentUser).createTime || "-"), 1)
]),
_: 1
}),
unref(currentUser).address ? (openBlock(), createBlock(_component_a_descriptions_item, {
key: 0,
label: "地址",
span: 2
}, {
default: withCtx(() => [
createTextVNode(toDisplayString([unref(currentUser).province, unref(currentUser).city, unref(currentUser).region, unref(currentUser).address].filter(Boolean).join(" ")), 1)
]),
_: 1
})) : createCommentVNode("", true)
]),
_: 1
})
], 64)) : createCommentVNode("", true)
];
}
}),
_: 1
}, _parent));
_push(`</div>`);
};
}
});
const _sfc_setup = _sfc_main.setup;
_sfc_main.setup = (props, ctx) => {
const ssrContext = useSSRContext();
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("pages/admin/users.vue");
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};
const users = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-0c7d49a8"]]);
export { users as default };
//# sourceMappingURL=users-R2tJfhAK.mjs.map