my-resources.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615
  1. <template>
  2. <view class="my-resources" :class="{ 'dark-mode': isDarkTheme }">
  3. <!-- 顶部导航栏 -->
  4. <view class="header">
  5. <text class="header-title">我的资源</text>
  6. <view class="header-right">
  7. <text class="dropdown-icon">▼</text>
  8. </view>
  9. </view>
  10. <!-- 搜索栏 -->
  11. <view class="search-bar">
  12. <view class="search-input-wrapper">
  13. <text class="search-icon">🔍</text>
  14. <input type="text" class="search-input" placeholder="请输入人搜索关键词" v-model="searchKeyword" @input="handleSearch" />
  15. </view>
  16. </view>
  17. <scroll-view scroll-y class="content">
  18. <!-- 资源列表 -->
  19. <view class="resource-item" v-for="(item, index) in resources" :key="index" @click="handleViewUserDetail(item)">
  20. <!-- 优质资源标签 -->
  21. <view class="quality-tag" v-if="item.isQuality">优质资源</view>
  22. <!-- 头部:头像 + 名字/性别 + 审核状态 -->
  23. <view class="resource-header">
  24. <image v-if="item.avatar" :src="item.avatar" mode="aspectFill" class="resource-avatar"></image>
  25. <view v-else class="resource-avatar-placeholder"></view>
  26. <view class="resource-info">
  27. <view class="name-gender-row">
  28. <text class="resource-name">{{ item.name }}</text>
  29. <text class="resource-gender">{{ item.gender }}</text>
  30. <text class="status-tag" :class="{ 'approved': item.status === '已审核', 'pending': item.status === '待审核' }">{{ item.status }}</text>
  31. </view>
  32. </view>
  33. <!-- 右侧点赞/加号 -->
  34. <view class="right-action" v-if="item.isPlus">
  35. <text class="heart-icon">💗</text>
  36. </view>
  37. </view>
  38. <!-- 标签 -->
  39. <view class="labels-section">
  40. <text class="label" v-for="(label, idx) in item.labels" :key="idx">{{ label }}</text>
  41. </view>
  42. <!-- 择偶要求 -->
  43. <view class="requirement-section">
  44. <text class="requirement-text">择偶要求: {{ item.requirement }}</text>
  45. </view>
  46. <!-- 联系方式 -->
  47. <view class="contact-section">
  48. <text class="contact-label">联系方式:</text>
  49. <text class="contact-number">{{ item.contact }}</text>
  50. <text class="copy-btn" @click.stop="handleCopy(item.contact)">复制</text>
  51. </view>
  52. <!-- 底部按钮 -->
  53. <view class="action-buttons">
  54. <text class="delete-btn" @click.stop="handleDelete(item.id)">删除</text>
  55. <text class="match-btn" @click.stop="handleMatch(item.id)">精准匹配</text>
  56. </view>
  57. </view>
  58. </scroll-view>
  59. <!-- 底部优质资源按钮 -->
  60. <view class="quality-resources-section fixed-bottom">
  61. <view class="quality-resources-btn" @click="navigateToQualityResources">
  62. <text class="btn-icon">⭐</text>
  63. <text class="btn-text">优质资源</text>
  64. </view>
  65. </view>
  66. <!-- 底部添加按钮 -->
  67. <view class="add-button" @click="handleAdd">
  68. <text class="add-button-icon">+</text>
  69. </view>
  70. <!-- 底部导航 -->
  71. <view class="tabbar">
  72. <view class="tabbar-item" @click="navigateToWorkbench">
  73. <text class="tab-icon">🏠</text>
  74. <text class="tab-text">工作台</text>
  75. </view>
  76. <view class="tabbar-item active" @click="navigateToMyResources">
  77. <text class="tab-icon">📋</text>
  78. <text class="tab-text">我的资源</text>
  79. </view>
  80. <view class="tabbar-item" @click="navigateToRanking">
  81. <text class="tab-icon">🏆</text>
  82. <text class="tab-text">排行榜</text>
  83. </view>
  84. <view class="tabbar-item" @click="navigateToMessage">
  85. <view class="tab-icon-wrapper">
  86. <text class="tab-icon">💬</text>
  87. <view class="badge" v-if="unreadCount > 0">{{ unreadCount }}</view>
  88. </view>
  89. <text class="tab-text">消息</text>
  90. </view>
  91. <view class="tabbar-item" @click="navigateToMine">
  92. <text class="tab-icon">👤</text>
  93. <text class="tab-text">我的</text>
  94. </view>
  95. </view>
  96. </view>
  97. </template>
  98. <script>
  99. import api from '@/utils/api.js'
  100. export default {
  101. data() {
  102. return {
  103. searchKeyword: '',
  104. unreadCount: 3,
  105. resources: [
  106. {
  107. id: 1,
  108. avatar: '',
  109. name: '小高',
  110. gender: '男',
  111. status: '已审核',
  112. isPlus: false,
  113. labels: ['气质男', '小清新'],
  114. requirement: '165+ 本科',
  115. contact: '123****8912',
  116. isQuality: false
  117. },
  118. {
  119. id: 2,
  120. avatar: '',
  121. name: '小美',
  122. gender: '女',
  123. status: '已审核',
  124. isPlus: true,
  125. labels: ['温柔', '知性', '爱读书'],
  126. requirement: '175+ 硕士 有房',
  127. contact: '138****6543',
  128. isQuality: false
  129. },
  130. {
  131. id: 3,
  132. avatar: '',
  133. name: '阿强',
  134. gender: '男',
  135. status: '待审核',
  136. isPlus: false,
  137. labels: ['阳光', '运动型'],
  138. requirement: '160+ 大专以上',
  139. contact: '159****2234',
  140. isQuality: true
  141. }
  142. ],
  143. isDarkTheme: false
  144. }
  145. },
  146. onShow() {
  147. const stored = uni.getStorageSync('matchmakerDarkMode')
  148. if (stored === true || stored === false) {
  149. this.isDarkTheme = stored
  150. }
  151. },
  152. onLoad() {
  153. // 加载我的资源数据
  154. this.loadMyResources()
  155. },
  156. methods: {
  157. async loadMyResources() {
  158. try {
  159. const res = await api.matchmaker.getMyResources()
  160. if (res && res.data && res.data.length > 0) {
  161. this.resources = res.data
  162. }
  163. } catch (e) {
  164. console.error('加载资源数据失败:', e)
  165. }
  166. },
  167. handleSearch() {
  168. console.log('搜索关键词:', this.searchKeyword)
  169. },
  170. handleCopy(contact) {
  171. uni.setClipboardData({
  172. data: contact.replace(/\*+/g, ''),
  173. success: () => {
  174. uni.showToast({
  175. title: '复制成功',
  176. icon: 'success'
  177. })
  178. }
  179. })
  180. },
  181. handleDelete(id) {
  182. uni.showModal({
  183. title: '删除确认',
  184. content: '确定要删除该资源吗?',
  185. success: (res) => {
  186. if (res.confirm) {
  187. console.log('删除资源:', id)
  188. uni.showToast({
  189. title: '删除成功',
  190. icon: 'success'
  191. })
  192. }
  193. }
  194. })
  195. },
  196. handleMatch(id) {
  197. console.log('精准匹配:', id)
  198. uni.navigateTo({
  199. url: `/pages/matchmaker-workbench/precise-match?id=${id}`
  200. })
  201. },
  202. handleAdd() {
  203. uni.navigateTo({
  204. url: '/pages/matchmaker-workbench/add-resource'
  205. })
  206. },
  207. navigateToWorkbench() {
  208. uni.redirectTo({
  209. url: '/pages/matchmaker-workbench/index'
  210. })
  211. },
  212. navigateToMyResources() {
  213. // 已在我的资源页面,无需跳转
  214. },
  215. navigateToRanking() {
  216. uni.redirectTo({
  217. url: '/pages/matchmaker-workbench/ranking'
  218. })
  219. },
  220. navigateToMessage() {
  221. uni.redirectTo({
  222. url: '/pages/matchmaker-workbench/message'
  223. })
  224. },
  225. navigateToMine() {
  226. uni.redirectTo({
  227. url: '/pages/matchmaker-workbench/mine'
  228. })
  229. },
  230. navigateToQualityResources() {
  231. uni.navigateTo({
  232. url: '/pages/matchmaker-workbench/quality-resources'
  233. })
  234. },
  235. handleViewUserDetail(item) {
  236. // 跳转到客户详情页面,传递用户ID
  237. uni.navigateTo({
  238. url: `/pages/matchmaker-workbench/client-detail?id=${item.id}`
  239. })
  240. }
  241. }
  242. }
  243. </script>
  244. <style lang="scss" scoped>
  245. .my-resources {
  246. min-height: 100vh;
  247. background: #FFF9F9;
  248. display: flex;
  249. flex-direction: column;
  250. }
  251. /* 顶部导航栏 */
  252. .header {
  253. display: flex;
  254. align-items: center;
  255. justify-content: space-between;
  256. padding: 20rpx 30rpx;
  257. padding-top: calc(20rpx + env(safe-area-inset-top));
  258. background: #FFF9F9;
  259. .header-title {
  260. font-size: 36rpx;
  261. font-weight: bold;
  262. color: #9C27B0;
  263. }
  264. .header-right {
  265. .dropdown-icon {
  266. font-size: 24rpx;
  267. color: #9C27B0;
  268. }
  269. }
  270. }
  271. /* 搜索栏 */
  272. .search-bar {
  273. padding: 15rpx 20rpx;
  274. background: #FFF9F9;
  275. .search-input-wrapper {
  276. display: flex;
  277. align-items: center;
  278. background: #FFFFFF;
  279. border-radius: 25rpx;
  280. padding: 12rpx 20rpx;
  281. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
  282. .search-icon {
  283. font-size: 28rpx;
  284. margin-right: 12rpx;
  285. }
  286. .search-input {
  287. flex: 1;
  288. font-size: 26rpx;
  289. color: #333;
  290. border: none;
  291. outline: none;
  292. background: transparent;
  293. &::placeholder {
  294. color: #999;
  295. }
  296. }
  297. }
  298. }
  299. .content {
  300. flex: 1;
  301. overflow-y: auto;
  302. padding: 15rpx 20rpx 20rpx;
  303. }
  304. /* 优质资源按钮(紧贴加号按钮上方,稍微缩小) */
  305. .quality-resources-section {
  306. position: fixed;
  307. right: 30rpx; /* 与加号按钮右边对齐 */
  308. bottom: 240rpx; /* 在加号按钮正上方留一点间距 */
  309. z-index: 999;
  310. .quality-resources-btn {
  311. display: flex;
  312. align-items: center;
  313. justify-content: center;
  314. gap: 8rpx;
  315. padding: 14rpx 22rpx; /* 比之前的 20rpx 略小 */
  316. background: linear-gradient(135deg, #FFF3E0 0%, #FFE0B2 100%);
  317. border-radius: 18rpx;
  318. border: 2rpx solid #FFB74D;
  319. .btn-icon {
  320. font-size: 28rpx; /* 略小 */
  321. }
  322. .btn-text {
  323. font-size: 24rpx; /* 略小 */
  324. font-weight: bold;
  325. color: #FF9800;
  326. }
  327. }
  328. }
  329. /* 资源卡片 */
  330. .resource-item {
  331. background: #FFFFFF;
  332. border-radius: 16rpx;
  333. margin-bottom: 15rpx;
  334. padding: 20rpx;
  335. position: relative;
  336. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
  337. /* 优质资源标签 */
  338. .quality-tag {
  339. position: absolute;
  340. top: 15rpx;
  341. right: 15rpx;
  342. background: linear-gradient(135deg, #FFD700 0%, #FFA000 100%);
  343. color: #FFFFFF;
  344. font-size: 20rpx;
  345. font-weight: bold;
  346. padding: 6rpx 14rpx;
  347. border-radius: 12rpx;
  348. }
  349. /* 头部:头像 + 名字/性别 + 审核状态 */
  350. .resource-header {
  351. display: flex;
  352. align-items: center;
  353. margin-bottom: 15rpx;
  354. gap: 15rpx;
  355. .resource-avatar {
  356. width: 80rpx;
  357. height: 80rpx;
  358. border-radius: 50%;
  359. flex-shrink: 0;
  360. background: #E8E8E8;
  361. }
  362. .resource-avatar-placeholder {
  363. width: 80rpx;
  364. height: 80rpx;
  365. border-radius: 50%;
  366. flex-shrink: 0;
  367. background: linear-gradient(135deg, #E0E0E0, #BDBDBD);
  368. }
  369. .resource-info {
  370. flex: 1;
  371. .name-gender-row {
  372. display: flex;
  373. align-items: center;
  374. gap: 10rpx;
  375. .resource-name {
  376. font-size: 28rpx;
  377. font-weight: bold;
  378. color: #333;
  379. }
  380. .resource-gender {
  381. font-size: 24rpx;
  382. color: #666;
  383. }
  384. .status-tag {
  385. display: inline-block;
  386. padding: 4rpx 12rpx;
  387. border-radius: 12rpx;
  388. font-size: 20rpx;
  389. font-weight: bold;
  390. &.approved {
  391. background: #E8F5E8;
  392. color: #4CAF50;
  393. }
  394. &.pending {
  395. background: #FFF3E0;
  396. color: #FF9800;
  397. }
  398. }
  399. }
  400. }
  401. .right-action {
  402. .heart-icon {
  403. font-size: 28rpx;
  404. }
  405. }
  406. }
  407. /* 标签 */
  408. .labels-section {
  409. display: flex;
  410. flex-wrap: wrap;
  411. gap: 8rpx;
  412. margin-bottom: 12rpx;
  413. .label {
  414. display: inline-block;
  415. padding: 5rpx 14rpx;
  416. background: #F5F5F5;
  417. color: #666;
  418. border-radius: 12rpx;
  419. font-size: 22rpx;
  420. }
  421. }
  422. /* 择偶要求 */
  423. .requirement-section {
  424. margin-bottom: 12rpx;
  425. .requirement-text {
  426. font-size: 24rpx;
  427. color: #666;
  428. line-height: 1.4;
  429. }
  430. }
  431. /* 联系方式 */
  432. .contact-section {
  433. display: flex;
  434. align-items: center;
  435. margin-bottom: 15rpx;
  436. gap: 8rpx;
  437. .contact-label {
  438. font-size: 24rpx;
  439. color: #333;
  440. font-weight: bold;
  441. }
  442. .contact-number {
  443. flex: 1;
  444. font-size: 24rpx;
  445. color: #9C27B0;
  446. }
  447. .copy-btn {
  448. font-size: 22rpx;
  449. color: #9C27B0;
  450. font-weight: bold;
  451. }
  452. }
  453. /* 底部按钮 */
  454. .action-buttons {
  455. display: flex;
  456. justify-content: space-between;
  457. gap: 12rpx;
  458. .delete-btn {
  459. flex: 1;
  460. padding: 10rpx 20rpx;
  461. background: #FFEBEE;
  462. color: #E91E63;
  463. border-radius: 20rpx;
  464. font-size: 24rpx;
  465. font-weight: bold;
  466. text-align: center;
  467. }
  468. .match-btn {
  469. flex: 1;
  470. padding: 10rpx 20rpx;
  471. background: linear-gradient(135deg, #9C27B0 0%, #BA68C8 100%);
  472. color: #FFFFFF;
  473. border-radius: 20rpx;
  474. font-size: 24rpx;
  475. font-weight: bold;
  476. text-align: center;
  477. }
  478. }
  479. }
  480. /* 添加按钮 */
  481. .add-button {
  482. position: fixed;
  483. bottom: 130rpx;
  484. right: 30rpx;
  485. width: 90rpx;
  486. height: 90rpx;
  487. border-radius: 50%;
  488. background: linear-gradient(135deg, #9C27B0 0%, #BA68C8 100%);
  489. display: flex;
  490. align-items: center;
  491. justify-content: center;
  492. box-shadow: 0 4rpx 16rpx rgba(156, 39, 176, 0.3);
  493. z-index: 1000;
  494. .add-button-icon {
  495. font-size: 50rpx;
  496. color: #FFFFFF;
  497. line-height: 1;
  498. font-weight: bold;
  499. }
  500. }
  501. /* 底部导航 */
  502. .tabbar {
  503. position: fixed;
  504. bottom: 0;
  505. left: 0;
  506. right: 0;
  507. height: 110rpx;
  508. background: #FFFFFF;
  509. border-top: 1rpx solid #F0F0F0;
  510. display: flex;
  511. justify-content: space-around;
  512. align-items: center;
  513. padding-bottom: env(safe-area-inset-bottom);
  514. .tabbar-item {
  515. display: flex;
  516. flex-direction: column;
  517. align-items: center;
  518. gap: 6rpx;
  519. padding: 10rpx 0;
  520. .tab-icon-wrapper {
  521. position: relative;
  522. .badge {
  523. position: absolute;
  524. top: -8rpx;
  525. right: -12rpx;
  526. background: #FF4444;
  527. color: #FFFFFF;
  528. font-size: 18rpx;
  529. font-weight: bold;
  530. min-width: 28rpx;
  531. height: 28rpx;
  532. padding: 0 6rpx;
  533. border-radius: 14rpx;
  534. display: flex;
  535. align-items: center;
  536. justify-content: center;
  537. }
  538. }
  539. .tab-icon {
  540. font-size: 36rpx;
  541. }
  542. .tab-text {
  543. font-size: 20rpx;
  544. color: #999;
  545. }
  546. &.active {
  547. .tab-text {
  548. color: #9C27B0;
  549. font-weight: bold;
  550. }
  551. }
  552. }
  553. }
  554. </style>