Browse Source

分类消息

wgl 4 years ago
parent
commit
ed0e4b7041

+ 1 - 1
.env.development

@@ -2,7 +2,7 @@ NODE_ENV=devlopment
 VUE_APP_NODE_NAME=devlopment
 OUT_PUT_NAME=dev
 VUE_APP_LOCAL_STORAGE_PREFIX=dev
-VUE_APP_BACKEND_URL=http://192.168.33.120:8086/jp-housekeeper-server/
+VUE_APP_BACKEND_URL=https://ykt-test.xiaoxinda.com/jp-housekeeper-server/
 #小鹏管家微信appid
 VUE_APP_WXAPPID=wx7e70eb62a8459869
 VUE_APP_AUTH=

+ 1 - 1
config/project.js

@@ -1 +1 @@
-exports.name = 'home'
+exports.name = 'business'

+ 36 - 0
src/projects/business/apis/Common/notice.js

@@ -27,3 +27,39 @@ export function sendMessage(params) {
 		method: 'post',
 	})
 }
+
+//============================新接口========================
+//获取最新消息列表
+export function getTopList(params) {
+	return request({
+		url: '/mobile/messageApi/topList',
+		data: Qs.stringify(params),
+		method: 'post',
+	})
+}
+
+//消息分组
+export function getGroupList(params) {
+	return request({
+		url: '/mobile/messageApi/groupList',
+		data: Qs.stringify(params),
+		method: 'post',
+	})
+}
+
+//消息分页列表
+export function getMessageList(params) {
+	return request({
+		url: '/mobile/messageApi/pageList',
+		data: Qs.stringify(params),
+		method: 'post',
+	})
+}
+
+//查看消息
+export function getMessageInfo(id) {
+	return request({
+		url: '/mobile/messageApi/view/' + id,
+		method: 'get',
+	})
+}

+ 4 - 6
src/projects/business/views/Common/Notice/Home.vue

@@ -41,7 +41,7 @@
 		},
 		data() {
 			return {
-				pageTitle: '通知公告',
+				pageTitle: '消息列表',
 
 				isLoading: false,
 
@@ -49,19 +49,17 @@
 					pageIndex: 1,
 					pageSize: 20,
 					totalPage: 1,
-					openId: '',
+					type: this.$route.query.type
 				},
 				recordList: [],
 			}
 		},
-		created() {
-			this.listForm.openId = this.openId;
-		},
+		created() {},
 		methods: {
 			//获取列表
 			getList() {
 				this.isLoading = true;
-				API_Notice.getNoticeList(this.listForm).then(response => {
+				API_Notice.getMessageList(this.listForm).then(response => {
 					if (response) {
 						if (this.listForm.pageIndex == 1) {
 							this.recordList = response.data;

+ 27 - 12
src/projects/business/views/Common/Notice/Info.vue

@@ -11,15 +11,13 @@
 				</div>
 				<p v-html="detail.content"></p>
 			</div>
-			<!-- <div class="vongi-notice-list">
+			<div v-if="noticeList.length" class="vongi-notice-list">
 				<h3><img src="~$project/assets/img/text.png" width="12" />相关内容</h3>
 				<div class="vongi-floor-padded">
-					<a href="" class="mui-ellipsis"> 关联新闻内容1 </a>
-					<a href="" class="mui-ellipsis">
-						9月园区活动通知9月园区活动通知9月园区活动通知9月园区活动通知9月园区活动通知
-					</a>
+					<router-link :to="{name:'CommonNoticeInfo',query:{id:item.id}}" v-for="(item,index) in noticeList" class="mui-ellipsis"
+					 v-text="item.title"></router-link>
 				</div>
-			</div> -->
+			</div>
 		</div>
 
 		<loading :visible="isLoading"></loading>
@@ -44,14 +42,14 @@
 		},
 		data() {
 			return {
-				pageTitle: '通知公告',
+				pageTitle: '消息详情',
 
 				isLoading: false,
 
-				subForm: {
-					id: this.$route.query.id
-				},
+				id: this.$route.query.id,
 				detail: [],
+
+				noticeList: [],
 			}
 		},
 		created() {
@@ -61,11 +59,28 @@
 			//获取详情
 			getDetail() {
 				this.isLoading = true;
-				API_Notice.getNoticeInfo(this.subForm).then(response => {
+				API_Notice.getMessageInfo(this.id).then(response => {
 
-					this.detail = response.messageNotice;
+					this.detail = response;
 
 					this.isLoading = false;
+					//获取最新5条通知消息
+					this.getLastNotice();
+				}).catch(error => {
+					this.isLoading = false;
+					mui.toast(error);
+				})
+			},
+			//获取最新5条通知消息
+			getLastNotice() {
+				this.isLoading = true;
+				API_Notice.getTopList({
+					type: this.detail.type,
+					limit: 5,
+					excludeMessageId: this.id
+				}).then(response => {
+					this.noticeList = response;
+					this.isLoading = false;
 				}).catch(error => {
 					this.isLoading = false;
 					mui.toast(error);

+ 7 - 9
src/projects/business/views/Master/Home.vue

@@ -81,10 +81,10 @@
 							<img class="mui-media-object mui-pull-right" src="~$project/assets/img/cicon18.png" width="54" />
 						</router-link>
 					</div>
-					<div class="mui-col-xs-12">
+					<div v-if="noticeList.length" class="mui-col-xs-12">
 						<div class="vongi-floor-padded">
 							<router-link :to="{name:'CommonNotice'}" v-for="(item,index) in noticeList" :key="index" class="text-list">
-								<h5 class="mui-ellipsis" v-text="item.title"></h5><span v-text="item.createTime.substr(5)"></span>
+								<h5 class="mui-ellipsis" v-text="item.title"></h5><span v-text="item.date"></span>
 							</router-link>
 						</div>
 						<router-link :to="{name:'CommonNotice'}" class="vongi-link"><span class="mui-icon mui-icon-forward"></span></router-link>
@@ -227,14 +227,12 @@
 			//获取最新二条通知消息
 			getLastNotice() {
 				this.isLoading = true;
-				API_Notice.getNoticeList({
-					pageIndex: 1,
-					pageSize: 2,
+				API_Notice.getTopList({
+					type: 1,
+					limit: 2,
+					excludeMessageId: ''
 				}).then(response => {
-					let data = response.data;
-					if (data.length > 0) {
-						this.noticeList = data.slice(0, 1);
-					}
+					this.noticeList = response;
 					this.isLoading = false;
 				}).catch(error => {
 					this.isLoading = false;

+ 21 - 40
src/projects/business/views/Master/Mine/Message.vue

@@ -6,43 +6,26 @@
 		<div class="mui-content margin49">
 			<ul class="mui-table-view vongi-news">
 				<li class="mui-table-view-cell mui-media">
-					<router-link :to="{name:'CommonNotice'}">
+					<router-link :to="{name:'CommonNotice',query:{type:noticeInfo.type}}">
 						<img class="mui-media-object mui-pull-left" src="~$project/assets/img/bell1.png">
 						<div class="mui-media-body">
-							<h3 class="flew-sp">通知公告<span class="mui-h6" v-text="lastNotice.createTime"></span></h3>
-							<p class='mui-ellipsis' v-text="lastNotice.title"></p>
+							<h3 class="flew-sp">{{noticeInfo.name}}<span class="mui-h6" v-text="noticeInfo.message?noticeInfo.message.date:''"></span></h3>
+							<p class='mui-ellipsis' v-text="noticeInfo.message?noticeInfo.message.title:''"></p>
 						</div>
-						<!-- <span class="mui-badge mui-badge-danger">5</span> -->
+						<span v-if="noticeInfo.total" class="mui-badge mui-badge-danger" v-text="noticeInfo.total"></span>
 					</router-link>
 				</li>
 			</ul>
 			<ul class="mui-table-view vongi-news">
-				<li class="mui-table-view-cell mui-media kfz">
-					<a href="javascript:;">
+				<li v-for="(item,index) in messageList" class="mui-table-view-cell mui-media">
+					<router-link :to="{name:'CommonNotice',query:{type:item.type}}">
 						<img class="mui-media-object mui-pull-left" src="~$project/assets/img/kaoqin1.png">
 						<div class="mui-media-body">
-							<h3 class="flew-sp">考勤消息<span class="mui-h6">09.20</span></h3>
-							<p class='mui-ellipsis'>考勤打卡提醒</p>
+							<h3 class="flew-sp">{{item.name}}<span class="mui-h6" v-text="item.message?item.message.date:''"></span></h3>
+							<p class='mui-ellipsis' v-text="item.message?item.message.title:''"></p>
 						</div>
-					</a>
-				</li>
-				<li class="mui-table-view-cell mui-media kfz">
-					<a href="javascript:;">
-						<img class="mui-media-object mui-pull-left" src="~$project/assets/img/audit1.png">
-						<div class="mui-media-body">
-							<h3 class="flew-sp">通知公告<span class="mui-h6">09.20</span></h3>
-							<p class='mui-ellipsis'>9月园区活动通知</p>
-						</div>
-					</a>
-				</li>
-				<li class="mui-table-view-cell mui-media kfz">
-					<a href="javascript:;">
-						<img class="mui-media-object mui-pull-left" src="~$project/assets/img/home1.png">
-						<div class="mui-media-body">
-							<h3 class="flew-sp">通知公告<span class="mui-h6">09.20</span></h3>
-							<p class='mui-ellipsis'>9月园区活动通知</p>
-						</div>
-					</a>
+						<span v-if="item.total" class="mui-badge mui-badge-danger" v-text="item.total"></span>
+					</router-link>
 				</li>
 			</ul>
 		</div>
@@ -77,7 +60,10 @@
 
 				isLoading: false,
 
-				lastNotice: {}
+				noticeInfo: {
+					message: {}
+				},
+				messageList: [],
 			}
 		},
 		created() {
@@ -87,17 +73,12 @@
 			}
 		},
 		methods: {
-			//获取最新一条通知消息
-			getLastNotice() {
+			//获取消息分组
+			getGroupList() {
 				this.isLoading = true;
-				API_Notice.getNoticeList({
-					pageIndex: 1,
-					pageSize: 1,
-				}).then(response => {
-					let data = response.data;
-					if (data.length > 0) {
-						this.lastNotice = data[0];
-					}
+				API_Notice.getGroupList().then(response => {
+					this.noticeInfo = response[0];
+					this.messageList = response.slice(1)
 					this.isLoading = false;
 				}).catch(error => {
 					this.isLoading = false;
@@ -107,8 +88,8 @@
 			asynCallBack() {},
 		},
 		mounted() {
-			//获取最新一条通知消息
-			this.getLastNotice();
+			//获取分组通知消息
+			this.getGroupList();
 		},
 		destroyed() {