Przeglądaj źródła

前端用户中心

lusa 3 tygodni temu
rodzic
commit
f1de90b5b0

+ 1 - 1
Jenkinsfile

@@ -178,7 +178,7 @@ pipeline {
                             remote.password = passwordHW
                         }
 //                         if (params.module == 'sp-user-mobile-center') {
-                           sh """cd ${params.modulePrefix}/${params.module} && npm install  && npm run build:${params.profile}"""
+                           sh """cd ${params.modulePrefix}/${params.module} && npm install  && npm run ${params.profile}"""
 //                         } else {
 //                            sh """cd ${params.modulePrefix}/${params.module} && npm install  && npm run ${params.profile}"""
 //                         }

+ 7 - 7
ui/sp-storlead-center/src/api/public.ts

@@ -174,27 +174,27 @@ export const listMessage = (data: any) => {
 
 /**
  * 获取类型以及未读数量
- * @param data
+ * @param appId 应用ID
  * @returns {*}
  */
-export const getMessageType = () => {
+export const getMessageType = (appId?: string | number) => {
     return request({
-        url: '/sys/inside/message/getNoReadCount',
+        url: '/sys/message/getNoReadCount',
         method: 'post',
-        data: {}
+        data: { appId }
     });
 };
 
 /**
  * 获取公告未读数量
- * @param data
+ * @param appId 应用ID
  * @returns {*}
  */
-export const getBulletinUnreadCount = () => {
+export const getBulletinUnreadCount = (appId?: string | number) => {
     return request({
         url: '/bulletin/unread-count',
         method: 'get',
-        params: {}
+        params: { appId }
     });
 };
 

+ 10 - 2
ui/sp-storlead-center/src/api/system/bulletin/types.ts

@@ -128,12 +128,16 @@ export interface BulletinForm extends BaseEntity {
    * 显示顺序
    */
   sort?: number;
-  columnValue?: string|number;
+    columnValue?: string|number;
   noticeUserIdList?: string[]|number[];
   isTalk?: number;
   remindMode?: string;
   fileIds?: string[];
   files?: string;
+  /**
+   * 所属应用id
+   */
+  appId?: string | number;
 
 }
 
@@ -198,11 +202,15 @@ export interface BulletinQuery extends PageQuery {
    * 日期范围参数
    */
   params?: any;
-  blurry?: string;
+    blurry?: string;
   startDate?: string;
   endDate?: string;
   columnValue?: string|number;
   createByIds?: string[]|number[];
+  /**
+   * 所属应用id
+   */
+  appId?: string | number;
 }
 
 

+ 2 - 0
ui/sp-storlead-center/src/layout/components/Navbar.vue

@@ -148,6 +148,8 @@ const getFirstLeafPath = (routes: any[], parentPath = ''): string => {
 // 切换应用系统:更新激活应用并跳转第一个可用路由
 const switchApp = (app: any) => {
     permissionStore.setActiveApp(app.appId);
+    // 切换应用后立即刷新消息未读数
+    useNoticeStore().getMessageCount(app.appId);
     const targetPath = getFirstLeafPath(app.children);
     if (targetPath) {
         router.push(targetPath).catch(() => {});

+ 14 - 1
ui/sp-storlead-center/src/layout/components/notice/index.vue

@@ -70,6 +70,9 @@
     import { listMessage, getMessageType, updateRead, updateReadAll, clearRead } from '@/api/public'
     import setMsgTools from './SetMsgTools.vue'
     import moment from "moment";
+    import { usePermissionStore } from '@/store/modules/permission';
+
+    const permissionStore = usePermissionStore();
 
     const typeData = ref([])
     const setMsgToolsRef = ref()
@@ -81,6 +84,7 @@
         pageIndex: 1,
         pageSize: 10,
         messageType: 0,
+        appId: undefined as string | number | undefined,
     })
 
     const noticeData = ref([])
@@ -88,7 +92,7 @@
 
     const router = useRouter();
     const getType = () => {
-        getMessageType().then(res => {
+        getMessageType(permissionStore.activeAppId).then(res => {
             if(res.success) {
                 typeData.value = res.result
                 search.value.messageType = Number(router.currentRoute.value.query.messageType) as number
@@ -189,7 +193,16 @@
         }
     });
 
+    // 监听应用切换,刷新消息类型和列表
+    watch(() => permissionStore.activeAppId, (newAppId) => {
+        if (newAppId) {
+            search.value.appId = newAppId;
+            getType();
+        }
+    });
+
     onMounted(() => {
+        search.value.appId = permissionStore.activeAppId;
         getType()
     })
 </script>

+ 3 - 2
ui/sp-storlead-center/src/permission.ts

@@ -92,11 +92,12 @@ router.beforeEach(async (to, from, next) => {
                     });
                     // 邮箱页面不需要循环调未读数接口
                     if(to.path.indexOf('/email') == -1) {
+                        const currentAppId = usePermissionStore().activeAppId;
                         useNoticeStore().getCount() // 邮箱未读
-                        useNoticeStore().getMessageCount() // 消息未读
+                        useNoticeStore().getMessageCount(currentAppId) // 消息未读
                         setInterval(() => {
                             useNoticeStore().getCount()
-                            useNoticeStore().getMessageCount()
+                            useNoticeStore().getMessageCount(usePermissionStore().activeAppId)
                         }, 1000 * 60)
                     }
                     next({...to, replace: true}); // hack方法 确保addRoutes已完成

+ 4 - 4
ui/sp-storlead-center/src/store/modules/notice.ts

@@ -44,14 +44,14 @@ export const useNoticeStore = defineStore('notice', () => {
     })
   }
 
-  // 获取消息未读数
-  const getMessageCount = async() => {
-    await getMessageType().then(res => {
+    // 获取消息未读数
+  const getMessageCount = async(appId?: string | number) => {
+    await getMessageType(appId).then(res => {
       let countList = (res.result || []).map(item => item.stateNumber)
       state.messageNoReadCount = eval(countList.join("+"))
       state.messageData = res.result || []
     })
-    await getBulletinUnreadCount().then(res => {
+    await getBulletinUnreadCount(appId).then(res => {
       state.bulletinNoReadCount = res.result.count
     })
   }

+ 1 - 1
ui/sp-storlead-center/src/utils/request.ts

@@ -182,7 +182,7 @@ service.interceptors.response.use(
     } else if (message.includes('Request failed with status code')) {
       message = '系统接口' + message.substr(message.length - 3) + '异常';
     }
-    let msgUrls  = ['/sys/inside/message/getNoReadCount', '/mail/get_new_mail', '/mail/receive_mail']
+    let msgUrls  = ['/sys/message/getNoReadCount', '/mail/get_new_mail', '/mail/receive_mail']
     if(msgUrls.includes(error?.config?.url)) {
       return false
     }else {

+ 2 - 2
ui/sp-user-center/src/api/public.ts

@@ -166,7 +166,7 @@ export const listExport = (query: any) => {
  */
 export const listMessage = (data: any) => {
     return request({
-        url: '/sys/inside/message/pageList',
+        url: '/sys/message/pageList',
         method: 'post',
         data
     });
@@ -179,7 +179,7 @@ export const listMessage = (data: any) => {
  */
 export const getMessageType = () => {
     return request({
-        url: '/sys/inside/message/getNoReadCount',
+        url: '/sys/message/getNoReadCount',
         method: 'post',
         data: {}
     });

+ 1 - 1
ui/sp-user-center/src/utils/request.ts

@@ -248,7 +248,7 @@ service.interceptors.response.use(
     } else if (message.includes('Request failed with status code')) {
       message = '系统接口' + message.substr(message.length - 3) + '异常';
     }
-    let msgUrls  = ['/sys/inside/message/getNoReadCount', '/mail/get_new_mail', '/mail/receive_mail']
+    let msgUrls  = ['/sys/message/getNoReadCount', '/mail/get_new_mail', '/mail/receive_mail']
     if(msgUrls.includes(error?.config?.url)) {
       return false
     }else {