index.vue 48 KB

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