You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
198 lines
10 KiB
198 lines
10 KiB
import { defineComponent, ref, computed, reactive, mergeProps, useSSRContext } from 'vue';
|
|
import { ssrRenderAttrs, ssrRenderStyle, ssrIncludeBooleanAttr, ssrLooseContain, ssrLooseEqual, ssrRenderList, ssrRenderAttr, ssrInterpolate } from 'vue/server-renderer';
|
|
import { u as useApi } from './useApi-B-E5eLsI.mjs';
|
|
import { u as useToast } from './useToast-CS21XT61.mjs';
|
|
import { a as useAuthStore } from './server.mjs';
|
|
import './useLoading-D4zrSa2m.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 '../routes/renderer.mjs';
|
|
import 'vue-bundle-renderer/runtime';
|
|
import 'unhead/server';
|
|
import 'devalue';
|
|
import 'unhead/utils';
|
|
import 'pinia';
|
|
import 'perfect-debounce';
|
|
|
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
__name: "users",
|
|
__ssrInlineRender: true,
|
|
setup(__props) {
|
|
useApi();
|
|
useToast();
|
|
const auth = useAuthStore();
|
|
const REGION_MAP = {
|
|
cn: "中国",
|
|
us: "美国",
|
|
hw: "海外",
|
|
ea: "东亚",
|
|
sea: "东南亚",
|
|
sa: "南亚",
|
|
me: "中东",
|
|
eu: "欧洲",
|
|
ru: "俄罗斯",
|
|
af: "非洲",
|
|
sam: "南美",
|
|
nam: "北美",
|
|
oc: "大洋洲",
|
|
br: "巴西",
|
|
in: "印度"
|
|
};
|
|
function regionLabel(r) {
|
|
return REGION_MAP[r] || r || "默认";
|
|
}
|
|
const apps = ref([]);
|
|
const qApp = ref("");
|
|
const qRegion = ref("");
|
|
const qUid = ref("");
|
|
const user = ref(null);
|
|
const emptyHint = ref("请输入查询条件后点击「搜索」");
|
|
ref("");
|
|
const lastUid = ref("");
|
|
const giftAllowed = computed(() => [1, 2, 3].includes(auth.identity));
|
|
ref(null);
|
|
const gift = reactive({ vipday: 0, trademin: 0, meetmin: 0 });
|
|
const appNames = computed(() => {
|
|
const names = [];
|
|
apps.value.forEach((a) => {
|
|
if (!names.includes(a.name)) names.push(a.name);
|
|
});
|
|
return names;
|
|
});
|
|
const regionItems = computed(() => apps.value.filter((a) => a.name === qApp.value));
|
|
function fmtTs(ts) {
|
|
if (!ts) return "-";
|
|
return new Date(ts * 1e3).toLocaleString();
|
|
}
|
|
function fmtBool(v) {
|
|
return v ? "是" : "否";
|
|
}
|
|
function fmtGender(g) {
|
|
return g === 1 ? "男" : g === 2 ? "女" : "未知";
|
|
}
|
|
function dispVal(v) {
|
|
return v === void 0 || v === null || v === "" ? "-" : v;
|
|
}
|
|
const sections = [
|
|
{ title: "基本信息", rows: [
|
|
["uid", "UID"],
|
|
["name", "用户名"],
|
|
["account", "登录账号"],
|
|
["mail", "邮箱"],
|
|
["phone", "手机号"],
|
|
["gender", "性别", "gender"],
|
|
["language", "语言"],
|
|
["version", "版本"],
|
|
["channel", "渠道"],
|
|
["State", "状态"],
|
|
["country_code", "国家码"],
|
|
["continent_code", "大洲码"],
|
|
["servicetag", "服务区"],
|
|
["phonemodel", "手机型号"],
|
|
["phonemac", "设备ID"]
|
|
] },
|
|
{ title: "第三方登录", rows: [
|
|
["wxopenid", "微信 openid"],
|
|
["googleopenid", "Google openid"],
|
|
["facebookopenid", "Facebook openid"],
|
|
["appleopenid", "Apple openid"]
|
|
] },
|
|
{ title: "会员与积分", rows: [
|
|
["viplv", "VIP等级"],
|
|
["vipexptime", "VIP到期", "ts"],
|
|
["aichatintegral", "AI积分"],
|
|
["aichattotalintegral", "AI累计积分"],
|
|
["tradeintegral", "翻译积分"],
|
|
["tradetotalintegral", "翻译累计积分"],
|
|
["meetintegral", "会议积分"],
|
|
["meettotalintegral", "会议累计积分"],
|
|
["lastbindproductid", "最后绑定产品ID"],
|
|
["isactivatecode", "已领激活码", "bool"],
|
|
["isgiveaway", "首次绑定赠送", "bool"]
|
|
] },
|
|
{ title: "时间", rows: [
|
|
["createtime", "注册时间", "ts"],
|
|
["lastsgintime", "最后登录", "ts"],
|
|
["canceltime", "注销时间", "ts"]
|
|
] }
|
|
];
|
|
function cellValue(u, row) {
|
|
const t = row[2];
|
|
const v = u[row[0]];
|
|
if (t === "ts") return fmtTs(v);
|
|
if (t === "bool") return fmtBool(v);
|
|
if (t === "gender") return fmtGender(v);
|
|
return dispVal(v);
|
|
}
|
|
const avatarInitial = computed(() => {
|
|
const u = user.value;
|
|
if (!u) return "?";
|
|
return String(u.name || u.uid || "?").charAt(0).toUpperCase();
|
|
});
|
|
return (_ctx, _push, _parent, _attrs) => {
|
|
_push(`<div${ssrRenderAttrs(mergeProps({ class: "space-y-6" }, _attrs))}><div class="bg-white rounded-xl shadow-sm border border-slate-100 p-4"><div class="flex items-end gap-3 flex-wrap"><div class="form-control"><label class="label py-1"><span class="label-text text-xs">应用</span></label><select class="select select-bordered select-sm" style="${ssrRenderStyle({ "min-width": "180px" })}">`);
|
|
if (!appNames.value.length) {
|
|
_push(`<option value=""${ssrIncludeBooleanAttr(Array.isArray(qApp.value) ? ssrLooseContain(qApp.value, "") : ssrLooseEqual(qApp.value, "")) ? " selected" : ""}>无可用应用</option>`);
|
|
} else {
|
|
_push(`<!---->`);
|
|
}
|
|
_push(`<!--[-->`);
|
|
ssrRenderList(appNames.value, (n) => {
|
|
_push(`<option${ssrRenderAttr("value", n)}${ssrIncludeBooleanAttr(Array.isArray(qApp.value) ? ssrLooseContain(qApp.value, n) : ssrLooseEqual(qApp.value, n)) ? " selected" : ""}>${ssrInterpolate(n)}</option>`);
|
|
});
|
|
_push(`<!--]--></select></div><div class="form-control"><label class="label py-1"><span class="label-text text-xs">区域</span></label><select class="select select-bordered select-sm" style="${ssrRenderStyle({ "min-width": "140px" })}">`);
|
|
if (!regionItems.value.length) {
|
|
_push(`<option value=""${ssrIncludeBooleanAttr(Array.isArray(qRegion.value) ? ssrLooseContain(qRegion.value, "") : ssrLooseEqual(qRegion.value, "")) ? " selected" : ""}>无可用区域</option>`);
|
|
} else {
|
|
_push(`<!---->`);
|
|
}
|
|
_push(`<!--[-->`);
|
|
ssrRenderList(regionItems.value, (a) => {
|
|
_push(`<option${ssrRenderAttr("value", a.id)}${ssrIncludeBooleanAttr(Array.isArray(qRegion.value) ? ssrLooseContain(qRegion.value, a.id) : ssrLooseEqual(qRegion.value, a.id)) ? " selected" : ""}>${ssrInterpolate(regionLabel(a.region))}</option>`);
|
|
});
|
|
_push(`<!--]--></select></div><div class="form-control"><label class="label py-1"><span class="label-text text-xs">用户UID</span></label><input${ssrRenderAttr("value", qUid.value)} type="text" class="input input-bordered input-sm" style="${ssrRenderStyle({ "min-width": "240px" })}" placeholder="输入用户 UID"></div><button class="btn btn-primary btn-sm text-white">搜索</button></div><p class="text-xs text-slate-400 mt-2">选择应用与区域后输入 UID,直接查询该部署业务库中的用户信息。</p></div>`);
|
|
if (!user.value) {
|
|
_push(`<div class="bg-white rounded-xl shadow-sm border border-slate-100 p-12 text-center text-slate-400">${ssrInterpolate(emptyHint.value)}</div>`);
|
|
} else {
|
|
_push(`<div class="space-y-5"><div class="bg-white rounded-xl shadow-sm border border-slate-100 p-5 flex items-center gap-4">`);
|
|
if (user.value.avatar) {
|
|
_push(`<img${ssrRenderAttr("src", user.value.avatar)} class="w-14 h-14 rounded-full object-cover border border-slate-100">`);
|
|
} else {
|
|
_push(`<div class="w-14 h-14 rounded-full bg-indigo-100 text-indigo-600 flex items-center justify-center text-xl font-bold">${ssrInterpolate(avatarInitial.value)}</div>`);
|
|
}
|
|
_push(`<div><div class="text-lg font-semibold text-slate-800">${ssrInterpolate(dispVal(user.value.name))}</div><div class="text-xs text-slate-400 font-mono mt-0.5">${ssrInterpolate(dispVal(user.value.uid))}</div></div><div class="ml-auto flex items-center gap-3"><span class="badge badge-primary badge-outline">VIP ${ssrInterpolate(user.value.viplv || 0)}</span>`);
|
|
if (giftAllowed.value) {
|
|
_push(`<button class="btn btn-success btn-sm text-white">赠送资源点</button>`);
|
|
} else {
|
|
_push(`<!---->`);
|
|
}
|
|
_push(`</div></div><!--[-->`);
|
|
ssrRenderList(sections, (s) => {
|
|
_push(`<div class="bg-white rounded-xl shadow-sm border border-slate-100 overflow-hidden"><div class="px-5 py-3 border-b border-slate-50 text-sm font-semibold text-slate-700">${ssrInterpolate(s.title)}</div><div class="px-5 py-3 grid grid-cols-1 md:grid-cols-2 gap-x-8"><!--[-->`);
|
|
ssrRenderList(s.rows, (r) => {
|
|
_push(`<div class="flex justify-between gap-3 py-1.5 border-b border-slate-50"><span class="text-xs text-slate-400 shrink-0">${ssrInterpolate(r[1])}</span><span class="text-sm text-slate-700 break-all text-right">${ssrInterpolate(cellValue(user.value, r))}</span></div>`);
|
|
});
|
|
_push(`<!--]--></div></div>`);
|
|
});
|
|
_push(`<!--]--></div>`);
|
|
}
|
|
_push(`<dialog class="modal"><div class="modal-box max-w-md"><h3 class="font-bold text-lg mb-1 text-slate-800">赠送资源点</h3><p class="text-xs text-slate-400 mb-4">目标用户 UID:<span class="font-mono text-slate-600">${ssrInterpolate(lastUid.value)}</span>。代理账号将从自己的资源点余额中扣减,超管/管理员无消耗。</p><div class="grid grid-cols-3 gap-3"><div class="form-control"><label class="label py-1"><span class="label-text text-sm">VIP天数</span></label><input${ssrRenderAttr("value", gift.vipday)} type="number" class="input input-bordered" min="0"></div><div class="form-control"><label class="label py-1"><span class="label-text text-sm">翻译分钟</span></label><input${ssrRenderAttr("value", gift.trademin)} type="number" class="input input-bordered" min="0"></div><div class="form-control"><label class="label py-1"><span class="label-text text-sm">会议分钟</span></label><input${ssrRenderAttr("value", gift.meetmin)} type="number" class="input input-bordered" min="0"></div></div><div class="modal-action"><button class="btn btn-sm">取消</button><button class="btn btn-success btn-sm text-white">确认赠送</button></div></div><form method="dialog" class="modal-backdrop"><button>close</button></form></dialog></div>`);
|
|
};
|
|
}
|
|
});
|
|
const _sfc_setup = _sfc_main.setup;
|
|
_sfc_main.setup = (props, ctx) => {
|
|
const ssrContext = useSSRContext();
|
|
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("pages/users.vue");
|
|
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
|
|
};
|
|
|
|
export { _sfc_main as default };
|
|
//# sourceMappingURL=users-A-iAUOTp.mjs.map
|
|
|