index.vue 44 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846
  1. <template>
  2. <view class="mine-page">
  3. <!-- 用户信息区域 -->
  4. <view class="user-section">
  5. <view class="user-info">
  6. <image class="avatar" :src="userInfo.avatar" mode="aspectFill"></image>
  7. <view class="user-details">
  8. <view class="nickname-row">
  9. <text class="nickname">{{ userInfo.nickname }}</text>
  10. <!-- VIP标志 -->
  11. <view class="vip-badge" v-if="userInfo.isVip">
  12. <text class="vip-badge-text">VIP</text>
  13. </view>
  14. <view class="verify-badge" @click="goVerify" v-if="!userInfo.isVerified">
  15. <text class="verify-text">未实名,立即认证</text>
  16. </view>
  17. </view>
  18. <!-- 基本信息展示 -->
  19. <view class="user-basic-info">
  20. <view class="info-item" v-if="userInfo.gender">
  21. <text class="info-icon">{{ userInfo.gender === 1 ? '👨' : '👩' }}</text>
  22. <text class="info-text">{{ userInfo.genderText }}</text>
  23. </view>
  24. <view class="info-item" v-if="userInfo.age">
  25. <text class="info-icon">🎂</text>
  26. <text class="info-text">{{ userInfo.age }}岁</text>
  27. </view>
  28. <view class="info-item" v-if="userInfo.height">
  29. <text class="info-icon">📏</text>
  30. <text class="info-text">{{ userInfo.height }}cm</text>
  31. </view>
  32. <view class="info-item" v-if="userInfo.educationText">
  33. <text class="info-icon">🎓</text>
  34. <text class="info-text">{{ userInfo.educationText }}</text>
  35. </view>
  36. </view>
  37. <view class="progress-row">
  38. <view class="progress-bar">
  39. <view class="progress-fill" :style="{ width: userInfo.profileProgress + '%' }"></view>
  40. </view>
  41. <text class="progress-text" @click="goCompleteProfile">完善资料 ></text>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. <!-- VIP会员卡片 -->
  47. <view class="vip-card" @click="goVip" v-if="!userInfo.isVip">
  48. <view class="vip-content">
  49. <view class="vip-icon">👑</view>
  50. <view class="vip-info">
  51. <text class="vip-title">VIP会员未开通</text>
  52. <text class="vip-subtitle">开通会员可享受尊贵服务哦</text>
  53. </view>
  54. </view>
  55. <view class="vip-button">立即开通</view>
  56. </view>
  57. <!-- 专属红娘(仅登录后显示) -->
  58. <view class="matchmaker-card" v-if="currentUserId">
  59. <text class="matchmaker-text">您的专属红娘:{{ matchmaker.code || '暂无' }} {{ matchmaker.phone || '' }}</text>
  60. </view>
  61. <!-- 快捷入口 -->
  62. <view class="quick-actions">
  63. <view class="action-item" @click="showCheckinPopup">
  64. <view class="action-icon calendar-icon">📅</view>
  65. <text class="action-label">签到</text>
  66. </view>
  67. <view class="action-item" @click="goToPage('customize')">
  68. <view class="action-icon phone-icon">📞</view>
  69. <text class="action-label">私人定制</text>
  70. </view>
  71. <view class="action-item" @click="goToPage('part-time-matchmaker')">
  72. <view class="action-icon heart-icon">💕</view>
  73. <text class="action-label">加入红娘</text>
  74. </view>
  75. </view>
  76. <!-- 签到弹窗 -->
  77. <uni-popup ref="checkinPopup" type="center" :mask-click="true">
  78. <view class="checkin-popup">
  79. <view class="popup-header">
  80. <text class="popup-title">每日签到</text>
  81. <view class="close-btn" @click="closeCheckinPopup">
  82. <text class="close-icon">✕</text>
  83. </view>
  84. </view>
  85. <view class="checkin-info">
  86. <view class="info-item">
  87. <text class="info-label">已连续签到</text>
  88. <text class="info-value">{{ checkinData.continuousDays }} 天</text>
  89. </view>
  90. <view class="info-item">
  91. <text class="info-label">累计签到</text>
  92. <text class="info-value">{{ checkinData.totalDays }} 天</text>
  93. </view>
  94. </view>
  95. <scroll-view scroll-y class="checkin-content">
  96. <view class="checkin-calendar">
  97. <view class="calendar-header">
  98. <text class="month-text">{{ currentMonth }}</text>
  99. </view>
  100. <view class="week-header">
  101. <text class="week-day" v-for="day in weekDays" :key="day">{{ day }}</text>
  102. </view>
  103. <view class="calendar-body">
  104. <view
  105. class="calendar-day"
  106. v-for="(day, index) in calendarDays"
  107. :key="index"
  108. :class="{
  109. 'empty': !day.date,
  110. 'checked': day.checked,
  111. 'today': day.isToday
  112. }"
  113. >
  114. <text class="day-num" v-if="day.date">{{ day.date }}</text>
  115. <view class="check-mark" v-if="day.checked">✓</view>
  116. </view>
  117. </view>
  118. </view>
  119. <view class="checkin-rewards">
  120. <text class="rewards-title">签到奖励</text>
  121. <view class="rewards-list">
  122. <view
  123. class="reward-item"
  124. v-for="(reward, index) in checkinRewards"
  125. :key="index"
  126. :class="{ 'received': reward.received, 'current': reward.isCurrent }"
  127. >
  128. <view class="reward-icon">{{ reward.icon }}</view>
  129. <text class="reward-day">第{{ reward.day }}天</text>
  130. <text class="reward-text">{{ reward.reward }}</text>
  131. <view class="received-mark" v-if="reward.received">✓</view>
  132. </view>
  133. </view>
  134. </view>
  135. </scroll-view>
  136. <view class="checkin-button-wrapper">
  137. <button
  138. class="checkin-btn"
  139. :class="{ 'disabled': checkinData.todayChecked }"
  140. @click="handleCheckin"
  141. :disabled="checkinData.todayChecked"
  142. >
  143. {{ checkinData.todayChecked ? '今日已签到' : '立即签到' }}
  144. </button>
  145. </view>
  146. </view>
  147. </uni-popup>
  148. <!-- 功能菜单列表 -->
  149. <view class="menu-list">
  150. <view class="menu-item" @click="goToPage('basicInfo')">
  151. <view class="menu-left">
  152. <text class="menu-icon">🆔</text>
  153. <text class="menu-text">基本资料</text>
  154. </view>
  155. <text class="menu-arrow">›</text>
  156. </view>
  157. <view class="menu-item" @click="goToPage('partnerRequirement')">
  158. <view class="menu-left">
  159. <text class="menu-icon">💜</text>
  160. <text class="menu-text">对象要求</text>
  161. </view>
  162. <text class="menu-arrow">›</text>
  163. </view>
  164. <view class="menu-item" @click="goToPage('blacklist')">
  165. <view class="menu-left">
  166. <text class="menu-icon">📋</text>
  167. <text class="menu-text">黑名单</text>
  168. </view>
  169. <text class="menu-arrow">›</text>
  170. </view>
  171. <view class="menu-item" @click="goToPage('myActivity')">
  172. <view class="menu-left">
  173. <text class="menu-icon">📷</text>
  174. <text class="menu-text">我的活动</text>
  175. </view>
  176. <text class="menu-arrow">›</text>
  177. </view>
  178. <view class="menu-item" @click="goToPage('partTimeMatchmaker')">
  179. <view class="menu-left">
  180. <text class="menu-icon">💎</text>
  181. <text class="menu-text">兼职红娘</text>
  182. </view>
  183. <text class="menu-arrow">›</text>
  184. </view>
  185. <view class="menu-item" @click="goToPage('settings')">
  186. <view class="menu-left">
  187. <text class="menu-icon">⚙️</text>
  188. <text class="menu-text">设置</text>
  189. </view>
  190. <text class="menu-arrow">›</text>
  191. </view>
  192. </view>
  193. <!-- 底部导航栏 -->
  194. <view class="tabbar">
  195. <view class="tabbar-item" @click="switchTab('index')">
  196. <text class="tabbar-icon">🏠</text>
  197. <text class="tabbar-text">首页</text>
  198. </view>
  199. <view class="tabbar-item" @click="switchTab('plaza')">
  200. <text class="tabbar-icon">💕</text>
  201. <text class="tabbar-text">广场</text>
  202. </view>
  203. <view class="tabbar-item" @click="switchTab('recommend')">
  204. <text class="tabbar-icon">👍</text>
  205. <text class="tabbar-text">推荐</text>
  206. </view>
  207. <view class="tabbar-item" @click="switchTab('message')">
  208. <text class="tabbar-icon">💬</text>
  209. <text class="tabbar-text">消息</text>
  210. </view>
  211. <view class="tabbar-item active" @click="switchTab('mine')">
  212. <text class="tabbar-icon">👤</text>
  213. <text class="tabbar-text">我的</text>
  214. </view>
  215. </view>
  216. </view>
  217. </template>
  218. <script>
  219. export default {
  220. data() {
  221. return {
  222. // 网关地址
  223. gatewayURL: 'http://localhost:8083',
  224. // 用户ID(如果没有登录,默认为1)
  225. currentUserId: null,
  226. // 用户信息(从后端获取)
  227. userInfo: {
  228. userId: null,
  229. nickname: '准备加载...',
  230. avatar: 'https://via.placeholder.com/100',
  231. phone: '',
  232. email: '',
  233. gender: null,
  234. genderText: '未知',
  235. birthDate: null,
  236. age: null,
  237. isVerified: false,
  238. profileProgress: 0,
  239. isVip: false
  240. },
  241. stats: {
  242. myConnection: 0,
  243. myFavorites: 0,
  244. whoViewedMe: 0,
  245. iViewed: 0
  246. },
  247. matchmaker: {
  248. code: 'xxxxx',
  249. phone: '99*******99'
  250. },
  251. // 签到数据
  252. checkinData: {
  253. continuousDays: 0,
  254. totalDays: 0,
  255. todayChecked: false,
  256. checkedDates: []
  257. },
  258. weekDays: ['日', '一', '二', '三', '四', '五', '六'],
  259. currentMonth: '',
  260. calendarDays: [],
  261. checkinRewards: []
  262. }
  263. },
  264. onLoad() {
  265. console.log('=== 我的页面加载开始 ===')
  266. // 立即检查登录状态
  267. const token = uni.getStorageSync('token')
  268. const userInfo = uni.getStorageSync('userInfo')
  269. if (!token || !userInfo) {
  270. // 未登录,立即强制跳转到登录页
  271. console.log('❌ 未登录,强制跳转到登录页')
  272. uni.showModal({
  273. title: '需要登录',
  274. content: '请先登录后查看个人信息',
  275. showCancel: false, // 不允许取消
  276. confirmText: '去登录',
  277. success: () => {
  278. uni.navigateTo({
  279. url: '/pages/page3/page3'
  280. })
  281. }
  282. })
  283. return
  284. }
  285. // 已登录,同步登录状态
  286. this.syncLoginStatus()
  287. // 监听VIP购买成功事件
  288. uni.$on('vipPurchased', this.handleVipPurchased)
  289. },
  290. onUnload() {
  291. // 页面卸载时移除事件监听
  292. uni.$off('vipPurchased', this.handleVipPurchased)
  293. },
  294. onShow() {
  295. console.log('=== 我的页面显示 ===')
  296. // 检查登录状态
  297. const token = uni.getStorageSync('token')
  298. const userInfo = uni.getStorageSync('userInfo')
  299. if (!token || !userInfo) {
  300. // 未登录,直接跳转(不显示弹窗,因为onLoad已经显示过了)
  301. console.log('❌ 未登录,跳转到登录页')
  302. uni.navigateTo({
  303. url: '/pages/page3/page3'
  304. })
  305. return
  306. }
  307. // 已登录,同步登录状态
  308. this.syncLoginStatus()
  309. },
  310. methods: {
  311. // 同步登录状态并更新页面数据
  312. syncLoginStatus() {
  313. console.log('=== 同步登录状态 ===')
  314. // 获取最新的登录信息
  315. const token = uni.getStorageSync('token')
  316. const userInfo = uni.getStorageSync('userInfo')
  317. const userId = uni.getStorageSync('userId')
  318. console.log('最新登录状态:')
  319. console.log('- token存在:', !!token)
  320. console.log('- userInfo存在:', !!userInfo)
  321. console.log('- userId:', userId)
  322. if (token && userInfo && userId) {
  323. // 已登录状态 - 立即使用存储的用户信息更新页面
  324. console.log('✅ 检测到登录状态,立即更新页面数据')
  325. this.currentUserId = parseInt(userId)
  326. // 直接使用存储的用户信息更新页面
  327. this.userInfo = {
  328. userId: userInfo.userId || userId,
  329. nickname: userInfo.nickname || '用户',
  330. avatar: userInfo.avatarUrl || userInfo.avatar || 'https://via.placeholder.com/100',
  331. phone: this.maskPhone(userInfo.phone) || '',
  332. email: userInfo.email || '',
  333. gender: userInfo.gender,
  334. genderText: this.getGenderText(userInfo.gender),
  335. birthDate: userInfo.birthDate,
  336. age: this.calculateAge(userInfo.birthDate),
  337. isVerified: false,
  338. profileProgress: userInfo.profileProgress || 0,
  339. isVip: false
  340. }
  341. console.log('✅ 页面用户信息已更新:', this.userInfo.nickname)
  342. // 强制页面刷新
  343. this.$forceUpdate()
  344. // 设置统计数据
  345. this.stats = {
  346. myConnection: Math.floor(Math.random() * 8) + 2,
  347. myFavorites: Math.floor(Math.random() * 15) + 5,
  348. whoViewedMe: Math.floor(Math.random() * 12) + 3,
  349. iViewed: Math.floor(Math.random() * 20) + 8
  350. }
  351. // 立即加载最新用户信息(不延迟)
  352. this.loadUserInfo()
  353. } else {
  354. // 未登录状态 - 设置空白用户信息
  355. console.log('❌ 未检测到登录状态')
  356. this.currentUserId = null
  357. // 设置未登录状态的用户信息
  358. this.userInfo = {
  359. userId: null,
  360. nickname: '未登录',
  361. avatar: 'https://via.placeholder.com/100?text=未登录',
  362. phone: '',
  363. email: '',
  364. gender: 0,
  365. genderText: '未知',
  366. birthDate: null,
  367. age: null,
  368. isVerified: false,
  369. profileProgress: 0,
  370. isVip: false
  371. }
  372. // 清空统计数据
  373. this.stats = {
  374. myConnection: 0,
  375. myFavorites: 0,
  376. whoViewedMe: 0,
  377. iViewed: 0
  378. }
  379. // 强制页面更新
  380. this.$forceUpdate()
  381. // 提示需要登录
  382. setTimeout(() => {
  383. uni.showModal({
  384. title: '需要登录',
  385. content: '请先登录后查看完整功能',
  386. showCancel: false,
  387. confirmText: '去登录',
  388. success: () => {
  389. uni.navigateTo({
  390. url: '/pages/page3/page3'
  391. })
  392. }
  393. })
  394. }, 500)
  395. }
  396. },
  397. // 简单的手机号脱敏
  398. maskPhone(phone) {
  399. if (!phone || phone.length < 11) return phone
  400. return phone.substring(0, 3) + '****' + phone.substring(7)
  401. },
  402. // 获取性别文字
  403. getGenderText(gender) {
  404. switch(gender) {
  405. case 1: return '男'
  406. case 2: return '女'
  407. default: return '未知'
  408. }
  409. },
  410. // 计算年龄
  411. calculateAge(birthDate) {
  412. if (!birthDate) return null
  413. const birth = new Date(birthDate)
  414. const today = new Date()
  415. let age = today.getFullYear() - birth.getFullYear()
  416. const monthDiff = today.getMonth() - birth.getMonth()
  417. if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birth.getDate())) {
  418. age--
  419. }
  420. return age
  421. },
  422. // 从后端加载用户信息(通过网关)
  423. loadUserInfo() {
  424. // 检查是否真正登录(必须有token和userInfo)
  425. const token = uni.getStorageSync('token')
  426. const userInfo = uni.getStorageSync('userInfo')
  427. if (!token || !userInfo) {
  428. console.warn('未登录,不加载用户信息')
  429. return
  430. }
  431. // 检查用户ID是否有效
  432. if (!this.currentUserId || this.currentUserId <= 0) {
  433. console.warn('无有效用户ID,无法加载用户信息')
  434. this.setDefaultUserInfo()
  435. return
  436. }
  437. console.log('加载用户信息,用户ID:', this.currentUserId)
  438. // 获取用户基本信息
  439. uni.request({
  440. url: this.gatewayURL + '/api/user/info?userId=' + this.currentUserId,
  441. method: 'GET',
  442. success: (res) => {
  443. console.log('用户信息API响应:', res.data)
  444. if (res.data && res.data.code === 200) {
  445. const data = res.data.data
  446. console.log('✅ API返回用户数据:', data)
  447. // 更新用户信息
  448. this.userInfo = {
  449. userId: data.userId,
  450. nickname: data.nickname || '用户',
  451. avatar: data.avatar || 'https://via.placeholder.com/100',
  452. phone: data.phone,
  453. email: data.email,
  454. gender: data.gender,
  455. genderText: data.genderText,
  456. birthDate: data.birthDate,
  457. age: data.age,
  458. isVerified: data.isVerified || false,
  459. profileProgress: data.profileProgress || 0,
  460. isVip: data.isVip || false,
  461. // 扩展信息
  462. height: data.height,
  463. weight: data.weight,
  464. star: data.star,
  465. animal: data.animal,
  466. educationLevel: data.educationLevel,
  467. educationText: data.educationText,
  468. schoolName: data.schoolName,
  469. company: data.company,
  470. jobTitle: data.jobTitle,
  471. salaryRange: data.salaryRange,
  472. salaryText: data.salaryText,
  473. maritalStatus: data.maritalStatus,
  474. maritalText: data.maritalText,
  475. house: data.house,
  476. houseText: data.houseText,
  477. car: data.car,
  478. carText: data.carText,
  479. hobby: data.hobby,
  480. authenticityScore: data.authenticityScore
  481. }
  482. console.log('✅ 用户信息更新完成:', this.userInfo.nickname)
  483. // 强制页面更新
  484. this.$forceUpdate()
  485. // 加载签到信息
  486. this.loadCheckinInfo()
  487. } else {
  488. console.error('获取用户信息失败:', res.data)
  489. const errorMsg = res.data?.message || '获取用户信息失败'
  490. // 如果是用户不存在的错误,给出特殊提示
  491. if (errorMsg.includes('用户不存在') || errorMsg.includes('用户ID无效')) {
  492. uni.showModal({
  493. title: '用户不存在',
  494. content: `当前用户ID(${this.currentUserId})在数据库中不存在,登录信息有误,请重新登录`,
  495. showCancel: false,
  496. confirmText: '重新登录',
  497. success: () => {
  498. // 清除登录信息并跳转登录页
  499. uni.clearStorageSync()
  500. uni.navigateTo({
  501. url: '/pages/page3/page3?redirect=' + encodeURIComponent('/pages/mine/index')
  502. })
  503. }
  504. })
  505. } else {
  506. uni.showToast({
  507. title: errorMsg,
  508. icon: 'none'
  509. })
  510. // 设置默认用户信息
  511. this.setDefaultUserInfo()
  512. }
  513. }
  514. },
  515. fail: (err) => {
  516. console.error('获取用户信息失败:', err)
  517. // API失败时,提示用户网络错误
  518. uni.showModal({
  519. title: '网络错误',
  520. content: '无法连接到服务器,请检查网络连接或稍后重试',
  521. showCancel: true,
  522. cancelText: '返回',
  523. confirmText: '重试',
  524. success: (modalRes) => {
  525. if (modalRes.confirm) {
  526. // 重试加载
  527. this.loadUserInfo()
  528. }
  529. }
  530. })
  531. // 设置默认用户信息以避免页面空白
  532. this.setDefaultUserInfo()
  533. uni.showToast({
  534. title: '网络连接失败',
  535. icon: 'none',
  536. duration: 2000
  537. })
  538. }
  539. })
  540. },
  541. // 设置默认用户信息(未登录或加载失败时)
  542. setDefaultUserInfo() {
  543. this.userInfo = {
  544. userId: null,
  545. nickname: '未登录用户',
  546. avatar: 'https://via.placeholder.com/100?text=未登录',
  547. phone: '',
  548. email: '',
  549. gender: null,
  550. genderText: '未知',
  551. birthDate: null,
  552. age: null,
  553. isVerified: false,
  554. profileProgress: 0,
  555. isVip: false,
  556. height: null,
  557. weight: null,
  558. star: null,
  559. animal: null,
  560. educationLevel: null,
  561. schoolName: null,
  562. company: null,
  563. jobTitle: null,
  564. salaryRange: null,
  565. maritalStatus: null,
  566. house: null,
  567. car: null,
  568. hobby: null,
  569. authenticityScore: 0
  570. }
  571. // 显示登录提示(仅在没有登录时显示)
  572. const token = uni.getStorageSync('token')
  573. if (!token) {
  574. setTimeout(() => {
  575. uni.showModal({
  576. title: '提示',
  577. content: '请先登录以查看完整功能',
  578. showCancel: true,
  579. cancelText: '稍后',
  580. confirmText: '去登录',
  581. success: (res) => {
  582. if (res.confirm) {
  583. uni.navigateTo({
  584. url: '/pages/page3/page3?redirect=' + encodeURIComponent('/pages/mine/index')
  585. })
  586. }
  587. }
  588. })
  589. }, 1000) // 延迟1秒显示,避免页面刚加载就弹窗
  590. }
  591. },
  592. // 加载签到信息
  593. loadCheckinInfo() {
  594. // 确保有用户ID
  595. if (!this.userInfo.userId) {
  596. console.error('用户ID不存在,无法加载签到信息')
  597. return
  598. }
  599. uni.request({
  600. url: this.gatewayURL + '/api/checkin/info',
  601. method: 'GET',
  602. data: {
  603. userId: this.userInfo.userId
  604. },
  605. success: (res) => {
  606. console.log('签到信息:', res.data)
  607. if (res.data.code === 200) {
  608. const data = res.data.data
  609. // 更新签到数据
  610. this.checkinData = {
  611. continuousDays: data.continuousDays,
  612. totalDays: data.totalDays,
  613. todayChecked: data.todayChecked,
  614. checkedDates: data.checkedDates
  615. }
  616. // 更新奖励列表
  617. this.checkinRewards = data.rewards
  618. // 生成日历
  619. this.generateCalendarFromBackend(data.checkedDates)
  620. }
  621. },
  622. fail: (err) => {
  623. console.error('获取签到信息失败:', err)
  624. uni.showToast({
  625. title: '加载签到信息失败',
  626. icon: 'none'
  627. })
  628. }
  629. })
  630. },
  631. // 根据后端数据生成日历
  632. generateCalendarFromBackend(checkedDates) {
  633. const today = new Date()
  634. const year = today.getFullYear()
  635. const month = today.getMonth()
  636. const todayStr = this.formatDate(today) // 今天的日期字符串
  637. this.currentMonth = `${year}年${month + 1}月`
  638. const firstDay = new Date(year, month, 1).getDay()
  639. const daysInMonth = new Date(year, month + 1, 0).getDate()
  640. const days = []
  641. for (let i = 0; i < firstDay; i++) {
  642. days.push({ date: null, checked: false, isToday: false })
  643. }
  644. for (let i = 1; i <= daysInMonth; i++) {
  645. const date = new Date(year, month, i)
  646. const dateStr = this.formatDate(date)
  647. const isToday = dateStr === todayStr // 通过日期字符串比较,更准确
  648. const checked = checkedDates.includes(dateStr)
  649. days.push({
  650. date: i,
  651. checked: checked,
  652. isToday: isToday,
  653. dateStr: dateStr
  654. })
  655. }
  656. this.calendarDays = days
  657. },
  658. // 格式化日期
  659. formatDate(date) {
  660. const year = date.getFullYear()
  661. const month = String(date.getMonth() + 1).padStart(2, '0')
  662. const day = String(date.getDate()).padStart(2, '0')
  663. return `${year}-${month}-${day}`
  664. },
  665. // 显示签到弹窗
  666. showCheckinPopup() {
  667. this.$refs.checkinPopup.open()
  668. },
  669. // 关闭签到弹窗
  670. closeCheckinPopup() {
  671. this.$refs.checkinPopup.close()
  672. },
  673. // 处理签到(通过网关)
  674. handleCheckin() {
  675. if (this.checkinData.todayChecked) {
  676. uni.showToast({
  677. title: '今日已签到',
  678. icon: 'none'
  679. })
  680. return
  681. }
  682. // 确保有用户ID
  683. if (!this.userInfo.userId) {
  684. uni.showToast({
  685. title: '请先登录',
  686. icon: 'none'
  687. })
  688. return
  689. }
  690. // 调用后端签到接口(通过网关)
  691. uni.request({
  692. url: this.gatewayURL + '/api/checkin/sign?userId=' + this.userInfo.userId,
  693. method: 'POST',
  694. success: (res) => {
  695. console.log('签到结果:', res.data)
  696. if (res.data.code === 200) {
  697. // 显示签到成功提示
  698. uni.showToast({
  699. title: res.data.message,
  700. icon: 'success',
  701. duration: 2500
  702. })
  703. const data = res.data.data
  704. // 更新签到数据
  705. this.checkinData = {
  706. continuousDays: data.continuousDays,
  707. totalDays: data.totalDays,
  708. todayChecked: data.todayChecked,
  709. checkedDates: data.checkedDates
  710. }
  711. // 更新奖励列表
  712. this.checkinRewards = data.rewards
  713. // 重新生成日历
  714. this.generateCalendarFromBackend(data.checkedDates)
  715. } else {
  716. // 签到失败
  717. uni.showToast({
  718. title: res.data.message,
  719. icon: 'none',
  720. duration: 2000
  721. })
  722. }
  723. },
  724. fail: (err) => {
  725. console.error('签到失败:', err)
  726. uni.showToast({
  727. title: '签到失败,请稍后重试',
  728. icon: 'none'
  729. })
  730. }
  731. })
  732. },
  733. goVerify() {
  734. uni.showToast({
  735. title: '前往实名认证',
  736. icon: 'none'
  737. })
  738. },
  739. goCompleteProfile() {
  740. this.goToPage('basicInfo')
  741. },
  742. goVip() {
  743. uni.navigateTo({
  744. url: '/pages/vip/index'
  745. })
  746. },
  747. goToPage(page) {
  748. console.log('=== goToPage 被调用 ===')
  749. console.log('页面参数:', page)
  750. console.log('当前用户ID:', this.currentUserId)
  751. try {
  752. if (page === 'basicInfo') {
  753. console.log('✅ 跳转到基本资料页面')
  754. // 跳转到基本资料页面
  755. uni.navigateTo({
  756. url: '/pages/profile/index',
  757. success: () => {
  758. console.log('✅ 基本资料页面跳转成功')
  759. },
  760. fail: (err) => {
  761. console.error('❌ 基本资料页面跳转失败:', err)
  762. uni.showToast({
  763. title: '页面跳转失败',
  764. icon: 'none'
  765. })
  766. }
  767. })
  768. } else if (page === 'partTimeMatchmaker') {
  769. console.log('✅ 跳转到兼职红娘页面')
  770. // 跳转到兼职红娘页面
  771. uni.navigateTo({
  772. url: '/pages/part-time-matchmaker/index',
  773. success: () => {
  774. console.log('✅ 兼职红娘页面跳转成功')
  775. },
  776. fail: (err) => {
  777. console.error('❌ 兼职红娘页面跳转失败:', err)
  778. uni.showToast({
  779. title: '页面跳转失败',
  780. icon: 'none'
  781. })
  782. }
  783. })
  784. } else if (page === 'blacklist') {
  785. console.log('✅ 跳转到黑名单页面')
  786. // 跳转到黑名单页面
  787. uni.navigateTo({
  788. url: '/pages/blacklist/index',
  789. success: () => {
  790. console.log('✅ 黑名单页面跳转成功')
  791. },
  792. fail: (err) => {
  793. console.error('❌ 黑名单页面跳转失败:', err)
  794. uni.showToast({
  795. title: '页面跳转失败',
  796. icon: 'none'
  797. })
  798. }
  799. })
  800. } else if (page === 'partnerRequirement') {
  801. console.log('✅ 跳转到对象要求页面')
  802. // 跳转到对象要求页面
  803. uni.navigateTo({
  804. url: '/pages/partner-requirement/index',
  805. success: () => {
  806. console.log('✅ 对象要求页面跳转成功')
  807. },
  808. fail: (err) => {
  809. console.error('❌ 对象要求页面跳转失败:', err)
  810. uni.showToast({
  811. title: '页面跳转失败',
  812. icon: 'none'
  813. })
  814. }
  815. })
  816. } else if (page === 'settings') {
  817. console.log('✅ 跳转到设置页面')
  818. // 跳转到设置页面
  819. uni.navigateTo({
  820. url: '/pages/settings/index',
  821. success: () => {
  822. console.log('✅ 设置页面跳转成功')
  823. },
  824. fail: (err) => {
  825. console.error('❌ 设置页面跳转失败:', err)
  826. uni.showToast({
  827. title: '页面跳转失败',
  828. icon: 'none'
  829. })
  830. }
  831. })
  832. } else if (page === 'customize') {
  833. console.log('✅ 跳转到私人定制页面')
  834. // 跳转到私人定制页面
  835. uni.navigateTo({
  836. url: '/pages/customize/index',
  837. success: () => {
  838. console.log('✅ 私人定制页面跳转成功')
  839. },
  840. fail: (err) => {
  841. console.error('❌ 私人定制页面跳转失败:', err)
  842. uni.showToast({
  843. title: '页面跳转失败',
  844. icon: 'none'
  845. })
  846. }
  847. })
  848. } else if (page === 'part-time-matchmaker') {
  849. console.log('✅ 跳转到加入红娘页面')
  850. // 跳转到加入红娘页面
  851. uni.navigateTo({
  852. url: '/pages/part-time-matchmaker/index',
  853. success: () => {
  854. console.log('✅ 加入红娘页面跳转成功')
  855. },
  856. fail: (err) => {
  857. console.error('❌ 加入红娘页面跳转失败:', err)
  858. uni.showToast({
  859. title: '页面跳转失败',
  860. icon: 'none'
  861. })
  862. }
  863. })
  864. } else if (page === 'myActivity') {
  865. console.log('✅ 跳转到我的活动页面')
  866. // 跳转到我的活动页面
  867. uni.navigateTo({
  868. url: '/pages/mine/my-activities',
  869. success: () => {
  870. console.log('✅ 我的活动页面跳转成功')
  871. },
  872. fail: (err) => {
  873. console.error('❌ 我的活动页面跳转失败:', err)
  874. uni.showToast({
  875. title: '页面跳转失败',
  876. icon: 'none'
  877. })
  878. }
  879. })
  880. } else {
  881. console.log('⚠️ 未知页面类型:', page)
  882. uni.showToast({
  883. title: '功能开发中',
  884. icon: 'none'
  885. })
  886. }
  887. } catch (error) {
  888. console.error('❌ goToPage 执行出错:', error)
  889. uni.showToast({
  890. title: '页面跳转异常',
  891. icon: 'none'
  892. })
  893. }
  894. },
  895. switchTab(tab) {
  896. if (tab === 'mine') return
  897. const tabPages = {
  898. index: '/pages/index/index',
  899. plaza: '/pages/plaza/index',
  900. recommend: '/pages/recommend/index',
  901. message: '/pages/message/index'
  902. }
  903. if (tabPages[tab]) {
  904. uni.redirectTo({
  905. url: tabPages[tab]
  906. })
  907. }
  908. },
  909. // 处理退出登录
  910. handleLogout() {
  911. console.log('点击退出登录按钮')
  912. uni.showModal({
  913. title: '退出登录',
  914. content: '确定要退出登录吗?',
  915. showCancel: true,
  916. cancelText: '取消',
  917. confirmText: '确定',
  918. success: (res) => {
  919. if (res.confirm) {
  920. console.log('用户确认退出登录')
  921. this.executeLogout()
  922. } else {
  923. console.log('用户取消退出登录')
  924. }
  925. }
  926. })
  927. },
  928. // 执行退出登录(最可靠的方式)
  929. executeLogout() {
  930. console.log('=== 执行退出登录 ===')
  931. // 立即显示加载状态
  932. uni.showLoading({
  933. title: '退出中...',
  934. mask: true
  935. })
  936. // 延迟执行,确保UI更新
  937. setTimeout(() => {
  938. try {
  939. console.log('步骤1: 清除登录数据')
  940. // 方法1: 逐个清除
  941. uni.removeStorageSync('token')
  942. uni.removeStorageSync('userInfo')
  943. uni.removeStorageSync('userId')
  944. uni.removeStorageSync('rememberedAccount')
  945. console.log('步骤2: 验证数据清除')
  946. const remainToken = uni.getStorageSync('token')
  947. const remainUser = uni.getStorageSync('userInfo')
  948. console.log('清除后检查 - token:', remainToken, 'userInfo:', remainUser)
  949. // 如果还有残留数据,使用强制清除
  950. if (remainToken || remainUser) {
  951. console.log('检测到残留数据,执行强制清除')
  952. uni.clearStorageSync()
  953. }
  954. console.log('步骤3: 重置页面状态')
  955. this.currentUserId = null
  956. this.userInfo = {
  957. userId: null,
  958. nickname: '未登录用户',
  959. avatar: 'https://via.placeholder.com/100?text=未登录'
  960. }
  961. // 隐藏加载,显示成功
  962. uni.hideLoading()
  963. uni.showToast({
  964. title: '退出成功!',
  965. icon: 'success',
  966. duration: 1500
  967. })
  968. // 延迟跳转
  969. setTimeout(() => {
  970. console.log('步骤4: 跳转到登录页面')
  971. uni.reLaunch({
  972. url: '/pages/page3/page3'
  973. })
  974. }, 1500)
  975. } catch (error) {
  976. console.error('退出过程出错:', error)
  977. uni.hideLoading()
  978. // 强制退出
  979. uni.clearStorageSync()
  980. uni.showModal({
  981. title: '退出完成',
  982. content: '已清除登录信息,请重新打开应用',
  983. showCancel: false,
  984. confirmText: '知道了'
  985. })
  986. }
  987. }, 300) // 300毫秒延迟确保UI响应
  988. },
  989. // 设置测试用户数据(基于数据库真实数据)
  990. // ⚠️ 已弃用:此方法仅供调试使用,正常流程不再调用测试数据
  991. setTestUserData() {
  992. console.log('=== 设置测试用户数据 ===')
  993. console.warn('⚠️ 警告:正在使用测试数据,这不应该在生产环境中发生')
  994. // 根据当前用户ID设置对应的数据库用户信息
  995. const userId = this.currentUserId || 1
  996. let userData = {}
  997. switch(userId) {
  998. case 1:
  999. userData = {
  1000. userId: 1,
  1001. nickname: '小明',
  1002. avatar: 'https://example.com/avatar1.jpg',
  1003. phone: '138****8001',
  1004. email: 'user1@example.com',
  1005. gender: 1,
  1006. genderText: '男',
  1007. birthDate: '1990-05-05',
  1008. age: 34,
  1009. isVerified: true,
  1010. profileProgress: 80,
  1011. isVip: false
  1012. }
  1013. break
  1014. case 2:
  1015. userData = {
  1016. userId: 2,
  1017. nickname: '小红',
  1018. avatar: 'https://example.com/avatar2.jpg',
  1019. phone: '138****8002',
  1020. email: 'user2@example.com',
  1021. gender: 2,
  1022. genderText: '女',
  1023. birthDate: '1992-08-22',
  1024. age: 32,
  1025. isVerified: true,
  1026. profileProgress: 90,
  1027. isVip: true
  1028. }
  1029. break
  1030. case 3:
  1031. userData = {
  1032. userId: 3,
  1033. nickname: '用户5718',
  1034. avatar: 'https://via.placeholder.com/100?text=用户',
  1035. phone: '188****5718',
  1036. email: '',
  1037. gender: 0,
  1038. genderText: '未知',
  1039. birthDate: null,
  1040. age: null,
  1041. isVerified: false,
  1042. profileProgress: 30,
  1043. isVip: false
  1044. }
  1045. break
  1046. default:
  1047. userData = {
  1048. userId: userId,
  1049. nickname: '测试用户',
  1050. avatar: 'https://via.placeholder.com/100?text=测试',
  1051. phone: '',
  1052. email: '',
  1053. gender: 0,
  1054. genderText: '未知',
  1055. birthDate: null,
  1056. age: null,
  1057. isVerified: false,
  1058. profileProgress: 20,
  1059. isVip: false
  1060. }
  1061. }
  1062. // 设置用户信息
  1063. this.userInfo = userData
  1064. console.log('✅ 测试用户数据设置完成:', this.userInfo.nickname)
  1065. // 设置统计数据
  1066. this.stats = {
  1067. myConnection: Math.floor(Math.random() * 10),
  1068. myFavorites: Math.floor(Math.random() * 20),
  1069. whoViewedMe: Math.floor(Math.random() * 15),
  1070. iViewed: Math.floor(Math.random() * 25)
  1071. }
  1072. // 显示提示
  1073. uni.showToast({
  1074. title: '使用测试数据: ' + this.userInfo.nickname,
  1075. icon: 'success',
  1076. duration: 2000
  1077. })
  1078. },
  1079. // 处理VIP购买成功事件
  1080. handleVipPurchased() {
  1081. console.log('=== 收到VIP购买成功通知 ===')
  1082. // 延迟刷新,确保后端数据已更新
  1083. setTimeout(() => {
  1084. console.log('开始刷新用户信息...')
  1085. this.loadUserInfo()
  1086. }, 500)
  1087. }
  1088. }
  1089. }
  1090. </script>
  1091. <style lang="scss" scoped>
  1092. /* 扁平化设计风格 */
  1093. .mine-page {
  1094. min-height: 100vh;
  1095. background: #F5F5F5;
  1096. padding-bottom: 120rpx;
  1097. }
  1098. /* 用户信息区域 - 扁平化 */
  1099. .user-section {
  1100. margin: 0;
  1101. margin-top: env(safe-area-inset-top);
  1102. padding: 30rpx;
  1103. background: #FFE5F1;
  1104. .user-info {
  1105. display: flex;
  1106. align-items: flex-start;
  1107. margin-bottom: 40rpx;
  1108. .avatar {
  1109. width: 120rpx;
  1110. height: 120rpx;
  1111. border-radius: 12rpx;
  1112. margin-right: 25rpx;
  1113. background-color: #FFFFFF;
  1114. border: 2rpx solid #E0E0E0;
  1115. }
  1116. .user-details {
  1117. flex: 1;
  1118. .nickname-row {
  1119. display: flex;
  1120. align-items: center;
  1121. margin-bottom: 16rpx;
  1122. margin-top: 10rpx;
  1123. .nickname {
  1124. font-size: 38rpx;
  1125. font-weight: bold;
  1126. color: #333333;
  1127. margin-right: 20rpx;
  1128. }
  1129. /* VIP标志样式 */
  1130. .vip-badge {
  1131. background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
  1132. padding: 6rpx 16rpx;
  1133. border-radius: 6rpx;
  1134. margin-right: 12rpx;
  1135. box-shadow: 0 2rpx 8rpx rgba(255, 215, 0, 0.3);
  1136. .vip-badge-text {
  1137. font-size: 20rpx;
  1138. color: #FFFFFF;
  1139. font-weight: 700;
  1140. letter-spacing: 1rpx;
  1141. }
  1142. }
  1143. .verify-badge {
  1144. background: #B8E986;
  1145. padding: 8rpx 20rpx;
  1146. border-radius: 6rpx;
  1147. .verify-text {
  1148. font-size: 22rpx;
  1149. color: #FFFFFF;
  1150. font-weight: 600;
  1151. }
  1152. }
  1153. }
  1154. /* 基本信息展示 - 扁平化 */
  1155. .user-basic-info {
  1156. display: flex;
  1157. flex-wrap: wrap;
  1158. gap: 16rpx;
  1159. margin-bottom: 20rpx;
  1160. .info-item {
  1161. display: flex;
  1162. align-items: center;
  1163. gap: 8rpx;
  1164. padding: 8rpx 16rpx;
  1165. background: #FFFFFF;
  1166. border-radius: 8rpx;
  1167. border: 2rpx solid #E0E0E0;
  1168. .info-icon {
  1169. font-size: 28rpx;
  1170. }
  1171. .info-text {
  1172. font-size: 24rpx;
  1173. color: #666666;
  1174. font-weight: 500;
  1175. }
  1176. }
  1177. }
  1178. .progress-row {
  1179. display: flex;
  1180. align-items: center;
  1181. .progress-bar {
  1182. flex: 1;
  1183. height: 16rpx;
  1184. background-color: #FFFFFF;
  1185. border-radius: 8rpx;
  1186. overflow: hidden;
  1187. margin-right: 20rpx;
  1188. border: 2rpx solid #E0E0E0;
  1189. .progress-fill {
  1190. height: 100%;
  1191. background: #B8E986;
  1192. border-radius: 6rpx;
  1193. transition: width 0.3s;
  1194. }
  1195. }
  1196. .progress-text {
  1197. font-size: 24rpx;
  1198. color: #666666;
  1199. white-space: nowrap;
  1200. }
  1201. }
  1202. }
  1203. }
  1204. }
  1205. /* VIP会员卡片 - 扁平化 */
  1206. .vip-card {
  1207. margin: 30rpx;
  1208. background: #E8E5FF;
  1209. border-radius: 12rpx;
  1210. padding: 30rpx;
  1211. display: flex;
  1212. align-items: center;
  1213. justify-content: space-between;
  1214. border: 2rpx solid #D5CFFF;
  1215. transition: all 0.2s ease;
  1216. &:active {
  1217. background: #D5CFFF;
  1218. }
  1219. .vip-content {
  1220. display: flex;
  1221. align-items: center;
  1222. .vip-icon {
  1223. font-size: 60rpx;
  1224. margin-right: 20rpx;
  1225. }
  1226. .vip-info {
  1227. display: flex;
  1228. flex-direction: column;
  1229. .vip-title {
  1230. font-size: 32rpx;
  1231. font-weight: bold;
  1232. color: #6B4EA3;
  1233. margin-bottom: 8rpx;
  1234. }
  1235. .vip-subtitle {
  1236. font-size: 24rpx;
  1237. color: #8B7BAA;
  1238. }
  1239. }
  1240. }
  1241. .vip-button {
  1242. background: #9575CD;
  1243. color: #FFFFFF;
  1244. padding: 16rpx 32rpx;
  1245. border-radius: 8rpx;
  1246. font-size: 26rpx;
  1247. white-space: nowrap;
  1248. font-weight: 600;
  1249. }
  1250. }
  1251. /* 专属红娘 - 扁平化 */
  1252. .matchmaker-card {
  1253. margin: 30rpx;
  1254. margin-top: 20rpx;
  1255. background: #FFF8E1;
  1256. border-radius: 12rpx;
  1257. padding: 25rpx;
  1258. text-align: center;
  1259. border: 2rpx solid #FFD54F;
  1260. .matchmaker-text {
  1261. font-size: 26rpx;
  1262. color: #F57C00;
  1263. font-weight: 500;
  1264. }
  1265. }
  1266. /* 快捷入口 - 扁平化 */
  1267. .quick-actions {
  1268. margin: 30rpx;
  1269. background-color: #FFFFFF;
  1270. border-radius: 12rpx;
  1271. padding: 40rpx;
  1272. display: flex;
  1273. justify-content: space-around;
  1274. border: 2rpx solid #E0E0E0;
  1275. .action-item {
  1276. display: flex;
  1277. flex-direction: column;
  1278. align-items: center;
  1279. transition: all 0.2s ease;
  1280. &:active {
  1281. transform: scale(0.95);
  1282. }
  1283. .action-icon {
  1284. width: 100rpx;
  1285. height: 100rpx;
  1286. border-radius: 12rpx;
  1287. display: flex;
  1288. align-items: center;
  1289. justify-content: center;
  1290. font-size: 50rpx;
  1291. margin-bottom: 15rpx;
  1292. border: 2rpx solid #E0E0E0;
  1293. }
  1294. .calendar-icon {
  1295. background: #FFE5E5;
  1296. }
  1297. .phone-icon {
  1298. background: #FFE8F5;
  1299. }
  1300. .heart-icon {
  1301. background: #FFE5E5;
  1302. }
  1303. .action-label {
  1304. font-size: 26rpx;
  1305. color: #666666;
  1306. }
  1307. }
  1308. }
  1309. /* 功能菜单列表 - 扁平化 */
  1310. .menu-list {
  1311. margin: 30rpx;
  1312. background-color: #FFFFFF;
  1313. border-radius: 12rpx;
  1314. overflow: hidden;
  1315. border: 2rpx solid #E0E0E0;
  1316. .menu-item {
  1317. display: flex;
  1318. align-items: center;
  1319. justify-content: space-between;
  1320. padding: 35rpx 30rpx;
  1321. border-bottom: 2rpx solid #F5F5F5;
  1322. transition: all 0.2s ease;
  1323. &:last-child {
  1324. border-bottom: none;
  1325. }
  1326. &:active {
  1327. background: #F5F5F5;
  1328. }
  1329. .menu-left {
  1330. display: flex;
  1331. align-items: center;
  1332. .menu-icon {
  1333. font-size: 44rpx;
  1334. margin-right: 20rpx;
  1335. }
  1336. .menu-text {
  1337. font-size: 30rpx;
  1338. color: #333333;
  1339. }
  1340. }
  1341. .menu-arrow {
  1342. font-size: 50rpx;
  1343. color: #CCCCCC;
  1344. font-weight: 300;
  1345. }
  1346. }
  1347. /* 退出登录特殊样式 - 扁平化 */
  1348. .menu-item.logout-item {
  1349. border-top: 2rpx solid #FFE5E5;
  1350. background: #FFF5F5;
  1351. .menu-left .menu-icon {
  1352. color: #E74C3C;
  1353. }
  1354. .menu-left .menu-text {
  1355. color: #E74C3C;
  1356. font-weight: 500;
  1357. }
  1358. .menu-arrow {
  1359. color: #E74C3C;
  1360. }
  1361. &:active {
  1362. background: #FFEBEB;
  1363. }
  1364. }
  1365. }
  1366. /* 签到弹窗样式 - 扁平化 */
  1367. .checkin-popup {
  1368. width: 650rpx;
  1369. max-height: 85vh;
  1370. background-color: #FFFFFF;
  1371. border-radius: 16rpx;
  1372. overflow: hidden;
  1373. display: flex;
  1374. flex-direction: column;
  1375. border: 2rpx solid #E0E0E0;
  1376. .popup-header {
  1377. display: flex;
  1378. align-items: center;
  1379. justify-content: center;
  1380. padding: 30rpx 30rpx 20rpx;
  1381. position: relative;
  1382. background: #FFE5F1;
  1383. flex-shrink: 0;
  1384. border-bottom: 2rpx solid #E0E0E0;
  1385. .popup-title {
  1386. font-size: 32rpx;
  1387. font-weight: bold;
  1388. color: #E91E63;
  1389. }
  1390. .close-btn {
  1391. position: absolute;
  1392. right: 20rpx;
  1393. top: 25rpx;
  1394. width: 50rpx;
  1395. height: 50rpx;
  1396. display: flex;
  1397. align-items: center;
  1398. justify-content: center;
  1399. .close-icon {
  1400. font-size: 36rpx;
  1401. color: #666666;
  1402. }
  1403. }
  1404. }
  1405. .checkin-info {
  1406. display: flex;
  1407. justify-content: space-around;
  1408. padding: 20rpx 30rpx;
  1409. background: #FFFFFF;
  1410. flex-shrink: 0;
  1411. border-bottom: 2rpx solid #E0E0E0;
  1412. .info-item {
  1413. display: flex;
  1414. flex-direction: column;
  1415. align-items: center;
  1416. .info-label {
  1417. font-size: 22rpx;
  1418. color: #999999;
  1419. margin-bottom: 8rpx;
  1420. }
  1421. .info-value {
  1422. font-size: 36rpx;
  1423. font-weight: bold;
  1424. color: #E91E63;
  1425. }
  1426. }
  1427. }
  1428. .checkin-content {
  1429. flex: 1;
  1430. overflow-y: auto;
  1431. max-height: 50vh;
  1432. }
  1433. .checkin-calendar {
  1434. padding: 20rpx 30rpx;
  1435. .calendar-header {
  1436. text-align: center;
  1437. margin-bottom: 15rpx;
  1438. .month-text {
  1439. font-size: 26rpx;
  1440. font-weight: bold;
  1441. color: #333333;
  1442. }
  1443. }
  1444. .week-header {
  1445. display: flex;
  1446. margin-bottom: 10rpx;
  1447. .week-day {
  1448. flex: 1;
  1449. text-align: center;
  1450. font-size: 22rpx;
  1451. color: #999999;
  1452. }
  1453. }
  1454. .calendar-body {
  1455. display: flex;
  1456. flex-wrap: wrap;
  1457. .calendar-day {
  1458. width: calc(100% / 7);
  1459. height: 70rpx;
  1460. display: flex;
  1461. align-items: center;
  1462. justify-content: center;
  1463. position: relative;
  1464. margin-bottom: 8rpx;
  1465. .day-num {
  1466. font-size: 24rpx;
  1467. color: #333333;
  1468. }
  1469. .check-mark {
  1470. position: absolute;
  1471. top: 3rpx;
  1472. right: 3rpx;
  1473. font-size: 18rpx;
  1474. color: #FFFFFF;
  1475. background: #E91E63;
  1476. width: 26rpx;
  1477. height: 26rpx;
  1478. border-radius: 50%;
  1479. display: flex;
  1480. align-items: center;
  1481. justify-content: center;
  1482. }
  1483. &.empty {
  1484. visibility: hidden;
  1485. }
  1486. &.checked {
  1487. background: #FFE5F1;
  1488. border-radius: 8rpx;
  1489. border: 2rpx solid #E91E63;
  1490. .day-num {
  1491. color: #E91E63;
  1492. font-weight: bold;
  1493. }
  1494. }
  1495. &.today {
  1496. background: #E91E63;
  1497. border-radius: 8rpx;
  1498. .day-num {
  1499. color: #FFFFFF;
  1500. font-weight: bold;
  1501. }
  1502. }
  1503. &.today.checked {
  1504. .check-mark {
  1505. background: #FFFFFF;
  1506. color: #E91E63;
  1507. }
  1508. }
  1509. }
  1510. }
  1511. }
  1512. .checkin-rewards {
  1513. padding: 15rpx 30rpx 20rpx;
  1514. border-top: 1rpx solid #F5F5F5;
  1515. flex-shrink: 0;
  1516. .rewards-title {
  1517. font-size: 26rpx;
  1518. font-weight: bold;
  1519. color: #333333;
  1520. margin-bottom: 15rpx;
  1521. display: block;
  1522. }
  1523. .rewards-list {
  1524. display: flex;
  1525. justify-content: space-between;
  1526. gap: 15rpx;
  1527. .reward-item {
  1528. flex: 1;
  1529. background: #F5F5F5;
  1530. border-radius: 12rpx;
  1531. padding: 20rpx 12rpx;
  1532. display: flex;
  1533. flex-direction: column;
  1534. align-items: center;
  1535. position: relative;
  1536. border: 2rpx solid #E0E0E0;
  1537. .reward-icon {
  1538. font-size: 50rpx;
  1539. margin-bottom: 10rpx;
  1540. }
  1541. .reward-day {
  1542. font-size: 24rpx;
  1543. color: #666666;
  1544. margin-bottom: 8rpx;
  1545. }
  1546. .reward-text {
  1547. font-size: 26rpx;
  1548. color: #333333;
  1549. font-weight: bold;
  1550. }
  1551. .received-mark {
  1552. position: absolute;
  1553. top: 8rpx;
  1554. right: 8rpx;
  1555. width: 32rpx;
  1556. height: 32rpx;
  1557. background: #B8E986;
  1558. color: #FFFFFF;
  1559. border-radius: 50%;
  1560. display: flex;
  1561. align-items: center;
  1562. justify-content: center;
  1563. font-size: 20rpx;
  1564. }
  1565. &.received {
  1566. opacity: 0.6;
  1567. }
  1568. &.current {
  1569. border-color: #E91E63;
  1570. background: #FFE5F1;
  1571. .reward-text {
  1572. color: #E91E63;
  1573. }
  1574. }
  1575. }
  1576. }
  1577. }
  1578. .checkin-button-wrapper {
  1579. padding: 0 30rpx 25rpx;
  1580. flex-shrink: 0;
  1581. .checkin-btn {
  1582. width: 100%;
  1583. background: #E91E63;
  1584. color: #FFFFFF;
  1585. font-size: 30rpx;
  1586. font-weight: bold;
  1587. border-radius: 8rpx;
  1588. padding: 20rpx;
  1589. border: none;
  1590. transition: all 0.2s ease;
  1591. &:active:not(.disabled) {
  1592. opacity: 0.8;
  1593. }
  1594. &.disabled {
  1595. background: #CCCCCC;
  1596. }
  1597. &::after {
  1598. border: none;
  1599. }
  1600. }
  1601. }
  1602. }
  1603. /* 底部导航栏 - 扁平化 */
  1604. .tabbar {
  1605. position: fixed;
  1606. bottom: 0;
  1607. left: 0;
  1608. right: 0;
  1609. display: flex;
  1610. background-color: #FFFFFF;
  1611. border-top: 2rpx solid #E0E0E0;
  1612. padding-bottom: constant(safe-area-inset-bottom);
  1613. padding-bottom: env(safe-area-inset-bottom);
  1614. z-index: 999;
  1615. .tabbar-item {
  1616. flex: 1;
  1617. display: flex;
  1618. flex-direction: column;
  1619. align-items: center;
  1620. justify-content: center;
  1621. padding: 18rpx 0;
  1622. transition: all 0.2s ease;
  1623. &:active {
  1624. background: #F5F5F5;
  1625. }
  1626. .tabbar-icon {
  1627. font-size: 46rpx;
  1628. margin-bottom: 8rpx;
  1629. }
  1630. .tabbar-text {
  1631. font-size: 22rpx;
  1632. color: #666666;
  1633. font-weight: 500;
  1634. }
  1635. &.active {
  1636. background: #FFE5F1;
  1637. .tabbar-text {
  1638. color: #E91E63;
  1639. font-weight: 700;
  1640. }
  1641. }
  1642. }
  1643. }
  1644. </style>