Search.vue 22 KB

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