Search.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898
  1. <template>
  2. <view class="search-container">
  3. <!-- 搜索框 -->
  4. <view class="search-header">
  5. <view class="cancel-btn" @click="goBack">
  6. <uni-icons type="left" size="22" color="#1F1F1F"></uni-icons>
  7. </view>
  8. <view class="search-box">
  9. <!-- <uni-icons type="search" size="16" color="#999"></uni-icons> -->
  10. <input type="text" v-model="searchKeyword" placeholder="请输入关键词" confirm-type="search" @confirm="handleSearch"
  11. @input="handleInput" />
  12. <uni-icons v-if="searchKeyword" type="clear" size="16" color="#999" @click="clearKeyword"></uni-icons>
  13. <view class="searchImgBox" @click="handleSearch">
  14. <image class="image" src="@/static/home/sy_icon_sousuo.png"></image>
  15. </view>
  16. </view>
  17. </view>
  18. <view class="reserveASeat"></view>
  19. <!-- 搜索历史 -->
  20. <view class="search-history" v-if="searchStatus && historyList.length > 0">
  21. <view class="history-header">
  22. <text class="title">搜索历史</text>
  23. <image @click="clearHistory" style="width: 32rpx;height: 32rpx;" class="deleteAll" src="@/static/home/sy_icon_shanchu.png"></image>
  24. </view>
  25. <view class="history-list">
  26. <view class="history-item" v-for="(item, index) in displayedHistoryList" :key="index"
  27. @click="useHistoryKeyword(item)">
  28. <view>
  29. <uni-icons type="clock" size="14" color="#999"></uni-icons>
  30. <view class="history-text">
  31. <image src="@/static/home/sy_icon_lishijilu.png"></image> {{ item }}
  32. </view>
  33. </view>
  34. <image class="deleteBtn" @click.stop="deleteHistoryItem(item)" src="@/static/icon/close.png"></image>
  35. </view>
  36. <view class="expandBtn" @click="toggleHistory">
  37. <view v-if="!isExpanded">
  38. <template v-if="historyList.length > 5">
  39. 查看全部
  40. <image src="@/static/home/sy_icon_chakanquanbu.png"></image>
  41. </template>
  42. </view>
  43. <view v-else class="fold">
  44. 折叠历史记录
  45. <image src="@/static/home/sy_icon_chakanquanbu.png"></image>
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. <!-- 搜索结果 -->
  51. <view class="search-result" v-if="searchKeyword && !searchStatus">
  52. <!-- <view class="search-result"> -->
  53. <!-- 这里添加搜索结果的展示逻辑 -->
  54. <view>
  55. <view class="tab-nav">
  56. <view v-for="(tab, index) in ['作品', '作者']" :key="index"
  57. :class="['tab-item', currentTab === index ? 'active' : '']" @click="switchTab(index)">
  58. {{ tab }}
  59. <view class="indicator-triangle">
  60. </view>
  61. </view>
  62. </view>
  63. <!-- 关注列表 - 类似my.vue -->
  64. <view v-show="currentTab === 0" class="follow-list">
  65. <block v-if="followList.length > 0">
  66. <w-waterfall :data="followList">
  67. <template v-slot:content="{ item, width }">
  68. <card :item="formatItem(item)" findType="search" :width="width" :custom-style="{ background: '#fff' }" textColor="#999" titleTextColor="#000">
  69. </card>
  70. </template>
  71. </w-waterfall>
  72. </block>
  73. <view class="no-data" v-else-if="!isLoadingFollow">
  74. <text>暂无作品数据</text>
  75. </view>
  76. </view>
  77. <view v-show="currentTab === 1" class="follow-list" style="padding: 0 30rpx;">
  78. <block v-if="recommendList.length > 0">
  79. <view class="follow-item" v-for="(item, index) in recommendList" :key="index" @click="goToUserHomepage(item.id)">
  80. <CircleAvatar @click="goToUserHomepage(item.user_id)" class="avator" :src="item.avator"></CircleAvatar>
  81. <view class="info">
  82. <view class="top-box" @click="goToUserHomepage(item.user_id)">
  83. <view class="name one-omit">{{ item.nickname }}</view>
  84. <image src="../../static/icon/wd_icon_nan.png" mode="widthFix" v-if="item.sex_id == 1" />
  85. <image src="../../static/icon/wd_icon_nv.png" mode="widthFix" v-else-if="item.sex_id == 2" />
  86. <view class="level">Lv{{ item.level }}</view>
  87. </view>
  88. <!-- <view class="desc">{{ item.description }}</view> -->
  89. </view>
  90. <view :class="item.is_attention ? 'unfollow-btn active' : 'unfollow-btn'" @click="toggleFollow(item)">
  91. <image src="../../static/me/wd_icon_guanzhu.png"></image>
  92. {{ item.is_attention == 0 ? '取消关注' : '关注' }}
  93. </view>
  94. </view>
  95. </block>
  96. <view class="no-data" v-else-if="!isLoadingFollow">
  97. <text>暂无作者数据</text>
  98. </view>
  99. </view>
  100. <!-- avator: "http://e.yujianmate.com/images/avator/b1.jpg"
  101. is_attention: 0
  102. level: 0
  103. nickname: "刘畅"
  104. sex_id: 2 -->
  105. </view>
  106. </view>
  107. <DialogBox ref="DialogBox"></DialogBox>
  108. </view>
  109. </template>
  110. <script>
  111. const HISTORY_KEY = 'search_history';
  112. const MAX_HISTORY = 20;
  113. export default {
  114. data() {
  115. return {
  116. searchKeyword: '', // 搜索关键词
  117. historyList: [], // 搜索历史
  118. searchResult: [], // 搜索结果
  119. primaryHistoryList: [],
  120. isExpanded: false, // 添加展开/折叠状态变量
  121. currentTab: 0, // 当前激活的标签页
  122. followList: [], // 关注列表数据
  123. followOffset: 0, // 关注列表偏移量
  124. hasMoreFollow: true, // 是否有更多关注列表数据
  125. recommendList: [], // 推荐列表数据
  126. recommendOffset: 0, // 推荐列表偏移量
  127. hasMoreRecommend: true, // 是否有更多推荐列表数据
  128. isLoadingFollow: false, // 是否正在加载关注列表
  129. isLoadingRecommend: false, // 是否正在加载推荐列表
  130. searchStatus: true,//显示搜索历史 false显示搜索结果
  131. }
  132. },
  133. onLoad() {
  134. // 加载历史记录
  135. this.loadHistory();
  136. },
  137. onReachBottom() {
  138. // 触底加载更多数据
  139. if (!(hasMoreFollow || hasMoreRecommend)) {
  140. switch (this.currentTab) {
  141. case 0:
  142. this.loadFollowList();
  143. break;
  144. case 1:
  145. this.loadRecommendList();
  146. break;
  147. }
  148. } else {
  149. uni.hideToast();
  150. uni.showToast({
  151. title:'没有更多数据了',
  152. icon: 'none'
  153. });
  154. return;
  155. }
  156. },
  157. computed: {
  158. // 添加计算属性以控制显示的历史记录数量
  159. displayedHistoryList() {
  160. return this.isExpanded ? this.historyList : this.historyList.slice(0, 5);
  161. }
  162. },
  163. methods: {
  164. // 加载历史记录
  165. loadHistory() {
  166. try {
  167. const history = uni.getStorageSync(HISTORY_KEY);
  168. this.historyList = history ? JSON.parse(history) : [];
  169. } catch (e) {
  170. console.error('Failed to load search history:', e);
  171. this.historyList = [];
  172. }
  173. // this.primaryHistoryList = JSON.parse(JSON.stringify(this.historyList));
  174. },
  175. // 保存历史记录
  176. saveHistory() {
  177. try {
  178. // 将当前搜索词添加到历史记录开头
  179. if (this.searchKeyword && !this.historyList.includes(this.searchKeyword)) {
  180. console.log(this.historyList, 11111);
  181. this.historyList.unshift(this.searchKeyword);
  182. console.log(this.historyList, 11111);
  183. // 限制历史记录数量
  184. if (this.historyList.length > MAX_HISTORY) {
  185. this.historyList = this.historyList.slice(0, MAX_HISTORY);
  186. }
  187. uni.setStorageSync(HISTORY_KEY, JSON.stringify(this.historyList));
  188. }
  189. } catch (e) {
  190. console.error('Failed to save search history:', e);
  191. }
  192. },
  193. // 清空历史记录
  194. clearHistory() {
  195. this.$refs['DialogBox'].confirm({
  196. title: '提示',
  197. content: '确定要清空搜索历史吗?',
  198. DialogType: 'inquiry',
  199. btn1: '否',
  200. btn2: '是',
  201. animation: 0
  202. }).then((res) => {
  203. if (res.isConfirm) {
  204. this.historyList = [];
  205. uni.setStorageSync(HISTORY_KEY, '[]');
  206. }
  207. })
  208. },
  209. // 清空单个历史记录
  210. deleteHistoryItem(item) {
  211. console.log(item, '删除历史记录');
  212. this.$refs['DialogBox'].confirm({
  213. title: '提示',
  214. content: '确定要删除搜索历史吗?',
  215. DialogType: 'inquiry',
  216. btn1: '否',
  217. btn2: '是',
  218. animation: 0
  219. }).then((res) => {
  220. if (res.isConfirm) {
  221. const index = this.historyList.indexOf(item);
  222. if (index !== -1) {
  223. this.historyList.splice(index, 1);
  224. }
  225. uni.setStorageSync(HISTORY_KEY, JSON.stringify(this.historyList));
  226. }
  227. })
  228. },
  229. // 使用历史记录中的关键词
  230. useHistoryKeyword(keyword) {
  231. this.searchKeyword = keyword;
  232. this.handleSearch();
  233. },
  234. // 处理搜索
  235. handleSearch() {
  236. if (!this.searchKeyword.trim()) return;
  237. // 保存到历史记录
  238. this.saveHistory();
  239. this.searchStatus = false;
  240. // this.loadHistory()
  241. // TODO: 实现搜索逻辑
  242. console.log('Searching for:', this.searchKeyword);
  243. this.queryList()
  244. },
  245. // 清空搜索框
  246. clearKeyword() {
  247. this.searchKeyword = '';
  248. },
  249. // 处理输入
  250. handleInput(e) {
  251. this.searchKeyword = e.detail.value;
  252. // this.historyList = this.primaryHistoryList.filter(item => {
  253. // if (item.includes(e.detail.value)) {
  254. // return item;
  255. // }
  256. // })
  257. if (this.searchKeyword.trim() == '') {
  258. this.searchStatus = true;
  259. }
  260. console.log(this.historyList, e.detail.value);
  261. },
  262. // 返回上一页
  263. goBack() {
  264. uni.navigateBack();
  265. },
  266. // 添加展开/折叠方法
  267. toggleHistory() {
  268. this.isExpanded = !this.isExpanded;
  269. },
  270. switchTab(index) {
  271. this.currentTab = index;
  272. this.searchRequest(index);
  273. this.queryList()
  274. },
  275. formatItem(item) {
  276. this.downloadAndProcessImage(item.images)
  277. .then((color) => {
  278. console.log(`平均颜色: R=${color.r}, G=${color.g}, B=${color.b}`);
  279. })
  280. .catch((error) => {
  281. console.error("获取图像失败:", error);
  282. });
  283. // 处理接口返回的数据,使其适配card组件
  284. return {
  285. id: item.id,
  286. allowEdit: false,
  287. nickname: item.nickname,
  288. avator: item.avator,
  289. num_like: item.num_like,
  290. num_view: item.num_view,
  291. image: item.images || item.img_url || item.image, // 优先使用images字段
  292. w: item.width,
  293. h: item.height,
  294. title: item.title || "",
  295. desc: item.desc || "",
  296. backgroundColor: "#f6f6f6",
  297. };
  298. },
  299. downloadAndProcessImage(imageUrl, width = 10, height = 10) {
  300. return new Promise((resolve, reject) => {
  301. uni.downloadFile({
  302. url: imageUrl,
  303. success: (downloadResult) => {
  304. if (downloadResult.statusCode === 200) {
  305. const tempFilePath = downloadResult.tempFilePath;
  306. const ctx = uni.createCanvasContext('myCanvas', this);
  307. ctx.drawImage(tempFilePath, 0, 0, width, height);
  308. ctx.draw(false, () => {
  309. uni.canvasGetImageData({
  310. canvasId: 'myCanvas',
  311. x: 0,
  312. y: 0,
  313. width: width,
  314. height: height,
  315. success: (res) => {
  316. const data = res.data;
  317. let r = 0,
  318. g = 0,
  319. b = 0;
  320. for (let i = 0; i < data.length; i +=
  321. 4) {
  322. r += data[i];
  323. g += data[i + 1];
  324. b += data[i + 2];
  325. }
  326. const count = width * height;
  327. r = Math.floor(r / count);
  328. g = Math.floor(g / count);
  329. b = Math.floor(b / count);
  330. resolve({
  331. r,
  332. g,
  333. b
  334. });
  335. },
  336. fail: (err) => {
  337. reject(err);
  338. }
  339. });
  340. });
  341. } else {
  342. reject(new Error('下载图像失败'));
  343. }
  344. },
  345. fail: (err) => {
  346. reject(err);
  347. }
  348. });
  349. });
  350. },
  351. queryList() {
  352. // 根据当前标签刷新数据
  353. switch (this.currentTab) {
  354. case 0:
  355. // 重置作品列表
  356. this.followList = [];
  357. this.followOffset = 0;
  358. this.hasMoreFollow = true;
  359. // this.loadFollowList();
  360. this.loadFollowList();
  361. break;
  362. case 1:
  363. // 重置作者列表
  364. this.recommendList = [];
  365. this.recommendOffset = 0;
  366. this.hasMoreRecommend = true;
  367. // this.loadRecommendList();
  368. this.loadRecommendList();
  369. break;
  370. }
  371. },
  372. loadFollowList() {
  373. if (this.isLoadingFollow) return;
  374. this.isLoadingFollow = true;
  375. uni.request({
  376. url: this.$apiHost + "/Work/getlist",
  377. data: {
  378. uuid: getApp().globalData.uuid,
  379. skey: getApp().globalData.skey,
  380. offset: this.followOffset,
  381. search: this.searchKeyword,
  382. },
  383. header: {
  384. "content-type": "application/json",
  385. sign: getApp().globalData.headerSign,
  386. },
  387. success: (res) => {
  388. console.log("作品列表数据:", res.data);
  389. // 确保在任何情况下都完成加载
  390. if (
  391. res.data.success == "yes" &&
  392. res.data.list &&
  393. res.data.list.length > 0
  394. ) {
  395. // 只有当列表有数据时才追加
  396. this.followList = [...this.followList, ...res.data.list];
  397. this.followOffset += res.data.list.length;
  398. console.log(this.followOffset, "作品列表数据");
  399. if (res.data.list.length < 20) {
  400. this.hasMoreFollow = false;
  401. }
  402. } else {
  403. // 如果列表为空,确保标记没有更多数据
  404. this.hasMoreFollow = false;
  405. }
  406. // 无论是否有数据,都需要通知z-paging组件完成刷新
  407. if (this.$refs.paging) {
  408. this.$refs.paging.complete(this.followList);
  409. }
  410. },
  411. complete: () => {
  412. this.isLoadingFollow = false;
  413. },
  414. fail: (e) => {
  415. console.log("请求关注列表失败:", e);
  416. this.isLoadingFollow = false;
  417. // 加载失败时也要通知组件完成
  418. if (this.$refs.paging) {
  419. this.$refs.paging.complete(false);
  420. }
  421. },
  422. });
  423. },
  424. loadRecommendList() {
  425. console.log(this.recommendOffset, 666);
  426. if (this.isLoadingRecommend) return;
  427. this.isLoadingRecommend = true;
  428. uni.request({
  429. url: this.$apiHost + "/User/getlist",
  430. data: {
  431. uuid: getApp().globalData.uuid,
  432. skey: getApp().globalData.skey,
  433. offset: this.recommendOffset,
  434. search: this.searchKeyword,
  435. },
  436. header: {
  437. "content-type": "application/json",
  438. sign: getApp().globalData.headerSign,
  439. },
  440. success: (res) => {
  441. console.log("作者列表数据:", res.data);
  442. if (
  443. res.data.success == "yes" &&
  444. res.data.list &&
  445. res.data.list.length > 0
  446. ) {
  447. this.recommendList = [...this.recommendList, ...res.data.list];
  448. this.recommendOffset += res.data.list.length;
  449. console.log(this.recommendOffset, "作者列表数据");
  450. if (res.data.list.length < 20) {
  451. this.hasMoreRecommend = false;
  452. }
  453. } else {
  454. this.hasMoreRecommend = false;
  455. }
  456. // 无论是否有数据,都需要通知z-paging组件完成刷新
  457. if (this.$refs.paging) {
  458. this.$refs.paging.complete(this.recommendList);
  459. }
  460. },
  461. complete: () => {
  462. this.isLoadingRecommend = false;
  463. },
  464. fail: (e) => {
  465. console.log("请求推荐列表失败:", e);
  466. this.isLoadingRecommend = false;
  467. // 加载失败时也要通知组件完成
  468. if (this.$refs.paging) {
  469. this.$refs.paging.complete(false);
  470. }
  471. },
  472. });
  473. },
  474. toggleFollow(item) {
  475. uni.request({
  476. url: this.$apiHost + '/Member/attention',
  477. data: {
  478. uuid: getApp().globalData.uuid,
  479. id: item.user_id,
  480. },
  481. header: {
  482. "content-type": "application/json",
  483. 'sign': getApp().globalData.headerSign
  484. },
  485. success: (res) => {
  486. console.log("关注结果:", res.data);
  487. uni.showToast({
  488. title: res.data.str,
  489. icon: 'none'
  490. });
  491. if (res.data.success === "yes") {
  492. if (res.data.str === "关注成功") {
  493. item.is_attention = false
  494. }
  495. if (res.data.str === "取消关注") {
  496. item.is_attention = true
  497. }
  498. }
  499. },
  500. fail: (e) => {
  501. console.log("关注失败:", e);
  502. uni.showToast({
  503. title: '网络请求失败',
  504. icon: 'none'
  505. });
  506. }
  507. });
  508. // 这里可以添加调用后端API的逻辑
  509. },
  510. // 搜索请求
  511. searchRequest() {
  512. },
  513. goToUserHomepage(id) {
  514. if (!id) {
  515. return;
  516. }
  517. uni.navigateTo({
  518. url: "/pages/my/userHomepage?id=" + id,
  519. });
  520. },
  521. }
  522. }
  523. </script>
  524. <style lang="scss">
  525. .search-container {
  526. background-color: #ffffff;
  527. min-height: 100vh;
  528. width: 100%;
  529. overflow-x: hidden;
  530. position: relative;
  531. .search-header {
  532. background-color: #ffffff;
  533. padding: 16rpx 30rpx;
  534. display: flex;
  535. align-items: center;
  536. padding-top: calc(16rpx + var(--status-bar-height));
  537. padding-left: 40rpx;
  538. padding-right: 28rpx;
  539. padding-bottom: 16rpx;
  540. position: fixed;
  541. left: 0;
  542. top: 0;
  543. z-index: 9;
  544. width: 100%;
  545. box-sizing: border-box;
  546. .search-box {
  547. flex: 1;
  548. height: 72rpx;
  549. background-color: #f1f1f1;
  550. border-radius: 36rpx;
  551. display: flex;
  552. align-items: center;
  553. padding: 0 24rpx;
  554. padding-left: 14rpx;
  555. width: 622rpx;
  556. height: 72rpx;
  557. background: #FFFFFF;
  558. border-radius: 36rpx;
  559. border: 6rpx solid #000000;
  560. position: relative;
  561. left: 0;
  562. top: 0;
  563. box-sizing: border-box;
  564. max-width: calc(100% - 60rpx);
  565. input {
  566. flex: 1;
  567. height: 100%;
  568. margin: 0 16rpx;
  569. font-size: 24rpx;
  570. font-family: 'PingFang SC-Medium';
  571. width: auto;
  572. min-width: 0;
  573. }
  574. .searchImgBox {
  575. width: 88rpx;
  576. height: 56rpx;
  577. background: #1F1F1F;
  578. border-radius: 32rpx;
  579. display: flex;
  580. align-items: center;
  581. justify-content: center;
  582. position: absolute;
  583. top: 50%;
  584. right: 6rpx;
  585. transform: translateY(-50%);
  586. flex-shrink: 0;
  587. .image {
  588. width: 36rpx;
  589. height: 36rpx;
  590. }
  591. }
  592. }
  593. .cancel-btn {
  594. color: #1f1f1f;
  595. width: 36rpx;
  596. height: 100%;
  597. margin-right: 24rpx;
  598. font-weight: 700;
  599. flex-shrink: 0;
  600. }
  601. }
  602. .reserveASeat {
  603. width: 100%;
  604. height: calc(108rpx + var(--status-bar-height));
  605. }
  606. .search-history {
  607. background-color: #ffffff;
  608. padding: 30rpx;
  609. padding-top: 15rpx;
  610. width: 100%;
  611. box-sizing: border-box;
  612. .history-header {
  613. display: flex;
  614. justify-content: space-between;
  615. align-items: center;
  616. margin-bottom: 15rpx;
  617. width: 100%;
  618. box-sizing: border-box;
  619. .title {
  620. font-size: 30rpx;
  621. color: #333;
  622. font-weight: bold;
  623. }
  624. }
  625. .history-list {
  626. transition: all 1s;
  627. overflow: hidden;
  628. width: 100%;
  629. box-sizing: border-box;
  630. .history-item {
  631. display: flex;
  632. align-items: center;
  633. padding: 18rpx 0;
  634. justify-content: space-between;
  635. width: 100%;
  636. box-sizing: border-box;
  637. .history-text {
  638. font-size: 28rpx;
  639. color: #666;
  640. display: flex;
  641. align-items: center;
  642. justify-content: flex-start;
  643. font-weight: 400;
  644. color: #1F1F1F;
  645. margin-left: 6rpx;
  646. font-family: 'PingFang SC-Bold';
  647. flex: 1;
  648. overflow: hidden;
  649. min-width: 0;
  650. image {
  651. width: 32rpx;
  652. height: 32rpx;
  653. margin-right: 16rpx;
  654. flex-shrink: 0;
  655. }
  656. }
  657. .deleteBtn {
  658. width: 30rpx;
  659. height: 30rpx;
  660. flex-shrink: 0;
  661. }
  662. }
  663. }
  664. }
  665. .search-result {
  666. background-color: #ffffff;
  667. margin-top: 20rpx;
  668. min-height: 200rpx;
  669. width: 100%;
  670. box-sizing: border-box;
  671. .tab-nav {
  672. display: flex;
  673. justify-content: flex-start;
  674. padding: 20rpx 20rpx;
  675. padding-top: 0;
  676. box-sizing: border-box;
  677. background: #ffffff;
  678. width: 100%;
  679. overflow-x: hidden;
  680. .tab-item {
  681. padding: 10rpx 38rpx;
  682. color: #1F1F1F;
  683. font-size: 28rpx;
  684. background: #F2F6F2;
  685. margin-right: 20rpx;
  686. border-radius: 30rpx;
  687. position: relative;
  688. left: 0;
  689. top: 0;
  690. line-height: 1;
  691. flex-shrink: 0;
  692. white-space: nowrap;
  693. .indicator-triangle {
  694. position: absolute;
  695. bottom: -10rpx;
  696. left: 50%;
  697. transform: translateX(-50%);
  698. width: 0;
  699. height: 0;
  700. border-left: 10rpx solid transparent;
  701. border-right: 10rpx solid transparent;
  702. border-top: 10rpx solid #ACF934;
  703. display: none;
  704. }
  705. &.active {
  706. background: #ACF934;
  707. font-family: "CustomFont" !important;
  708. .indicator-triangle {
  709. display: block;
  710. }
  711. }
  712. }
  713. }
  714. .follow-list {
  715. padding: 0;
  716. width: 100%;
  717. box-sizing: border-box;
  718. .follow-item {
  719. display: flex;
  720. align-items: center;
  721. padding: 20rpx 0;
  722. width: 100%;
  723. box-sizing: border-box;
  724. .avator {
  725. width: 120rpx;
  726. height: 120rpx;
  727. margin-right: 24rpx;
  728. flex-shrink: 0;
  729. }
  730. .info {
  731. flex: 1;
  732. min-width: 0;
  733. .top-box {
  734. display: flex;
  735. align-items: center;
  736. width: 100%;
  737. box-sizing: border-box;
  738. .name {
  739. font-size: 32rpx;
  740. font-weight: 500;
  741. margin-bottom: 8rpx;
  742. max-width: 200rpx;
  743. overflow: hidden;
  744. text-overflow: ellipsis;
  745. white-space: nowrap;
  746. }
  747. >image {
  748. width: 36rpx;
  749. margin-left: 8rpx;
  750. margin-right: 10rpx;
  751. flex-shrink: 0;
  752. }
  753. .level {
  754. font-weight: 400;
  755. font-size: 20rpx;
  756. font-family: "PingFang SC-Bold";
  757. background: linear-gradient(360deg, #acf934 0%, #ffe439 100%);
  758. border-radius: 8rpx;
  759. padding: 2rpx 8rpx;
  760. display: inline-block;
  761. flex-shrink: 0;
  762. }
  763. }
  764. }
  765. .unfollow-btn {
  766. font-size: 24rpx;
  767. width: 144rpx;
  768. height: 52rpx;
  769. display: flex;
  770. justify-content: center;
  771. align-items: center;
  772. color: #1f1f1f;
  773. background: #fff;
  774. border: 2rpx solid #1f1f1f;
  775. border-radius: 112rpx;
  776. margin: 0;
  777. font-family: 'PingFang SC-Bold';
  778. flex-shrink: 0;
  779. image {
  780. display: none;
  781. width: 16rpx;
  782. height: 16rpx;
  783. margin-right: 5rpx;
  784. }
  785. &.active {
  786. color: #ACF934;
  787. background: #000;
  788. image {
  789. display: inline-block;
  790. }
  791. }
  792. }
  793. }
  794. }
  795. }
  796. .no-data {
  797. display: flex;
  798. flex-direction: column;
  799. align-items: center;
  800. justify-content: center;
  801. padding: 60rpx 0;
  802. background-color: #fff;
  803. width: 100%;
  804. box-sizing: border-box;
  805. text {
  806. color: #808080;
  807. font-size: 28rpx;
  808. }
  809. }
  810. }
  811. .expandBtn {
  812. view {
  813. font-family: 'PingFang SC-Bold';
  814. color: #999999;
  815. display: flex;
  816. align-items: center;
  817. justify-content: center;
  818. &.fold {
  819. image {
  820. transform: rotate(180deg) translateY(-2rpx);
  821. }
  822. }
  823. image {
  824. width: 28rpx;
  825. height: 28rpx;
  826. }
  827. }
  828. }
  829. </style>