Procházet zdrojové kódy

fix:冲突解决

jiayubo před 18 hodinami
rodič
revize
bc57e31540

+ 17 - 13
App.vue

@@ -1,5 +1,5 @@
 <script>
-import WebSocketManager from '@/utils/WebSocketManager.js';
+// import WebSocketManager from '@/utils/WebSocketManager.js';
 import { watch } from 'vue';
 import store from '@/store'
 export default {
@@ -19,23 +19,27 @@ export default {
 	watch: {
         userId: {
             handler() {
-                console.log('yong---------------',this.userId);
-				const wsManager = new WebSocketManager(this.userId);
-				// 设置消息回调
-				wsManager.onMessage(data => {
-					console.log('app-接收到的消息:', data);
-					// 处理消息逻辑
-					if(data.type === 'msgUnreadCount'){
-						store.dispatch('handleMessageCount',data.data)
-					}
-				});
-				// 建立连接
-				wsManager.connect();
+                // console.log('yong---------------',this.userId);
+				// const wsManager = new WebSocketManager(this.userId);
+				// // 设置消息回调
+				// wsManager.onMessage(data => {
+				// 	console.log('app-接收到的消息:', data);
+				// 	// 处理消息逻辑
+				// 	if(data.type === 'msgUnreadCount'){
+				// 		store.dispatch('handleMessageCount',data.data)
+				// 	}
+				// });
+				// // 建立连接
+				// wsManager.connect();
             },
             immediate: true,
             deep: true
         }
     },
+	onMounted() { 
+		console.log("TCL: onMounted -> onMounted", onMounted)
+		
+	},
 }
 </script>
 

+ 21 - 0
api/conversation.js

@@ -50,4 +50,25 @@ export function setRead(data) {
         method: 'post',
         data
     })
+}
+
+
+
+//删除会话记录
+export function conversationRemove(data) {
+    return request({
+        url: `/core/conversation/remove`,
+        method: 'post',
+        data
+    })
+}
+
+
+//获取历史聊天记录,目前设置为获取10条
+export function getHistoryMsg(data) {
+    return request({
+        url: `/core/conversation/getHistoryMsg`,
+        method: 'post',
+        data
+    })
 }

+ 229 - 379
components/Client/new_file.vue

@@ -4,17 +4,21 @@
 			<view class="Wrapper-grid">
 				<view class="serve-title client-title" v-if="userType == 2">注册专区</view>
 				<up-grid :border="false" col="4">
-					<up-grid-item v-for="(item, index) in serveiceList" :key="index"
-						 @click="handleGridClick(item)">
+					<up-grid-item v-for="(item, index) in serveiceList" :key="index" @click="handleGridClick(item)">
 						<view class="grid-box">
 							<view class="grid-icon">
-								<image :src="item.icon" class="service-img" mode="aspectFit" />
+								<image :src="item.businessIcon" class="service-img" mode="aspectFit" />
 							</view>
-							<text class="grid-text">{{ item.name }}</text>
+							<text class="grid-text">{{ item.businessName }}</text>
 						</view>
 					</up-grid-item>
 				</up-grid>
 				<up-toast ref="uToastRef" />
+
+				<view @click="DataInit" class="paiban-sty" v-if="userType == 2">
+					<image src="/static/serverImg/home/icon/icon8.png" class="service-img" mode="aspectFit" />
+					排班管理
+				</view>
 			</view>
 		</template>
 
@@ -26,402 +30,248 @@
 </template>
 
 <script setup>
-	import {
-		ref,
-		onMounted,
-		watch,
-		computed,
-		provide
-	} from 'vue';
-	import {
-		workDate,
-		getDataTime,
-		getVolunteerInfo
-	} from '@/api/volunteer.js'
-	import {
-		volunteerSeachgetTreeList,
-		volunteerDataList
-	} from "@/api/volunteerDetailsApi/details.js"
-	import Calendar from '../../components/uni-calendar/components/uni-calendar/uni-calendar.vue'
-
-	const swiperList = ['integral', 'kefu-ermai', 'coupon', 'gift', 'scan', 'pause-circle', 'wifi', 'email', 'list'];
-
-	// Toast 控制宫格
-	const uToastRef = ref(null);
-	const userType = uni.getStorageSync('userType') //读取本地存储
-	// 用户/志愿者 识别标识
-	const userOrWorker = uni.getStorageSync('storage_data').vuex_userOrWorker //读取本地存储
-
-	const calendar = ref(null)
-	const info = ref({
-		lunar: true,
-		range: true,
-		insert: false,
-	})
-	const selected = ref([])
-
-	// 普通用户
-	const serviceList1 = [{
-			icon: '/static/Tioimages/父母体检.png',
-			name: '老人生活',
-			key: 1,
-		},
-		{
-			icon: '/static/Tioimages/1 妇女儿童权益保护服务.png',
-			name: '孩子成长',
-			key: 2,
-		},
-		{
-			icon: '/static/Tioimages/临时帮手.png',
-			name: '临时帮手',
-			key: 3,
-    },
-    	{
-			icon: '/static/Tioimages/家庭保洁.png',
-			name: '家庭保洁',
-			key: 4,
-		},
-		{
-			icon: '/static/Tioimages/家电维修.png',
-			name: '家电维护',
-			key: 5,
-		},
-		{
-			icon: '/static/Tioimages/专家服务.png',
-			name: '专家服务',
-			key: 6,
-		},
-		{
-			icon: '/static/Tioimages/15-旅游服务-01.png',
-			name: '旅游服务',
-			key: 7,
-		},
-		{
-			icon: '/static/Tioimages/交友.png',
-			name: '交友专区',
-			key: 8,
-		},
-		{
-			icon: '/static/Tioimages/休闲娱乐.png',
-			name: '娱乐专区',
-			key: 9,
-		},
-		{
-			icon: '/static/Tioimages/福利商城_购物车.png',
-			name: '商城购物',
-			key: 10,
-		},
-		{
-			icon: '/static/Tioimages/本地生活.png',
-			name: '本地生活',
-			key: 11,
-		},
-		{
-			icon: '/static/Tioimages/其他服务.png',
-			name: '其他服务',
-			key: 12,
-		},
-	]
-
-	//志愿者
-	const serviceList2 = [{
-			icon: '/static/Tioimages/父母体检.png',
-			name: '老人生活',
-			key: 1,
-		},
-		{
-			icon: '/static/Tioimages/1 妇女儿童权益保护服务.png',
-			name: '孩子成长',
-			key: 2,
-		},
-		{
-			icon: '/static/Tioimages/临时帮手.png',
-			name: '临时帮手',
-			key: 4,
-    },
-    {
-			icon: '/static/Tioimages/家庭保洁.png',
-			name: '家庭保洁',
-			key: 3,
-		},
-		{
-			icon: '/static/Tioimages/家电维修.png',
-			name: '家电维护',
-			key: 5,
-		},
-		{
-			icon: '/static/Tioimages/专家服务.png',
-			name: '专家服务',
-			key: 6,
-		},
-		{
-			icon: '/static/Tioimages/15-旅游服务-01.png',
-			name: '旅游服务',
-			key: 7,
-		},
-		{
-			icon: '/static/Tioimages/交友.png',
-			name: '交友专区',
-			key: 8,
-		},
-		{
-			icon: '/static/Tioimages/休闲娱乐.png',
-			name: '娱乐专区',
-			key: 9,
-		},
-		{
-			icon: '/static/Tioimages/福利商城_购物车.png',
-			name: '商城购物',
-			key: 10,
-		},
-		{
-			icon: '/static/Tioimages/本地生活.png',
-			name: '本地生活',
-			key: 11,
-		},
-		{
-			icon: '/static/Tioimages/其他服务.png',
-			name: '其他服务',
-			key: 12,
-		},
-		{
-			icon: '/static/serverImg/home/icon/icon8.png',
-			name: '排班管理',
-			key: 13
-		},
-	]
-
-	const serveiceList = computed(() => {
-		console.log('userType ____>', userType);
-
-		if (userType === 1) {
-			return serviceList1
-		}
-		return serviceList2
-	})
-
-
-
-
-	// 宫格点击事件
-	const handleGridClick = async (service) => {
-		// 用户
-		if (userType == 1) {
-			uni.setNavigationBarTitle({ title: service.name }); // 动态设置顶部胶囊标题
-			// 动态获取 parentId
-			const params = {
-				parentId: service.key,
-			}
-			const res = await volunteerSeachgetTreeList(params)
-
-			// 只有第一条、第二条、临时帮手和家庭保洁可以跳转
-			if (service.key === 1 || service.key === 2 || service.key === 3 || service.key === 4 || service.key === 5 || service.key === 6) {
-				uni.navigateTo({
-					url: `/pages_home/pages/client/details?title=${encodeURIComponent(service.name)}&dataList=${encodeURIComponent(JSON.stringify(res.data))}&serviceCategory=${service.key}`
-				});
-			} else {
-				// 其他条目提示"敬请期待"
-				uni.showToast({
-					title: '敬请期待',
-					icon: 'none'
-				});
-			}
-		}
-		// 志愿者
-		if (userType == 2) {
-			// 交友专区、娱乐专区、商城购物、本地生活 显示敬请期待
-			if (service.key === 8 || service.key === 9 || service.key === 10 || service.key === 11) {
-				uni.showToast({
-					title: '敬请期待',
-					icon: 'none'
-				});
-				return;
-			}
-			
-			if (service.key !== 13) {
-				if ([1,2,3,4,5].includes(service.key)) {
-					const res = await getVolunteerInfo({
-						serviceCategory: service.key
-					});
-					if (res.code === 200 && res.data) {
-						//已有注册,跳转详情页面
-						uni.navigateTo({
-							url: `/pages_home/pages/details/index?data=${encodeURIComponent(JSON.stringify(service))}`
-						})
-						return
-					}
-
-					uni.navigateTo({
-						url: `/pages_home/pages/register/index?data=${encodeURIComponent(JSON.stringify(service))}`
-					})
-				} else {
-					// 其他条目提示"敬请期待"
-					uni.showToast({
-						title: '敬请期待',
-						icon: 'none'
-					});
-				}
-				return;
-			}
-			init();
-
+import {
+	ref,
+	onMounted,
+	watch,
+	computed,
+	provide
+} from 'vue';
+import {
+	workDate,
+	getDataTime,
+	getVolunteerInfo
+} from '@/api/volunteer.js'
+import {
+	volunteerSeachgetTreeList,
+	volunteerDataList
+} from "@/api/volunteerDetailsApi/details.js"
+import { getTreeList } from '@/api/volunteer'
+import Calendar from '../../components/uni-calendar/components/uni-calendar/uni-calendar.vue'
+
+const swiperList = ['integral', 'kefu-ermai', 'coupon', 'gift', 'scan', 'pause-circle', 'wifi', 'email', 'list'];
+
+// Toast 控制宫格
+const uToastRef = ref(null);
+const userType = uni.getStorageSync('userType') //读取本地存储
+// 用户/志愿者 识别标识
+const userOrWorker = uni.getStorageSync('storage_data').vuex_userOrWorker //读取本地存储
+
+const calendar = ref(null)
+const info = ref({
+	lunar: true,
+	range: true,
+	insert: false,
+})
+const selected = ref([])
+
+const serveiceList = ref([]);
+
+
+
+// 宫格点击事件
+const handleGridClick = async (service) => {
+	// 用户
+	if (userType == 1) {
+
+		// 动态获取 parentId
+		const params = {
+			parentId: service.id,
 		}
-	};
-
-	const change = (e) => {
-		console.log('change', e);
-		let dates = [{
-			date: e.fulldate,
-			info: `${e.time.startTime}~${e.time.endTime}`,
-			time: e.time
-		}]
-		if (e.range.before && e.range.after) {
-			dates = e.range.data.map(item => {
-				return {
-					date: item,
-					info: `${e.time.startTime}~${e.time.endTime}`,
-					time: e.time
-				}
+		const res = await volunteerSeachgetTreeList(params)
+		uni.navigateTo({
+			url: `/pages_home/pages/client/details?dataList=${encodeURIComponent(JSON.stringify(res.data))}&serviceCategory=${service.id}`
+		});
+	}
+	// 志愿者
+	if (userType == 2) {
+		const res = await getVolunteerInfo({
+			serviceCategory: service.id
+		});
+		if (res.code === 200 && res.data) {
+			//已有注册,跳转详情页面
+			uni.navigateTo({
+				url: `/pages_home/pages/details/index?data=${encodeURIComponent(JSON.stringify({...service,key: service.id}))}`
 			})
+			return
 		}
-		selected.value = [...selected.value, ...dates]
-	}
 
-	const onDelete = (e) => {
-		selected.value = selected.value.filter(item => {
-			console.log('item.fulldate !== e.date', item.date, e.fulldate);
-
-			return item.date !== e.fulldate
+		uni.navigateTo({
+			url: `/pages_home/pages/register/index?data=${encodeURIComponent(JSON.stringify({...service,key: service.id}))}`
 		})
-		console.log(e, selected.value);
-	}
 
-
-	//排班时间去重处理
-	const handleDates = computed(() => {
-		const parmas = selected.value.map(item => {
+	}
+};
+
+const change = (e) => {
+	console.log('change', e);
+	let dates = [{
+		date: e.fulldate,
+		info: `${e.time.startTime}~${e.time.endTime}`,
+		time: e.time
+	}]
+	if (e.range.before && e.range.after) {
+		dates = e.range.data.map(item => {
 			return {
-				workDate: item.date,
-				workStartTime: item.time.startTime,
-				workEndTime: item.time.endTime
+				date: item,
+				info: `${e.time.startTime}~${e.time.endTime}`,
+				time: e.time
 			}
 		})
-		return parmas.reduce((acc, current) => {
-			const existing = acc.find(item => item.workDate === current.workDate);
-			if (existing) {
-				Object.assign(existing, current);
-			} else {
-				acc.push(current);
-			}
-			return acc;
-		}, []);
-	});
-	const confirm = (e) => {
-		const parmas = handleDates.value;
-		console.log('确定', parmas);
-		workDate(parmas).then(res => {
-			if (res.code == 200) {
-				uni.showToast({
-					title: '修改成功',
-					icon: 'success',
-					success: () => {
-						setTimeout(() => {
-							close();
-						}, 1000)
-					}
-				})
+	}
+	selected.value = [...selected.value, ...dates]
+}
 
-				return;
-			}
+const onDelete = (e) => {
+	selected.value = selected.value.filter(item => {
+		console.log('item.fulldate !== e.date', item.date, e.fulldate);
+
+		return item.date !== e.fulldate
+	})
+	console.log(e, selected.value);
+}
+
+
+//排班时间去重处理
+const handleDates = computed(() => {
+	const parmas = selected.value.map(item => {
+		return {
+			workDate: item.date,
+			workStartTime: item.time.startTime,
+			workEndTime: item.time.endTime
+		}
+	})
+	return parmas.reduce((acc, current) => {
+		const existing = acc.find(item => item.workDate === current.workDate);
+		if (existing) {
+			Object.assign(existing, current);
+		} else {
+			acc.push(current);
+		}
+		return acc;
+	}, []);
+});
+const confirm = (e) => {
+	const parmas = handleDates.value;
+	console.log('确定', parmas);
+	workDate(parmas).then(res => {
+		if (res.code == 200) {
 			uni.showToast({
-				title: res.msg,
-				icon: 'none'
+				title: '修改成功',
+				icon: 'success',
+				success: () => {
+					setTimeout(() => {
+						close();
+					}, 1000)
+				}
 			})
+
+			return;
+		}
+		uni.showToast({
+			title: res.msg,
+			icon: 'none'
 		})
-	};
-	const close = () => {
-		calendar.value.close();
-	}
+	})
+};
+const close = () => {
+	calendar.value.close();
+}
+
+const init = () => {
+	getTreeList({ parentId: '0' }).then(res => {
+		console.log("TCL: init -> res", res)
+		serveiceList.value = res.data;
+	})
+}
 
-	const init = () => {
-		getDataTime().then(res => {
-			console.log('res', res);
-			if (res.code === 200) {
-				selected.value = res.data.map(item => {
-					return {
-						date: item.workDate,
-						info: `${item.workStartTime}~${item.workEndTime}`,
-						time: {
-							startTime: item.workStartTime,
-							endTime: item.workEndTime
-						}
+const DataInit = () => {
+	getDataTime().then(res => {
+		console.log('res', res);
+		if (res.code === 200) {
+			selected.value = res.data.map(item => {
+				return {
+					date: item.workDate,
+					info: `${item.workStartTime}~${item.workEndTime}`,
+					time: {
+						startTime: item.workStartTime,
+						endTime: item.workEndTime
 					}
-				})
-				calendar.value.open();
-			}
+				}
+			})
+			calendar.value.open();
+		}
 
 
-		})
-	}
+	})
+}
 
 
 
-	onMounted(() => {
-		// init();
-	});
+onMounted(() => {
+	init();
+});
 </script>
 
 <style scoped>
-	.Wrapper-grid {
-		margin-top: 36rpx;
-	}
-
-	/* 图标样式 */
-	.service-img {}
-
-	/* 文本样式 */
-	.grid-text {
-		font-size: 24rpx;
-		color: #333;
-		text-align: center;
-		/* margin-top: 18rpx; */
-	}
-
-	.grid-box {
-		display: flex;
-		align-items: center;
-		justify-content: center;
-		flex-direction: column;
-		margin-bottom: 12rpx;
-	}
-
-	.grid-icon {
-		width: 100rpx;
-		height: 100rpx;
-		opacity: 1;
-		border-radius: 12rpx;
-		/* background: rgba(251, 229, 225, 1); */
-		display: flex;
-		align-items: center;
-		justify-content: center;
-	}
-
-	.service-img {
-		width: 78rpx;
-		height: 78rpx;
-	}
-
-	.swiper {
-		height: 340rpx;
-	}
-
-	.grid-text {
-		font-size: 14px;
-		color: #909399;
-		/* padding: 10rpx 0 0 0rpx; */
-	}
-
-	.client-title {
-		padding: 0 32rpx;
-	}
+.Wrapper-grid {
+	margin-top: 36rpx;
+}
+
+/* 图标样式 */
+.service-img {}
+
+/* 文本样式 */
+.grid-text {
+	font-size: 24rpx;
+	color: #333;
+	text-align: center;
+	/* margin-top: 18rpx; */
+}
+
+.grid-box {
+	display: flex;
+	align-items: center;
+	justify-content: center;
+	flex-direction: column;
+	margin-bottom: 12rpx;
+}
+
+.grid-icon {
+	width: 100rpx;
+	height: 100rpx;
+	opacity: 1;
+	border-radius: 12rpx;
+	/* background: rgba(251, 229, 225, 1); */
+	display: flex;
+	align-items: center;
+	justify-content: center;
+}
+
+.service-img {
+	width: 78rpx;
+	height: 78rpx;
+}
+
+.swiper {
+	height: 340rpx;
+}
+
+.grid-text {
+	font-size: 14px;
+	color: #909399;
+	/* padding: 10rpx 0 0 0rpx; */
+}
+
+.client-title {
+	padding: 0 32rpx;
+}
+
+.paiban-sty {
+	display: flex;
+	align-items: center;
+	/* justify-content: center; */
+	margin: 20rpx 0;
+	padding: 0 20rpx;
+}
 </style>

+ 14 - 14
components/CustomTabBar/index.vue

@@ -4,13 +4,13 @@
             <view class="handleBox" v-for="(item) in tabBarList" :key="item.key + 'tab_bar'">
                 <view class="menuBox" @click="goPages(item)">
                     <view class="menuIcon">
-                        <view class="message-style" v-if="item.key === 'chat' && messageCount > 0">{{ messageCount }}
+                        <view class="message-style" v-if="item.key === 'chat' && messageCount > 0">{{  messageCount }}
                         </view>
                         <image v-if="item.key != selectIndex" class="img" :src="item.iconPath"></image>
                         <image v-else class="img" :src="item.selectedIconPath"></image>
                     </view>
                     <view class="menuName">
-                        <text :class="item.key == selectIndex ? 'TextColor' : 'Text'">{{ item.text }}</text>
+                        <text :class="item.key == selectIndex ? 'TextColor' : 'Text'">{{  item.text }}</text>
                     </view>
                 </view>
             </view>
@@ -67,11 +67,11 @@ export default {
                         key: 'class'
                     },
                     {
-                    "pagePath": "/pages/chat",
-                    "iconPath": "/static/images/tabbar/class.png",
-                    "selectedIconPath": "/static/images/tabbar/class_.png",
-                    "text": "消息",
-                    key: 'chat'
+                        "pagePath": "/pages/chat",
+                        "iconPath": "/static/images/tabbar/class.png",
+                        "selectedIconPath": "/static/images/tabbar/class_.png",
+                        "text": "消息",
+                        key: 'chat'
                     },
                     {
                         "pagePath": "/pages/classify",
@@ -97,13 +97,13 @@ export default {
                     "text": "首页",
                     key: 'home'
                 },
-                {
-                    "pagePath": "/pages/mallMenu",
-                    "iconPath": "/static/images/tabbar/class.png",
-                    "selectedIconPath": "/static/images/tabbar/class_.png",
-                    "text": "分类",
-                    key: 'class'
-                },
+                // {
+                //     "pagePath": "/pages/mallMenu",
+                //     "iconPath": "/static/images/tabbar/class.png",
+                //     "selectedIconPath": "/static/images/tabbar/class_.png",
+                //     "text": "分类",
+                //     key: 'class'
+                // },
                 // {
                 //     "pagePath": "/pages/release",
                 //     "iconPath": "/static/images/tabbar/class.png",

+ 107 - 41
pages/chat.vue

@@ -1,38 +1,55 @@
 <template>
     <view class="chat-container">
+
         <scroll-view refresher-enabled :refresher-triggered="isRefreshing" @refresherrefresh="onCustomRefresh"
             class="scroll-view-class" @scrolltolower="scrolltolower" scroll-y>
             <view class="chat-main">
                 <view v-if="list && list.length > 0">
-                    <view class="chat-item" v-for="item in list" :key="item.code" @click="onClick(item)">
-                        <img v-if="item.conversationAvatar" :src="item.conversationAvatar" alt="" class="chat-img" />
-                        <img src="/static/serverImg/mine/user.png" alt="" class="chat-img" v-else/>
-                        <view class="chat-box">
-                            <view class="chat-top">
-                                <text class="chat-name">{{ type?item.userName:item.volunteerName }}</text>
-                                <text class="chat-time">{{ item.createTime }}</text>
-                            </view>
-                            <view class="chat-bottom">
-                                <text class="chat-text">
-                                   {{ item.msgContent }}
-                                </text>
-                                <!-- <view class="chat-num">
-                                    2
-                                </view> -->
-                            </view>
-                        </view>
-                    </view>
-                    <!-- <up-loadmore style="margin-top: 40rpx;" :status="loadmoreInfo.status"
-                     :loadmoreText="loadmoreInfo.loadingText" :loadingText="loadmoreInfo.loadmoreText"
-                     :nomoreText="loadmoreInfo.nomoreText" @loadmore="handleLoadmore" /> -->
+                    <uni-swipe-action>
+                        <uni-swipe-action-item v-for="item in list" :key="item.code" :right-options="[
+                            {
+                                text: '删除',
+                                style: {
+                                    backgroundColor: '#ff4949',
+                                    width: '80px'
+                                }
+                            }
+                        ]" @click="handleDelete(item)">
+                            <template #default>
+                                <view class="chat-item" @click="onClick(item)">
+                                    <img v-if="item.conversationAvatar" :src="item.conversationAvatar" alt=""
+                                        class="chat-img" />
+                                    <img src="/static/serverImg/mine/user.png" alt="" class="chat-img" v-else />
+                                    <view class="chat-box">
+                                        <view class="chat-top">
+                                            <text class="chat-name">{{ item.conversationType === '1' ? '系统消息' :
+                                                type?item.volunteerName:item.userName }}</text>
+                                            <text class="chat-time">{{ handlerData(item.newestMsgTime ||
+                                                item.createTime) }}</text>
+                                        </view>
+                                        <view class="chat-bottom">
+                                            <text class="chat-text">
+                                                {{ item.msgType === '2' ? '[图片]' : item.newestMsgContent || '[暂无消息]' }}
+                                            </text>
+                                            <view class="chat-num"
+                                                v-if="item.msgUnreadCount && item.msgUnreadCount > 0">
+                                                {{ item.msgUnreadCount }}
+                                            </view>
+                                        </view>
+                                    </view>
+                                </view>
+                            </template>
+                        </uni-swipe-action-item>
+                    </uni-swipe-action>
                 </view>
                 <view v-else>
-                    <NoneView value="您还没有相关账单" />
+                    <NoneView value="您还没有相关消息" />
                 </view>
-
-
             </view>
         </scroll-view>
+
+
+
         <custom-tab-bar page="chat" />
     </view>
 
@@ -40,25 +57,25 @@
 
 <script setup>
 import CustomTabBar from '@/components/CustomTabBar/index.vue'
-import { ref, computed } from 'vue'
+import { ref, computed, reactive } from 'vue'
 import { getAccountChangeList, getVolunteerChangeList } from "@/api/mine";
 import { onShow } from '@dcloudio/uni-app';
 import { useDict } from '@/utils/dict.js';
 import NoneView from '@/components/NoneView/index.vue'
-
-import { getList } from '@/api/conversation.js';
+import dayjs from 'dayjs/esm/index'
+import { getList, conversationRemove } from '@/api/conversation.js';
 
 const { } = useDict();
 const userType = uni.getStorageSync('userType') //读取本地存储
+console.log("TCL: userType", userType)
 const list = ref([])
 
 
-const type = computed(() =>{
-    return userType === 1 
+const type = computed(() => {
+    return userType === 1
 })
 const isRefreshing = ref(false)
 
-
 const loadmoreInfo = ref({
     status: 'loadmore',
     loadingText: '努力加载中...',
@@ -70,8 +87,26 @@ const pages = ref({
     pageSize: 10,
     total: 0,
 })
+const isToday = (date) => {
+    return dayjs(date).isSame(dayjs(), 'day');
+};
+
+const isYesterday = (date) => {
+    return dayjs(date).isSame(dayjs().subtract(1, 'day'), 'day');
+};
+const handlerData = (dates) => {
+    const date = dayjs(dates);
+    if (isToday(dates)) {
+        return date.format('HH:MM');;
+    } else if (isYesterday(dates)) {
+        return '昨天';
+    } else {
+        return date.format('YY/MM/DD'); // 或者其他格式如 'YYYY年MM月DD日'
+    }
+}
+
 const onClick = (record) => {
-	console.log("TCL: onClick -> record", record)
+    console.log("TCL: onClick -> record", record)
     uni.navigateTo({
         url: `/pages_orderuser/pages/talk/pages/index/index?conversationRecordId=${record.conversationRecordId}`
     });
@@ -85,6 +120,27 @@ const onCustomRefresh = () => {
     pages.value.current = 1;
     init('top')
 };
+const handleDelete = (item) => {
+    uni.showModal({
+        title: '提示',
+        content: '确定要删除该聊天吗?',
+        success: async (res) => {
+            if (res.confirm) {
+                // 调用删除接口
+                try {
+                    await conversationRemove({
+                        conversationRecordId: item.conversationRecordId,
+                        system: userType === 1 ? '1' : '2'
+                    }); // 替换为实际接口
+                    uni.showToast({ title: '删除成功' });
+                    init('top'); // 刷新列表
+                } catch (err) {
+                    uni.showToast({ title: '删除失败', icon: 'none' });
+                }
+            }
+        }
+    });
+};
 
 const init = async (type) => {
     try {
@@ -107,7 +163,7 @@ const init = async (type) => {
         const res = await getList({
             // pageNum: pages.value.current,
             // pageSize: pages.value.pageSize,
-            system: userType===1?'1':'2'
+            system: userType === 1 ? '1' : '2'
         });
         list.value = type === 'top' ? res.rows : [...list.value, ...res.rows];
         pages.value.total = res.total;
@@ -161,6 +217,7 @@ onShow(() => {
     .chat-item {
         padding: 16rpx;
         display: flex;
+        border-bottom: 1px solid rgba(238, 238, 238, 1);
 
         .chat-img {
             width: 96rpx;
@@ -170,9 +227,9 @@ onShow(() => {
         }
 
         .chat-box {
-            border-bottom: 1px solid rgba(238, 238, 238, 1);
+            // border-bottom: 1px solid rgba(238, 238, 238, 1);
             flex: 1;
-            padding-bottom: 16rpx;
+            // padding-bottom: 16rpx;
 
             .chat-top {
                 display: flex;
@@ -198,6 +255,7 @@ onShow(() => {
             .chat-bottom {
                 display: flex;
                 justify-content: space-between;
+
                 .chat-text {
                     font-size: 28rpx;
                     font-weight: 400;
@@ -206,9 +264,12 @@ onShow(() => {
                     width: 250px;
 
 
-                    white-space: nowrap;       /* 禁止换行 */
-                    overflow: hidden;          /* 隐藏溢出内容 */
-                    text-overflow: ellipsis;   /* 溢出部分显示省略号 */
+                    white-space: nowrap;
+                    /* 禁止换行 */
+                    overflow: hidden;
+                    /* 隐藏溢出内容 */
+                    text-overflow: ellipsis;
+                    /* 溢出部分显示省略号 */
                 }
 
                 .chat-num {
@@ -218,10 +279,11 @@ onShow(() => {
                     align-items: center;
                     justify-content: center;
 
-                    width: 20px;
-                    height: 20px;
-                    border-radius: 20px;
-                    line-height: 20px;
+                    width: 40rpx;
+                    height: 40rpx;
+                    border-radius: 40rpx;
+                    line-height: 40rpx;
+                    font-size: 24rpx;
                 }
             }
 
@@ -230,4 +292,8 @@ onShow(() => {
 
     }
 }
+
+.chat-item {
+    transition: transform 0.2s ease;
+}
 </style>

+ 3 - 2
pages/index.vue

@@ -286,11 +286,12 @@ const addresstree = ref([]);
 onMounted(async () => {
 
 
-  const res_dara = await regionAddresstree()
-  addresstree.value = res_dara.data;
+ 
 
   const token  = getToken();
   if(token){
+    const res_dara = await regionAddresstree()
+    addresstree.value = res_dara.data;
     locateTheCurrentAddress(res_dara.data)
     .then((res) => {
       console.log('locateTheCurrentAddress', res)

+ 20 - 14
pages/mallMenu.vue

@@ -177,6 +177,12 @@ export default {
             const { id } = service;
             const key = id;
             if (this.userType == '2') {
+                // const parmas = { ...service, key,name:service.businessName,record };
+                // uni.navigateTo({
+                //     url: `/pages_home/pages/register/index?data=${encodeURIComponent(JSON.stringify(parmas))}`
+                // })
+                // return;
+
                 const res = await getVolunteerInfo({
                     serviceCategory: key
                 });
@@ -189,11 +195,8 @@ export default {
                     })
                     return
                 }
-                [1, 2] ? uni.navigateTo({
+                uni.navigateTo({
                     url: `/pages_home/pages/register/index?data=${encodeURIComponent(JSON.stringify(parmas))}`
-                }) : uni.showToast({
-                    title: '敬请期待',
-                    icon: 'none'
                 })
                 return;
 
@@ -205,17 +208,20 @@ export default {
             }
             const res = await volunteerSeachgetTreeList(params)
             // 只有第一条和第二条可以跳转
-            if (key === '1' || key === '2') {
-                uni.navigateTo({
+            // if (key === '1' || key === '2') {
+            //     uni.navigateTo({
+            //         url: `/pages_home/pages/client/details?dataList=${encodeURIComponent(JSON.stringify(res.data))}&id=${record.id}`
+            //     });
+            // } else {
+            //     // 其他条目提示“敬请期待”
+            //     uni.showToast({
+            //         title: '敬请期待',
+            //         icon: 'none'
+            //     });
+            // }
+            uni.navigateTo({
                     url: `/pages_home/pages/client/details?dataList=${encodeURIComponent(JSON.stringify(res.data))}&id=${record.id}`
-                });
-            } else {
-                // 其他条目提示“敬请期待”
-                uni.showToast({
-                    title: '敬请期待',
-                    icon: 'none'
-                });
-            }
+            });
 
         }
 

+ 13 - 6
pages/mine.vue

@@ -180,9 +180,12 @@ const adminList = ref(
 			iconName: 'account',
 			operate: () => {
 				uni.setStorageSync('userType', 1);
+				store.dispatch('GetInfo').then((res) => {
+				userInfo.value = store.state.user;
 				uni.reLaunch({
 					url: '/pages/index'
 				});
+			});
 			}
 		},
 	]);
@@ -218,8 +221,11 @@ const userList = ref([
 		iconName: 'account',
 		operate: () => {
 			uni.setStorageSync('userType', 2);
-			uni.reLaunch({
-				url: '/pages/index'
+			store.dispatch('GetInfo').then((res) => {
+				userInfo.value = store.state.user;
+				uni.reLaunch({
+					url: '/pages/index'
+				});
 			});
 		}
 	}
@@ -293,10 +299,11 @@ const handLsetTing = () => {
 
 
 const geUserInfo = () => {
-	console.log(store.state, '>>>>99');
-	store.dispatch('GetInfo').then((res) => {
-		userInfo.value = store.state.user
-	});
+	console.log(store.state.user, '>>>>99');
+	userInfo.value = store.state.user;
+	// store.dispatch('GetInfo').then((res) => {
+	// 	userInfo.value = store.state.user
+	// });
 }
 
 onShow(() => {

+ 5 - 1
pages_home/components/updata-imgs/index.vue

@@ -37,6 +37,10 @@ const props = defineProps({
         type: String,
         default: ''
 
+    },
+    fileCount: {
+        type: Number,
+        default: 1
     }
 });
 const emit = defineEmits(['onSubmit']);
@@ -50,7 +54,7 @@ const deletePic = (index) => {
     getFile();
 };
 const uploadClick = async (type) => {
-    const res = await wxUploadFile(type);
+    const res = await wxUploadFile(type,props.fileCount);
     fileList.value = [...fileList.value, ...res];
     getFile();
     console.log('xxxxres', res, fileList.value);

+ 1 - 1
pages_home/pages/details/index.vue

@@ -239,7 +239,7 @@ onLoad((options) => {
     console.log("option", option);
 
     uni.setNavigationBarTitle({
-        title: option.name + '详情'  // 根据业务逻辑调整 
+        title: option.businessName + '详情'  // 根据业务逻辑调整 
     });
 
     setTimeout(() => {

+ 8 - 5
pages_home/pages/register/index.vue

@@ -110,7 +110,7 @@
 
 
 		<view v-for="item in updata_list" :key="item.key" class="updata-imgs">
-			<UpdataImgs :fileList="file_url[item.key]" :data="item" ref="zsImg" @onSubmit="onChange" />
+			<UpdataImgs :fileList="file_url[item.key]" :data="item" :fileCount="item.fileCount" ref="zsImg" @onSubmit="onChange"  />
 		</view>
 
 
@@ -147,7 +147,8 @@ const updata_list = [
 		key: 'volunteerPicture',
 		ref: userImg,
 		// permission: [1, 2],
-		required: true
+		required: true,
+		fileCount:1
 	},
 	{
 		title: '身份证正面',
@@ -165,7 +166,8 @@ const updata_list = [
 		key: 'idCardPictureBack',
 		ref: zsImg,
 		// permission: [1, 2],
-		required: true
+		required: true,
+		fileCount:2
 	},
 	{
 		title: '职业、资质证书',
@@ -174,7 +176,8 @@ const updata_list = [
 		key: 'certificationPicture',
 		ref: zsImg,
 		// permission: [1, 2],
-		required: false
+		required: false,
+		fileCount:6
 	}
 ]
 
@@ -606,7 +609,7 @@ onLoad((options) => {
 	console.log("option", data.value);
 
 	uni.setNavigationBarTitle({
-		title: option.name  // 根据业务逻辑调整 
+		title: option.businessName  // 根据业务逻辑调整 
 	});
 
 	setTimeout(() => {

+ 67 - 18
pages_orderuser/pages/talk/pages/index/index.vue

@@ -9,12 +9,12 @@
 						<view v-for="(item, index) in talkList" :key="item.msgSendTime" :id="'msg-' + item.msgSendTime">
 							<view class="item flex-col" :class="item.senderId == this.userId ? 'push' : 'pull'">
 								<!-- <image :src="item.pic" mode="aspectFill" class="pic"></image> -->
-								<img v-if="item.senderId !== this.userId" :src="orderInfo.conversationAvatar" alt=""
+								<img v-if="item.senderId !== this.userId" :src="orderInfo.conversationAvatar || '/static/serverImg/mine/user.png' " alt=""
 									class="pic" mode="aspectFill" />
 								<img src="/static/serverImg/mine/user.png" alt="" class="pic" mode="aspectFill"
 									v-else />
 								<view class="content">
-									<template v-if="item.contentType === 'image'">
+									<template v-if="item.msgType === '2'">
 										<image :src="item.msgContent" mode="widthFix" style="width: 400rpx;"></image>
 									</template>
 									<template v-else>
@@ -44,11 +44,10 @@
 </template>
 
 <script>
-import { getHistoryMsg } from "@/pages_orderuser/pages/talk/request/template-talk/history-msg.js";
 import { wxUploadFile, wxMakePhoneCall } from '@/utils/wxRequest.js'
-import { sendMsg, getOrderConversationInfo, getListConversationInfo, setRead } from '@/api/conversation.js';
+import { sendMsg, getOrderConversationInfo, getListConversationInfo, setRead,getHistoryMsg } from '@/api/conversation.js';
 import { onMounted } from "vue";
-
+import store from "@/store"
 export default {
 	data() {
 		return {
@@ -74,6 +73,8 @@ export default {
 			system: '2',
 			userId: uni.getStorageSync('userId'), //读取本地存储
 			conversationRecordId: null,//会话id
+			storeUser:  store.state.user,
+			store:store,
 		}
 	},
 	computed: {
@@ -106,26 +107,61 @@ export default {
 
 		this.getMessage();
 
+	
+
 	},
 	onMounted() {
-		uni.onSocketMessage(function (parmas) {
-			const res = JSON.parse(parmas.data);
-			console.log("TCL: get -> res", res)
-			if (res.type === 'msgNew') {
-				this.talkList.unshift({ ...res.data, code: 200 });
-			}
+		// uni.onSocketMessage(function (parmas) {
+		// 	const res = JSON.parse(parmas.data);
+		// 	console.log("TCL: get -> res", res)
+		// 	if (res.type === 'msgNew') {
+		// 		this.talkList.unshift({ ...res.data, code: 200 });
+		// 	}
 
-			console.log(' onMounted-收到服务器消息:', res, this.talkList);
+		// 	console.log(' onMounted-收到服务器消息:', res, this.talkList);
 
 
-		});
+		// });
+		
 
 	},
 	methods: {
 		// 下拉刷新
 		refresherrefresh(e) {
-			this.getMessage();
+			console.log("TCL: 下拉刷新 -> e", e)
 			this.scrollView.refresherTriggered = true;
+			// this.getMessage();
+			const conversationMsgRecordId = this.talkList[this.talkList.length-1].conversationMsgRecordId;
+			console.log("TCL: refresherrefresh -> conversationMsgRecordId", conversationMsgRecordId,this.talkList[this.talkList.length-1])
+			const msgSendTime =  this.talkList[this.talkList.length-1].msgSendTime
+			getHistoryMsg({conversationMsgRecordId,conversationRecordId:this.conversationRecordId}).then(res => {
+				console.log("TCL: refresherrefresh -> res", res)
+				if(res.code === 200){
+					if(res.data.length === 0) {
+						uni.showToast({
+							title: '没有更多消息了',
+							icon: 'none'
+						})
+						this.scrollView.refresherTriggered = false;
+						return
+					}
+					this.talkList = [...this.talkList,...res.data];
+					this.scrollView.refresherTriggered = false;
+					this.scrollView.intoView = `msg-${msgSendTime}`;
+				}
+			})
+		},
+		listsMessage(){
+			console.log('-----listsMessage---->', this.storeUser,this.storeUser.wsManager);
+
+			this.storeUser.wsManager.onMessage(res => {
+				console.log('--------->', res)
+				// 处理消息逻辑
+				if (res.type === 'msgNew') {
+					this.talkList.unshift({ ...res.data, code: 200 });
+				}
+			});
+
 		},
 		// 获取历史消息
 		getMessage() {
@@ -133,6 +169,15 @@ export default {
 				return;
 			}
 
+			console.log('--------->', this.storeUser);
+			if (!this.storeUser.wsManager) {
+				store.dispatch('GetInfo').then((res) => {
+					this.listsMessage();
+				 });
+			}else{
+				this.listsMessage();
+			}
+
 			// 此处用到 ES7 的 async/await 知识,为使代码更加优美。不懂的请自行学习。
 			let get = async () => {
 				this.ajax.flag = false;
@@ -152,14 +197,16 @@ export default {
 
 				const res = await apiFun(parmas);
 				console.log("TCL: getOrder -> res", res)
-				this.scrollView.refresherTriggered = false;
+			
 				if (res.code === 200) {
 					const data = res.data.vos;
 					// 获取待滚动元素选择器,解决插入数据后,滚动条定位时使用。取当前消息数据的第一条信息元素
 					const selector = `msg-${data?.[0]?.msgSendTime}`;
-
+					// uni.setNavigationBarTitle({
+					// 		title: userType === 1? res.data. :  // 根据业务逻辑调整 
+					// 	});
 					// 将获取到的消息数据合并到消息数组中
-					this.talkList = [...this.talkList, ...data];
+					this.talkList = data;
 					console.log("TCL: getOrder -> talkList", this.talkList)
 					this.orderInfo = res.data;
 
@@ -208,11 +255,13 @@ export default {
 				msgContent: content,
 				msgSendTime: new Date().getTime(),
 				senderId: this.userId,
+				msgType: contentType =='text'?'1':'2',//消息类型 1文字消息 2图片消息
 			}
 			const res = await sendMsg({
 				...this.orderInfo,
 				msgContent: content,
-				system: this.system
+				system: this.system,
+				msgType: data.msgType
 			});
 			this.talkList.unshift({ ...data, code: res.code });
 			this.scrollView.intoView = `msg-${data.msgSendTime}`;

binární
static/Tioimages/1 妇女儿童权益保护服务.png


binární
static/Tioimages/15-旅游服务-01.png


binární
static/Tioimages/1v专业指导.png


binární
static/Tioimages/专家服务.png


binární
static/Tioimages/临时帮手.png


binární
static/Tioimages/交友.png


binární
static/Tioimages/休闲娱乐.png


binární
static/Tioimages/健康管理.png


binární
static/Tioimages/其他服务.png


binární
static/Tioimages/发起维修.png


binární
static/Tioimages/家庭保洁.png


binární
static/Tioimages/家电维修.png


binární
static/Tioimages/本地生活.png


binární
static/Tioimages/父母体检.png


binární
static/Tioimages/福利商城_购物车.png


+ 42 - 15
store/modules/user.ts

@@ -5,7 +5,7 @@ import { login, logout, getInfo } from '@/api/login'
 import { getToken, setToken, removeToken } from '@/utils/auth'
 import { UserState, UserForm } from '@/types/store'
 import { Module } from 'vuex'
-
+import WebSocketManager from '@/utils/WebSocketManager.js';
 const baseUrl = config.baseUrl
 
 const user: Module<UserState, UserState> = {
@@ -15,10 +15,11 @@ const user: Module<UserState, UserState> = {
     avatar: storage.get(constant.avatar),
     roles: storage.get(constant.roles),
     permissions: storage.get(constant.permissions),
-	  userOrWorker: storage.get(constant.userOrWorker),
-    nickName:  storage.get(constant.nickName),
-    userId: null,
-    messageCount:0
+    userOrWorker: storage.get(constant.userOrWorker),
+    nickName: storage.get(constant.nickName),
+    userId: storage.get(constant.userId),
+    messageCount: 0,
+    wsManager: null
   },
   mutations: {
     SET_TOKEN: (state, token: string) => {
@@ -54,6 +55,9 @@ const user: Module<UserState, UserState> = {
     SET_MESSAGECOUNT: (state, num: Number) => {
       state.messageCount = num
     },
+    SET_MESSAGE: (state, ms:any) => {
+      state.wsManager = ms
+    },
   },
 
   actions: {
@@ -79,7 +83,7 @@ const user: Module<UserState, UserState> = {
       return new Promise((resolve, reject) => {
         getInfo().then((res: any) => {
           const user = res.user
-          const avatar = (user == null || user.avatar == "" || user.avatar == null) ? "/static/serverImg/mine/user.png" :  user.avatar
+          const avatar = (user == null || user.avatar == "" || user.avatar == null) ? "/static/serverImg/mine/user.png" : user.avatar
           const username = (user == null || user.userName == "" || user.userName == null) ? "" : user.userName
           if (res.roles && res.roles.length > 0) {
             commit('SET_ROLES', res.roles)
@@ -87,17 +91,39 @@ const user: Module<UserState, UserState> = {
           } else {
             commit('SET_ROLES', ['ROLE_DEFAULT'])
           }
-		  
-		  console.log(res.user.userOrWorker, '>>>>>>res.user.userOrWorker');
-		  
-		  if (res.user)  commit('SET_USERORWORKER', res.user.userOrWorker)
-		  
-		  console.log(state.userOrWorker, '>>>>>>');
-		  
+
+          console.log(res.user.userOrWorker, '>>>>>>res.user.userOrWorker');
+
+          if (res.user) commit('SET_USERORWORKER', res.user.userOrWorker)
+
+          console.log(state.userOrWorker, '>>>>>>');
+
           commit('SET_NAME', username)
           commit('SET_AVATAR', avatar)
           commit('SET_NICKNAME', res.user.nickName)
           commit('SET_USERID', res.user.userId)
+
+
+          console.log("TCL: GetInfo -> wsManager1", this.wsManager)
+          if (this.wsManager) {
+            this.wsManager.closeConnection();
+          }else{
+            //获取账户时,连接soket 
+            const ms = new WebSocketManager(res.user.userId);
+            // 设置消息回调
+            ms.onMessage(data => {
+              // 处理消息逻辑
+              if (data.type === 'msgUnreadCount') {
+                commit('SET_MESSAGECOUNT', data.data);
+              }
+            });
+            // 建立连接
+            ms.connect();
+            commit('SET_MESSAGE', ms)
+
+          }
+          
+
           resolve(res)
         }).catch(error => {
           reject(error)
@@ -115,7 +141,8 @@ const user: Module<UserState, UserState> = {
           removeToken()
 
           uni.setStorageSync('userType', 1)
-          uni.setStorageSync('userId', null)
+          // uni.setStorageSync('userId', null)
+          uni.removeStorageSync('userId')
           storage.clean()
           resolve(res)
         }).catch(error => {
@@ -123,7 +150,7 @@ const user: Module<UserState, UserState> = {
         })
       })
     },
-    handleMessageCount({ commit, state },count) { 
+    handleMessageCount({ commit, state }, count) {
       commit('SET_MESSAGECOUNT', count);
     },
   }

+ 3 - 1
types/store.ts

@@ -5,7 +5,9 @@ export interface UserState {
     avatar: string,
     roles: Array<string>
     permissions: Array<string>
-	userOrWorker: any
+	userOrWorker: any,
+    userId:any,
+    nickName:any
 }
 
 export interface UserForm {

+ 23 - 15
utils/WebSocketManager.js

@@ -1,15 +1,20 @@
-
+import config from '@/config'
+const baseUrl = config.baseUrl
 class WebSocketManager {
     constructor(userId) {
         // 1用户 2志愿者
         this.system = uni.getStorageSync('userType') === 1 ? '1' : '2';
         this.userId = userId;
-        this.url = `ws://192.168.100.127:9527/websocket/${this.system}/${this.userId}`;
+        const url = baseUrl.split('/')[2];
+		console.log("TCL: WebSocketManager -> constructor -> url", url)
+        this.url = `ws://${url}/websocket/${this.system}/${this.userId}`;
+
         this.socketTask = null;
         this.heartbeatInterval = null;
         this.reconnectTimer = null;
         this.isConnecting = false;
         this.onMessageCallback = null;
+
     }
 
     /**
@@ -19,17 +24,18 @@ class WebSocketManager {
         if (this.isConnecting || !this.userId) {
             console.warn('正在连接或缺少用户ID');
             return;
+        }
+         // 如果已有连接,先关闭旧连接
+        if (this.isConnected) {
+            console.log('已存在连接,正在关闭旧连接...');
+            this.socketTask.close();
         }
         this.isConnecting = true;
-
         console.log('建立 WebSocket 连接:', this.url);
-        if(!this.socketTask){
-            this.socketTask = uni.connectSocket({
-                url: this.url,
-                success: () => console.log('WebSocket 连接创建成功'),
-            });
-        }
-       
+        this.socketTask = uni.connectSocket({
+            url: this.url,
+            success: () => console.log('WebSocket 连接创建成功'),
+        });
 
         this._setupEventListeners();
     }
@@ -48,6 +54,7 @@ class WebSocketManager {
             console.log('收到 WebSocket 消息:', res.data);
             try {
                 const data = JSON.parse(res.data);
+				console.log("TCL: WebSocketManager -> _setupEventListeners -> data", data)
                 if (typeof this.onMessageCallback === 'function') {
                     this.onMessageCallback(data); // 回调通知外部
                 }
@@ -124,17 +131,18 @@ class WebSocketManager {
      * 主动关闭连接
      */
     closeConnection() {
-        if (this.socketTask) {
-            this.socketTask.close();
-            this.socketTask = null;
-        }
-        this.stopHeartbeat();
+        console.log('主动关闭连接',this.socketTask);
+        
+        this.socketTask.close();
+        this.socketTask = null;
+        // this.stopHeartbeat();
     }
 
     /**
      * 设置消息回调
      */
     onMessage(callback) {
+		console.log("TCL: WebSocketManager -> onMessage -> callback", callback)
         this.onMessageCallback = callback;
     }
 }

+ 3 - 1
utils/storage.ts

@@ -9,7 +9,9 @@ let storageNodeKeys = [
 	constant.name, 
 	constant.roles,
 	constant.permissions,
-	constant.userOrWorker
+	constant.userOrWorker,
+  constant.nickName,
+  constant.userId
 ]
 
 // 存储的数据