index.vue 42 KB

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