dedsudiyu hai 11 meses
pai
achega
836381b9d1
Modificáronse 3 ficheiros con 99 adicións e 39 borrados
  1. 6 0
      pages.json
  2. 36 8
      pages/api/index.js
  3. 57 31
      pages/views/information/information.vue

+ 6 - 0
pages.json

@@ -25,6 +25,12 @@
 				"navigationBarTitleText": "消息"
 			}
 		},
+		{
+			"path": "pages/views/information/informationInfo",//消息
+			"style": {
+				"navigationBarTitleText": "消息详情"
+			}
+		},
 		{
 			"path": "pages/views/home/home",//首页
 			"style": {

+ 36 - 8
pages/api/index.js

@@ -34,14 +34,6 @@ export const getLogoInfo  = (data) => {
         data: data,
     })
 };
-//消息列表
-export const systemNoticeGetNoticeList = (data) => {
-	return apiResquest({
-		url: `/system/notice/getNoticeList`,
-		method: 'GET',
-		data: data,
-	})
-};
 //化学品登录-扫码验证
 export const chemicalAioIdentityScanLogin = (data) => {
 	return apiResquest({
@@ -202,6 +194,42 @@ export const chemicalAioVerifyAppletLogin  = (data) => {
 };
 
 
+/************************消息相关************************/
+
+//消息-未读消息数量
+export const systemNoticeGetNoticeCount  = (id,data) => {
+    return apiResquest({
+        url: `/system/notice/getNoticeCount`,
+        method: 'GET',
+        data: data,
+    })
+};
+//消息-列表
+export const systemNoticeGetNoticeList  = (data) => {
+    return apiResquest({
+        url: `/system/notice/getNoticeList`,
+        method: 'GET',
+        data: data,
+    })
+};
+//消息-详情
+export const systemNoticeGetNoticeDetail  = (data) => {
+    return apiResquest({
+        url: `/system/notice/getNoticeDetail`,
+        method: 'GET',
+        data: data,
+    })
+};
+
+//消息-获取系统消息类型
+export const systemNoticeGetNoticeType  = (data) => {
+    return apiResquest({
+        url: `/system/notice/getNoticeType`,
+        method: 'GET',
+        data: data,
+    })
+};
+
 /************************未调试************************/
 
 

+ 57 - 31
pages/views/information/information.vue

@@ -6,8 +6,8 @@
 				<img src="@/pages/images/icon_xx_tz.png">
 				<view class="right-box">
 					<view class="top-box">
+						<view>{{item.className}}</view>
 						<view>{{item.userName}}</view>
-						<view>{{item.deptName}}</view>
 						<view>{{item.sendTime}}</view>
 					</view>
 					<view class="bottom">{{item.title}}</view>
@@ -21,32 +21,29 @@
 
 <script>
 	import {
+		parseTime
+	} from '@/component/public.js'
+	import {
+		systemNoticeGetNoticeType,
 		systemNoticeGetNoticeList
 	} from '@/pages/api/index.js'
-	// #ifdef MP-WEIXIN
 	import {
 		tabBar
 	} from '@/pages/component/tabBar.vue'
-	// #endif
 	export default {
-		// #ifdef MP-WEIXIN
 		components: {
 			tabBar
 		},
-		// #endif
-		// #ifdef H5
-		components: {
-			"tabBar": () => import('@/pages/component/tabBar.vue'),
-		},
-		// #endif
 		data() {
 			return {
 				queryParams: {
 					page: 1,
-					pageSize: 20,
+					pageSize: 10,
 				},
 				total: 0,
 				dataList: [],
+				getDataType: false,
+				typeList: [],
 			}
 		},
 		onLoad() {
@@ -56,22 +53,27 @@
 
 		},
 		mounted() {
-			this.getList();
+			this.systemNoticeGetNoticeType();
 		},
 		methods: {
+			//详情页
+			goInfoPage(item) {
+				console.log('item',item)
+				uni.navigateTo({
+					url: '/pages/views/information/informationInfo?item=' + encodeURIComponent(JSON.stringify(item))
+				});
+			},
 			//滚动事件
 			scrollGet() {
 				let self = this;
 				if (self.total / self.queryParams.pageSize <= self.queryParams.page) {
-					console.log('没有更多数据!')
+					this.$set(this, 'getDataType', true);
 				} else {
-					setTimeout(function() {
-						self.queryParams.page += 1;
-						self.getList();
-					}, 1000)
-
+					this.queryParams.page += 1;
+					this.$nextTick(() => {
+						this.getList();
+					})
 				}
-
 			},
 			//获取列表数据
 			async getList() {
@@ -80,16 +82,39 @@
 					data
 				} = await systemNoticeGetNoticeList(this.queryParams);
 				if (data.code == 200) {
-					this.dataList = [...this.dataList, ...data.data.records]
-					this.total = data.data.total;
+					data.data.records.forEach((item) => {
+						this.typeList.forEach((typeItem) => {
+							if (typeItem.code == item.noticeType) {
+								item.sendTime = parseTime(item.sendTime, "{y}-{m}-{d} {h}:{i}");
+								item.className = typeItem.name;
+							}
+						})
+					})
+					if (self.queryParams.page == 1) {
+						this.dataList = data.data.records;
+						this.total = data.data.total;
+						if (data.data.total / self.queryParams.pageSize <= self.queryParams.page) {
+							this.$set(this, 'getDataType', true);
+						}
+					} else {
+						this.dataList = [...this.dataList, ...data.data.records]
+						this.total = data.data.total;
+						if (data.data.total / self.queryParams.pageSize <= self.queryParams.page) {
+							this.$set(this, 'getDataType', true);
+						}
+					}
 				}
 			},
-			formatDate(date) {
-				let newDate = new Date(date);
-				let YY = newDate.getFullYear() + '-';
-				let MM = (newDate.getMonth() + 1 < 10 ? '0' + (newDate.getMonth() + 1) : newDate.getMonth() + 1) + '-';
-				let DD = (newDate.getDate() < 10 ? '0' + (newDate.getDate()) : newDate.getDate());
-				return YY + MM + DD;
+			//获取系统消息类型
+			async systemNoticeGetNoticeType() {
+				let self = this;
+				const {
+					data
+				} = await systemNoticeGetNoticeType();
+				if (data.code == 200) {
+					this.$set(this, 'typeList', data.data);
+					this.getList();
+				}
 			},
 		}
 	}
@@ -128,6 +153,7 @@
 
 				.right-box {
 					flex: 1;
+					overflow: hidden;
 
 					.top-box {
 						display flex;
@@ -141,20 +167,20 @@
 						}
 
 						view:nth-child(2) {
-
 							font-size: 24rpx;
-							color: #CCCCCC;
+							color: #999;
 							flex: 1;
-							white-space: nowrap;
+							display: block;
 							overflow: hidden;
 							text-overflow: ellipsis;
+							white-space: nowrap;
 
 
 						}
 
 						view:nth-child(3) {
 							font-size: 20rpx;
-							color: #CCCCCC;
+							color: #999;
 							text-align right;
 						}
 					}