diff --git a/build/plugins.ts b/build/plugins.ts index 94b544f..74daa32 100644 --- a/build/plugins.ts +++ b/build/plugins.ts @@ -13,7 +13,7 @@ import { visualizer } from "rollup-plugin-visualizer"; import removeConsole from "vite-plugin-remove-console"; import { themePreprocessorPlugin } from "@pureadmin/theme"; import { genScssMultipleScopeVars } from "../src/layout/theme"; -import { vitePluginFakeServer } from "vite-plugin-fake-server"; +// import { vitePluginFakeServer } from "vite-plugin-fake-server"; export function getPluginsList( VITE_CDN: boolean, @@ -44,12 +44,12 @@ export function getPluginsList( */ removeNoMatch(), // mock支持 - vitePluginFakeServer({ - logger: false, - include: "mock", - infixName: false, - enableProd: true - }), + // vitePluginFakeServer({ + // logger: false, + // include: "mock", + // infixName: false, + // enableProd: true + // }), // 自定义主题 themePreprocessorPlugin({ scss: { diff --git a/src/api/routes.ts b/src/api/routes.ts index 501ea3c..b092c5d 100644 --- a/src/api/routes.ts +++ b/src/api/routes.ts @@ -1,4 +1,5 @@ import { http } from "@/utils/http"; +import { baseUrlApi } from "./utils"; type Result = { success: boolean; @@ -6,5 +7,7 @@ type Result = { }; export const getAsyncRoutes = () => { - return http.request("get", "/get-async-routes"); + // return http.request("get", "/get-async-routes"); + // 暂时返回空动态路由 + return http.request("get", baseUrlApi("auth/async-routes")); }; diff --git a/src/api/user.ts b/src/api/user.ts index e1d383e..b7be5cb 100644 --- a/src/api/user.ts +++ b/src/api/user.ts @@ -37,8 +37,10 @@ export type RefreshTokenResult = { /** 登录 */ export const getLogin = (data?: object) => { - return http.request("post", "/login", { data }); - return http.request("post", baseUrlApi("login"), { data }); + // return http.request("post", "/login", { data }); + // console.log(http.request("get", baseUrlApi("/user/roles"))); + // console.log(data); + return http.request("post", baseUrlApi("login"), { data }); }; /** 刷新`token` */ diff --git a/src/api/utils.ts b/src/api/utils.ts index adcea37..a9793cb 100644 --- a/src/api/utils.ts +++ b/src/api/utils.ts @@ -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}`; diff --git a/src/router/modules/airworthiness.ts b/src/router/modules/airworthiness.ts index a622b21..65dc7d6 100644 --- a/src/router/modules/airworthiness.ts +++ b/src/router/modules/airworthiness.ts @@ -17,7 +17,7 @@ export default { component: () => import("@/views/airworthiness/index.vue"), meta: { title: "适航资源", - roles: ["admin", "common"] + roles: ["admin", "3"] } } ] diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index 9d0430e..ad7d0ca 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -69,6 +69,8 @@ export const useUserStore = defineStore({ return new Promise((resolve, reject) => { getLogin(data) .then(data => { + console.log("loginByUsername"); + console.log(data.data); if (data?.success) setToken(data.data); resolve(data); }) diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 6a8096e..6659925 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -43,7 +43,10 @@ const onLogin = async (formEl: FormInstance | undefined) => { if (valid) { loading.value = true; useUserStoreHook() - .loginByUsername({ username: ruleForm.username, password: "admin123" }) + .loginByUsername({ + username: ruleForm.username, + password: ruleForm.password + }) .then(res => { if (res.success) { // 获取后端路由 diff --git a/vite.config.ts b/vite.config.ts index d34162f..f387c94 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -26,10 +26,10 @@ export default ({ mode }: ConfigEnv): UserConfigExport => { // 本地跨域代理 https://cn.vitejs.dev/config/server-options.html#server-proxy proxy: { // 第一个代理后端地址 - "/api": { - target: "http://127.0.0.1:3000", + "/base": { + target: "http://127.0.0.1:9098", changeOrigin: true, - rewrite: path => path.replace(/^\/api/, "") + rewrite: path => path.replace(/^\/base/, "") }, // 第二个代理后端地址 "/otherApi": {