feat(api): 添加多路由代理处理实现
- 新增api目录下多个接口路径代理处理文件,支持动态拼接目标URL - 根据环境变量选择不同的后端服务地址(如dev和生产环境) - 统一添加TenantId和Authorization请求头传递租户及身份信息 - 实现请求参数及搜索参数的完整转发 - 引入better-sqlite3及node内建模块支持服务端功能 - 新增专家详情页面,实现文章、成果及预约咨询功能展示 - 页面实现加载骨架屏、标签页切换及空状态提示优化体验
This commit is contained in:
659
.output/server/chunks/build/articles-CkRo2zT3.mjs
Normal file
659
.output/server/chunks/build/articles-CkRo2zT3.mjs
Normal file
@@ -0,0 +1,659 @@
|
||||
import { defineComponent, computed, ref, resolveComponent, mergeProps, withCtx, unref, isRef, createTextVNode, createVNode, createBlock, createCommentVNode, toDisplayString, openBlock, toValue, getCurrentInstance, onServerPrefetch, shallowRef, toRef, nextTick, useSSRContext } from 'vue';
|
||||
import { ssrRenderAttrs, ssrRenderComponent, ssrInterpolate } from 'vue/server-renderer';
|
||||
import { p as pageAppArticle } from './index-DLTWNMRy.mjs';
|
||||
import { s as setToken } from './token-util-C_wOpB5F.mjs';
|
||||
import { g as useRuntimeConfig, h as useNuxtApp, i as asyncDataDefaults, j as createError } from './server.mjs';
|
||||
import { debounce } from 'perfect-debounce';
|
||||
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 'ant-design-vue';
|
||||
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';
|
||||
|
||||
function useAsyncData(...args) {
|
||||
const autoKey = typeof args[args.length - 1] === "string" ? args.pop() : void 0;
|
||||
if (_isAutoKeyNeeded(args[0], args[1])) {
|
||||
args.unshift(autoKey);
|
||||
}
|
||||
let [_key, _handler, options = {}] = args;
|
||||
const key = computed(() => toValue(_key));
|
||||
if (typeof key.value !== "string") {
|
||||
throw new TypeError("[nuxt] [useAsyncData] key must be a string.");
|
||||
}
|
||||
if (typeof _handler !== "function") {
|
||||
throw new TypeError("[nuxt] [useAsyncData] handler must be a function.");
|
||||
}
|
||||
const nuxtApp = useNuxtApp();
|
||||
options.server ??= true;
|
||||
options.default ??= getDefault;
|
||||
options.getCachedData ??= getDefaultCachedData;
|
||||
options.lazy ??= false;
|
||||
options.immediate ??= true;
|
||||
options.deep ??= asyncDataDefaults.deep;
|
||||
options.dedupe ??= "cancel";
|
||||
options._functionName || "useAsyncData";
|
||||
nuxtApp._asyncData[key.value];
|
||||
function createInitialFetch() {
|
||||
const initialFetchOptions = { cause: "initial", dedupe: options.dedupe };
|
||||
if (!nuxtApp._asyncData[key.value]?._init) {
|
||||
initialFetchOptions.cachedData = options.getCachedData(key.value, nuxtApp, { cause: "initial" });
|
||||
nuxtApp._asyncData[key.value] = createAsyncData(nuxtApp, key.value, _handler, options, initialFetchOptions.cachedData);
|
||||
}
|
||||
return () => nuxtApp._asyncData[key.value].execute(initialFetchOptions);
|
||||
}
|
||||
const initialFetch = createInitialFetch();
|
||||
const asyncData = nuxtApp._asyncData[key.value];
|
||||
asyncData._deps++;
|
||||
const fetchOnServer = options.server !== false && nuxtApp.payload.serverRendered;
|
||||
if (fetchOnServer && options.immediate) {
|
||||
const promise = initialFetch();
|
||||
if (getCurrentInstance()) {
|
||||
onServerPrefetch(() => promise);
|
||||
} else {
|
||||
nuxtApp.hook("app:created", async () => {
|
||||
await promise;
|
||||
});
|
||||
}
|
||||
}
|
||||
const asyncReturn = {
|
||||
data: writableComputedRef(() => nuxtApp._asyncData[key.value]?.data),
|
||||
pending: writableComputedRef(() => nuxtApp._asyncData[key.value]?.pending),
|
||||
status: writableComputedRef(() => nuxtApp._asyncData[key.value]?.status),
|
||||
error: writableComputedRef(() => nuxtApp._asyncData[key.value]?.error),
|
||||
refresh: (...args2) => {
|
||||
if (!nuxtApp._asyncData[key.value]?._init) {
|
||||
const initialFetch2 = createInitialFetch();
|
||||
return initialFetch2();
|
||||
}
|
||||
return nuxtApp._asyncData[key.value].execute(...args2);
|
||||
},
|
||||
execute: (...args2) => asyncReturn.refresh(...args2),
|
||||
clear: () => {
|
||||
const entry = nuxtApp._asyncData[key.value];
|
||||
if (entry?._abortController) {
|
||||
try {
|
||||
entry._abortController.abort(new DOMException("AsyncData aborted by user.", "AbortError"));
|
||||
} finally {
|
||||
entry._abortController = void 0;
|
||||
}
|
||||
}
|
||||
clearNuxtDataByKey(nuxtApp, key.value);
|
||||
}
|
||||
};
|
||||
const asyncDataPromise = Promise.resolve(nuxtApp._asyncDataPromises[key.value]).then(() => asyncReturn);
|
||||
Object.assign(asyncDataPromise, asyncReturn);
|
||||
return asyncDataPromise;
|
||||
}
|
||||
function writableComputedRef(getter) {
|
||||
return computed({
|
||||
get() {
|
||||
return getter()?.value;
|
||||
},
|
||||
set(value) {
|
||||
const ref2 = getter();
|
||||
if (ref2) {
|
||||
ref2.value = value;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
function _isAutoKeyNeeded(keyOrFetcher, fetcher) {
|
||||
if (typeof keyOrFetcher === "string") {
|
||||
return false;
|
||||
}
|
||||
if (typeof keyOrFetcher === "object" && keyOrFetcher !== null) {
|
||||
return false;
|
||||
}
|
||||
if (typeof keyOrFetcher === "function" && typeof fetcher === "function") {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function clearNuxtDataByKey(nuxtApp, key) {
|
||||
if (key in nuxtApp.payload.data) {
|
||||
nuxtApp.payload.data[key] = void 0;
|
||||
}
|
||||
if (key in nuxtApp.payload._errors) {
|
||||
nuxtApp.payload._errors[key] = void 0;
|
||||
}
|
||||
if (nuxtApp._asyncData[key]) {
|
||||
nuxtApp._asyncData[key].data.value = unref(nuxtApp._asyncData[key]._default());
|
||||
nuxtApp._asyncData[key].error.value = void 0;
|
||||
nuxtApp._asyncData[key].status.value = "idle";
|
||||
}
|
||||
if (key in nuxtApp._asyncDataPromises) {
|
||||
nuxtApp._asyncDataPromises[key] = void 0;
|
||||
}
|
||||
}
|
||||
function pick(obj, keys) {
|
||||
const newObj = {};
|
||||
for (const key of keys) {
|
||||
newObj[key] = obj[key];
|
||||
}
|
||||
return newObj;
|
||||
}
|
||||
function createAsyncData(nuxtApp, key, _handler, options, initialCachedData) {
|
||||
nuxtApp.payload._errors[key] ??= void 0;
|
||||
const hasCustomGetCachedData = options.getCachedData !== getDefaultCachedData;
|
||||
const handler = _handler ;
|
||||
const _ref = options.deep ? ref : shallowRef;
|
||||
const hasCachedData = initialCachedData !== void 0;
|
||||
const unsubRefreshAsyncData = nuxtApp.hook("app:data:refresh", async (keys) => {
|
||||
if (!keys || keys.includes(key)) {
|
||||
await asyncData.execute({ cause: "refresh:hook" });
|
||||
}
|
||||
});
|
||||
const asyncData = {
|
||||
data: _ref(hasCachedData ? initialCachedData : options.default()),
|
||||
pending: computed(() => asyncData.status.value === "pending"),
|
||||
error: toRef(nuxtApp.payload._errors, key),
|
||||
status: shallowRef("idle"),
|
||||
execute: (...args) => {
|
||||
const [_opts, newValue = void 0] = args;
|
||||
const opts = _opts && newValue === void 0 && typeof _opts === "object" ? _opts : {};
|
||||
if (nuxtApp._asyncDataPromises[key]) {
|
||||
if ((opts.dedupe ?? options.dedupe) === "defer") {
|
||||
return nuxtApp._asyncDataPromises[key];
|
||||
}
|
||||
}
|
||||
{
|
||||
const cachedData = "cachedData" in opts ? opts.cachedData : options.getCachedData(key, nuxtApp, { cause: opts.cause ?? "refresh:manual" });
|
||||
if (cachedData !== void 0) {
|
||||
nuxtApp.payload.data[key] = asyncData.data.value = cachedData;
|
||||
asyncData.error.value = void 0;
|
||||
asyncData.status.value = "success";
|
||||
return Promise.resolve(cachedData);
|
||||
}
|
||||
}
|
||||
if (asyncData._abortController) {
|
||||
asyncData._abortController.abort(new DOMException("AsyncData request cancelled by deduplication", "AbortError"));
|
||||
}
|
||||
asyncData._abortController = new AbortController();
|
||||
asyncData.status.value = "pending";
|
||||
const cleanupController = new AbortController();
|
||||
const promise = new Promise(
|
||||
(resolve, reject) => {
|
||||
try {
|
||||
const timeout = opts.timeout ?? options.timeout;
|
||||
const mergedSignal = mergeAbortSignals([asyncData._abortController?.signal, opts?.signal], cleanupController.signal, timeout);
|
||||
if (mergedSignal.aborted) {
|
||||
const reason = mergedSignal.reason;
|
||||
reject(reason instanceof Error ? reason : new DOMException(String(reason ?? "Aborted"), "AbortError"));
|
||||
return;
|
||||
}
|
||||
mergedSignal.addEventListener("abort", () => {
|
||||
const reason = mergedSignal.reason;
|
||||
reject(reason instanceof Error ? reason : new DOMException(String(reason ?? "Aborted"), "AbortError"));
|
||||
}, { once: true, signal: cleanupController.signal });
|
||||
return Promise.resolve(handler(nuxtApp, { signal: mergedSignal })).then(resolve, reject);
|
||||
} catch (err) {
|
||||
reject(err);
|
||||
}
|
||||
}
|
||||
).then(async (_result) => {
|
||||
let result = _result;
|
||||
if (options.transform) {
|
||||
result = await options.transform(_result);
|
||||
}
|
||||
if (options.pick) {
|
||||
result = pick(result, options.pick);
|
||||
}
|
||||
nuxtApp.payload.data[key] = result;
|
||||
asyncData.data.value = result;
|
||||
asyncData.error.value = void 0;
|
||||
asyncData.status.value = "success";
|
||||
}).catch((error) => {
|
||||
if (nuxtApp._asyncDataPromises[key] && nuxtApp._asyncDataPromises[key] !== promise) {
|
||||
return nuxtApp._asyncDataPromises[key];
|
||||
}
|
||||
if (asyncData._abortController?.signal.aborted) {
|
||||
return nuxtApp._asyncDataPromises[key];
|
||||
}
|
||||
if (typeof DOMException !== "undefined" && error instanceof DOMException && error.name === "AbortError") {
|
||||
asyncData.status.value = "idle";
|
||||
return nuxtApp._asyncDataPromises[key];
|
||||
}
|
||||
asyncData.error.value = createError(error);
|
||||
asyncData.data.value = unref(options.default());
|
||||
asyncData.status.value = "error";
|
||||
}).finally(() => {
|
||||
cleanupController.abort();
|
||||
delete nuxtApp._asyncDataPromises[key];
|
||||
});
|
||||
nuxtApp._asyncDataPromises[key] = promise;
|
||||
return nuxtApp._asyncDataPromises[key];
|
||||
},
|
||||
_execute: debounce((...args) => asyncData.execute(...args), 0, { leading: true }),
|
||||
_default: options.default,
|
||||
_deps: 0,
|
||||
_init: true,
|
||||
_hash: void 0,
|
||||
_off: () => {
|
||||
unsubRefreshAsyncData();
|
||||
if (nuxtApp._asyncData[key]?._init) {
|
||||
nuxtApp._asyncData[key]._init = false;
|
||||
}
|
||||
if (!hasCustomGetCachedData) {
|
||||
nextTick(() => {
|
||||
if (!nuxtApp._asyncData[key]?._init) {
|
||||
clearNuxtDataByKey(nuxtApp, key);
|
||||
asyncData.execute = () => Promise.resolve();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
return asyncData;
|
||||
}
|
||||
const getDefault = () => void 0;
|
||||
const getDefaultCachedData = (key, nuxtApp, ctx) => {
|
||||
if (nuxtApp.isHydrating) {
|
||||
return nuxtApp.payload.data[key];
|
||||
}
|
||||
if (ctx.cause !== "refresh:manual" && ctx.cause !== "refresh:hook") {
|
||||
return nuxtApp.static.data[key];
|
||||
}
|
||||
};
|
||||
function mergeAbortSignals(signals, cleanupSignal, timeout) {
|
||||
const list = signals.filter((s) => !!s);
|
||||
if (typeof timeout === "number" && timeout >= 0) {
|
||||
const timeoutSignal = AbortSignal.timeout?.(timeout);
|
||||
if (timeoutSignal) {
|
||||
list.push(timeoutSignal);
|
||||
}
|
||||
}
|
||||
if (AbortSignal.any) {
|
||||
return AbortSignal.any(list);
|
||||
}
|
||||
const controller = new AbortController();
|
||||
for (const sig of list) {
|
||||
if (sig.aborted) {
|
||||
const reason = sig.reason ?? new DOMException("Aborted", "AbortError");
|
||||
try {
|
||||
controller.abort(reason);
|
||||
} catch {
|
||||
controller.abort();
|
||||
}
|
||||
return controller.signal;
|
||||
}
|
||||
}
|
||||
const onAbort = () => {
|
||||
const abortedSignal = list.find((s) => s.aborted);
|
||||
const reason = abortedSignal?.reason ?? new DOMException("Aborted", "AbortError");
|
||||
try {
|
||||
controller.abort(reason);
|
||||
} catch {
|
||||
controller.abort();
|
||||
}
|
||||
};
|
||||
for (const sig of list) {
|
||||
sig.addEventListener?.("abort", onAbort, { once: true, signal: cleanupSignal });
|
||||
}
|
||||
return controller.signal;
|
||||
}
|
||||
const _sfc_main = /* @__PURE__ */ defineComponent({
|
||||
__name: "articles",
|
||||
__ssrInlineRender: true,
|
||||
setup(__props) {
|
||||
const config = useRuntimeConfig();
|
||||
const tenantId = computed(() => String(config.public.tenantId));
|
||||
const page = ref(1);
|
||||
const limit = ref(10);
|
||||
const keywords = ref("");
|
||||
const token = ref("");
|
||||
const { data, pending, error, refresh } = useAsyncData(
|
||||
"app-article-page",
|
||||
() => pageAppArticle({
|
||||
page: page.value,
|
||||
limit: limit.value,
|
||||
keywords: keywords.value || void 0
|
||||
}),
|
||||
{ server: false }
|
||||
);
|
||||
const list = computed(() => data.value?.list ?? []);
|
||||
const total = computed(() => data.value?.count ?? 0);
|
||||
function applyToken() {
|
||||
setToken(token.value);
|
||||
refresh();
|
||||
}
|
||||
function clearToken() {
|
||||
token.value = "";
|
||||
refresh();
|
||||
}
|
||||
function doSearch() {
|
||||
page.value = 1;
|
||||
refresh();
|
||||
}
|
||||
function onPageChange(nextPage) {
|
||||
page.value = nextPage;
|
||||
refresh();
|
||||
}
|
||||
function onPageSizeChange(_current, nextSize) {
|
||||
limit.value = nextSize;
|
||||
page.value = 1;
|
||||
refresh();
|
||||
}
|
||||
return (_ctx, _push, _parent, _attrs) => {
|
||||
const _component_a_card = resolveComponent("a-card");
|
||||
const _component_a_input_password = resolveComponent("a-input-password");
|
||||
const _component_a_button = resolveComponent("a-button");
|
||||
const _component_a_input = resolveComponent("a-input");
|
||||
const _component_a_alert = resolveComponent("a-alert");
|
||||
const _component_a_table = resolveComponent("a-table");
|
||||
const _component_a_table_column = resolveComponent("a-table-column");
|
||||
const _component_a_pagination = resolveComponent("a-pagination");
|
||||
_push(`<main${ssrRenderAttrs(mergeProps({ class: "min-h-screen bg-gray-50 p-8" }, _attrs))}><div class="mx-auto max-w-5xl space-y-6">`);
|
||||
_push(ssrRenderComponent(_component_a_card, {
|
||||
title: "文章列表 (pageAppArticle)",
|
||||
class: "shadow-sm"
|
||||
}, {
|
||||
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
||||
if (_push2) {
|
||||
_push2(`<div class="flex flex-wrap items-center gap-3"${_scopeId}>`);
|
||||
_push2(ssrRenderComponent(_component_a_input_password, {
|
||||
value: unref(token),
|
||||
"onUpdate:value": ($event) => isRef(token) ? token.value = $event : null,
|
||||
placeholder: "Authorization (AccessToken)",
|
||||
class: "w-96"
|
||||
}, null, _parent2, _scopeId));
|
||||
_push2(ssrRenderComponent(_component_a_button, {
|
||||
disabled: unref(pending),
|
||||
onClick: applyToken
|
||||
}, {
|
||||
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
|
||||
if (_push3) {
|
||||
_push3(`设置Token`);
|
||||
} else {
|
||||
return [
|
||||
createTextVNode("设置Token")
|
||||
];
|
||||
}
|
||||
}),
|
||||
_: 1
|
||||
}, _parent2, _scopeId));
|
||||
_push2(ssrRenderComponent(_component_a_button, {
|
||||
disabled: unref(pending),
|
||||
danger: "",
|
||||
onClick: clearToken
|
||||
}, {
|
||||
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
|
||||
if (_push3) {
|
||||
_push3(`清除Token`);
|
||||
} else {
|
||||
return [
|
||||
createTextVNode("清除Token")
|
||||
];
|
||||
}
|
||||
}),
|
||||
_: 1
|
||||
}, _parent2, _scopeId));
|
||||
_push2(ssrRenderComponent(_component_a_input, {
|
||||
value: unref(keywords),
|
||||
"onUpdate:value": ($event) => isRef(keywords) ? keywords.value = $event : null,
|
||||
placeholder: "关键词 keywords",
|
||||
class: "w-72",
|
||||
onPressEnter: doSearch
|
||||
}, null, _parent2, _scopeId));
|
||||
_push2(ssrRenderComponent(_component_a_button, {
|
||||
type: "primary",
|
||||
loading: unref(pending),
|
||||
onClick: doSearch
|
||||
}, {
|
||||
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
|
||||
if (_push3) {
|
||||
_push3(`查询`);
|
||||
} else {
|
||||
return [
|
||||
createTextVNode("查询")
|
||||
];
|
||||
}
|
||||
}),
|
||||
_: 1
|
||||
}, _parent2, _scopeId));
|
||||
_push2(ssrRenderComponent(_component_a_button, {
|
||||
disabled: unref(pending),
|
||||
onClick: unref(refresh)
|
||||
}, {
|
||||
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
|
||||
if (_push3) {
|
||||
_push3(`刷新`);
|
||||
} else {
|
||||
return [
|
||||
createTextVNode("刷新")
|
||||
];
|
||||
}
|
||||
}),
|
||||
_: 1
|
||||
}, _parent2, _scopeId));
|
||||
_push2(`<div class="text-sm text-gray-500"${_scopeId}> TenantId: ${ssrInterpolate(unref(tenantId))}</div></div>`);
|
||||
if (unref(error)) {
|
||||
_push2(ssrRenderComponent(_component_a_alert, {
|
||||
class: "mt-4",
|
||||
"show-icon": "",
|
||||
type: "error",
|
||||
message: String(unref(error))
|
||||
}, null, _parent2, _scopeId));
|
||||
} else {
|
||||
_push2(`<!---->`);
|
||||
}
|
||||
_push2(ssrRenderComponent(_component_a_table, {
|
||||
class: "mt-4",
|
||||
"data-source": unref(list),
|
||||
loading: unref(pending),
|
||||
pagination: false,
|
||||
"row-key": "articleId",
|
||||
size: "middle"
|
||||
}, {
|
||||
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
|
||||
if (_push3) {
|
||||
_push3(ssrRenderComponent(_component_a_table_column, {
|
||||
title: "ID",
|
||||
"data-index": "articleId",
|
||||
width: "90"
|
||||
}, null, _parent3, _scopeId2));
|
||||
_push3(ssrRenderComponent(_component_a_table_column, {
|
||||
title: "标题",
|
||||
"data-index": "title"
|
||||
}, null, _parent3, _scopeId2));
|
||||
_push3(ssrRenderComponent(_component_a_table_column, {
|
||||
title: "编号",
|
||||
"data-index": "code",
|
||||
width: "220"
|
||||
}, null, _parent3, _scopeId2));
|
||||
_push3(ssrRenderComponent(_component_a_table_column, {
|
||||
title: "栏目",
|
||||
"data-index": "categoryName",
|
||||
width: "160"
|
||||
}, null, _parent3, _scopeId2));
|
||||
_push3(ssrRenderComponent(_component_a_table_column, {
|
||||
title: "创建时间",
|
||||
"data-index": "createTime",
|
||||
width: "180"
|
||||
}, null, _parent3, _scopeId2));
|
||||
} else {
|
||||
return [
|
||||
createVNode(_component_a_table_column, {
|
||||
title: "ID",
|
||||
"data-index": "articleId",
|
||||
width: "90"
|
||||
}),
|
||||
createVNode(_component_a_table_column, {
|
||||
title: "标题",
|
||||
"data-index": "title"
|
||||
}),
|
||||
createVNode(_component_a_table_column, {
|
||||
title: "编号",
|
||||
"data-index": "code",
|
||||
width: "220"
|
||||
}),
|
||||
createVNode(_component_a_table_column, {
|
||||
title: "栏目",
|
||||
"data-index": "categoryName",
|
||||
width: "160"
|
||||
}),
|
||||
createVNode(_component_a_table_column, {
|
||||
title: "创建时间",
|
||||
"data-index": "createTime",
|
||||
width: "180"
|
||||
})
|
||||
];
|
||||
}
|
||||
}),
|
||||
_: 1
|
||||
}, _parent2, _scopeId));
|
||||
_push2(`<div class="mt-4 flex items-center justify-end"${_scopeId}>`);
|
||||
_push2(ssrRenderComponent(_component_a_pagination, {
|
||||
current: unref(page),
|
||||
"page-size": unref(limit),
|
||||
total: unref(total),
|
||||
"show-size-changer": "",
|
||||
"page-size-options": ["10", "20", "50", "100"],
|
||||
onChange: onPageChange,
|
||||
onShowSizeChange: onPageSizeChange
|
||||
}, null, _parent2, _scopeId));
|
||||
_push2(`</div>`);
|
||||
} else {
|
||||
return [
|
||||
createVNode("div", { class: "flex flex-wrap items-center gap-3" }, [
|
||||
createVNode(_component_a_input_password, {
|
||||
value: unref(token),
|
||||
"onUpdate:value": ($event) => isRef(token) ? token.value = $event : null,
|
||||
placeholder: "Authorization (AccessToken)",
|
||||
class: "w-96"
|
||||
}, null, 8, ["value", "onUpdate:value"]),
|
||||
createVNode(_component_a_button, {
|
||||
disabled: unref(pending),
|
||||
onClick: applyToken
|
||||
}, {
|
||||
default: withCtx(() => [
|
||||
createTextVNode("设置Token")
|
||||
]),
|
||||
_: 1
|
||||
}, 8, ["disabled"]),
|
||||
createVNode(_component_a_button, {
|
||||
disabled: unref(pending),
|
||||
danger: "",
|
||||
onClick: clearToken
|
||||
}, {
|
||||
default: withCtx(() => [
|
||||
createTextVNode("清除Token")
|
||||
]),
|
||||
_: 1
|
||||
}, 8, ["disabled"]),
|
||||
createVNode(_component_a_input, {
|
||||
value: unref(keywords),
|
||||
"onUpdate:value": ($event) => isRef(keywords) ? keywords.value = $event : null,
|
||||
placeholder: "关键词 keywords",
|
||||
class: "w-72",
|
||||
onPressEnter: doSearch
|
||||
}, null, 8, ["value", "onUpdate:value"]),
|
||||
createVNode(_component_a_button, {
|
||||
type: "primary",
|
||||
loading: unref(pending),
|
||||
onClick: doSearch
|
||||
}, {
|
||||
default: withCtx(() => [
|
||||
createTextVNode("查询")
|
||||
]),
|
||||
_: 1
|
||||
}, 8, ["loading"]),
|
||||
createVNode(_component_a_button, {
|
||||
disabled: unref(pending),
|
||||
onClick: unref(refresh)
|
||||
}, {
|
||||
default: withCtx(() => [
|
||||
createTextVNode("刷新")
|
||||
]),
|
||||
_: 1
|
||||
}, 8, ["disabled", "onClick"]),
|
||||
createVNode("div", { class: "text-sm text-gray-500" }, " TenantId: " + toDisplayString(unref(tenantId)), 1)
|
||||
]),
|
||||
unref(error) ? (openBlock(), createBlock(_component_a_alert, {
|
||||
key: 0,
|
||||
class: "mt-4",
|
||||
"show-icon": "",
|
||||
type: "error",
|
||||
message: String(unref(error))
|
||||
}, null, 8, ["message"])) : createCommentVNode("", true),
|
||||
createVNode(_component_a_table, {
|
||||
class: "mt-4",
|
||||
"data-source": unref(list),
|
||||
loading: unref(pending),
|
||||
pagination: false,
|
||||
"row-key": "articleId",
|
||||
size: "middle"
|
||||
}, {
|
||||
default: withCtx(() => [
|
||||
createVNode(_component_a_table_column, {
|
||||
title: "ID",
|
||||
"data-index": "articleId",
|
||||
width: "90"
|
||||
}),
|
||||
createVNode(_component_a_table_column, {
|
||||
title: "标题",
|
||||
"data-index": "title"
|
||||
}),
|
||||
createVNode(_component_a_table_column, {
|
||||
title: "编号",
|
||||
"data-index": "code",
|
||||
width: "220"
|
||||
}),
|
||||
createVNode(_component_a_table_column, {
|
||||
title: "栏目",
|
||||
"data-index": "categoryName",
|
||||
width: "160"
|
||||
}),
|
||||
createVNode(_component_a_table_column, {
|
||||
title: "创建时间",
|
||||
"data-index": "createTime",
|
||||
width: "180"
|
||||
})
|
||||
]),
|
||||
_: 1
|
||||
}, 8, ["data-source", "loading"]),
|
||||
createVNode("div", { class: "mt-4 flex items-center justify-end" }, [
|
||||
createVNode(_component_a_pagination, {
|
||||
current: unref(page),
|
||||
"page-size": unref(limit),
|
||||
total: unref(total),
|
||||
"show-size-changer": "",
|
||||
"page-size-options": ["10", "20", "50", "100"],
|
||||
onChange: onPageChange,
|
||||
onShowSizeChange: onPageSizeChange
|
||||
}, null, 8, ["current", "page-size", "total"])
|
||||
])
|
||||
];
|
||||
}
|
||||
}),
|
||||
_: 1
|
||||
}, _parent));
|
||||
_push(`</div></main>`);
|
||||
};
|
||||
}
|
||||
});
|
||||
const _sfc_setup = _sfc_main.setup;
|
||||
_sfc_main.setup = (props, ctx) => {
|
||||
const ssrContext = useSSRContext();
|
||||
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("pages/articles.vue");
|
||||
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
|
||||
};
|
||||
|
||||
export { _sfc_main as default };
|
||||
//# sourceMappingURL=articles-CkRo2zT3.mjs.map
|
||||
Reference in New Issue
Block a user