index.vue 45 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748
  1. <template>
  2. <view class="home-page">
  3. <!-- 顶部状态栏 -->
  4. <view class="top-bar">
  5. <view class="logo">婚恋</view>
  6. <view class="top-right-icons">
  7. <!-- 红娘工作台切换按钮 - 仅登录用户显示 -->
  8. <view v-if="userInfo && userInfo.userId && userInfo.isMatchmaker && parseInt(userInfo.isMatchmaker) === 1"
  9. class="matchmaker-btn" @click="openMatchmakerPopup">
  10. <text class="switch-icon">🔄</text>
  11. <text class="switch-text">切换工作台</text>
  12. </view>
  13. <!-- 消息通知图标 -->
  14. <view class="msg-icon" @click="goToMessages">
  15. <text class="icon">🔔</text>
  16. <view v-if="unreadCount > 0" class="badge">{{ unreadCount }}</view>
  17. </view>
  18. </view>
  19. </view>
  20. <!-- 个性化欢迎语 -->
  21. <!-- <view class="welcome-card" v-if="userInfo.nickname">
  22. <view class="welcome-content">
  23. <text class="welcome-text">你好,{{ userInfo.nickname }}!</text>
  24. <text class="match-info">今天有 <text class="highlight">{{ matchCount }}</text> 位新嘉宾和你匹配哦 ❤️</text>
  25. </view>
  26. </view> -->
  27. <!-- 轮播图 -->
  28. <view class="banner-section" v-if="bannerList && bannerList.length > 0">
  29. <swiper class="banner-swiper" :indicator-dots="true" :autoplay="true" :interval="4000" :duration="1000"
  30. :circular="true" indicator-color="rgba(255, 255, 255, 0.5)" indicator-active-color="#E91E63">
  31. <swiper-item v-for="(banner, index) in bannerList" :key="index">
  32. <view class="banner-item" @click="handleBannerClick(banner)">
  33. <image :src="banner.cover_image || banner.coverImage" class="banner-image" mode="aspectFill"
  34. :data-section="'banner'" :data-index="index"
  35. @error="handleImageError" @load="handleImageLoad"></image>
  36. <view class="banner-mask">
  37. <view class="banner-title">{{ banner.name }}</view>
  38. <view class="banner-subtitle" v-if="banner.subtitle">{{ banner.subtitle }}</view>
  39. <view class="banner-btn">查看更多</view>
  40. </view>
  41. </view>
  42. </swiper-item>
  43. </swiper>
  44. </view>
  45. <!-- 小喇叭公告栏 -->
  46. <view class="notice-bar" v-if="noticeList && noticeList.length > 0">
  47. <text class="notice-icon">📢</text>
  48. <swiper class="notice-swiper" vertical :autoplay="true" :interval="3000" :duration="500"
  49. :circular="true">
  50. <swiper-item v-for="(notice, index) in noticeList" :key="index">
  51. <view class="notice-text">{{ notice.content }}</view>
  52. </swiper-item>
  53. </swiper>
  54. </view>
  55. <!-- 核心功能入口 -->
  56. <view class="function-grid">
  57. <view class="grid-item" v-for="(item, index) in functionList" :key="index" @click="handleFunctionClick(item)">
  58. <view class="grid-icon-wrapper" :style="{ background: item.gradient || item.bgColor || '#FFE5F1' }">
  59. <text class="grid-icon" :style="{ color: item.iconColor || '#333333' }">{{ item.icon }}</text>
  60. </view>
  61. <text class="grid-text">{{ item.name }}</text>
  62. </view>
  63. </view>
  64. <!-- 成功案例 -->
  65. <view class="section success-case-section" v-if="successCases && successCases.length > 0">
  66. <view class="section-header">
  67. <text class="section-title">💕 成功案例</text>
  68. <text class="section-more" @click="goToSuccessCaseList">查看更多 ></text>
  69. </view>
  70. <view class="success-case-grid">
  71. <view class="case-card" v-for="(caseItem, index) in successCases.slice(0, 2)" :key="index"
  72. @click="handleSuccessCaseClick(caseItem)">
  73. <view class="case-image-wrapper">
  74. <image :src="caseItem.imageUrl" class="case-image" mode="aspectFill"
  75. :data-section="'successCase'" :data-index="index"
  76. @error="handleImageError" @load="handleImageLoad"></image>
  77. </view>
  78. <view class="case-content">
  79. <view class="couple-names">{{ caseItem.maleUserNickname || '先生' }}&{{ caseItem.femaleUserNickname || '女士' }}</view>
  80. <view class="case-quote">{{ caseItem.quote || '我们通过平台找到了彼此❤️' }}</view>
  81. <view class="case-meta">
  82. <text class="marriage-date">相识于{{ formatMarriageDate(caseItem.marriageDate) }}</text>
  83. </view>
  84. </view>
  85. </view>
  86. </view>
  87. </view>
  88. <!-- 平台活动 -->
  89. <view class="section activity-recommend-section" v-if="hotActivities && hotActivities.length > 0">
  90. <view class="section-header">
  91. <text class="section-title">🎉 平台活动</text>
  92. <text class="section-more" @click="goToActivityList">查看更多 ></text>
  93. </view>
  94. <view class="activity-scroll-container">
  95. <view class="activity-scroll-wrapper">
  96. <view class="activity-scroll-content">
  97. <!-- 第一组活动 -->
  98. <view class="activity-card-scroll" v-for="(activity, index) in hotActivities" :key="index"
  99. @click="handleActivityClick(activity)">
  100. <view class="activity-image-wrapper">
  101. <image :src="activity.cover_image" class="activity-image" mode="aspectFill"
  102. :data-section="'activity'" :data-index="index"
  103. @error="handleImageError" @load="handleImageLoad"></image>
  104. <view class="activity-status" v-if="activity.status === 1">报名中</view>
  105. </view>
  106. <view class="activity-info-static">
  107. <view class="activity-name-static">{{ activity.name }}</view>
  108. <view class="activity-time-static">{{ formatActivityTime(activity.startTime, activity.endTime) }}</view>
  109. </view>
  110. </view>
  111. <!-- 第二组活动(用于无缝滚动) -->
  112. <view class="activity-card-scroll" v-for="(activity, index) in hotActivities" :key="index + 100"
  113. @click="handleActivityClick(activity)">
  114. <view class="activity-image-wrapper">
  115. <image :src="activity.coverImage" class="activity-image" mode="aspectFill"
  116. :data-section="'activity'" :data-index="index + 100"
  117. @error="handleImageError" @load="handleImageLoad"></image>
  118. <view class="activity-status" v-if="activity.status === 1">报名中</view>
  119. </view>
  120. <view class="activity-info-static">
  121. <view class="activity-name-static">{{ activity.name }}</view>
  122. <view class="activity-time-static">{{ formatActivityTime(activity.startTime, activity.endTime) }}</view>
  123. </view>
  124. </view>
  125. </view>
  126. </view>
  127. </view>
  128. </view>
  129. <!-- 今日缘分推荐 -->
  130. <!-- <view class="section fate-recommend-section" v-if="todayRecommendUsers && todayRecommendUsers.length > 0">
  131. <view class="section-header">
  132. <text class="section-title">🌟 今日缘分</text>
  133. <text class="section-more" @click="goToRecommend">查看更多 ></text>
  134. </view>
  135. <view class="fate-cards">
  136. <view class="fate-card" v-for="(user, index) in todayRecommendUsers" :key="index"
  137. @click="handleUserClick(user)">
  138. <view class="user-avatar-wrapper">
  139. <image :src="user.avatarUrl || user.avatar" class="user-avatar" mode="aspectFill"
  140. :data-section="'todayRecommend'" :data-index="index"
  141. @error="handleImageError" @load="handleImageLoad"></image>
  142. <view class="online-status" v-if="user.isOnline"></view>
  143. </view>
  144. <view class="user-basic-info">
  145. <text class="user-nickname">{{ user.nickname }}</text>
  146. <text class="user-age-location">{{ user.age }}岁 · {{ user.location || user.city }}</text>
  147. </view>
  148. <view class="match-score">
  149. <text class="match-text">匹配度</text>
  150. <text class="match-percentage">{{ formatMatchScore(user.compatibilityScore) }}%</text>
  151. </view>
  152. <view class="user-tags">
  153. <text class="user-tag" v-for="(tag, tagIndex) in parseUserTags(user).slice(0, 2)" :key="tagIndex">
  154. {{ tag }}
  155. </text>
  156. </view>
  157. </view>
  158. </view>
  159. </view> -->
  160. <!-- 个人魅力指数 -->
  161. <view class="section charm-index-section" v-if="userInfo.userId">
  162. <view class="charm-card">
  163. <view class="charm-header">
  164. <text class="charm-title">💖 个人魅力指数</text>
  165. <text class="charm-score">{{ charmIndex.totalScore }}</text>
  166. </view>
  167. <view class="charm-progress">
  168. <view class="progress-bar">
  169. <view class="progress-fill" :style="{ width: charmIndex.totalScore + '%' }"></view>
  170. </view>
  171. <text class="progress-text">超越了{{ charmIndex.beatPercentage }}%的用户</text>
  172. </view>
  173. <view class="charm-items">
  174. <view class="charm-item" v-for="(item, index) in charmIndex.items" :key="index">
  175. <text class="charm-item-label">{{ item.label }}</text>
  176. <view class="charm-item-progress">
  177. <view class="item-progress-bar">
  178. <view class="item-progress-fill" :style="{ width: item.score + '%' }"></view>
  179. </view>
  180. <text class="charm-item-score">{{ item.score }}%</text>
  181. </view>
  182. </view>
  183. </view>
  184. <view class="charm-tip">
  185. <text class="tip-text">💡 {{ charmIndex.tip }}</text>
  186. </view>
  187. </view>
  188. </view>
  189. <!-- 底部占位 -->
  190. <view class="bottom-placeholder"></view>
  191. <!-- 底部导航栏 -->
  192. <view class="tabbar">
  193. <view class="tabbar-item active" @click="switchTab('index')">
  194. <text class="tabbar-icon">🏠</text>
  195. <text class="tabbar-text">首页</text>
  196. </view>
  197. <view class="tabbar-item" @click="switchTab('plaza')">
  198. <text class="tabbar-icon">💕</text>
  199. <text class="tabbar-text">动态</text>
  200. </view>
  201. <view class="tabbar-item" @click="switchTab('recommend')">
  202. <text class="tabbar-icon">👍</text>
  203. <text class="tabbar-text">推荐</text>
  204. </view>
  205. <view class="tabbar-item" @click="switchTab('message')">
  206. <text class="tabbar-icon">💬</text>
  207. <text class="tabbar-text">消息</text>
  208. <view v-if="unreadCount >= 1" class="tabbar-badge">{{ unreadCount }}</view>
  209. </view>
  210. <view class="tabbar-item" @click="switchTab('mine')">
  211. <text class="tabbar-icon">👤</text>
  212. <text class="tabbar-text">我的</text>
  213. </view>
  214. </view>
  215. <!-- 红娘提示弹框 -->
  216. <uni-popup ref="matchmakerPopup" type="dialog">
  217. <uni-popup-dialog
  218. type="confirm"
  219. title="红娘工作台"
  220. content="您是平台认证红娘,是否前往红娘工作台?"
  221. confirmText="前往工作台"
  222. cancelText="取消"
  223. @confirm="goToMatchmakerWorkspace"
  224. @cancel="closeMatchmakerPopup">
  225. </uni-popup-dialog>
  226. </uni-popup>
  227. </view>
  228. </template>
  229. <script>
  230. import api, { request } from '@/utils/api.js'
  231. import { formatTime, formatCountdown, isLoggedIn, goToLogin } from '@/utils/util.js'
  232. import { DEFAULT_IMAGES, ACTIVITY_TYPES } from '@/config/index.js'
  233. export default {
  234. data() {
  235. return {
  236. // 用户信息
  237. userInfo: {
  238. nickname: '小张',
  239. userId: null,
  240. isMatchmaker: '1' // 测试用,实际从后端获取
  241. },
  242. matchCount: 3,
  243. // 轮播图数据
  244. bannerList: [
  245. ],
  246. // 公告数据
  247. noticeList: [
  248. ],
  249. // 功能入口
  250. functionList: [
  251. { id: 1, name: '星命测算', icon: '💖', path: '/pages/astrology/index', bgColor: '#FF6B9D', iconColor: '#FFFFFF', gradient: 'linear-gradient(135deg, #FF6B9D 0%, #FF8EAB 100%)' },
  252. { id: 2, name: '红娘列表', icon: '👤', path: '/pages/matchmakers/list', bgColor: '#6BC5F8', iconColor: '#FFFFFF', gradient: 'linear-gradient(135deg, #6BC5F8 0%, #87CEEB 100%)' },
  253. // { id: 3, name: '加入红娘', icon: '💕', path: '/pages/part-time-matchmaker/index', bgColor: '#9B7EDE', iconColor: '#FFFFFF', gradient: 'linear-gradient(135deg, #9B7EDE 0%, #B19CD9 100%)' },
  254. // { id: 3, name: '加入红娘', icon: '💕', path: '/pages/part-time-matchmaker/index', bgColor: '#9B7EDE', iconColor: '#FFFFFF', gradient: 'linear-gradient(135deg, #9B7EDE 0%, #B19CD9 100%)' },
  255. { id: 4, name: '精品课程', icon: '📚', path: '/pages/courses/list', bgColor: '#FF8C42', iconColor: '#FFFFFF', gradient: 'linear-gradient(135deg, #FF8C42 0%, #FFA366 100%)' },
  256. { id: 5, name: '今日缘分', icon: '💝', path: '/pages/recommend/index', bgColor: '#FF69B4', iconColor: '#FFFFFF', gradient: 'linear-gradient(135deg, #FF69B4 0%, #FF8CC8 100%)', needLogin: true },
  257. // { id: 6, name: '专属定制', icon: '🎁', path: '/pages/customize/index', bgColor: '#FFA500', iconColor: '#FFFFFF', gradient: 'linear-gradient(135deg, #FFA500 0%, #FFB84D 100%)' }
  258. ],
  259. // 热门活动
  260. hotActivities: [],
  261. // 成功案例
  262. successCases: [],
  263. // VIP特权(保留但不在首页显示)
  264. vipPrivileges: [
  265. { icon: '💎', text: '专属红娘服务' },
  266. { icon: '⚡', text: '优先匹配推荐' },
  267. { icon: '👑', text: '贵族身份标识' },
  268. { icon: '🔒', text: '隐身访问模式' }
  269. ],
  270. // 今日推荐用户
  271. todayRecommendUsers: [],
  272. // 个人魅力指数
  273. charmIndex: {
  274. totalScore: 75,
  275. beatPercentage: 68,
  276. items: [
  277. { label: '资料完整度', score: 80 },
  278. { label: '活跃度', score: 70 },
  279. { label: '互动质量', score: 75 },
  280. { label: '形象分数', score: 72 }
  281. ],
  282. tip: '完善更多个人信息可提升魅力指数'
  283. },
  284. // 倒计时定时器
  285. countdownTimer: null,
  286. // 图片加载错误计数
  287. imageErrorCount: 0,
  288. // 是否已经显示过红娘弹框(避免重复显示)
  289. hasShownMatchmakerPopup: false
  290. }
  291. },
  292. computed: {
  293. // 从Vuex获取全局未读数
  294. unreadCount() {
  295. return this.$store.getters.getTotalUnread || 0;
  296. }
  297. },
  298. onLoad() {
  299. this.loadUserInfo()
  300. this.loadBannerData()
  301. this.loadNoticeData()
  302. // this.loadTodayRecommend()
  303. this.loadCharmIndex()
  304. this.loadHotActivities()
  305. this.loadSuccessCases()
  306. // 监听未读消息数更新事件
  307. uni.$on('conversationUnreadUpdate', (totalUnread) => {
  308. console.log('📬 首页收到未读数更新:', totalUnread);
  309. this.$store.dispatch('updateTotalUnread', totalUnread);
  310. });
  311. },
  312. onUnload() {
  313. // 清理资源
  314. uni.$off('conversationUnreadUpdate');
  315. },
  316. onShow() {
  317. console.log('📱 页面onShow触发')
  318. // 页面显示时检查是否为红娘
  319. this.checkMatchmakerStatus()
  320. },
  321. methods: {
  322. // 删除自动弹出功能,只保留手动点击切换
  323. checkMatchmakerStatus() {
  324. // 从本地存储获取用户信息
  325. const userInfo = uni.getStorageSync('userInfo')
  326. console.log('🔍 检查红娘状态,用户信息:', userInfo)
  327. // 此处不再自动弹出弹框,只在用户点击切换按钮时显示
  328. },
  329. // 前往红娘工作台
  330. goToMatchmakerWorkspace() {
  331. console.log('🚀 前往红娘工作台')
  332. this.$refs.matchmakerPopup.close()
  333. // 跳转到红娘工作台
  334. uni.navigateTo({
  335. url: '/pages/matchmaker-workbench/index'
  336. })
  337. },
  338. // 关闭红娘弹框
  339. closeMatchmakerPopup() {
  340. console.log('🚫 用户选择不前往红娘工作台')
  341. this.$refs.matchmakerPopup.close()
  342. },
  343. // 加载用户信息
  344. loadUserInfo() {
  345. // 从本地存储或接口获取用户信息
  346. const userInfo = uni.getStorageSync('userInfo')
  347. if (userInfo) {
  348. this.userInfo = userInfo
  349. this.matchCount = Math.floor(Math.random() * 10) + 1
  350. }
  351. },
  352. // 加载轮播图数据
  353. async loadBannerData() {
  354. try {
  355. // 调用 API 获取轮播图数据
  356. const data = await api.home.getBanners()
  357. if (data && data.length > 0) {
  358. // 处理轮播图数据,确保字段格式正确
  359. this.bannerList = data.map(banner => ({
  360. ...banner,
  361. cover_image: banner.cover_image || banner.coverImage || DEFAULT_IMAGES.banner,
  362. name: banner.name || banner.title || '',
  363. subtitle: banner.subtitle || '',
  364. type: banner.type || 'activity',
  365. targetId: banner.targetId || banner.id
  366. }))
  367. }
  368. } catch (error) {
  369. console.error('获取轮播图失败:', error)
  370. // 使用默认数据
  371. }
  372. },
  373. // 加载公告数据
  374. async loadNoticeData() {
  375. try {
  376. // 调用 API 获取公告数据
  377. const data = await api.home.getNotices()
  378. if (data && data.length > 0) {
  379. this.noticeList = data
  380. }
  381. } catch (error) {
  382. console.error('获取公告失败:', error)
  383. // 使用默认数据
  384. }
  385. },
  386. // 加载今日推荐
  387. async loadTodayRecommend() {
  388. try {
  389. const userId = this.userInfo.userId || parseInt(uni.getStorageSync('userId'))
  390. if (!userId) {
  391. console.log('用户未登录,跳过今日推荐加载')
  392. return
  393. }
  394. // 调用推荐API获取推荐用户列表
  395. const data = await api.recommend.getUsers({
  396. userId: userId,
  397. oppoOnly: 1, // 只推荐异性
  398. limit: 20 // 获取20个用户用于筛选
  399. })
  400. if (data && data.length > 0) {
  401. // 按匹配度降序排序,取前3个匹配度最高的用户
  402. const sortedUsers = data
  403. .filter(user => user.compatibilityScore && user.compatibilityScore > 0)
  404. .sort((a, b) => (b.compatibilityScore || 0) - (a.compatibilityScore || 0))
  405. .slice(0, 3)
  406. // 处理用户数据
  407. this.todayRecommendUsers = sortedUsers.map(user => ({
  408. ...user,
  409. avatarUrl: this.validateImageUrl(user.avatarUrl || DEFAULT_IMAGES.avatar),
  410. age: user.age || 0,
  411. location: this.formatLocation(user),
  412. isOnline: false // 可以根据实际情况设置
  413. }))
  414. console.log('今日缘分推荐加载成功,匹配度最高的用户:', this.todayRecommendUsers)
  415. }
  416. } catch (error) {
  417. console.error('获取推荐用户失败:', error)
  418. this.todayRecommendUsers = []
  419. }
  420. },
  421. // 格式化位置信息
  422. formatLocation(user) {
  423. const parts = []
  424. if (user.provinceName) parts.push(user.provinceName)
  425. if (user.cityName) parts.push(user.cityName)
  426. if (parts.length === 0 && user.location) return user.location
  427. if (parts.length === 0 && user.city) return user.city
  428. return parts.join(' ')
  429. },
  430. // 格式化匹配度分数
  431. formatMatchScore(score) {
  432. if (!score) return '0.0'
  433. return Number(score).toFixed(1)
  434. },
  435. // 解析用户标签
  436. parseUserTags(user) {
  437. const tags = []
  438. if (user.star) tags.push(user.star)
  439. if (user.jobTitle) tags.push(user.jobTitle)
  440. if (user.hobby) {
  441. try {
  442. const hobbies = typeof user.hobby === 'string' ? JSON.parse(user.hobby) : user.hobby
  443. if (Array.isArray(hobbies)) {
  444. tags.push(...hobbies.slice(0, 2))
  445. }
  446. } catch (e) {
  447. console.error('解析兴趣爱好失败:', e)
  448. }
  449. }
  450. return tags
  451. },
  452. // 加载魅力指数
  453. async loadCharmIndex() {
  454. try {
  455. if (this.userInfo.userId) {
  456. // 调用 API 获取魅力指数
  457. // const data = await api.user.getCharmIndex(this.userInfo.userId)
  458. // if (data) {
  459. // this.charmIndex = data
  460. // }
  461. }
  462. } catch (error) {
  463. console.error('获取魅力指数失败:', error)
  464. }
  465. },
  466. // 加载热门活动
  467. async loadHotActivities() {
  468. try {
  469. // 调用 API 获取活动列表(获取所有状态为1的活动,而不是只获取热门活动)
  470. const data = await api.activity.getList({
  471. status: 1,
  472. limit: 10
  473. })
  474. if (data && data.length > 0) {
  475. this.hotActivities = data.map((activity, index) => {
  476. const rawCover = this.validateImageUrl(activity.cover_image || activity.coverImage || activity.imageUrl || activity.image_url)
  477. return {
  478. ...activity,
  479. coverImage: this.ensureRomanticCover(rawCover, index),
  480. name: activity.name || activity.title || '',
  481. startTime: activity.startTime || activity.start_time || activity.startDate || '',
  482. endTime: activity.endTime || activity.end_time || activity.endDate || '',
  483. status: activity.status || 0
  484. }})
  485. } else {
  486. // 使用默认活动数据
  487. this.hotActivities = [
  488. ]
  489. }
  490. } catch (error) {
  491. console.error('获取热门活动失败:', error)
  492. // 使用默认数据
  493. this.hotActivities = [
  494. {
  495. id: 1,
  496. name: '七夕单身派对',
  497. description: '浪漫七夕夜,遇见更好的ta',
  498. coverImage: DEFAULT_IMAGES.activity || 'https://images.unsplash.com/photo-1511632765486-a01980e01a18?w=750&h=400&fit=crop',
  499. startTime: '2024-02-14 19:00:00',
  500. location: '杭州西湖文化广场',
  501. price: 99,
  502. status: 1
  503. },
  504. {
  505. id: 2,
  506. name: '情人节主题聚会',
  507. description: '高端单身聚会,品味生活',
  508. coverImage: DEFAULT_IMAGES.banner || 'https://images.unsplash.com/photo-1522673607200-164d1b6ce486?w=750&h=360&fit=crop',
  509. startTime: '2024-02-14 20:00:00',
  510. location: '上海外滩茶餐厅',
  511. price: 128,
  512. status: 1
  513. },
  514. {
  515. id: 3,
  516. name: '春日户外踏青',
  517. description: '拥抱春天,邂逅美好',
  518. coverImage: DEFAULT_IMAGES.couple || 'https://images.unsplash.com/photo-1516589178581-6cd7833ae3b2?w=520&h=360&fit=crop',
  519. startTime: '2024-03-20 14:00:00',
  520. location: '苏州园林博物馆',
  521. price: 68,
  522. status: 1
  523. }
  524. ]
  525. }
  526. },
  527. // 格式化活动时间(支持开始和结束时间)
  528. formatActivityTime(startTime, endTime) {
  529. if (!startTime) return '时间待定'
  530. try {
  531. const start = new Date(startTime)
  532. const startMonth = start.getMonth() + 1
  533. const startDay = start.getDate()
  534. const startHour = start.getHours().toString().padStart(2, '0')
  535. const startMinute = start.getMinutes().toString().padStart(2, '0')
  536. let timeStr = `${startMonth}月${startDay}日 ${startHour}:${startMinute}`
  537. // 如果有结束时间,添加结束时间
  538. if (endTime) {
  539. const end = new Date(endTime)
  540. const endMonth = end.getMonth() + 1
  541. const endDay = end.getDate()
  542. const endHour = end.getHours().toString().padStart(2, '0')
  543. const endMinute = end.getMinutes().toString().padStart(2, '0')
  544. timeStr += ` - ${endMonth}月${endDay}日 ${endHour}:${endMinute}`
  545. }
  546. return timeStr
  547. } catch (error) {
  548. return '时间待定'
  549. }
  550. },
  551. // 加载成功案例
  552. async loadSuccessCases() {
  553. try {
  554. // 调用 API 获取成功案例列表
  555. const data = await api.successCase.getList({
  556. pageNum: 1,
  557. pageSize: 5
  558. })
  559. if (data && data.length > 0) {
  560. this.successCases = data.map(caseItem => ({
  561. ...caseItem,
  562. maleUserNickname: caseItem.maleUserNickname || caseItem.male_user_nickname || '先生',
  563. femaleUserNickname: caseItem.femaleUserNickname || caseItem.female_user_nickname || '女士',
  564. imageUrl: this.validateImageUrl(caseItem.imageUrl || caseItem.image_url || DEFAULT_IMAGES.couple),
  565. quote: caseItem.quote || '我们通过平台找到了彼此❤️',
  566. marriageDate: caseItem.marriageDate || caseItem.marriage_date || ''
  567. }))
  568. } else {
  569. // 使用默认数据
  570. this.successCases = []
  571. }
  572. } catch (error) {
  573. console.error('获取成功案例失败:', error)
  574. // 使用默认数据
  575. this.successCases = [
  576. {
  577. caseNo: 'CASE001',
  578. maleUserNickname: '张先生',
  579. femaleUserNickname: '李女士',
  580. imageUrl: DEFAULT_IMAGES.couple,
  581. quote: '从第一次咖啡约会到领证,只用了90天',
  582. marriageDate: '2024-08-20'
  583. },
  584. {
  585. caseNo: 'CASE002',
  586. maleUserNickname: '王先生',
  587. femaleUserNickname: '赵女士',
  588. imageUrl: DEFAULT_IMAGES.couple,
  589. quote: '感谢红娘的专业服务,让我们相遇相知',
  590. marriageDate: '2024-09-15'
  591. }
  592. ]
  593. }
  594. },
  595. // 格式化结婚日期
  596. formatMarriageDate(dateStr) {
  597. if (!dateStr) return '佳音渐近'
  598. try {
  599. const date = new Date(dateStr)
  600. const year = date.getFullYear()
  601. const month = date.getMonth() + 1
  602. const day = date.getDate()
  603. return `${year}年${month}月${day}日`
  604. } catch (error) {
  605. return '佳音渐近'
  606. }
  607. },
  608. // 跳转到VIP页面
  609. goToVip() {
  610. uni.navigateTo({
  611. url: '/pages/vip/index'
  612. })
  613. },
  614. // 跳转到活动列表
  615. goToActivityList() {
  616. uni.navigateTo({
  617. url: '/pages/activities/list'
  618. })
  619. },
  620. // 处理活动点击
  621. handleActivityClick(activity) {
  622. uni.navigateTo({
  623. url: `/pages/activities/detail?id=${activity.id}`
  624. })
  625. },
  626. // 跳转到成功案例列表
  627. goToSuccessCaseList() {
  628. uni.navigateTo({
  629. url: '/pages/success-case/list'
  630. })
  631. },
  632. // 处理成功案例点击
  633. handleSuccessCaseClick(caseItem) {
  634. const caseNo = caseItem.caseNo || caseItem.case_no
  635. uni.navigateTo({
  636. url: `/pages/success-case/detail?caseNo=${caseNo}`
  637. })
  638. },
  639. // 处理图片加载错误并回退到默认图
  640. handleImageError(e) {
  641. const failedSrc = e.detail ? e.detail.errMsg : '未知错误'
  642. const dataset = (e && e.target && e.target.dataset) ? e.target.dataset : {}
  643. const section = dataset.section
  644. const index = dataset.index
  645. console.warn('图片加载失败:', failedSrc, 'section:', section, 'index:', index)
  646. const fallbackMap = {
  647. banner: DEFAULT_IMAGES.banner,
  648. activity: DEFAULT_IMAGES.activity,
  649. successCase: DEFAULT_IMAGES.couple,
  650. todayRecommend: DEFAULT_IMAGES.avatar
  651. }
  652. const setFallback = (list, targetIndex, key, fallback, extraKeys = []) => {
  653. if (!Array.isArray(list) || list.length === 0) return
  654. const numIndex = Number(targetIndex)
  655. if (Number.isNaN(numIndex)) return
  656. const normalizedIndex = ((numIndex % list.length) + list.length) % list.length
  657. if (!list[normalizedIndex]) return
  658. this.$set(list[normalizedIndex], key, fallback)
  659. extraKeys.forEach(extraKey => this.$set(list[normalizedIndex], extraKey, fallback))
  660. }
  661. switch (section) {
  662. case 'banner':
  663. setFallback(this.bannerList, index, 'cover_image', fallbackMap.banner)
  664. setFallback(this.bannerList, index, 'coverImage', fallbackMap.banner)
  665. break
  666. case 'activity':
  667. setFallback(this.hotActivities, index, 'coverImage', this.getRomanticImage(index))
  668. break
  669. case 'successCase':
  670. setFallback(this.successCases, index, 'imageUrl', fallbackMap.successCase)
  671. break
  672. case 'todayRecommend':
  673. setFallback(this.todayRecommendUsers, index, 'avatar', fallbackMap.todayRecommend)
  674. break
  675. default:
  676. break
  677. }
  678. },
  679. // 处理图片加载成功
  680. handleImageLoad(e) {
  681. // 图片加载成功,重置错误计数
  682. this.imageErrorCount = 0
  683. },
  684. // 验证和处理图片URL
  685. validateImageUrl(url) {
  686. if (!url || url === 'null' || url === 'undefined') {
  687. return DEFAULT_IMAGES.activity || DEFAULT_IMAGES.banner || 'http://115.190.125.125:9001/static-images/login-bg.png'
  688. }
  689. let cleanedUrl = String(url).trim()
  690. const httpIndex = cleanedUrl.indexOf('http')
  691. if (httpIndex > 0) {
  692. cleanedUrl = cleanedUrl.slice(httpIndex)
  693. }
  694. if (!cleanedUrl) {
  695. return DEFAULT_IMAGES.activity || DEFAULT_IMAGES.banner || 'http://115.190.125.125:9001/static-images/login-bg.png'
  696. }
  697. // 如果是相对路径,添加协议和域名
  698. if (cleanedUrl.startsWith('/')) {
  699. // 检查是否是完整的服务器路径
  700. if (cleanedUrl.startsWith('/banners/') || cleanedUrl.startsWith('/activities/') || cleanedUrl.startsWith('/images/')) {
  701. return `http://115.190.125.125:9000${cleanedUrl}`
  702. }
  703. return `http://115.190.125.125:9000${cleanedUrl}`
  704. }
  705. // 如果已经是完整URL,直接返回
  706. if (cleanedUrl.startsWith('http://') || cleanedUrl.startsWith('https://')) {
  707. return cleanedUrl
  708. }
  709. // 其他情况返回默认图片
  710. return DEFAULT_IMAGES.activity || DEFAULT_IMAGES.banner || 'http://115.190.125.125:9001/static-images/login-bg.png'
  711. },
  712. getRomanticImage(index = 0) {
  713. if (!this.romanticImages || this.romanticImages.length === 0) {
  714. return DEFAULT_IMAGES.activity || DEFAULT_IMAGES.banner || 'http://115.190.125.125:9001/static-images/login-bg.png'
  715. }
  716. const idx = Math.abs(Number(index) || 0) % this.romanticImages.length
  717. return this.romanticImages[idx]
  718. },
  719. ensureRomanticCover(url, index = 0) {
  720. if (!url || url === DEFAULT_IMAGES.activity || url === DEFAULT_IMAGES.banner || url === 'http://115.190.125.125:9001/static-images/login-bg.png') {
  721. return this.getRomanticImage(index)
  722. }
  723. return url
  724. },
  725. // 跳转到推荐页面
  726. goToRecommend() {
  727. uni.navigateTo({
  728. url: '/pages/recommend/index'
  729. })
  730. },
  731. // 处理用户点击
  732. handleUserClick(user) {
  733. const userId = user.userId || user.id
  734. if (!userId) {
  735. uni.showToast({
  736. title: '用户信息错误',
  737. icon: 'none'
  738. })
  739. return
  740. }
  741. uni.navigateTo({
  742. url: `/pages/recommend/user-detail?userId=${userId}`
  743. })
  744. },
  745. // 格式化时间
  746. formatTime,
  747. // Banner点击
  748. handleBannerClick(banner) {
  749. if (banner.type === 'activity') {
  750. uni.navigateTo({
  751. url: `/pages/activities/detail?id=${banner.targetId}`
  752. })
  753. } else if (banner.type === 'course') {
  754. uni.navigateTo({
  755. url: `/pages/courses/detail?id=${banner.targetId}`
  756. })
  757. } else if (banner.type === 'case') {
  758. uni.navigateTo({
  759. url: '/pages/success-case/list'
  760. })
  761. }
  762. },
  763. // 功能入口点击
  764. handleFunctionClick(item) {
  765. // 今日缘分:直接跳转到专门的推荐页面
  766. if (item && (item.id === 5 || item.name === '今日缘分' || item.name === '今日推荐')) {
  767. console.log('点击今日缘分,跳转到专门页面')
  768. uni.navigateTo({
  769. url: '/pages/today-recommend/index',
  770. success: () => {
  771. console.log('跳转今日缘分页面成功')
  772. },
  773. fail: (err) => {
  774. console.error('跳转今日缘分页面失败:', err)
  775. uni.showToast({
  776. title: '页面跳转失败',
  777. icon: 'none'
  778. })
  779. }
  780. })
  781. return
  782. }
  783. // 检查是否需要登录
  784. if (item.needLogin && !isLoggedIn()) {
  785. uni.navigateTo({
  786. url: '/pages/page3/page3'
  787. })
  788. return
  789. }
  790. if (item.path) {
  791. let url = item.path
  792. if (item.query) {
  793. const queryStr = Object.keys(item.query).map(key => `${key}=${item.query[key]}`).join('&')
  794. url += '?' + queryStr
  795. }
  796. uni.navigateTo({
  797. url: url,
  798. fail: () => {
  799. uni.showToast({
  800. title: '功能开发中',
  801. icon: 'none'
  802. })
  803. }
  804. })
  805. }
  806. },
  807. // 跳转到消息中心
  808. goToMessages() {
  809. uni.navigateTo({
  810. url: '/pages/message/index',
  811. fail: () => {
  812. uni.showToast({
  813. title: '功能开发中',
  814. icon: 'none'
  815. })
  816. }
  817. })
  818. },
  819. // 打开红娘工作台弹框
  820. openMatchmakerPopup() {
  821. // 删除检查处理标记的逻辑,每次点击都显示弹框
  822. if (this.$refs.matchmakerPopup) {
  823. this.$refs.matchmakerPopup.open()
  824. }
  825. },
  826. // 切换Tab
  827. switchTab(tab) {
  828. if (tab === 'index') return
  829. const tabPages = {
  830. plaza: '/pages/plaza/index',
  831. recommend: '/pages/recommend/index',
  832. message: '/pages/message/index',
  833. mine: '/pages/mine/index'
  834. }
  835. if (tabPages[tab]) {
  836. uni.redirectTo({
  837. url: tabPages[tab]
  838. })
  839. }
  840. }
  841. }
  842. }
  843. </script>
  844. <style lang="scss" scoped>
  845. .home-page {
  846. min-height: 100vh;
  847. background: #F5F5F5;
  848. padding-bottom: 120rpx;
  849. }
  850. /* 顶部状态栏 */
  851. .top-bar {
  852. display: flex;
  853. justify-content: space-between;
  854. align-items: center;
  855. padding: 25rpx 35rpx;
  856. background: #FFFFFF;
  857. border-bottom: 2rpx solid #E0E0E0;
  858. .logo {
  859. font-size: 38rpx;
  860. font-weight: 800;
  861. color: #E91E63;
  862. }
  863. .top-right-icons {
  864. display: flex;
  865. align-items: center;
  866. gap: 20rpx;
  867. }
  868. .matchmaker-btn {
  869. position: relative;
  870. width: auto;
  871. height: auto;
  872. display: flex;
  873. align-items: center;
  874. justify-content: center;
  875. background: transparent;
  876. border-radius: 0;
  877. transition: all 0.3s ease;
  878. padding: 10rpx 20rpx;
  879. color: #E91E63;
  880. font-weight: 600;
  881. border: 2rpx solid #E91E63;
  882. border-radius: 25rpx;
  883. &:active {
  884. opacity: 0.8;
  885. transform: scale(0.98);
  886. background: rgba(233, 30, 99, 0.1);
  887. }
  888. .switch-icon {
  889. font-size: 28rpx;
  890. margin-right: 8rpx;
  891. }
  892. .switch-text {
  893. font-size: 26rpx;
  894. color: #E91E63;
  895. font-weight: 600;
  896. }
  897. }
  898. .msg-icon {
  899. position: relative;
  900. width: 68rpx;
  901. height: 68rpx;
  902. display: flex;
  903. align-items: center;
  904. justify-content: center;
  905. background: #FFE5F1;
  906. border-radius: 50%;
  907. transition: all 0.2s ease;
  908. &:active {
  909. opacity: 0.8;
  910. transform: scale(0.95);
  911. }
  912. .icon {
  913. font-size: 44rpx;
  914. }
  915. .badge {
  916. position: absolute;
  917. top: -5rpx;
  918. right: -5rpx;
  919. min-width: 36rpx;
  920. height: 36rpx;
  921. line-height: 36rpx;
  922. padding: 0 8rpx;
  923. background: #FF6B6B;
  924. color: #FFFFFF;
  925. font-size: 20rpx;
  926. font-weight: bold;
  927. border-radius: 18rpx;
  928. text-align: center;
  929. }
  930. }
  931. }
  932. /* 个性化欢迎语 */
  933. .welcome-card {
  934. margin: 25rpx 35rpx;
  935. padding: 35rpx;
  936. background: #FFFFFF;
  937. border-radius: 16rpx;
  938. border: 2rpx solid #E0E0E0;
  939. .welcome-content {
  940. display: flex;
  941. flex-direction: column;
  942. gap: 16rpx;
  943. .welcome-text {
  944. font-size: 34rpx;
  945. font-weight: 700;
  946. color: #333333;
  947. line-height: 1.3;
  948. }
  949. .match-info {
  950. font-size: 28rpx;
  951. color: #666666;
  952. line-height: 1.4;
  953. .highlight {
  954. color: #E91E63;
  955. font-weight: 800;
  956. font-size: 36rpx;
  957. }
  958. }
  959. }
  960. }
  961. /* 轮播图 */
  962. .banner-section {
  963. margin: 10rpx 10rpx;
  964. .banner-swiper {
  965. height: 480rpx;
  966. border-radius: 16rpx;
  967. overflow: hidden;
  968. border: 2rpx solid #E0E0E0;
  969. .banner-item {
  970. position: relative;
  971. width: 100%;
  972. height: 100%;
  973. overflow: hidden;
  974. .banner-image {
  975. width: 100%;
  976. height: 100%;
  977. }
  978. .banner-mask {
  979. position: absolute;
  980. bottom: 0;
  981. left: 0;
  982. right: 0;
  983. padding: 35rpx;
  984. background: rgba(0, 0, 0, 0.6);
  985. color: #FFFFFF;
  986. .banner-title {
  987. font-size: 38rpx;
  988. font-weight: 800;
  989. margin-bottom: 12rpx;
  990. line-height: 1.2;
  991. }
  992. .banner-subtitle {
  993. font-size: 26rpx;
  994. margin-bottom: 24rpx;
  995. }
  996. .banner-btn {
  997. display: inline-block;
  998. padding: 12rpx 32rpx;
  999. background: #E91E63;
  1000. border-radius: 8rpx;
  1001. font-size: 26rpx;
  1002. font-weight: 600;
  1003. transition: all 0.2s ease;
  1004. &:active {
  1005. opacity: 0.8;
  1006. }
  1007. }
  1008. }
  1009. }
  1010. }
  1011. }
  1012. /* 公告栏 */
  1013. .notice-bar {
  1014. display: flex;
  1015. align-items: center;
  1016. margin: 25rpx 35rpx;
  1017. padding: 24rpx 30rpx;
  1018. background: #FFF8E1;
  1019. border-radius: 8rpx;
  1020. border: 2rpx solid #FFD54F;
  1021. border-left: 6rpx solid #FFC107;
  1022. .notice-icon {
  1023. font-size: 34rpx;
  1024. margin-right: 24rpx;
  1025. }
  1026. .notice-swiper {
  1027. flex: 1;
  1028. height: 44rpx;
  1029. .notice-text {
  1030. font-size: 28rpx;
  1031. color: #795548;
  1032. line-height: 44rpx;
  1033. white-space: nowrap;
  1034. overflow: hidden;
  1035. text-overflow: ellipsis;
  1036. font-weight: 500;
  1037. }
  1038. }
  1039. }
  1040. /* 功能入口 */
  1041. .function-grid {
  1042. display: grid;
  1043. grid-template-columns: repeat(4, 1fr);
  1044. gap: 24rpx;
  1045. margin: 20rpx 1rpx;
  1046. padding: 30rpx;
  1047. background: #FFFFFF;
  1048. border-radius: 16rpx;
  1049. border: 2rpx solid #E0E0E0;
  1050. .grid-item {
  1051. display: flex;
  1052. flex-direction: column;
  1053. align-items: center;
  1054. gap: 14rpx;
  1055. padding: 20rpx 12rpx;
  1056. transition: all 0.3s ease;
  1057. border-radius: 12rpx;
  1058. &:active {
  1059. transform: scale(0.95);
  1060. opacity: 0.9;
  1061. }
  1062. .grid-icon-wrapper {
  1063. width: 140rpx;
  1064. height: 140rpx;
  1065. display: flex;
  1066. align-items: center;
  1067. justify-content: center;
  1068. border-radius: 20rpx;
  1069. position: relative;
  1070. overflow: hidden;
  1071. /* 外阴影 + 内阴影 - 增强立体感和深度感 */
  1072. box-shadow: inset 0 2rpx 8rpx rgba(255, 255, 255, 0.3),
  1073. 0 10rpx 30rpx rgba(0, 0, 0, 0.2),
  1074. 0 4rpx 12rpx rgba(0, 0, 0, 0.15);
  1075. transition: all 0.3s ease;
  1076. /* 光泽效果 - 左上角强烈高光,模拟图片中的光泽 */
  1077. &::before {
  1078. content: '';
  1079. position: absolute;
  1080. top: -60%;
  1081. left: -60%;
  1082. width: 220%;
  1083. height: 220%;
  1084. background: linear-gradient(135deg,
  1085. rgba(255, 255, 255, 0.6) 0%,
  1086. rgba(255, 255, 255, 0.4) 15%,
  1087. rgba(255, 255, 255, 0.2) 30%,
  1088. rgba(255, 255, 255, 0.05) 50%,
  1089. transparent 70%);
  1090. transform: rotate(45deg);
  1091. pointer-events: none;
  1092. z-index: 1;
  1093. border-radius: 50%;
  1094. }
  1095. /* 底部深度阴影 - 增强立体感 */
  1096. &::after {
  1097. content: '';
  1098. position: absolute;
  1099. bottom: 0;
  1100. left: 0;
  1101. right: 0;
  1102. height: 40%;
  1103. background: linear-gradient(to top,
  1104. rgba(0, 0, 0, 0.15) 0%,
  1105. rgba(0, 0, 0, 0.08) 50%,
  1106. transparent 100%);
  1107. pointer-events: none;
  1108. z-index: 1;
  1109. border-radius: 0 0 20rpx 20rpx;
  1110. }
  1111. &:active {
  1112. transform: scale(0.92);
  1113. box-shadow: inset 0 2rpx 8rpx rgba(255, 255, 255, 0.2),
  1114. 0 6rpx 20rpx rgba(0, 0, 0, 0.25);
  1115. }
  1116. .grid-icon {
  1117. font-size: 70rpx;
  1118. position: relative;
  1119. z-index: 2;
  1120. /* 图标阴影 - 让图标更突出 */
  1121. filter: drop-shadow(0 3rpx 8rpx rgba(0, 0, 0, 0.2));
  1122. text-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.1);
  1123. }
  1124. }
  1125. .grid-text {
  1126. font-size: 24rpx;
  1127. font-weight: 600;
  1128. color: #333333;
  1129. text-align: center;
  1130. line-height: 1.2;
  1131. }
  1132. }
  1133. }
  1134. /* 区块样式 */
  1135. .section {
  1136. margin: 40rpx 0;
  1137. .section-header {
  1138. display: flex;
  1139. justify-content: space-between;
  1140. align-items: center;
  1141. padding: 0 35rpx;
  1142. margin-bottom: 25rpx;
  1143. .section-title {
  1144. font-size: 36rpx;
  1145. font-weight: 800;
  1146. color: #333333;
  1147. border-left: 6rpx solid #E91E63;
  1148. padding-left: 16rpx;
  1149. }
  1150. .section-more {
  1151. font-size: 26rpx;
  1152. color: #E91E63;
  1153. font-weight: 600;
  1154. transition: all 0.2s ease;
  1155. &:active {
  1156. opacity: 0.6;
  1157. }
  1158. }
  1159. }
  1160. }
  1161. /* 平台活动展示区 */
  1162. .activity-recommend-section {
  1163. .activity-scroll-container {
  1164. margin: 0 35rpx;
  1165. overflow: hidden;
  1166. position: relative;
  1167. .activity-scroll-wrapper {
  1168. width: 100%;
  1169. overflow: hidden;
  1170. .activity-scroll-content {
  1171. display: flex;
  1172. animation: activityScroll 30s linear infinite;
  1173. gap: 20rpx;
  1174. width: fit-content;
  1175. &:hover {
  1176. animation-play-state: paused;
  1177. }
  1178. .activity-card-scroll {
  1179. flex-shrink: 0;
  1180. width: 500rpx;
  1181. background: #FFFFFF;
  1182. border-radius: 16rpx;
  1183. overflow: hidden;
  1184. border: 2rpx solid #E0E0E0;
  1185. transition: all 0.3s ease;
  1186. &:active {
  1187. transform: scale(0.98);
  1188. opacity: 0.9;
  1189. }
  1190. .activity-image-wrapper {
  1191. position: relative;
  1192. width: 100%;
  1193. height: 280rpx;
  1194. overflow: hidden;
  1195. .activity-image {
  1196. width: 100%;
  1197. height: 100%;
  1198. }
  1199. .activity-status {
  1200. position: absolute;
  1201. top: 15rpx;
  1202. right: 15rpx;
  1203. padding: 6rpx 12rpx;
  1204. background: #4CAF50;
  1205. color: #FFFFFF;
  1206. font-size: 22rpx;
  1207. font-weight: 600;
  1208. border-radius: 8rpx;
  1209. }
  1210. }
  1211. .activity-info-static {
  1212. padding: 20rpx;
  1213. .activity-name-static {
  1214. font-size: 28rpx;
  1215. font-weight: 700;
  1216. color: #333333;
  1217. margin-bottom: 8rpx;
  1218. line-height: 1.3;
  1219. }
  1220. .activity-time-static {
  1221. font-size: 24rpx;
  1222. color: #666666;
  1223. line-height: 1.4;
  1224. }
  1225. }
  1226. }
  1227. }
  1228. }
  1229. }
  1230. }
  1231. @keyframes activityScroll {
  1232. 0% {
  1233. transform: translateX(0);
  1234. }
  1235. 100% {
  1236. transform: translateX(-50%);
  1237. }
  1238. }
  1239. /* 今日缘分推荐 */
  1240. .fate-recommend-section {
  1241. .fate-cards {
  1242. display: flex;
  1243. gap: 20rpx;
  1244. padding: 0 35rpx;
  1245. overflow-x: auto;
  1246. scrollbar-width: none;
  1247. &::-webkit-scrollbar {
  1248. display: none;
  1249. }
  1250. .fate-card {
  1251. min-width: 320rpx;
  1252. background: #FFFFFF;
  1253. border-radius: 16rpx;
  1254. padding: 25rpx;
  1255. border: 2rpx solid #E0E0E0;
  1256. display: flex;
  1257. flex-direction: column;
  1258. align-items: center;
  1259. gap: 15rpx;
  1260. position: relative;
  1261. transition: all 0.2s ease;
  1262. &:active {
  1263. background: #F5F5F5;
  1264. }
  1265. .user-avatar-wrapper {
  1266. position: relative;
  1267. .user-avatar {
  1268. width: 100rpx;
  1269. height: 100rpx;
  1270. border-radius: 50%;
  1271. border: 3rpx solid #E0E0E0;
  1272. }
  1273. .online-status {
  1274. position: absolute;
  1275. bottom: 5rpx;
  1276. right: 5rpx;
  1277. width: 20rpx;
  1278. height: 20rpx;
  1279. background: #4CAF50;
  1280. border-radius: 50%;
  1281. border: 3rpx solid white;
  1282. }
  1283. }
  1284. .user-basic-info {
  1285. text-align: center;
  1286. .user-nickname {
  1287. font-size: 28rpx;
  1288. font-weight: 700;
  1289. color: #333333;
  1290. display: block;
  1291. margin-bottom: 5rpx;
  1292. }
  1293. .user-age-location {
  1294. font-size: 24rpx;
  1295. color: #666666;
  1296. }
  1297. }
  1298. .match-score {
  1299. display: flex;
  1300. align-items: center;
  1301. gap: 8rpx;
  1302. padding: 8rpx 16rpx;
  1303. background: #FFE5F1;
  1304. border-radius: 8rpx;
  1305. .match-text {
  1306. font-size: 22rpx;
  1307. color: #666666;
  1308. }
  1309. .match-percentage {
  1310. font-size: 26rpx;
  1311. font-weight: 700;
  1312. color: #E91E63;
  1313. }
  1314. }
  1315. .user-tags {
  1316. display: flex;
  1317. gap: 8rpx;
  1318. flex-wrap: wrap;
  1319. justify-content: center;
  1320. .user-tag {
  1321. font-size: 20rpx;
  1322. color: #666666;
  1323. background: #F5F5F5;
  1324. padding: 6rpx 12rpx;
  1325. border-radius: 8rpx;
  1326. border: 1rpx solid #E0E0E0;
  1327. }
  1328. }
  1329. }
  1330. }
  1331. }
  1332. /* 个人魅力指数 */
  1333. .charm-index-section {
  1334. margin: 25rpx 35rpx;
  1335. .charm-card {
  1336. background: #FFFFFF;
  1337. border-radius: 16rpx;
  1338. padding: 35rpx;
  1339. border: 2rpx solid #E0E0E0;
  1340. .charm-header {
  1341. display: flex;
  1342. justify-content: space-between;
  1343. align-items: center;
  1344. margin-bottom: 25rpx;
  1345. .charm-title {
  1346. font-size: 32rpx;
  1347. font-weight: 800;
  1348. color: #333333;
  1349. }
  1350. .charm-score {
  1351. font-size: 48rpx;
  1352. font-weight: 800;
  1353. color: #E91E63;
  1354. }
  1355. }
  1356. .charm-progress {
  1357. margin-bottom: 30rpx;
  1358. .progress-bar {
  1359. width: 100%;
  1360. height: 12rpx;
  1361. background: #FFE5F1;
  1362. border-radius: 6rpx;
  1363. overflow: hidden;
  1364. margin-bottom: 10rpx;
  1365. .progress-fill {
  1366. height: 100%;
  1367. background: #E91E63;
  1368. border-radius: 6rpx;
  1369. transition: width 1s ease;
  1370. }
  1371. }
  1372. .progress-text {
  1373. font-size: 24rpx;
  1374. color: #666666;
  1375. text-align: center;
  1376. display: block;
  1377. }
  1378. }
  1379. .charm-items {
  1380. display: flex;
  1381. flex-direction: column;
  1382. gap: 20rpx;
  1383. margin-bottom: 25rpx;
  1384. .charm-item {
  1385. display: flex;
  1386. justify-content: space-between;
  1387. align-items: center;
  1388. .charm-item-label {
  1389. font-size: 26rpx;
  1390. color: #666666;
  1391. font-weight: 500;
  1392. }
  1393. .charm-item-progress {
  1394. display: flex;
  1395. align-items: center;
  1396. gap: 12rpx;
  1397. flex: 1;
  1398. margin-left: 20rpx;
  1399. .item-progress-bar {
  1400. flex: 1;
  1401. height: 8rpx;
  1402. background: #FFE5F1;
  1403. border-radius: 4rpx;
  1404. overflow: hidden;
  1405. .item-progress-fill {
  1406. height: 100%;
  1407. background: #E91E63;
  1408. border-radius: 4rpx;
  1409. transition: width 1s ease;
  1410. }
  1411. }
  1412. .charm-item-score {
  1413. font-size: 24rpx;
  1414. color: #E91E63;
  1415. font-weight: 600;
  1416. min-width: 60rpx;
  1417. text-align: right;
  1418. }
  1419. }
  1420. }
  1421. }
  1422. .charm-tip {
  1423. padding: 20rpx;
  1424. background: #FFF8E1;
  1425. border-radius: 8rpx;
  1426. border: 2rpx solid #FFD54F;
  1427. .tip-text {
  1428. font-size: 24rpx;
  1429. color: #666666;
  1430. line-height: 1.5;
  1431. }
  1432. }
  1433. }
  1434. }
  1435. /* 底部占位 */
  1436. .bottom-placeholder {
  1437. height: 30rpx;
  1438. }
  1439. /* 底部导航栏 */
  1440. .tabbar {
  1441. position: fixed;
  1442. bottom: 0;
  1443. left: 0;
  1444. right: 0;
  1445. display: flex;
  1446. background-color: #FFFFFF;
  1447. border-top: 1rpx solid #F0F0F0;
  1448. padding-bottom: constant(safe-area-inset-bottom);
  1449. padding-bottom: env(safe-area-inset-bottom);
  1450. z-index: 999;
  1451. box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.05);
  1452. .tabbar-item {
  1453. flex: 1;
  1454. display: flex;
  1455. flex-direction: column;
  1456. align-items: center;
  1457. justify-content: center;
  1458. padding: 15rpx 0;
  1459. position: relative;
  1460. .tabbar-icon {
  1461. font-size: 44rpx;
  1462. margin-bottom: 5rpx;
  1463. }
  1464. .tabbar-text {
  1465. font-size: 22rpx;
  1466. color: #666666;
  1467. }
  1468. &.active {
  1469. .tabbar-text {
  1470. color: #E91E63;
  1471. font-weight: bold;
  1472. }
  1473. }
  1474. }
  1475. }
  1476. /* 成功案例 */
  1477. .success-case-section {
  1478. .success-case-grid {
  1479. display: grid;
  1480. grid-template-columns: repeat(2, 1fr);
  1481. gap: 20rpx;
  1482. margin: 0 35rpx;
  1483. .case-card {
  1484. background: #FFFFFF;
  1485. border-radius: 16rpx;
  1486. overflow: hidden;
  1487. border: 2rpx solid #E0E0E0;
  1488. transition: all 0.3s ease;
  1489. &:active {
  1490. transform: scale(0.98);
  1491. opacity: 0.9;
  1492. }
  1493. .case-image-wrapper {
  1494. width: 100%;
  1495. height: 320rpx;
  1496. position: relative;
  1497. overflow: hidden;
  1498. .case-image {
  1499. width: 100%;
  1500. height: 100%;
  1501. }
  1502. }
  1503. .case-content {
  1504. padding: 20rpx;
  1505. .couple-names {
  1506. font-size: 28rpx;
  1507. font-weight: 700;
  1508. color: #333333;
  1509. margin-bottom: 10rpx;
  1510. line-height: 1.3;
  1511. }
  1512. .case-quote {
  1513. font-size: 24rpx;
  1514. color: #666666;
  1515. line-height: 1.5;
  1516. margin-bottom: 12rpx;
  1517. display: -webkit-box;
  1518. -webkit-box-orient: vertical;
  1519. -webkit-line-clamp: 2;
  1520. overflow: hidden;
  1521. }
  1522. .case-meta {
  1523. .marriage-date {
  1524. font-size: 22rpx;
  1525. color: #999999;
  1526. line-height: 1.4;
  1527. }
  1528. }
  1529. }
  1530. }
  1531. }
  1532. }
  1533. @keyframes marquee {
  1534. 0% {
  1535. transform: translateX(0);
  1536. }
  1537. 100% {
  1538. transform: translateX(-50%);
  1539. }
  1540. }
  1541. .tabbar-badge {
  1542. position: absolute;
  1543. top: 8rpx;
  1544. right: 50%;
  1545. margin-right: -40rpx;
  1546. min-width: 32rpx;
  1547. height: 32rpx;
  1548. line-height: 32rpx;
  1549. padding: 0 6rpx;
  1550. background-color: #FA5151;
  1551. border-radius: 16rpx;
  1552. font-size: 20rpx;
  1553. color: #FFFFFF;
  1554. text-align: center;
  1555. }
  1556. </style>