index.vue 46 KB

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