feat(api): 添加多路由代理处理实现
- 新增api目录下多个接口路径代理处理文件,支持动态拼接目标URL - 根据环境变量选择不同的后端服务地址(如dev和生产环境) - 统一添加TenantId和Authorization请求头传递租户及身份信息 - 实现请求参数及搜索参数的完整转发 - 引入better-sqlite3及node内建模块支持服务端功能 - 新增专家详情页面,实现文章、成果及预约咨询功能展示 - 页面实现加载骨架屏、标签页切换及空状态提示优化体验
This commit is contained in:
386
.output/server/chunks/build/index-A9wylOpH.mjs
Normal file
386
.output/server/chunks/build/index-A9wylOpH.mjs
Normal file
@@ -0,0 +1,386 @@
|
||||
import { a as _export_sfc, c as useHead, n as navigateTo } from './server.mjs';
|
||||
import { defineComponent, computed, ref, reactive, resolveComponent, mergeProps, unref, withCtx, createVNode, createTextVNode, useSSRContext } from 'vue';
|
||||
import { ssrRenderAttrs, ssrRenderComponent } from 'vue/server-renderer';
|
||||
import { message } from 'ant-design-vue';
|
||||
import '../nitro/nitro.mjs';
|
||||
import 'node:http';
|
||||
import 'node:https';
|
||||
import 'node:events';
|
||||
import 'node:buffer';
|
||||
import 'node:fs';
|
||||
import 'node:path';
|
||||
import 'node:crypto';
|
||||
import 'node:url';
|
||||
import 'better-sqlite3';
|
||||
import 'vue-router';
|
||||
import '@babel/runtime/helpers/esm/extends';
|
||||
import 'stylis';
|
||||
import 'dayjs';
|
||||
import '../routes/renderer.mjs';
|
||||
import 'vue-bundle-renderer/runtime';
|
||||
import 'unhead/server';
|
||||
import 'devalue';
|
||||
import 'unhead/plugins';
|
||||
import 'unhead/utils';
|
||||
|
||||
const _sfc_main = /* @__PURE__ */ defineComponent({
|
||||
__name: "index",
|
||||
__ssrInlineRender: true,
|
||||
setup(__props) {
|
||||
useHead({ title: "建言献策 - 决策咨询网" });
|
||||
const isAuthed = computed(() => false);
|
||||
const submitting = ref(false);
|
||||
const formData = reactive({
|
||||
title: "",
|
||||
content: "",
|
||||
contact: ""
|
||||
});
|
||||
const rules = {
|
||||
title: [{ required: true, message: "请输入建言标题" }],
|
||||
content: [{ required: true, message: "请输入建言内容" }]
|
||||
};
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
message.success("建言已提交,感谢您的参与!");
|
||||
handleReset();
|
||||
} catch (e) {
|
||||
message.error(e?.message || "提交失败");
|
||||
}
|
||||
}
|
||||
function handleReset() {
|
||||
formData.title = "";
|
||||
formData.content = "";
|
||||
formData.contact = "";
|
||||
}
|
||||
return (_ctx, _push, _parent, _attrs) => {
|
||||
const _component_a_form = resolveComponent("a-form");
|
||||
const _component_a_form_item = resolveComponent("a-form-item");
|
||||
const _component_a_input = resolveComponent("a-input");
|
||||
const _component_a_textarea = resolveComponent("a-textarea");
|
||||
const _component_a_space = resolveComponent("a-space");
|
||||
const _component_a_button = resolveComponent("a-button");
|
||||
const _component_a_result = resolveComponent("a-result");
|
||||
_push(`<div${ssrRenderAttrs(mergeProps({ class: "suggestions-page" }, _attrs))} data-v-e8abb86f><div class="page-header" data-v-e8abb86f><h1 class="page-title" data-v-e8abb86f>建言献策</h1><p class="page-desc" data-v-e8abb86f>您的每一条建议都是我们进步的动力,期待您的声音</p></div><div class="suggestions-content" data-v-e8abb86f><div class="intro-section" data-v-e8abb86f><h2 data-v-e8abb86f>参与方式</h2><p data-v-e8abb86f>欢迎您对政策制定、经济发展、社会治理等方面提出宝贵意见和建议。请您先登录或注册账号,然后填写建言内容。</p></div>`);
|
||||
if (unref(isAuthed)) {
|
||||
_push(ssrRenderComponent(_component_a_form, {
|
||||
model: unref(formData),
|
||||
rules,
|
||||
layout: "vertical",
|
||||
class: "suggestion-form"
|
||||
}, {
|
||||
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
||||
if (_push2) {
|
||||
_push2(ssrRenderComponent(_component_a_form_item, {
|
||||
label: "建言标题",
|
||||
name: "title"
|
||||
}, {
|
||||
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
|
||||
if (_push3) {
|
||||
_push3(ssrRenderComponent(_component_a_input, {
|
||||
value: unref(formData).title,
|
||||
"onUpdate:value": ($event) => unref(formData).title = $event,
|
||||
placeholder: "请输入建言标题",
|
||||
maxlength: 100,
|
||||
"show-count": ""
|
||||
}, null, _parent3, _scopeId2));
|
||||
} else {
|
||||
return [
|
||||
createVNode(_component_a_input, {
|
||||
value: unref(formData).title,
|
||||
"onUpdate:value": ($event) => unref(formData).title = $event,
|
||||
placeholder: "请输入建言标题",
|
||||
maxlength: 100,
|
||||
"show-count": ""
|
||||
}, null, 8, ["value", "onUpdate:value"])
|
||||
];
|
||||
}
|
||||
}),
|
||||
_: 1
|
||||
}, _parent2, _scopeId));
|
||||
_push2(ssrRenderComponent(_component_a_form_item, {
|
||||
label: "建言内容",
|
||||
name: "content"
|
||||
}, {
|
||||
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
|
||||
if (_push3) {
|
||||
_push3(ssrRenderComponent(_component_a_textarea, {
|
||||
value: unref(formData).content,
|
||||
"onUpdate:value": ($event) => unref(formData).content = $event,
|
||||
placeholder: "请详细描述您的建议和意见...",
|
||||
rows: 8,
|
||||
maxlength: 2e3,
|
||||
"show-count": ""
|
||||
}, null, _parent3, _scopeId2));
|
||||
} else {
|
||||
return [
|
||||
createVNode(_component_a_textarea, {
|
||||
value: unref(formData).content,
|
||||
"onUpdate:value": ($event) => unref(formData).content = $event,
|
||||
placeholder: "请详细描述您的建议和意见...",
|
||||
rows: 8,
|
||||
maxlength: 2e3,
|
||||
"show-count": ""
|
||||
}, null, 8, ["value", "onUpdate:value"])
|
||||
];
|
||||
}
|
||||
}),
|
||||
_: 1
|
||||
}, _parent2, _scopeId));
|
||||
_push2(ssrRenderComponent(_component_a_form_item, {
|
||||
label: "联系方式(选填)",
|
||||
name: "contact"
|
||||
}, {
|
||||
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
|
||||
if (_push3) {
|
||||
_push3(ssrRenderComponent(_component_a_input, {
|
||||
value: unref(formData).contact,
|
||||
"onUpdate:value": ($event) => unref(formData).contact = $event,
|
||||
placeholder: "请输入您的联系方式,方便我们与您联系"
|
||||
}, null, _parent3, _scopeId2));
|
||||
} else {
|
||||
return [
|
||||
createVNode(_component_a_input, {
|
||||
value: unref(formData).contact,
|
||||
"onUpdate:value": ($event) => unref(formData).contact = $event,
|
||||
placeholder: "请输入您的联系方式,方便我们与您联系"
|
||||
}, null, 8, ["value", "onUpdate:value"])
|
||||
];
|
||||
}
|
||||
}),
|
||||
_: 1
|
||||
}, _parent2, _scopeId));
|
||||
_push2(ssrRenderComponent(_component_a_form_item, null, {
|
||||
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
|
||||
if (_push3) {
|
||||
_push3(ssrRenderComponent(_component_a_space, null, {
|
||||
default: withCtx((_3, _push4, _parent4, _scopeId3) => {
|
||||
if (_push4) {
|
||||
_push4(ssrRenderComponent(_component_a_button, {
|
||||
type: "primary",
|
||||
size: "large",
|
||||
onClick: handleSubmit,
|
||||
loading: unref(submitting)
|
||||
}, {
|
||||
default: withCtx((_4, _push5, _parent5, _scopeId4) => {
|
||||
if (_push5) {
|
||||
_push5(` 提交建言 `);
|
||||
} else {
|
||||
return [
|
||||
createTextVNode(" 提交建言 ")
|
||||
];
|
||||
}
|
||||
}),
|
||||
_: 1
|
||||
}, _parent4, _scopeId3));
|
||||
_push4(ssrRenderComponent(_component_a_button, {
|
||||
size: "large",
|
||||
onClick: handleReset
|
||||
}, {
|
||||
default: withCtx((_4, _push5, _parent5, _scopeId4) => {
|
||||
if (_push5) {
|
||||
_push5(` 重置 `);
|
||||
} else {
|
||||
return [
|
||||
createTextVNode(" 重置 ")
|
||||
];
|
||||
}
|
||||
}),
|
||||
_: 1
|
||||
}, _parent4, _scopeId3));
|
||||
} else {
|
||||
return [
|
||||
createVNode(_component_a_button, {
|
||||
type: "primary",
|
||||
size: "large",
|
||||
onClick: handleSubmit,
|
||||
loading: unref(submitting)
|
||||
}, {
|
||||
default: withCtx(() => [
|
||||
createTextVNode(" 提交建言 ")
|
||||
]),
|
||||
_: 1
|
||||
}, 8, ["loading"]),
|
||||
createVNode(_component_a_button, {
|
||||
size: "large",
|
||||
onClick: handleReset
|
||||
}, {
|
||||
default: withCtx(() => [
|
||||
createTextVNode(" 重置 ")
|
||||
]),
|
||||
_: 1
|
||||
})
|
||||
];
|
||||
}
|
||||
}),
|
||||
_: 1
|
||||
}, _parent3, _scopeId2));
|
||||
} else {
|
||||
return [
|
||||
createVNode(_component_a_space, null, {
|
||||
default: withCtx(() => [
|
||||
createVNode(_component_a_button, {
|
||||
type: "primary",
|
||||
size: "large",
|
||||
onClick: handleSubmit,
|
||||
loading: unref(submitting)
|
||||
}, {
|
||||
default: withCtx(() => [
|
||||
createTextVNode(" 提交建言 ")
|
||||
]),
|
||||
_: 1
|
||||
}, 8, ["loading"]),
|
||||
createVNode(_component_a_button, {
|
||||
size: "large",
|
||||
onClick: handleReset
|
||||
}, {
|
||||
default: withCtx(() => [
|
||||
createTextVNode(" 重置 ")
|
||||
]),
|
||||
_: 1
|
||||
})
|
||||
]),
|
||||
_: 1
|
||||
})
|
||||
];
|
||||
}
|
||||
}),
|
||||
_: 1
|
||||
}, _parent2, _scopeId));
|
||||
} else {
|
||||
return [
|
||||
createVNode(_component_a_form_item, {
|
||||
label: "建言标题",
|
||||
name: "title"
|
||||
}, {
|
||||
default: withCtx(() => [
|
||||
createVNode(_component_a_input, {
|
||||
value: unref(formData).title,
|
||||
"onUpdate:value": ($event) => unref(formData).title = $event,
|
||||
placeholder: "请输入建言标题",
|
||||
maxlength: 100,
|
||||
"show-count": ""
|
||||
}, null, 8, ["value", "onUpdate:value"])
|
||||
]),
|
||||
_: 1
|
||||
}),
|
||||
createVNode(_component_a_form_item, {
|
||||
label: "建言内容",
|
||||
name: "content"
|
||||
}, {
|
||||
default: withCtx(() => [
|
||||
createVNode(_component_a_textarea, {
|
||||
value: unref(formData).content,
|
||||
"onUpdate:value": ($event) => unref(formData).content = $event,
|
||||
placeholder: "请详细描述您的建议和意见...",
|
||||
rows: 8,
|
||||
maxlength: 2e3,
|
||||
"show-count": ""
|
||||
}, null, 8, ["value", "onUpdate:value"])
|
||||
]),
|
||||
_: 1
|
||||
}),
|
||||
createVNode(_component_a_form_item, {
|
||||
label: "联系方式(选填)",
|
||||
name: "contact"
|
||||
}, {
|
||||
default: withCtx(() => [
|
||||
createVNode(_component_a_input, {
|
||||
value: unref(formData).contact,
|
||||
"onUpdate:value": ($event) => unref(formData).contact = $event,
|
||||
placeholder: "请输入您的联系方式,方便我们与您联系"
|
||||
}, null, 8, ["value", "onUpdate:value"])
|
||||
]),
|
||||
_: 1
|
||||
}),
|
||||
createVNode(_component_a_form_item, null, {
|
||||
default: withCtx(() => [
|
||||
createVNode(_component_a_space, null, {
|
||||
default: withCtx(() => [
|
||||
createVNode(_component_a_button, {
|
||||
type: "primary",
|
||||
size: "large",
|
||||
onClick: handleSubmit,
|
||||
loading: unref(submitting)
|
||||
}, {
|
||||
default: withCtx(() => [
|
||||
createTextVNode(" 提交建言 ")
|
||||
]),
|
||||
_: 1
|
||||
}, 8, ["loading"]),
|
||||
createVNode(_component_a_button, {
|
||||
size: "large",
|
||||
onClick: handleReset
|
||||
}, {
|
||||
default: withCtx(() => [
|
||||
createTextVNode(" 重置 ")
|
||||
]),
|
||||
_: 1
|
||||
})
|
||||
]),
|
||||
_: 1
|
||||
})
|
||||
]),
|
||||
_: 1
|
||||
})
|
||||
];
|
||||
}
|
||||
}),
|
||||
_: 1
|
||||
}, _parent));
|
||||
} else {
|
||||
_push(`<div class="login-prompt" data-v-e8abb86f>`);
|
||||
_push(ssrRenderComponent(_component_a_result, {
|
||||
title: "请先登录",
|
||||
"sub-title": "登录后可提交建言献策"
|
||||
}, {
|
||||
extra: withCtx((_, _push2, _parent2, _scopeId) => {
|
||||
if (_push2) {
|
||||
_push2(ssrRenderComponent(_component_a_button, {
|
||||
type: "primary",
|
||||
size: "large",
|
||||
onClick: ($event) => ("navigateTo" in _ctx ? _ctx.navigateTo : unref(navigateTo))("/login")
|
||||
}, {
|
||||
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
|
||||
if (_push3) {
|
||||
_push3(` 去登录 `);
|
||||
} else {
|
||||
return [
|
||||
createTextVNode(" 去登录 ")
|
||||
];
|
||||
}
|
||||
}),
|
||||
_: 1
|
||||
}, _parent2, _scopeId));
|
||||
} else {
|
||||
return [
|
||||
createVNode(_component_a_button, {
|
||||
type: "primary",
|
||||
size: "large",
|
||||
onClick: ($event) => ("navigateTo" in _ctx ? _ctx.navigateTo : unref(navigateTo))("/login")
|
||||
}, {
|
||||
default: withCtx(() => [
|
||||
createTextVNode(" 去登录 ")
|
||||
]),
|
||||
_: 1
|
||||
}, 8, ["onClick"])
|
||||
];
|
||||
}
|
||||
}),
|
||||
_: 1
|
||||
}, _parent));
|
||||
_push(`</div>`);
|
||||
}
|
||||
_push(`</div></div>`);
|
||||
};
|
||||
}
|
||||
});
|
||||
const _sfc_setup = _sfc_main.setup;
|
||||
_sfc_main.setup = (props, ctx) => {
|
||||
const ssrContext = useSSRContext();
|
||||
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("pages/suggestions/index.vue");
|
||||
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
|
||||
};
|
||||
const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-e8abb86f"]]);
|
||||
|
||||
export { index as default };
|
||||
//# sourceMappingURL=index-A9wylOpH.mjs.map
|
||||
Reference in New Issue
Block a user