first commit
This commit is contained in:
commit
db5762abd4
687 files changed
+171307
No files matched your search
@@ -0,0 +1,295 @@
|
||||
<script>
|
||||
import "~/assets/styles/ChartBox.CYP_mhat.css";
|
||||
import "~/assets/styles/HomeConsumeTrend.DfrmEdD9.css";
|
||||
import { toDisplayString } from "vue";
|
||||
import { onMounted } from "vue";
|
||||
import { createBlock } from "vue";
|
||||
import { ref } from "vue";
|
||||
import { withCtx } from "vue";
|
||||
import { computed } from "vue";
|
||||
import { createElementBlock } from "vue";
|
||||
import { createElementVNode } from "vue";
|
||||
import { createTextVNode } from "vue";
|
||||
import { unref } from "vue";
|
||||
import { defineComponent } from "vue";
|
||||
import { createVNode } from "vue";
|
||||
import { openBlock } from "vue";
|
||||
import { NuxtLink } from "#components";
|
||||
import { useApi } from "~/lib/auth.js";
|
||||
import { useAuth } from "~/lib/auth.js";
|
||||
import { t as _plugin_vue_export_helper_t } from "~/lib/_plugin-vue_export-helper.js";
|
||||
import { t as useTheme_t } from "~/lib/useTheme.js";
|
||||
import ChartBox from "~/components/ChartBox.vue";
|
||||
import ListEmpty from "~/components/ListEmpty.vue";
|
||||
import skeleton from "primevue/skeleton";
|
||||
var x = {
|
||||
class: `home-card`,
|
||||
},
|
||||
S = {
|
||||
class: `home-card-head`,
|
||||
},
|
||||
C = {
|
||||
class: `home-mini-stats`,
|
||||
},
|
||||
w = {
|
||||
class: `home-mini-stat`,
|
||||
},
|
||||
T = {
|
||||
class: `home-mini-value`,
|
||||
},
|
||||
E = {
|
||||
class: `home-mini-stat`,
|
||||
},
|
||||
D = {
|
||||
class: `home-mini-value`,
|
||||
},
|
||||
O = {
|
||||
class: `home-mini-stat`,
|
||||
},
|
||||
k = {
|
||||
class: `home-mini-value`,
|
||||
},
|
||||
A = {
|
||||
class: `chart-wrap`,
|
||||
},
|
||||
j = {
|
||||
key: 0,
|
||||
},
|
||||
M = 6,
|
||||
N = Object.assign(
|
||||
_plugin_vue_export_helper_t(
|
||||
defineComponent({
|
||||
__name: `HomeConsumeTrend`,
|
||||
setup(u) {
|
||||
let g = useApi(),
|
||||
N = useAuth(),
|
||||
P = useTheme_t(),
|
||||
F = ref([]),
|
||||
I = ref(!0),
|
||||
L = ref(``);
|
||||
function R(e) {
|
||||
let t = new Date();
|
||||
return Array.from(
|
||||
{
|
||||
length: e,
|
||||
},
|
||||
(n, r) => {
|
||||
let i = new Date(
|
||||
t.getFullYear(),
|
||||
t.getMonth() - (e - 1 - r),
|
||||
1,
|
||||
);
|
||||
return {
|
||||
key: `${i.getFullYear()}-${i.getMonth() + 1}`,
|
||||
label: `${i.getMonth() + 1}月`,
|
||||
};
|
||||
},
|
||||
);
|
||||
}
|
||||
onMounted(async () => {
|
||||
try {
|
||||
let e = await g.get(`/transaction`, {
|
||||
page: 1,
|
||||
limit: 200,
|
||||
}),
|
||||
t = R(M),
|
||||
n = new Map(t.map((e) => [e.key, 0]));
|
||||
for (let t of e.list ?? []) {
|
||||
let e = new Date((t.create_time || 0) * 1e3),
|
||||
r = `${e.getFullYear()}-${e.getMonth() + 1}`;
|
||||
n.has(r) && n.set(r, (n.get(r) ?? 0) + Number(t.amount || 0));
|
||||
}
|
||||
F.value = t.map((e) => ({
|
||||
label: e.label,
|
||||
amount: Math.round((n.get(e.key) ?? 0) * 100) / 100,
|
||||
}));
|
||||
} catch (e) {
|
||||
L.value = e instanceof Error ? e.message : `消费记录加载失败`;
|
||||
} finally {
|
||||
I.value = !1;
|
||||
}
|
||||
});
|
||||
let z = computed(() => (P.isDark.value ? `#618dff` : `#0052d9`)),
|
||||
B = computed(() => ({
|
||||
grid: {
|
||||
left: 4,
|
||||
right: 8,
|
||||
top: 16,
|
||||
bottom: 0,
|
||||
outerBoundsMode: `same`,
|
||||
outerBoundsContain: `axisLabel`,
|
||||
},
|
||||
tooltip: {
|
||||
trigger: `axis`,
|
||||
valueFormatter: (e) => `¥${Number(e ?? 0).toFixed(2)}`,
|
||||
},
|
||||
xAxis: {
|
||||
type: `category`,
|
||||
boundaryGap: !1,
|
||||
data: F.value.map((e) => e.label),
|
||||
},
|
||||
yAxis: {
|
||||
type: `value`,
|
||||
axisLabel: {
|
||||
formatter: `¥{value}`,
|
||||
},
|
||||
},
|
||||
series: [
|
||||
{
|
||||
type: `line`,
|
||||
smooth: !0,
|
||||
symbol: `circle`,
|
||||
symbolSize: 6,
|
||||
data: F.value.map((e) => e.amount),
|
||||
itemStyle: {
|
||||
color: z.value,
|
||||
},
|
||||
lineStyle: {
|
||||
color: z.value,
|
||||
width: 2,
|
||||
},
|
||||
areaStyle: {
|
||||
color: z.value,
|
||||
opacity: 0.1,
|
||||
},
|
||||
},
|
||||
],
|
||||
}));
|
||||
return (t, r) => {
|
||||
let a = NuxtLink,
|
||||
u = skeleton,
|
||||
m = ListEmpty,
|
||||
h = ChartBox;
|
||||
return (
|
||||
openBlock(),
|
||||
createElementBlock(`div`, x, [
|
||||
createElementVNode(`div`, S, [
|
||||
(r[1] ||= createElementVNode(
|
||||
`div`,
|
||||
{
|
||||
class: `home-card-title`,
|
||||
},
|
||||
[
|
||||
createElementVNode(`i`, {
|
||||
class: `pi pi-chart-line`,
|
||||
}),
|
||||
createTextVNode(`消费趋势`),
|
||||
],
|
||||
-1,
|
||||
)),
|
||||
createVNode(
|
||||
a,
|
||||
{
|
||||
to: `/finance`,
|
||||
class: `home-card-more`,
|
||||
},
|
||||
{
|
||||
default: withCtx(() => [
|
||||
...(r[0] ||= [createTextVNode(`消费记录 ›`, -1)]),
|
||||
]),
|
||||
_: 1,
|
||||
},
|
||||
),
|
||||
]),
|
||||
createElementVNode(`div`, C, [
|
||||
createElementVNode(`div`, w, [
|
||||
(r[2] ||= createElementVNode(
|
||||
`span`,
|
||||
{
|
||||
class: `home-mini-label`,
|
||||
},
|
||||
`本月消费`,
|
||||
-1,
|
||||
)),
|
||||
createElementVNode(
|
||||
`span`,
|
||||
T,
|
||||
`¥` +
|
||||
toDisplayString(
|
||||
unref(N).overview?.this_month_consume ?? `--`,
|
||||
),
|
||||
1,
|
||||
),
|
||||
]),
|
||||
createElementVNode(`div`, E, [
|
||||
(r[3] ||= createElementVNode(
|
||||
`span`,
|
||||
{
|
||||
class: `home-mini-label`,
|
||||
},
|
||||
`累计消费`,
|
||||
-1,
|
||||
)),
|
||||
createElementVNode(
|
||||
`span`,
|
||||
D,
|
||||
`¥` + toDisplayString(unref(N).overview?.consume ?? `--`),
|
||||
1,
|
||||
),
|
||||
]),
|
||||
createElementVNode(`div`, O, [
|
||||
(r[4] ||= createElementVNode(
|
||||
`span`,
|
||||
{
|
||||
class: `home-mini-label`,
|
||||
},
|
||||
`未付订单`,
|
||||
-1,
|
||||
)),
|
||||
createElementVNode(
|
||||
`span`,
|
||||
k,
|
||||
toDisplayString(unref(N).overview?.unpaid_order ?? `--`),
|
||||
1,
|
||||
),
|
||||
]),
|
||||
]),
|
||||
createElementVNode(`div`, A, [
|
||||
unref(I)
|
||||
? (openBlock(),
|
||||
createElementBlock(`div`, j, [
|
||||
createVNode(u, {
|
||||
height: `150px`,
|
||||
}),
|
||||
]))
|
||||
: unref(L)
|
||||
? (openBlock(),
|
||||
createBlock(
|
||||
m,
|
||||
{
|
||||
key: 1,
|
||||
icon: `pi pi-exclamation-circle`,
|
||||
title: `消费趋势加载失败`,
|
||||
description: unref(L),
|
||||
},
|
||||
null,
|
||||
8,
|
||||
[`description`],
|
||||
))
|
||||
: (openBlock(),
|
||||
createBlock(
|
||||
h,
|
||||
{
|
||||
key: 2,
|
||||
option: unref(B),
|
||||
height: 150,
|
||||
},
|
||||
null,
|
||||
8,
|
||||
[`option`],
|
||||
)),
|
||||
]),
|
||||
])
|
||||
);
|
||||
};
|
||||
},
|
||||
}),
|
||||
[[`__scopeId`, `data-v-90c11ad2`]],
|
||||
),
|
||||
{
|
||||
__name: `HomeConsumeTrend`,
|
||||
},
|
||||
);
|
||||
export {};
|
||||
export default N;
|
||||
</script>
|
||||
@@ -0,0 +1,268 @@
|
||||
<script>
|
||||
import "~/assets/styles/HomeExpiringPanel.Ckflw2Hv.css";
|
||||
import { toDisplayString } from "vue";
|
||||
import { renderList } from "vue";
|
||||
import { onMounted } from "vue";
|
||||
import { createBlock } from "vue";
|
||||
import { ref } from "vue";
|
||||
import { withCtx } from "vue";
|
||||
import { createElementBlock } from "vue";
|
||||
import { Fragment } from "vue";
|
||||
import { createElementVNode } from "vue";
|
||||
import { createTextVNode } from "vue";
|
||||
import { unref } from "vue";
|
||||
import { defineComponent } from "vue";
|
||||
import { createVNode } from "vue";
|
||||
import { openBlock } from "vue";
|
||||
import { NuxtLink } from "#components";
|
||||
import { useApi } from "~/lib/auth.js";
|
||||
import { t as _plugin_vue_export_helper_t } from "~/lib/_plugin-vue_export-helper.js";
|
||||
import { r as dict_r } from "~/lib/dict.js";
|
||||
import ListEmpty from "~/components/ListEmpty.vue";
|
||||
import skeleton from "primevue/skeleton";
|
||||
var b = {
|
||||
class: `home-card`,
|
||||
},
|
||||
x = {
|
||||
key: 0,
|
||||
class: `home-list`,
|
||||
},
|
||||
S = {
|
||||
key: 3,
|
||||
class: `home-list`,
|
||||
},
|
||||
C = {
|
||||
class: `home-row-main`,
|
||||
},
|
||||
w = {
|
||||
class: `home-row-title col-mono`,
|
||||
},
|
||||
T = {
|
||||
class: `home-row-sub`,
|
||||
},
|
||||
E = {
|
||||
class: `due-badge`,
|
||||
},
|
||||
D = 7,
|
||||
O = 5,
|
||||
k = Object.assign(
|
||||
_plugin_vue_export_helper_t(
|
||||
defineComponent({
|
||||
__name: `HomeExpiringPanel`,
|
||||
setup(d) {
|
||||
let g = useApi(),
|
||||
k = ref([]),
|
||||
A = ref(!0),
|
||||
j = ref(``);
|
||||
onMounted(async () => {
|
||||
try {
|
||||
let e = Math.floor(Date.now() / 1e3),
|
||||
t = e + D * 86400,
|
||||
n = [],
|
||||
r = 1,
|
||||
i = 0;
|
||||
for (; n.length < O;) {
|
||||
let a = await g.get(`/host`, {
|
||||
page: r,
|
||||
limit: 100,
|
||||
orderby: `due_time`,
|
||||
sort: `asc`,
|
||||
start_time: e,
|
||||
end_time: t,
|
||||
}),
|
||||
o = a.list ?? [];
|
||||
if (
|
||||
(n.push(
|
||||
...o.filter(
|
||||
(e) =>
|
||||
Number(e.due_time) > Date.now() / 1e3 &&
|
||||
Number(e.due_time) <= t,
|
||||
),
|
||||
),
|
||||
(i += o.length),
|
||||
!o.length ||
|
||||
(a.count === void 0
|
||||
? o.length < 100
|
||||
: i >= Number(a.count)))
|
||||
)
|
||||
break;
|
||||
r++;
|
||||
}
|
||||
k.value = n
|
||||
.filter((e) => Number(e.due_time) > Date.now() / 1e3)
|
||||
.sort((e, t) => Number(e.due_time) - Number(t.due_time))
|
||||
.slice(0, O);
|
||||
} catch (e) {
|
||||
j.value = e instanceof Error ? e.message : `到期实例加载失败`;
|
||||
} finally {
|
||||
A.value = !1;
|
||||
}
|
||||
});
|
||||
function M(e) {
|
||||
return e ? Math.ceil((e * 1e3 - Date.now()) / 864e5) : 0;
|
||||
}
|
||||
return (n, i) => {
|
||||
let d = skeleton,
|
||||
h = ListEmpty,
|
||||
g = NuxtLink;
|
||||
return (
|
||||
openBlock(),
|
||||
createElementBlock(`div`, b, [
|
||||
createElementVNode(
|
||||
`div`,
|
||||
{
|
||||
class: `home-card-head`,
|
||||
},
|
||||
[
|
||||
(i[0] ||= createElementVNode(
|
||||
`div`,
|
||||
{
|
||||
class: `home-card-title`,
|
||||
},
|
||||
[
|
||||
createElementVNode(`i`, {
|
||||
class: `pi pi-clock`,
|
||||
}),
|
||||
createTextVNode(`到期提醒`),
|
||||
],
|
||||
-1,
|
||||
)),
|
||||
createElementVNode(
|
||||
`span`,
|
||||
{
|
||||
class: `home-card-more`,
|
||||
},
|
||||
toDisplayString(D) + ` 天内`,
|
||||
),
|
||||
],
|
||||
),
|
||||
unref(A)
|
||||
? (openBlock(),
|
||||
createElementBlock(`div`, x, [
|
||||
(openBlock(),
|
||||
createElementBlock(
|
||||
Fragment,
|
||||
null,
|
||||
renderList(2, (e) =>
|
||||
createElementVNode(
|
||||
`div`,
|
||||
{
|
||||
key: e,
|
||||
class: `home-row-skeleton`,
|
||||
},
|
||||
[
|
||||
createVNode(d, {
|
||||
height: `14px`,
|
||||
width: `50%`,
|
||||
}),
|
||||
createVNode(d, {
|
||||
height: `12px`,
|
||||
width: `30%`,
|
||||
style: {
|
||||
"margin-top": `8px`,
|
||||
},
|
||||
}),
|
||||
],
|
||||
),
|
||||
),
|
||||
64,
|
||||
)),
|
||||
]))
|
||||
: unref(j)
|
||||
? (openBlock(),
|
||||
createBlock(
|
||||
h,
|
||||
{
|
||||
key: 1,
|
||||
icon: `pi pi-exclamation-circle`,
|
||||
title: `加载失败`,
|
||||
description: unref(j),
|
||||
},
|
||||
null,
|
||||
8,
|
||||
[`description`],
|
||||
))
|
||||
: unref(k).length
|
||||
? (openBlock(),
|
||||
createElementBlock(`div`, S, [
|
||||
(openBlock(!0),
|
||||
createElementBlock(
|
||||
Fragment,
|
||||
null,
|
||||
renderList(
|
||||
unref(k),
|
||||
(t) => (
|
||||
openBlock(),
|
||||
createBlock(
|
||||
g,
|
||||
{
|
||||
key: t.id,
|
||||
to: `/servers/server?id=${t.id}`,
|
||||
class: `home-row`,
|
||||
},
|
||||
{
|
||||
default: withCtx(() => [
|
||||
createElementVNode(`div`, C, [
|
||||
createElementVNode(
|
||||
`div`,
|
||||
w,
|
||||
toDisplayString(t.name),
|
||||
1,
|
||||
),
|
||||
createElementVNode(
|
||||
`div`,
|
||||
T,
|
||||
`到期 ` +
|
||||
toDisplayString(
|
||||
(`formatTime` in n
|
||||
? n.formatTime
|
||||
: unref(dict_r))(t.due_time),
|
||||
),
|
||||
1,
|
||||
),
|
||||
]),
|
||||
createElementVNode(
|
||||
`span`,
|
||||
E,
|
||||
toDisplayString(M(t.due_time)) +
|
||||
` 天后 `,
|
||||
1,
|
||||
),
|
||||
]),
|
||||
_: 2,
|
||||
},
|
||||
1032,
|
||||
[`to`],
|
||||
)
|
||||
),
|
||||
),
|
||||
128,
|
||||
)),
|
||||
]))
|
||||
: (openBlock(),
|
||||
createBlock(
|
||||
h,
|
||||
{
|
||||
key: 2,
|
||||
icon: `pi pi-check-circle`,
|
||||
title: `暂无即将到期的实例`,
|
||||
description: `${D} 天内有实例到期时会在这里提醒你`,
|
||||
},
|
||||
null,
|
||||
8,
|
||||
[`description`],
|
||||
)),
|
||||
])
|
||||
);
|
||||
};
|
||||
},
|
||||
}),
|
||||
[[`__scopeId`, `data-v-9017f053`]],
|
||||
),
|
||||
{
|
||||
__name: `HomeExpiringPanel`,
|
||||
},
|
||||
);
|
||||
export {};
|
||||
export default k;
|
||||
</script>
|
||||
@@ -0,0 +1,440 @@
|
||||
<script>
|
||||
import "~/assets/styles/HomeNoticePanel.e5-qgzAs.css";
|
||||
import { toDisplayString } from "vue";
|
||||
import { renderList } from "vue";
|
||||
import { onMounted } from "vue";
|
||||
import { onBeforeUnmount } from "vue";
|
||||
import { createBlock } from "vue";
|
||||
import { ref } from "vue";
|
||||
import { withCtx } from "vue";
|
||||
import { createCommentVNode } from "vue";
|
||||
import { isRef } from "vue";
|
||||
import { createElementBlock } from "vue";
|
||||
import { Fragment } from "vue";
|
||||
import { createElementVNode } from "vue";
|
||||
import { createTextVNode } from "vue";
|
||||
import { unref } from "vue";
|
||||
import { defineComponent } from "vue";
|
||||
import { createVNode } from "vue";
|
||||
import { openBlock } from "vue";
|
||||
import { NuxtLink } from "#components";
|
||||
import { useApi } from "~/lib/auth.js";
|
||||
import dialog from "primevue/dialog";
|
||||
import button from "primevue/button";
|
||||
import { t as _plugin_vue_export_helper_t } from "~/lib/_plugin-vue_export-helper.js";
|
||||
import message from "primevue/message";
|
||||
import { n as dict_n } from "~/lib/dict.js";
|
||||
import { r as dict_r } from "~/lib/dict.js";
|
||||
import ListEmpty from "~/components/ListEmpty.vue";
|
||||
import skeleton from "primevue/skeleton";
|
||||
import { n as sanitize_n } from "~/lib/sanitize.js";
|
||||
var O = [`aria-busy`],
|
||||
k = {
|
||||
class: `home-card-head`,
|
||||
},
|
||||
A = {
|
||||
key: 1,
|
||||
class: `home-list`,
|
||||
},
|
||||
j = [`inert`, `aria-disabled`],
|
||||
M = [`onClick`],
|
||||
N = {
|
||||
class: `home-row-title notice-title`,
|
||||
},
|
||||
P = {
|
||||
class: `home-row-sub`,
|
||||
},
|
||||
F = {
|
||||
class: `home-card-foot`,
|
||||
},
|
||||
I = {
|
||||
key: 0,
|
||||
},
|
||||
L = {
|
||||
key: 2,
|
||||
class: `detail`,
|
||||
},
|
||||
R = {
|
||||
class: `detail-time`,
|
||||
},
|
||||
z = [`innerHTML`],
|
||||
B = Object.assign(
|
||||
_plugin_vue_export_helper_t(
|
||||
defineComponent({
|
||||
__name: `HomeNoticePanel`,
|
||||
setup(m) {
|
||||
let x = useApi(),
|
||||
B = ref([]),
|
||||
V = ref(!0),
|
||||
H = ref(!1),
|
||||
U = ref(``),
|
||||
W = !1,
|
||||
G = 0,
|
||||
K = ref(!1),
|
||||
q = ref(null),
|
||||
J = ref(!1),
|
||||
Y = ref(``),
|
||||
X = ref(null),
|
||||
Z = 0;
|
||||
async function Q() {
|
||||
if (W) return;
|
||||
let e = ++G;
|
||||
((W = !0), (V.value = !0), (U.value = ``));
|
||||
try {
|
||||
let t = await x.get(`/announcement`, {
|
||||
page: 1,
|
||||
limit: 5,
|
||||
});
|
||||
if (e !== G) return;
|
||||
((B.value = t.list ?? []), (H.value = !0));
|
||||
} catch (t) {
|
||||
if (e !== G) return;
|
||||
U.value = t instanceof Error ? t.message : `公告加载失败`;
|
||||
} finally {
|
||||
e === G && ((V.value = !1), (W = !1));
|
||||
}
|
||||
}
|
||||
(onMounted(Q),
|
||||
onBeforeUnmount(() => {
|
||||
(G++, Z++);
|
||||
}));
|
||||
async function $(e) {
|
||||
let t = ++Z;
|
||||
((K.value = !0),
|
||||
(J.value = !0),
|
||||
(X.value = e),
|
||||
(Y.value = ``),
|
||||
(q.value = null));
|
||||
try {
|
||||
let n = await x.get(`/announcement/${e.id}`);
|
||||
if (t !== Z) return;
|
||||
if (!n.announcement) throw Error(`公告不存在或已删除`);
|
||||
q.value = n.announcement;
|
||||
} catch (e) {
|
||||
t === Z &&
|
||||
(Y.value =
|
||||
e instanceof Error ? e.message : `正文加载失败,请重试`);
|
||||
} finally {
|
||||
t === Z && (J.value = !1);
|
||||
}
|
||||
}
|
||||
return (n, r) => {
|
||||
let a = NuxtLink,
|
||||
m = button,
|
||||
v = message,
|
||||
x = skeleton,
|
||||
W = ListEmpty,
|
||||
G = dialog;
|
||||
return (
|
||||
openBlock(),
|
||||
createElementBlock(
|
||||
`div`,
|
||||
{
|
||||
class: `home-card`,
|
||||
"aria-busy": unref(V),
|
||||
},
|
||||
[
|
||||
createElementVNode(`div`, k, [
|
||||
(r[4] ||= createElementVNode(
|
||||
`div`,
|
||||
{
|
||||
class: `home-card-title`,
|
||||
},
|
||||
`公告板`,
|
||||
-1,
|
||||
)),
|
||||
createVNode(
|
||||
a,
|
||||
{
|
||||
to: `/notices`,
|
||||
class: `home-card-more`,
|
||||
"aria-label": `全部公告`,
|
||||
},
|
||||
{
|
||||
default: withCtx(() => [
|
||||
...(r[3] ||= [
|
||||
createElementVNode(
|
||||
`i`,
|
||||
{
|
||||
class: `pi pi-angle-right`,
|
||||
},
|
||||
null,
|
||||
-1,
|
||||
),
|
||||
]),
|
||||
]),
|
||||
_: 1,
|
||||
},
|
||||
),
|
||||
]),
|
||||
unref(U) && unref(H)
|
||||
? (openBlock(),
|
||||
createBlock(
|
||||
v,
|
||||
{
|
||||
key: 0,
|
||||
severity: `error`,
|
||||
closable: !1,
|
||||
role: `alert`,
|
||||
},
|
||||
{
|
||||
default: withCtx(() => [
|
||||
createTextVNode(toDisplayString(unref(U)), 1),
|
||||
createVNode(
|
||||
m,
|
||||
{
|
||||
label: `重新加载`,
|
||||
icon: `pi pi-refresh`,
|
||||
severity: `secondary`,
|
||||
text: ``,
|
||||
disabled: unref(V),
|
||||
onClick: Q,
|
||||
},
|
||||
null,
|
||||
8,
|
||||
[`disabled`],
|
||||
),
|
||||
]),
|
||||
_: 1,
|
||||
},
|
||||
))
|
||||
: createCommentVNode(``, !0),
|
||||
unref(V) && !unref(H)
|
||||
? (openBlock(),
|
||||
createElementBlock(`div`, A, [
|
||||
(openBlock(),
|
||||
createElementBlock(
|
||||
Fragment,
|
||||
null,
|
||||
renderList(5, (e) =>
|
||||
createElementVNode(
|
||||
`div`,
|
||||
{
|
||||
key: e,
|
||||
class: `home-row-skeleton`,
|
||||
},
|
||||
[
|
||||
createVNode(x, {
|
||||
height: `14px`,
|
||||
width: `70%`,
|
||||
}),
|
||||
],
|
||||
),
|
||||
),
|
||||
64,
|
||||
)),
|
||||
]))
|
||||
: unref(U) && !unref(H)
|
||||
? (openBlock(),
|
||||
createBlock(
|
||||
W,
|
||||
{
|
||||
key: 2,
|
||||
icon: `pi pi-exclamation-circle`,
|
||||
title: `公告加载失败`,
|
||||
description: unref(U),
|
||||
},
|
||||
{
|
||||
default: withCtx(() => [
|
||||
createVNode(m, {
|
||||
label: `重新加载`,
|
||||
icon: `pi pi-refresh`,
|
||||
severity: `secondary`,
|
||||
size: `small`,
|
||||
onClick: Q,
|
||||
}),
|
||||
]),
|
||||
_: 1,
|
||||
},
|
||||
8,
|
||||
[`description`],
|
||||
))
|
||||
: unref(B).length
|
||||
? (openBlock(),
|
||||
createElementBlock(
|
||||
`div`,
|
||||
{
|
||||
key: 4,
|
||||
class: `home-list`,
|
||||
inert: unref(U) ? !0 : void 0,
|
||||
"aria-disabled": !!unref(U),
|
||||
},
|
||||
[
|
||||
(openBlock(!0),
|
||||
createElementBlock(
|
||||
Fragment,
|
||||
null,
|
||||
renderList(
|
||||
unref(B),
|
||||
(t) => (
|
||||
openBlock(),
|
||||
createElementBlock(
|
||||
`button`,
|
||||
{
|
||||
key: t.id,
|
||||
type: `button`,
|
||||
class: `home-row notice-row`,
|
||||
onClick: (e) => $(t),
|
||||
},
|
||||
[
|
||||
createElementVNode(
|
||||
`span`,
|
||||
N,
|
||||
toDisplayString(t.title),
|
||||
1,
|
||||
),
|
||||
createElementVNode(
|
||||
`span`,
|
||||
P,
|
||||
toDisplayString(
|
||||
(`formatDate` in n
|
||||
? n.formatDate
|
||||
: unref(dict_n))(t.create_time),
|
||||
),
|
||||
1,
|
||||
),
|
||||
],
|
||||
8,
|
||||
M,
|
||||
)
|
||||
),
|
||||
),
|
||||
128,
|
||||
)),
|
||||
],
|
||||
8,
|
||||
j,
|
||||
))
|
||||
: (openBlock(),
|
||||
createBlock(W, {
|
||||
key: 3,
|
||||
icon: `pi pi-megaphone`,
|
||||
title: `暂无公告`,
|
||||
description: `平台公告与通知会显示在这里`,
|
||||
})),
|
||||
createElementVNode(`div`, F, [
|
||||
createVNode(
|
||||
a,
|
||||
{
|
||||
to: `/notices`,
|
||||
class: `home-button secondary`,
|
||||
},
|
||||
{
|
||||
default: withCtx(() => [
|
||||
...(r[5] ||= [createTextVNode(`查看全部`, -1)]),
|
||||
]),
|
||||
_: 1,
|
||||
},
|
||||
),
|
||||
]),
|
||||
createVNode(
|
||||
G,
|
||||
{
|
||||
visible: unref(K),
|
||||
"onUpdate:visible": (r[2] ||= (e) =>
|
||||
isRef(K) ? (K.value = e) : null),
|
||||
header: unref(X)?.title || `公告详情`,
|
||||
modal: ``,
|
||||
draggable: !1,
|
||||
style: {
|
||||
width: `640px`,
|
||||
},
|
||||
},
|
||||
{
|
||||
footer: withCtx(() => [
|
||||
unref(Y) && unref(X)
|
||||
? (openBlock(),
|
||||
createBlock(m, {
|
||||
key: 0,
|
||||
label: `重新加载正文`,
|
||||
icon: `pi pi-refresh`,
|
||||
severity: `secondary`,
|
||||
onClick: (r[0] ||= (e) => $(unref(X))),
|
||||
}))
|
||||
: createCommentVNode(``, !0),
|
||||
createVNode(m, {
|
||||
label: `关闭`,
|
||||
severity: `secondary`,
|
||||
text: ``,
|
||||
onClick: (r[1] ||= (e) => (K.value = !1)),
|
||||
}),
|
||||
]),
|
||||
default: withCtx(() => [
|
||||
unref(J)
|
||||
? (openBlock(),
|
||||
createElementBlock(`div`, I, [
|
||||
createVNode(x, {
|
||||
height: `120px`,
|
||||
}),
|
||||
]))
|
||||
: unref(Y)
|
||||
? (openBlock(),
|
||||
createBlock(
|
||||
v,
|
||||
{
|
||||
key: 1,
|
||||
severity: `error`,
|
||||
closable: !1,
|
||||
},
|
||||
{
|
||||
default: withCtx(() => [
|
||||
createTextVNode(
|
||||
toDisplayString(unref(Y)),
|
||||
1,
|
||||
),
|
||||
]),
|
||||
_: 1,
|
||||
},
|
||||
))
|
||||
: unref(q)
|
||||
? (openBlock(),
|
||||
createElementBlock(`div`, L, [
|
||||
createElementVNode(
|
||||
`div`,
|
||||
R,
|
||||
toDisplayString(
|
||||
(`formatTime` in n
|
||||
? n.formatTime
|
||||
: unref(dict_r))(unref(q).create_time),
|
||||
),
|
||||
1,
|
||||
),
|
||||
createElementVNode(
|
||||
`div`,
|
||||
{
|
||||
class: `detail-content`,
|
||||
innerHTML: (`sanitizeHtml` in n
|
||||
? n.sanitizeHtml
|
||||
: unref(sanitize_n))(
|
||||
unref(q).content || ``,
|
||||
),
|
||||
},
|
||||
null,
|
||||
8,
|
||||
z,
|
||||
),
|
||||
]))
|
||||
: createCommentVNode(``, !0),
|
||||
]),
|
||||
_: 1,
|
||||
},
|
||||
8,
|
||||
[`visible`, `header`],
|
||||
),
|
||||
],
|
||||
8,
|
||||
O,
|
||||
)
|
||||
);
|
||||
};
|
||||
},
|
||||
}),
|
||||
[[`__scopeId`, `data-v-a93c47c1`]],
|
||||
),
|
||||
{
|
||||
__name: `HomeNoticePanel`,
|
||||
},
|
||||
);
|
||||
export {};
|
||||
export default B;
|
||||
</script>
|
||||
@@ -0,0 +1,427 @@
|
||||
<script>
|
||||
import "~/assets/styles/HomeReferralPanel.DsgN33ME.css";
|
||||
import { toDisplayString } from "vue";
|
||||
import { renderList } from "vue";
|
||||
import { onMounted } from "vue";
|
||||
import { ref } from "vue";
|
||||
import { withCtx } from "vue";
|
||||
import { createCommentVNode } from "vue";
|
||||
import { computed } from "vue";
|
||||
import { createElementBlock } from "vue";
|
||||
import { Fragment } from "vue";
|
||||
import { createElementVNode } from "vue";
|
||||
import { createTextVNode } from "vue";
|
||||
import { unref } from "vue";
|
||||
import { defineComponent } from "vue";
|
||||
import { createVNode } from "vue";
|
||||
import { openBlock } from "vue";
|
||||
import { NuxtLink } from "#components";
|
||||
import { useApi } from "~/lib/auth.js";
|
||||
import { Icon } from "#components";
|
||||
import button from "primevue/button";
|
||||
import { t as _plugin_vue_export_helper_t } from "~/lib/_plugin-vue_export-helper.js";
|
||||
import skeleton from "primevue/skeleton";
|
||||
var x = [`aria-busy`],
|
||||
S = {
|
||||
class: `home-card-head`,
|
||||
},
|
||||
C = {
|
||||
id: `home-referral-title`,
|
||||
class: `home-card-title`,
|
||||
},
|
||||
w = {
|
||||
key: 0,
|
||||
class: `referral-body referral-loading`,
|
||||
role: `status`,
|
||||
"aria-label": `正在加载推介数据`,
|
||||
},
|
||||
T = {
|
||||
class: `referral-placeholders`,
|
||||
},
|
||||
E = {
|
||||
key: 1,
|
||||
class: `referral-body referral-empty`,
|
||||
role: `status`,
|
||||
},
|
||||
D = {
|
||||
key: 2,
|
||||
class: `referral-body`,
|
||||
},
|
||||
O = {
|
||||
class: `referral-overview`,
|
||||
},
|
||||
k = {
|
||||
class: `referral-balance`,
|
||||
},
|
||||
A = {
|
||||
key: 0,
|
||||
},
|
||||
j = {
|
||||
key: 0,
|
||||
class: `referral-invitees`,
|
||||
},
|
||||
M = {
|
||||
class: `referral-stats`,
|
||||
},
|
||||
N = {
|
||||
key: 0,
|
||||
},
|
||||
P = {
|
||||
class: `referral-footer`,
|
||||
},
|
||||
F = {
|
||||
key: 3,
|
||||
class: `referral-body referral-empty`,
|
||||
},
|
||||
I = Object.assign(
|
||||
_plugin_vue_export_helper_t(
|
||||
defineComponent({
|
||||
__name: `HomeReferralPanel`,
|
||||
setup(f) {
|
||||
let y = useApi(),
|
||||
I = ref(null),
|
||||
L = ref(!0),
|
||||
R = ref(``),
|
||||
z = !1,
|
||||
B = computed(() => !!I.value?.url),
|
||||
V = computed(() => I.value?.permission === 1),
|
||||
H = computed(() => I.value?.relation_mode === `permanent`),
|
||||
U = computed(() => [
|
||||
{
|
||||
label: `待结算`,
|
||||
value: I.value?.pending_amount,
|
||||
},
|
||||
{
|
||||
label: `已生效`,
|
||||
value: I.value?.active_amount,
|
||||
},
|
||||
{
|
||||
label: `已提现`,
|
||||
value: I.value?.withdrawn_amount,
|
||||
},
|
||||
]);
|
||||
function W(e, t = !0) {
|
||||
if (
|
||||
(typeof e != `number` && typeof e != `string`) ||
|
||||
String(e).trim() === ``
|
||||
)
|
||||
return `—`;
|
||||
let n = Number(e);
|
||||
return !Number.isFinite(n) ||
|
||||
(!t && (!Number.isInteger(n) || n < 0))
|
||||
? `—`
|
||||
: n.toLocaleString(`zh-CN`, {
|
||||
minimumFractionDigits: t ? 2 : 0,
|
||||
maximumFractionDigits: t ? 2 : 0,
|
||||
});
|
||||
}
|
||||
async function G() {
|
||||
if (!z) {
|
||||
((z = !0), (L.value = !0), (R.value = ``));
|
||||
try {
|
||||
let e = (
|
||||
await y.get(`/recommend/promoter`, void 0, !1, {
|
||||
timeoutMs: 1e4,
|
||||
})
|
||||
)?.promoter;
|
||||
if (!e || (!e.url && e.permission !== 0 && e.permission !== 1))
|
||||
throw Error(`暂时无法获取推介数据,请重试。`);
|
||||
I.value = e;
|
||||
} catch (e) {
|
||||
((I.value = null),
|
||||
(R.value =
|
||||
e instanceof Error
|
||||
? e.message
|
||||
: `暂时无法获取推介数据,请重试。`));
|
||||
} finally {
|
||||
((L.value = !1), (z = !1));
|
||||
}
|
||||
}
|
||||
}
|
||||
return (
|
||||
onMounted(G),
|
||||
(n, r) => {
|
||||
let o = Icon,
|
||||
f = NuxtLink,
|
||||
g = skeleton,
|
||||
y = button;
|
||||
return (
|
||||
openBlock(),
|
||||
createElementBlock(
|
||||
`section`,
|
||||
{
|
||||
class: `home-card home-referral`,
|
||||
"aria-labelledby": `home-referral-title`,
|
||||
"aria-busy": unref(L),
|
||||
},
|
||||
[
|
||||
createElementVNode(`div`, S, [
|
||||
createElementVNode(`h2`, C, [
|
||||
createVNode(o, {
|
||||
name: `lucide:gift`,
|
||||
"aria-hidden": `true`,
|
||||
}),
|
||||
(r[0] ||= createTextVNode(`推介计划`, -1)),
|
||||
]),
|
||||
createVNode(
|
||||
f,
|
||||
{
|
||||
to: `/recommend`,
|
||||
class: `home-card-more`,
|
||||
"aria-label": `查看推介计划`,
|
||||
},
|
||||
{
|
||||
default: withCtx(() => [
|
||||
...(r[1] ||= [
|
||||
createElementVNode(
|
||||
`i`,
|
||||
{
|
||||
class: `pi pi-angle-right`,
|
||||
"aria-hidden": `true`,
|
||||
},
|
||||
null,
|
||||
-1,
|
||||
),
|
||||
]),
|
||||
]),
|
||||
_: 1,
|
||||
},
|
||||
),
|
||||
]),
|
||||
unref(L)
|
||||
? (openBlock(),
|
||||
createElementBlock(`div`, w, [
|
||||
createVNode(g, {
|
||||
width: `6rem`,
|
||||
height: `14px`,
|
||||
}),
|
||||
createVNode(g, {
|
||||
width: `11rem`,
|
||||
height: `36px`,
|
||||
}),
|
||||
createElementVNode(`div`, T, [
|
||||
(openBlock(),
|
||||
createElementBlock(
|
||||
Fragment,
|
||||
null,
|
||||
renderList(3, (e) =>
|
||||
createVNode(g, {
|
||||
key: e,
|
||||
height: `48px`,
|
||||
}),
|
||||
),
|
||||
64,
|
||||
)),
|
||||
]),
|
||||
]))
|
||||
: unref(R)
|
||||
? (openBlock(),
|
||||
createElementBlock(`div`, E, [
|
||||
(r[2] ||= createElementVNode(
|
||||
`h3`,
|
||||
null,
|
||||
`推介数据加载失败`,
|
||||
-1,
|
||||
)),
|
||||
createElementVNode(
|
||||
`p`,
|
||||
null,
|
||||
toDisplayString(unref(R)),
|
||||
1,
|
||||
),
|
||||
createVNode(y, {
|
||||
label: `重试`,
|
||||
icon: `pi pi-refresh`,
|
||||
severity: `secondary`,
|
||||
outlined: ``,
|
||||
size: `small`,
|
||||
onClick: G,
|
||||
}),
|
||||
]))
|
||||
: unref(B)
|
||||
? (openBlock(),
|
||||
createElementBlock(`div`, D, [
|
||||
createElementVNode(`dl`, O, [
|
||||
createElementVNode(`div`, k, [
|
||||
(r[3] ||= createElementVNode(
|
||||
`dt`,
|
||||
null,
|
||||
`可提现奖励`,
|
||||
-1,
|
||||
)),
|
||||
createElementVNode(`dd`, null, [
|
||||
W(unref(I)?.withdrawable_amount) === `—`
|
||||
? createCommentVNode(``, !0)
|
||||
: (openBlock(),
|
||||
createElementBlock(`small`, A, `¥`)),
|
||||
createTextVNode(
|
||||
toDisplayString(
|
||||
W(unref(I)?.withdrawable_amount),
|
||||
),
|
||||
1,
|
||||
),
|
||||
]),
|
||||
]),
|
||||
unref(H)
|
||||
? (openBlock(),
|
||||
createElementBlock(`div`, j, [
|
||||
(r[5] ||= createElementVNode(
|
||||
`dt`,
|
||||
null,
|
||||
`邀请人数`,
|
||||
-1,
|
||||
)),
|
||||
createElementVNode(`dd`, null, [
|
||||
createTextVNode(
|
||||
toDisplayString(
|
||||
W(unref(I)?.invitee_count, !1),
|
||||
),
|
||||
1,
|
||||
),
|
||||
(r[4] ||= createElementVNode(
|
||||
`small`,
|
||||
null,
|
||||
`人`,
|
||||
-1,
|
||||
)),
|
||||
]),
|
||||
]))
|
||||
: createCommentVNode(``, !0),
|
||||
]),
|
||||
createElementVNode(`dl`, M, [
|
||||
(openBlock(!0),
|
||||
createElementBlock(
|
||||
Fragment,
|
||||
null,
|
||||
renderList(
|
||||
unref(U),
|
||||
(t) => (
|
||||
openBlock(),
|
||||
createElementBlock(
|
||||
`div`,
|
||||
{
|
||||
key: t.label,
|
||||
class: `referral-stat`,
|
||||
},
|
||||
[
|
||||
createElementVNode(
|
||||
`dt`,
|
||||
null,
|
||||
toDisplayString(t.label),
|
||||
1,
|
||||
),
|
||||
createElementVNode(`dd`, null, [
|
||||
W(t.value) === `—`
|
||||
? createCommentVNode(``, !0)
|
||||
: (openBlock(),
|
||||
createElementBlock(
|
||||
`small`,
|
||||
N,
|
||||
`¥`,
|
||||
)),
|
||||
createTextVNode(
|
||||
toDisplayString(W(t.value)),
|
||||
1,
|
||||
),
|
||||
]),
|
||||
],
|
||||
)
|
||||
),
|
||||
),
|
||||
128,
|
||||
)),
|
||||
]),
|
||||
createElementVNode(`div`, P, [
|
||||
(r[7] ||= createElementVNode(
|
||||
`p`,
|
||||
null,
|
||||
`查看邀请记录与奖励结算进度`,
|
||||
-1,
|
||||
)),
|
||||
createVNode(
|
||||
f,
|
||||
{
|
||||
to: `/recommend`,
|
||||
class: `referral-details`,
|
||||
},
|
||||
{
|
||||
default: withCtx(() => [
|
||||
...(r[6] ||= [
|
||||
createTextVNode(`查看推介明细`, -1),
|
||||
createElementVNode(
|
||||
`i`,
|
||||
{
|
||||
class: `pi pi-angle-right`,
|
||||
"aria-hidden": `true`,
|
||||
},
|
||||
null,
|
||||
-1,
|
||||
),
|
||||
]),
|
||||
]),
|
||||
_: 1,
|
||||
},
|
||||
),
|
||||
]),
|
||||
]))
|
||||
: (openBlock(),
|
||||
createElementBlock(`div`, F, [
|
||||
createElementVNode(
|
||||
`h3`,
|
||||
null,
|
||||
toDisplayString(
|
||||
unref(V)
|
||||
? `尚未开通推介计划`
|
||||
: `暂未开放推介申请`,
|
||||
),
|
||||
1,
|
||||
),
|
||||
createElementVNode(
|
||||
`p`,
|
||||
null,
|
||||
toDisplayString(
|
||||
unref(V)
|
||||
? `开通后获取专属链接,邀请好友。你的邀请人数与推介奖励将在这里展示。`
|
||||
: `目前暂不接受新的推介申请,可前往推介计划查看详情。`,
|
||||
),
|
||||
1,
|
||||
),
|
||||
createVNode(
|
||||
f,
|
||||
{
|
||||
to: `/recommend`,
|
||||
class: `home-button`,
|
||||
},
|
||||
{
|
||||
default: withCtx(() => [
|
||||
createTextVNode(
|
||||
toDisplayString(
|
||||
unref(V)
|
||||
? `了解并开通`
|
||||
: `查看推介计划`,
|
||||
),
|
||||
1,
|
||||
),
|
||||
]),
|
||||
_: 1,
|
||||
},
|
||||
),
|
||||
])),
|
||||
],
|
||||
8,
|
||||
x,
|
||||
)
|
||||
);
|
||||
}
|
||||
);
|
||||
},
|
||||
}),
|
||||
[[`__scopeId`, `data-v-8690c3a5`]],
|
||||
),
|
||||
{
|
||||
__name: `HomeReferralPanel`,
|
||||
},
|
||||
);
|
||||
export {};
|
||||
export default I;
|
||||
</script>
|
||||
@@ -0,0 +1,491 @@
|
||||
<script>
|
||||
import "~/assets/styles/HomeServerPanel.Do7AgMDx.css";
|
||||
import { toDisplayString } from "vue";
|
||||
import { renderList } from "vue";
|
||||
import { onMounted } from "vue";
|
||||
import { onUnmounted } from "vue";
|
||||
import { normalizeClass } from "vue";
|
||||
import { watch } from "vue";
|
||||
import { createBlock } from "vue";
|
||||
import { ref } from "vue";
|
||||
import { withCtx } from "vue";
|
||||
import { createCommentVNode } from "vue";
|
||||
import { createElementBlock } from "vue";
|
||||
import { Fragment } from "vue";
|
||||
import { createElementVNode } from "vue";
|
||||
import { createTextVNode } from "vue";
|
||||
import { unref } from "vue";
|
||||
import { defineComponent } from "vue";
|
||||
import { createVNode } from "vue";
|
||||
import { openBlock } from "vue";
|
||||
import { NuxtLink } from "#components";
|
||||
import { useApi } from "~/lib/auth.js";
|
||||
import button from "primevue/button";
|
||||
import { t as _plugin_vue_export_helper_t } from "~/lib/_plugin-vue_export-helper.js";
|
||||
import message from "primevue/message";
|
||||
import { n as product_name_n } from "~/lib/product-name.js";
|
||||
import { c as dict_c } from "~/lib/dict.js";
|
||||
import { l as dict_l } from "~/lib/dict.js";
|
||||
import { r as dict_r } from "~/lib/dict.js";
|
||||
import paginator from "primevue/paginator";
|
||||
import ListEmpty from "~/components/ListEmpty.vue";
|
||||
import { t as modules_t } from "~/lib/modules.js";
|
||||
import tag from "primevue/tag";
|
||||
import skeleton from "primevue/skeleton";
|
||||
import { t as server_page_t } from "~/lib/server-page.js";
|
||||
var ne = [`aria-busy`],
|
||||
j = {
|
||||
class: `home-card-head server-head`,
|
||||
},
|
||||
M = {
|
||||
class: `home-tabs`,
|
||||
role: `group`,
|
||||
"aria-label": `服务器类型`,
|
||||
},
|
||||
N = [`aria-pressed`, `onClick`],
|
||||
P = {
|
||||
key: 0,
|
||||
class: `server-cols`,
|
||||
},
|
||||
F = {
|
||||
key: 2,
|
||||
class: `home-list`,
|
||||
},
|
||||
I = [`inert`, `aria-disabled`],
|
||||
L = {
|
||||
class: `home-row-main`,
|
||||
},
|
||||
R = {
|
||||
class: `home-row-title`,
|
||||
},
|
||||
z = {
|
||||
class: `home-row-sub`,
|
||||
},
|
||||
B = {
|
||||
class: `home-row-side server-due`,
|
||||
},
|
||||
V = [`inert`, `aria-disabled`],
|
||||
H = Object.assign(
|
||||
_plugin_vue_export_helper_t(
|
||||
defineComponent({
|
||||
__name: `HomeServerPanel`,
|
||||
setup(h) {
|
||||
let x = useApi(),
|
||||
H = [
|
||||
{
|
||||
label: `云服务器`,
|
||||
modules: modules_t.cloud,
|
||||
to: `/cloud-servers`,
|
||||
},
|
||||
{
|
||||
label: `物理服务器`,
|
||||
modules: modules_t.dcim,
|
||||
to: `/dedicated-servers`,
|
||||
},
|
||||
],
|
||||
U = H.map((e) => server_page_t(x, e.modules)),
|
||||
W = ref(0),
|
||||
G = ref([]),
|
||||
K = ref(!0),
|
||||
q = ref(!1),
|
||||
J = ref(``),
|
||||
Y = ref(1),
|
||||
X = ref(0),
|
||||
Z = 0,
|
||||
Q = ``;
|
||||
async function $() {
|
||||
let e = ++Z,
|
||||
t = JSON.stringify([W.value, Y.value]);
|
||||
(t !== Q && ((G.value = []), (X.value = 0), (q.value = !1)),
|
||||
(K.value = !0),
|
||||
(J.value = ``));
|
||||
try {
|
||||
let n = await U[W.value]({
|
||||
module: H[W.value].modules.join(`,`),
|
||||
page: Y.value,
|
||||
limit: 5,
|
||||
});
|
||||
if (e !== Z) return;
|
||||
((G.value = n.list ?? []),
|
||||
(X.value = n.count ?? G.value.length),
|
||||
(Q = t),
|
||||
(q.value = !0));
|
||||
} catch (t) {
|
||||
if (e !== Z) return;
|
||||
J.value = t instanceof Error ? t.message : `服务器加载失败`;
|
||||
} finally {
|
||||
e === Z && (K.value = !1);
|
||||
}
|
||||
}
|
||||
function re(e) {
|
||||
if (!(K.value || J.value)) return ((Y.value = e.page + 1), $());
|
||||
}
|
||||
return (
|
||||
watch(W, () => {
|
||||
((Y.value = 1), $());
|
||||
}),
|
||||
onMounted($),
|
||||
onUnmounted(() => {
|
||||
Z += 1;
|
||||
}),
|
||||
(n, r) => {
|
||||
let a = NuxtLink,
|
||||
s = button,
|
||||
h = message,
|
||||
y = skeleton,
|
||||
x = ListEmpty,
|
||||
D = tag,
|
||||
A = paginator;
|
||||
return (
|
||||
openBlock(),
|
||||
createElementBlock(
|
||||
`div`,
|
||||
{
|
||||
class: `home-card`,
|
||||
"aria-busy": unref(K),
|
||||
},
|
||||
[
|
||||
createElementVNode(`div`, j, [
|
||||
(r[1] ||= createElementVNode(
|
||||
`div`,
|
||||
{
|
||||
class: `home-card-title`,
|
||||
},
|
||||
`服务器`,
|
||||
-1,
|
||||
)),
|
||||
createVNode(
|
||||
a,
|
||||
{
|
||||
to: H[unref(W)].to,
|
||||
class: `home-card-more`,
|
||||
"aria-label": `查看全部${H[unref(W)].label}`,
|
||||
},
|
||||
{
|
||||
default: withCtx(() => [
|
||||
...(r[0] ||= [
|
||||
createElementVNode(
|
||||
`i`,
|
||||
{
|
||||
class: `pi pi-angle-right`,
|
||||
},
|
||||
null,
|
||||
-1,
|
||||
),
|
||||
]),
|
||||
]),
|
||||
_: 1,
|
||||
},
|
||||
8,
|
||||
[`to`, `aria-label`],
|
||||
),
|
||||
]),
|
||||
createElementVNode(`div`, M, [
|
||||
(openBlock(),
|
||||
createElementBlock(
|
||||
Fragment,
|
||||
null,
|
||||
renderList(H, (t, n) =>
|
||||
createElementVNode(
|
||||
`button`,
|
||||
{
|
||||
key: t.label,
|
||||
type: `button`,
|
||||
class: normalizeClass([
|
||||
`home-tab`,
|
||||
{
|
||||
active: unref(W) === n,
|
||||
},
|
||||
]),
|
||||
"aria-pressed": unref(W) === n,
|
||||
onClick: (e) => (W.value = n),
|
||||
},
|
||||
toDisplayString(t.label),
|
||||
11,
|
||||
N,
|
||||
),
|
||||
),
|
||||
64,
|
||||
)),
|
||||
]),
|
||||
unref(G).length || unref(K)
|
||||
? (openBlock(),
|
||||
createElementBlock(`div`, P, [
|
||||
...(r[2] ||= [
|
||||
createElementVNode(`span`, null, `名称`, -1),
|
||||
createElementVNode(`span`, null, `到期时间`, -1),
|
||||
createElementVNode(`span`, null, `计费状态`, -1),
|
||||
]),
|
||||
]))
|
||||
: createCommentVNode(``, !0),
|
||||
unref(J) && unref(q)
|
||||
? (openBlock(),
|
||||
createBlock(
|
||||
h,
|
||||
{
|
||||
key: 1,
|
||||
severity: `error`,
|
||||
closable: !1,
|
||||
role: `alert`,
|
||||
},
|
||||
{
|
||||
default: withCtx(() => [
|
||||
createTextVNode(toDisplayString(unref(J)), 1),
|
||||
createVNode(
|
||||
s,
|
||||
{
|
||||
label: `重新加载`,
|
||||
icon: `pi pi-refresh`,
|
||||
severity: `secondary`,
|
||||
text: ``,
|
||||
disabled: unref(K),
|
||||
onClick: $,
|
||||
},
|
||||
null,
|
||||
8,
|
||||
[`disabled`],
|
||||
),
|
||||
]),
|
||||
_: 1,
|
||||
},
|
||||
))
|
||||
: createCommentVNode(``, !0),
|
||||
unref(K) && !unref(q)
|
||||
? (openBlock(),
|
||||
createElementBlock(`div`, F, [
|
||||
(openBlock(),
|
||||
createElementBlock(
|
||||
Fragment,
|
||||
null,
|
||||
renderList(5, (e) =>
|
||||
createElementVNode(
|
||||
`div`,
|
||||
{
|
||||
key: e,
|
||||
class: `home-row-skeleton`,
|
||||
},
|
||||
[
|
||||
createVNode(y, {
|
||||
height: `14px`,
|
||||
width: `45%`,
|
||||
}),
|
||||
createVNode(y, {
|
||||
height: `12px`,
|
||||
width: `30%`,
|
||||
style: {
|
||||
"margin-top": `8px`,
|
||||
},
|
||||
}),
|
||||
],
|
||||
),
|
||||
),
|
||||
64,
|
||||
)),
|
||||
]))
|
||||
: unref(J) && !unref(q)
|
||||
? (openBlock(),
|
||||
createBlock(
|
||||
x,
|
||||
{
|
||||
key: 3,
|
||||
icon: `pi pi-exclamation-circle`,
|
||||
title: `服务器加载失败`,
|
||||
description: unref(J),
|
||||
},
|
||||
{
|
||||
default: withCtx(() => [
|
||||
createVNode(s, {
|
||||
label: `重新加载`,
|
||||
icon: `pi pi-refresh`,
|
||||
severity: `secondary`,
|
||||
outlined: ``,
|
||||
onClick: $,
|
||||
}),
|
||||
]),
|
||||
_: 1,
|
||||
},
|
||||
8,
|
||||
[`description`],
|
||||
))
|
||||
: unref(G).length
|
||||
? (openBlock(),
|
||||
createElementBlock(
|
||||
`div`,
|
||||
{
|
||||
key: 5,
|
||||
class: `home-list`,
|
||||
inert: unref(J) ? !0 : void 0,
|
||||
"aria-disabled": !!unref(J),
|
||||
},
|
||||
[
|
||||
(openBlock(!0),
|
||||
createElementBlock(
|
||||
Fragment,
|
||||
null,
|
||||
renderList(
|
||||
unref(G),
|
||||
(t) => (
|
||||
openBlock(),
|
||||
createBlock(
|
||||
a,
|
||||
{
|
||||
key: t.id,
|
||||
to: `/servers/server?id=${t.id}`,
|
||||
class: `home-row`,
|
||||
},
|
||||
{
|
||||
default: withCtx(() => [
|
||||
createElementVNode(`div`, L, [
|
||||
createElementVNode(
|
||||
`div`,
|
||||
R,
|
||||
toDisplayString(
|
||||
unref(product_name_n)(
|
||||
t.product_name,
|
||||
) || t.name,
|
||||
),
|
||||
1,
|
||||
),
|
||||
createElementVNode(
|
||||
`div`,
|
||||
z,
|
||||
` #` +
|
||||
toDisplayString(t.id) +
|
||||
` / ` +
|
||||
toDisplayString(t.name),
|
||||
1,
|
||||
),
|
||||
]),
|
||||
createElementVNode(
|
||||
`span`,
|
||||
B,
|
||||
toDisplayString(
|
||||
(`formatTime` in n
|
||||
? n.formatTime
|
||||
: unref(dict_r))(t.due_time),
|
||||
),
|
||||
1,
|
||||
),
|
||||
createVNode(
|
||||
D,
|
||||
{
|
||||
value: (`statusLabel` in n
|
||||
? n.statusLabel
|
||||
: unref(dict_c))(t.status),
|
||||
severity: (`statusSeverity` in n
|
||||
? n.statusSeverity
|
||||
: unref(dict_l))(t.status),
|
||||
},
|
||||
null,
|
||||
8,
|
||||
[`value`, `severity`],
|
||||
),
|
||||
]),
|
||||
_: 2,
|
||||
},
|
||||
1032,
|
||||
[`to`],
|
||||
)
|
||||
),
|
||||
),
|
||||
128,
|
||||
)),
|
||||
],
|
||||
8,
|
||||
I,
|
||||
))
|
||||
: (openBlock(),
|
||||
createBlock(
|
||||
x,
|
||||
{
|
||||
key: 4,
|
||||
icon: `pi pi-server`,
|
||||
title: `还没有${H[unref(W)].label}`,
|
||||
description: `选购后实例会显示在这里`,
|
||||
},
|
||||
{
|
||||
default: withCtx(() => [
|
||||
createVNode(
|
||||
a,
|
||||
{
|
||||
to: `/products`,
|
||||
class: `home-button`,
|
||||
},
|
||||
{
|
||||
default: withCtx(() => [
|
||||
...(r[3] ||= [
|
||||
createElementVNode(
|
||||
`i`,
|
||||
{
|
||||
class: `pi pi-plus`,
|
||||
"aria-hidden": `true`,
|
||||
},
|
||||
null,
|
||||
-1,
|
||||
),
|
||||
createTextVNode(`订购产品`, -1),
|
||||
]),
|
||||
]),
|
||||
_: 1,
|
||||
},
|
||||
),
|
||||
]),
|
||||
_: 1,
|
||||
},
|
||||
8,
|
||||
[`title`],
|
||||
)),
|
||||
unref(G).length || (unref(K) && !unref(q))
|
||||
? (openBlock(),
|
||||
createElementBlock(
|
||||
`div`,
|
||||
{
|
||||
key: 6,
|
||||
class: `server-pagination`,
|
||||
inert: unref(K) || unref(J) ? !0 : void 0,
|
||||
"aria-disabled": unref(K) || !!unref(J),
|
||||
},
|
||||
[
|
||||
unref(K) && !unref(q)
|
||||
? (openBlock(),
|
||||
createBlock(y, {
|
||||
key: 0,
|
||||
height: `40px`,
|
||||
}))
|
||||
: (openBlock(),
|
||||
createBlock(
|
||||
A,
|
||||
{
|
||||
key: 1,
|
||||
rows: 5,
|
||||
"total-records": unref(X),
|
||||
first: (unref(Y) - 1) * 5,
|
||||
onPage: re,
|
||||
},
|
||||
null,
|
||||
8,
|
||||
[`total-records`, `first`],
|
||||
)),
|
||||
],
|
||||
8,
|
||||
V,
|
||||
))
|
||||
: createCommentVNode(``, !0),
|
||||
],
|
||||
8,
|
||||
ne,
|
||||
)
|
||||
);
|
||||
}
|
||||
);
|
||||
},
|
||||
}),
|
||||
[[`__scopeId`, `data-v-7ce76df7`]],
|
||||
),
|
||||
{
|
||||
__name: `HomeServerPanel`,
|
||||
},
|
||||
);
|
||||
export {};
|
||||
export default H;
|
||||
</script>
|
||||
@@ -0,0 +1,394 @@
|
||||
<script>
|
||||
import "~/assets/styles/HomeTicketPanel.LxPesukM.css";
|
||||
import { toDisplayString } from "vue";
|
||||
import { renderList } from "vue";
|
||||
import { onMounted } from "vue";
|
||||
import { onBeforeUnmount } from "vue";
|
||||
import { createBlock } from "vue";
|
||||
import { ref } from "vue";
|
||||
import { withCtx } from "vue";
|
||||
import { createCommentVNode } from "vue";
|
||||
import { createElementBlock } from "vue";
|
||||
import { Fragment } from "vue";
|
||||
import { createElementVNode } from "vue";
|
||||
import { createTextVNode } from "vue";
|
||||
import { unref } from "vue";
|
||||
import { defineComponent } from "vue";
|
||||
import { createVNode } from "vue";
|
||||
import { openBlock } from "vue";
|
||||
import { normalizeStyle } from "vue";
|
||||
import { NuxtLink } from "#components";
|
||||
import { useApi } from "~/lib/auth.js";
|
||||
import button from "primevue/button";
|
||||
import { t as _plugin_vue_export_helper_t } from "~/lib/_plugin-vue_export-helper.js";
|
||||
import message from "primevue/message";
|
||||
import { n as dict_n } from "~/lib/dict.js";
|
||||
import ListEmpty from "~/components/ListEmpty.vue";
|
||||
import skeleton from "primevue/skeleton";
|
||||
var T = [`aria-busy`],
|
||||
E = {
|
||||
class: `home-card-head`,
|
||||
},
|
||||
D = {
|
||||
key: 1,
|
||||
class: `home-list`,
|
||||
},
|
||||
O = [`inert`, `aria-disabled`],
|
||||
k = {
|
||||
class: `home-row-main`,
|
||||
},
|
||||
A = {
|
||||
class: `home-row-title`,
|
||||
},
|
||||
j = {
|
||||
class: `home-row-sub`,
|
||||
},
|
||||
M = {
|
||||
key: 5,
|
||||
class: `home-card-foot`,
|
||||
},
|
||||
N = Object.assign(
|
||||
_plugin_vue_export_helper_t(
|
||||
defineComponent({
|
||||
__name: `HomeTicketPanel`,
|
||||
setup(p) {
|
||||
let b = useApi(),
|
||||
N = ref([]),
|
||||
P = ref(!0),
|
||||
F = ref(!1),
|
||||
I = ref(``),
|
||||
L = 0;
|
||||
async function R() {
|
||||
let e = ++L;
|
||||
((P.value = !0), (I.value = ``));
|
||||
try {
|
||||
let t = await b.get(`/ticket`, {
|
||||
page: 1,
|
||||
limit: 5,
|
||||
});
|
||||
if (e !== L) return;
|
||||
((N.value = t.list ?? []), (F.value = !0));
|
||||
} catch (t) {
|
||||
if (e !== L) return;
|
||||
I.value = t instanceof Error ? t.message : `工单加载失败`;
|
||||
} finally {
|
||||
e === L && (P.value = !1);
|
||||
}
|
||||
}
|
||||
return (
|
||||
onMounted(R),
|
||||
onBeforeUnmount(() => {
|
||||
L++;
|
||||
}),
|
||||
(n, r) => {
|
||||
let a = NuxtLink,
|
||||
p = button,
|
||||
v = message,
|
||||
b = skeleton,
|
||||
L = ListEmpty;
|
||||
return (
|
||||
openBlock(),
|
||||
createElementBlock(
|
||||
`div`,
|
||||
{
|
||||
class: `home-card`,
|
||||
"aria-busy": unref(P),
|
||||
},
|
||||
[
|
||||
createElementVNode(`div`, E, [
|
||||
(r[1] ||= createElementVNode(
|
||||
`div`,
|
||||
{
|
||||
class: `home-card-title`,
|
||||
},
|
||||
`工单处理`,
|
||||
-1,
|
||||
)),
|
||||
createVNode(
|
||||
a,
|
||||
{
|
||||
to: `/tickets`,
|
||||
class: `home-card-more`,
|
||||
"aria-label": `全部工单`,
|
||||
},
|
||||
{
|
||||
default: withCtx(() => [
|
||||
...(r[0] ||= [
|
||||
createElementVNode(
|
||||
`i`,
|
||||
{
|
||||
class: `pi pi-angle-right`,
|
||||
},
|
||||
null,
|
||||
-1,
|
||||
),
|
||||
]),
|
||||
]),
|
||||
_: 1,
|
||||
},
|
||||
),
|
||||
]),
|
||||
unref(I) && unref(F)
|
||||
? (openBlock(),
|
||||
createBlock(
|
||||
v,
|
||||
{
|
||||
key: 0,
|
||||
severity: `error`,
|
||||
closable: !1,
|
||||
role: `alert`,
|
||||
},
|
||||
{
|
||||
default: withCtx(() => [
|
||||
createTextVNode(toDisplayString(unref(I)), 1),
|
||||
createVNode(
|
||||
p,
|
||||
{
|
||||
label: `重新加载`,
|
||||
icon: `pi pi-refresh`,
|
||||
severity: `secondary`,
|
||||
text: ``,
|
||||
disabled: unref(P),
|
||||
onClick: R,
|
||||
},
|
||||
null,
|
||||
8,
|
||||
[`disabled`],
|
||||
),
|
||||
]),
|
||||
_: 1,
|
||||
},
|
||||
))
|
||||
: createCommentVNode(``, !0),
|
||||
unref(P) && !unref(F)
|
||||
? (openBlock(),
|
||||
createElementBlock(`div`, D, [
|
||||
(openBlock(),
|
||||
createElementBlock(
|
||||
Fragment,
|
||||
null,
|
||||
renderList(5, (e) =>
|
||||
createElementVNode(
|
||||
`div`,
|
||||
{
|
||||
key: e,
|
||||
class: `home-row-skeleton`,
|
||||
},
|
||||
[
|
||||
createVNode(b, {
|
||||
height: `14px`,
|
||||
width: `55%`,
|
||||
}),
|
||||
createVNode(b, {
|
||||
height: `12px`,
|
||||
width: `35%`,
|
||||
style: {
|
||||
"margin-top": `8px`,
|
||||
},
|
||||
}),
|
||||
],
|
||||
),
|
||||
),
|
||||
64,
|
||||
)),
|
||||
]))
|
||||
: unref(I) && !unref(F)
|
||||
? (openBlock(),
|
||||
createBlock(
|
||||
L,
|
||||
{
|
||||
key: 2,
|
||||
icon: `pi pi-exclamation-circle`,
|
||||
title: `工单加载失败`,
|
||||
description: unref(I),
|
||||
},
|
||||
{
|
||||
default: withCtx(() => [
|
||||
createVNode(p, {
|
||||
label: `重新加载`,
|
||||
icon: `pi pi-refresh`,
|
||||
severity: `secondary`,
|
||||
outlined: ``,
|
||||
onClick: R,
|
||||
}),
|
||||
]),
|
||||
_: 1,
|
||||
},
|
||||
8,
|
||||
[`description`],
|
||||
))
|
||||
: unref(N).length
|
||||
? (openBlock(),
|
||||
createElementBlock(
|
||||
`div`,
|
||||
{
|
||||
key: 4,
|
||||
class: `home-list`,
|
||||
inert: unref(I) ? !0 : void 0,
|
||||
"aria-disabled": !!unref(I),
|
||||
},
|
||||
[
|
||||
(openBlock(!0),
|
||||
createElementBlock(
|
||||
Fragment,
|
||||
null,
|
||||
renderList(
|
||||
unref(N),
|
||||
(t) => (
|
||||
openBlock(),
|
||||
createBlock(
|
||||
a,
|
||||
{
|
||||
key: t.id,
|
||||
to: `/tickets/${t.id}`,
|
||||
class: `home-row`,
|
||||
},
|
||||
{
|
||||
default: withCtx(() => [
|
||||
createElementVNode(`div`, k, [
|
||||
createElementVNode(
|
||||
`div`,
|
||||
A,
|
||||
toDisplayString(t.title),
|
||||
1,
|
||||
),
|
||||
createElementVNode(
|
||||
`div`,
|
||||
j,
|
||||
toDisplayString(
|
||||
(`formatDate` in n
|
||||
? n.formatDate
|
||||
: unref(dict_n))(
|
||||
t.last_reply_time ||
|
||||
t.post_time,
|
||||
),
|
||||
),
|
||||
1,
|
||||
),
|
||||
]),
|
||||
createElementVNode(
|
||||
`span`,
|
||||
{
|
||||
class: `ticket-status`,
|
||||
style: normalizeStyle({
|
||||
background:
|
||||
t.color ||
|
||||
`var(--p-text-muted-color)`,
|
||||
}),
|
||||
},
|
||||
toDisplayString(t.status),
|
||||
5,
|
||||
),
|
||||
]),
|
||||
_: 2,
|
||||
},
|
||||
1032,
|
||||
[`to`],
|
||||
)
|
||||
),
|
||||
),
|
||||
128,
|
||||
)),
|
||||
],
|
||||
8,
|
||||
O,
|
||||
))
|
||||
: (openBlock(),
|
||||
createBlock(
|
||||
L,
|
||||
{
|
||||
key: 3,
|
||||
icon: `pi pi-inbox`,
|
||||
title: `暂无工单`,
|
||||
description: `有问题随时提交工单,我们会尽快处理`,
|
||||
},
|
||||
{
|
||||
default: withCtx(() => [
|
||||
createVNode(
|
||||
a,
|
||||
{
|
||||
to: `/tickets/create`,
|
||||
class: `home-button`,
|
||||
},
|
||||
{
|
||||
default: withCtx(() => [
|
||||
...(r[2] ||= [
|
||||
createElementVNode(
|
||||
`i`,
|
||||
{
|
||||
class: `pi pi-plus`,
|
||||
"aria-hidden": `true`,
|
||||
},
|
||||
null,
|
||||
-1,
|
||||
),
|
||||
createTextVNode(`创建工单`, -1),
|
||||
]),
|
||||
]),
|
||||
_: 1,
|
||||
},
|
||||
),
|
||||
]),
|
||||
_: 1,
|
||||
},
|
||||
)),
|
||||
unref(N).length || (unref(P) && !unref(F))
|
||||
? (openBlock(),
|
||||
createElementBlock(`div`, M, [
|
||||
createVNode(
|
||||
a,
|
||||
{
|
||||
to: `/tickets`,
|
||||
class: `home-button secondary`,
|
||||
},
|
||||
{
|
||||
default: withCtx(() => [
|
||||
...(r[3] ||= [createTextVNode(`查看全部`, -1)]),
|
||||
]),
|
||||
_: 1,
|
||||
},
|
||||
),
|
||||
createVNode(
|
||||
a,
|
||||
{
|
||||
to: `/tickets/create`,
|
||||
class: `home-button`,
|
||||
},
|
||||
{
|
||||
default: withCtx(() => [
|
||||
...(r[4] ||= [
|
||||
createElementVNode(
|
||||
`i`,
|
||||
{
|
||||
class: `pi pi-plus`,
|
||||
"aria-hidden": `true`,
|
||||
},
|
||||
null,
|
||||
-1,
|
||||
),
|
||||
createTextVNode(`创建工单`, -1),
|
||||
]),
|
||||
]),
|
||||
_: 1,
|
||||
},
|
||||
),
|
||||
]))
|
||||
: createCommentVNode(``, !0),
|
||||
],
|
||||
8,
|
||||
T,
|
||||
)
|
||||
);
|
||||
}
|
||||
);
|
||||
},
|
||||
}),
|
||||
[[`__scopeId`, `data-v-bacdfa58`]],
|
||||
),
|
||||
{
|
||||
__name: `HomeTicketPanel`,
|
||||
},
|
||||
);
|
||||
export {};
|
||||
export default N;
|
||||
</script>
|
||||
@@ -0,0 +1,197 @@
|
||||
<script>
|
||||
import "~/assets/styles/HomeTicketStat.C4kzybrY.css";
|
||||
import { toDisplayString } from "vue";
|
||||
import { renderList } from "vue";
|
||||
import { onMounted } from "vue";
|
||||
import { createBlock } from "vue";
|
||||
import { ref } from "vue";
|
||||
import { withCtx } from "vue";
|
||||
import { computed } from "vue";
|
||||
import { createElementBlock } from "vue";
|
||||
import { Fragment } from "vue";
|
||||
import { createElementVNode } from "vue";
|
||||
import { createTextVNode } from "vue";
|
||||
import { unref } from "vue";
|
||||
import { defineComponent } from "vue";
|
||||
import { createVNode } from "vue";
|
||||
import { openBlock } from "vue";
|
||||
import { normalizeStyle } from "vue";
|
||||
import { NuxtLink } from "#components";
|
||||
import { useApi } from "~/lib/auth.js";
|
||||
import { t as _plugin_vue_export_helper_t } from "~/lib/_plugin-vue_export-helper.js";
|
||||
import ListEmpty from "~/components/ListEmpty.vue";
|
||||
import skeleton from "primevue/skeleton";
|
||||
var x = {
|
||||
class: `home-card`,
|
||||
},
|
||||
S = {
|
||||
class: `home-card-head`,
|
||||
},
|
||||
C = {
|
||||
key: 0,
|
||||
class: `home-card-body`,
|
||||
},
|
||||
w = {
|
||||
key: 3,
|
||||
class: `stat-grid`,
|
||||
},
|
||||
T = {
|
||||
class: `stat-num`,
|
||||
},
|
||||
E = {
|
||||
class: `stat-name`,
|
||||
},
|
||||
D = Object.assign(
|
||||
_plugin_vue_export_helper_t(
|
||||
defineComponent({
|
||||
__name: `HomeTicketStat`,
|
||||
setup(f) {
|
||||
let v = useApi(),
|
||||
D = ref([]),
|
||||
O = ref({}),
|
||||
k = ref(!0),
|
||||
A = ref(``);
|
||||
onMounted(async () => {
|
||||
try {
|
||||
let [e, t] = await Promise.all([
|
||||
v.get(`/ticket/status`),
|
||||
v.get(`/ticket/statistic`),
|
||||
]);
|
||||
((D.value = e.list ?? []), (O.value = t ?? {}));
|
||||
} catch (e) {
|
||||
A.value = e instanceof Error ? e.message : `工单统计加载失败`;
|
||||
} finally {
|
||||
k.value = !1;
|
||||
}
|
||||
});
|
||||
let j = computed(() =>
|
||||
D.value
|
||||
.filter((e) => O.value[e.id] !== void 0)
|
||||
.map((e) => ({
|
||||
...e,
|
||||
count: O.value[e.id] ?? 0,
|
||||
})),
|
||||
);
|
||||
return (n, i) => {
|
||||
let o = NuxtLink,
|
||||
f = skeleton,
|
||||
_ = ListEmpty;
|
||||
return (
|
||||
openBlock(),
|
||||
createElementBlock(`div`, x, [
|
||||
createElementVNode(`div`, S, [
|
||||
(i[1] ||= createElementVNode(
|
||||
`div`,
|
||||
{
|
||||
class: `home-card-title`,
|
||||
},
|
||||
[
|
||||
createElementVNode(`i`, {
|
||||
class: `pi pi-chart-bar`,
|
||||
}),
|
||||
createTextVNode(`工单状态`),
|
||||
],
|
||||
-1,
|
||||
)),
|
||||
createVNode(
|
||||
o,
|
||||
{
|
||||
to: `/tickets`,
|
||||
class: `home-card-more`,
|
||||
},
|
||||
{
|
||||
default: withCtx(() => [
|
||||
...(i[0] ||= [createTextVNode(`全部 ›`, -1)]),
|
||||
]),
|
||||
_: 1,
|
||||
},
|
||||
),
|
||||
]),
|
||||
unref(k)
|
||||
? (openBlock(),
|
||||
createElementBlock(`div`, C, [
|
||||
createVNode(f, {
|
||||
height: `56px`,
|
||||
}),
|
||||
]))
|
||||
: unref(A)
|
||||
? (openBlock(),
|
||||
createBlock(
|
||||
_,
|
||||
{
|
||||
key: 1,
|
||||
icon: `pi pi-exclamation-circle`,
|
||||
title: `统计加载失败`,
|
||||
description: unref(A),
|
||||
},
|
||||
null,
|
||||
8,
|
||||
[`description`],
|
||||
))
|
||||
: unref(j).length
|
||||
? (openBlock(),
|
||||
createElementBlock(`div`, w, [
|
||||
(openBlock(!0),
|
||||
createElementBlock(
|
||||
Fragment,
|
||||
null,
|
||||
renderList(
|
||||
unref(j),
|
||||
(t) => (
|
||||
openBlock(),
|
||||
createBlock(
|
||||
o,
|
||||
{
|
||||
key: t.id,
|
||||
to: `/tickets?status=${t.id}`,
|
||||
class: `stat-chip`,
|
||||
style: normalizeStyle({
|
||||
borderLeftColor: t.color,
|
||||
}),
|
||||
},
|
||||
{
|
||||
default: withCtx(() => [
|
||||
createElementVNode(
|
||||
`span`,
|
||||
T,
|
||||
toDisplayString(t.count),
|
||||
1,
|
||||
),
|
||||
createElementVNode(
|
||||
`span`,
|
||||
E,
|
||||
toDisplayString(t.name),
|
||||
1,
|
||||
),
|
||||
]),
|
||||
_: 2,
|
||||
},
|
||||
1032,
|
||||
[`to`, `style`],
|
||||
)
|
||||
),
|
||||
),
|
||||
128,
|
||||
)),
|
||||
]))
|
||||
: (openBlock(),
|
||||
createBlock(_, {
|
||||
key: 2,
|
||||
icon: `pi pi-inbox`,
|
||||
title: `暂无工单`,
|
||||
description: `提交工单后可在这里跟踪进度`,
|
||||
})),
|
||||
])
|
||||
);
|
||||
};
|
||||
},
|
||||
}),
|
||||
[[`__scopeId`, `data-v-6971a1b9`]],
|
||||
),
|
||||
{
|
||||
__name: `HomeTicketStat`,
|
||||
},
|
||||
);
|
||||
export {};
|
||||
export default D;
|
||||
</script>
|
||||
@@ -0,0 +1,206 @@
|
||||
<script>
|
||||
import "~/assets/styles/WithdrawDialog.ks0wdKEK.css";
|
||||
import "~/assets/styles/PaymentDialog.BNFKQF1U.css";
|
||||
import "~/assets/styles/RechargeDialog.DpsMly4r.css";
|
||||
import "~/assets/styles/HomeWalletCard.C5SHzGlJ.css";
|
||||
import { toDisplayString } from "vue";
|
||||
import { onMounted } from "vue";
|
||||
import { normalizeClass } from "vue";
|
||||
import { createBlock } from "vue";
|
||||
import { ref } from "vue";
|
||||
import { withCtx } from "vue";
|
||||
import { createCommentVNode } from "vue";
|
||||
import { isRef } from "vue";
|
||||
import { createElementBlock } from "vue";
|
||||
import { createElementVNode } from "vue";
|
||||
import { unref } from "vue";
|
||||
import { defineComponent } from "vue";
|
||||
import { createVNode } from "vue";
|
||||
import { openBlock } from "vue";
|
||||
import { NuxtLink } from "#components";
|
||||
import { useAuth } from "~/lib/auth.js";
|
||||
import { t as useSiteConfig_t } from "~/lib/useSiteConfig.js";
|
||||
import button from "primevue/button";
|
||||
import { t as _plugin_vue_export_helper_t } from "~/lib/_plugin-vue_export-helper.js";
|
||||
import skeleton from "primevue/skeleton";
|
||||
import RechargeDialog from "~/components/RechargeDialog.vue";
|
||||
import WithdrawDialog from "~/components/WithdrawDialog.vue";
|
||||
import { t as useWithdrawAvailability_t } from "~/lib/useWithdrawAvailability.js";
|
||||
var C = {
|
||||
class: `home-card`,
|
||||
},
|
||||
w = {
|
||||
class: `home-card-head`,
|
||||
},
|
||||
T = {
|
||||
class: `home-card-body wallet-body`,
|
||||
},
|
||||
E = {
|
||||
class: `balance-value`,
|
||||
},
|
||||
D = {
|
||||
key: 0,
|
||||
},
|
||||
O = {
|
||||
key: 1,
|
||||
},
|
||||
k = Object.assign(
|
||||
_plugin_vue_export_helper_t(
|
||||
defineComponent({
|
||||
__name: `HomeWalletCard`,
|
||||
setup(d) {
|
||||
let v = useAuth(),
|
||||
{ rechargeClosed: k, load: A } = useSiteConfig_t(),
|
||||
{ enabled: j, load: M } = useWithdrawAvailability_t(),
|
||||
N = ref(!1),
|
||||
P = ref(!1);
|
||||
onMounted(() => {
|
||||
(A().catch(() => {}), M());
|
||||
});
|
||||
async function F() {
|
||||
await v.refreshOverview().catch(() => {});
|
||||
}
|
||||
return (t, i) => {
|
||||
let d = NuxtLink,
|
||||
h = skeleton,
|
||||
g = button,
|
||||
S = RechargeDialog,
|
||||
A = WithdrawDialog;
|
||||
return (
|
||||
openBlock(),
|
||||
createElementBlock(`div`, C, [
|
||||
createElementVNode(`div`, w, [
|
||||
(i[5] ||= createElementVNode(
|
||||
`div`,
|
||||
{
|
||||
class: `home-card-title`,
|
||||
},
|
||||
`钱包`,
|
||||
-1,
|
||||
)),
|
||||
createVNode(
|
||||
d,
|
||||
{
|
||||
to: `/finance`,
|
||||
class: `home-card-more`,
|
||||
"aria-label": `钱包明细`,
|
||||
},
|
||||
{
|
||||
default: withCtx(() => [
|
||||
...(i[4] ||= [
|
||||
createElementVNode(
|
||||
`i`,
|
||||
{
|
||||
class: `pi pi-angle-right`,
|
||||
},
|
||||
null,
|
||||
-1,
|
||||
),
|
||||
]),
|
||||
]),
|
||||
_: 1,
|
||||
},
|
||||
),
|
||||
]),
|
||||
createElementVNode(`div`, T, [
|
||||
(i[6] ||= createElementVNode(
|
||||
`div`,
|
||||
{
|
||||
class: `balance-label`,
|
||||
},
|
||||
`可用余额`,
|
||||
-1,
|
||||
)),
|
||||
createElementVNode(`div`, E, [
|
||||
unref(v).overview
|
||||
? (openBlock(),
|
||||
createElementBlock(
|
||||
`span`,
|
||||
O,
|
||||
`¥` + toDisplayString(unref(v).overview.credit),
|
||||
1,
|
||||
))
|
||||
: (openBlock(),
|
||||
createElementBlock(`span`, D, [
|
||||
createVNode(h, {
|
||||
width: `90px`,
|
||||
height: `28px`,
|
||||
}),
|
||||
])),
|
||||
]),
|
||||
createElementVNode(
|
||||
`div`,
|
||||
{
|
||||
class: normalizeClass([
|
||||
`wallet-actions`,
|
||||
{
|
||||
"wallet-actions-single": !unref(j),
|
||||
},
|
||||
]),
|
||||
},
|
||||
[
|
||||
unref(j)
|
||||
? (openBlock(),
|
||||
createBlock(g, {
|
||||
key: 0,
|
||||
label: `提现`,
|
||||
severity: `secondary`,
|
||||
outlined: ``,
|
||||
onClick: (i[0] ||= (e) => (P.value = !0)),
|
||||
}))
|
||||
: createCommentVNode(``, !0),
|
||||
createVNode(
|
||||
g,
|
||||
{
|
||||
label: `充值`,
|
||||
icon: `pi pi-plus`,
|
||||
disabled: unref(k),
|
||||
title: unref(k) ? `站点已关闭充值` : void 0,
|
||||
onClick: (i[1] ||= (e) => (N.value = !0)),
|
||||
},
|
||||
null,
|
||||
8,
|
||||
[`disabled`, `title`],
|
||||
),
|
||||
],
|
||||
2,
|
||||
),
|
||||
]),
|
||||
createVNode(
|
||||
S,
|
||||
{
|
||||
modelValue: unref(N),
|
||||
"onUpdate:modelValue": (i[2] ||= (e) =>
|
||||
isRef(N) ? (N.value = e) : null),
|
||||
onSuccess: F,
|
||||
},
|
||||
null,
|
||||
8,
|
||||
[`modelValue`],
|
||||
),
|
||||
createVNode(
|
||||
A,
|
||||
{
|
||||
modelValue: unref(P),
|
||||
"onUpdate:modelValue": (i[3] ||= (e) =>
|
||||
isRef(P) ? (P.value = e) : null),
|
||||
onSuccess: F,
|
||||
},
|
||||
null,
|
||||
8,
|
||||
[`modelValue`],
|
||||
),
|
||||
])
|
||||
);
|
||||
};
|
||||
},
|
||||
}),
|
||||
[[`__scopeId`, `data-v-0dbd1f86`]],
|
||||
),
|
||||
{
|
||||
__name: `HomeWalletCard`,
|
||||
},
|
||||
);
|
||||
export {};
|
||||
export default k;
|
||||
</script>
|
||||
@@ -0,0 +1,36 @@
|
||||
<script>
|
||||
import "~/assets/styles/RoxyMascot.CDqPSf2d.css";
|
||||
import { createStaticVNode } from "vue";
|
||||
import { createElementBlock } from "vue";
|
||||
import { openBlock } from "vue";
|
||||
import { t as _plugin_vue_export_helper_t } from "~/lib/_plugin-vue_export-helper.js";
|
||||
var i = {},
|
||||
a = {
|
||||
class: `roxy-mascot`,
|
||||
"aria-hidden": `true`,
|
||||
};
|
||||
function o(r, i) {
|
||||
return (
|
||||
openBlock(),
|
||||
createElementBlock(`div`, a, [
|
||||
...(i[0] ||= [
|
||||
createStaticVNode(
|
||||
`<div class="roxy-shadow" data-v-65169a82></div><div class="roxy-staff" data-v-65169a82><span class="staff-ring" data-v-65169a82><i data-v-65169a82></i></span></div><div class="roxy-leg leg-back" data-v-65169a82><i data-v-65169a82></i></div><div class="roxy-leg leg-front" data-v-65169a82><i data-v-65169a82></i></div><div class="roxy-body" data-v-65169a82><span class="cape-fold" data-v-65169a82></span><span class="cape-hem" data-v-65169a82></span></div><div class="roxy-sleeve sleeve-left" data-v-65169a82></div><div class="roxy-sleeve sleeve-right" data-v-65169a82></div><div class="roxy-head" data-v-65169a82><div class="hair-back" data-v-65169a82></div><div class="roxy-ear ear-left" data-v-65169a82></div><div class="roxy-ear ear-right" data-v-65169a82></div><div class="roxy-face" data-v-65169a82><span class="roxy-brow brow-left" data-v-65169a82></span><span class="roxy-brow brow-right" data-v-65169a82></span><span class="roxy-eye eye-left" data-v-65169a82><i data-v-65169a82></i></span><span class="roxy-eye eye-right" data-v-65169a82><i data-v-65169a82></i></span><span class="roxy-cheek cheek-left" data-v-65169a82></span><span class="roxy-cheek cheek-right" data-v-65169a82></span><span class="roxy-nose" data-v-65169a82></span><span class="roxy-mouth" data-v-65169a82></span></div><div class="roxy-fringe fringe-left" data-v-65169a82></div><div class="roxy-fringe fringe-middle" data-v-65169a82></div><div class="roxy-fringe fringe-right" data-v-65169a82></div><div class="roxy-braid braid-left" data-v-65169a82><i data-v-65169a82></i><i data-v-65169a82></i><i data-v-65169a82></i><i data-v-65169a82></i><span class="hair-tie" data-v-65169a82></span></div><div class="roxy-braid braid-right" data-v-65169a82><i data-v-65169a82></i><i data-v-65169a82></i><i data-v-65169a82></i><i data-v-65169a82></i><span class="hair-tie" data-v-65169a82></span></div><div class="roxy-hat" data-v-65169a82><div class="hat-cone" data-v-65169a82><span class="hat-seam" data-v-65169a82></span></div><div class="hat-band" data-v-65169a82></div><div class="hat-brim" data-v-65169a82></div><span class="hat-buckle" data-v-65169a82></span></div></div><div class="roxy-hand hand-left" data-v-65169a82><i data-v-65169a82></i></div><div class="roxy-hand hand-right" data-v-65169a82><i data-v-65169a82></i></div>`,
|
||||
10,
|
||||
),
|
||||
]),
|
||||
])
|
||||
);
|
||||
}
|
||||
var s = Object.assign(
|
||||
_plugin_vue_export_helper_t(i, [
|
||||
[`render`, o],
|
||||
[`__scopeId`, `data-v-65169a82`],
|
||||
]),
|
||||
{
|
||||
__name: `RoxyMascot`,
|
||||
},
|
||||
);
|
||||
export {};
|
||||
export default s;
|
||||
</script>
|
||||
Reference in new issue
Block a user