Переглянути джерело

feat(personal_message,mine):部门切换

HMY 1 рік тому
батько
коміт
9cddffd552
2 змінених файлів з 33 додано та 25 видалено
  1. 28 19
      pages/mine/index.vue
  2. 5 6
      pages/mine/personal_message/personal_message.vue

+ 28 - 19
pages/mine/index.vue

@@ -3,7 +3,9 @@
 		<!-- 用户信息部分 -->
 		<uni-card margin="0" spacing="0">
 			<view class="headImg">
-				<image :src="userStore.user.photo==''?config.baseUrlPre+config.defaultAvatarPath:config.baseUrlPre+userStore.user.photo" class="avatar" @click="toEditAvatar"></image>
+				<image
+					:src="userStore.user.photo==''?config.baseUrlPre+config.defaultAvatarPath:config.baseUrlPre+userStore.user.photo"
+					class="avatar" @click="toEditAvatar"></image>
 			</view>
 			<view class="user-info">
 				<view class="info-detail">
@@ -25,7 +27,7 @@
 						</view>
 					</view>
 					<view>
-						<text> 职务: {{ userStore.user.positionName ||'暂无'}}</text>
+						<text> 职务: {{ userStore.user.groupXUsers[index].posName ||'暂无'}}</text>
 					</view>
 
 				</view>
@@ -41,17 +43,13 @@
 					<text class="title">编辑资料</text>
 					<text class="desc">></text>
 				</view>
-				<!-- <view class="function-item" @click="waitWork">
-					<text class="ygoa-icon icon-waitWork"></text>
-					<text class="title">待办事项</text>
-					<text class="desc">></text>
-				</view> -->
+
 				<view class="function-item" @click="checkIn">
 					<text class="ygoa-icon icon-checkIn"></text>
 					<text class="title">我的考勤</text>
 					<text class="desc">></text>
 				</view>
-				
+
 				<view class="function-item" @click="clockIn">
 					<text class="ygoa-icon icon-clockIn"></text>
 					<text class="title">我的打卡</text>
@@ -70,20 +68,30 @@
 </template>
 
 <script setup lang="ts">
-	import {ref} from 'vue';
+	import { onMounted, ref } from 'vue';
 	import $tab from "@/plugins/tab.js"
-	import {useUserStore} from '@/store/user.js'
+	import { useUserStore } from '@/store/user.js'
 	import config from '@/config';
 	import { onShow } from '@dcloudio/uni-app'
 	const userStore = useUserStore()
 
-	onShow(()=>{
+	onShow(() => {
 		uni.$emit('showTabBarBadge')
 	})
-	
+
 	// 部门数组
 	const deptNameArray = ref(['研发部', '业务部', '法务部']);
 	const index = ref(0);
+	onMounted(() => {
+		initDeptArray();
+	})
+
+	//部门初始化
+	function initDeptArray() {
+		const groupXUsers = userStore.user.groupXUsers;
+		// 使用map方法提取groupName
+		deptNameArray.value = groupXUsers.map(groupXUser => groupXUser.groupName);
+	}
 
 	// 部门切换事件
 	function bindPickerChange(e) {
@@ -100,11 +108,6 @@
 		$tab.navigateTo('/pages/mine/edit/edit')
 	};
 
-	// 待办事项的函数
-	// function waitWork() {
-	// 	$tab.navigateTo('/pages/mine/waitWork/waitWork')
-	// }
-
 	// 我的考勤的函数
 	function checkIn() {
 		$tab.navigateTo('/pages/mine/checkIn/checkIn')
@@ -120,7 +123,7 @@
 		$tab.navigateTo('/pages/mine/clockIn/clockIn')
 	};
 	//头像修改页
-	function toEditAvatar(){
+	function toEditAvatar() {
 		// $tab.navigateTo('/pages/mine/avatar/avatarTest/avatarTest')
 		$tab.navigateTo('/pages/mine/avatar/avatar')
 	}
@@ -229,7 +232,13 @@
 		color: blue;
 		font-size: 1.1rem;
 		background-color: #f5f5f5;
-		// text-decoration-color: blue;
+		overflow: hidden;
+		/* 隐藏超出部分 */
+		white-space: nowrap;
+		/* 不换行 */
+		text-overflow: ellipsis;
+		/* 省略号 */
+		max-width: 30vh;
 	}
 
 

+ 5 - 6
pages/mine/personal_message/personal_message.vue

@@ -5,13 +5,12 @@
 
 		<!-- 用户名及职位 -->
 		<text class="username">{{ userInfo.name }}</text>
-		<!-- <view class="position" v-for="(item,index) in userInfo.department" :key="index">
-			{{ item.departmentName }}--{{item.position}}
-		</view> -->
-		<view class="position" >
-			{{ userInfo.deptName }}--{{userInfo.positionName}}
+		<view class="position" v-for="(item,index) in userInfo.groupXUsers" :key="index">
+			{{ item.groupName }}--{{item.posName||'暂无'}}
 		</view>
-
+		<!-- <view class="position" >
+			{{ userInfo.deptName }}--{{userInfo.positionName}}
+		</view> -->
 
 		<!-- 联系方式 -->
 		<view class="contact-info">