index.vue 45 KB

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