index.vue 58 KB

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