ranking.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491
  1. <template>
  2. <view class="matchmaker-ranking">
  3. <!-- 顶部导航栏 -->
  4. <view class="header">
  5. <view class="back-btn" @click="goBack"></view>
  6. <text class="header-title">红娘排行榜</text>
  7. <view class="placeholder"></view>
  8. </view>
  9. <!-- 更新提示 -->
  10. <view class="update-info">
  11. <text class="update-text">每天17点自动更新数据</text>
  12. </view>
  13. <!-- 本周最佳榜标题 -->
  14. <view class="section-title-wrapper">
  15. <text class="section-title">
  16. <text class="title-icon">👩‍❤️‍💋‍👨</text>
  17. 本周最佳榜
  18. <text class="title-icon">👩‍❤️‍💋‍👨</text>
  19. </text>
  20. </view>
  21. <!-- 榜说明 -->
  22. <view class="ranking-description">
  23. <text class="description-text">榜单综合万粉以下红娘的日牵线数,用户好评数 等综合因素,上榜为前20的红娘</text>
  24. </view>
  25. <!-- 前三名展示 -->
  26. <view class="top-three-container">
  27. <view class="top-three-item second">
  28. <text class="rank-number">2</text>
  29. <view class="avatar-large"></view>
  30. <text class="matchmaker-name">小颖颖</text>
  31. <text class="success-count">成功人数: 11</text>
  32. <view class="like-btn" @click="handleLike(2)">点赞</view>
  33. </view>
  34. <view class="top-three-item first">
  35. <text class="rank-number">1</text>
  36. <view class="avatar-large"></view>
  37. <text class="matchmaker-name">小超超</text>
  38. <text class="success-count">成功人数: 12</text>
  39. <view class="like-btn active" @click="handleLike(1)">点赞</view>
  40. </view>
  41. <view class="top-three-item third">
  42. <text class="rank-number">3</text>
  43. <view class="avatar-large"></view>
  44. <text class="matchmaker-name">小魏魏</text>
  45. <text class="success-count">成功人数: 10</text>
  46. <view class="like-btn" @click="handleLike(3)">点赞</view>
  47. </view>
  48. </view>
  49. <!-- 排行榜列表 -->
  50. <scroll-view scroll-y class="ranking-list">
  51. <view class="ranking-item" v-for="(item, index) in rankingList" :key="index">
  52. <text class="rank-number-normal">{{ index + 4 }}</text>
  53. <view class="avatar-small"></view>
  54. <view class="matchmaker-info">
  55. <text class="matchmaker-name-normal">{{ item.name }}</text>
  56. <text class="success-count-normal">成功人数: {{ item.successCount }} 人</text>
  57. <text class="user-rating">用户好评数:{{ item.userRating }}</text>
  58. </view>
  59. <view class="like-btn-small" @click="handleLike(index + 4)">点赞</view>
  60. </view>
  61. </scroll-view>
  62. <!-- 底部导航 -->
  63. <view class="tabbar">
  64. <view class="tabbar-item" @click="navigateToWorkbench">
  65. <text class="tab-icon">🏠</text>
  66. <text class="tab-text">工作台</text>
  67. </view>
  68. <view class="tabbar-item" @click="navigateToMyResources">
  69. <text class="tab-icon">📋</text>
  70. <text class="tab-text">我的资源</text>
  71. </view>
  72. <view class="tabbar-item active" @click="navigateToRanking">
  73. <text class="tab-icon">🏆</text>
  74. <text class="tab-text">排行榜</text>
  75. </view>
  76. <view class="tabbar-item" @click="navigateToMessage">
  77. <view class="tab-icon-wrapper">
  78. <text class="tab-icon">💬</text>
  79. <view class="badge">3</view>
  80. </view>
  81. <text class="tab-text">消息</text>
  82. </view>
  83. <view class="tabbar-item" @click="navigateToMine">
  84. <text class="tab-icon">👤</text>
  85. <text class="tab-text">我的</text>
  86. </view>
  87. </view>
  88. </view>
  89. </template>
  90. <script>
  91. import api from '@/utils/api.js'
  92. export default {
  93. data() {
  94. return {
  95. rankingList: [
  96. { name: '小华华', successCount: 9, userRating: 25 },
  97. { name: '小蒋蒋', successCount: 8, userRating: 24 },
  98. { name: '小明明', successCount: 7, userRating: 23 },
  99. { name: '小信信', successCount: 6, userRating: 23 },
  100. { name: '小莉莉', successCount: 6, userRating: 22 },
  101. { name: '小圆圆', successCount: 5, userRating: 21 },
  102. { name: '小方方', successCount: 5, userRating: 20 },
  103. { name: '小香香', successCount: 4, userRating: 19 },
  104. { name: '小甜甜', successCount: 4, userRating: 18 },
  105. { name: '小美美', successCount: 4, userRating: 18 },
  106. { name: '小柔柔', successCount: 3, userRating: 17 },
  107. { name: '小静静', successCount: 3, userRating: 16 },
  108. { name: '小聪聪', successCount: 3, userRating: 15 },
  109. { name: '小慧慧', successCount: 3, userRating: 15 },
  110. { name: '小欢欢', successCount: 2, userRating: 14 },
  111. { name: '小乐乐', successCount: 2, userRating: 13 },
  112. { name: '小笑笑', successCount: 2, userRating: 12 },
  113. { name: '小闹闹', successCount: 1, userRating: 11 },
  114. { name: '小跳跳', successCount: 1, userRating: 10 },
  115. { name: '小跑跑', successCount: 1, userRating: 9 }
  116. ]
  117. }
  118. },
  119. onLoad() {
  120. // 加载排行榜数据
  121. this.loadRankingData()
  122. },
  123. methods: {
  124. // 返回上一页
  125. goBack() {
  126. uni.navigateBack()
  127. },
  128. // 加载排行榜数据
  129. async loadRankingData() {
  130. try {
  131. const res = await api.matchmaker.getRankingData()
  132. if (res.data) {
  133. this.rankingList = res.data
  134. }
  135. } catch (e) {
  136. console.error('加载排行榜数据失败:', e)
  137. }
  138. },
  139. // 点赞
  140. handleLike(rank) {
  141. // 实现点赞功能
  142. console.log('点赞第', rank, '名红娘')
  143. uni.showToast({
  144. title: '点赞成功',
  145. icon: 'success'
  146. })
  147. },
  148. // 导航到工作台
  149. navigateToWorkbench() {
  150. uni.redirectTo({
  151. url: '/pages/matchmaker-workbench/index'
  152. })
  153. },
  154. // 导航到我的资源
  155. navigateToMyResources() {
  156. uni.redirectTo({
  157. url: '/pages/matchmaker-workbench/my-resources'
  158. })
  159. },
  160. // 导航到排行榜
  161. navigateToRanking() {
  162. // 已在排行榜页面,无需跳转
  163. },
  164. // 导航到消息
  165. navigateToMessage() {
  166. uni.redirectTo({
  167. url: '/pages/matchmaker-workbench/message'
  168. })
  169. },
  170. // 导航到我的
  171. navigateToMine() {
  172. uni.redirectTo({
  173. url: '/pages/matchmaker-workbench/mine'
  174. })
  175. }
  176. }
  177. }
  178. </script>
  179. <style lang="scss" scoped>
  180. .matchmaker-ranking {
  181. min-height: 100vh;
  182. background: linear-gradient(135deg, #FFF3F6 0%, #FFE4E8 100%);
  183. display: flex;
  184. flex-direction: column;
  185. }
  186. /* 顶部导航栏 */
  187. .header {
  188. display: flex;
  189. align-items: center;
  190. justify-content: space-between;
  191. padding: 25rpx 30rpx;
  192. padding-top: calc(25rpx + env(safe-area-inset-top));
  193. background: #FFF9F9;
  194. border-bottom: 1rpx solid #F0F0F0;
  195. .back-btn {
  196. width: 70rpx;
  197. height: 70rpx;
  198. display: flex;
  199. align-items: center;
  200. justify-content: center;
  201. background: rgba(240, 240, 240, 0.5);
  202. border-radius: 50%;
  203. background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23333"><path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"/></svg>');
  204. background-size: 40rpx 40rpx;
  205. background-repeat: no-repeat;
  206. background-position: center;
  207. }
  208. .header-title {
  209. font-size: 38rpx;
  210. font-weight: bold;
  211. color: #333;
  212. }
  213. .placeholder {
  214. width: 70rpx;
  215. }
  216. }
  217. /* 更新提示 */
  218. .update-info {
  219. background: #FFF3E0;
  220. padding: 15rpx;
  221. text-align: center;
  222. .update-text {
  223. font-size: 24rpx;
  224. color: #FF9800;
  225. }
  226. }
  227. /* 本周最佳榜标题 */
  228. .section-title-wrapper {
  229. text-align: center;
  230. margin: 30rpx 0 15rpx;
  231. .section-title {
  232. display: inline-block;
  233. font-size: 36rpx;
  234. font-weight: bold;
  235. color: #E91E63;
  236. line-height: 1.4;
  237. .title-icon {
  238. font-size: 40rpx;
  239. margin: 0 10rpx;
  240. }
  241. }
  242. }
  243. /* 榜说明 */
  244. .ranking-description {
  245. padding: 0 30rpx 25rpx;
  246. .description-text {
  247. display: block;
  248. font-size: 26rpx;
  249. color: #666;
  250. line-height: 1.5;
  251. text-align: center;
  252. }
  253. }
  254. /* 前三名展示 */
  255. .top-three-container {
  256. display: flex;
  257. justify-content: space-around;
  258. align-items: flex-end;
  259. padding: 0 20rpx 40rpx;
  260. background: #FFF9F9;
  261. border-radius: 20rpx;
  262. margin: 0 20rpx 20rpx;
  263. box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
  264. .top-three-item {
  265. display: flex;
  266. flex-direction: column;
  267. align-items: center;
  268. padding: 20rpx;
  269. border-radius: 20rpx;
  270. position: relative;
  271. &.first {
  272. background: linear-gradient(135deg, #FFD700 0%, #FFA000 100%);
  273. width: 280rpx;
  274. height: 400rpx;
  275. order: 2;
  276. margin-bottom: 30rpx;
  277. }
  278. &.second {
  279. background: linear-gradient(135deg, #C0C0C0 0%, #A8A8A8 100%);
  280. width: 240rpx;
  281. height: 350rpx;
  282. order: 1;
  283. }
  284. &.third {
  285. background: linear-gradient(135deg, #CD7F32 0%, #B87333 100%);
  286. width: 240rpx;
  287. height: 350rpx;
  288. order: 3;
  289. }
  290. .rank-number {
  291. position: absolute;
  292. top: 20rpx;
  293. left: 20rpx;
  294. font-size: 48rpx;
  295. font-weight: bold;
  296. color: #FFFFFF;
  297. }
  298. .avatar-large {
  299. width: 120rpx;
  300. height: 120rpx;
  301. border-radius: 50%;
  302. background: rgba(255, 255, 255, 0.3);
  303. margin: 40rpx 0 20rpx;
  304. }
  305. .matchmaker-name {
  306. font-size: 32rpx;
  307. font-weight: bold;
  308. color: #FFFFFF;
  309. margin-bottom: 15rpx;
  310. }
  311. .success-count {
  312. font-size: 28rpx;
  313. color: #FFFFFF;
  314. margin-bottom: 30rpx;
  315. }
  316. .like-btn {
  317. padding: 12rpx 35rpx;
  318. background: rgba(255, 255, 255, 0.2);
  319. color: #FFFFFF;
  320. border-radius: 25rpx;
  321. font-size: 26rpx;
  322. font-weight: bold;
  323. border: 2rpx solid #FFFFFF;
  324. &.active {
  325. background: #E91E63;
  326. color: #FFFFFF;
  327. border-color: #E91E63;
  328. }
  329. }
  330. }
  331. }
  332. .ranking-list {
  333. flex: 1;
  334. padding: 0 20rpx 120rpx;
  335. .ranking-item {
  336. display: flex;
  337. align-items: center;
  338. background: #FFFFFF;
  339. border-radius: 20rpx;
  340. padding: 25rpx;
  341. margin-bottom: 20rpx;
  342. box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
  343. .rank-number-normal {
  344. width: 50rpx;
  345. height: 50rpx;
  346. display: flex;
  347. align-items: center;
  348. justify-content: center;
  349. font-size: 28rpx;
  350. font-weight: bold;
  351. color: #999;
  352. border-radius: 50%;
  353. background: #F0F0F0;
  354. margin-right: 20rpx;
  355. }
  356. .avatar-small {
  357. width: 80rpx;
  358. height: 80rpx;
  359. border-radius: 50%;
  360. background: #F0F0F0;
  361. margin-right: 20rpx;
  362. }
  363. .matchmaker-info {
  364. flex: 1;
  365. .matchmaker-name-normal {
  366. display: block;
  367. font-size: 32rpx;
  368. font-weight: bold;
  369. color: #333;
  370. margin-bottom: 8rpx;
  371. }
  372. .success-count-normal,
  373. .user-rating {
  374. display: block;
  375. font-size: 24rpx;
  376. color: #666;
  377. margin-bottom: 4rpx;
  378. }
  379. }
  380. .like-btn-small {
  381. padding: 10rpx 30rpx;
  382. background: linear-gradient(135deg, #E91E63 0%, #C2185B 100%);
  383. color: #FFFFFF;
  384. border-radius: 25rpx;
  385. font-size: 26rpx;
  386. font-weight: bold;
  387. }
  388. }
  389. }
  390. /* 底部导航 */
  391. .tabbar {
  392. position: fixed;
  393. bottom: 0;
  394. left: 0;
  395. right: 0;
  396. height: 110rpx;
  397. background: #FFFFFF;
  398. border-top: 1rpx solid #F0F0F0;
  399. display: flex;
  400. justify-content: space-around;
  401. align-items: center;
  402. padding-bottom: env(safe-area-inset-bottom);
  403. .tabbar-item {
  404. display: flex;
  405. flex-direction: column;
  406. align-items: center;
  407. gap: 6rpx;
  408. padding: 10rpx 0;
  409. .tab-icon-wrapper {
  410. position: relative;
  411. .badge {
  412. position: absolute;
  413. top: -8rpx;
  414. right: -12rpx;
  415. background: #FF4444;
  416. color: #FFFFFF;
  417. font-size: 18rpx;
  418. font-weight: bold;
  419. min-width: 28rpx;
  420. height: 28rpx;
  421. padding: 0 6rpx;
  422. border-radius: 14rpx;
  423. display: flex;
  424. align-items: center;
  425. justify-content: center;
  426. }
  427. }
  428. .tab-icon {
  429. font-size: 36rpx;
  430. }
  431. .tab-text {
  432. font-size: 20rpx;
  433. color: #999;
  434. }
  435. &.active {
  436. .tab-text {
  437. color: #9C27B0;
  438. font-weight: bold;
  439. }
  440. }
  441. }
  442. }
  443. </style>