my-resources.vue 49 KB

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