my-resources.vue 50 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789
  1. <template>
  2. <view class="my-resources">
  3. <view class="status-bar-placeholder" :style="{height: statusBarHeight + 'px', backgroundColor: '#FFFFFF'}"></view>
  4. <!-- 顶部导航栏 -->
  5. <view class="header">
  6. <view class="header-left" @click="goBack">
  7. <text class="back-icon">←</text>
  8. </view>
  9. <text class="header-title">我的资源</text>
  10. <view class="header-right">
  11. <text class="dropdown-arrow">▼</text>
  12. </view>
  13. </view>
  14. <!-- 搜索栏 -->
  15. <view class="search-bar">
  16. <view class="search-input-wrapper">
  17. <view class="search-icon-small"></view>
  18. <input type="text" class="search-input" placeholder="请输入姓名、手机号或标签(如:温柔)" v-model="searchKeyword" @input="handleSearch" />
  19. </view>
  20. </view>
  21. <!-- 资源/线索切换标签 -->
  22. <view class="tab-switcher">
  23. <view class="tab-item" :class="{ active: currentTab === 'resource' }" @click="switchToResource">
  24. <text class="tab-text">资源</text>
  25. <text class="tab-count">({{ registeredTotal }})</text>
  26. </view>
  27. <view class="tab-item" :class="{ active: currentTab === 'clue' }" @click="switchToClue">
  28. <text class="tab-text">线索</text>
  29. <text class="tab-count">({{ unregisteredTotal }})</text>
  30. </view>
  31. </view>
  32. <scroll-view scroll-y class="content" @scrolltolower="handleScrollToLower" :lower-threshold="50" :enable-back-to-top="true" :scroll-with-animation="true">
  33. <!-- 资源部分(已注册用户) -->
  34. <view class="resource-section" v-if="currentTab === 'resource'">
  35. <view class="section-header" v-if="registeredResources.length > 0">
  36. <text class="section-title">资源</text>
  37. <text class="section-count">({{ registeredTotal }})</text>
  38. </view>
  39. <view class="resource-list-container">
  40. <view class="resource-item" v-for="(item, index) in getRegisteredDisplayData" :key="getRegisteredItemKey(item, index)" @click="handleResourceClickSafe(item, index)">
  41. <!-- 右上角选中图标(左移) -->
  42. <view class="select-icon">✓-</view>
  43. <!-- 编辑按钮 -->
  44. <view class="edit-icon" @click.stop="handleEdit(item.id || item.resourceId || item.resource_id)">
  45. <text class="edit-text">编辑</text>
  46. </view>
  47. <view class="resource-header">
  48. <image
  49. :src="item.avatar"
  50. mode="aspectFill"
  51. class="resource-avatar"
  52. @error="handleImageErrorRegistered(index)"
  53. @load="handleImageLoadRegistered(index)"
  54. :lazy-load="true"
  55. ></image>
  56. <view class="resource-basic-info">
  57. <view class="name-gender">
  58. <text class="resource-name">{{ item.name }}</text>
  59. <text class="resource-gender gender-tag">{{ item.gender }}</text>
  60. </view>
  61. <view class="status-tag-wrapper">
  62. <text class="status-tag register-tag registered">已注册</text>
  63. <text class="status-tag match-tag" :class="{ 'matched': item.isMatch === 1, 'unmatched': item.isMatch === 0 || !item.isMatch }">
  64. {{ item.isMatch === 1 ? '已匹配' : '未匹配' }}
  65. </text>
  66. </view>
  67. </view>
  68. </view>
  69. <view class="resource-details">
  70. <view class="labels">
  71. <text class="label" v-for="(label, idx) in item.labels" :key="idx">{{ label }}</text>
  72. </view>
  73. <view class="requirement-box">
  74. <text class="requirement-label">择偶要求:</text>
  75. <text class="requirement-content">{{ item.requirement }}</text>
  76. </view>
  77. <view class="contact-box">
  78. <text class="contact-label">联系方式:</text>
  79. <text class="contact-number">{{ item.contact }}</text>
  80. <text class="copy-btn" @click.stop="handleCopyContact(item.originalPhone || item.contact)">复制</text>
  81. </view>
  82. <view class="action-buttons">
  83. <view class="delete-btn" @click.stop="handleDelete(item.id || item.resourceId || item.resource_id)">删除</view>
  84. <view class="match-btn" @click.stop="handleMatch(item.id || item.resourceId || item.resource_id)">精准匹配</view>
  85. </view>
  86. </view>
  87. <!-- 优质资源标签 -->
  88. <view class="quality-tag" v-if="item.isQuality">
  89. <text class="quality-star">★</text>
  90. <text class="quality-text">优质资源</text>
  91. </view>
  92. </view>
  93. </view>
  94. <!-- 加载更多提示 -->
  95. <view class="load-more-tip" v-if="registeredResources.length < registeredTotal && currentTab === 'resource'">
  96. <text class="load-more-text">下拉加载更多</text>
  97. </view>
  98. <!-- 没有更多数据提示 -->
  99. <view class="no-more-tip" v-if="registeredResources.length >= registeredTotal && registeredTotal > 0 && currentTab === 'resource'">
  100. <text class="no-more-text">已加载全部数据</text>
  101. </view>
  102. </view>
  103. <!-- 线索部分(未注册用户) -->
  104. <view class="resource-section" v-if="currentTab === 'clue'">
  105. <view class="section-header" v-if="unregisteredResources.length > 0">
  106. <text class="section-title">线索</text>
  107. <text class="section-count">({{ unregisteredTotal }})</text>
  108. </view>
  109. <view class="resource-list-container">
  110. <view class="resource-item" v-for="(item, index) in getUnregisteredDisplayData" :key="getUnregisteredItemKey(item, index)" @click="handleResourceClickSafe(item, index)">
  111. <!-- 右上角选中图标(左移) -->
  112. <view class="select-icon">✓-</view>
  113. <!-- 编辑按钮 -->
  114. <view class="edit-icon" @click.stop="handleEdit(item.id || item.resourceId || item.resource_id)">
  115. <text class="edit-text">编辑</text>
  116. </view>
  117. <view class="resource-header">
  118. <image
  119. :src="item.avatar"
  120. mode="aspectFill"
  121. class="resource-avatar"
  122. @error="handleImageErrorUnregistered(index)"
  123. @load="handleImageLoadUnregistered(index)"
  124. :lazy-load="true"
  125. ></image>
  126. <view class="resource-basic-info">
  127. <view class="name-gender">
  128. <text class="resource-name">{{ item.name }}</text>
  129. <text class="resource-gender gender-tag">{{ item.gender }}</text>
  130. </view>
  131. <view class="status-tag-wrapper">
  132. <text class="status-tag register-tag unregistered">未注册</text>
  133. <!-- 审核状态标签(仅线索列表显示) -->
  134. <text class="status-tag audit-tag" :class="{ 'audit-pending': item.status === 0 || item.status === null || item.status === undefined, 'audit-approved': item.status === 1, 'audit-rejected': item.status === 2 }">
  135. {{ item.status === 0 || item.status === null || item.status === undefined ? '待审核' : (item.status === 1 ? '审核通过' : (item.status === 2 ? '审核未通过' : '待审核')) }}
  136. </text>
  137. </view>
  138. </view>
  139. </view>
  140. <view class="resource-details">
  141. <view class="labels">
  142. <text class="label" v-for="(label, idx) in item.labels" :key="idx">{{ label }}</text>
  143. </view>
  144. <!-- 未审核通过原因 -->
  145. <view class="reject-reason" v-if="item.status === 2 && item.rejectReason">
  146. <text class="reject-reason-text">审核未通过原因:{{ item.rejectReason }}</text>
  147. </view>
  148. <view class="requirement-box">
  149. <text class="requirement-label">择偶要求:</text>
  150. <text class="requirement-content">{{ item.requirement }}</text>
  151. </view>
  152. <view class="contact-box">
  153. <text class="contact-label">联系方式:</text>
  154. <text class="contact-number">{{ item.contact }}</text>
  155. <text class="copy-btn" @click.stop="handleCopyContact(item.originalPhone || item.contact)">复制</text>
  156. </view>
  157. <view class="action-buttons">
  158. <view class="delete-btn" @click.stop="handleDelete(item.id || item.resourceId || item.resource_id)">删除</view>
  159. <view class="match-btn" @click.stop="handleMatch(item.id || item.resourceId || item.resource_id)">精准匹配</view>
  160. </view>
  161. </view>
  162. <!-- 优质资源标签 -->
  163. <view class="quality-tag" v-if="item.isQuality">
  164. <text class="quality-star">★</text>
  165. <text class="quality-text">优质资源</text>
  166. </view>
  167. </view>
  168. </view>
  169. <!-- 加载更多提示 -->
  170. <view class="load-more-tip" v-if="unregisteredResources.length < unregisteredTotal && currentTab === 'clue'">
  171. <text class="load-more-text">下拉加载更多</text>
  172. </view>
  173. <!-- 没有更多数据提示 -->
  174. <view class="no-more-tip" v-if="unregisteredResources.length >= unregisteredTotal && unregisteredTotal > 0 && currentTab === 'clue'">
  175. <text class="no-more-text">已加载全部数据</text>
  176. </view>
  177. </view>
  178. <!-- 空状态 -->
  179. <view class="empty-state" v-if="(currentTab === 'resource' && registeredTotal === 0 && registeredResources.length === 0) || (currentTab === 'clue' && unregisteredTotal === 0 && unregisteredResources.length === 0)">
  180. <text class="empty-text">{{ currentTab === 'resource' ? '暂无资源' : '暂无线索' }}</text>
  181. </view>
  182. </scroll-view>
  183. <!-- 底部添加按钮 -->
  184. <view class="add-button" @click="handleAdd">
  185. <text class="add-button-icon">+</text>
  186. </view>
  187. <!-- 底部导航 -->
  188. <view class="tabbar">
  189. <view class="tabbar-item home" @click="navigateToWorkbench">
  190. <view class="tabbar-icon"></view>
  191. <text class="tabbar-text">工作台</text>
  192. </view>
  193. <view class="tabbar-item resources active" @click="navigateToMyResources">
  194. <view class="tabbar-icon"></view>
  195. <text class="tabbar-text">我的资源</text>
  196. </view>
  197. <view class="tabbar-item trophy" @click="navigateToRanking">
  198. <view class="tabbar-icon"></view>
  199. <text class="tabbar-text">排行榜</text>
  200. </view>
  201. <!-- <view class="tabbar-item message" @click="navigateToMessage">
  202. <view class="tabbar-icon">
  203. <view v-if="unreadCount > 0" class="badge">{{ unreadCount }}</view>
  204. </view>
  205. <text class="tabbar-text">消息</text>
  206. </view> -->
  207. <view class="tabbar-item mine" @click="navigateToMine">
  208. <view class="tabbar-icon"></view>
  209. <text class="tabbar-text">我的</text>
  210. </view>
  211. </view>
  212. </view>
  213. </template>
  214. <script>
  215. import api from '@/utils/api.js'
  216. export default {
  217. data() {
  218. return {
  219. statusBarHeight: 0,
  220. searchKeyword: '',
  221. isFirstLoad: true, // 标记是否为首次加载
  222. currentTab: 'resource', // 当前选中的标签:'resource' 或 'clue'
  223. resources: [], // 保留用于兼容
  224. registeredResources: [], // 已注册用户(资源部分)- 已加载的数据
  225. unregisteredResources: [], // 未注册用户(线索部分)- 已加载的数据
  226. allRegisteredResources: [], // 已注册用户(资源部分)- 全部数据(从后端获取)
  227. allUnregisteredResources: [], // 未注册用户(线索部分)- 全部数据(从后端获取)
  228. refreshTimer: null, // 定时刷新器
  229. // 资源分页
  230. registeredPageNum: 1, // 资源当前页码
  231. registeredPageSize: 3, // 资源每页显示数量
  232. registeredTotal: 0, // 资源总数
  233. registeredLoading: false, // 资源加载中标志
  234. // 线索分页
  235. unregisteredPageNum: 1, // 线索当前页码
  236. unregisteredPageSize: 3, // 线索每页显示数量
  237. unregisteredTotal: 0, // 线索总数
  238. unregisteredLoading: false // 线索加载中标志
  239. }
  240. },
  241. computed: {
  242. // 全局未读消息数
  243. unreadCount() {
  244. return this.$store.getters.getTotalUnread || 0
  245. },
  246. // 获取资源已加载的数据(用于显示)
  247. getRegisteredDisplayData() {
  248. const data = (this.registeredResources || []).filter(item => {
  249. const isValid = item && item.id !== undefined && item.id !== null
  250. if (!isValid) {
  251. }
  252. return isValid
  253. })
  254. return data
  255. },
  256. // 获取线索已加载的数据(用于显示)
  257. getUnregisteredDisplayData() {
  258. const data = (this.unregisteredResources || []).filter(item => {
  259. const isValid = item && item.id !== undefined && item.id !== null
  260. return isValid
  261. })
  262. return data
  263. }
  264. },
  265. onLoad() {
  266. // 加载我的资源数据
  267. this.loadMyResources()
  268. this.isFirstLoad = false
  269. // 监听刷新事件
  270. uni.$on('refreshResourceList', () => {
  271. this.loadMyResources()
  272. })
  273. // 启动定时刷新,每30秒检查一次用户注册状态变化
  274. this.startAutoRefresh()
  275. //获取状态栏高度
  276. const systemInfo = uni.getSystemInfoSync()
  277. this.statusBarHeight = systemInfo.statusBarHeight
  278. },
  279. onShow() {
  280. // 页面显示时刷新列表(从其他页面返回时,非首次加载)
  281. if (!this.isFirstLoad) {
  282. this.loadMyResources()
  283. }
  284. // 重新启动定时刷新
  285. this.startAutoRefresh()
  286. },
  287. onHide() {
  288. // 页面隐藏时停止定时刷新
  289. this.stopAutoRefresh()
  290. },
  291. onUnload() {
  292. // 页面卸载时移除事件监听和停止定时刷新
  293. uni.$off('refreshResourceList')
  294. this.stopAutoRefresh()
  295. },
  296. methods: {
  297. //返回上一页
  298. goBack() {
  299. uni.navigateBack({
  300. delta: 1 // 返回上一级页面
  301. })
  302. },
  303. // 获取审核状态文本
  304. getAuditStatusText(status) {
  305. if (status === null || status === undefined) {
  306. return '待审核'
  307. }
  308. switch (status) {
  309. case 0:
  310. return '待审核'
  311. case 1:
  312. return '审核通过'
  313. case 2:
  314. return '审核未通过'
  315. default:
  316. return '待审核'
  317. }
  318. },
  319. // 获取审核状态样式类(返回对象,用于:class绑定)
  320. getAuditStatusClass(status) {
  321. if (status === null || status === undefined) {
  322. return { 'audit-pending': true }
  323. }
  324. switch (status) {
  325. case 0:
  326. return { 'audit-pending': true }
  327. case 1:
  328. return { 'audit-approved': true }
  329. case 2:
  330. return { 'audit-rejected': true }
  331. default:
  332. return { 'audit-pending': true }
  333. }
  334. },
  335. // 获取资源项的key
  336. getRegisteredItemKey(item, index) {
  337. if (item && item.id) {
  338. return 'registered-' + item.id
  339. }
  340. return 'registered-placeholder-' + index
  341. },
  342. // 获取线索项的key
  343. getUnregisteredItemKey(item, index) {
  344. if (item && item.id) {
  345. return 'unregistered-' + item.id
  346. }
  347. return 'unregistered-placeholder-' + index
  348. },
  349. // 切换到资源标签
  350. switchToResource() {
  351. this.currentTab = 'resource'
  352. // 切换标签时重置已加载数据
  353. this.registeredPageNum = 1
  354. this.loadRegisteredPage(1)
  355. },
  356. // 切换到线索标签
  357. switchToClue() {
  358. this.currentTab = 'clue'
  359. // 切换标签时重置已加载数据
  360. this.unregisteredPageNum = 1
  361. this.loadUnregisteredPage(1)
  362. },
  363. // 滚动到底部触发加载更多
  364. handleScrollToLower(e) {
  365. if (this.currentTab === 'resource') {
  366. // 资源列表加载更多
  367. if (!this.registeredLoading) {
  368. // 如果已加载数量小于总数,继续加载
  369. if (this.registeredTotal > 0 && this.registeredResources.length < this.registeredTotal) {
  370. this.loadMoreRegistered()
  371. } else if (this.registeredTotal === 0) {
  372. this.loadMoreRegistered()
  373. }
  374. }
  375. } else {
  376. if (!this.unregisteredLoading) {
  377. // 如果已加载数量小于总数,继续加载
  378. if (this.unregisteredTotal > 0 && this.unregisteredResources.length < this.unregisteredTotal) {
  379. this.loadMoreUnregistered()
  380. } else if (this.unregisteredTotal === 0) {
  381. this.loadMoreUnregistered()
  382. }
  383. }
  384. }
  385. },
  386. // 加载资源指定页数据(从后端加载,使用isUser参数过滤已注册用户)
  387. async loadRegisteredPage(pageNum) {
  388. if (this.registeredLoading) return
  389. this.registeredLoading = true
  390. this.registeredPageNum = pageNum
  391. try {
  392. // 获取当前登录用户ID
  393. const userInfo = uni.getStorageSync('userInfo') || {}
  394. const userId = uni.getStorageSync('userId')
  395. let currentUserId = userInfo.userId || userId || null
  396. if (currentUserId !== null && currentUserId !== undefined) {
  397. currentUserId = parseInt(currentUserId)
  398. if (isNaN(currentUserId) || currentUserId <= 0) {
  399. currentUserId = null
  400. }
  401. }
  402. if (!currentUserId) {
  403. this.registeredResources = []
  404. this.registeredLoading = false
  405. return
  406. }
  407. const baseUrl = 'https://api.zhongruanke.cn/api'
  408. // 构建查询参数,使用isUser=1参数只获取已注册用户
  409. let url = `${baseUrl}/my-resource/list?currentUserId=${currentUserId}&pageNum=${pageNum}&pageSize=${this.registeredPageSize}&isUser=1`
  410. if (this.searchKeyword && this.searchKeyword.trim()) {
  411. url += `&keyword=${encodeURIComponent(this.searchKeyword.trim())}`
  412. }
  413. const [error, res] = await uni.request({
  414. url: url,
  415. method: 'GET'
  416. })
  417. if (error) {
  418. this.registeredResources = []
  419. this.registeredLoading = false
  420. return
  421. }
  422. if (res.statusCode === 200 && res.data && res.data.code === 200) {
  423. const pageData = res.data.data
  424. if (pageData && pageData.records) {
  425. // 转换数据格式,并过滤掉无效数据(null值)
  426. const resources = this.convertResourceData(pageData.records).filter(item => item !== null && item !== undefined)
  427. // 如果是第一页,直接替换;否则追加
  428. if (pageNum === 1) {
  429. this.registeredResources = resources
  430. } else {
  431. this.registeredResources = [...this.registeredResources, ...resources]
  432. }
  433. // 更新总数(使用后端返回的total)
  434. this.registeredTotal = pageData.total || 0
  435. } else {
  436. if (pageNum === 1) {
  437. this.registeredResources = []
  438. this.registeredTotal = 0
  439. }
  440. }
  441. } else {
  442. }
  443. } catch (e) {
  444. if (this.registeredPageNum === 1) {
  445. this.registeredResources = []
  446. }
  447. } finally {
  448. this.registeredLoading = false
  449. }
  450. },
  451. // 加载线索指定页数据(从后端加载,使用isUser参数过滤未注册用户)
  452. async loadUnregisteredPage(pageNum) {
  453. if (this.unregisteredLoading) {
  454. return
  455. }
  456. this.unregisteredLoading = true
  457. this.unregisteredPageNum = pageNum
  458. try {
  459. // 获取当前登录用户ID
  460. const userInfo = uni.getStorageSync('userInfo') || {}
  461. const userId = uni.getStorageSync('userId')
  462. let currentUserId = userInfo.userId || userId || null
  463. if (currentUserId !== null && currentUserId !== undefined) {
  464. currentUserId = parseInt(currentUserId)
  465. if (isNaN(currentUserId) || currentUserId <= 0) {
  466. currentUserId = null
  467. }
  468. }
  469. if (!currentUserId) {
  470. this.unregisteredResources = []
  471. this.unregisteredLoading = false
  472. return
  473. }
  474. const baseUrl = 'https://api.zhongruanke.cn/api'
  475. // 构建查询参数,使用isUser=0参数只获取未注册用户(线索)
  476. let url = `${baseUrl}/my-resource/list?currentUserId=${currentUserId}&pageNum=${pageNum}&pageSize=${this.unregisteredPageSize}&isUser=0`
  477. if (this.searchKeyword && this.searchKeyword.trim()) {
  478. url += `&keyword=${encodeURIComponent(this.searchKeyword.trim())}`
  479. }
  480. const [error, res] = await uni.request({
  481. url: url,
  482. method: 'GET'
  483. })
  484. if (error) {
  485. this.unregisteredResources = []
  486. this.unregisteredLoading = false
  487. return
  488. }
  489. if (res.statusCode === 200 && res.data && res.data.code === 200) {
  490. const pageData = res.data.data
  491. if (pageData && pageData.records) {
  492. // 转换数据格式,并过滤掉无效数据(null值)
  493. const resources = this.convertResourceData(pageData.records).filter(item => item !== null && item !== undefined)
  494. // 如果是第一页,直接替换;否则追加
  495. if (pageNum === 1) {
  496. this.unregisteredResources = resources
  497. } else {
  498. this.unregisteredResources = [...this.unregisteredResources, ...resources]
  499. }
  500. // 更新总数(使用后端返回的total)
  501. this.unregisteredTotal = pageData.total || 0
  502. } else {
  503. if (pageNum === 1) {
  504. this.unregisteredResources = []
  505. this.unregisteredTotal = 0
  506. }
  507. }
  508. }
  509. } catch (e) {
  510. if (this.unregisteredPageNum === 1) {
  511. this.unregisteredResources = []
  512. }
  513. } finally {
  514. this.unregisteredLoading = false
  515. }
  516. },
  517. // 加载更多资源(从后端分页加载)
  518. async loadMoreRegistered() {
  519. if (this.registeredLoading) return
  520. // 如果已加载的数据已经达到或超过估算的总数,不再加载
  521. if (this.registeredResources.length >= this.registeredTotal && this.registeredTotal > 0) return
  522. this.registeredPageNum++
  523. await this.loadRegisteredPage(this.registeredPageNum)
  524. },
  525. // 加载更多线索(从后端分页加载)
  526. async loadMoreUnregistered() {
  527. if (this.unregisteredLoading) return
  528. // 如果已加载的数据已经达到或超过估算的总数,不再加载
  529. if (this.unregisteredResources.length >= this.unregisteredTotal && this.unregisteredTotal > 0) return
  530. this.unregisteredPageNum++
  531. await this.loadUnregisteredPage(this.unregisteredPageNum)
  532. },
  533. // 转换资源数据格式(提取公共方法)
  534. convertResourceData(records) {
  535. return records.map(item => {
  536. let requirement = item.mateSelectionCriteria || item.mate_selection_criteria || ''
  537. if (requirement) {
  538. requirement = requirement.trim()
  539. }
  540. const labels = []
  541. if (item.constellation) {
  542. labels.push(item.constellation)
  543. }
  544. if (item.occupation) {
  545. labels.push(item.occupation)
  546. }
  547. let avatarUrl = item.avatarUrl || item.avatar_url || item.avatar || ''
  548. if (!avatarUrl || avatarUrl.trim() === '' || avatarUrl === 'null' || avatarUrl === null || avatarUrl === undefined) {
  549. avatarUrl = ''
  550. } else {
  551. avatarUrl = avatarUrl.trim()
  552. }
  553. let resourceId = item.resourceId || item.resource_id
  554. if (resourceId === null || resourceId === undefined || resourceId === 'undefined' || resourceId === 'null') {
  555. return null
  556. }
  557. resourceId = parseInt(resourceId)
  558. if (isNaN(resourceId) || resourceId <= 0) {
  559. return null
  560. }
  561. let isUser = item.isUser !== null && item.isUser !== undefined ? item.isUser :
  562. (item.is_user !== null && item.is_user !== undefined ? item.is_user : 0)
  563. isUser = parseInt(isUser) || 0
  564. let userId = item.userId !== null && item.userId !== undefined ? item.userId :
  565. (item.user_id !== null && item.user_id !== undefined ? item.user_id : null)
  566. if (userId !== null && userId !== undefined) {
  567. userId = parseInt(userId)
  568. if (isNaN(userId) || userId <= 0) {
  569. userId = null
  570. }
  571. }
  572. let isMatch = item.isMatch !== null && item.isMatch !== undefined ? item.isMatch :
  573. (item.is_match !== null && item.is_match !== undefined ? item.is_match : 0)
  574. isMatch = parseInt(isMatch) || 0
  575. let resourceTags = []
  576. if (item.tags && Array.isArray(item.tags) && item.tags.length > 0) {
  577. resourceTags = item.tags
  578. } else if (labels && labels.length > 0) {
  579. resourceTags = labels
  580. }
  581. return {
  582. id: resourceId,
  583. resourceId: resourceId,
  584. resource_id: resourceId,
  585. avatar: avatarUrl,
  586. name: item.name || '',
  587. gender: item.gender === 1 ? '男' : item.gender === 2 ? '女' : '未知',
  588. status: item.status !== undefined && item.status !== null ? item.status : 0,
  589. rejectReason: item.rejectReason || item.reject_reason || '',
  590. isUser: isUser,
  591. userId: userId,
  592. isMatch: isMatch,
  593. isPlus: false,
  594. labels: resourceTags,
  595. requirement: requirement || '暂无要求',
  596. contact: item.phone ? item.phone.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2') : '',
  597. originalPhone: item.phone || '',
  598. isQuality: false
  599. }
  600. }).filter(item => item !== null)
  601. },
  602. // 加载我的资源数据(改为分页加载)
  603. async loadMyResources() {
  604. try {
  605. // 重置分页
  606. this.registeredPageNum = 1
  607. this.unregisteredPageNum = 1
  608. // 同时加载资源和线索,进入页面即可两端都查询完毕
  609. await Promise.all([
  610. this.loadRegisteredPage(1),
  611. this.loadUnregisteredPage(1)
  612. ])
  613. } catch (e) {
  614. }
  615. },
  616. // 搜索
  617. async handleSearch() {
  618. // 重置分页到第一页
  619. this.registeredPageNum = 1
  620. this.unregisteredPageNum = 1
  621. // 重新加载资源数据,包含搜索关键词
  622. await this.loadMyResources()
  623. },
  624. // 删除资源
  625. async handleDelete(id) {
  626. // 如果id无效,尝试从当前资源列表中查找
  627. if (id === null || id === undefined || id === 'undefined' || id === 'null' || id === '') {
  628. // 尝试从当前显示的资源中找到对应的资源
  629. const allDisplayData = this.currentTab === 'resource'
  630. ? this.getRegisteredDisplayData
  631. : this.getUnregisteredDisplayData
  632. // 如果仍然找不到,显示错误
  633. uni.showToast({
  634. title: '资源ID无效,无法删除',
  635. icon: 'none'
  636. })
  637. return
  638. }
  639. // 确保id是有效的整数
  640. let resourceId = parseInt(id)
  641. if (isNaN(resourceId) || resourceId <= 0) {
  642. // 如果解析失败,尝试从字符串中提取数字
  643. const match = String(id).match(/\d+/)
  644. if (match) {
  645. resourceId = parseInt(match[0])
  646. }
  647. if (isNaN(resourceId) || resourceId <= 0) {
  648. uni.showToast({
  649. title: '资源ID格式错误,无法删除',
  650. icon: 'none'
  651. })
  652. return
  653. }
  654. }
  655. uni.showModal({
  656. title: '删除确认',
  657. content: '确定要删除该资源吗?',
  658. success: async (res) => {
  659. if (res.confirm) {
  660. try {
  661. uni.showLoading({
  662. title: '删除中...'
  663. })
  664. const baseUrl = 'https://api.zhongruanke.cn/api'
  665. const [error, deleteRes] = await uni.request({
  666. url: `${baseUrl}/my-resource/delete/${resourceId}`,
  667. method: 'DELETE'
  668. })
  669. uni.hideLoading()
  670. if (error) {
  671. uni.showToast({
  672. title: '删除失败',
  673. icon: 'none'
  674. })
  675. return
  676. }
  677. if (deleteRes.statusCode === 200 && deleteRes.data && deleteRes.data.code === 200) {
  678. uni.showToast({
  679. title: '删除成功',
  680. icon: 'success'
  681. })
  682. // 删除成功后刷新资源列表
  683. await this.loadMyResources()
  684. } else {
  685. uni.showToast({
  686. title: deleteRes.data.message || '删除失败',
  687. icon: 'none'
  688. })
  689. }
  690. } catch (e) {
  691. uni.hideLoading()
  692. uni.showToast({
  693. title: '删除失败,请稍后重试',
  694. icon: 'none'
  695. })
  696. }
  697. }
  698. }
  699. })
  700. },
  701. // 精准匹配
  702. // 编辑资源
  703. handleEdit(id) {
  704. // 跳转到资源录入页面(编辑模式),传递资源ID
  705. uni.navigateTo({
  706. url: `/pages/matchmaker-workbench/resource-input?resourceId=${id}`,
  707. success: () => {
  708. },
  709. fail: (err) => {
  710. uni.showToast({
  711. title: '跳转失败',
  712. icon: 'none'
  713. })
  714. }
  715. })
  716. },
  717. handleMatch(id) {
  718. // 查找资源项
  719. const allResources = [...this.registeredResources, ...this.unregisteredResources]
  720. const resource = allResources.find(item => item.id === id)
  721. if (!resource) {
  722. uni.showToast({
  723. title: '资源不存在',
  724. icon: 'none'
  725. })
  726. return
  727. }
  728. // 检查用户是否已注册(isUser === 1 且 userId !== null)
  729. if (resource.isUser !== 1 || resource.userId === null || resource.userId === undefined) {
  730. uni.showToast({
  731. title: '该用户还未注册用户端,注册之后才能进行匹配',
  732. icon: 'none',
  733. duration: 3000
  734. })
  735. return
  736. }
  737. // 已注册用户,跳转到精准匹配页面
  738. uni.navigateTo({
  739. url: `/pages/matchmaker-workbench/precise-match?resourceId=${id}`
  740. })
  741. },
  742. // 复制联系方式
  743. handleCopyContact(contact) {
  744. if (!contact) {
  745. uni.showToast({
  746. title: '联系方式为空',
  747. icon: 'none'
  748. })
  749. return
  750. }
  751. // 如果是脱敏的手机号,需要从原始数据中获取完整号码
  752. // 这里需要根据实际情况调整,可能需要从item中获取原始phone
  753. // 暂时先复制显示的文本
  754. uni.setClipboardData({
  755. data: contact,
  756. success: () => {
  757. uni.showToast({
  758. title: '已复制到剪贴板',
  759. icon: 'success'
  760. })
  761. },
  762. fail: () => {
  763. uni.showToast({
  764. title: '复制失败',
  765. icon: 'none'
  766. })
  767. }
  768. })
  769. },
  770. // 客户点击事件,跳转到客户详情页面
  771. handleClientClick(id) {
  772. uni.navigateTo({
  773. url: `/pages/matchmaker-workbench/client-detail?resourceId=${id}`
  774. })
  775. },
  776. // 资源项点击事件(安全包装方法)
  777. handleResourceClickSafe(item, index) {
  778. // 如果 item 无效,尝试从数组中获取
  779. if (!item || item === null || item === undefined) {
  780. const dataArray = this.currentTab === 'resource' ? this.getRegisteredDisplayData : this.getUnregisteredDisplayData
  781. if (dataArray && Array.isArray(dataArray) && index >= 0 && index < dataArray.length) {
  782. item = dataArray[index]
  783. }
  784. }
  785. // 如果仍然无效,直接返回
  786. if (!item || item === null || item === undefined) {
  787. return
  788. }
  789. // 调用实际的点击处理方法
  790. this.handleResourceClick(item)
  791. },
  792. // 资源项点击事件
  793. handleResourceClick(item) {
  794. // 检查 item 是否存在
  795. if (!item || item === null || item === undefined) {
  796. return
  797. }
  798. // 检查 item.id 是否存在
  799. if (!item.id && item.id !== 0) {
  800. uni.showToast({
  801. title: '资源ID无效',
  802. icon: 'none',
  803. duration: 2000
  804. })
  805. return
  806. }
  807. // 判断是否为已注册用户(isUser === 1 且 userId !== null)
  808. if (item.isUser === 1 && item.userId !== null && item.userId !== undefined) {
  809. // 已注册,跳转到客户详情页面
  810. const resourceId = item.id
  811. uni.navigateTo({
  812. url: `/pages/matchmaker-workbench/client-detail?resourceId=${resourceId}`,
  813. success: () => {
  814. },
  815. fail: (err) => {
  816. uni.showToast({
  817. title: '跳转失败,请重试',
  818. icon: 'none'
  819. })
  820. }
  821. })
  822. } else {
  823. // 未注册,提示用户
  824. uni.showToast({
  825. title: '该用户还未注册用户端',
  826. icon: 'none',
  827. duration: 2000
  828. })
  829. }
  830. },
  831. // 添加资源
  832. handleAdd() {
  833. // 跳转到信息录入页面
  834. uni.navigateTo({
  835. url: '/pages/matchmaker-workbench/resource-input',
  836. success: () => {
  837. },
  838. fail: (err) => {
  839. uni.showToast({
  840. title: '页面跳转失败',
  841. icon: 'none'
  842. })
  843. }
  844. })
  845. },
  846. // 导航到工作台
  847. navigateToWorkbench() {
  848. uni.navigateTo({
  849. url: '/pages/matchmaker-workbench/index'
  850. })
  851. },
  852. // 导航到我的资源
  853. navigateToMyResources() {
  854. // 已在我的资源页面,无需跳转
  855. },
  856. // 导航到排行榜
  857. navigateToRanking() {
  858. uni.navigateTo({
  859. url: '/pages/matchmaker-workbench/ranking'
  860. })
  861. },
  862. // 导航到消息
  863. navigateToMessage() {
  864. uni.navigateTo({
  865. url: '/pages/matchmaker-workbench/message'
  866. })
  867. },
  868. // 导航到我的
  869. navigateToMine() {
  870. uni.navigateTo({
  871. url: '/pages/matchmaker-workbench/mine'
  872. })
  873. },
  874. // 启动自动刷新
  875. startAutoRefresh() {
  876. // 清除之前的定时器
  877. this.stopAutoRefresh()
  878. // 每30秒刷新一次,检查用户注册状态变化
  879. this.refreshTimer = setInterval(async () => {
  880. // 先批量检查并更新线索用户的注册状态
  881. await this.batchCheckClueRegistrationStatus()
  882. // 然后刷新资源列表
  883. await this.loadMyResources()
  884. }, 30000) // 30秒
  885. },
  886. // 批量检查并更新线索用户的注册状态
  887. async batchCheckClueRegistrationStatus() {
  888. try {
  889. // 获取红娘ID,优先使用userInfo中的matchmakerId,否则使用userId
  890. const userInfo = uni.getStorageSync('userInfo') || {}
  891. const userId = uni.getStorageSync('userId')
  892. let matchmakerId = userInfo.matchmakerId || userId || null
  893. if (!matchmakerId) {
  894. return
  895. }
  896. // 确保matchmakerId是有效的整数
  897. matchmakerId = parseInt(matchmakerId)
  898. if (isNaN(matchmakerId) || matchmakerId <= 0) {
  899. return
  900. }
  901. const baseUrl = 'https://api.zhongruanke.cn/api'
  902. const [error, res] = await uni.request({
  903. url: `${baseUrl}/my-resource/batch-check-clue-registration`,
  904. method: 'POST',
  905. data: {
  906. matchmakerId: matchmakerId
  907. }
  908. })
  909. if (error) {
  910. return
  911. }
  912. if (res.statusCode === 200 && res.data && res.data.code === 200) {
  913. const updateCount = res.data.data?.updateCount || 0
  914. }
  915. } catch (e) {
  916. }
  917. },
  918. // 停止自动刷新
  919. stopAutoRefresh() {
  920. if (this.refreshTimer) {
  921. clearInterval(this.refreshTimer)
  922. this.refreshTimer = null
  923. }
  924. },
  925. // 已注册资源图片加载错误处理
  926. handleImageErrorRegistered(index) {
  927. this.handleImageError(index, 'registered')
  928. },
  929. // 未注册资源图片加载错误处理
  930. handleImageErrorUnregistered(index) {
  931. this.handleImageError(index, 'unregistered')
  932. },
  933. // 已注册资源图片加载成功处理
  934. handleImageLoadRegistered(index) {
  935. this.handleImageLoad(index, 'registered')
  936. },
  937. // 未注册资源图片加载成功处理
  938. handleImageLoadUnregistered(index) {
  939. this.handleImageLoad(index, 'unregistered')
  940. },
  941. // 图片加载错误处理(内部方法)
  942. handleImageError(index, type) {
  943. try {
  944. // 获取当前显示的数据
  945. const displayData = type === 'registered' ? this.getRegisteredDisplayData : this.getUnregisteredDisplayData
  946. const resource = displayData && displayData[index]
  947. if (!resource) {
  948. return
  949. }
  950. const originalUrl = resource.avatar
  951. const resourceId = resource.id
  952. if (originalUrl &&
  953. originalUrl.trim() !== '' &&
  954. !originalUrl.includes('placeholder') &&
  955. !originalUrl.includes('default') &&
  956. !originalUrl.includes('via.placeholder')) {
  957. if (type === 'registered') {
  958. const displayListIndex = this.registeredResources.findIndex(item => item.id === resourceId)
  959. if (displayListIndex !== -1) {
  960. this.$set(this.registeredResources[displayListIndex], 'avatar', '')
  961. }
  962. } else {
  963. const displayListIndex = this.unregisteredResources.findIndex(item => item.id === resourceId)
  964. if (displayListIndex !== -1) {
  965. this.$set(this.unregisteredResources[displayListIndex], 'avatar', '')
  966. }
  967. }
  968. }
  969. } catch (e) {
  970. }
  971. },
  972. // 图片加载成功处理(内部方法)
  973. handleImageLoad(index, type) {
  974. try {
  975. // 获取当前显示的数据
  976. const displayData = type === 'registered' ? this.getRegisteredDisplayData : this.getUnregisteredDisplayData
  977. if (displayData && displayData[index]) {
  978. }
  979. } catch (e) {
  980. }
  981. }
  982. }
  983. }
  984. </script>
  985. <style lang="scss" scoped>
  986. .my-resources {
  987. min-height: 100vh;
  988. background: #F5F5F5;
  989. display: flex;
  990. flex-direction: column;
  991. }
  992. /* 顶部导航栏 */
  993. .header {
  994. display: flex;
  995. align-items: center;
  996. justify-content: space-between;
  997. padding: 20rpx 30rpx;
  998. // padding-top: calc(20rpx + env(safe-area-inset-top));
  999. background: #FFFFFF;
  1000. border-bottom: 1rpx solid #F0F0F0;
  1001. .header-left {
  1002. width: 40rpx; // 固定宽度,避免挤压标题
  1003. }
  1004. // 新增:返回按钮样式
  1005. .back-icon {
  1006. font-size: 36rpx;
  1007. color: #9C27B0; // 和标题颜色统一
  1008. font-weight: bold;
  1009. }
  1010. .header-title {
  1011. font-size: 36rpx;
  1012. font-weight: bold;
  1013. color: #9C27B0;
  1014. flex: 1; // 让标题占中间剩余空间,实现居中
  1015. text-align: center;
  1016. }
  1017. .header-right {
  1018. .dropdown-arrow {
  1019. font-size: 24rpx;
  1020. color: #9C27B0;
  1021. font-weight: normal;
  1022. }
  1023. }
  1024. }
  1025. /* 资源/线索切换标签 */
  1026. .tab-switcher {
  1027. display: flex;
  1028. align-items: center;
  1029. background: #FFFFFF;
  1030. border-bottom: 1rpx solid #F0F0F0;
  1031. padding: 0 30rpx;
  1032. .tab-item {
  1033. flex: 1;
  1034. display: flex;
  1035. align-items: center;
  1036. justify-content: center;
  1037. padding: 25rpx 0;
  1038. position: relative;
  1039. cursor: pointer;
  1040. transition: all 0.3s;
  1041. .tab-text {
  1042. font-size: 32rpx;
  1043. font-weight: 500;
  1044. color: #666;
  1045. margin-right: 8rpx;
  1046. }
  1047. .tab-count {
  1048. font-size: 26rpx;
  1049. color: #999;
  1050. }
  1051. &.active {
  1052. .tab-text {
  1053. color: #9C27B0;
  1054. font-weight: bold;
  1055. }
  1056. .tab-count {
  1057. color: #9C27B0;
  1058. }
  1059. &::after {
  1060. content: '';
  1061. position: absolute;
  1062. bottom: 0;
  1063. left: 0;
  1064. right: 0;
  1065. height: 4rpx;
  1066. background: linear-gradient(135deg, #9C27B0 0%, #BA68C8 100%);
  1067. border-radius: 2rpx 2rpx 0 0;
  1068. }
  1069. }
  1070. &:active {
  1071. opacity: 0.7;
  1072. }
  1073. }
  1074. }
  1075. /* 搜索栏 */
  1076. .search-bar {
  1077. padding: 20rpx;
  1078. background: #F5F5F5;
  1079. .search-input-wrapper {
  1080. display: flex;
  1081. align-items: center;
  1082. background: #FFFFFF;
  1083. border-radius: 30rpx;
  1084. padding: 12rpx 20rpx;
  1085. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.03);
  1086. .search-icon-small {
  1087. width: 32rpx;
  1088. height: 32rpx;
  1089. 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>');
  1090. background-size: contain;
  1091. background-repeat: no-repeat;
  1092. background-position: center;
  1093. margin-right: 15rpx;
  1094. }
  1095. .search-input {
  1096. flex: 1;
  1097. font-size: 28rpx;
  1098. color: #333;
  1099. border: none;
  1100. outline: none;
  1101. background: transparent;
  1102. &::placeholder {
  1103. color: #999;
  1104. }
  1105. }
  1106. }
  1107. }
  1108. .content {
  1109. flex: 1;
  1110. height: 0; /* 配合 flex: 1 使用,确保 scroll-view 有明确高度 */
  1111. padding: 0 20rpx 140rpx;
  1112. box-sizing: border-box;
  1113. }
  1114. /* 资源分组 */
  1115. .resource-section {
  1116. margin-bottom: 30rpx;
  1117. min-height: calc(50vh - 100rpx); /* 确保至少占半屏高度 */
  1118. display: flex;
  1119. flex-direction: column;
  1120. .section-header {
  1121. display: flex;
  1122. align-items: center;
  1123. padding: 20rpx 0 15rpx;
  1124. margin-bottom: 10rpx;
  1125. flex-shrink: 0;
  1126. .section-title {
  1127. font-size: 32rpx;
  1128. font-weight: bold;
  1129. color: #9C27B0;
  1130. margin-right: 10rpx;
  1131. }
  1132. .section-count {
  1133. font-size: 26rpx;
  1134. color: #999;
  1135. font-weight: normal;
  1136. }
  1137. }
  1138. /* 资源列表容器,确保有固定高度 */
  1139. .resource-list-container {
  1140. flex: 1;
  1141. display: flex;
  1142. flex-direction: column;
  1143. min-height: calc(50vh - 200rpx);
  1144. }
  1145. }
  1146. /* 加载更多提示 */
  1147. .load-more-tip {
  1148. display: flex;
  1149. justify-content: center;
  1150. align-items: center;
  1151. padding: 30rpx 0;
  1152. .load-more-text {
  1153. font-size: 26rpx;
  1154. color: #999;
  1155. }
  1156. }
  1157. /* 没有更多数据提示 */
  1158. .no-more-tip {
  1159. display: flex;
  1160. justify-content: center;
  1161. align-items: center;
  1162. padding: 30rpx 0;
  1163. .no-more-text {
  1164. font-size: 26rpx;
  1165. color: #999;
  1166. }
  1167. }
  1168. /* 空状态 */
  1169. .empty-state {
  1170. display: flex;
  1171. justify-content: center;
  1172. align-items: center;
  1173. padding: 100rpx 0;
  1174. .empty-text {
  1175. font-size: 28rpx;
  1176. color: #999;
  1177. }
  1178. }
  1179. /* 资源列表 */
  1180. .resource-item {
  1181. background: #FFFFFF;
  1182. border-radius: 20rpx;
  1183. margin-bottom: 20rpx;
  1184. padding: 25rpx;
  1185. position: relative;
  1186. box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
  1187. /* 右上角选中图标 */
  1188. .select-icon {
  1189. position: absolute;
  1190. top: 20rpx;
  1191. right: 120rpx; /* 左移,为编辑按钮留出空间 */
  1192. width: 40rpx;
  1193. height: 40rpx;
  1194. background: #FF4444;
  1195. color: #FFFFFF;
  1196. border-radius: 50%;
  1197. display: flex;
  1198. align-items: center;
  1199. justify-content: center;
  1200. font-size: 24rpx;
  1201. font-weight: bold;
  1202. z-index: 10;
  1203. }
  1204. .edit-icon {
  1205. position: absolute;
  1206. top: 20rpx;
  1207. right: 20rpx;
  1208. padding: 8rpx 20rpx;
  1209. background: linear-gradient(135deg, #9C27B0 0%, #BA68C8 100%);
  1210. border-radius: 20rpx;
  1211. display: flex;
  1212. align-items: center;
  1213. justify-content: center;
  1214. z-index: 10;
  1215. box-shadow: 0 2rpx 8rpx rgba(156, 39, 176, 0.3);
  1216. .edit-text {
  1217. color: #FFFFFF;
  1218. font-size: 24rpx;
  1219. font-weight: 500;
  1220. }
  1221. }
  1222. .resource-header {
  1223. display: flex;
  1224. align-items: flex-start;
  1225. margin-bottom: 20rpx;
  1226. padding-right: 50rpx;
  1227. .resource-avatar {
  1228. width: 100rpx;
  1229. height: 100rpx;
  1230. border-radius: 8rpx;
  1231. margin-right: 20rpx;
  1232. flex-shrink: 0;
  1233. background-color: #F5F5F5;
  1234. background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23CCCCCC"><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>');
  1235. background-size: 60% 60%;
  1236. background-position: center;
  1237. background-repeat: no-repeat;
  1238. }
  1239. .resource-basic-info {
  1240. flex: 1;
  1241. min-width: 0;
  1242. .name-gender {
  1243. display: flex;
  1244. align-items: center;
  1245. gap: 10rpx;
  1246. margin-bottom: 12rpx;
  1247. .resource-name {
  1248. font-size: 30rpx;
  1249. font-weight: bold;
  1250. color: #333;
  1251. }
  1252. .resource-gender {
  1253. font-size: 26rpx;
  1254. color: #666;
  1255. &.gender-tag {
  1256. display: inline-block;
  1257. padding: 4rpx 12rpx;
  1258. background: #F3E5F5;
  1259. color: #9C27B0;
  1260. border-radius: 12rpx;
  1261. font-size: 22rpx;
  1262. font-weight: 500;
  1263. }
  1264. }
  1265. }
  1266. .status-tag-wrapper {
  1267. display: flex;
  1268. align-items: center;
  1269. .status-tag {
  1270. display: inline-block;
  1271. padding: 4rpx 12rpx;
  1272. border-radius: 12rpx;
  1273. font-size: 22rpx;
  1274. font-weight: 500;
  1275. margin-right: 8rpx;
  1276. &.approved {
  1277. background: #E3F2FD;
  1278. color: #2196F3;
  1279. }
  1280. &.pending {
  1281. background: #FFF3E0;
  1282. color: #FF9800;
  1283. }
  1284. &.register-tag {
  1285. &.registered {
  1286. background: #E8F5E9;
  1287. color: #4CAF50;
  1288. }
  1289. &.unregistered {
  1290. background: #FCE4EC;
  1291. color: #E91E63;
  1292. }
  1293. }
  1294. &.match-tag {
  1295. margin-left: 10rpx;
  1296. &.matched {
  1297. background: #E3F2FD;
  1298. color: #2196F3;
  1299. }
  1300. &.unmatched {
  1301. background: #FFF3E0;
  1302. color: #FF9800;
  1303. }
  1304. }
  1305. /* 审核状态标签样式 */
  1306. &.audit-tag {
  1307. margin-left: 10rpx;
  1308. /* 待审核 - 橙色/黄色 */
  1309. &.audit-pending {
  1310. background: #FFF3E0;
  1311. color: #FF9800;
  1312. border: 1rpx solid #FFB74D;
  1313. }
  1314. /* 审核通过 - 绿色 */
  1315. &.audit-approved {
  1316. background: #E8F5E9;
  1317. color: #4CAF50;
  1318. border: 1rpx solid #81C784;
  1319. }
  1320. /* 审核未通过 - 红色 */
  1321. &.audit-rejected {
  1322. background: #FFEBEE;
  1323. color: #F44336;
  1324. border: 1rpx solid #E57373;
  1325. }
  1326. }
  1327. }
  1328. }
  1329. }
  1330. }
  1331. .resource-details {
  1332. .labels {
  1333. display: flex;
  1334. flex-wrap: wrap;
  1335. gap: 10rpx;
  1336. margin-bottom: 15rpx;
  1337. .label {
  1338. display: inline-block;
  1339. padding: 6rpx 14rpx;
  1340. background: #F3E5F5;
  1341. color: #9C27B0;
  1342. border-radius: 15rpx;
  1343. font-size: 22rpx;
  1344. font-weight: 500;
  1345. }
  1346. }
  1347. .requirement-box {
  1348. background: #F3E5F5;
  1349. border-radius: 12rpx;
  1350. padding: 16rpx 20rpx;
  1351. margin-bottom: 15rpx;
  1352. display: flex;
  1353. align-items: center;
  1354. flex-wrap: wrap;
  1355. .requirement-label {
  1356. font-size: 28rpx;
  1357. color: #7B1FA2;
  1358. font-weight: 500;
  1359. margin-right: 8rpx;
  1360. white-space: nowrap;
  1361. }
  1362. .requirement-content {
  1363. font-size: 28rpx;
  1364. color: #7B1FA2;
  1365. font-weight: 400;
  1366. }
  1367. }
  1368. .contact-box {
  1369. margin-bottom: 20rpx;
  1370. display: flex;
  1371. align-items: center;
  1372. flex-wrap: wrap;
  1373. .contact-label {
  1374. font-size: 26rpx;
  1375. color: #333;
  1376. font-weight: 500;
  1377. margin-right: 10rpx;
  1378. white-space: nowrap;
  1379. }
  1380. .contact-number {
  1381. flex: 1;
  1382. font-size: 26rpx;
  1383. color: #333;
  1384. font-weight: 400;
  1385. min-width: 0;
  1386. }
  1387. .copy-btn {
  1388. font-size: 24rpx;
  1389. color: #9C27B0;
  1390. font-weight: 500;
  1391. margin-left: 15rpx;
  1392. white-space: nowrap;
  1393. cursor: pointer;
  1394. }
  1395. }
  1396. .action-buttons {
  1397. display: flex;
  1398. justify-content: space-between;
  1399. align-items: center;
  1400. gap: 15rpx;
  1401. .delete-btn {
  1402. flex: 1;
  1403. padding: 14rpx 0;
  1404. background: #FFEBEE;
  1405. color: #E91E63;
  1406. border-radius: 25rpx;
  1407. font-size: 26rpx;
  1408. font-weight: 500;
  1409. text-align: center;
  1410. }
  1411. .match-btn {
  1412. flex: 1.5;
  1413. padding: 14rpx 0;
  1414. background: linear-gradient(135deg, #9C27B0 0%, #BA68C8 100%);
  1415. color: #FFFFFF;
  1416. border-radius: 25rpx;
  1417. font-size: 26rpx;
  1418. font-weight: 500;
  1419. text-align: center;
  1420. }
  1421. }
  1422. }
  1423. /* 优质资源标签 */
  1424. .quality-tag {
  1425. position: absolute;
  1426. top: 80rpx;
  1427. right: 20rpx;
  1428. background: linear-gradient(135deg, #9C27B0 0%, #BA68C8 100%);
  1429. color: #FFFFFF;
  1430. font-size: 22rpx;
  1431. font-weight: bold;
  1432. padding: 8rpx 16rpx;
  1433. border-radius: 20rpx;
  1434. display: flex;
  1435. align-items: center;
  1436. gap: 4rpx;
  1437. box-shadow: 0 2rpx 8rpx rgba(156, 39, 176, 0.3);
  1438. z-index: 5;
  1439. .quality-star {
  1440. font-size: 20rpx;
  1441. }
  1442. .quality-text {
  1443. font-size: 22rpx;
  1444. }
  1445. }
  1446. }
  1447. /* 审核未通过原因 */
  1448. .reject-reason {
  1449. margin-top: 12rpx;
  1450. padding: 14rpx 16rpx;
  1451. background: #FFF3E0;
  1452. border: 1rpx solid #FFCC80;
  1453. border-radius: 10rpx;
  1454. color: #E65100;
  1455. font-size: 24rpx;
  1456. line-height: 1.5;
  1457. }
  1458. /* 添加按钮 */
  1459. .add-button {
  1460. position: fixed;
  1461. bottom: 200rpx;
  1462. right: 40rpx;
  1463. width: 100rpx;
  1464. height: 100rpx;
  1465. border-radius: 50%;
  1466. background: linear-gradient(135deg, #9C27B0 0%, #BA68C8 100%);
  1467. display: flex;
  1468. align-items: center;
  1469. justify-content: center;
  1470. box-shadow: 0 4rpx 20rpx rgba(156, 39, 176, 0.4);
  1471. z-index: 999;
  1472. .add-button-icon {
  1473. font-size: 60rpx;
  1474. color: #FFFFFF;
  1475. line-height: 1;
  1476. font-weight: bold;
  1477. }
  1478. }
  1479. /* 底部导航 */
  1480. .tabbar {
  1481. position: fixed;
  1482. bottom: 0;
  1483. left: 0;
  1484. right: 0;
  1485. height: 100rpx;
  1486. background: #FFFFFF;
  1487. border-top: 1rpx solid #F0F0F0;
  1488. display: flex;
  1489. justify-content: space-around;
  1490. align-items: center;
  1491. padding-bottom: env(safe-area-inset-bottom);
  1492. .tabbar-item {
  1493. display: flex;
  1494. flex-direction: column;
  1495. align-items: center;
  1496. gap: 8rpx;
  1497. padding: 10rpx 0;
  1498. .tabbar-icon {
  1499. width: 44rpx;
  1500. height: 44rpx;
  1501. background-size: contain;
  1502. background-repeat: no-repeat;
  1503. background-position: center;
  1504. position: relative;
  1505. .badge {
  1506. position: absolute;
  1507. top: -8rpx;
  1508. right: -8rpx;
  1509. background: #FF4444;
  1510. color: #FFFFFF;
  1511. font-size: 20rpx;
  1512. font-weight: bold;
  1513. width: 32rpx;
  1514. height: 32rpx;
  1515. display: flex;
  1516. align-items: center;
  1517. justify-content: center;
  1518. border-radius: 16rpx;
  1519. }
  1520. }
  1521. .tabbar-text {
  1522. font-size: 20rpx;
  1523. color: #999;
  1524. }
  1525. &.active {
  1526. .tabbar-text {
  1527. color: #9C27B0;
  1528. font-weight: bold;
  1529. }
  1530. }
  1531. &.home .tabbar-icon {
  1532. 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="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"/></svg>');
  1533. }
  1534. &.active.home .tabbar-icon {
  1535. 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>');
  1536. }
  1537. &.resources .tabbar-icon {
  1538. 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>');
  1539. }
  1540. &.active.resources .tabbar-icon {
  1541. 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>');
  1542. }
  1543. &.trophy .tabbar-icon {
  1544. 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 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>');
  1545. }
  1546. &.active.trophy .tabbar-icon {
  1547. 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="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>');
  1548. }
  1549. &.message .tabbar-icon {
  1550. 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>');
  1551. }
  1552. &.active.message .tabbar-icon {
  1553. 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>');
  1554. }
  1555. &.mine .tabbar-icon {
  1556. 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>');
  1557. }
  1558. &.active.mine .tabbar-icon {
  1559. 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>');
  1560. }
  1561. }
  1562. }
  1563. </style>