Przeglądaj źródła

feat(matchmaker): 添加红娘工作台切换与退出功能

- 在首页顶部添加红娘工作台切换按钮,仅对红娘用户显示
- 删除红娘工作台自动弹出功能,改为手动点击触发
- 在红娘工作台页面添加退出按钮及确认弹框
- 优化红娘相关按钮的样式和交互效果
- 调整积分商城跳转逻辑,指向具体页面而非提示开发中
- 修改登出跳转方式为 redirectTo,防止返回到已登出页面
- 更新相关 CSS 样式以支持新增的箭头图标和布局调整
李思佳 1 miesiąc temu
rodzic
commit
5281342277

+ 112 - 71
LiangZhiYUMao/pages/index/index.vue

@@ -3,9 +3,20 @@
 		<!-- 顶部状态栏 -->
 		<!-- 顶部状态栏 -->
 		<view class="top-bar">
 		<view class="top-bar">
 			<view class="logo">婚恋</view>
 			<view class="logo">婚恋</view>
-			<view class="msg-icon" @click="goToMessages">
-				<text class="icon">🔔</text>
-				<view v-if="unreadCount > 0" class="badge">{{ unreadCount }}</view>
+			<view class="top-right-icons">
+				<!-- 红娘工作台切换按钮 -->
+			<view v-if="userInfo.isMatchmaker && parseInt(userInfo.isMatchmaker) === 1" 
+				class="matchmaker-btn" @click="openMatchmakerPopup">
+				<view class="arrow-container">
+					<view class="arrow arrow-top"></view>
+					<view class="arrow arrow-bottom"></view>
+				</view>
+			</view>
+				<!-- 消息通知图标 -->
+				<view class="msg-icon" @click="goToMessages">
+					<text class="icon">🔔</text>
+					<view v-if="unreadCount > 0" class="badge">{{ unreadCount }}</view>
+				</view>
 			</view>
 			</view>
 		</view>
 		</view>
 
 
@@ -238,10 +249,11 @@
 		data() {
 		data() {
 			return {
 			return {
 				// 用户信息
 				// 用户信息
-				userInfo: {
-					nickname: '小张',
-					userId: null
-				},
+			userInfo: {
+				nickname: '小张',
+				userId: null,
+				isMatchmaker: '1' // 测试用,实际从后端获取
+			},
 				matchCount: 3,
 				matchCount: 3,
 			
 			
 
 
@@ -336,48 +348,12 @@
 			this.checkMatchmakerStatus()
 			this.checkMatchmakerStatus()
 		},
 		},
 		methods: {
 		methods: {
-			// 检查红娘状态
+			// 删除自动弹出功能,只保留手动点击切换
 			checkMatchmakerStatus() {
 			checkMatchmakerStatus() {
 				// 从本地存储获取用户信息
 				// 从本地存储获取用户信息
 				const userInfo = uni.getStorageSync('userInfo')
 				const userInfo = uni.getStorageSync('userInfo')
 				console.log('🔍 检查红娘状态,用户信息:', userInfo)
 				console.log('🔍 检查红娘状态,用户信息:', userInfo)
-				
-				// 严格判断:只有明确为红娘(值为1)的用户才显示弹框
-				// 使用 parseInt 确保类型一致,避免字符串和数字比较问题
-				if (userInfo && userInfo.isMatchmaker && parseInt(userInfo.isMatchmaker) === 1) {
-					const storageKey = 'matchmakerPopupHandled_' + userInfo.userId
-					console.log('📝 存储键:', storageKey)
-					
-					// 检查用户是否已经处理过红娘工作台提示
-					const matchmakerPopupHandled = uni.getStorageSync(storageKey)
-					console.log('✅ 已处理标记:', matchmakerPopupHandled)
-					
-					if (matchmakerPopupHandled) {
-						console.log('❌ 用户已处理过红娘工作台提示,不再显示弹框')
-						return
-					}
-					
-					// 避免在同一次会话中重复显示弹框
-					if (this.hasShownMatchmakerPopup) {
-						console.log('❌ 本次会话已显示过弹框,不再重复显示')
-						return
-					}
-					
-					console.log('✨ 用户是红娘且未处理过提示,准备显示弹框')
-					// 标记已显示(仅在当前会话中有效)
-					this.hasShownMatchmakerPopup = true
-					// 延迟显示弹框,确保页面已完全加载
-					setTimeout(() => {
-						if (this.$refs.matchmakerPopup) {
-							this.$refs.matchmakerPopup.open()
-							console.log('🎉 弹框已打开')
-						} else {
-							console.error('❌ 弹框组件引用不存在')
-						}
-					}, 500)
-				} else {
-					console.log('ℹ️ 用户不是红娘,isMatchmaker值:', userInfo?.isMatchmaker)
-				}
+				// 此处不再自动弹出弹框,只在用户点击切换按钮时显示
 			},
 			},
 			
 			
 			// 前往红娘工作台
 			// 前往红娘工作台
@@ -385,19 +361,6 @@
 				console.log('🚀 前往红娘工作台')
 				console.log('🚀 前往红娘工作台')
 				this.$refs.matchmakerPopup.close()
 				this.$refs.matchmakerPopup.close()
 				
 				
-				// 标记用户已处理过弹框(选择了前往)
-				const userInfo = uni.getStorageSync('userInfo')
-				if (userInfo && userInfo.userId) {
-					const storageKey = 'matchmakerPopupHandled_' + userInfo.userId
-					uni.setStorageSync(storageKey, true)
-					console.log('💾 已保存处理标记(前往):', storageKey, '=', true)
-					// 验证保存
-					const saved = uni.getStorageSync(storageKey)
-					console.log('🔍 验证保存结果:', saved)
-				} else {
-					console.error('❌ 无法保存标记,用户信息不完整:', userInfo)
-				}
-				
 				// 跳转到红娘工作台
 				// 跳转到红娘工作台
 				uni.navigateTo({
 				uni.navigateTo({
 					url: '/pages/matchmaker-workbench/index'
 					url: '/pages/matchmaker-workbench/index'
@@ -408,19 +371,6 @@
 			closeMatchmakerPopup() {
 			closeMatchmakerPopup() {
 				console.log('🚫 用户选择不前往红娘工作台')
 				console.log('🚫 用户选择不前往红娘工作台')
 				this.$refs.matchmakerPopup.close()
 				this.$refs.matchmakerPopup.close()
-				
-				// 标记用户已处理过弹框(选择了取消)
-				const userInfo = uni.getStorageSync('userInfo')
-				if (userInfo && userInfo.userId) {
-					const storageKey = 'matchmakerPopupHandled_' + userInfo.userId
-					uni.setStorageSync(storageKey, true)
-					console.log('💾 已保存处理标记(取消):', storageKey, '=', true)
-					// 验证保存
-					const saved = uni.getStorageSync(storageKey)
-					console.log('🔍 验证保存结果:', saved)
-				} else {
-					console.error('❌ 无法保存标记,用户信息不完整:', userInfo)
-				}
 			},
 			},
 			
 			
 			// 加载用户信息
 			// 加载用户信息
@@ -945,6 +895,14 @@
 					}
 					}
 				})
 				})
 			},
 			},
+			
+			// 打开红娘工作台弹框
+			openMatchmakerPopup() {
+				// 删除检查处理标记的逻辑,每次点击都显示弹框
+				if (this.$refs.matchmakerPopup) {
+					this.$refs.matchmakerPopup.open()
+				}
+			},
 
 
 
 
 		// 切换Tab
 		// 切换Tab
@@ -990,6 +948,88 @@
 			color: #E91E63;
 			color: #E91E63;
 		}
 		}
 
 
+		.top-right-icons {
+			display: flex;
+			align-items: center;
+			gap: 20rpx;
+		}
+
+		.matchmaker-btn {
+			position: relative;
+			width: 68rpx;
+			height: 68rpx;
+			display: flex;
+			align-items: center;
+			justify-content: center;
+			background: transparent;
+			border-radius: 4rpx;
+			transition: all 0.2s ease;
+			
+			&:active {
+				opacity: 0.6;
+				transform: scale(0.95);
+			}
+
+			.arrow-container {
+				display: flex;
+				flex-direction: column;
+				align-items: center;
+				gap: 4rpx;
+				width: 64rpx;
+			}
+
+			.arrow {
+				position: relative;
+				width: 64rpx;
+				height: 22rpx;
+			}
+
+			.arrow::before,
+			.arrow::after {
+				content: '';
+				position: absolute;
+				transition: all 0.2s ease;
+			}
+
+			/* 上方箭头 - 向右 */
+			.arrow-top::before {
+				top: 8rpx;
+				left: 0;
+				width: 40rpx;
+				height: 6rpx;
+				background: #333;
+			}
+
+			.arrow-top::after {
+				top: 0;
+				right: 0;
+				width: 0;
+				height: 0;
+				border-top: 11rpx solid transparent;
+				border-bottom: 11rpx solid transparent;
+				border-left: 24rpx solid #333;
+			}
+
+			/* 下方箭头 - 向左 */
+			.arrow-bottom::before {
+				top: 8rpx;
+				right: 0;
+				width: 40rpx;
+				height: 6rpx;
+				background: #333;
+			}
+
+			.arrow-bottom::after {
+				top: 0;
+				left: 0;
+				width: 0;
+				height: 0;
+				border-top: 11rpx solid transparent;
+				border-bottom: 11rpx solid transparent;
+				border-right: 24rpx solid #333;
+			}
+		}
+
 		.msg-icon {
 		.msg-icon {
 			position: relative;
 			position: relative;
 			width: 68rpx;
 			width: 68rpx;
@@ -1003,6 +1043,7 @@
 			
 			
 			&:active {
 			&:active {
 				opacity: 0.8;
 				opacity: 0.8;
+				transform: scale(0.95);
 			}
 			}
 
 
 			.icon {
 			.icon {

+ 119 - 12
LiangZhiYUMao/pages/matchmaker-workbench/index.vue

@@ -5,7 +5,13 @@
 			<text class="header-title">红娘工作台</text>
 			<text class="header-title">红娘工作台</text>
 			<view class="header-right">
 			<view class="header-right">
 				<view class="search-icon" @click="handleSearch"></view>
 				<view class="search-icon" @click="handleSearch"></view>
-				<view class="settings-icon" @click="handleSettings"></view>
+				<!-- 退出红娘工作台按钮 -->
+				<view class="exit-workbench-btn" @click="openExitPopup">
+					<view class="arrow-container">
+						<view class="arrow arrow-top"></view>
+						<view class="arrow arrow-bottom"></view>
+					</view>
+				</view>
 			</view>
 			</view>
 		</view>
 		</view>
 
 
@@ -92,6 +98,19 @@
 			</view>
 			</view>
 		</scroll-view>
 		</scroll-view>
 
 
+		<!-- 退出红娘工作台弹框 -->
+		<uni-popup ref="exitPopup" type="dialog">
+			<uni-popup-dialog
+				type="confirm"
+				title="退出工作台"
+				content="确定要退出红娘工作台吗?"
+				confirmText="确定"
+				cancelText="取消"
+				@confirm="exitWorkbench"
+				@cancel="closeExitPopup">
+			</uni-popup-dialog>
+		</uni-popup>
+
 		<!-- 底部导航 -->
 		<!-- 底部导航 -->
 		<view class="tabbar">
 		<view class="tabbar">
 			<view class="tabbar-item active" @click="navigateToWorkbench">
 			<view class="tabbar-item active" @click="navigateToWorkbench">
@@ -151,9 +170,27 @@ export default {
 			handleSearch() {
 			handleSearch() {
 				// 实现搜索功能
 				// 实现搜索功能
 			},
 			},
-			// 设置
-			handleSettings() {
-				// 实现设置功能
+			// 打开退出工作台弹框
+			openExitPopup() {
+				if (this.$refs.exitPopup) {
+					this.$refs.exitPopup.open()
+				}
+			},
+			// 关闭退出工作台弹框
+			closeExitPopup() {
+				if (this.$refs.exitPopup) {
+					this.$refs.exitPopup.close()
+				}
+			},
+			// 退出红娘工作台
+			exitWorkbench() {
+				if (this.$refs.exitPopup) {
+					this.$refs.exitPopup.close()
+				}
+				// 返回用户首页
+				uni.redirectTo({
+					url: '/pages/index/index'
+				})
 			},
 			},
 			// 公告点击
 			// 公告点击
 			handleAnnouncement() {
 			handleAnnouncement() {
@@ -245,20 +282,90 @@ export default {
 			gap: 20rpx;
 			gap: 20rpx;
 
 
 			.search-icon,
 			.search-icon,
-			.settings-icon {
-				width: 44rpx;
-				height: 44rpx;
-				background-size: contain;
-				background-repeat: no-repeat;
-				background-position: center;
+			.exit-workbench-btn {
+				width: 68rpx;
+				height: 68rpx;
+				display: flex;
+				align-items: center;
+				justify-content: center;
 			}
 			}
 
 
 			.search-icon {
 			.search-icon {
 				background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23999"><path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"/></svg>');
 				background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23999"><path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"/></svg>');
+				background-size: 44rpx 44rpx;
+				background-repeat: no-repeat;
+				background-position: center;
 			}
 			}
 
 
-			.settings-icon {
-				background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23999"><path d="M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z"/></svg>');
+			/* 退出工作台按钮样式 */
+			.exit-workbench-btn {
+				background: transparent;
+				border-radius: 4rpx;
+				transition: all 0.2s ease;
+				
+				&:active {
+					opacity: 0.6;
+					transform: scale(0.95);
+				}
+
+				.arrow-container {
+					display: flex;
+					flex-direction: column;
+					align-items: center;
+					gap: 4rpx;
+					width: 60rpx;
+				}
+
+				.arrow {
+					position: relative;
+					width: 64rpx;
+					height: 22rpx;
+				}
+
+				.arrow::before,
+				.arrow::after {
+					content: '';
+					position: absolute;
+					transition: all 0.2s ease;
+				}
+
+				/* 上方箭头 - 向右 */
+				.arrow-top::before {
+					top: 8rpx;
+					left: 0;
+					width: 40rpx;
+					height: 6rpx;
+					background: #333;
+				}
+
+				.arrow-top::after {
+					top: 0;
+					right: 0;
+					width: 0;
+					height: 0;
+					border-top: 11rpx solid transparent;
+					border-bottom: 11rpx solid transparent;
+					border-left: 24rpx solid #333;
+				}
+
+				/* 下方箭头 - 向左 */
+				.arrow-bottom::before {
+					top: 8rpx;
+					right: 0;
+					width: 40rpx;
+					height: 6rpx;
+					background: #333;
+				}
+
+				.arrow-bottom::after {
+					top: 0;
+					left: 0;
+					width: 0;
+					height: 0;
+					border-top: 11rpx solid transparent;
+					border-bottom: 11rpx solid transparent;
+					border-right: 24rpx solid #333;
+				}
 			}
 			}
 		}
 		}
 	}
 	}

+ 4 - 6
LiangZhiYUMao/pages/matchmaker-workbench/mine.vue

@@ -154,10 +154,8 @@
 			},
 			},
 			// 积分商城
 			// 积分商城
 			handlePointsMall() {
 			handlePointsMall() {
-				console.log('积分商城')
-				uni.showToast({
-					title: '积分商城开发中',
-					icon: 'none'
+				uni.navigateTo({
+					url: '/pages/matchmaker-workbench/points-mall'
 				})
 				})
 			},
 			},
 			// 编辑资料
 			// 编辑资料
@@ -186,8 +184,8 @@
 							// 清除本地存储
 							// 清除本地存储
 							uni.removeStorageSync('token')
 							uni.removeStorageSync('token')
 							uni.removeStorageSync('userInfo')
 							uni.removeStorageSync('userInfo')
-							// 跳转到登录页
-							uni.navigateTo({
+							// 跳转到登录页,使用redirectTo确保无法返回
+							uni.redirectTo({
 								url: '/pages/page3/page3'
 								url: '/pages/page3/page3'
 							})
 							})
 						}
 						}