ソースを参照

refactor(mine):个人中心修改样式
feat(mine):新增消息流程未读数字角标

HMY 1 年間 前
コミット
566ca0c906
4 ファイル変更90 行追加34 行削除
  1. 13 0
      api/message.js
  2. 15 0
      api/process.js
  3. 7 9
      pages/mine/clockIn/clockIn.vue
  4. 55 25
      pages/mine/index.vue

+ 13 - 0
api/message.js

@@ -65,4 +65,17 @@ export function getMessageInfo(params) {
 			}
 		}
 	})
+}
+
+export function getUnReadMessageNum(useId) {
+	return request({
+		url: preUrl,
+		method: 'post',
+		data: {
+			'serviceId': 'eu_2013V01readMessage',
+			'params': {
+				'staffId': useId
+			}
+		}
+	})
 }

+ 15 - 0
api/process.js

@@ -83,4 +83,19 @@ export function getProcessInfo(userId, insId) {
 			}
 		}
 	})
+}
+
+//获取待办流程数
+export function getUnProcessNum(userId,startTime) {
+	return request({
+		url: preUrl,
+		method: 'post',
+		data: {
+			serviceId: 'bpm_2013V0100PHONE010',
+			params: {
+				staffId: userId, // useId
+				startTime: startTime // 开始时间
+			}
+		}
+	})
 }

+ 7 - 9
pages/mine/clockIn/clockIn.vue

@@ -33,8 +33,7 @@
 		</atl-map>
 		<!-- 打卡按钮 -->
 		<view class="footer">
-			<button type="primary" @click="signInOrOut">{{signName}}</button>
-			
+			<button type="primary" @click="signInOrOut" :style="{ backgroundColor: signColor }">{{signName}}</button>	
 		</view>
 	</view>
 </template>
@@ -131,7 +130,7 @@
 	const signOutStatusName = ref('早退')
 	const isSignInStatusDisabled = ref(true)
 	const isSignOutStatusDisabled = ref(true)
-
+	const signColor=ref('green')//打卡按钮颜色
 	//获取今天考勤状态
 	function getTodayAtt() {
 		const params = {
@@ -151,16 +150,17 @@
 					// console.log('getTime1',time1);
 					signInTime.value = time1.att_time.split(' ')[1];
 					signName.value = '下班签退';
+					signColor.value='blue';
 					if (isTimeInRange(signInTime.value, ...config.lateTimeRange)) {
 						isSignInStatusDisabled.value = false; //迟到
 					}
 				}
 				if (time2 !== undefined) {
 					signOutTime.value = time2.att_time.split(' ')[1];
-					if (Array.isArray(config.signOutTimeRange) && isTimeInRange(signOutTime.value, "00:00:00",
-							config
-							.signOutTimeRange[0])) {
+					if (Array.isArray(config.signOutTimeRange) && isTimeInRange(signOutTime.value, "00:00:00",config.signOutTimeRange[0])) {
 						isSignOutStatusDisabled.value = false; //早退
+					}else{
+						isSignOutStatusDisabled.value = true;//隐藏早退状态
 					}
 				}
 			}
@@ -190,9 +190,7 @@
 		// attType.value=1;
 		var attType = 1;
 		getAddress();
-		if (clockIn(attType)) {
-			signName.value = '下班签退'
-		}
+		clockIn(attType)
 	};
 
 	// 下班签退

+ 55 - 25
pages/mine/index.vue

@@ -77,6 +77,8 @@
 
 	import headImg from "@/static/images/mine/headImg.jpg"
 	import $tab from "@/plugins/tab.js"
+	import { getUnReadMessageNum } from '@/api/message';
+	import { getUnProcessNum } from '@/api/process';
 	import {
 		useUserStore
 	} from '@/store/user.js'
@@ -84,12 +86,40 @@
 	const userInfo = ref({})
 	onMounted(() => {
 		userInfo.value = userStore.user
-		// console.log('userStore', userStore.user);
-		// uni.setTabBarBadge({
-		//     index: 0,//tabbar的索引
-		//     text: String(2)//要添加的角标内容
-		// })
+		showTarBarBadge();
 	})
+	
+	function showTarBarBadge(){
+		let unReadMsgNum=0;
+		let unProcessNum=0;
+		getUnProcessNum(userStore.user.useId,"").then(res=>{
+			unProcessNum=parseInt(res.returnParams.total, 10);
+			console.log('unProcessNum',res.returnParams.total);
+			if(unProcessNum==0){
+				uni.removeTabBarBadge({
+					index:1
+				})
+			}else{
+				uni.setTabBarBadge({
+				  index: 1,
+				  text: String(unProcessNum)
+				})
+			}
+		})
+		getUnReadMessageNum(userStore.user.useId).then(res=>{
+			unReadMsgNum=parseInt(res.returnParams, 10)+unProcessNum;
+			if(unReadMsgNum==0){
+				uni.removeTabBarBadge({
+					index:0
+				})
+			}else{
+				uni.setTabBarBadge({
+				  index: 0,
+				  text: String(unReadMsgNum)
+				})
+			}
+		})		
+	}
 	// 部门数组
 	const array = ref(['研发部', '业务部', '法务部']);
 	const index = ref(0);
@@ -148,15 +178,15 @@
 	.user-info {
 		display: flex;
 		align-items: center;
-		padding: 1rem  4rem;
+		padding: 1rem 4rem;
 		border-bottom: 1rpx solid #666;
 		color: #777;
 	}
 
 
 	.avatar {
-		width: 200rpx;
-		height: 200rpx;
+		width: 6.25rem;
+		height: 6.25rem;
 		border-radius: 50%;
 	}
 
@@ -166,43 +196,43 @@
 	}
 
 	.name {
-		padding: 15rpx 0;
+		padding: 0.5rem 0;
 		color: #333;
-		font-size: 17px;
+		font-size: 1.1rem;
 	}
 
 
 
 	.function-list {
-		margin-bottom: 60rpx;
+		margin-bottom: 2rem;
 	}
 
 	.function-item {
 		display: flex;
 		align-items: center;
 		justify-content: space-between;
-		padding: 20rpx;
+		padding: 0.75rem;
 		background-color: white;
 		border-radius: 10rpx;
-		margin-bottom: 20rpx;
+		margin-bottom: 0.75rem;
 		border-bottom: 1px solid gainsboro;
 	}
 
 
 	.title {
 		flex-grow: 1;
-		font-size: 15px;
+		font-size: 1rem;
 	}
 
 	.desc {
 		color: #777;
-		margin-right: 20rpx;
+		margin-right: 0.5rem;
 	}
 
 	.select1 {
 		display: inline-block;
 		width: 50%;
-		margin-top: 10rpx;
+		margin-top: 0.3rem;
 	}
 
 	.headImg {
@@ -217,7 +247,7 @@
 
 	::v-deep .uni-list-cell-left {
 		padding: 0 0;
-		font-size: 17px;
+		font-size: 1.1rem;
 		color: #333;
 		flex: none;
 	}
@@ -227,11 +257,11 @@
 	}
 
 	::v-deep .uni-input {
-		padding: 15rpx 8rpx;
+		padding: 0.5rem 0.25rem;
 		text-decoration: underline;
 		/* 给文字添加下划线 */
 		color: blue;
-		font-size: 17px;
+		font-size: 1.1rem;
 		background-color: #f5f5f5;
 		// text-decoration-color: blue;
 	}
@@ -241,16 +271,16 @@
 	.uni-list-cell-right {
 		flex: none;
 	}
-	
-	::v-deep .uni-card{
+
+	::v-deep .uni-card {
 		background-color: #f5f5f5 !important;
 	}
-	
-	::v-deep .uni-card--shadow{
+
+	::v-deep .uni-card--shadow {
 		box-shadow: none !important;
 	}
-	
-	::v-deep .uni-card--border{
+
+	::v-deep .uni-card--border {
 		border: none !important;
 	}
 </style>