diff --git a/pingan/.env b/pingan/.env index b34b128..cb00381 100644 --- a/pingan/.env +++ b/pingan/.env @@ -1,2 +1,5 @@ VUE_APP_NAME=超级车补管理后台 VUE_APP_API_BASE_URL=https://hcb.liche.cn/pingan +# webSocket配置 +VUE_APP_WS_URL=wss://api.ss.haodian.cn/wss +VUE_APP_WS_PLATFORM=2 diff --git a/pingan/.env.development b/pingan/.env.development index 7a0ad44..a777c50 100644 --- a/pingan/.env.development +++ b/pingan/.env.development @@ -1,3 +1,6 @@ VUE_APP_API_BASE_URL=/pingan URL = http://agent.admin.haodian.cn PORT = 8200 +# webSocket配置 +VUE_APP_WS_URL=ws://api.ss.haodian.cn/wss +VUE_APP_WS_PLATFORM=2 diff --git a/pingan/src/api/user/notice/index.js b/pingan/src/api/user/notice/index.js new file mode 100644 index 0000000..5c20745 --- /dev/null +++ b/pingan/src/api/user/notice/index.js @@ -0,0 +1,38 @@ +import request from '@/utils/request'; + +/** + * 通知列表 + * @param params 查询条件 + */ +export async function pageNotice(params) { + const res = await request.get('/user/notice/page', { + params + }); + if (res.data.code === 0) { + return res.data.data; + } + return Promise.reject(new Error(res.data.message)); +} + +/** + * 获取未读消息数 + * @param params + * @returns {Promise<*>} + */ +export async function unRead(params) { + const res = await request.get('/user/notice/unRead', { + params + }); + if (res.data.code === 0) { + return res.data.data; + } + return Promise.reject(new Error(res.data.message)); +} + +export async function setRead(data) { + const res = await request.post('/user/notice/read', data); + if (res.data.code === 0) { + return res.data.message; + } + return Promise.reject(new Error(res.data.message)); +} diff --git a/pingan/src/config/setting.js b/pingan/src/config/setting.js index d909a6d..5bd95ab 100644 --- a/pingan/src/config/setting.js +++ b/pingan/src/config/setting.js @@ -63,3 +63,6 @@ export const MAP_KEY = '006d995d433058322319fa797f2876f5'; // EleAdmin 授权码, 自带的只能用于演示, 正式项目请更换为自己的授权码 export const LICENSE_CODE = 'dk9mcwJyetRWQlxWRiojIqJWdzJCLi4Wa4QDN5ojI0NWZI1kI6ICZpJCLiwiIVNzVz4UW6Iibvl2cyVmdQfiETMuEjI0NW=='; + +// token 存储的名称 +export const WEB_SOCKET_TOKEN_STORE_NAME = 'websocket_access_token'; diff --git a/pingan/src/layout/components/header-notice.vue b/pingan/src/layout/components/header-notice.vue index d7124cc..c580ae5 100644 --- a/pingan/src/layout/components/header-notice.vue +++ b/pingan/src/layout/components/header-notice.vue @@ -10,13 +10,16 @@ > - +
-
{{ item.title }}
-
{{ item.time }}
+
{{ item.content }}
+
{{ item.c_time }}
@@ -36,12 +39,13 @@
清空通知
- + 查看更多
+ diff --git a/pingan/src/layout/components/header-tools.vue b/pingan/src/layout/components/header-tools.vue index 7a66584..328893c 100644 --- a/pingan/src/layout/components/header-tools.vue +++ b/pingan/src/layout/components/header-tools.vue @@ -16,11 +16,9 @@
--> -
@@ -59,7 +57,7 @@ diff --git a/pingan/src/views/user/notice/components/message-notice.vue b/pingan/src/views/user/notice/components/message-notice.vue new file mode 100644 index 0000000..8c91baf --- /dev/null +++ b/pingan/src/views/user/notice/components/message-notice.vue @@ -0,0 +1,158 @@ + + + diff --git a/pingan/src/views/user/notice/components/message-todo.vue b/pingan/src/views/user/notice/components/message-todo.vue new file mode 100644 index 0000000..5429212 --- /dev/null +++ b/pingan/src/views/user/notice/components/message-todo.vue @@ -0,0 +1,149 @@ + + + diff --git a/pingan/src/views/user/notice/index.vue b/pingan/src/views/user/notice/index.vue new file mode 100644 index 0000000..993a118 --- /dev/null +++ b/pingan/src/views/user/notice/index.vue @@ -0,0 +1,179 @@ + + + + +