mazhenhang 1 mesiac pred
rodič
commit
f5f7cbb2a7
1 zmenil súbory, kde vykonal 12 pridanie a 372 odobranie
  1. 12 372
      LiangZhiYUMao/pages/matchmaker-workbench/mine.vue

+ 12 - 372
LiangZhiYUMao/pages/matchmaker-workbench/mine.vue

@@ -70,19 +70,12 @@
             <text class="settings-text">编辑资料</text>
             <view class="arrow-right"></view>
           </view>
-				<!-- 设置选项 -->
-				<view class="settings-section">
-					<view class="settings-item" @click="handleSuccessCaseUpload">
-						<view class="settings-icon success-case"></view>
-						<text class="settings-text">撮合成功审核</text>
-						<view class="arrow-right"></view>
-					</view>
-
-					<view class="settings-item" @click="handleEditProfile">
-						<view class="settings-icon user"></view>
-						<text class="settings-text">编辑资料</text>
-						<view class="arrow-right"></view>
-					</view>
+
+          <view class="settings-item" @click="handleSuccessCaseUpload">
+            <view class="settings-icon success-case"></view>
+            <text class="settings-text">撮合成功审核</text>
+            <view class="arrow-right"></view>
+          </view>
 
           <view class="settings-item" @click="handleAccountSettings">
             <view class="settings-icon info"></view>
@@ -567,7 +560,6 @@ export default {
         }
       } catch (error) {
         console.error('签到失败:', error)
-        // 检查是否是已签到的错误
         if (error.msg && error.msg.includes('已签到')) {
           this.isSignedToday = true
           uni.showToast({
@@ -604,6 +596,12 @@ export default {
         url: '/pages/matchmaker-workbench/points-mall'
       })
     },
+    // 撮合成功审核
+    handleSuccessCaseUpload() {
+      uni.navigateTo({
+        url: '/pages/matchmaker-workbench/success-case-upload'
+      })
+    },
     // 编辑资料
     handleEditProfile() {
       console.log('编辑资料')
@@ -663,364 +661,6 @@ export default {
     }
   }
 }
-	import api from '../../utils/api.js'
-	export default {
-		data() {
-			return {
-				profile: {
-					realName: '',
-					avatarUrl: '',
-					badge: '',
-					rating: 5.0,
-					level: '',
-					levelName: '',
-					nextLevelName: '',
-					points: 0,
-					currentLevelPoints: 0,
-					nextLevelPoints: 100,
-					pointsToNextLevel: 0,
-					levelProgress: 0
-				},
-				// 签到相关
-				isSignedToday: false,
-				continuousDays: 0,
-				totalDays: 0,
-				currentDate: new Date(),
-				calendarTitle: '',
-				calendarDays: []
-			}
-		},
-		onLoad() {
-			this.loadProfileData()
-			this.checkSignInStatus()
-			this.generateCalendar()
-		},
-		onShow() {
-			// 从编辑资料页返回时,自动刷新个人资料
-			this.loadProfileData()
-		},
-		computed: {
-			unreadCount() {
-				return this.$store.getters.getTotalUnread || 0
-			}
-		},
-		methods: {
-			// 生成日历数据
-			generateCalendar() {
-				const date = this.currentDate || new Date()
-				const year = date.getFullYear()
-				const month = date.getMonth()
-				// 设置日历标题
-				this.calendarTitle = `${year}年·${month + 1}月`
-				// 获取当月第一天
-				const firstDay = new Date(year, month, 1)
-				// 获取当月第一天是星期几(0-6,0表示周日)
-				const firstDayWeek = firstDay.getDay()
-				// 获取当月最后一天
-				const lastDay = new Date(year, month + 1, 0)
-				// 获取当月最后一天的日期
-				const lastDayDate = lastDay.getDate()
-				// 获取上个月最后一天的日期
-				const prevMonthLastDay = new Date(year, month, 0).getDate()
-				const days = []
-				// 添加上个月的日期
-				for (let i = firstDayWeek - 1; i >= 0; i--) {
-					days.push({
-						date: prevMonthLastDay - i,
-						isCurrentMonth: false,
-						isToday: false,
-						isChecked: false
-					})
-				}
-				// 添加当月的日期
-				const today = new Date()
-				const isCurrentMonth = today.getFullYear() === year && today.getMonth() === month
-				for (let i = 1; i <= lastDayDate; i++) {
-					const isToday = isCurrentMonth && today.getDate() === i
-					days.push({
-						date: i,
-						isCurrentMonth: true,
-						isToday: isToday,
-						isChecked: isToday && this.isSignedToday
-					})
-				}
-				// 添加下个月的日期,补满6行
-				const totalDays = 42 // 6行7列
-				const nextMonthDays = totalDays - days.length
-				for (let i = 1; i <= nextMonthDays; i++) {
-					days.push({
-						date: i,
-						isCurrentMonth: false,
-						isToday: false,
-						isChecked: false
-					})
-				}
-				this.calendarDays = days
-			},
-			// 加载个人资料数据
-			async loadProfileData() {
-				try {
-					const userInfo = uni.getStorageSync('userInfo')
-					console.log('从本地存储获取到的用户信息:', userInfo)
-					// 模拟用户信息,用于测试
-					const testUserId = 19
-					const userId = userInfo && userInfo.userId ? userInfo.userId : testUserId
-					console.log('使用的userId:', userId)
-					// 调用API获取红娘信息
-					console.log('开始调用API获取红娘信息...')
-					const matchmakerInfo = await api.matchmaker.getByUserId(userId)
-					console.log('API调用结果:', matchmakerInfo)
-					if (matchmakerInfo) {
-						const levelNames = ['', '青铜', '白银', '黄金', '铂金', '钻石']
-						const currentLevel = matchmakerInfo.level || 1
-						const nextLevel = currentLevel < 5 ? currentLevel + 1 : 5
-						const nextLevelName = levelNames[nextLevel]
-						const defaultAvatars = {
-							male: 'http://115.190.125.125:9000/dynamic-comments/dynamics/5c645152-9940-41d3-83a9-69ee6e0c0aaa.png',
-							female: 'http://115.190.125.125:9000/dynamic-comments/dynamics/c7fb04d7-ee4d-4b3d-bcef-f246da9c841f.png'
-						}
-						const avatarUrl = matchmakerInfo.gender === 1 ? defaultAvatars.male : defaultAvatars.female
-						console.log('获取到的红娘信息:', matchmakerInfo)
-						this.profile = {
-							realName: matchmakerInfo.real_name || '',
-							avatarUrl: avatarUrl,
-							badge: matchmakerInfo.type_name || '',
-							rating: matchmakerInfo.rating || 5.0,
-							level: currentLevel,
-							levelName: matchmakerInfo.level_name || levelNames[currentLevel],
-							nextLevelName: nextLevelName,
-							points: matchmakerInfo.points || 0,
-							currentLevelPoints: matchmakerInfo.current_level_points || 0,
-							nextLevelPoints: matchmakerInfo.next_level_points || 100,
-							pointsToNextLevel: matchmakerInfo.points_to_next_level || 0,
-							levelProgress: matchmakerInfo.level_progress || 0
-						}
-						console.log('更新后的profile数据:', this.profile)
-					} else {
-						console.log('matchmakerInfo为空,无法更新profile数据')
-					}
-				} catch (error) {
-					console.error('加载个人资料失败:', error)
-					uni.showToast({
-						title: '加载失败,请稍后重试: ' + error.message,
-						icon: 'none'
-					})
-				}
-			},
-			// 返回上一页
-			goBack() {
-				uni.navigateBack()
-			},
-			// 检查今日是否已签到
-			async checkSignInStatus() {
-				try {
-					const userInfo = uni.getStorageSync('userInfo')
-					const userId = userInfo && userInfo.userId ? userInfo.userId : null
-					if (userId) {
-						const res = await api.matchmaker.checkinStatus(userId)
-						console.log('检查签到状态返回结果:', res)
-						let signed = false
-						if (typeof res === 'boolean') {
-							signed = res
-						} else if (typeof res === 'string') {
-							signed = res === 'true'
-						} else if (typeof res === 'number') {
-							signed = res === 1
-						} else if (res && typeof res === 'object') {
-							if (typeof res.todaySigned === 'boolean') signed = res.todaySigned
-							else if (typeof res.signed === 'boolean') signed = res.signed
-							else if (typeof res.isSignedToday === 'boolean') signed = res.isSignedToday
-							else if (typeof res.data === 'object' && res.data) {
-								if (typeof res.data.todaySigned === 'boolean') signed = res.data.todaySigned
-								else if (typeof res.data.signed === 'boolean') signed = res.data.signed
-								else if (typeof res.data.isSignedToday === 'boolean') signed = res.data.isSignedToday
-							}
-						}
-						this.isSignedToday = !!signed
-						const stats = await api.matchmaker.checkinStats(userId)
-						console.log('获取签到统计返回结果:', stats)
-						if (stats) {
-							this.continuousDays = stats.continuousDays || 0
-							this.totalDays = stats.totalDays || 0
-						}
-					} else {
-						this.isSignedToday = false
-						this.continuousDays = 0
-						this.totalDays = 0
-						console.warn('没有有效的userId,无法检查签到状态')
-					}
-				} catch (error) {
-					console.error('检查签到状态失败:', error)
-					this.isSignedToday = false
-					this.continuousDays = 0
-					this.totalDays = 0
-				}
-			},
-			// 显示签到弹框
-			showSignInPopup() {
-				this.$refs.signInPopup.open()
-			},
-			// 关闭签到弹框
-			closeSignInPopup() {
-				this.$refs.signInPopup.close()
-			},
-			// 执行签到
-			async doSignIn() {
-				try {
-					const userInfo = uni.getStorageSync('userInfo')
-					const userId = userInfo && userInfo.userId ? userInfo.userId : null
-					if (userId) {
-						const res = await api.matchmaker.doCheckin(userId)
-						console.log('签到API返回结果:', res)
-						let success = false
-						let alreadySigned = false
-						if (typeof res === 'boolean') {
-							success = res
-						} else if (typeof res === 'string') {
-							success = res === 'true' || res === 'ok' || res === 'success'
-						} else if (res && typeof res === 'object') {
-							if (typeof res.success === 'boolean') success = res.success
-							if (typeof res.todaySigned === 'boolean') alreadySigned = res.todaySigned
-							else if (typeof res.signed === 'boolean') alreadySigned = res.signed
-							else if (typeof res.isSignedToday === 'boolean') alreadySigned = res.isSignedToday
-							if (res.data && typeof res.data === 'object') {
-								if (typeof res.data.success === 'boolean') success = res.data.success
-								if (typeof res.data.todaySigned === 'boolean') alreadySigned = res.data.todaySigned
-								else if (typeof res.data.signed === 'boolean') alreadySigned = res.data.signed
-								else if (typeof res.data.isSignedToday === 'boolean') alreadySigned = res.data.isSignedToday
-							}
-						}
-						if (success) {
-							uni.showToast({
-								title: '签到成功',
-								icon: 'success'
-							})
-							this.isSignedToday = true
-							this.generateCalendar()
-							this.loadProfileData()
-							this.closeSignInPopup()
-						} else if (alreadySigned) {
-							uni.showToast({
-								title: '今日已签到',
-								icon: 'none'
-							})
-						} else {
-							uni.showToast({
-								title: '签到失败,请稍后重试',
-								icon: 'none'
-							})
-						}
-					} else {
-						uni.showToast({
-							title: '请先登录',
-							icon: 'none'
-						})
-						setTimeout(() => {
-							uni.navigateTo({
-								url: '/pages/page3/page3'
-							})
-						}, 1000)
-					}
-				} catch (error) {
-					console.error('签到失败:', error)
-					uni.showToast({
-						title: error.msg || '签到失败,请稍后重试',
-						icon: 'none'
-					})
-				}
-			},
-			// 签到(旧方法,保持兼容)
-			handleSignIn() {
-				this.showSignInPopup()
-			},
-			// 我的资源
-			handleMyResources() {
-				uni.navigateTo({
-					url: '/pages/matchmaker-workbench/my-resources'
-				})
-			},
-			// 活动中心
-			handleActivityCenter() {
-				uni.navigateTo({
-					url: '/pages/activities/list'
-				})
-			},
-			// 积分商城
-			handlePointsMall() {
-				console.log('积分商城')
-				uni.showToast({
-					title: '积分商城开发中',
-					icon: 'none'
-				})
-			},
-			// 撮合成功审核
-			handleSuccessCaseUpload() {
-				console.log('撮合成功审核')
-				uni.navigateTo({
-					url: '/pages/matchmaker-workbench/success-case-upload'
-				})
-			},
-			// 编辑资料
-			handleEditProfile() {
-				console.log('编辑资料')
-				uni.navigateTo({
-					url: '/pages/matchmaker-workbench/edit-profile'
-				})
-			},
-			// 账户设置
-			handleAccountSettings() {
-				console.log('账户设置')
-				uni.showToast({
-					title: '账户设置开发中',
-					icon: 'none'
-				})
-			},
-			// 退出登录
-			handleLogout() {
-				uni.showModal({
-					title: '退出登录',
-					content: '确定要退出登录吗?',
-					success: (res) => {
-						if (res.confirm) {
-							uni.removeStorageSync('token')
-							uni.removeStorageSync('userInfo')
-							uni.navigateTo({
-								url: '/pages/page3/page3'
-							})
-						}
-					}
-				})
-			},
-			// 导航到工作台
-			navigateToWorkbench() {
-				uni.navigateTo({
-					url: '/pages/matchmaker-workbench/index'
-				})
-			},
-			// 导航到我的资源
-			navigateToMyResources() {
-				uni.navigateTo({
-					url: '/pages/matchmaker-workbench/my-resources'
-				})
-			},
-			// 导航到排行榜
-			navigateToRanking() {
-				uni.navigateTo({
-					url: '/pages/matchmaker-workbench/ranking'
-				})
-			},
-			// 导航到消息
-			navigateToMessage() {
-				uni.navigateTo({
-					url: '/pages/matchmaker-workbench/message'
-				})
-			},
-			// 导航到我的
-			navigateToMine() {
-				// 已在我的页面,无需跳转
-			}
-		}
-	}
 </script>
 
 <style lang="scss" scoped>