index.vue 58 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217
  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. <text class="tabbar-icon">🏠</text>
  219. <text class="tabbar-text">首页</text>
  220. </view>
  221. <view class="tabbar-item" @click="switchTab('plaza')">
  222. <text class="tabbar-icon">💕</text>
  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 >= 1" class="tabbar-badge">{{ unreadCount }}</view>
  233. </view> -->
  234. <view class="tabbar-item" @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.navigateTo({
  760. url: '/pages/settings/id-verification'
  761. })
  762. },
  763. goCompleteProfile() {
  764. this.goToPage('basicInfo')
  765. },
  766. goVip() {
  767. uni.navigateTo({
  768. url: '/pages/vip/index'
  769. })
  770. },
  771. goToPage(page) {
  772. try {
  773. if (page === 'basicInfo') {
  774. uni.navigateTo({
  775. url: '/pages/profile/index',
  776. success: () => {
  777. },
  778. fail: (err) => {
  779. console.error('❌ 基本资料页面跳转失败:', err)
  780. uni.showToast({
  781. title: '页面跳转失败',
  782. icon: 'none'
  783. })
  784. }
  785. })
  786. } else if (page === 'verifyRealName') {
  787. // 跳转到实名认证页面
  788. uni.navigateTo({
  789. url: '/pages/settings/id-verification',
  790. success: () => {
  791. },
  792. fail: (err) => {
  793. console.error('❌ 实名认证页面跳转失败:', err)
  794. uni.showToast({
  795. title: '页面跳转失败',
  796. icon: 'none'
  797. })
  798. }
  799. })
  800. } else if (page === 'verifyEducation') {
  801. // 跳转到实名认证页面
  802. uni.navigateTo({
  803. url: '/pages/settings/id-verification',
  804. success: () => {
  805. },
  806. fail: (err) => {
  807. console.error('❌ 学历认证页面跳转失败:', err)
  808. uni.showToast({
  809. title: '页面跳转失败',
  810. icon: 'none'
  811. })
  812. }
  813. })
  814. } else if (page === 'partTimeMatchmaker') {
  815. // 跳转到兼职红娘页面
  816. uni.navigateTo({
  817. url: '/pages/part-time-matchmaker/index',
  818. success: () => {
  819. },
  820. fail: (err) => {
  821. console.error('❌ 兼职红娘页面跳转失败:', err)
  822. uni.showToast({
  823. title: '页面跳转失败',
  824. icon: 'none'
  825. })
  826. }
  827. })
  828. } else if (page === 'blacklist') {
  829. // 跳转到黑名单页面
  830. uni.navigateTo({
  831. url: '/pages/blacklist/index',
  832. success: () => {
  833. },
  834. fail: (err) => {
  835. console.error('❌ 黑名单页面跳转失败:', err)
  836. uni.showToast({
  837. title: '页面跳转失败',
  838. icon: 'none'
  839. })
  840. }
  841. })
  842. } else if (page === 'partnerRequirement') {
  843. // 跳转到对象要求页面
  844. uni.navigateTo({
  845. url: '/pages/partner-requirement/index',
  846. success: () => {
  847. },
  848. fail: (err) => {
  849. console.error('❌ 对象要求页面跳转失败:', err)
  850. uni.showToast({
  851. title: '页面跳转失败',
  852. icon: 'none'
  853. })
  854. }
  855. })
  856. } else if (page === 'feedback') {
  857. uni.navigateTo({
  858. url: '/pages/feedback/index',
  859. success: () => {
  860. },
  861. fail: (err) => {
  862. console.error('❌ 用户反馈页面跳转失败:', err)
  863. uni.showToast({
  864. title: '页面跳转失败',
  865. icon: 'none'
  866. })
  867. }
  868. })
  869. } else if (page === 'settings') {
  870. uni.navigateTo({
  871. url: '/pages/settings/index',
  872. success: () => {
  873. },
  874. fail: (err) => {
  875. console.error('❌ 设置页面跳转失败:', err)
  876. uni.showToast({
  877. title: '页面跳转失败',
  878. icon: 'none'
  879. })
  880. }
  881. })
  882. }
  883. else if (page === 'part-time-matchmaker') {
  884. uni.navigateTo({
  885. url: '/pages/part-time-matchmaker/index',
  886. success: () => {
  887. },
  888. fail: (err) => {
  889. console.error('❌ 加入红娘页面跳转失败:', err)
  890. uni.showToast({
  891. title: '页面跳转失败',
  892. icon: 'none'
  893. })
  894. }
  895. })
  896. } else if (page === 'myActivity') {
  897. uni.navigateTo({
  898. url: '/pages/mine/my-activities',
  899. success: () => {
  900. },
  901. fail: (err) => {
  902. console.error('❌ 我的活动页面跳转失败:', err)
  903. uni.showToast({
  904. title: '页面跳转失败',
  905. icon: 'none'
  906. })
  907. }
  908. })
  909. } else if (page === 'myDynamics') {
  910. uni.navigateTo({
  911. url: '/pages/mine/my-dynamics',
  912. success: () => {
  913. },
  914. fail: (err) => {
  915. console.error('❌ 我的动态页面跳转失败:', err)
  916. uni.showToast({
  917. title: '页面跳转失败',
  918. icon: 'none'
  919. })
  920. }
  921. })
  922. } else {
  923. uni.showToast({
  924. title: '功能开发中',
  925. icon: 'none'
  926. })
  927. }
  928. } catch (error) {
  929. console.error('❌ goToPage 执行出错:', error)
  930. uni.showToast({
  931. title: '页面跳转异常',
  932. icon: 'none'
  933. })
  934. }
  935. },
  936. switchTab(tab) {
  937. if (tab === 'mine') return
  938. const tabPages = {
  939. index: '/pages/index/index',
  940. plaza: '/pages/plaza/index',
  941. recommend: '/pages/recommend/index',
  942. message: '/pages/message/index'
  943. }
  944. if (tabPages[tab]) {
  945. uni.redirectTo({
  946. url: tabPages[tab]
  947. })
  948. }
  949. },
  950. // 处理退出登录
  951. handleLogout() {
  952. uni.showModal({
  953. title: '退出登录',
  954. content: '确定要退出登录吗?',
  955. showCancel: true,
  956. cancelText: '取消',
  957. confirmText: '确定',
  958. success: (res) => {
  959. if (res.confirm) {
  960. this.executeLogout()
  961. }
  962. }
  963. })
  964. },
  965. // 执行退出登录(最可靠的方式)
  966. executeLogout() {
  967. // 立即显示加载状态
  968. uni.showLoading({
  969. title: '退出中...',
  970. mask: true
  971. })
  972. // 延迟执行,确保UI更新
  973. setTimeout(() => {
  974. try {
  975. // 断开在线状态WebSocket
  976. try {
  977. const timPresenceManager = require('@/utils/tim-presence-manager.js').default;
  978. if (timPresenceManager) {
  979. timPresenceManager.disconnect();
  980. }
  981. } catch (error) {
  982. console.error('❌ 断开在线状态WebSocket失败:', error);
  983. }
  984. // 断开TIM WebSocket
  985. try {
  986. const timManager = require('@/utils/tim-manager.js').default;
  987. if (timManager && timManager.isLogin) {
  988. timManager.logout();
  989. }
  990. } catch (error) {
  991. console.error('❌ TIM登出失败:', error);
  992. }
  993. // 方法1: 逐个清除
  994. uni.removeStorageSync('token')
  995. uni.removeStorageSync('userInfo')
  996. uni.removeStorageSync('userId')
  997. uni.removeStorageSync('rememberedAccount')
  998. const remainToken = uni.getStorageSync('token')
  999. const remainUser = uni.getStorageSync('userInfo')
  1000. // 如果还有残留数据,使用强制清除
  1001. if (remainToken || remainUser) {
  1002. uni.clearStorageSync()
  1003. }
  1004. this.currentUserId = null
  1005. this.userInfo = {
  1006. userId: null,
  1007. nickname: '未登录用户',
  1008. avatar: 'https://via.placeholder.com/100?text=未登录'
  1009. }
  1010. // 隐藏加载,显示成功
  1011. uni.hideLoading()
  1012. uni.showToast({
  1013. title: '退出成功!',
  1014. icon: 'success',
  1015. duration: 1500
  1016. })
  1017. // 延迟跳转
  1018. setTimeout(() => {
  1019. uni.reLaunch({
  1020. url: '/pages/page3/page3'
  1021. })
  1022. }, 1500)
  1023. } catch (error) {
  1024. console.error('退出过程出错:', error)
  1025. uni.hideLoading()
  1026. // 强制退出
  1027. uni.clearStorageSync()
  1028. uni.showModal({
  1029. title: '退出完成',
  1030. content: '已清除登录信息,请重新打开应用',
  1031. showCancel: false,
  1032. confirmText: '知道了'
  1033. })
  1034. }
  1035. }, 300) // 300毫秒延迟确保UI响应
  1036. },
  1037. // 设置测试用户数据(基于数据库真实数据)
  1038. // ⚠️ 已弃用:此方法仅供调试使用,正常流程不再调用测试数据
  1039. setTestUserData() {
  1040. console.warn('⚠️ 警告:正在使用测试数据,这不应该在生产环境中发生')
  1041. // 根据当前用户ID设置对应的数据库用户信息
  1042. const userId = this.currentUserId || 1
  1043. let userData = {}
  1044. // 设置用户信息
  1045. this.userInfo = userData
  1046. // 设置统计数据
  1047. this.stats = {
  1048. myConnection: Math.floor(Math.random() * 10),
  1049. myFavorites: Math.floor(Math.random() * 20),
  1050. whoViewedMe: Math.floor(Math.random() * 15),
  1051. iViewed: Math.floor(Math.random() * 25)
  1052. }
  1053. // 显示提示
  1054. uni.showToast({
  1055. title: '使用测试数据: ' + this.userInfo.nickname,
  1056. icon: 'success',
  1057. duration: 2000
  1058. })
  1059. },
  1060. // 处理VIP购买成功事件
  1061. handleVipPurchased() {
  1062. // 延迟刷新,确保后端数据已更新
  1063. setTimeout(() => {
  1064. this.loadUserInfo()
  1065. }, 500)
  1066. },
  1067. // 统计数据板块点击事件
  1068. goToLikedByMe() {
  1069. // 跳转到我喜欢的页面
  1070. uni.navigateTo({
  1071. url: '/pages/mine/liked-by-me',
  1072. fail: (err) => {
  1073. console.error('跳转我喜欢的页面失败:', err)
  1074. uni.showToast({
  1075. title: '页面跳转失败',
  1076. icon: 'none'
  1077. })
  1078. }
  1079. })
  1080. },
  1081. // 获取我喜欢的用户真实数量
  1082. async getLikedUsersCount() {
  1083. try {
  1084. const userId = this.currentUserId
  1085. if (userId) {
  1086. // 调用后端API获取真实的喜欢用户数量
  1087. const result = await api.recommend.getLikedUsersCount(userId)
  1088. // 确保获取的是数字值
  1089. const count = typeof result === 'number' ? result : (result.data || 0)
  1090. // 更新统计数据
  1091. this.stats.myConnection = count || 0
  1092. }
  1093. } catch (error) {
  1094. console.error('获取喜欢的用户数量失败:', error)
  1095. // 如果获取失败,使用默认值
  1096. this.stats.myConnection = 0
  1097. }
  1098. },
  1099. goToLikedMe() {
  1100. // 跳转到喜欢我的页面
  1101. uni.navigateTo({
  1102. url: '/pages/mine/liked-me',
  1103. fail: (err) => {
  1104. console.error('跳转喜欢我的页面失败:', err)
  1105. uni.showToast({
  1106. title: '页面跳转失败',
  1107. icon: 'none'
  1108. })
  1109. }
  1110. })
  1111. },
  1112. goToVisitedByMe() {
  1113. // 跳转到我浏览的页面
  1114. uni.navigateTo({
  1115. url: '/pages/mine/visited-by-me',
  1116. fail: (err) => {
  1117. console.error('跳转我浏览的页面失败:', err)
  1118. uni.showToast({
  1119. title: '页面跳转失败',
  1120. icon: 'none'
  1121. })
  1122. }
  1123. })
  1124. }
  1125. }
  1126. }
  1127. </script>
  1128. <style lang="scss" scoped>
  1129. /* 扁平化设计风格 */
  1130. .mine-page {
  1131. min-height: 100vh;
  1132. background: #F5F5F5;
  1133. padding-bottom: 120rpx;
  1134. }
  1135. /* 用户信息内的统计数据样式 */
  1136. .user-stats {
  1137. display: flex;
  1138. justify-content: space-around;
  1139. margin: 20rpx 0 0;
  1140. padding: 0;
  1141. background: transparent;
  1142. border-radius: 0;
  1143. box-shadow: none;
  1144. border: none;
  1145. }
  1146. .stats-item {
  1147. flex: 1;
  1148. display: flex;
  1149. flex-direction: column;
  1150. align-items: center;
  1151. justify-content: center;
  1152. padding: 15rpx 20rpx;
  1153. border-radius: 0;
  1154. transition: all 0.3s ease;
  1155. &:not(:last-child) {
  1156. border-right: none;
  1157. }
  1158. .stats-number {
  1159. font-size: 40rpx;
  1160. font-weight: bold;
  1161. color: #FFFFFF;
  1162. margin-bottom: 5rpx;
  1163. text-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
  1164. }
  1165. .stats-label {
  1166. font-size: 22rpx;
  1167. color: rgba(255, 255, 255, 0.9);
  1168. font-weight: 500;
  1169. text-shadow: 0 1rpx 4rpx rgba(0, 0, 0, 0.1);
  1170. }
  1171. }
  1172. /* 用户信息区域 - 优化版 */
  1173. .user-section {
  1174. margin: 0;
  1175. margin-top: env(safe-area-inset-top);
  1176. padding: 30rpx;
  1177. background: linear-gradient(135deg, #FF8A9B 0%, #FFB4C0 100%);
  1178. box-shadow: 0 4rpx 20rpx rgba(255, 138, 155, 0.2);
  1179. .user-info {
  1180. display: flex;
  1181. align-items: flex-start;
  1182. margin-bottom: 0;
  1183. .avatar {
  1184. width: 140rpx;
  1185. height: 140rpx;
  1186. border-radius: 50%;
  1187. margin-right: 30rpx;
  1188. background-color: #FFFFFF;
  1189. border: 4rpx solid rgba(255, 255, 255, 0.8);
  1190. box-shadow: 0 8rpx 30rpx rgba(255, 138, 155, 0.3);
  1191. transition: transform 0.3s ease;
  1192. overflow: hidden;
  1193. }
  1194. .avatar:active {
  1195. transform: scale(1.05);
  1196. }
  1197. .user-details {
  1198. flex: 1;
  1199. .nickname-row {
  1200. display: flex;
  1201. align-items: center;
  1202. margin-bottom: 20rpx;
  1203. margin-top: 0;
  1204. .nickname {
  1205. font-size: 44rpx;
  1206. font-weight: bold;
  1207. color: #FFFFFF;
  1208. margin-right: 16rpx;
  1209. text-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
  1210. }
  1211. /* VIP标志样式 - 精致版 */
  1212. .vip-badge {
  1213. margin-right: 12rpx;
  1214. display: flex;
  1215. align-items: center;
  1216. justify-content: center;
  1217. background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
  1218. color: #FFFFFF;
  1219. padding: 6rpx 16rpx;
  1220. border-radius: 20rpx;
  1221. font-size: 24rpx;
  1222. font-weight: bold;
  1223. box-shadow:
  1224. 0 4rpx 15rpx rgba(255, 215, 0, 0.4),
  1225. 0 0 0 2rpx rgba(255, 255, 255, 0.9);
  1226. transition: all 0.3s ease;
  1227. letter-spacing: 1rpx;
  1228. text-transform: uppercase;
  1229. position: relative;
  1230. overflow: hidden;
  1231. z-index: 1;
  1232. &:before {
  1233. content: '';
  1234. position: absolute;
  1235. top: 0;
  1236. left: -100%;
  1237. width: 100%;
  1238. height: 100%;
  1239. background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  1240. transition: left 0.4s ease;
  1241. z-index: -1;
  1242. }
  1243. &:active {
  1244. transform: scale(0.95);
  1245. box-shadow:
  1246. 0 3rpx 10rpx rgba(255, 215, 0, 0.3),
  1247. 0 0 0 2rpx rgba(255, 255, 255, 0.9);
  1248. }
  1249. &:active:before {
  1250. left: 100%;
  1251. }
  1252. }
  1253. .verify-badge {
  1254. background: rgba(255, 255, 255, 0.9);
  1255. padding: 8rpx 22rpx;
  1256. border-radius: 20rpx;
  1257. box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.1);
  1258. transition: all 0.3s ease;
  1259. .verify-text {
  1260. font-size: 24rpx;
  1261. color: #FF6B8A;
  1262. font-weight: 600;
  1263. }
  1264. }
  1265. .verify-badge:active {
  1266. transform: scale(0.95);
  1267. background: rgba(255, 255, 255, 1);
  1268. }
  1269. }
  1270. /* 基本信息展示 - 优化版 */
  1271. .user-basic-info {
  1272. display: flex;
  1273. flex-wrap: wrap;
  1274. gap: 18rpx;
  1275. margin-bottom: 24rpx;
  1276. .info-item {
  1277. display: flex;
  1278. align-items: center;
  1279. gap: 10rpx;
  1280. padding: 10rpx 22rpx;
  1281. background: rgba(255, 255, 255, 0.9);
  1282. border-radius: 25rpx;
  1283. box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.08);
  1284. backdrop-filter: blur(10rpx);
  1285. transition: all 0.3s ease;
  1286. .info-icon {
  1287. font-size: 30rpx;
  1288. }
  1289. .info-text {
  1290. font-size: 26rpx;
  1291. color: #333333;
  1292. font-weight: 500;
  1293. }
  1294. }
  1295. .info-item:active {
  1296. transform: scale(0.98);
  1297. box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.12);
  1298. }
  1299. }
  1300. .progress-row {
  1301. display: flex;
  1302. align-items: center;
  1303. gap: 20rpx;
  1304. .progress-bar {
  1305. flex: 1;
  1306. height: 14rpx;
  1307. background-color: rgba(255, 255, 255, 0.3);
  1308. border-radius: 7rpx;
  1309. overflow: hidden;
  1310. box-shadow: inset 0 2rpx 4rpx rgba(0, 0, 0, 0.1);
  1311. .progress-fill {
  1312. height: 100%;
  1313. background: linear-gradient(90deg, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 1) 100%);
  1314. border-radius: 7rpx;
  1315. transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  1316. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.15);
  1317. }
  1318. }
  1319. .progress-text {
  1320. font-size: 26rpx;
  1321. color: rgba(255, 255, 255, 0.95);
  1322. font-weight: 500;
  1323. white-space: nowrap;
  1324. text-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
  1325. transition: color 0.3s ease;
  1326. }
  1327. .progress-text:active {
  1328. color: #FFFFFF;
  1329. }
  1330. }
  1331. }
  1332. }
  1333. }
  1334. /* VIP会员卡片 - 优化版 */
  1335. .vip-card {
  1336. margin: 20rpx 30rpx;
  1337. background: linear-gradient(135deg, #F0E6FF 0%, #E8DFFF 100%);
  1338. border-radius: 20rpx;
  1339. padding: 35rpx;
  1340. display: flex;
  1341. align-items: center;
  1342. justify-content: space-between;
  1343. box-shadow: 0 4rpx 20rpx rgba(153, 102, 255, 0.15);
  1344. transition: all 0.3s ease;
  1345. border: none;
  1346. &:active {
  1347. transform: translateY(2rpx);
  1348. box-shadow: 0 2rpx 10rpx rgba(153, 102, 255, 0.1);
  1349. }
  1350. .vip-content {
  1351. display: flex;
  1352. align-items: center;
  1353. .vip-icon {
  1354. font-size: 70rpx;
  1355. margin-right: 25rpx;
  1356. filter: drop-shadow(0 4rpx 15rpx rgba(218, 112, 214, 0.4));
  1357. }
  1358. .vip-info {
  1359. display: flex;
  1360. flex-direction: column;
  1361. gap: 8rpx;
  1362. .vip-title {
  1363. font-size: 34rpx;
  1364. font-weight: bold;
  1365. color: #6B4EA3;
  1366. }
  1367. .vip-subtitle {
  1368. font-size: 24rpx;
  1369. color: #8B7BAA;
  1370. background: rgba(255, 255, 255, 0.6);
  1371. padding: 6rpx 18rpx;
  1372. border-radius: 15rpx;
  1373. }
  1374. }
  1375. }
  1376. .vip-button {
  1377. background: linear-gradient(135deg, #9575CD 0%, #7E57C2 100%);
  1378. color: #FFFFFF;
  1379. padding: 18rpx 35rpx;
  1380. border-radius: 30rpx;
  1381. font-size: 28rpx;
  1382. white-space: nowrap;
  1383. font-weight: 600;
  1384. box-shadow: 0 4rpx 15rpx rgba(149, 117, 205, 0.3);
  1385. transition: all 0.3s ease;
  1386. }
  1387. .vip-button:active {
  1388. transform: scale(0.95);
  1389. box-shadow: 0 2rpx 10rpx rgba(149, 117, 205, 0.2);
  1390. }
  1391. }
  1392. /* 专属红娘 - 优化版 */
  1393. .matchmaker-card {
  1394. margin: 20rpx 30rpx;
  1395. background: linear-gradient(135deg, #FFF3E0 0%, #FFE0B2 100%);
  1396. border-radius: 20rpx;
  1397. padding: 25rpx;
  1398. text-align: center;
  1399. box-shadow: 0 4rpx 20rpx rgba(255, 193, 7, 0.15);
  1400. border: none;
  1401. .matchmaker-text {
  1402. font-size: 28rpx;
  1403. color: #F57C00;
  1404. font-weight: 500;
  1405. display: flex;
  1406. align-items: center;
  1407. justify-content: center;
  1408. gap: 10rpx;
  1409. }
  1410. }
  1411. /* 快捷入口 - 优化版 */
  1412. .quick-actions {
  1413. margin: 20rpx 30rpx;
  1414. background: rgba(255, 255, 255, 0.95);
  1415. backdrop-filter: blur(10rpx);
  1416. border-radius: 20rpx;
  1417. padding: 45rpx 30rpx;
  1418. display: flex;
  1419. justify-content: space-around;
  1420. box-shadow: 0 4rpx 25rpx rgba(0, 0, 0, 0.08);
  1421. border: none;
  1422. .action-item {
  1423. display: flex;
  1424. flex-direction: column;
  1425. align-items: center;
  1426. gap: 15rpx;
  1427. transition: all 0.3s ease;
  1428. padding: 15rpx;
  1429. border-radius: 15rpx;
  1430. &:active {
  1431. transform: translateY(2rpx);
  1432. background: rgba(255, 255, 255, 0.8);
  1433. }
  1434. .action-icon {
  1435. width: 110rpx;
  1436. height: 110rpx;
  1437. border-radius: 20rpx;
  1438. display: flex;
  1439. align-items: center;
  1440. justify-content: center;
  1441. font-size: 55rpx;
  1442. box-shadow: 0 6rpx 20rpx rgba(0, 0, 0, 0.1);
  1443. transition: all 0.3s ease;
  1444. border: none;
  1445. }
  1446. .action-icon:active {
  1447. transform: scale(0.95);
  1448. }
  1449. .calendar-icon {
  1450. background: linear-gradient(135deg, #E8F5E8 0%, #C8E6C9 100%);
  1451. color: #4CAF50;
  1452. }
  1453. .phone-icon {
  1454. background: linear-gradient(135deg, #FFF3CD 0%, #FFEEBA 100%);
  1455. color: #FFA726;
  1456. }
  1457. .heart-icon {
  1458. background: linear-gradient(135deg, #FFEBEE 0%, #FFCDD2 100%);
  1459. color: #F44336;
  1460. }
  1461. .action-label {
  1462. font-size: 28rpx;
  1463. color: #333333;
  1464. font-weight: 500;
  1465. }
  1466. }
  1467. }
  1468. /* 功能菜单列表 - 优化版 */
  1469. .menu-list {
  1470. margin: 20rpx 30rpx 30rpx;
  1471. background: rgba(255, 255, 255, 0.95);
  1472. backdrop-filter: blur(10rpx);
  1473. border-radius: 20rpx;
  1474. overflow: hidden;
  1475. box-shadow: 0 4rpx 25rpx rgba(0, 0, 0, 0.08);
  1476. border: none;
  1477. .menu-item {
  1478. display: flex;
  1479. align-items: center;
  1480. justify-content: space-between;
  1481. padding: 40rpx 35rpx;
  1482. border-bottom: 1rpx solid rgba(0, 0, 0, 0.05);
  1483. transition: all 0.3s ease;
  1484. position: relative;
  1485. overflow: hidden;
  1486. &:before {
  1487. content: '';
  1488. position: absolute;
  1489. left: 0;
  1490. top: 0;
  1491. width: 5rpx;
  1492. height: 100%;
  1493. background: linear-gradient(135deg, #FF8A9B 0%, #FFB4C0 100%);
  1494. transform: scaleY(0);
  1495. transition: transform 0.3s ease;
  1496. }
  1497. &:last-child {
  1498. border-bottom: none;
  1499. }
  1500. &:active {
  1501. background: linear-gradient(135deg, #FFF8FA 0%, #FFF0F2 100%);
  1502. transform: translateX(5rpx);
  1503. &:before {
  1504. transform: scaleY(1);
  1505. }
  1506. }
  1507. .menu-left {
  1508. display: flex;
  1509. align-items: center;
  1510. gap: 25rpx;
  1511. .menu-icon {
  1512. font-size: 48rpx;
  1513. transition: transform 0.3s ease;
  1514. }
  1515. .menu-text {
  1516. font-size: 32rpx;
  1517. color: #333333;
  1518. font-weight: 500;
  1519. transition: color 0.3s ease;
  1520. }
  1521. }
  1522. .menu-arrow {
  1523. font-size: 48rpx;
  1524. color: #E0E0E0;
  1525. font-weight: 300;
  1526. transition: color 0.3s ease;
  1527. }
  1528. &:active .menu-arrow {
  1529. color: #FF8A9B;
  1530. transform: translateX(5rpx);
  1531. }
  1532. }
  1533. /* 退出登录特殊样式 - 优化版 */
  1534. .menu-item.logout-item {
  1535. border-top: 3rpx solid rgba(255, 99, 132, 0.2);
  1536. background: linear-gradient(135deg, #FFF8F8 0%, #FFF0F0 100%);
  1537. .menu-left .menu-icon {
  1538. color: #F44336;
  1539. font-size: 50rpx;
  1540. }
  1541. .menu-left .menu-text {
  1542. color: #F44336;
  1543. font-weight: bold;
  1544. font-size: 34rpx;
  1545. }
  1546. .menu-arrow {
  1547. color: #F44336;
  1548. }
  1549. &:active {
  1550. background: linear-gradient(135deg, #FFEEEE 0%, #FFDDDD 100%);
  1551. }
  1552. &:before {
  1553. background: linear-gradient(135deg, #F44336 0%, #FF6B8A 100%);
  1554. }
  1555. }
  1556. }
  1557. /* 签到弹窗样式 - 优化版 */
  1558. .checkin-popup {
  1559. width: 680rpx;
  1560. max-height: 90vh;
  1561. background: rgba(255, 255, 255, 0.98);
  1562. backdrop-filter: blur(20rpx);
  1563. border-radius: 25rpx;
  1564. overflow: hidden;
  1565. display: flex;
  1566. flex-direction: column;
  1567. box-shadow: 0 10rpx 50rpx rgba(0, 0, 0, 0.15);
  1568. border: none;
  1569. .popup-header {
  1570. display: flex;
  1571. align-items: center;
  1572. justify-content: center;
  1573. padding: 40rpx 30rpx 30rpx;
  1574. position: relative;
  1575. background: linear-gradient(135deg, #FF8A9B 0%, #FFB4C0 100%);
  1576. flex-shrink: 0;
  1577. .popup-title {
  1578. font-size: 36rpx;
  1579. font-weight: bold;
  1580. color: #FFFFFF;
  1581. text-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
  1582. }
  1583. .close-btn {
  1584. position: absolute;
  1585. right: 25rpx;
  1586. top: 30rpx;
  1587. width: 60rpx;
  1588. height: 60rpx;
  1589. display: flex;
  1590. align-items: center;
  1591. justify-content: center;
  1592. background: rgba(255, 255, 255, 0.2);
  1593. border-radius: 50%;
  1594. transition: all 0.3s ease;
  1595. &:active {
  1596. transform: scale(0.9);
  1597. background: rgba(255, 255, 255, 0.3);
  1598. }
  1599. .close-icon {
  1600. font-size: 40rpx;
  1601. color: #FFFFFF;
  1602. line-height: 1;
  1603. }
  1604. }
  1605. }
  1606. .checkin-info {
  1607. display: flex;
  1608. justify-content: space-around;
  1609. padding: 30rpx;
  1610. background: linear-gradient(135deg, #FFF8FA 0%, #FFF0F2 100%);
  1611. flex-shrink: 0;
  1612. .info-item {
  1613. display: flex;
  1614. flex-direction: column;
  1615. align-items: center;
  1616. gap: 12rpx;
  1617. .info-label {
  1618. font-size: 24rpx;
  1619. color: #999999;
  1620. font-weight: 500;
  1621. }
  1622. .info-value {
  1623. font-size: 42rpx;
  1624. font-weight: bold;
  1625. color: #FF6B8A;
  1626. text-shadow: 0 2rpx 8rpx rgba(255, 107, 138, 0.2);
  1627. }
  1628. }
  1629. }
  1630. .checkin-content {
  1631. flex: 1;
  1632. overflow-y: auto;
  1633. max-height: 55vh;
  1634. }
  1635. .checkin-calendar {
  1636. padding: 30rpx;
  1637. .calendar-header {
  1638. text-align: center;
  1639. margin-bottom: 25rpx;
  1640. .month-text {
  1641. font-size: 30rpx;
  1642. font-weight: bold;
  1643. color: #333333;
  1644. background: linear-gradient(135deg, #FF8A9B 0%, #FFB4C0 100%);
  1645. -webkit-background-clip: text;
  1646. -webkit-text-fill-color: transparent;
  1647. background-clip: text;
  1648. }
  1649. }
  1650. .week-header {
  1651. display: flex;
  1652. margin-bottom: 15rpx;
  1653. .week-day {
  1654. flex: 1;
  1655. text-align: center;
  1656. font-size: 24rpx;
  1657. color: #666666;
  1658. font-weight: 600;
  1659. }
  1660. }
  1661. .calendar-body {
  1662. display: grid;
  1663. grid-template-columns: repeat(7, 1fr);
  1664. gap: 12rpx;
  1665. .calendar-day {
  1666. height: 80rpx;
  1667. display: flex;
  1668. align-items: center;
  1669. justify-content: center;
  1670. position: relative;
  1671. box-sizing: border-box;
  1672. border-radius: 15rpx;
  1673. transition: all 0.3s ease;
  1674. background: rgba(255, 255, 255, 0.5);
  1675. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
  1676. .day-num {
  1677. font-size: 26rpx;
  1678. color: #333333;
  1679. font-weight: 500;
  1680. }
  1681. .check-mark {
  1682. position: absolute;
  1683. top: 8rpx;
  1684. right: 8rpx;
  1685. font-size: 20rpx;
  1686. color: #FFFFFF;
  1687. background: linear-gradient(135deg, #FF6B8A 0%, #FF8A9B 100%);
  1688. width: 30rpx;
  1689. height: 30rpx;
  1690. border-radius: 50%;
  1691. display: flex;
  1692. align-items: center;
  1693. justify-content: center;
  1694. box-shadow: 0 2rpx 8rpx rgba(255, 107, 138, 0.3);
  1695. }
  1696. &.empty {
  1697. visibility: hidden;
  1698. }
  1699. &.checked {
  1700. background: linear-gradient(135deg, #FFE0E6 0%, #FFCCD5 100%);
  1701. box-shadow: 0 4rpx 15rpx rgba(255, 107, 138, 0.2);
  1702. .day-num {
  1703. color: #FF6B8A;
  1704. font-weight: bold;
  1705. }
  1706. }
  1707. &.today {
  1708. background: linear-gradient(135deg, #FF6B8A 0%, #FF8A9B 100%);
  1709. box-shadow: 0 6rpx 20rpx rgba(255, 107, 138, 0.3);
  1710. .day-num {
  1711. color: #FFFFFF;
  1712. font-weight: bold;
  1713. font-size: 28rpx;
  1714. }
  1715. }
  1716. &.today.checked {
  1717. .check-mark {
  1718. background: rgba(255, 255, 255, 0.9);
  1719. color: #FF6B8A;
  1720. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
  1721. }
  1722. }
  1723. }
  1724. }
  1725. }
  1726. .checkin-rewards {
  1727. padding: 25rpx 30rpx 30rpx;
  1728. background: linear-gradient(135deg, #FFF8FA 0%, #FFF0F2 100%);
  1729. flex-shrink: 0;
  1730. .rewards-title {
  1731. font-size: 30rpx;
  1732. font-weight: bold;
  1733. color: #333333;
  1734. margin-bottom: 20rpx;
  1735. display: block;
  1736. }
  1737. .rewards-list {
  1738. display: flex;
  1739. justify-content: space-between;
  1740. gap: 18rpx;
  1741. .reward-item {
  1742. flex: 1;
  1743. background: rgba(255, 255, 255, 0.9);
  1744. border-radius: 18rpx;
  1745. padding: 25rpx 15rpx;
  1746. display: flex;
  1747. flex-direction: column;
  1748. align-items: center;
  1749. position: relative;
  1750. box-shadow: 0 4rpx 15rpx rgba(0, 0, 0, 0.08);
  1751. transition: all 0.3s ease;
  1752. .reward-icon {
  1753. font-size: 60rpx;
  1754. margin-bottom: 15rpx;
  1755. filter: drop-shadow(0 4rpx 15rpx rgba(0, 0, 0, 0.1));
  1756. }
  1757. .reward-day {
  1758. font-size: 26rpx;
  1759. color: #666666;
  1760. margin-bottom: 12rpx;
  1761. font-weight: 500;
  1762. }
  1763. .reward-text {
  1764. font-size: 28rpx;
  1765. color: #333333;
  1766. font-weight: bold;
  1767. }
  1768. .received-mark {
  1769. position: absolute;
  1770. top: 15rpx;
  1771. right: 15rpx;
  1772. width: 36rpx;
  1773. height: 36rpx;
  1774. background: linear-gradient(135deg, #4CAF50 0%, #8BC34A 100%);
  1775. color: #FFFFFF;
  1776. border-radius: 50%;
  1777. display: flex;
  1778. align-items: center;
  1779. justify-content: center;
  1780. font-size: 22rpx;
  1781. box-shadow: 0 2rpx 8rpx rgba(76, 175, 80, 0.3);
  1782. }
  1783. &.received {
  1784. opacity: 0.7;
  1785. transform: scale(0.95);
  1786. }
  1787. &.current {
  1788. background: linear-gradient(135deg, #FFE0E6 0%, #FFCCD5 100%);
  1789. box-shadow: 0 6rpx 20rpx rgba(255, 107, 138, 0.2);
  1790. .reward-text {
  1791. color: #FF6B8A;
  1792. }
  1793. .reward-icon {
  1794. transform: scale(1.1);
  1795. }
  1796. }
  1797. }
  1798. }
  1799. }
  1800. .checkin-button-wrapper {
  1801. padding: 0 30rpx 40rpx;
  1802. flex-shrink: 0;
  1803. .checkin-btn {
  1804. width: 100%;
  1805. background: linear-gradient(135deg, #FF6B8A 0%, #FF8A9B 100%);
  1806. color: #FFFFFF;
  1807. font-size: 34rpx;
  1808. font-weight: bold;
  1809. border-radius: 35rpx;
  1810. padding: 25rpx;
  1811. border: none;
  1812. transition: all 0.3s ease;
  1813. box-shadow: 0 6rpx 25rpx rgba(255, 107, 138, 0.3);
  1814. &:active:not(.disabled) {
  1815. transform: translateY(2rpx);
  1816. box-shadow: 0 4rpx 15rpx rgba(255, 107, 138, 0.2);
  1817. }
  1818. &.disabled {
  1819. background: linear-gradient(135deg, #E0E0E0 0%, #BDBDBD 100%);
  1820. box-shadow: none;
  1821. }
  1822. &::after {
  1823. border: none;
  1824. }
  1825. }
  1826. }
  1827. }
  1828. /* 底部导航栏 - 优化版 */
  1829. .tabbar {
  1830. position: fixed;
  1831. bottom: 0;
  1832. left: 0;
  1833. right: 0;
  1834. display: flex;
  1835. background-color: #FFFFFF;
  1836. border-top: 1rpx solid #F0F0F0;
  1837. padding-bottom: constant(safe-area-inset-bottom);
  1838. padding-bottom: env(safe-area-inset-bottom);
  1839. z-index: 999;
  1840. box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.05);
  1841. .tabbar-item {
  1842. flex: 1;
  1843. display: flex;
  1844. flex-direction: column;
  1845. align-items: center;
  1846. justify-content: center;
  1847. padding: 10rpx 0;
  1848. position: relative;
  1849. transition: all 0.3s ease;
  1850. .tabbar-icon {
  1851. font-size: 48rpx;
  1852. margin-bottom: 8rpx;
  1853. transition: all 0.3s ease;
  1854. }
  1855. .first-icon{
  1856. width: 20px;
  1857. height: 20px;
  1858. margin-bottom: 5px;
  1859. margin-top: 5px;
  1860. }
  1861. .tabbar-text {
  1862. font-size: 24rpx;
  1863. color: #999999;
  1864. transition: all 0.3s ease;
  1865. font-weight: 500;
  1866. }
  1867. &.active {
  1868. transform: translateY(-5rpx);
  1869. .tabbar-icon {
  1870. color: #FF6B8A;
  1871. transform: scale(1.1);
  1872. filter: drop-shadow(0 4rpx 15rpx rgba(255, 107, 138, 0.3));
  1873. }
  1874. .tabbar-text {
  1875. color: #722F37;
  1876. font-weight: bold;
  1877. }
  1878. }
  1879. &:active:not(.active) {
  1880. transform: translateY(2rpx);
  1881. }
  1882. }
  1883. }
  1884. .tabbar-badge {
  1885. position: absolute;
  1886. top: 8rpx;
  1887. right: 50%;
  1888. margin-right: -40rpx;
  1889. min-width: 36rpx;
  1890. height: 36rpx;
  1891. line-height: 36rpx;
  1892. padding: 0 10rpx;
  1893. background: linear-gradient(135deg, #FF6B8A 0%, #FF8A9B 100%);
  1894. border-radius: 18rpx;
  1895. font-size: 22rpx;
  1896. color: #FFFFFF;
  1897. text-align: center;
  1898. font-weight: bold;
  1899. box-shadow: 0 4rpx 15rpx rgba(255, 107, 138, 0.3);
  1900. transform: scale(1);
  1901. transition: all 0.3s ease;
  1902. }
  1903. .tabbar-item.active .tabbar-badge {
  1904. transform: scale(1.1);
  1905. }
  1906. </style>