Compare commits
2 Commits
9a9a08b7ca
...
e39ea741ea
| Author | SHA1 | Date | |
|---|---|---|---|
| e39ea741ea | |||
| ee1ae711f5 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -19,4 +19,5 @@ tests/**/coverage/
|
|||||||
*.ntvs*
|
*.ntvs*
|
||||||
*.njsproj
|
*.njsproj
|
||||||
*.sln
|
*.sln
|
||||||
tsconfig.tsbuildinfo
|
tsconfig.tsbuildinfo
|
||||||
|
/.husky/
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
. "$(dirname "$0")/_/husky.sh"
|
|
||||||
. "$(dirname "$0")/common.sh"
|
. "$(dirname "$0")/common.sh"
|
||||||
|
|
||||||
[ -n "$CI" ] && exit 0
|
[ -n "$CI" ] && exit 0
|
||||||
@@ -7,4 +6,4 @@
|
|||||||
PATH="/usr/local/bin:$PATH"
|
PATH="/usr/local/bin:$PATH"
|
||||||
|
|
||||||
# Perform lint check on files in the staging area through .lintstagedrc configuration
|
# Perform lint check on files in the staging area through .lintstagedrc configuration
|
||||||
pnpm exec lint-staged
|
pnpm exec lint-staged
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { baseUrlApi } from "./utils";
|
|||||||
|
|
||||||
export type UserResult = {
|
export type UserResult = {
|
||||||
success: boolean;
|
success: boolean;
|
||||||
|
status: number;
|
||||||
data: {
|
data: {
|
||||||
/** 头像 */
|
/** 头像 */
|
||||||
avatar: string;
|
avatar: string;
|
||||||
|
|||||||
@@ -66,12 +66,20 @@ export const useUserStore = defineStore({
|
|||||||
},
|
},
|
||||||
/** 登入 */
|
/** 登入 */
|
||||||
async loginByUsername(data) {
|
async loginByUsername(data) {
|
||||||
|
console.info("```````````````````````````````````````````````");
|
||||||
|
console.info(data);
|
||||||
return new Promise<UserResult>((resolve, reject) => {
|
return new Promise<UserResult>((resolve, reject) => {
|
||||||
getLogin(data)
|
getLogin(data)
|
||||||
.then(data => {
|
.then(data => {
|
||||||
console.log("loginByUsername");
|
console.log("loginByUsername");
|
||||||
console.log(data.data);
|
console.log(data.data);
|
||||||
if (data?.success) setToken(data.data);
|
console.log(data.status);
|
||||||
|
console.log(data);
|
||||||
|
//if (data?.success) setToken(data.data);
|
||||||
|
// if(data?.status==200) setToken(data.data);
|
||||||
|
if (data && data.status == 200) {
|
||||||
|
setToken(data.data);
|
||||||
|
}
|
||||||
resolve(data);
|
resolve(data);
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ const { title } = useNav();
|
|||||||
|
|
||||||
const ruleForm = reactive({
|
const ruleForm = reactive({
|
||||||
username: "admin",
|
username: "admin",
|
||||||
password: "admin123"
|
password: "comcat@2019"
|
||||||
});
|
});
|
||||||
|
|
||||||
const onLogin = async (formEl: FormInstance | undefined) => {
|
const onLogin = async (formEl: FormInstance | undefined) => {
|
||||||
@@ -45,10 +45,22 @@ const onLogin = async (formEl: FormInstance | undefined) => {
|
|||||||
useUserStoreHook()
|
useUserStoreHook()
|
||||||
.loginByUsername({
|
.loginByUsername({
|
||||||
username: ruleForm.username,
|
username: ruleForm.username,
|
||||||
password: ruleForm.password
|
password: ruleForm.password,
|
||||||
|
isBackendUser: 1
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res.success) {
|
console.log(res);
|
||||||
|
console.log("res.status = " + res.status);
|
||||||
|
console.log("res.success = " + res.success);
|
||||||
|
// if (res.success) {
|
||||||
|
console.info(typeof res.status);
|
||||||
|
if (res.status) {
|
||||||
|
console.log(res.status);
|
||||||
|
} else {
|
||||||
|
console.info(res);
|
||||||
|
console.error("res.status is undefined");
|
||||||
|
}
|
||||||
|
if (res.status === 200) {
|
||||||
// 获取后端路由
|
// 获取后端路由
|
||||||
return initRouter().then(() => {
|
return initRouter().then(() => {
|
||||||
router.push(getTopMenu(true).path).then(() => {
|
router.push(getTopMenu(true).path).then(() => {
|
||||||
|
|||||||
@@ -29,13 +29,41 @@ export default ({ mode }: ConfigEnv): UserConfigExport => {
|
|||||||
"/base": {
|
"/base": {
|
||||||
target: "http://127.0.0.1:9098",
|
target: "http://127.0.0.1:9098",
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
rewrite: path => path.replace(/^\/base/, "")
|
rewrite: path => path.replace(/^\/base/, ""),
|
||||||
|
configure: (proxy, options) => {
|
||||||
|
// 添加调试日志
|
||||||
|
proxy.on("proxyReq", (proxyReq, req, res) => {
|
||||||
|
console.log(res);
|
||||||
|
console.log("代理请求:", {
|
||||||
|
from: req.url,
|
||||||
|
to: options.target + proxyReq.path
|
||||||
|
});
|
||||||
|
});
|
||||||
|
proxy.on("proxyRes", (proxyRes, req, res) => {
|
||||||
|
console.log(res);
|
||||||
|
console.log("代理响应:", {
|
||||||
|
path: req.url,
|
||||||
|
status: proxyRes.statusCode
|
||||||
|
});
|
||||||
|
});
|
||||||
|
proxy.on("error", (err, req, res) => {
|
||||||
|
console.log(res);
|
||||||
|
console.log(req);
|
||||||
|
console.error("代理错误:", err);
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// 第二个代理后端地址
|
// 第二个代理后端地址
|
||||||
"/otherApi": {
|
"/otherApi": {
|
||||||
target: "http://127.0.0.1:3290",
|
target: "http://127.0.0.1:3290",
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
rewrite: path => path.replace(/^\/otherApi/, "")
|
rewrite: path => path.replace(/^\/otherApi/, "")
|
||||||
|
},
|
||||||
|
// 第三个代理后端地址
|
||||||
|
"/biz": {
|
||||||
|
target: "http://127.0.0.1:8089",
|
||||||
|
changeOrigin: true,
|
||||||
|
rewrite: path => path.replace(/^\/biz/, "")
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 预热文件以提前转换和缓存结果,降低启动期间的初始页面加载时长并防止转换瀑布
|
// 预热文件以提前转换和缓存结果,降低启动期间的初始页面加载时长并防止转换瀑布
|
||||||
|
|||||||
Reference in New Issue
Block a user