feat(api): 添加多路由代理处理实现
- 新增api目录下多个接口路径代理处理文件,支持动态拼接目标URL - 根据环境变量选择不同的后端服务地址(如dev和生产环境) - 统一添加TenantId和Authorization请求头传递租户及身份信息 - 实现请求参数及搜索参数的完整转发 - 引入better-sqlite3及node内建模块支持服务端功能 - 新增专家详情页面,实现文章、成果及预约咨询功能展示 - 页面实现加载骨架屏、标签页切换及空状态提示优化体验
This commit is contained in:
46
.output/server/chunks/build/index-CEJdy8RB.mjs
Normal file
46
.output/server/chunks/build/index-CEJdy8RB.mjs
Normal file
@@ -0,0 +1,46 @@
|
||||
import { S as SERVER_API_URL } from './server.mjs';
|
||||
import { r as requestClient } from './request-BIxQh2im.mjs';
|
||||
import { s as setToken } from './token-util-C_wOpB5F.mjs';
|
||||
|
||||
const intervalError = "[nuxt] `setInterval` should not be used on the server. Consider wrapping it with an `onNuxtReady`, `onBeforeMount` or `onMounted` lifecycle hook, or ensure you only call it in the browser by checking `false`.";
|
||||
const setInterval = () => {
|
||||
console.error(intervalError);
|
||||
};
|
||||
async function getCaptcha() {
|
||||
const res = await requestClient.get(
|
||||
SERVER_API_URL + "/captcha"
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
async function loginBySms(data) {
|
||||
const res = await requestClient.post(
|
||||
SERVER_API_URL + "/loginBySms",
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
setToken(res.data.data?.access_token, data.remember);
|
||||
if (res.data.data?.user) {
|
||||
const user = res.data.data?.user;
|
||||
localStorage.setItem("TenantId", String(user.tenantId));
|
||||
localStorage.setItem("UserId", String(user.userId));
|
||||
}
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
async function sendSmsCaptcha(data) {
|
||||
const res = await requestClient.post(
|
||||
SERVER_API_URL + "/sendSmsCaptcha",
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
export { setInterval as a, getCaptcha as g, loginBySms as l, sendSmsCaptcha as s };
|
||||
//# sourceMappingURL=index-CEJdy8RB.mjs.map
|
||||
Reference in New Issue
Block a user