index.vue 55 KB

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