1
0

2 Коммитууд 4dd92935e7 ... 402574a74f

Эзэн SHA1 Мессеж Огноо
  shuchang 402574a74f 新增消息 3 сар өмнө
  shuchang 000fb1bd65 新增消息 3 сар өмнө

+ 4 - 5
common/config/api.js

@@ -17,7 +17,10 @@ export const getHospitalListUrl = (data) => http.get('/dev-api/care/hospital/lis
 // 上传
 export const uploadAvatarUrl = (params, config = {}) => http.upload('/dev-api/system/user/profile/avatar', params,
 	config);
-
+// 获取未读消息数
+export const getMsgCountUrl = (data) => http.get('/dev-api/system/notice/myNoticeList', data);
+// 修改消息
+export const modifyMsgUrl = (params, config = {}) => http.post('/dev-api/system/notice/setIsRead', params, config);
 
 
 
@@ -26,10 +29,6 @@ export const uploadAvatarUrl = (params, config = {}) => http.upload('/dev-api/sy
 // 注册
 export const registerUrl = (params, config = {}) => http.post('/xc-order/api//order/user/register', params, config);
 
-// 获取未读消息数
-export const getMsgCountUrl = (data) => http.get('/xc-order/api/order/message/getNotReadNum', data);
-// 修改消息
-export const modifyMsgUrl = (data) => http.get('/xc-order/api/order/message/isRead', data);
 // 查询消息列表
 export const getMessageListUrl = (params, config = {}) => http.post('/xc-order/api/order/message/messageList', params,
 	config);

+ 17 - 6
components/ItemMessage.vue

@@ -1,18 +1,25 @@
 <template>
 	<view class="px-32 mt-24 flex-column" @click="changeReadStatus">
-		<text class="w-100p text-center font" style="line-height: 60rpx;color: #9EA5B7;">{{item.createTime}}</text>
+		<text class="w-100p text-center font" style="line-height: 60rpx;color: #9EA5B7;">{{computeTime}}</text>
 		<view class="flex-row mt-08">
-			<image :src="item.isRead === '0'?'/static/images/message-un-read.png':'/static/images/message-read.png'"
+			<image :src="item.readStatus === '0'?'/static/images/message-un-read.png':'/static/images/message-read.png'"
 				style="width: 64rpx;height: 64rpx;" mode="aspectFill"></image>
-			<view class="flex-1 ml-24 rounded-8 px-32 py-16"
+			<view class="flex-1 ml-24 rounded-8 px-32 py-16 flex-column"
 				style="background-color: white;border: 0.6px solid #FFFFFF;box-shadow: 0px 4px 8px 0px rgba(218, 235, 253, 0.21);">
-				<text class="font" style="color: #333333;line-height: 60rpx;">{{item.message}}</text>
+				<text class="font font-weight-bolder"
+					style="color: #333333;line-height: 60rpx;">{{item.notice_title}}</text>
+				<text class="font" style="color: #333333;line-height: 60rpx;">{{item.notice_content}}</text>
 			</view>
 		</view>
 	</view>
 </template>
 
 <script setup>
+	import dayjs from 'dayjs'
+	import {
+		computed
+	} from 'vue'
+
 	const emit = defineEmits(['modify'])
 	const props = defineProps({
 		item: {
@@ -27,9 +34,13 @@
 		}
 	})
 
+	const computeTime = computed(() => {
+		return dayjs(props.item.create_time).format('YYYY-MM-DD HH:mm:ss')
+	})
+
 	const changeReadStatus = () => {
-		if (props.item.isRead === '0') {
-			emit('modify', props.item.id)
+		if (props.item.readStatus === '0') {
+			emit('modify', props.item.notice_user_id)
 		}
 	}
 </script>

+ 17 - 11
pages/subpack/pages/application/list.vue

@@ -23,11 +23,12 @@
 		reactive,
 		computed,
 		getCurrentInstance,
-		onMounted
+		onMounted,
+		computed
 	} from 'vue';
 	//import { onLoad } from '@dcloudio/uni-app'
 	import applyItem from '../../components/apply/apply-item.vue';
-	
+
 	import {
 		useStore
 	} from 'vuex';
@@ -199,11 +200,14 @@
 			pageNum: pageNo,
 			pageSize
 		}
-		if(tabList.value.length>tabIndex.value){
+		if (tabList.value.length > tabIndex.value) {
 			let query = tabList.value[tabIndex.value].query;
-			params = {...params, ...query}
+			params = {
+				...params,
+				...query
+			}
 		}
-	
+
 		getCareList({
 			params: params
 		}).then(data => {
@@ -215,16 +219,18 @@
 
 	function tapItemHandle(item) {
 		// console.log('tapItemHandle=>', item);
-		if(!item.applyId) return false;
-		uni.$u.route('/pages/subpack/pages/application/info',{id: item.applyId})
+		if (!item.applyId) return false;
+		uni.$u.route('/pages/subpack/pages/application/info', {
+			id: item.applyId
+		})
 	}
-	onLoad(()=>{
-		uni.$on('renderApplyList',()=>{
+	onLoad(() => {
+		uni.$on('renderApplyList', () => {
 			proxy.$refs.paging.reload();
 		})
 	})
-	
-	onUnload(()=>{
+
+	onUnload(() => {
 		uni.$off('renderApplyList')
 	})
 </script>

+ 4 - 3
pages/subpack/pages/bindInfo/bindInfo.vue

@@ -83,10 +83,11 @@
 						uni.hideLoading();
 						console.log('用户信息', res);
 						let user = {
+							id: res.data.user.userId,
 							avatar: this.avatarImg,
-							nickName: res.user.nickName,
-							phonenumber: res.user.phonenumber,
-							roles: res.roles
+							nickName: res.data.user.nickName,
+							phonenumber: res.data.user.phonenumber,
+							roles: res.data.roles
 						}
 						this.$u.vuex('vuex_user', user);
 						uni.switchTab({

+ 42 - 9
pages/tabbar/application/application.vue

@@ -47,7 +47,6 @@
 <script>
 	import {
 		getUserInfoUrl,
-
 		getMsgCountUrl
 	} from '@/common/config/api.js'
 	export default {
@@ -61,7 +60,7 @@
 			this.getUserInfo();
 		},
 		onShow() {
-			// this.getMsgCount();
+			this.getMsgCount();
 		},
 		computed: {
 			computeHeight() {
@@ -75,6 +74,12 @@
 				if (this.vuex_user.roles.includes('area')) {
 					return '护理审核'
 				}
+				if (this.vuex_user.roles.includes('company')) {
+					return '护理指派'
+				}
+				if (this.vuex_user.roles.includes('nurse')) {
+					return '护理打卡'
+				}
 			}
 		},
 		methods: {
@@ -83,6 +88,7 @@
 					.then(res => {
 						console.log('用户信息', res);
 						let user = {
+							id: res.user.userId,
 							avatar: res.user.avatar,
 							nickName: res.user.nickName,
 							phonenumber: res.user.phonenumber,
@@ -99,22 +105,35 @@
 				console.log(this.vuex_user.id);
 				getMsgCountUrl({
 						params: {
-							userId: this.vuex_user.id
+							pageNum: 1,
+							pageSize: 1,
+							userId: this.vuex_user.id,
+							status: 0
+						},
+						custom: {
+							catch: true
 						}
 					})
 					.then(res => {
 						console.log('未读消息数', res);
-						const count = parseInt(res);
-						if (count > 0) {
-							uni.setTabBarBadge({
-								index: 1,
-								text: count > 99 ? '99+' : res
-							})
+						if (res.code === 200) {
+							const count = String(res.total);
+							if (count > 0) {
+								uni.setTabBarBadge({
+									index: 1,
+									text: count > 99 ? '99+' : count
+								})
+							} else {
+								uni.removeTabBarBadge({
+									index: 1
+								})
+							}
 						} else {
 							uni.removeTabBarBadge({
 								index: 1
 							})
 						}
+
 					})
 					.catch(err => {
 						console.log(err);
@@ -134,6 +153,20 @@
 						url: '/pages/subpack/pages/application/list'
 					})
 				}
+
+				// 护理公司
+				if (this.vuex_user.roles.includes('company')) {
+					return uni.navigateTo({
+						url: '/pages/subpack/pages/application/list'
+					})
+				}
+				
+				// 护理人员
+				if (this.vuex_user.roles.includes('nurse')) {
+					return uni.navigateTo({
+						url: '/pages/subpack/pages/application/list'
+					})
+				}
 			}
 		}
 	}

+ 32 - 18
pages/tabbar/message/message.vue

@@ -1,11 +1,12 @@
 <template>
 	<z-paging ref="msgpPging" v-model="dataList" @query="queryList" loading-more-no-more-text="没有更多消息了">
 		<template v-slot:top>
-			<up-navbar title=" 消息" bgColor="transparent" leftIcon='' :title-style="{fontWeight:'bold'}">
+			<up-navbar title="消息" bgColor="transparent" leftIcon='' :title-style="{fontWeight:'bold'}">
 			</up-navbar>
 			<div class="nav-header" :style="{height:computeNavHeight}"></div>
 		</template>
-		<ItemMessage v-for="(item,index) in dataList" :item="item" :index="index" @modify="handleModify">
+		<ItemMessage v-for="(item,index) in dataList" :item="item" :index="index" :key="item.notice_user_id"
+			@modify="handleModify">
 		</ItemMessage>
 	</z-paging>
 </template>
@@ -13,7 +14,7 @@
 <script>
 	import {
 		getMsgCountUrl,
-		getMessageListUrl,
+		// getMessageListUrl,
 		modifyMsgUrl
 	} from '@/common/config/api.js'
 	import ItemMessage from '@/components/ItemMessage.vue'
@@ -38,9 +39,7 @@
 		methods: {
 			handleModify(id) {
 				modifyMsgUrl({
-						params: {
-							id
-						}
+						noticeUserId: id
 					})
 					.then(res => {
 						console.log('阅读消息', res);
@@ -55,18 +54,30 @@
 			getMsgCount() {
 				getMsgCountUrl({
 						params: {
-							userId: this.vuex_user.id
+							pageNum: 1,
+							pageSize: 1,
+							userId: this.vuex_user.id,
+							status: 0
+						},
+						custom: {
+							catch: true
 						}
 					})
 					.then(res => {
 						console.log('未读消息数', res);
 						this.$refs.msgpPging.reload();
-						const count = parseInt(res);
-						if (count > 0) {
-							uni.setTabBarBadge({
-								index: 1,
-								text: count > 99 ? '99+' : res
-							})
+						if (res.code === 200) {
+							const count = String(res.total);
+							if (count > 0) {
+								uni.setTabBarBadge({
+									index: 1,
+									text: count > 99 ? '99+' : count
+								})
+							} else {
+								uni.removeTabBarBadge({
+									index: 1
+								})
+							}
 						} else {
 							uni.removeTabBarBadge({
 								index: 1
@@ -79,14 +90,17 @@
 			},
 			queryList(pageNo, pageSize) {
 				// this.$refs.msgpPging.complete([1, 2, 3, 4, 5]);
-				getMessageListUrl({
-						pageNum: pageNo,
-						pageSize: pageSize,
-						userId: this.vuex_user.id
+				getMsgCountUrl({
+						params: {
+							pageNum: 1,
+							pageSize: 1,
+							userId: this.vuex_user.id,
+							status: 0
+						},
 					})
 					.then(res => {
 						console.log('消息列表: ', res);
-						this.$refs.msgpPging.complete(res.records);
+						this.$refs.msgpPging.complete(res);
 					})
 					.catch(err => {
 						console.log('err: ', err);

+ 1 - 1
pages/tabbar/mine/mine.vue

@@ -3,7 +3,7 @@
 		<u-navbar class="u-navbar-box" title="我的" placeholder bgColor="transparent" left-icon-size="0" />
 		<view class="top-box">
 			<u-image class="bg-box" width="690rpx" height="270rpx" src="/static/mine/user-center-bg.png" />
-			<div class="avatar-name">
+			<div class="avatar-name" style="z-index: 9;">
 				<up-avatar size="116rpx" :src="computeAvatarUrl" defaultUrl="/static/mine/avatar-def.png"
 					bgColor="#305BFF" />
 				<!-- <u-image class="avatar" width="116rpx" bgColor="transparent" height="116rpx"

+ 7 - 1
utils/request/interceptors.js

@@ -30,7 +30,7 @@ const responseInterceptors = (vm) => {
 	 * @param {Object} http 
 	 */
 	http.interceptors.response.use((response) => {
-		// console.log('response: ', response);
+		console.log('response: ', response);
 		if (response?.config?.custom?.isCloseLoad) {
 			uni.hideLoading();
 		}
@@ -54,6 +54,7 @@ const responseInterceptors = (vm) => {
 				})
 			}
 			// 如果需要catch返回,则进行reject
+			console.log(custom);
 			if (custom?.catch) {
 				uni.hideLoading();
 				return Promise.reject(data)
@@ -62,6 +63,11 @@ const responseInterceptors = (vm) => {
 				return new Promise(() => {})
 			}
 		}
+
+		if (custom?.catch) {
+			uni.hideLoading();
+			return Promise.resolve(data)
+		}
 		if (!data.data && data.rows) data.data = data.rows;
 		return data.data || {}
 	}, (response) => {