index.vue 23 KB

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