diff --git a/src/api/shop.js b/src/api/shop.js index 83dd852..f84cfdd 100644 --- a/src/api/shop.js +++ b/src/api/shop.js @@ -159,4 +159,31 @@ export function updateAccount(data) { url: '/merchantInfo/detail/updateAccount', data }) -} \ No newline at end of file +} + +/** + * 机构详情信息 + * @param {*} data + * @returns + */ +export function agencyInfo(params) { + return request({ + method: 'get', + url: `/agency/AgencyInfo`, + params + }) +} + +/** + * 更改机构详情 + * @param {*} data + * @returns + */ +export function updateAgency(data) { + return request({ + method: 'post', + url: '/agency/updateAgency', + data + }) +} + diff --git a/src/api/user.js b/src/api/user.js index cbcfea1..6725587 100644 --- a/src/api/user.js +++ b/src/api/user.js @@ -13,3 +13,16 @@ export function getUserInfo() { url: "/user/getUserInfoByToken", }); } + +/** + * 获取消息列表 + * @param {*} params + * @returns + */ +export function getNotices(params) { + return request({ + method: 'get', + url: '/notification/page', + params + }) +} diff --git a/src/router/index.js b/src/router/index.js index fcc45cf..8c2a785 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -5,6 +5,7 @@ import _hook from "@/hooks/index.js"; import { useRoutes } from "@/store/routes.js"; import NProgress from "nprogress"; import "nprogress/nprogress.css"; +import { useUser } from "@/store/user.js"; const router = createRouter({ history: createWebHistory(), @@ -15,6 +16,7 @@ NProgress.configure({ showSpinner: false }); router.beforeEach(async (to, from, next) => { NProgress.start(); const token = _hook.useLocalStorage.get("token"); + const storeUser = useUser(); if (to.path === "/login" && !token) { next(); NProgress.done(); @@ -36,6 +38,7 @@ router.beforeEach(async (to, from, next) => { storeRoutes.setNavbar(to.path); next(); NProgress.done(); + storeUser.getNotices() } } } diff --git a/src/router/routes.js b/src/router/routes.js index 83813d2..a86767a 100644 --- a/src/router/routes.js +++ b/src/router/routes.js @@ -292,6 +292,16 @@ export const asyncRoutes = [ title: '大机构', icon: 'Tickets' } + }, + { + path: '/organization/big_organization/agent_detail', + name: 'agent_detail', + component: () => import('@/views/organization/agent_detail.vue'), + meta: { + title: '机构详情', + isHide: true, + activeMenu: '/organization/big_organization' + } } ] }, @@ -520,5 +530,27 @@ export const asyncRoutes = [ } } ] + }, + { + path: '/notice', + component: layout, + meta: { + title: '消息管理', + isHide: true, + roles: ['MG'] + }, + redirect: '/notice/index', + children: [ + { + isHide: true, + path: '/notice/index', + name: 'noticeIndex', + component: () => import('@/views/notice/index.vue'), + meta: { + title: '消息列表', + isHide: true, + } + } + ] } ]; diff --git a/src/store/user.js b/src/store/user.js index cadcfd1..2459dd8 100644 --- a/src/store/user.js +++ b/src/store/user.js @@ -1,12 +1,16 @@ import { defineStore } from "pinia"; import _hook from "@/hooks/index.js"; -import { login, getUserInfo } from "@/api/user.js"; +import { login, getUserInfo, getNotices } from "@/api/user.js"; export const useUser = defineStore("useUser", { state: () => { return { userInfo: {}, token: _hook.useLocalStorage.get("token") || "", + notices: { + num: 0, + list: [] + } }; }, getters: {}, @@ -40,5 +44,20 @@ export const useUser = defineStore("useUser", { return res.userInfo; }); }, + /** + * 获取消息列表 + */ + async getNotices() { + try { + const res = await getNotices({ + currPage: 1, + size: 10 + }) + this.notices.num = res.unread + this.notices.list = res.list.list + } catch (error) { + console.error('获取消息列表error=', error) + } + } }, }); diff --git a/src/views/layout/components/pageHeader.vue b/src/views/layout/components/pageHeader.vue index 16c756a..1236d31 100644 --- a/src/views/layout/components/pageHeader.vue +++ b/src/views/layout/components/pageHeader.vue @@ -14,6 +14,45 @@