index.vue 45 KB

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