分类分级任务联调
Showing
5 changed files
with
39 additions
and
20 deletions
| ... | @@ -6,7 +6,11 @@ VITE_APP_TITLE = 数据资产管理系统 | ... | @@ -6,7 +6,11 @@ VITE_APP_TITLE = 数据资产管理系统 |
| 6 | # VITE_API_BASEURL = http://localhost:9000 | 6 | # VITE_API_BASEURL = http://localhost:9000 |
| 7 | VITE_API_BASEURL = http://10.4.82.1:28052/ | 7 | VITE_API_BASEURL = http://10.4.82.1:28052/ |
| 8 | # 平台用户 接口请地址 | 8 | # 平台用户 接口请地址 |
| 9 | VITE_APP_USER_API_BASEURL = gateway-server/user | 9 | VITE_APP_USER_API_BASEURL = gateway-server |
| 10 | |||
| 11 | #AUTH服务 | ||
| 12 | VITE_APP_AUTH_URL = 'ms-daop-auth-service' | ||
| 13 | |||
| 10 | # 系统管理 接口地址 | 14 | # 系统管理 接口地址 |
| 11 | VITE_APP_API_BASEURL = ms-daop-zcgl-system-manager-service | 15 | VITE_APP_API_BASEURL = ms-daop-zcgl-system-manager-service |
| 12 | # 文件上传请求地址 | 16 | # 文件上传请求地址 |
| ... | @@ -42,3 +46,4 @@ VITE_API_MESSAGE = ms-swzl-message-notification-service | ... | @@ -42,3 +46,4 @@ VITE_API_MESSAGE = ms-swzl-message-notification-service |
| 42 | VITE_BUILD_SOURCEMAP = false | 46 | VITE_BUILD_SOURCEMAP = false |
| 43 | # 是否在打包时开启压缩,支持 gzip 和 brotli | 47 | # 是否在打包时开启压缩,支持 gzip 和 brotli |
| 44 | VITE_BUILD_COMPRESS = gzip,brotli | 48 | VITE_BUILD_COMPRESS = gzip,brotli |
| 49 | ... | ... |
| ... | @@ -4,7 +4,7 @@ VITE_APP_TITLE = 数据资产管理系统 | ... | @@ -4,7 +4,7 @@ VITE_APP_TITLE = 数据资产管理系统 |
| 4 | VITE_API_BASEURL = https://www.zgsjzc.com/api | 4 | VITE_API_BASEURL = https://www.zgsjzc.com/api |
| 5 | # VITE_API_BASEURL = http://49.4.26.201:31709/ | 5 | # VITE_API_BASEURL = http://49.4.26.201:31709/ |
| 6 | # 平台用户 接口请地址 | 6 | # 平台用户 接口请地址 |
| 7 | VITE_APP_USER_API_BASEURL = gateway-server/user | 7 | VITE_APP_USER_API_BASEURL = gateway-server |
| 8 | # 系统管理 接口地址 | 8 | # 系统管理 接口地址 |
| 9 | VITE_APP_API_BASEURL = ms-daop-zcgl-system-manager-service | 9 | VITE_APP_API_BASEURL = ms-daop-zcgl-system-manager-service |
| 10 | # 文件上传请求地址 | 10 | # 文件上传请求地址 | ... | ... |
| ... | @@ -3,15 +3,16 @@ import request from "@/utils/request"; | ... | @@ -3,15 +3,16 @@ import request from "@/utils/request"; |
| 3 | /** 获取数往知来接入idaas的token。 */ | 3 | /** 获取数往知来接入idaas的token。 */ |
| 4 | export const getTokenByCode = (params) => { | 4 | export const getTokenByCode = (params) => { |
| 5 | return request({ | 5 | return request({ |
| 6 | url: `/csbr-zuul/user/idaas-login?code=${params.code}&platformGuid=${params.platformGuid}&userType=${params.userType}`, | 6 | url: `${import.meta.env.VITE_APP_USER_API_BASEURL}/staff/login`, |
| 7 | method: 'post' | 7 | method: 'post', |
| 8 | data: params | ||
| 8 | }) | 9 | }) |
| 9 | } | 10 | } |
| 10 | 11 | ||
| 11 | /** 退出登录 */ | 12 | /** 退出登录 */ |
| 12 | export const loginOut = () => { | 13 | export const loginOut = () => { |
| 13 | return request({ | 14 | return request({ |
| 14 | url: `/csbr-zuul/user/logout`, | 15 | url: `${import.meta.env.VITE_APP_USER_API_BASEURL}/user/logout`, |
| 15 | method: 'get' | 16 | method: 'get' |
| 16 | }) | 17 | }) |
| 17 | } | 18 | } |
| ... | @@ -19,11 +20,20 @@ export const loginOut = () => { | ... | @@ -19,11 +20,20 @@ export const loginOut = () => { |
| 19 | /** 刷新token,延长过期时间 */ | 20 | /** 刷新token,延长过期时间 */ |
| 20 | export const refreshToken = (params) => { | 21 | export const refreshToken = (params) => { |
| 21 | return request({ | 22 | return request({ |
| 22 | url: `/csbr-zuul/user/refreshToken?refreshToken=${params.refreshToken}`, | 23 | url: `${import.meta.env.VITE_APP_USER_API_BASEURL}/user/refreshToken?refreshToken=${params.refreshToken}`, |
| 23 | method: 'post' | 24 | method: 'post' |
| 24 | }) | 25 | }) |
| 25 | } | 26 | } |
| 26 | 27 | ||
| 28 | export const getSystemMenu = (params) => { | ||
| 29 | return request({ | ||
| 30 | url: `${ | ||
| 31 | import.meta.env.VITE_APP_AUTH_URL | ||
| 32 | }/product-menu-permission/tenant/get-product-menu?tenantGuid=${params.tenantGuid}&platformSystemGuid=32774fcfdf5e43e8b866660374d8bced`, | ||
| 33 | method: "get", | ||
| 34 | }); | ||
| 35 | }; | ||
| 36 | |||
| 27 | // 获取当前用户对应的产品和菜单 | 37 | // 获取当前用户对应的产品和菜单 |
| 28 | export const getUserInfo = () => { | 38 | export const getUserInfo = () => { |
| 29 | return request({ | 39 | return request({ | ... | ... |
| ... | @@ -50,7 +50,7 @@ router.beforeEach(async (to, from, next) => { | ... | @@ -50,7 +50,7 @@ router.beforeEach(async (to, from, next) => { |
| 50 | }) | 50 | }) |
| 51 | } | 51 | } |
| 52 | // 如果未开启主页,但进入的是主页,则会进入侧边栏导航第一个模块 | 52 | // 如果未开启主页,但进入的是主页,则会进入侧边栏导航第一个模块 |
| 53 | else if (!settingsStore.settings.home.enable && to.name === 'home') { | 53 | else if (!settingsStore.settings.home.enable && (to.name === 'home' || to.name === undefined)) { |
| 54 | if (menuStore.sidebarMenus.length > 0) { | 54 | if (menuStore.sidebarMenus.length > 0) { |
| 55 | next({ | 55 | next({ |
| 56 | path: menuStore.sidebarMenusFirstDeepestPath, | 56 | path: menuStore.sidebarMenusFirstDeepestPath, | ... | ... |
| ... | @@ -4,7 +4,7 @@ import router from '@/router' | ... | @@ -4,7 +4,7 @@ import router from '@/router' |
| 4 | import { ElMessage } from 'element-plus' | 4 | import { ElMessage } from 'element-plus' |
| 5 | import apiUser from '@/api/modules/user' | 5 | import apiUser from '@/api/modules/user' |
| 6 | import { getCurrentTime } from '@/utils/common' | 6 | import { getCurrentTime } from '@/utils/common' |
| 7 | import { getUserInfo, getTokenByCode, loginOut, refreshToken, editPasswordInterface } from '@/api/modules/queryService' | 7 | import { getSystemMenu, getUserInfo, getTokenByCode, loginOut, refreshToken, editPasswordInterface } from '@/api/modules/queryService' |
| 8 | 8 | ||
| 9 | const useUserStore = defineStore( | 9 | const useUserStore = defineStore( |
| 10 | // 唯一ID | 10 | // 唯一ID |
| ... | @@ -17,6 +17,7 @@ const useUserStore = defineStore( | ... | @@ -17,6 +17,7 @@ const useUserStore = defineStore( |
| 17 | const userId = ref(localStorage.userId ?? '') | 17 | const userId = ref(localStorage.userId ?? '') |
| 18 | const userName = ref(localStorage.userName ?? '') | 18 | const userName = ref(localStorage.userName ?? '') |
| 19 | const userData = ref(localStorage.userData ?? '{}') | 19 | const userData = ref(localStorage.userData ?? '{}') |
| 20 | const currentTenantGuid = ref(localStorage.currentTenantGuid ?? ''); | ||
| 20 | const userInfoData = ref(JSON.parse(localStorage.userInfoData ?? "[]")) | 21 | const userInfoData = ref(JSON.parse(localStorage.userInfoData ?? "[]")) |
| 21 | const token = ref(localStorage.token ?? '') | 22 | const token = ref(localStorage.token ?? '') |
| 22 | const tabbarMap: any = ref({}) | 23 | const tabbarMap: any = ref({}) |
| ... | @@ -30,10 +31,14 @@ const useUserStore = defineStore( | ... | @@ -30,10 +31,14 @@ const useUserStore = defineStore( |
| 30 | const timer: any = ref(null); | 31 | const timer: any = ref(null); |
| 31 | //获取token. | 32 | //获取token. |
| 32 | function getToken(data, state) { | 33 | function getToken(data, state) { |
| 33 | data.platformGuid = "6646dcad76c411eea911fa163e419da9"; | 34 | data.platformGuid = "7f16f697aec111ef8656fa163e60becd"; |
| 34 | data.userType = 2; | 35 | data.userType = 2; |
| 35 | isLogin.value = true; | 36 | data.validateUri = location.origin + '/'; |
| 37 | debugger | ||
| 38 | debugger | ||
| 36 | return getTokenPromise.value = getTokenByCode(data).then((res: any) => { | 39 | return getTokenPromise.value = getTokenByCode(data).then((res: any) => { |
| 40 | debugger | ||
| 41 | debugger | ||
| 37 | getTokenPromise.value = null; | 42 | getTokenPromise.value = null; |
| 38 | console.log(res); | 43 | console.log(res); |
| 39 | if (res.code == '00000') { | 44 | if (res.code == '00000') { |
| ... | @@ -41,25 +46,24 @@ const useUserStore = defineStore( | ... | @@ -41,25 +46,24 @@ const useUserStore = defineStore( |
| 41 | isLogin.value = true; | 46 | isLogin.value = true; |
| 42 | localStorage.setItem('code', `${data.code}`); | 47 | localStorage.setItem('code', `${data.code}`); |
| 43 | localStorage.setItem('state', state); | 48 | localStorage.setItem('state', state); |
| 44 | localStorage.setItem('token', res.data.access_token || ""); | 49 | localStorage.setItem('token', res.data.token || ""); |
| 45 | token.value = res.data.access_token; | 50 | token.value = res.data.access_token; |
| 46 | localStorage.setItem('refresh_token', res.data.refresh_token || ""); | 51 | localStorage.setItem('refresh_token', res.data.refreshToken || ""); |
| 47 | const expiresIn = (Date.now() + 1700000) + ""; | 52 | const expiresIn = (Date.now() + 1700000) + ""; |
| 48 | localStorage.setItem('expiresIn', expiresIn); | 53 | localStorage.setItem('expiresIn', expiresIn); |
| 49 | refreshUserToken(); | 54 | refreshUserToken(); |
| 50 | //获取用户信息 | 55 | //获取用户信息 |
| 51 | localStorage.setItem('account', res.data.logonUser) | ||
| 52 | localStorage.setItem('userId', res.data.userId) | ||
| 53 | localStorage.setItem('userName', res.data.userName) | ||
| 54 | localStorage.setItem('userData', JSON.stringify(res.data.data)) | ||
| 55 | account.value = res.data.logonUser | 56 | account.value = res.data.logonUser |
| 56 | userId.value = res.data.userId | 57 | userId.value = res.data.userId |
| 57 | userName.value = res.data.userName | 58 | userName.value = res.data.userName |
| 58 | userData.value = JSON.stringify(res.data.data) | 59 | // userData.value = JSON.stringify(res.data.data); |
| 59 | return getUserInfo().then((info: any) => { | 60 | currentTenantGuid.value = res.data.tenantInfoList && res.data.tenantInfoList.length ? res.data.tenantInfoList[0].guid : ''; |
| 61 | let currentTenant = res.data.tenantInfoList?.[0]; | ||
| 62 | return getSystemMenu({ tenantGuid: currentTenantGuid.value }).then((info: any) => { | ||
| 60 | if (info.code == '00000') { | 63 | if (info.code == '00000') { |
| 61 | localStorage.setItem('userInfoData', JSON.stringify(info.data)) | 64 | localStorage.setItem('userName', currentTenant?.name) |
| 62 | userInfoData.value = info.data | 65 | localStorage.setItem('userInfoData', JSON.stringify(info.data)); |
| 66 | userInfoData.value = info.data; | ||
| 63 | } else { | 67 | } else { |
| 64 | ElMessage.error(info.msg) | 68 | ElMessage.error(info.msg) |
| 65 | } | 69 | } | ... | ... |
-
Please register or sign in to post a comment