index.vue 59 KB

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