增加页面及路由;
修改proxy;
This commit is contained in:
@@ -13,7 +13,7 @@ import { visualizer } from "rollup-plugin-visualizer";
|
|||||||
import removeConsole from "vite-plugin-remove-console";
|
import removeConsole from "vite-plugin-remove-console";
|
||||||
import { themePreprocessorPlugin } from "@pureadmin/theme";
|
import { themePreprocessorPlugin } from "@pureadmin/theme";
|
||||||
import { genScssMultipleScopeVars } from "../src/layout/theme";
|
import { genScssMultipleScopeVars } from "../src/layout/theme";
|
||||||
import { vitePluginFakeServer } from "vite-plugin-fake-server";
|
// import { vitePluginFakeServer } from "vite-plugin-fake-server";
|
||||||
|
|
||||||
export function getPluginsList(
|
export function getPluginsList(
|
||||||
VITE_CDN: boolean,
|
VITE_CDN: boolean,
|
||||||
@@ -44,12 +44,12 @@ export function getPluginsList(
|
|||||||
*/
|
*/
|
||||||
removeNoMatch(),
|
removeNoMatch(),
|
||||||
// mock支持
|
// mock支持
|
||||||
vitePluginFakeServer({
|
// vitePluginFakeServer({
|
||||||
logger: false,
|
// logger: false,
|
||||||
include: "mock",
|
// include: "mock",
|
||||||
infixName: false,
|
// infixName: false,
|
||||||
enableProd: true
|
// enableProd: true
|
||||||
}),
|
// }),
|
||||||
// 自定义主题
|
// 自定义主题
|
||||||
themePreprocessorPlugin({
|
themePreprocessorPlugin({
|
||||||
scss: {
|
scss: {
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { http } from "@/utils/http";
|
import { http } from "@/utils/http";
|
||||||
|
import { baseUrlApi } from "./utils";
|
||||||
|
|
||||||
type Result = {
|
type Result = {
|
||||||
success: boolean;
|
success: boolean;
|
||||||
@@ -6,5 +7,7 @@ type Result = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getAsyncRoutes = () => {
|
export const getAsyncRoutes = () => {
|
||||||
return http.request<Result>("get", "/get-async-routes");
|
// return http.request<Result>("get", "/get-async-routes");
|
||||||
|
// 暂时返回空动态路由
|
||||||
|
return http.request<Result>("get", baseUrlApi("auth/async-routes"));
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -37,8 +37,10 @@ export type RefreshTokenResult = {
|
|||||||
|
|
||||||
/** 登录 */
|
/** 登录 */
|
||||||
export const getLogin = (data?: object) => {
|
export const getLogin = (data?: object) => {
|
||||||
return http.request<UserResult>("post", "/login", { data });
|
// return http.request<UserResult>("post", "/login", { data });
|
||||||
return http.request<any>("post", baseUrlApi("login"), { data });
|
// console.log(http.request<any>("get", baseUrlApi("/user/roles")));
|
||||||
|
// console.log(data);
|
||||||
|
return http.request<UserResult>("post", baseUrlApi("login"), { data });
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 刷新`token` */
|
/** 刷新`token` */
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// 第一个代理后端地址
|
// 第一个代理后端地址
|
||||||
export const baseUrlApi = (url: string) => `/api/${url}`;
|
export const baseUrlApi = (url: string) => `/base/${url}`;
|
||||||
// 第二个代理后端地址
|
// 第二个代理后端地址
|
||||||
export const baseUrlOtherApi = (url: string) => `/otherApi/${url}`;
|
export const baseUrlAuthrApi = (url: string) => `/auth/${url}`;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ export default {
|
|||||||
component: () => import("@/views/airworthiness/index.vue"),
|
component: () => import("@/views/airworthiness/index.vue"),
|
||||||
meta: {
|
meta: {
|
||||||
title: "适航资源",
|
title: "适航资源",
|
||||||
roles: ["admin", "common"]
|
roles: ["admin", "3"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -69,6 +69,8 @@ export const useUserStore = defineStore({
|
|||||||
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(data.data);
|
||||||
if (data?.success) setToken(data.data);
|
if (data?.success) setToken(data.data);
|
||||||
resolve(data);
|
resolve(data);
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -43,7 +43,10 @@ const onLogin = async (formEl: FormInstance | undefined) => {
|
|||||||
if (valid) {
|
if (valid) {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
useUserStoreHook()
|
useUserStoreHook()
|
||||||
.loginByUsername({ username: ruleForm.username, password: "admin123" })
|
.loginByUsername({
|
||||||
|
username: ruleForm.username,
|
||||||
|
password: ruleForm.password
|
||||||
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
// 获取后端路由
|
// 获取后端路由
|
||||||
|
|||||||
@@ -26,10 +26,10 @@ export default ({ mode }: ConfigEnv): UserConfigExport => {
|
|||||||
// 本地跨域代理 https://cn.vitejs.dev/config/server-options.html#server-proxy
|
// 本地跨域代理 https://cn.vitejs.dev/config/server-options.html#server-proxy
|
||||||
proxy: {
|
proxy: {
|
||||||
// 第一个代理后端地址
|
// 第一个代理后端地址
|
||||||
"/api": {
|
"/base": {
|
||||||
target: "http://127.0.0.1:3000",
|
target: "http://127.0.0.1:9098",
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
rewrite: path => path.replace(/^\/api/, "")
|
rewrite: path => path.replace(/^\/base/, "")
|
||||||
},
|
},
|
||||||
// 第二个代理后端地址
|
// 第二个代理后端地址
|
||||||
"/otherApi": {
|
"/otherApi": {
|
||||||
|
|||||||
Reference in New Issue
Block a user