Browse Source

我的消息

Z 2 năm trước cách đây
mục cha
commit
9395428724
4 tập tin đã thay đổi với 47 bổ sung10 xóa
  1. 34 0
      api/wt/index.js
  2. 1 1
      pages.json
  3. 11 8
      pages/home/components/navigation.vue
  4. 1 1
      pages/login/login.vue

+ 34 - 0
api/wt/index.js

@@ -5,6 +5,40 @@ import {
 	postJ
 } from "@/utils/request";
 import Vue from "vue";
+
+
+//获取我的消息列表
+export async function notifyMessagePageAPI(params, loding = true) {
+	const res = await postJ(
+		Vue.prototype.apiUrl + `/sys/notifymessage/page`, params, loding
+	);
+	if (res.code == 0) {
+		return res.data;
+	}
+	return Promise.reject(new Error(res.message));
+}
+
+//更新已读-指定消息ID
+export async function updateNotifyMessageReadByIdAPI(params, loding = true) {
+	const res = await postJ(
+		Vue.prototype.apiUrl + `/sys/notifymessage/updateNotifyMessageRead`, params, loding
+	);
+	if (res.code == 0) {
+		return res.data;
+	}
+	return Promise.reject(new Error(res.message));
+}
+//获取某用户的未读消息条数
+export async function getUnreadNotifyMessageCountAPI() {
+	const res = await get(
+		Vue.prototype.apiUrl + `/sys/notifymessage/getUnreadNotifyMessageCount`, '', false
+	);
+	if (res.code == 0) {
+		return res.data;
+	}
+	return Promise.reject(new Error(res.message));
+}
+
 //获取待办事项列表
 export async function getTodoTaskPage(query, loding = true) {
 	const res = await get(

+ 1 - 1
pages.json

@@ -42,7 +42,7 @@
 			}
 		},
 		{
-			"path": "pages/home/msg/msg",
+			"path": "pages/home/wt/message/message",
 			"style": {
 				"navigationBarTitleText": "我的消息",
 				"navigationStyle": "custom",

+ 11 - 8
pages/home/components/navigation.vue

@@ -9,7 +9,7 @@
 </template>
 
 <script>
-	import { getTodoTaskPage } from '@/api/wt/index.js'
+	import { getTodoTaskPage,getUnreadNotifyMessageCountAPI } from '@/api/wt/index.js'
 	export default {
 		data() {
 			return {
@@ -20,13 +20,13 @@
 						link_url: '/pages/home/myTicket/myTicket',
 						badge: 0
 					},
-					// {
-					// 	class: 'iconfont icon-dangqiangaojing',
-					// 	title: '我的消息',
-					// 	link_url: '/pages/home/msg/msg',
-					// 	badge: 0
-					// 	// "num": 1
-					// },
+					{
+						class: 'iconfont icon-dangqiangaojing',
+						title: '我的消息',
+						link_url: '/pages/home/wt/message/message',
+						badge: 0
+						// "num": 1
+					},
 					{
 						class: 'iconfont icon-kuneipandian ',
 						title: '我的待办',
@@ -73,8 +73,11 @@
 				//     // this.workList[3].badge = result[1].data.doneCount
 				//   }
 				// })
+				
 				const res = await getTodoTaskPage({}, false)
 				this.workList[2].badge = res.count
+				const messageCount = await getUnreadNotifyMessageCountAPI()
+				this.workList[1].badge = Number(messageCount)
 			}
 		}
 	}

+ 1 - 1
pages/login/login.vue

@@ -156,7 +156,7 @@
 						console.log(res)
 						let data = res.data
 						uni.setStorageSync('token', data.token)
-
+            uni.setStorageSync("userInfo", data);
 						uni.showToast({
 							title: '登录成功',
 							icon: 'success',