index.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935
  1. <template>
  2. <view class="matchmaker-workbench">
  3. <!-- 顶部导航栏 -->
  4. <view class="header">
  5. <text class="header-title">红娘工作台</text>
  6. <view class="header-right">
  7. <view class="search-icon" @click="handleSearch"></view>
  8. <!-- 返回用户端按钮 - 修改为与"前往红娘工作台"一致的样式 -->
  9. <view class="back-to-user-btn" @click="openExitPopup">
  10. <text class="btn-text">返回用户端</text>
  11. </view>
  12. </view>
  13. </view>
  14. <scroll-view scroll-y class="content">
  15. <!-- 欢迎卡片 -->
  16. <view class="welcome-card">
  17. <view class="welcome-text">
  18. <text class="welcome-title">欢迎回来</text>
  19. <text class="heart-icon">❤️</text>
  20. <text class="matchmaker-name">{{ matchmakerInfo.realName || makerName }}</text>
  21. </view>
  22. <image class="avatar" :src="matchmakerInfo.avatarUrl || '/static/default-avatar.svg'" mode="aspectFill"></image>
  23. </view>
  24. <!-- 统计卡片 -->
  25. <view class="stats-cards">
  26. <view class="stats-card success">
  27. <view class="stats-row">
  28. <text class="stats-number">{{ matchmakerInfo.successCouples || 0 }}</text>
  29. <text class="stats-tag orange">撮合达人</text>
  30. </view>
  31. <text class="stats-label">成功撮合</text>
  32. <text class="stats-subtitle">匹配数</text>
  33. </view>
  34. <view class="stats-card points">
  35. <view class="stats-row">
  36. <text class="stats-number">{{ matchmakerInfo.points || 0 }}</text>
  37. <text class="stats-tag purple">积分可兑礼</text>
  38. </view>
  39. <text class="stats-label">我的积分</text>
  40. <text class="stats-subtitle">可兑换</text>
  41. </view>
  42. </view>
  43. <!-- 公告卡片 -->
  44. <view class="announcement-card" @click="handleAnnouncement" v-if="currentAnnouncement">
  45. <text class="announcement-tag">公告</text>
  46. <text class="announcement-content">{{ currentAnnouncement.content }}</text>
  47. <view class="arrow-right"></view>
  48. </view>
  49. <view class="announcement-card" v-else>
  50. <text class="announcement-tag">公告</text>
  51. <text class="announcement-content">暂无公告</text>
  52. </view>
  53. <!-- 核心功能入口 -->
  54. <view class="function-grid">
  55. <view class="grid-item"
  56. v-for="item in functionList"
  57. :key="item.id"
  58. @click="navigateToFunction(item)">
  59. <view class="grid-icon-wrapper" :style="{ background: item.gradient || item.bgColor || '#FFE5F1' }">
  60. <text class="grid-icon" :style="{ color: item.iconColor || '#333333' }">{{ item.icon }}</text>
  61. </view>
  62. <text class="grid-text">{{ item.name }}</text>
  63. </view>
  64. </view>
  65. <!-- 本周最佳红娘 -->
  66. <view class="best-matchmaker-section">
  67. <view class="section-header">
  68. <text class="section-title">
  69. <text class="crown-icon">👑</text>
  70. 本周最佳红娘
  71. </text>
  72. <text class="section-more" @click="navigateToRanking">排行榜 ></text>
  73. </view>
  74. <view class="best-matchmaker-list">
  75. <view class="best-matchmaker-item" v-for="(item, index) in bestMatchmakers" :key="item.matchmaker_id || index"
  76. @click="goToMatchmakerDetail(item)">
  77. <text class="rank-number" :class="'rank-' + (index + 1)">{{ index + 1 }}</text>
  78. <image class="avatar-small" :src="item.avatar_url || '/static/default-avatar.svg'"
  79. mode="aspectFill"></image>
  80. <view class="matchmaker-info">
  81. <text class="matchmaker-name-small">{{ item.real_name || '红娘' }}</text>
  82. <text class="success-count">成功人数: {{ item.success_couples || 0 }}</text>
  83. </view>
  84. <view class="likes-info">
  85. <text class="heart-small">❤️</text>
  86. <text class="like-count">{{ item.likes || 0 }}</text>
  87. </view>
  88. </view>
  89. </view>
  90. </view>
  91. </scroll-view>
  92. <!-- 底部导航 -->
  93. <view class="tabbar">
  94. <view class="tabbar-item active home" @click="navigateToWorkbench">
  95. <view class="tabbar-icon"></view>
  96. <text class="tabbar-text">工作台</text>
  97. </view>
  98. <view class="tabbar-item resources" @click="navigateToMyResources">
  99. <view class="tabbar-icon"></view>
  100. <text class="tabbar-text">我的资源</text>
  101. </view>
  102. <view class="tabbar-item trophy" @click="navigateToRanking">
  103. <view class="tabbar-icon"></view>
  104. <text class="tabbar-text">排行榜</text>
  105. </view>
  106. <view class="tabbar-item message" @click="navigateToMessage">
  107. <view class="tabbar-icon">
  108. <view v-if="unreadCount > 0" class="badge">{{ unreadCount }}</view>
  109. </view>
  110. <text class="tabbar-text">消息</text>
  111. </view>
  112. <view class="tabbar-item mine" @click="navigateToMine">
  113. <view class="tabbar-icon"></view>
  114. <text class="tabbar-text">我的</text>
  115. </view>
  116. </view>
  117. </view>
  118. </template>
  119. <script>
  120. import api from '@/utils/api.js'
  121. export default {
  122. data() {
  123. return {
  124. bestMatchmakers: [],
  125. announcements: [],
  126. currentAnnouncementIndex: 0,
  127. makerName: uni.getStorageSync("userInfo").nickname,
  128. matchmakerInfo: {
  129. realName: '',
  130. avatarUrl: '',
  131. successCouples: 0,
  132. points: 0
  133. },
  134. // 金刚区功能列表(从数据库获取)
  135. functionList: []
  136. }
  137. },
  138. computed: {
  139. currentAnnouncement() {
  140. return this.announcements.length > 0 ? this.announcements[this.currentAnnouncementIndex] : null
  141. },
  142. // 全局未读消息数(来自用户端已配置的 Vuex)
  143. unreadCount() {
  144. return this.$store.getters.getTotalUnread || 0
  145. }
  146. },
  147. onLoad() {
  148. this.loadMatchmakerInfo()
  149. this.loadRankingData()
  150. this.loadAnnouncements()
  151. this.loadFunctionGridData()
  152. },
  153. methods: {
  154. // 加载当前登录红娘信息
  155. async loadMatchmakerInfo() {
  156. try {
  157. const userInfo = uni.getStorageSync('userInfo')
  158. if (!userInfo || !userInfo.userId) {
  159. console.log('未登录,无法获取红娘信息')
  160. return
  161. }
  162. // 根据userId获取红娘信息
  163. const res = await api.matchmaker.getByUserId(userInfo.userId)
  164. console.log('红娘信息原始返回:', res)
  165. // 解析返回数据(可能被包装在data字段中)
  166. let matchmaker = res
  167. if (res && res.data) {
  168. matchmaker = res.data
  169. }
  170. console.log('解析后红娘信息:', matchmaker)
  171. if (matchmaker && (matchmaker.matchmakerId || matchmaker.matchmaker_id)) {
  172. // 获取红娘ID
  173. const matchmakerId = matchmaker.matchmakerId || matchmaker.matchmaker_id
  174. this.matchmakerInfo = {
  175. realName: matchmaker.realName || matchmaker.real_name || userInfo.nickname,
  176. avatarUrl: matchmaker.avatarUrl || matchmaker.avatar_url || userInfo.avatarUrl,
  177. successCouples: matchmaker.successCouples || matchmaker.success_couples || 0,
  178. points: matchmaker.points || 0
  179. }
  180. // 将matchmakerId保存到userInfo中,供其他页面使用
  181. userInfo.matchmakerId = matchmakerId
  182. uni.setStorageSync('userInfo', userInfo)
  183. console.log('设置红娘信息:', this.matchmakerInfo, '红娘ID:', matchmakerId)
  184. } else {
  185. console.log('未找到红娘信息,使用默认值')
  186. }
  187. } catch (e) {
  188. console.error('加载红娘信息失败:', e)
  189. }
  190. },
  191. // 加载排行榜数据(取前3名)
  192. async loadRankingData() {
  193. try {
  194. const res = await api.matchmaker.getRankingData({ limit: 20 })
  195. let list = []
  196. if (res && Array.isArray(res)) {
  197. list = res
  198. } else if (res && res.data && Array.isArray(res.data)) {
  199. list = res.data
  200. }
  201. // 只取前3名显示
  202. this.bestMatchmakers = list.slice(0, 3)
  203. } catch (e) {
  204. console.error('加载排行榜数据失败:', e)
  205. }
  206. },
  207. // 加载公告数据
  208. async loadAnnouncements() {
  209. try {
  210. const res = await api.home.getNotices()
  211. if (res && Array.isArray(res)) {
  212. this.announcements = res
  213. } else if (res && res.data && Array.isArray(res.data)) {
  214. this.announcements = res.data
  215. }
  216. // 如果有多条公告,自动轮播
  217. if (this.announcements.length > 1) {
  218. this.startAnnouncementCarousel()
  219. }
  220. } catch (e) {
  221. console.error('加载公告失败:', e)
  222. }
  223. },
  224. // 加载金刚区功能数据
  225. async loadFunctionGridData() {
  226. try {
  227. // 获取红娘端金刚区功能列表
  228. console.log('开始请求金刚区数据...')
  229. const res = await api.home.getFunctionGridByType('matchmaker')
  230. console.log('金刚区API返回结果:', res)
  231. // 由于api.js中的request函数已经处理了响应,res直接是res.data.data或res.data
  232. if (Array.isArray(res)) {
  233. this.functionList = res
  234. console.log('金刚区数据加载成功,共', this.functionList.length, '项:', this.functionList)
  235. } else if (res && res.code === 200 && Array.isArray(res.data)) {
  236. this.functionList = res.data
  237. console.log('金刚区数据加载成功,共', this.functionList.length, '项:', this.functionList)
  238. } else {
  239. console.error('金刚区API返回数据格式不正确:', res)
  240. this.functionList = []
  241. }
  242. } catch (e) {
  243. console.error('加载金刚区功能失败:', e)
  244. this.functionList = []
  245. }
  246. },
  247. // 公告轮播
  248. startAnnouncementCarousel() {
  249. setInterval(() => {
  250. this.currentAnnouncementIndex = (this.currentAnnouncementIndex + 1) % this.announcements.length
  251. }, 5000)
  252. },
  253. // 公告点击
  254. handleAnnouncement() {
  255. if (this.currentAnnouncement) {
  256. uni.navigateTo({
  257. url: '/pages/announcement/list'
  258. })
  259. }
  260. },
  261. // 导航到我的资源
  262. navigateToMyResources() {
  263. uni.navigateTo({
  264. url: '/pages/matchmaker-workbench/my-resources'
  265. })
  266. },
  267. // 导航到优质资源
  268. navigateToQualityResources() {
  269. uni.navigateTo({
  270. url: '/pages/matchmaker-workbench/quality-resources'
  271. })
  272. },
  273. // 导航到课程培训
  274. navigateToCourses() {
  275. uni.navigateTo({
  276. url: '/pages/courses/list'
  277. })
  278. },
  279. // 导航到积分商城
  280. navigateToPointsMall() {
  281. uni.navigateTo({
  282. url: '/pages/matchmaker-workbench/points-mall'
  283. })
  284. },
  285. // 导航到活动中心
  286. navigateToActivityCenter() {
  287. uni.navigateTo({
  288. url: '/pages/matchmaker-workbench/activities'
  289. })
  290. },
  291. // 通用功能导航方法
  292. navigateToFunction(item) {
  293. uni.navigateTo({
  294. url: item.path
  295. })
  296. },
  297. // 导航到排行榜
  298. navigateToRanking() {
  299. uni.navigateTo({
  300. url: '/pages/matchmaker-workbench/ranking'
  301. })
  302. },
  303. // 跳转到红娘详情
  304. goToMatchmakerDetail(item) {
  305. if (!item) return
  306. const id = item.matchmaker_id || item.matchmakerId
  307. if (id) {
  308. uni.navigateTo({
  309. url: `/pages/matchmakers/detail?id=${id}`
  310. })
  311. }
  312. },
  313. // 导航到工作台
  314. navigateToWorkbench() {
  315. // 已在工作台,无需跳转
  316. },
  317. // 导航到消息
  318. navigateToMessage() {
  319. uni.navigateTo({
  320. url: '/pages/matchmaker-workbench/message'
  321. })
  322. },
  323. // 导航到我的
  324. navigateToMine() {
  325. uni.navigateTo({
  326. url: '/pages/matchmaker-workbench/mine'
  327. })
  328. },
  329. // 返回用户端首页
  330. openExitPopup() {
  331. uni.navigateTo({
  332. url: '/pages/index/index'
  333. })
  334. },
  335. // 搜索
  336. handleSearch() {
  337. console.log('搜索')
  338. }
  339. }
  340. }
  341. </script>
  342. <style lang="scss" scoped>
  343. .matchmaker-workbench {
  344. min-height: 100vh;
  345. background: #FFF9F9;
  346. display: flex;
  347. flex-direction: column;
  348. }
  349. /* 顶部导航栏 */
  350. .header {
  351. display: flex;
  352. align-items: center;
  353. justify-content: space-between;
  354. padding: 25rpx 30rpx;
  355. padding-top: calc(25rpx + env(safe-area-inset-top));
  356. background: #FFF9F9;
  357. border-bottom: 1rpx solid #F0F0F0;
  358. .header-title {
  359. font-size: 38rpx;
  360. font-weight: bold;
  361. color: #9C27B0;
  362. }
  363. .header-right {
  364. display: flex;
  365. align-items: center;
  366. gap: 20rpx;
  367. .search-icon,
  368. .settings-icon {
  369. width: 33rpx;
  370. height: 33rpx;
  371. background-size: contain;
  372. background-repeat: no-repeat;
  373. background-position: center;
  374. }
  375. .search-icon {
  376. background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23999"><path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"/></svg>');
  377. }
  378. .settings-icon {
  379. background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23999"><path d="M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z"/></svg>');
  380. }
  381. /* 返回用户端按钮 - 与"前往红娘工作台"按钮样式一致 */
  382. .back-to-user-btn {
  383. height: 60rpx;
  384. padding: 0 24rpx;
  385. background: linear-gradient(135deg, #FF8A9B 0%, #FF6B8A 100%);
  386. border-radius: 30rpx;
  387. display: flex;
  388. align-items: center;
  389. justify-content: center;
  390. box-shadow: 0 4rpx 12rpx rgba(255, 107, 138, 0.3);
  391. transition: all 0.3s ease;
  392. &:active {
  393. transform: scale(0.95);
  394. box-shadow: 0 2rpx 8rpx rgba(255, 107, 138, 0.3);
  395. }
  396. .btn-text {
  397. font-size: 26rpx;
  398. color: #FFFFFF;
  399. font-weight: bold;
  400. white-space: nowrap;
  401. }
  402. }
  403. }
  404. }
  405. .content {
  406. flex: 1;
  407. padding: 20rpx 20rpx 120rpx;
  408. display: flex;
  409. flex-direction: column;
  410. }
  411. /* 欢迎卡片 + 统计卡片合并 */
  412. .welcome-card {
  413. display: flex;
  414. justify-content: space-between;
  415. align-items: center;
  416. padding: 30rpx;
  417. background: linear-gradient(135deg, #FCE4EC 0%, #F8BBD0 100%);
  418. border-radius: 20rpx;
  419. margin-bottom: 20rpx;
  420. .welcome-text {
  421. display: flex;
  422. align-items: center;
  423. gap: 10rpx;
  424. .welcome-title {
  425. font-size: 38rpx;
  426. color: #333;
  427. }
  428. .heart-icon {
  429. font-size: 32rpx;
  430. }
  431. .matchmaker-name {
  432. font-size: 40rpx;
  433. font-weight: bold;
  434. color: #333;
  435. }
  436. }
  437. .avatar {
  438. width: 100rpx;
  439. height: 100rpx;
  440. border-radius: 50%;
  441. background: rgba(255, 255, 255, 0.3);
  442. }
  443. }
  444. /* 统计卡片 */
  445. .stats-cards {
  446. display: flex;
  447. gap: 20rpx;
  448. margin-bottom: 20rpx;
  449. .stats-card {
  450. flex: 1;
  451. padding: 25rpx;
  452. border-radius: 15rpx;
  453. background: #FFFFFF;
  454. box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
  455. .stats-row {
  456. display: flex;
  457. align-items: center;
  458. gap: 10rpx;
  459. margin-bottom: 8rpx;
  460. }
  461. .stats-number {
  462. font-size: 48rpx;
  463. font-weight: bold;
  464. }
  465. .stats-tag {
  466. font-size: 20rpx;
  467. padding: 4rpx 12rpx;
  468. border-radius: 6rpx;
  469. font-weight: 500;
  470. &.orange {
  471. color: #FF6B8A;
  472. border: 1rpx solid #FF6B8A;
  473. background: rgba(255, 107, 138, 0.1);
  474. }
  475. &.purple {
  476. color: #9C27B0;
  477. border: 1rpx solid #9C27B0;
  478. background: rgba(156, 39, 176, 0.1);
  479. }
  480. }
  481. .stats-label {
  482. display: block;
  483. font-size: 28rpx;
  484. margin-bottom: 8rpx;
  485. }
  486. .stats-subtitle {
  487. display: block;
  488. font-size: 24rpx;
  489. color: #999;
  490. }
  491. .stats-extra {
  492. display: block;
  493. font-size: 22rpx;
  494. color: #999;
  495. margin-top: 8rpx;
  496. }
  497. &.success {
  498. .stats-number {
  499. color: #FF6B8A;
  500. }
  501. .stats-label {
  502. color: #333;
  503. }
  504. }
  505. &.points {
  506. .stats-number {
  507. color: #9C27B0;
  508. }
  509. .stats-label {
  510. color: #333;
  511. }
  512. }
  513. }
  514. }
  515. /* 公告卡片 */
  516. .announcement-card {
  517. display: flex;
  518. align-items: center;
  519. justify-content: space-between;
  520. padding: 35rpx 30rpx;
  521. min-height: 80rpx;
  522. background: #FFFFFF;
  523. border-radius: 20rpx;
  524. margin-bottom: 20rpx;
  525. box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
  526. position: relative;
  527. .announcement-tag {
  528. display: inline-block;
  529. background: #FF9800;
  530. color: #FFFFFF;
  531. font-size: 22rpx;
  532. padding: 6rpx 16rpx;
  533. border-radius: 12rpx;
  534. margin-right: 15rpx;
  535. font-weight: bold;
  536. }
  537. .announcement-content {
  538. flex: 1;
  539. font-size: 26rpx;
  540. color: #333;
  541. line-height: 1.4;
  542. }
  543. .arrow-right {
  544. width: 24rpx;
  545. height: 24rpx;
  546. background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23999"><path d="M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z"/></svg>');
  547. background-size: contain;
  548. background-repeat: no-repeat;
  549. background-position: center;
  550. margin-left: 15rpx;
  551. }
  552. }
  553. /* 核心功能入口 */
  554. .function-grid {
  555. display: flex;
  556. flex-wrap: nowrap;
  557. gap: 20rpx;
  558. margin: 20rpx 10rpx;
  559. padding: 25rpx 15rpx;
  560. background: #fefeff;
  561. border-radius: 20rpx;
  562. border: 2rpx solid #f0f0f5;
  563. box-shadow: 0 4rpx 16rpx rgba(220, 220, 240, 0.2);
  564. box-sizing: border-box;
  565. }
  566. .grid-item {
  567. display: flex;
  568. flex-direction: column;
  569. align-items: center;
  570. justify-content: center;
  571. gap: 12rpx;
  572. padding: 15rpx 8rpx;
  573. transition: all 0.3s ease;
  574. border-radius: 16rpx;
  575. background: linear-gradient(180deg, #fff 0%, #fdfdff 100%);
  576. box-shadow: 0 2rpx 8rpx rgba(220, 220, 240, 0.15);
  577. flex: 1;
  578. min-width: 0;
  579. box-sizing: border-box;
  580. &:hover,
  581. &:active {
  582. transform: translateY(-4rpx) scale(0.98);
  583. background: linear-gradient(180deg, #fff 0%, #f8f8ff 100%);
  584. box-shadow: 0 6rpx 18rpx rgba(200, 200, 230, 0.25);
  585. }
  586. }
  587. /* 为不同功能定制图标容器底色(贴合功能主题) */
  588. .grid-item:nth-child(1) .grid-icon-wrapper {
  589. background: linear-gradient(135deg, #ff85a2 0%, #ff5d8f 100%);
  590. }
  591. .grid-item:nth-child(2) .grid-icon-wrapper {
  592. background: linear-gradient(135deg, #85cfff 0%, #5daaff 100%);
  593. }
  594. .grid-item:nth-child(3) .grid-icon-wrapper {
  595. background: linear-gradient(135deg, #ffc885 0%, #ffaa5d 100%);
  596. }
  597. .grid-item:nth-child(4) .grid-icon-wrapper {
  598. background: linear-gradient(135deg, #ff85d2 0%, #ff5daa 100%);
  599. }
  600. .grid-icon-wrapper {
  601. width: 120rpx;
  602. height: 120rpx;
  603. display: flex;
  604. align-items: center;
  605. justify-content: center;
  606. border-radius: 20rpx;
  607. position: relative;
  608. overflow: hidden;
  609. box-shadow: inset 0 3rpx 10rpx rgba(255, 255, 255, 0.4),
  610. 0 8rpx 24rpx rgba(0, 0, 0, 0.12);
  611. transition: all 0.3s ease;
  612. }
  613. .grid-icon-wrapper::before {
  614. content: '';
  615. position: absolute;
  616. top: -50%;
  617. left: -50%;
  618. width: 200%;
  619. height: 200%;
  620. background: linear-gradient(135deg,
  621. rgba(255, 255, 255, 0.7) 0%,
  622. rgba(255, 255, 255, 0.3) 40%,
  623. transparent 80%);
  624. transform: rotate(45deg);
  625. pointer-events: none;
  626. z-index: 1;
  627. }
  628. .grid-icon {
  629. font-size: 80rpx;
  630. color: #fff;
  631. position: relative;
  632. z-index: 2;
  633. filter: drop-shadow(0 4rpx 8rpx rgba(0, 0, 0, 0.15));
  634. }
  635. .grid-text {
  636. font-size: 22rpx;
  637. font-weight: 600;
  638. color: #2d2d46;
  639. text-align: center;
  640. line-height: 1.2;
  641. text-shadow: 0 1rpx 3rpx rgba(0, 0, 0, 0.05);
  642. overflow: hidden;
  643. text-overflow: ellipsis;
  644. display: -webkit-box;
  645. -webkit-line-clamp: 1;
  646. -webkit-box-orient: vertical;
  647. max-width: 100%;
  648. }
  649. /* 响应式适配:小屏自动改为2列 */
  650. @media (max-width: 600rpx) {
  651. .grid-item {
  652. min-width: calc(50% - 15rpx);
  653. max-width: calc(50% - 15rpx);
  654. }
  655. }
  656. /* 本周最佳红娘 */
  657. .best-matchmaker-section {
  658. flex: 1;
  659. min-height: 400rpx;
  660. padding: 30rpx;
  661. background: #FFFFFF;
  662. border-radius: 20rpx;
  663. box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
  664. display: flex;
  665. flex-direction: column;
  666. margin-bottom: 20rpx;
  667. .section-header {
  668. display: flex;
  669. justify-content: space-between;
  670. align-items: center;
  671. margin-bottom: 20rpx;
  672. .section-title {
  673. display: flex;
  674. align-items: center;
  675. font-size: 30rpx;
  676. font-weight: bold;
  677. color: red;
  678. .crown-icon {
  679. font-size: 32rpx;
  680. margin-right: 10rpx;
  681. }
  682. }
  683. .section-more {
  684. font-size: 24rpx;
  685. color: #9C27B0;
  686. }
  687. }
  688. .best-matchmaker-list {
  689. flex: 1;
  690. display: flex;
  691. flex-direction: column;
  692. gap: 20rpx;
  693. .best-matchmaker-item {
  694. display: flex;
  695. align-items: center;
  696. gap: 20rpx;
  697. padding: 30rpx 25rpx;
  698. background: #FAFAFA;
  699. border-radius: 15rpx;
  700. min-height: 100rpx;
  701. .rank-number {
  702. width: 45rpx;
  703. height: 45rpx;
  704. display: flex;
  705. align-items: center;
  706. justify-content: center;
  707. font-size: 28rpx;
  708. font-weight: bold;
  709. color: #FFF;
  710. border-radius: 50%;
  711. background: #FFD700;
  712. &.rank-1 {
  713. background: #FFD700;
  714. }
  715. &.rank-2 {
  716. background: #C0C0C0;
  717. }
  718. &.rank-3 {
  719. background: #CD7F32;
  720. }
  721. }
  722. .avatar-small {
  723. width: 80rpx;
  724. height: 80rpx;
  725. border-radius: 50%;
  726. background: #F0F0F0;
  727. }
  728. .matchmaker-info {
  729. flex: 1;
  730. .matchmaker-name-small {
  731. display: block;
  732. font-size: 32rpx;
  733. font-weight: bold;
  734. color: #333;
  735. margin-bottom: 8rpx;
  736. }
  737. .success-count {
  738. display: block;
  739. font-size: 26rpx;
  740. color: #999;
  741. }
  742. }
  743. .likes-info {
  744. display: flex;
  745. align-items: center;
  746. gap: 10rpx;
  747. .heart-small {
  748. font-size: 28rpx;
  749. }
  750. .like-count {
  751. font-size: 28rpx;
  752. color: #E91E63;
  753. font-weight: bold;
  754. }
  755. }
  756. }
  757. }
  758. }
  759. /* 底部导航 */
  760. .tabbar {
  761. position: fixed;
  762. bottom: 0;
  763. left: 0;
  764. right: 0;
  765. height: 100rpx;
  766. background: #FFFFFF;
  767. border-top: 1rpx solid #F0F0F0;
  768. display: flex;
  769. justify-content: space-around;
  770. align-items: center;
  771. padding-bottom: env(safe-area-inset-bottom);
  772. .tabbar-item {
  773. display: flex;
  774. flex-direction: column;
  775. align-items: center;
  776. gap: 8rpx;
  777. padding: 10rpx 0;
  778. .tabbar-icon {
  779. width: 44rpx;
  780. height: 44rpx;
  781. background-size: contain;
  782. background-repeat: no-repeat;
  783. background-position: center;
  784. position: relative;
  785. .badge {
  786. position: absolute;
  787. top: -8rpx;
  788. right: -8rpx;
  789. background: #FF4444;
  790. color: #FFFFFF;
  791. font-size: 20rpx;
  792. font-weight: bold;
  793. width: 32rpx;
  794. height: 32rpx;
  795. display: flex;
  796. align-items: center;
  797. justify-content: center;
  798. border-radius: 16rpx;
  799. }
  800. }
  801. .tabbar-text {
  802. font-size: 20rpx;
  803. color: #999;
  804. }
  805. &.active {
  806. .tabbar-text {
  807. color: #9C27B0;
  808. font-weight: bold;
  809. }
  810. }
  811. &.home .tabbar-icon {
  812. background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%239C27B0"><path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"/></svg>');
  813. }
  814. &.resources .tabbar-icon {
  815. background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23999"><path d="M16 11c1.66 0 2.99-1.34 2.99-3S17.66 5 16 5c-1.66 0-3 1.34-3 3s1.34 3 3 3zm-8 0c1.66 0 2.99-1.34 2.99-3S9.66 5 8 5C6.34 5 5 6.34 5 8s1.34 3 3 3zm0 2c-2.33 0-7 1.17-7 3.5V19h14v-2.5c0-2.33-4.67-3.5-7-3.5zm8 0c-.29 0-.62.02-.97.05 1.16.84 1.97 1.97 1.97 3.45V19h6v-2.5c0-2.33-4.67-3.5-7-3.5z"/></svg>');
  816. }
  817. &.active.resources .tabbar-icon {
  818. background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%239C27B0"><path d="M16 11c1.66 0 2.99-1.34 2.99-3S17.66 5 16 5c-1.66 0-3 1.34-3 3s1.34 3 3 3zm-8 0c1.66 0 2.99-1.34 2.99-3S9.66 5 8 5C6.34 5 5 6.34 5 8s1.34 3 3 3zm0 2c-2.33 0-7 1.17-7 3.5V19h14v-2.5c0-2.33-4.67-3.5-7-3.5zm8 0c-.29 0-.62.02-.97.05 1.16.84 1.97 1.97 1.97 3.45V19h6v-2.5c0-2.33-4.67-3.5-7-3.5z"/></svg>');
  819. }
  820. &.trophy .tabbar-icon {
  821. background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23999"><path d="M19 5h-2V3H7v2H5c-1.1 0-2 .9-2 2v1c0 2.55 1.92 4.63 4.39 4.94.63 1.5 1.98 2.63 3.61 2.96V19H7v2h10v-2h-4v-3.1c1.63-.33 2.98-1.46 3.61-2.96C19.08 12.63 21 10.55 21 8V7c0-1.1-.9-2-2-2zM5 8V7h2v3.82C5.84 10.4 5 9.3 5 8zm14 0c0 1.3-.84 2.4-2 2.82V7h2v1z"/></svg>');
  822. }
  823. &.active.trophy .tabbar-icon {
  824. background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%239C27B0"><path d="M19 5h-2V3H7v2H5c-1.1 0-2 .9-2 2v1c0 2.55 1.92 4.63 4.39 4.94.63 1.5 1.98 2.63 3.61 2.96V19H7v2h10v-2h-4v-3.1c1.63-.33 2.98-1.46 3.61-2.96C19.08 12.63 21 10.55 21 8V7c0-1.1-.9-2-2-2zM5 8V7h2v3.82C5.84 10.4 5 9.3 5 8zm14 0c0 1.3-.84 2.4-2 2.82V7h2v1z"/></svg>');
  825. }
  826. &.message .tabbar-icon {
  827. background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23999"><path d="M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H6l-2 2V4h16v12z"/></svg>');
  828. }
  829. &.active.message .tabbar-icon {
  830. background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%239C27B0"><path d="M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H6l-2 2V4h16v12z"/></svg>');
  831. }
  832. &.mine .tabbar-icon {
  833. background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23999"><path d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"/></svg>');
  834. }
  835. &.active.mine .tabbar-icon {
  836. background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%239C27B0"><path d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"/></svg>');
  837. }
  838. }
  839. }
  840. </style>