Search.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907
  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 ? '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. allowEdit: false,
  296. nickname: item.nickname,
  297. avator: item.avator,
  298. num_like: item.num_like,
  299. num_view: item.num_view,
  300. image: item.images || item.img_url || item.image, // 优先使用images字段
  301. w: item.width,
  302. h: item.height,
  303. title: item.title || "",
  304. desc: item.desc || "",
  305. backgroundColor: "#f6f6f6",
  306. };
  307. },
  308. downloadAndProcessImage(imageUrl, width = 10, height = 10) {
  309. return new Promise((resolve, reject) => {
  310. uni.downloadFile({
  311. url: imageUrl,
  312. success: (downloadResult) => {
  313. if (downloadResult.statusCode === 200) {
  314. const tempFilePath = downloadResult.tempFilePath;
  315. const ctx = uni.createCanvasContext('myCanvas', this);
  316. ctx.drawImage(tempFilePath, 0, 0, width, height);
  317. ctx.draw(false, () => {
  318. uni.canvasGetImageData({
  319. canvasId: 'myCanvas',
  320. x: 0,
  321. y: 0,
  322. width: width,
  323. height: height,
  324. success: (res) => {
  325. const data = res.data;
  326. let r = 0,
  327. g = 0,
  328. b = 0;
  329. for (let i = 0; i < data.length; i +=
  330. 4) {
  331. r += data[i];
  332. g += data[i + 1];
  333. b += data[i + 2];
  334. }
  335. const count = width * height;
  336. r = Math.floor(r / count);
  337. g = Math.floor(g / count);
  338. b = Math.floor(b / count);
  339. resolve({
  340. r,
  341. g,
  342. b
  343. });
  344. },
  345. fail: (err) => {
  346. reject(err);
  347. }
  348. });
  349. });
  350. } else {
  351. reject(new Error('下载图像失败'));
  352. }
  353. },
  354. fail: (err) => {
  355. reject(err);
  356. }
  357. });
  358. });
  359. },
  360. queryList() {
  361. // 根据当前标签刷新数据
  362. switch (this.currentTab) {
  363. case 0:
  364. // 重置作品列表
  365. this.followList = [];
  366. this.followOffset = 0;
  367. this.hasMoreFollow = true;
  368. // this.loadFollowList();
  369. this.loadFollowList();
  370. break;
  371. case 1:
  372. // 重置作者列表
  373. this.recommendList = [];
  374. this.recommendOffset = 0;
  375. this.hasMoreRecommend = true;
  376. // this.loadRecommendList();
  377. this.loadRecommendList();
  378. break;
  379. }
  380. },
  381. loadFollowList() {
  382. if (this.isLoadingFollow) return;
  383. this.isLoadingFollow = true;
  384. uni.request({
  385. url: this.$apiHost + "/Article/getlist",
  386. data: {
  387. uuid: getApp().globalData.uuid,
  388. skey: getApp().globalData.skey,
  389. type: "list",
  390. offset: this.followOffset,
  391. search: this.searchKeyword,
  392. },
  393. header: {
  394. "content-type": "application/json",
  395. sign: getApp().globalData.headerSign,
  396. },
  397. success: (res) => {
  398. console.log("作品列表数据:", res.data);
  399. // 确保在任何情况下都完成加载
  400. if (
  401. res.data.success == "yes" &&
  402. res.data.list &&
  403. res.data.list.length > 0
  404. ) {
  405. // 只有当列表有数据时才追加
  406. this.followList = [...this.followList, ...res.data.list];
  407. this.followOffset += res.data.list.length;
  408. console.log(this.followOffset, "作品列表数据");
  409. if (res.data.list.length < 20) {
  410. this.hasMoreFollow = false;
  411. }
  412. } else {
  413. // 如果列表为空,确保标记没有更多数据
  414. this.hasMoreFollow = false;
  415. }
  416. // 无论是否有数据,都需要通知z-paging组件完成刷新
  417. if (this.$refs.paging) {
  418. this.$refs.paging.complete(this.followList);
  419. }
  420. },
  421. complete: () => {
  422. this.isLoadingFollow = false;
  423. },
  424. fail: (e) => {
  425. console.log("请求关注列表失败:", e);
  426. this.isLoadingFollow = false;
  427. // 加载失败时也要通知组件完成
  428. if (this.$refs.paging) {
  429. this.$refs.paging.complete(false);
  430. }
  431. },
  432. });
  433. },
  434. loadRecommendList() {
  435. console.log(this.recommendOffset, 666);
  436. if (this.isLoadingRecommend) return;
  437. this.isLoadingRecommend = true;
  438. uni.request({
  439. url: this.$apiHost + "/User/getlist",
  440. data: {
  441. uuid: getApp().globalData.uuid,
  442. skey: getApp().globalData.skey,
  443. offset: this.recommendOffset,
  444. search: this.searchKeyword,
  445. },
  446. header: {
  447. "content-type": "application/json",
  448. sign: getApp().globalData.headerSign,
  449. },
  450. success: (res) => {
  451. console.log("作者列表数据:", res.data);
  452. if (
  453. res.data.success == "yes" &&
  454. res.data.list &&
  455. res.data.list.length > 0
  456. ) {
  457. this.recommendList = [...this.recommendList, ...res.data.list];
  458. this.recommendOffset += res.data.list.length;
  459. console.log(this.recommendOffset, "作者列表数据");
  460. if (res.data.list.length < 20) {
  461. this.hasMoreRecommend = false;
  462. }
  463. } else {
  464. this.hasMoreRecommend = false;
  465. }
  466. // 无论是否有数据,都需要通知z-paging组件完成刷新
  467. if (this.$refs.paging) {
  468. this.$refs.paging.complete(this.recommendList);
  469. }
  470. },
  471. complete: () => {
  472. this.isLoadingRecommend = false;
  473. },
  474. fail: (e) => {
  475. console.log("请求推荐列表失败:", e);
  476. this.isLoadingRecommend = false;
  477. // 加载失败时也要通知组件完成
  478. if (this.$refs.paging) {
  479. this.$refs.paging.complete(false);
  480. }
  481. },
  482. });
  483. },
  484. toggleFollow(item) {
  485. uni.request({
  486. url: this.$apiHost + '/Member/attention',
  487. data: {
  488. uuid: getApp().globalData.uuid,
  489. id: item.user_id,
  490. },
  491. header: {
  492. "content-type": "application/json",
  493. 'sign': getApp().globalData.headerSign
  494. },
  495. success: (res) => {
  496. console.log("关注结果:", res.data);
  497. uni.showToast({
  498. title: res.data.str,
  499. icon: 'none'
  500. });
  501. if (res.data.success === "yes") {
  502. if (res.data.str === "关注成功") {
  503. item.is_attention = false
  504. }
  505. if (res.data.str === "取消关注") {
  506. item.is_attention = true
  507. }
  508. }
  509. },
  510. fail: (e) => {
  511. console.log("关注失败:", e);
  512. uni.showToast({
  513. title: '网络请求失败',
  514. icon: 'none'
  515. });
  516. }
  517. });
  518. // 这里可以添加调用后端API的逻辑
  519. },
  520. // 搜索请求
  521. searchRequest() {},
  522. goToUserHomepage(id) {
  523. if (!id) {
  524. return;
  525. }
  526. uni.navigateTo({
  527. url: "/pages/my/userHomepage?id=" + id,
  528. });
  529. },
  530. }
  531. }
  532. </script>
  533. <style lang="scss">
  534. .search-container {
  535. background-color: #ffffff;
  536. min-height: 100vh;
  537. width: 100%;
  538. overflow-x: hidden;
  539. position: relative;
  540. .search-header {
  541. background-color: #ffffff;
  542. padding: 16rpx 30rpx;
  543. display: flex;
  544. align-items: center;
  545. padding-top: calc(16rpx + var(--status-bar-height));
  546. padding-left: 40rpx;
  547. padding-right: 28rpx;
  548. padding-bottom: 16rpx;
  549. position: fixed;
  550. left: 0;
  551. top: 0;
  552. z-index: 9;
  553. width: 100%;
  554. box-sizing: border-box;
  555. .search-box {
  556. flex: 1;
  557. height: 72rpx;
  558. background-color: #f1f1f1;
  559. border-radius: 36rpx;
  560. display: flex;
  561. align-items: center;
  562. padding: 0 24rpx;
  563. padding-left: 14rpx;
  564. width: 622rpx;
  565. height: 72rpx;
  566. background: #FFFFFF;
  567. border-radius: 36rpx;
  568. border: 6rpx solid #000000;
  569. position: relative;
  570. left: 0;
  571. top: 0;
  572. box-sizing: border-box;
  573. max-width: calc(100% - 60rpx);
  574. input {
  575. flex: 1;
  576. height: 100%;
  577. margin: 0 16rpx;
  578. font-size: 24rpx;
  579. font-family: 'PingFang SC-Medium';
  580. width: auto;
  581. min-width: 0;
  582. }
  583. .searchImgBox {
  584. width: 88rpx;
  585. height: 56rpx;
  586. background: #1F1F1F;
  587. border-radius: 32rpx;
  588. display: flex;
  589. align-items: center;
  590. justify-content: center;
  591. position: absolute;
  592. top: 50%;
  593. right: 6rpx;
  594. transform: translateY(-50%);
  595. flex-shrink: 0;
  596. .image {
  597. width: 36rpx;
  598. height: 36rpx;
  599. }
  600. }
  601. }
  602. .cancel-btn {
  603. color: #1f1f1f;
  604. width: 36rpx;
  605. height: 100%;
  606. margin-right: 24rpx;
  607. font-weight: 700;
  608. flex-shrink: 0;
  609. }
  610. }
  611. .reserveASeat {
  612. width: 100%;
  613. height: calc(108rpx + var(--status-bar-height));
  614. }
  615. .search-history {
  616. background-color: #ffffff;
  617. padding: 30rpx;
  618. padding-top: 15rpx;
  619. width: 100%;
  620. box-sizing: border-box;
  621. .history-header {
  622. display: flex;
  623. justify-content: space-between;
  624. align-items: center;
  625. margin-bottom: 15rpx;
  626. width: 100%;
  627. box-sizing: border-box;
  628. .title {
  629. font-size: 30rpx;
  630. color: #333;
  631. font-weight: bold;
  632. }
  633. }
  634. .history-list {
  635. transition: all 1s;
  636. overflow: hidden;
  637. width: 100%;
  638. box-sizing: border-box;
  639. .history-item {
  640. display: flex;
  641. align-items: center;
  642. padding: 18rpx 0;
  643. justify-content: space-between;
  644. width: 100%;
  645. box-sizing: border-box;
  646. .history-text {
  647. font-size: 28rpx;
  648. color: #666;
  649. display: flex;
  650. align-items: center;
  651. justify-content: flex-start;
  652. font-weight: 400;
  653. color: #1F1F1F;
  654. margin-left: 6rpx;
  655. font-family: 'PingFang SC-Bold';
  656. flex: 1;
  657. overflow: hidden;
  658. min-width: 0;
  659. image {
  660. width: 32rpx;
  661. height: 32rpx;
  662. margin-right: 16rpx;
  663. flex-shrink: 0;
  664. }
  665. }
  666. .deleteBtn {
  667. width: 30rpx;
  668. height: 30rpx;
  669. flex-shrink: 0;
  670. }
  671. }
  672. }
  673. }
  674. .search-result {
  675. background-color: #ffffff;
  676. margin-top: 20rpx;
  677. min-height: 200rpx;
  678. width: 100%;
  679. box-sizing: border-box;
  680. .tab-nav {
  681. display: flex;
  682. justify-content: flex-start;
  683. padding: 20rpx 20rpx;
  684. padding-top: 0;
  685. box-sizing: border-box;
  686. background: #ffffff;
  687. width: 100%;
  688. overflow-x: hidden;
  689. .tab-item {
  690. padding: 10rpx 38rpx;
  691. color: #1F1F1F;
  692. font-size: 28rpx;
  693. background: #F2F6F2;
  694. margin-right: 20rpx;
  695. border-radius: 30rpx;
  696. position: relative;
  697. left: 0;
  698. top: 0;
  699. line-height: 1;
  700. flex-shrink: 0;
  701. white-space: nowrap;
  702. .indicator-triangle {
  703. position: absolute;
  704. bottom: -10rpx;
  705. left: 50%;
  706. transform: translateX(-50%);
  707. width: 0;
  708. height: 0;
  709. border-left: 10rpx solid transparent;
  710. border-right: 10rpx solid transparent;
  711. border-top: 10rpx solid #ACF934;
  712. display: none;
  713. }
  714. &.active {
  715. background: #ACF934;
  716. font-family: "CustomFont" !important;
  717. .indicator-triangle {
  718. display: block;
  719. }
  720. }
  721. }
  722. }
  723. .follow-list {
  724. padding: 0;
  725. width: 100%;
  726. box-sizing: border-box;
  727. .follow-item {
  728. display: flex;
  729. align-items: center;
  730. padding: 20rpx 0;
  731. width: 100%;
  732. box-sizing: border-box;
  733. .avator {
  734. width: 120rpx;
  735. height: 120rpx;
  736. margin-right: 24rpx;
  737. flex-shrink: 0;
  738. }
  739. .info {
  740. flex: 1;
  741. min-width: 0;
  742. .top-box {
  743. display: flex;
  744. align-items: center;
  745. width: 100%;
  746. box-sizing: border-box;
  747. .name {
  748. font-size: 32rpx;
  749. font-weight: 500;
  750. margin-bottom: 8rpx;
  751. max-width: 200rpx;
  752. overflow: hidden;
  753. text-overflow: ellipsis;
  754. white-space: nowrap;
  755. }
  756. >image {
  757. width: 36rpx;
  758. margin-left: 8rpx;
  759. margin-right: 10rpx;
  760. flex-shrink: 0;
  761. }
  762. .level {
  763. font-weight: 400;
  764. font-size: 20rpx;
  765. font-family: "PingFang SC-Bold";
  766. background: linear-gradient(360deg, #acf934 0%, #ffe439 100%);
  767. border-radius: 8rpx;
  768. padding: 2rpx 8rpx;
  769. display: inline-block;
  770. flex-shrink: 0;
  771. }
  772. }
  773. }
  774. .unfollow-btn {
  775. font-size: 24rpx;
  776. width: 144rpx;
  777. height: 52rpx;
  778. display: flex;
  779. justify-content: center;
  780. align-items: center;
  781. color: #1f1f1f;
  782. background: #fff;
  783. border: 2rpx solid #1f1f1f;
  784. border-radius: 112rpx;
  785. margin: 0;
  786. font-family: 'PingFang SC-Bold';
  787. flex-shrink: 0;
  788. image {
  789. display: none;
  790. width: 16rpx;
  791. height: 16rpx;
  792. margin-right: 5rpx;
  793. }
  794. &.active {
  795. color: #ACF934;
  796. background: #000;
  797. image {
  798. display: inline-block;
  799. }
  800. }
  801. }
  802. }
  803. }
  804. }
  805. .no-data {
  806. display: flex;
  807. flex-direction: column;
  808. align-items: center;
  809. justify-content: center;
  810. padding: 60rpx 0;
  811. background-color: #fff;
  812. width: 100%;
  813. box-sizing: border-box;
  814. text {
  815. color: #808080;
  816. font-size: 28rpx;
  817. }
  818. }
  819. }
  820. .expandBtn {
  821. view {
  822. font-family: 'PingFang SC-Bold';
  823. color: #999999;
  824. display: flex;
  825. align-items: center;
  826. justify-content: center;
  827. &.fold {
  828. image {
  829. transform: rotate(180deg) translateY(-2rpx);
  830. }
  831. }
  832. image {
  833. width: 28rpx;
  834. height: 28rpx;
  835. }
  836. }
  837. }
  838. </style>