index.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921
  1. <template>
  2. <view class="recommend-page">
  3. <view class="toolbar">
  4. <button size="mini" class="tool-btn refresh-btn" @click="refresh"><text class="icon">⟳</text><text>换一批</text></button>
  5. <button size="mini" class="tool-btn filter-btn" @click="openFilter"><text class="icon">🔍</text><text>筛选</text></button>
  6. </view>
  7. <!-- 推荐/匹配选项卡 -->
  8. <view class="tab-container">
  9. <view :class="['tab-item', currentTab === 'recommend' ? 'active' : '']" @click="switchToTab('recommend')">
  10. <text class="tab-icon">💕</text>
  11. <text class="tab-text">推荐</text>
  12. </view>
  13. <view :class="['tab-item', currentTab === 'match' ? 'active' : '']" @click="switchToTab('match')">
  14. <text class="tab-icon">⚡</text>
  15. <text class="tab-text">匹配</text>
  16. </view>
  17. </view>
  18. <uni-popup ref="filterPopup" type="bottom" :mask-click="true">
  19. <view class="filter-sheet">
  20. <view class="sheet-handle"></view>
  21. <view class="sheet-title">精确筛选</view>
  22. <view class="sheet-body">
  23. <view class="field">
  24. <text class="field-label">性别</text>
  25. <view class="seg">
  26. <view :class="['seg-item', query.gender===null?'active':'']" @click="setGender(null)">不限</view>
  27. <view :class="['seg-item', query.gender===1?'active':'']" @click="setGender(1)">男</view>
  28. <view :class="['seg-item', query.gender===2?'active':'']" @click="setGender(2)">女</view>
  29. </view>
  30. </view>
  31. <view class="field two">
  32. <text class="field-label">年龄</text>
  33. <input class="ipt" type="number" v-model.number="query.ageMin" placeholder="最小" />
  34. <text class="dash">-</text>
  35. <input class="ipt" type="number" v-model.number="query.ageMax" placeholder="最大" />
  36. </view>
  37. <view class="field two">
  38. <text class="field-label">身高(cm)</text>
  39. <input class="ipt" type="number" v-model.number="query.heightMin" placeholder="最小" />
  40. <text class="dash">-</text>
  41. <input class="ipt" type="number" v-model.number="query.heightMax" placeholder="最大" />
  42. </view>
  43. <view class="field">
  44. <text class="field-label">城市</text>
  45. <picker mode="selector" :range="cityList" range-key="name" @change="onCityChange">
  46. <view class="ipt full picker">{{ currentCityName || '选择城市' }}</view>
  47. </picker>
  48. <picker mode="selector" :range="areaList" range-key="name" @change="onAreaChange" v-if="areaList.length">
  49. <view class="ipt full picker">{{ currentAreaName || '选择区域' }}</view>
  50. </picker>
  51. </view>
  52. <view class="field two">
  53. <text class="field-label">学历/收入</text>
  54. <picker mode="selector" :range="educationOptions" range-key="label" @change="onEduChange">
  55. <view class="ipt picker">{{ currentEduText || '不限学历' }}</view>
  56. </picker>
  57. <picker mode="selector" :range="salaryOptions" range-key="label" @change="onSalaryChange">
  58. <view class="ipt picker">{{ currentSalaryText || '不限收入' }}</view>
  59. </picker>
  60. </view>
  61. <view class="field two">
  62. <text class="field-label">星座/生肖</text>
  63. <picker mode="selector" :range="starOptions" range-key="label" @change="onStarChange">
  64. <view class="ipt picker">{{ currentStarText || '不限星座' }}</view>
  65. </picker>
  66. <picker mode="selector" :range="animalOptions" range-key="label" @change="onAnimalChange">
  67. <view class="ipt picker">{{ currentAnimalText || '不限生肖' }}</view>
  68. </picker>
  69. </view>
  70. <view class="field">
  71. <text class="field-label">兴趣</text>
  72. <input class="ipt full" v-model="hobbyInput" placeholder="用逗号分隔,如:旅行,音乐" />
  73. </view>
  74. </view>
  75. <view class="sheet-actions">
  76. <button class="btn ghost" @click="resetFilter">重置</button>
  77. <button class="btn primary" @click="applyFilter">确定</button>
  78. </view>
  79. </view>
  80. </uni-popup>
  81. <scroll-view scroll-y class="list">
  82. <view v-if="loading" class="skeleton">加载中...</view>
  83. <view v-else>
  84. <view v-for="(u, idx) in list" :key="u.userId || idx" class="card">
  85. <image :src="u.avatarUrl || '/static/close.png'" class="avatar" mode="aspectFill" @error="onImgErr(idx)"/>
  86. <view class="main">
  87. <view class="row">
  88. <text class="name">{{ u.nickname || '-' }}</text>
  89. <text class="score-badge">{{ fmtScore(u.compatibilityScore) }}</text>
  90. </view>
  91. <view class="meta">
  92. <text>{{ fmtGender(u.gender) }}</text>
  93. <text v-if="u.height">{{ u.height }}cm</text>
  94. <text v-if="u.educationLevel">{{ fmtEdu(u.educationLevel) }}</text>
  95. <text v-if="u.salaryRange">{{ fmtSalary(u.salaryRange) }}</text>
  96. </view>
  97. <view class="tags">
  98. <text v-if="u.star" class="tag">{{ u.star }}</text>
  99. <text v-if="u.animal" class="tag">{{ u.animal }}</text>
  100. <text v-if="u.jobTitle" class="tag">{{ u.jobTitle }}</text>
  101. <text v-for="t in parseHobby(u.hobby)" :key="t" class="tag">{{ t }}</text>
  102. </view>
  103. </view>
  104. <view class="actions">
  105. <button size="mini" class="act-btn ghost" @click="dislike(idx)">不喜欢</button>
  106. <button size="mini" class="act-btn primary" @click="like(idx)">喜欢</button>
  107. </view>
  108. </view>
  109. <view v-if="!list.length" class="empty">暂无推荐</view>
  110. </view>
  111. </scroll-view>
  112. <!-- 底部导航栏 -->
  113. <view class="tabbar">
  114. <view class="tabbar-item" @click="switchTab('index')">
  115. <text class="tabbar-icon">🏠</text>
  116. <text class="tabbar-text">首页</text>
  117. </view>
  118. <view class="tabbar-item" @click="switchTab('plaza')">
  119. <text class="tabbar-icon">💕</text>
  120. <text class="tabbar-text">广场</text>
  121. </view>
  122. <view class="tabbar-item active" @click="switchTab('recommend')">
  123. <text class="tabbar-icon">👍</text>
  124. <text class="tabbar-text">推荐</text>
  125. </view>
  126. <view class="tabbar-item" @click="switchTab('message')">
  127. <text class="tabbar-icon">💬</text>
  128. <text class="tabbar-text">消息</text>
  129. <view v-if="unreadCount > 0" class="tabbar-badge">{{ unreadCount }}</view>
  130. </view>
  131. <view class="tabbar-item" @click="switchTab('mine')">
  132. <text class="tabbar-icon">👤</text>
  133. <text class="tabbar-text">我的</text>
  134. </view>
  135. </view>
  136. </view>
  137. </template>
  138. <script>
  139. import api from '@/utils/api.js'
  140. import uniPopup from '@/uni_modules/uni-popup/components/uni-popup/uni-popup.vue'
  141. export default {
  142. components: { uniPopup },
  143. data() {
  144. return {
  145. currentTab: 'recommend', // 当前选中的选项卡
  146. list: [],
  147. loading: false,
  148. oppoOnly: 1,
  149. query: { userId: null, gender: null, ageMin: null, ageMax: null, heightMin: null, heightMax: null, cityId: null, areaId: null, educationMin: null, salaryMin: null, star: null, animal: null, hobbyTags: [], limit: 20, offset: 0 },
  150. hobbyInput: '',
  151. genderOptions: [{label:'不限', value:null},{label:'男', value:1},{label:'女', value:2}],
  152. educationOptions: [
  153. {label:'不限', value:null},{label:'高中及以下', value:1},{label:'大专', value:2},{label:'本科', value:3},{label:'硕士', value:4},{label:'博士', value:5}
  154. ],
  155. salaryOptions: [
  156. {label:'不限', value:null},{label:'<5k', value:1},{label:'5-10k', value:2},{label:'10-20k', value:3},{label:'20-50k', value:4},{label:'50k+', value:5}
  157. ],
  158. starOptions: [
  159. {label:'不限', value:null},{label:'白羊座', value:'白羊座'},{label:'金牛座', value:'金牛座'},{label:'双子座', value:'双子座'},{label:'巨蟹座', value:'巨蟹座'},{label:'狮子座', value:'狮子座'},{label:'处女座', value:'处女座'},{label:'天秤座', value:'天秤座'},{label:'天蝎座', value:'天蝎座'},{label:'射手座', value:'射手座'},{label:'摩羯座', value:'摩羯座'},{label:'水瓶座', value:'水瓶座'},{label:'双鱼座', value:'双鱼座'}
  160. ],
  161. animalOptions: [
  162. {label:'不限', value:null},{label:'鼠', value:'鼠'},{label:'牛', value:'牛'},{label:'虎', value:'虎'},{label:'兔', value:'兔'},{label:'龙', value:'龙'},{label:'蛇', value:'蛇'},{label:'马', value:'马'},{label:'羊', value:'羊'},{label:'猴', value:'猴'},{label:'鸡', value:'鸡'},{label:'狗', value:'狗'},{label:'猪', value:'猪'}
  163. ],
  164. currentEduText: '', currentSalaryText: '', currentStarText: '', currentAnimalText: '',
  165. provinceList: [], cityList: [], areaList: [], currentProvinceName: '', currentCityName: '', currentAreaName: ''
  166. }
  167. },
  168. computed: {
  169. unreadCount() {
  170. return this.$store.getters.getTotalUnread || 0;
  171. }
  172. },
  173. onLoad() { this.refresh() },
  174. methods: {
  175. // 切换选项卡
  176. switchToTab(tab) {
  177. this.currentTab = tab
  178. if (tab === 'recommend') {
  179. // 保持在当前推荐页面,刷新推荐列表
  180. console.log('切换到推荐页面')
  181. this.refresh()
  182. } else if (tab === 'match') {
  183. // 跳转到匹配页面
  184. console.log('切换到在线匹配')
  185. uni.navigateTo({
  186. url: '/pages/match/index',
  187. fail: () => {
  188. uni.showToast({
  189. title: '在线匹配功能开发中...',
  190. icon: 'none'
  191. })
  192. }
  193. })
  194. }
  195. },
  196. switchTab(tab) {
  197. if (tab === 'recommend') return
  198. const tabPages = {
  199. index: '/pages/index/index',
  200. plaza: '/pages/plaza/index',
  201. message: '/pages/message/index',
  202. mine: '/pages/mine/index'
  203. }
  204. if (tabPages[tab]) {
  205. uni.redirectTo({ url: tabPages[tab] })
  206. }
  207. },
  208. async refresh() {
  209. this.loading = true
  210. try {
  211. const storedUserId = uni.getStorageSync('userId'); const userId = storedUserId ? parseInt(storedUserId) : 1
  212. // 如果没有筛选,走默认接口;有筛选,调用 search
  213. if (!this.hasFilter()) {
  214. const data = await api.recommend.getUsers({ userId, oppoOnly: this.oppoOnly, limit: 20 })
  215. const seen = new Set(); const merged = []
  216. for (const it of (data || [])) { if (!seen.has(it.userId)) { seen.add(it.userId); merged.push(it) } }
  217. this.list = merged.map(it=>({ ...it, avatarUrl: this.getSafeAvatar(it.avatarUrl) }))
  218. } else {
  219. this.query.userId = userId; this.query.limit = 20; this.query.offset = 0
  220. const payload = this.buildQueryPayload()
  221. const data = await api.recommend.search(payload)
  222. const arr = Array.isArray(data) ? data : []
  223. this.list = arr.map(it=>({ ...it, avatarUrl: this.getSafeAvatar(it.avatarUrl) }))
  224. }
  225. } catch (e) {
  226. const msg = (e && (e.message || e.msg)) ? String(e.message || e.msg) : '获取推荐失败'
  227. console.error('recommend/search error:', e)
  228. uni.showToast({ title: msg, icon: 'none' })
  229. } finally { this.loading = false }
  230. },
  231. openFilter(){ this.ensureAreaData(); this.$refs.filterPopup.open('bottom') },
  232. closeFilter(){ this.$refs.filterPopup.close() },
  233. applyFilter(){ this.$refs.filterPopup.close(); this.refresh() },
  234. hasFilter(){
  235. const q=this.query
  236. return !!(q.gender||q.ageMin||q.ageMax||q.heightMin||q.heightMax||q.cityId||q.areaId||q.educationMin||q.salaryMin||q.star||q.animal||this.hobbyInput)
  237. },
  238. genderText(v){ if(v===1)return '男'; if(v===2)return '女'; return '不限' },
  239. setGender(v){ this.query.gender=v },
  240. onEduChange(e){
  241. const item = this.educationOptions[e.detail.value];
  242. this.query.educationMin = item.value;
  243. this.currentEduText = item.label;
  244. },
  245. onSalaryChange(e){
  246. const item = this.salaryOptions[e.detail.value];
  247. this.query.salaryMin = item.value;
  248. this.currentSalaryText = item.label;
  249. },
  250. onStarChange(e){
  251. const item = this.starOptions[e.detail.value];
  252. this.query.star = item.value || null;
  253. this.currentStarText = item.label;
  254. },
  255. onAnimalChange(e){
  256. const item = this.animalOptions[e.detail.value];
  257. this.query.animal = item.value || null;
  258. this.currentAnimalText = item.label;
  259. },
  260. buildQueryPayload(){
  261. const q = { ...this.query };
  262. if (this.hobbyInput) {
  263. q.hobbyTags = this.hobbyInput.split(',').map(s=>s.trim()).filter(Boolean)
  264. } else {
  265. delete q.hobbyTags
  266. }
  267. // 清理空值/空字符串/NaN,避免后端收到无效条件
  268. Object.keys(q).forEach(k => {
  269. const v = q[k];
  270. if (v === null || v === undefined || v === '' || (typeof v === 'number' && Number.isNaN(v))) {
  271. delete q[k]
  272. }
  273. })
  274. return q
  275. },
  276. resetFilter(){
  277. this.query={...this.query, gender:null, ageMin:null, ageMax:null, heightMin:null, heightMax:null, cityId:null, areaId:null, educationMin:null, salaryMin:null, star:null, animal:null};
  278. this.hobbyInput=''; this.currentCityName=''; this.currentAreaName=''; this.currentStarText=''; this.currentAnimalText=''; this.areaList=[]
  279. },
  280. async ensureAreaData(){
  281. // 无省份,直接加载热门城市或全量城市
  282. if(!this.cityList.length){
  283. try{ this.cityList = await api.area.getCities() }catch(e){}
  284. }
  285. },
  286. async onCityChange(e){
  287. const idx = e.detail.value; const c = this.cityList[idx]
  288. this.currentCityName = c?.name || ''
  289. this.query.cityId = c?.id || null
  290. this.currentAreaName = ''
  291. this.areaList = []
  292. if(this.query.cityId){
  293. try{ this.areaList = await api.area.getAreas(this.query.cityId) }catch(err){}
  294. }
  295. },
  296. onAreaChange(e){
  297. const idx = e.detail.value; const a = this.areaList[idx]
  298. this.currentAreaName = a?.name || ''
  299. this.query.areaId = a?.id || null
  300. },
  301. getSafeAvatar(url){
  302. if(!url) return '/static/close.png'
  303. const u = String(url)
  304. if(u.includes('example.com')) return '/static/close.png'
  305. return u
  306. },
  307. fmtScore(s){ return s ? Number(s).toFixed(1) : '0.0' },
  308. fmtGender(g){ return g===1?'男':g===2?'女':'-' },
  309. fmtEdu(v){ const map={1:'高中',2:'大专',3:'本科',4:'硕士',5:'博士'}; return map[v]||'-' },
  310. fmtSalary(v){ const map={1:'<5k',2:'5-10k',3:'10-20k',4:'20-50k',5:'50k+'}; return map[v]||'-' },
  311. parseHobby(h){ try{ const arr = typeof h === 'string' ? JSON.parse(h) : h; return Array.isArray(arr)?arr.slice(0,6):[] }catch{return []} },
  312. async like(i){
  313. const u=this.list[i];
  314. if(!u) return;
  315. const uid = parseInt(uni.getStorageSync('userId')||1);
  316. // 调用 API 记录喜欢
  317. if(u.userId){
  318. try {
  319. await api.recommend.feedback({ userId: uid, targetUserId: u.userId, type: 'like' });
  320. } catch(e) {
  321. console.error('反馈失败', e);
  322. }
  323. }
  324. // 显示选择弹窗
  325. uni.showModal({
  326. title: '已喜欢 ❤️',
  327. content: `你喜欢了 ${u.nickname || '该用户'},要立即发消息吗?`,
  328. confirmText: '发消息',
  329. cancelText: '继续浏览',
  330. success: (res) => {
  331. if (res.confirm) {
  332. // 跳转到聊天页面
  333. this.openChat(u);
  334. } else {
  335. // 继续浏览,显示成功提示
  336. uni.showToast({ title:'已记录', icon:'success' });
  337. }
  338. }
  339. });
  340. },
  341. async openChat(user) {
  342. // 验证必要参数
  343. if (!user || !user.userId) {
  344. uni.showToast({
  345. title: '用户信息错误',
  346. icon: 'none'
  347. });
  348. return;
  349. }
  350. const targetUserId = parseInt(user.userId);
  351. const targetUserName = user.nickname || '用户';
  352. const targetUserAvatar = user.avatarUrl || '/static/close.png';
  353. console.log('准备打开聊天,参数:', {
  354. targetUserId,
  355. targetUserName,
  356. targetUserAvatar
  357. });
  358. // 先导入用户到腾讯云IM(防止消息发送失败)
  359. uni.showLoading({ title: '准备中...' });
  360. try {
  361. // 获取当前用户ID
  362. const currentUserId = uni.getStorageSync('userId');
  363. console.log('📥 开始导入用户到TIM...');
  364. console.log(' - 当前用户:', currentUserId);
  365. console.log(' - 目标用户:', targetUserId);
  366. // 导入当前用户
  367. await uni.request({
  368. url: 'http://localhost:1004/api/im/importUser',
  369. method: 'POST',
  370. data: {
  371. userId: String(currentUserId),
  372. nickname: '用户' + currentUserId
  373. },
  374. header: {
  375. 'Content-Type': 'application/json'
  376. }
  377. });
  378. // 导入目标用户
  379. await uni.request({
  380. url: 'http://localhost:1004/api/im/importUser',
  381. method: 'POST',
  382. data: {
  383. userId: String(targetUserId),
  384. nickname: targetUserName
  385. },
  386. header: {
  387. 'Content-Type': 'application/json'
  388. }
  389. });
  390. console.log('✅ 用户导入完成');
  391. // 等待一小段时间确保导入生效
  392. await new Promise(resolve => setTimeout(resolve, 500));
  393. uni.hideLoading();
  394. // 跳转到聊天页面
  395. uni.navigateTo({
  396. url: `/pages/message/chat?targetUserId=${targetUserId}&targetUserName=${encodeURIComponent(targetUserName)}&targetUserAvatar=${encodeURIComponent(targetUserAvatar)}`
  397. });
  398. } catch (error) {
  399. console.error('❌ 导入用户失败:', error);
  400. uni.hideLoading();
  401. // 即使导入失败也尝试打开聊天(用户可能已存在)
  402. uni.navigateTo({
  403. url: `/pages/message/chat?targetUserId=${targetUserId}&targetUserName=${encodeURIComponent(targetUserName)}&targetUserAvatar=${encodeURIComponent(targetUserAvatar)}`
  404. });
  405. }
  406. },
  407. dislike(i){ const u=this.list[i]; if(!u) return; this.list.splice(i,1); uni.showToast({ title:'已隐藏', icon:'none' });
  408. const uid = parseInt(uni.getStorageSync('userId')||1); if(u.userId){ api.recommend.feedback({ userId: uid, targetUserId: u.userId, type: 'dislike' }) } },
  409. onImgErr(idx){ this.$set(this.list[idx], 'avatarUrl', '/static/close.png') }
  410. }
  411. }
  412. </script>
  413. <style lang="scss" scoped>
  414. /* 扁平化设计风格 */
  415. .recommend-page {
  416. min-height: 100vh;
  417. background-color: #F5F5F5;
  418. padding-bottom: 120rpx;
  419. }
  420. .toolbar{
  421. display: flex;
  422. justify-content: space-between;
  423. align-items: center;
  424. padding: 16rpx 20rpx;
  425. background: #FFFFFF;
  426. border-bottom: 2rpx solid #E0E0E0;
  427. }
  428. /* 选项卡样式 - 扁平化 */
  429. .tab-container {
  430. display: flex;
  431. margin: 20rpx;
  432. background: #FFFFFF;
  433. border-radius: 8rpx;
  434. border: 2rpx solid #E0E0E0;
  435. overflow: hidden;
  436. }
  437. .tab-item {
  438. flex: 1;
  439. display: flex;
  440. align-items: center;
  441. justify-content: center;
  442. padding: 18rpx 20rpx;
  443. transition: all 0.2s ease;
  444. border-right: 2rpx solid #E0E0E0;
  445. &:last-child {
  446. border-right: none;
  447. }
  448. .tab-icon {
  449. font-size: 28rpx;
  450. margin-right: 8rpx;
  451. }
  452. .tab-text {
  453. font-size: 28rpx;
  454. font-weight: 500;
  455. }
  456. &.active {
  457. background: #FFE5F1;
  458. .tab-icon {
  459. color: #E91E63;
  460. }
  461. .tab-text {
  462. color: #E91E63;
  463. font-weight: 600;
  464. }
  465. }
  466. &:not(.active) {
  467. background: #FFFFFF;
  468. .tab-icon {
  469. color: #999;
  470. }
  471. .tab-text {
  472. color: #666;
  473. }
  474. }
  475. }
  476. .tool-text{
  477. font-size: 26rpx;
  478. color: #666;
  479. }
  480. .tool-btn{
  481. height: 64rpx;
  482. padding: 0 24rpx;
  483. border-radius: 8rpx;
  484. display: flex;
  485. align-items: center;
  486. gap: 10rpx;
  487. font-size: 26rpx;
  488. background: #FFFFFF;
  489. border: 2rpx solid #E0E0E0;
  490. color: #333;
  491. transition: all 0.2s ease;
  492. &:active {
  493. opacity: 0.8;
  494. }
  495. }
  496. .tool-btn .icon{
  497. font-size: 28rpx;
  498. }
  499. .refresh-btn{
  500. background: #FFE5F1;
  501. border-color: #E91E63;
  502. color: #E91E63;
  503. }
  504. .filter-btn{
  505. background: #FFFFFF;
  506. border-color: #E0E0E0;
  507. color: #333;
  508. }
  509. .list{
  510. height: calc(100vh - 260rpx);
  511. padding: 0 20rpx;
  512. }
  513. .skeleton{
  514. padding: 40rpx;
  515. text-align: center;
  516. color: #999;
  517. }
  518. .empty{
  519. padding: 60rpx 20rpx;
  520. text-align: center;
  521. color: #999;
  522. font-size: 26rpx;
  523. }
  524. /* 用户卡片 - 扁平化 */
  525. .card{
  526. display: flex;
  527. background: #FFFFFF;
  528. border-radius: 12rpx;
  529. padding: 20rpx;
  530. margin: 16rpx 0;
  531. border: 2rpx solid #E0E0E0;
  532. transition: all 0.2s ease;
  533. &:active {
  534. background: #F5F5F5;
  535. }
  536. }
  537. .avatar{
  538. width: 140rpx;
  539. height: 140rpx;
  540. border-radius: 12rpx;
  541. background: #F5F5F5;
  542. border: 2rpx solid #E0E0E0;
  543. }
  544. .main{
  545. flex: 1;
  546. padding: 0 16rpx;
  547. }
  548. .row{
  549. display: flex;
  550. align-items: center;
  551. justify-content: space-between;
  552. }
  553. .name{
  554. font-size: 32rpx;
  555. font-weight: 600;
  556. color: #333;
  557. }
  558. .score{
  559. font-size: 28rpx;
  560. color: #E91E63;
  561. }
  562. .score-badge{
  563. min-width: 80rpx;
  564. text-align: center;
  565. padding: 6rpx 16rpx;
  566. border-radius: 8rpx;
  567. background: #FFE5F1;
  568. color: #E91E63;
  569. font-size: 26rpx;
  570. font-weight: 600;
  571. }
  572. .meta{
  573. display: flex;
  574. gap: 16rpx;
  575. font-size: 24rpx;
  576. color: #666;
  577. margin-top: 8rpx;
  578. }
  579. .tags{
  580. display: flex;
  581. flex-wrap: wrap;
  582. gap: 10rpx;
  583. margin-top: 10rpx;
  584. }
  585. .tag{
  586. background: #F5F5F5;
  587. color: #666;
  588. padding: 6rpx 12rpx;
  589. border-radius: 6rpx;
  590. font-size: 22rpx;
  591. border: 1rpx solid #E0E0E0;
  592. }
  593. .actions{
  594. display: flex;
  595. flex-direction: column;
  596. gap: 10rpx;
  597. justify-content: center;
  598. }
  599. .act-btn{
  600. border-radius: 8rpx;
  601. padding: 0 20rpx;
  602. height: 56rpx;
  603. line-height: 56rpx;
  604. font-size: 24rpx;
  605. transition: all 0.2s ease;
  606. &:active {
  607. opacity: 0.8;
  608. }
  609. }
  610. .tabbar-badge {
  611. position: absolute;
  612. top: 8rpx;
  613. right: 25%;
  614. min-width: 36rpx;
  615. height: 36rpx;
  616. line-height: 36rpx;
  617. padding: 0 8rpx;
  618. background: #FF6B6B;
  619. color: #FFFFFF;
  620. font-size: 20rpx;
  621. font-weight: bold;
  622. border-radius: 18rpx;
  623. text-align: center;
  624. }
  625. .act-btn.ghost{
  626. background: #F5F5F5;
  627. color: #666;
  628. border: 2rpx solid #E0E0E0;
  629. }
  630. .act-btn.primary{
  631. background: #E91E63;
  632. color: #FFFFFF;
  633. border: none;
  634. }
  635. /* 底部导航栏 - 扁平化 */
  636. .tabbar {
  637. position: fixed;
  638. bottom: 0;
  639. left: 0;
  640. right: 0;
  641. display: flex;
  642. background-color: #FFFFFF;
  643. border-top: 1rpx solid #F0F0F0;
  644. padding-bottom: constant(safe-area-inset-bottom);
  645. padding-bottom: env(safe-area-inset-bottom);
  646. z-index: 999;
  647. box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.05);
  648. .tabbar-item {
  649. flex: 1;
  650. display: flex;
  651. flex-direction: column;
  652. align-items: center;
  653. justify-content: center;
  654. padding: 15rpx 0;
  655. position: relative;
  656. .tabbar-icon {
  657. font-size: 44rpx;
  658. margin-bottom: 5rpx;
  659. }
  660. .tabbar-text {
  661. font-size: 22rpx;
  662. color: #666666;
  663. }
  664. &.active {
  665. .tabbar-text {
  666. color: #E91E63;
  667. font-weight: bold;
  668. }
  669. }
  670. }
  671. }
  672. .tabbar-item {
  673. flex: 1;
  674. display: flex;
  675. flex-direction: column;
  676. align-items: center;
  677. justify-content: center;
  678. padding: 18rpx 0;
  679. transition: all 0.2s ease;
  680. &:active {
  681. background: #F5F5F5;
  682. }
  683. }
  684. .tabbar-icon {
  685. font-size: 46rpx;
  686. margin-bottom: 8rpx;
  687. }
  688. .tabbar-text {
  689. font-size: 22rpx;
  690. color: #666666;
  691. font-weight: 500;
  692. }
  693. .tabbar-item.active {
  694. background: #FFE5F1;
  695. .tabbar-text {
  696. color: #E91E63;
  697. font-weight: 700;
  698. }
  699. }
  700. /* 筛选抽屉 - 扁平化 */
  701. .filter-sheet{
  702. background: #FFFFFF;
  703. border-top-left-radius: 16rpx;
  704. border-top-right-radius: 16rpx;
  705. padding-bottom: env(safe-area-inset-bottom);
  706. border-top: 2rpx solid #E0E0E0;
  707. }
  708. .sheet-handle{
  709. width: 120rpx;
  710. height: 8rpx;
  711. background: #E0E0E0;
  712. border-radius: 4rpx;
  713. margin: 16rpx auto;
  714. }
  715. .sheet-title{
  716. text-align: center;
  717. font-size: 32rpx;
  718. font-weight: 600;
  719. color: #333;
  720. margin-bottom: 10rpx;
  721. padding: 0 28rpx;
  722. border-bottom: 2rpx solid #E0E0E0;
  723. padding-bottom: 16rpx;
  724. }
  725. .sheet-body{
  726. padding: 20rpx 28rpx;
  727. max-height: 60vh;
  728. overflow: auto;
  729. }
  730. .field{
  731. margin: 18rpx 0;
  732. }
  733. .field.two{
  734. display: flex;
  735. align-items: center;
  736. }
  737. .field-label{
  738. width: 160rpx;
  739. color: #666;
  740. font-size: 26rpx;
  741. font-weight: 500;
  742. }
  743. .ipt{
  744. flex: 1;
  745. height: 70rpx;
  746. line-height: 70rpx;
  747. background: #F5F5F5;
  748. border-radius: 8rpx;
  749. padding: 0 20rpx;
  750. margin-right: 12rpx;
  751. font-size: 26rpx;
  752. display: flex;
  753. align-items: center;
  754. border: 2rpx solid #E0E0E0;
  755. }
  756. .ipt.full{
  757. width: 100%;
  758. margin-right: 0;
  759. }
  760. .dash{
  761. color: #999;
  762. margin-right: 12rpx;
  763. }
  764. .seg{
  765. display: flex;
  766. gap: 14rpx;
  767. }
  768. .seg-item{
  769. flex: 1;
  770. text-align: center;
  771. padding: 14rpx 0;
  772. border-radius: 8rpx;
  773. background: #F5F5F5;
  774. color: #666;
  775. font-size: 26rpx;
  776. border: 2rpx solid #E0E0E0;
  777. transition: all 0.2s ease;
  778. }
  779. .seg-item.active{
  780. background: #FFE5F1;
  781. color: #E91E63;
  782. font-weight: 600;
  783. border-color: #E91E63;
  784. }
  785. .sheet-actions{
  786. display: flex;
  787. gap: 16rpx;
  788. padding: 16rpx 28rpx 28rpx;
  789. border-top: 2rpx solid #E0E0E0;
  790. }
  791. .btn{
  792. flex: 1;
  793. height: 80rpx;
  794. border-radius: 8rpx;
  795. display: flex;
  796. align-items: center;
  797. justify-content: center;
  798. font-size: 28rpx;
  799. font-weight: 600;
  800. transition: all 0.2s ease;
  801. &:active {
  802. opacity: 0.8;
  803. }
  804. }
  805. .btn.ghost{
  806. background: #F5F5F5;
  807. color: #666;
  808. border: 2rpx solid #E0E0E0;
  809. }
  810. .btn.primary{
  811. background: #E91E63;
  812. color: #FFFFFF;
  813. border: none;
  814. }
  815. .tabbar-badge {
  816. position: absolute;
  817. top: 8rpx;
  818. right: 50%;
  819. margin-right: -40rpx;
  820. min-width: 32rpx;
  821. height: 32rpx;
  822. line-height: 32rpx;
  823. padding: 0 6rpx;
  824. background-color: #FA5151;
  825. border-radius: 16rpx;
  826. font-size: 20rpx;
  827. color: #FFFFFF;
  828. text-align: center;
  829. }
  830. </style>