index.vue 52 KB

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