feat(api): 添加多路由代理处理实现

- 新增api目录下多个接口路径代理处理文件,支持动态拼接目标URL
- 根据环境变量选择不同的后端服务地址(如dev和生产环境)
- 统一添加TenantId和Authorization请求头传递租户及身份信息
- 实现请求参数及搜索参数的完整转发
- 引入better-sqlite3及node内建模块支持服务端功能
- 新增专家详情页面,实现文章、成果及预约咨询功能展示
- 页面实现加载骨架屏、标签页切换及空状态提示优化体验
This commit is contained in:
2026-04-28 13:50:27 +08:00
parent 3edf4f0124
commit 528fe28ffc
399 changed files with 53320 additions and 0 deletions

View File

@@ -0,0 +1 @@
import{ac as c,a1 as p,a4 as h,ad as u}from"./DPwbf7XO.js";import{g as f}from"./Dl1HJz7f.js";function d(){return globalThis.$fetch}function g(t="5"){try{return localStorage.getItem("TenantId")||t}catch{return t}}function l(){try{return d()}catch{return globalThis.$fetch}}function m(t){const e=p(),n=e.public.serverApiBase,s=e.public.modulesApiBase,a=e.public.appApiBase;return t.startsWith(n)?h+t.slice(n.length):t.startsWith(s)?c+t.slice(s.length):t.startsWith(a)?u+t.slice(a.length):t}function T(t){const e=p(),n=t?.TenantId??t?.tenantId??g(String(e.public.tenantId)),s=f(),a={TenantId:String(n)};if(s&&(a.Authorization=s),t)for(const[o,i]of Object.entries(t))i!=null&&(a[o]=String(i));return a}function I(t){return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("/api/_server")||t.startsWith("/api/_modules")||t.startsWith("/api/_file")?t:t.startsWith("/api/app")?"/api/_app"+t.slice(8):t.startsWith("/")?c+t:c+"/"+t}async function r(t,e,n,s={}){const a=l(),o=I(m(e));return{data:await a(o,{method:t,query:s.params,body:n??s.data,headers:T(s.headers),responseType:s.responseType})}}const b={get:(t,e)=>r("GET",t,void 0,e),delete:(t,e)=>r("DELETE",t,void 0,e),post:(t,e,n)=>r("POST",t,e,n),put:(t,e,n)=>r("PUT",t,e,n)};export{b as r};