diff --git a/txw-mhzc-web/src/pages/index/api/mhzc-user/index.js b/txw-mhzc-web/src/pages/index/api/mhzc-user/index.js index 0c2b9be..50d0104 100644 --- a/txw-mhzc-web/src/pages/index/api/mhzc-user/index.js +++ b/txw-mhzc-web/src/pages/index/api/mhzc-user/index.js @@ -4,7 +4,7 @@ import { fetchSso } from '@/core/request'; * 门户用户相关 API */ export const getProfile = () => { - return fetchSso({ url: '/mhzc/user/profile', method: 'GET' }); + return fetchSso({ url: '/mhzc/user/init', method: 'POST' }); }; export const updateProfile = (data) => { diff --git a/txw-mhzc-web/src/pages/index/views/fwsc/sjsc.vue b/txw-mhzc-web/src/pages/index/views/fwsc/sjsc.vue index fdbc52e..2cc2bc7 100644 --- a/txw-mhzc-web/src/pages/index/views/fwsc/sjsc.vue +++ b/txw-mhzc-web/src/pages/index/views/fwsc/sjsc.vue @@ -231,6 +231,7 @@ export default { }; }, mounted() { + this.initUser(); this.loadDmList(); this.searchList(); // 检查是否需要直接打开发布面板 @@ -239,6 +240,17 @@ export default { } }, methods: { + async initUser() { + if (!hasLogin()) { + return; + } + try { + const { data } = await gxzxApi.init({}); + window.sessionStorage.setItem('yhxx', JSON.stringify(data)); + } catch (error) { + console.error('获取用户信息失败', error); + } + }, // 加载代码表 loadDmList() { this.sshyoptionsSearch(); diff --git a/txw-mhzc-web/src/pages/index/views/fwsc/xqsc.vue b/txw-mhzc-web/src/pages/index/views/fwsc/xqsc.vue index d59978c..232b231 100644 --- a/txw-mhzc-web/src/pages/index/views/fwsc/xqsc.vue +++ b/txw-mhzc-web/src/pages/index/views/fwsc/xqsc.vue @@ -214,6 +214,7 @@ import NewNav from '@/pages/index/components/new-nav/index.vue'; import BreadcrumbNav from '@/pages/index/components/breadcrumb/index.vue'; import XqscPublish from './components/XqscPublish.vue'; import api from '@/pages/index/api/fwsc/index.js'; +import { hasLogin } from '@/pages/index/api/login'; import { scrollPortalContentToTop } from '@/pages/index/utils/portal-scroll-mode'; import portalFigmaScaleMixin from '@/pages/index/utils/portal-figma-scale-mixin'; import comingSoonMixin from '@/pages/index/utils/coming-soon-mixin'; @@ -270,6 +271,7 @@ export default { }; }, mounted() { + this.initUser(); this.loadDmList(); this.searchList(); // 检查是否需要直接打开发布面板 @@ -278,6 +280,17 @@ export default { } }, methods: { + async initUser() { + if (!hasLogin()) { + return; + } + try { + const { data } = await api.init({}); + window.sessionStorage.setItem('yhxx', JSON.stringify(data)); + } catch (error) { + console.error('获取用户信息失败', error); + } + }, // 加载代码表 loadDmList() { this.xqlxoptionsSearch();