index.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930
  1. <template>
  2. <view class="sell-container">
  3. <!-- 顶部背景图 -->
  4. <image class="top-bg-image" src="/pages-sell/static/top-bg.png" mode="widthFix"></image>
  5. <!-- 导航栏 -->
  6. <view class="custom-navbar" :style="{ paddingTop: statusBarHeight + 'px' }">
  7. <view class="navbar-content">
  8. <text class="navbar-title">书嗨</text>
  9. <!-- 右侧胶囊占位,保持布局平衡 -->
  10. <view class="nav-right-placeholder"></view>
  11. </view>
  12. </view>
  13. <!-- 主要内容区域 -->
  14. <view class="main-content" :style="{ paddingTop: (statusBarHeight + 44) + 'px' }">
  15. <!-- 顶部固定区域:导航栏背景和搜索框 -->
  16. <view class="fixed-header-area" :style="{
  17. paddingTop: statusBarHeight + 44 + 'px',
  18. backgroundImage: scrollTop > 0 ? 'url(/pages-sell/static/top-bg.png)' : 'none',
  19. backgroundPosition: `center top`
  20. }">
  21. <view class="search-wrapper" @click="navigateTo('/pages-sell/pages/search')">
  22. <view class="search-box-uview">
  23. <u-search placeholder="搜索关键字" :show-action="false" bg-color="transparent" height="40"
  24. :clearabled="true" v-model="keyword" :disabled="true"
  25. search-icon="/pages-sell/static/search-icon.png"></u-search>
  26. <view class="search-btn-overlay">
  27. <text>搜索</text>
  28. </view>
  29. </view>
  30. </view>
  31. <!-- 热搜词横向滚动区域 -->
  32. <view class="hot-search-wrapper" v-if="hotSearchList.length > 0">
  33. <view class="hot-search-fixed-title">
  34. <view class="hot-tag hot-tag-highlight" @click="navigateTo('/pages-sell/pages/search')">热搜</view>
  35. </view>
  36. <scroll-view class="hot-search-scroll" scroll-x="true" :show-scrollbar="false">
  37. <view class="hot-search-list">
  38. <view
  39. class="hot-tag"
  40. v-for="(item, index) in hotSearchList"
  41. :key="index"
  42. @click="goSearchResult(item)"
  43. >
  44. {{ item }}
  45. </view>
  46. </view>
  47. </scroll-view>
  48. </view>
  49. </view>
  50. <!-- 占位,防止内容被 fixed 区域遮挡 -->
  51. <view class="search-placeholder"></view>
  52. <!-- 顶部横幅 Banner -->
  53. <view class="top-banner-wrapper">
  54. <image src="/pages-sell/static/top-banner.png" class="top-banner-img" mode="widthFix"></image>
  55. </view>
  56. <!-- 金刚区分类图标 (2行5列) -->
  57. <view class="category-grid">
  58. <view class="grid-item" v-for="(item, index) in categoryList" :key="index"
  59. @click="handleCategory(item)">
  60. <view class="icon-circle">
  61. <image :src="item.imgUrl" class="cat-icon" mode="aspectFit"></image>
  62. </view>
  63. <text class="cat-name">{{ item.showCateName || '-' }}</text>
  64. </view>
  65. </view>
  66. <!-- 推广与热销双卡片 -->
  67. <view class="promo-dual-card">
  68. <!-- 左侧:推广卖书 -->
  69. <view class="card-left">
  70. <view class="card-content">
  71. <u-swiper :list="swiperList" :autoplay="true" :interval="3000" name="imgUrl"></u-swiper>
  72. </view>
  73. </view>
  74. <!-- 右侧:热销商品 -->
  75. <view class="card-right">
  76. <view class="right-header" @click="navigateTo('/pages-sell/pages/hot-sell')">
  77. <image src="/pages-sell/static/icon-fire.png" class="fire-icon" mode="widthFix"></image>
  78. <text class="right-title">热销商品</text>
  79. <image src="/pages-sell/static/icon-fire.png" class="fire-icon flip" mode="widthFix"></image>
  80. </view>
  81. <view class="products-container">
  82. <!-- 使用网络图片作为书的封面占位 -->
  83. <image v-for="(item, index) in bookList" :key="index" :src="item.imgUrl" class="product-cover"
  84. mode="aspectFill" @click="navigateTo(item.jumpUrl)"></image>
  85. </view>
  86. </view>
  87. </view>
  88. <!-- 健康与成长双卡片 -->
  89. <view class="info-dual-card">
  90. <swiper class="info-card-swiper" :autoplay="true" :interval="3000" :circular="true">
  91. <swiper-item v-for="(item, index) in leftBookList" :key="index">
  92. <view class="info-card bg-orange" @click="navigateTo(item.jumpUrl)">
  93. <view class="info-text-group">
  94. <text class="info-title text-orange">{{ item.showCateName }}</text>
  95. <text class="info-desc text-orange-light">{{ item.remark }}</text>
  96. </view>
  97. <image :src="item.imgUrl" class="info-icon" mode="aspectFit"
  98. style="width: 125rpx;height: 111rpx;"></image>
  99. </view>
  100. </swiper-item>
  101. </swiper>
  102. <swiper class="info-card-swiper" :autoplay="true" :interval="3500" :circular="true">
  103. <swiper-item v-for="(item, index) in rightBookList" :key="index">
  104. <view class="info-card bg-green" @click="navigateTo(item.jumpUrl)">
  105. <view class="info-text-group">
  106. <text class="info-title text-green">{{ item.showCateName }}</text>
  107. <text class="info-desc text-green-light">{{ item.remark }}</text>
  108. </view>
  109. <image :src="item.imgUrl" class="info-icon" mode="aspectFit"></image>
  110. </view>
  111. </swiper-item>
  112. </swiper>
  113. </view>
  114. <!-- 公众号横幅 -->
  115. <view class="gzh-section" @click="navigateToOfficialAccount">
  116. <view class="gzh-bg-wrapper">
  117. <image src="/pages-sell/static/gzh-banner.png" class="gzh-img-bg" mode="aspectFill"></image>
  118. <view class="gzh-content-overlay">
  119. <text class="gzh-title">关注公众号 ,定期领红包</text>
  120. <view class="gzh-subtitle-pill">
  121. <text class="gzh-subtitle">别让好书蒙尘 ,书嗨陪你逐页品读</text>
  122. </view>
  123. </view>
  124. </view>
  125. </view>
  126. <!-- 书嗨推荐 -->
  127. <view class="recommend-section" @click="navigateTo(item.jumpUrl)" v-for="(item, index) in topicList"
  128. :key="index">
  129. <view class="section-header">
  130. <text class="section-title">{{ item.showCateName }}</text>
  131. <view class="view-more">
  132. <text>查看全部</text>
  133. <image src="/pages-sell/static/right-arrow.png" class="arrow-icon" mode="widthFix"></image>
  134. </view>
  135. </view>
  136. <view class="book-list">
  137. <view class="book-item" v-for="(book, index) in getDisplayBooks(item)" :key="index"
  138. @click.stop="navigateTo('/pages-sell/pages/detail?isbn=' + book.bookIsbn)">
  139. <image :src="book.bookImg" class="book-image" mode="aspectFill"></image>
  140. <text class="book-name">{{ book.bookName }}</text>
  141. <view class="price-row">
  142. <text class="currency">¥</text>
  143. <text class="price-val">{{ book.bookPrice }}</text>
  144. <text class="price-old">¥{{ book.bookOriginalPrice }}</text>
  145. </view>
  146. <view class="add-btn">
  147. <text>加入购物车</text>
  148. <image src="/pages-sell/static/shape-10.png" class="cart-symbol"></image>
  149. </view>
  150. </view>
  151. </view>
  152. </view>
  153. <!-- 底部留白,防止遮挡 -->
  154. <view class="bottom-safe-area"></view>
  155. </view>
  156. <!-- 分享红包悬浮按钮 -->
  157. <FloatingDrag :width="126" :height="140" :initial-position="redPacketPosition"
  158. @position-change="handleRedPacketPositionChange" v-if="shareList.length > 0">
  159. <button class="red-packet-btn" @click="navigateToRedPacket">
  160. <image src="/packet/static/index/btn_share.png" mode="widthFix" style="width: 126rpx; height: 140rpx">
  161. </image>
  162. </button>
  163. </FloatingDrag>
  164. </view>
  165. </template>
  166. <script>
  167. import FloatingDrag from "@/components/floating-drag.vue";
  168. export default {
  169. name: 'SellContainer',
  170. components: {
  171. FloatingDrag
  172. },
  173. data() {
  174. return {
  175. // 红包悬浮按钮位置
  176. redPacketPosition: {
  177. left: 'auto',
  178. right: 0,
  179. bottom: '15%',
  180. },
  181. barStyle: {
  182. backgroundColor: 'transparent',
  183. background: "url('/pages-sell/static/tab-selected.png') no-repeat center",
  184. backgroundSize: '100% 100%',
  185. position: 'relative',
  186. top: '-6rpx',
  187. },
  188. swiperList: [],
  189. statusBarHeight: 20,
  190. keyword: '',
  191. // 记录滚动距离以实现背景错位效果
  192. scrollTop: 0,
  193. // u-tabs 需要对象数组 [{name: 'xxx'}]
  194. hotTagList: [
  195. { name: '热搜' },
  196. { name: '励志' },
  197. { name: '绘本' },
  198. { name: '诺贝尔文学奖' },
  199. { name: '茅盾奖' },
  200. { name: '童书' }
  201. ],
  202. currentHotTag: 0,
  203. // 临时的网络书封面图片
  204. bookCoverUrl: 'https://img.yzcdn.cn/vant/cat.jpeg',
  205. categoryList: [], //金刚区
  206. bookList: [], // 右侧推荐书籍
  207. recommendBooks: [
  208. { title: '山河岁月', price: '6.80', original: '36.80', cover: 'https://img.yzcdn.cn/vant/cat.jpeg' },
  209. { title: '山河岁月', price: '6.80', original: '36.80', cover: 'https://img.yzcdn.cn/vant/cat.jpeg' },
  210. { title: '山河岁月', price: '6.80', original: '36.80', cover: 'https://img.yzcdn.cn/vant/cat.jpeg' }
  211. ],
  212. topicList: [], //专题推荐
  213. leftBookList: [], // 左侧推荐书籍
  214. rightBookList: [], // 右侧推荐书籍
  215. shareList: [], // 分享列表
  216. hotSearchList: [] // 存放热搜词
  217. }
  218. },
  219. created() {
  220. const systemInfo = uni.getSystemInfoSync();
  221. this.statusBarHeight = systemInfo.statusBarHeight || 20;
  222. this.hasShareList()
  223. this.getIndexCateInfo()
  224. this.getHotSearchData()
  225. },
  226. methods: {
  227. async getHotSearchData() {
  228. try {
  229. const res = await this.$u.api.getHotSearchListAjax();
  230. if (res.code === 200 || res.code === 0) {
  231. this.hotSearchList = res.data || [];
  232. }
  233. } catch (error) {
  234. console.log('获取热搜词失败', error);
  235. }
  236. },
  237. goSearchResult(keyword) {
  238. if (!keyword) return;
  239. // 过滤可能带有的 <em> 等后端返回的 HTML 标签
  240. const cleanKey = keyword.replace(/<[^>]+>/g, '');
  241. uni.navigateTo({
  242. url: '/pages-sell/pages/search-result?keyword=' + encodeURIComponent(cleanKey)
  243. });
  244. },
  245. // 接收外部传入的页面滚动事件
  246. onPageScroll(scrollTop) {
  247. this.scrollTop = scrollTop || 0;
  248. console.log(this.scrollTop)
  249. },
  250. async hasShareList() {
  251. const res = await this.$u.api.getShareRedBagListAjax();
  252. if (res.code === 200 || res.code === 0) {
  253. this.shareList = res.data || [];
  254. }
  255. },
  256. handleCategory(item) {
  257. if (!item.jumpUrl) return
  258. this.navigateTo(item.jumpUrl)
  259. },
  260. changeHotTag(index) {
  261. this.currentHotTag = index;
  262. console.log('切换标签:', index);
  263. },
  264. //跳转 URL
  265. navigateTo(url) {
  266. if (!url) return
  267. console.log(url)
  268. uni.navigateTo({
  269. url: url
  270. });
  271. },
  272. navigateToOfficialAccount() {
  273. // 打开公众号
  274. uni.getProvider({
  275. service: "oauth",
  276. success: function (res) {
  277. if (res.provider.includes("weixin")) {
  278. // 调用微信小程序的 wx.openOfficialAccountProfile
  279. wx.openOfficialAccountProfile({
  280. username: "bookersea",
  281. success: function (res) {
  282. console.log("打开公众号资料页成功", res);
  283. },
  284. fail: function (err) {
  285. console.log("打开公众号资料页失败", err);
  286. },
  287. complete: function () {
  288. console.log("接口调用结束");
  289. },
  290. });
  291. }
  292. },
  293. });
  294. },
  295. goRecommend() {
  296. uni.navigateTo({
  297. url: '/pages-sell/pages/recommend'
  298. });
  299. },
  300. goHotSell() {
  301. uni.navigateTo({
  302. url: '/pages-sell/pages/hot-sell'
  303. });
  304. },
  305. //获取首页装修信息
  306. getIndexCateInfo() {
  307. uni.$u.http.get('/token/shop/showIndex/getIndexCateInfo').then(res => {
  308. console.log(res)
  309. if (res.code == 200) {
  310. console.log(res.data)
  311. this.categoryList = res.data.find(item => item.position == 'diamond_area')?.shopIndexCateVo || []
  312. this.swiperList = res.data.find(item => item.position == 'left_banner')?.shopIndexCateVo || []
  313. this.bookList = res.data.find(item => item.position == 'right_banner')?.shopIndexCateVo || []
  314. this.leftBookList = res.data.find(item => item.position == 'left_book_list')?.shopIndexCateVo || []
  315. this.rightBookList = res.data.find(item => item.position == 'right_book_list')?.shopIndexCateVo || []
  316. //获取专题推荐
  317. this.topicList = res.data.find(item => item.position == 'topic')?.shopIndexCateVo || []
  318. }
  319. })
  320. },
  321. getDisplayBooks(item) {
  322. if (!item.bookInfoList) return []
  323. let limit = 3
  324. if (item.topicType === 2) {
  325. limit = 6
  326. }
  327. return item.bookInfoList.slice(0, limit)
  328. },
  329. // 跳转到红包分享页面
  330. navigateToRedPacket() {
  331. uni.navigateTo({
  332. url: '/packet/pages/share'
  333. });
  334. },
  335. // 红包按钮位置变化
  336. handleRedPacketPositionChange(position) {
  337. this.redPacketPosition = position;
  338. }
  339. }
  340. }
  341. </script>
  342. <style lang="scss" scoped>
  343. .sell-container {
  344. position: relative;
  345. min-height: 100vh;
  346. background-color: #F6F6F6;
  347. overflow-x: hidden;
  348. }
  349. /* 顶部大背景图 */
  350. .top-bg-image {
  351. position: absolute;
  352. top: 0;
  353. left: 0;
  354. width: 100%;
  355. z-index: 0;
  356. display: block;
  357. }
  358. /* 导航栏 */
  359. .custom-navbar {
  360. position: fixed;
  361. top: 0;
  362. left: 0;
  363. width: 100%;
  364. z-index: 100;
  365. display: flex;
  366. align-items: center;
  367. justify-content: center;
  368. .navbar-content {
  369. height: 44px;
  370. width: 100%;
  371. display: flex;
  372. align-items: center;
  373. justify-content: center;
  374. position: relative;
  375. .navbar-title {
  376. color: #fff;
  377. font-size: 36rpx;
  378. font-weight: 600;
  379. }
  380. }
  381. }
  382. .main-content {
  383. position: relative;
  384. z-index: 1;
  385. padding: 0 24rpx;
  386. }
  387. /* 顶部固定区域:背景和搜索框 */
  388. .fixed-header-area {
  389. position: fixed;
  390. top: 0;
  391. left: 0;
  392. width: 100%;
  393. z-index: 99;
  394. background-size: 100% auto;
  395. background-repeat: no-repeat;
  396. padding-left: 24rpx;
  397. padding-right: 24rpx;
  398. padding-bottom: 16rpx;
  399. box-sizing: border-box;
  400. transition: background-color 0.2s;
  401. }
  402. .search-placeholder {
  403. height: 160rpx; /* 增加高度以容纳热搜词 */
  404. }
  405. /* 热搜词横向滚动 */
  406. .hot-search-wrapper {
  407. margin-bottom: 24rpx;
  408. width: 100%;
  409. display: flex;
  410. align-items: center;
  411. }
  412. .hot-search-fixed-title {
  413. flex-shrink: 0;
  414. padding-left: 24rpx;
  415. }
  416. .hot-search-scroll {
  417. flex: 1;
  418. white-space: nowrap;
  419. overflow: hidden;
  420. }
  421. .hot-search-list {
  422. display: inline-flex;
  423. align-items: center;
  424. padding: 0 20rpx;
  425. }
  426. .hot-tag {
  427. display: inline-block;
  428. margin-right: 30rpx;
  429. font-size: 26rpx;
  430. color: #666;
  431. font-weight: 500;
  432. }
  433. .hot-tag-highlight {
  434. color: #38C148;
  435. font-weight: bold;
  436. padding-right: 20rpx;
  437. margin-right: 0;
  438. position: relative;
  439. }
  440. .hot-tag-highlight::after {
  441. content: '';
  442. position: absolute;
  443. right: 0;
  444. top: 50%;
  445. transform: translateY(-50%);
  446. width: 2rpx;
  447. height: 24rpx;
  448. background-color: #E0E0E0;
  449. }
  450. /* 搜索框 */
  451. .search-wrapper {
  452. margin-top: 10rpx;
  453. margin-bottom: 20rpx;
  454. .search-box-uview {
  455. height: 80rpx;
  456. background-color: #fff;
  457. border-radius: 40rpx;
  458. display: flex;
  459. align-items: center;
  460. padding: 0 10rpx 0 16rpx;
  461. position: relative;
  462. /* 覆盖 u-search 的 padding 以适配 */
  463. ::v-deep .u-search {
  464. flex: 1;
  465. /* 让输入框不遮挡右侧按钮 */
  466. padding-right: 140rpx !important;
  467. }
  468. .search-btn-overlay {
  469. position: absolute;
  470. right: 8rpx;
  471. top: 50%;
  472. transform: translateY(-50%);
  473. width: 140rpx;
  474. height: 64rpx;
  475. background: linear-gradient(0deg, #37C148 0%, #6ADD83 100%);
  476. border-radius: 32rpx;
  477. display: flex;
  478. align-items: center;
  479. justify-content: center;
  480. z-index: 2;
  481. text {
  482. color: #fff;
  483. font-size: 28rpx;
  484. font-weight: 500;
  485. }
  486. }
  487. }
  488. }
  489. /* 顶部横幅 */
  490. .top-banner-wrapper {
  491. width: 100%;
  492. margin-bottom: 30rpx;
  493. position: relative;
  494. .top-banner-img {
  495. width: 100%;
  496. border-radius: 40rpx;
  497. display: block;
  498. }
  499. }
  500. /* 分类图标 */
  501. .category-grid {
  502. display: flex;
  503. flex-wrap: wrap;
  504. margin-bottom: 10rpx;
  505. .grid-item {
  506. width: 20%;
  507. display: flex;
  508. flex-direction: column;
  509. align-items: center;
  510. margin-bottom: 30rpx;
  511. .icon-circle {
  512. width: 96rpx;
  513. height: 96rpx;
  514. display: flex;
  515. align-items: center;
  516. justify-content: center;
  517. margin-bottom: 12rpx;
  518. .cat-icon {
  519. width: 100%;
  520. height: 100%;
  521. }
  522. }
  523. .cat-name {
  524. font-size: 24rpx;
  525. color: #333;
  526. font-weight: 500;
  527. }
  528. }
  529. }
  530. /* 推广双卡片 */
  531. .promo-dual-card {
  532. display: flex;
  533. justify-content: space-between;
  534. margin-bottom: 24rpx;
  535. .card-left {
  536. width: 48%;
  537. height: 252rpx;
  538. border-radius: 20rpx;
  539. position: relative;
  540. overflow: hidden;
  541. }
  542. .card-right {
  543. width: 48%;
  544. height: 252rpx;
  545. /* Updated background per request */
  546. background: linear-gradient(to bottom, #FFD7C3 0%, #FFFFFF 32%);
  547. border-radius: 20rpx;
  548. padding: 20rpx;
  549. box-sizing: border-box;
  550. .right-header {
  551. display: flex;
  552. align-items: center;
  553. justify-content: center;
  554. margin-bottom: 20rpx;
  555. .right-title {
  556. font-size: 30rpx;
  557. font-weight: bold;
  558. color: #333;
  559. margin: 0 10rpx;
  560. }
  561. .fire-icon {
  562. width: 30rpx;
  563. height: 30rpx;
  564. }
  565. .flip {
  566. transform: scaleX(-1);
  567. }
  568. }
  569. .products-container {
  570. display: flex;
  571. justify-content: space-between;
  572. gap: 20rpx;
  573. .product-cover {
  574. flex: 1;
  575. height: 160rpx;
  576. border-radius: 12rpx;
  577. background-color: #f0f0f0;
  578. }
  579. }
  580. }
  581. }
  582. /* 信息双卡片 */
  583. .info-dual-card {
  584. display: flex;
  585. justify-content: space-between;
  586. margin-bottom: 24rpx;
  587. .info-card-swiper {
  588. width: 48%;
  589. height: 140rpx;
  590. border-radius: 12px;
  591. overflow: hidden;
  592. }
  593. .info-card {
  594. width: 100%;
  595. padding: 24rpx;
  596. border-radius: 12px;
  597. /* Updated radius */
  598. display: flex;
  599. justify-content: space-between;
  600. align-items: center;
  601. height: 140rpx;
  602. box-sizing: border-box;
  603. position: relative;
  604. /* For absolute icon */
  605. overflow: hidden;
  606. &.bg-orange {
  607. background: #FFF3E0;
  608. border: 1px solid #FFB72A;
  609. }
  610. &.bg-green {
  611. background: #D4F1D8;
  612. border: 1px solid #54A94E;
  613. }
  614. .info-text-group {
  615. flex: 1;
  616. z-index: 1;
  617. /* Ensure text is above */
  618. .info-title {
  619. font-size: 28rpx;
  620. font-weight: bold;
  621. display: block;
  622. margin-bottom: 6rpx;
  623. }
  624. .info-desc {
  625. font-size: 22rpx;
  626. line-height: 1.2;
  627. }
  628. .text-orange {
  629. color: #DB832D;
  630. }
  631. .text-orange-light {
  632. color: #DB832D;
  633. display: inline-block;
  634. width: 90%;
  635. //超出部分省略号显示
  636. overflow: hidden;
  637. white-space: nowrap;
  638. text-overflow: ellipsis;
  639. max-width: 200rpx;
  640. }
  641. .text-green {
  642. color: #1F8049;
  643. }
  644. .text-green-light {
  645. color: #1F8049;
  646. display: inline-block;
  647. width: 90%;
  648. //超出部分省略号显示
  649. overflow: hidden;
  650. white-space: nowrap;
  651. text-overflow: ellipsis;
  652. max-width: 200rpx;
  653. }
  654. }
  655. .info-icon {
  656. width: 100rpx;
  657. /* Slightly larger maybe */
  658. height: 100rpx;
  659. position: absolute;
  660. right: 0;
  661. bottom: 0;
  662. z-index: 0;
  663. opacity: 0.8;
  664. }
  665. }
  666. }
  667. /* 公众号 */
  668. .gzh-section {
  669. margin-bottom: 30rpx;
  670. height: 180rpx;
  671. /* Fixed height for consistency */
  672. border-radius: 20rpx;
  673. overflow: hidden;
  674. .gzh-bg-wrapper {
  675. width: 100%;
  676. height: 100%;
  677. position: relative;
  678. .gzh-img-bg {
  679. width: 100%;
  680. height: 100%;
  681. position: absolute;
  682. top: 0;
  683. left: 0;
  684. }
  685. .gzh-content-overlay {
  686. position: absolute;
  687. top: 0;
  688. left: 0;
  689. width: 60%;
  690. /* Only cover left side */
  691. height: 100%;
  692. padding: 30rpx;
  693. display: flex;
  694. flex-direction: column;
  695. justify-content: center;
  696. .gzh-title {
  697. font-size: 32rpx;
  698. font-weight: bold;
  699. color: #134E13;
  700. /* Dark green */
  701. margin-bottom: 16rpx;
  702. }
  703. .gzh-subtitle-pill {
  704. background: #FFF;
  705. border-radius: 24rpx;
  706. padding: 0 14rpx;
  707. line-height: 1.4;
  708. align-self: flex-start;
  709. .gzh-subtitle {
  710. font-size: 22rpx;
  711. color: #134E13;
  712. font-weight: 500;
  713. }
  714. }
  715. }
  716. }
  717. }
  718. /* 书嗨推荐 */
  719. .recommend-section {
  720. background-color: #fff;
  721. border-radius: 20rpx;
  722. padding: 30rpx;
  723. margin-bottom: 24rpx;
  724. .section-header {
  725. display: flex;
  726. justify-content: space-between;
  727. align-items: center;
  728. margin-bottom: 24rpx;
  729. .section-title {
  730. font-size: 32rpx;
  731. font-weight: bold;
  732. color: #333;
  733. }
  734. .view-more {
  735. display: flex;
  736. align-items: center;
  737. font-size: 24rpx;
  738. color: #8D8D8D;
  739. .arrow-icon {
  740. width: 12rpx;
  741. margin-left: 6rpx;
  742. }
  743. }
  744. }
  745. .book-list {
  746. display: flex;
  747. flex-wrap: wrap;
  748. justify-content: space-between;
  749. }
  750. .book-item {
  751. width: 200rpx;
  752. margin-bottom: 24rpx;
  753. display: flex;
  754. flex-direction: column;
  755. .book-image {
  756. width: 200rpx;
  757. height: 255rpx;
  758. border-radius: 2rpx;
  759. margin-bottom: 16rpx;
  760. background-color: #f9f9f9;
  761. }
  762. .book-name {
  763. font-family: 'Source Han Sans SC';
  764. font-weight: bold;
  765. font-size: 28rpx;
  766. color: #303030;
  767. margin-bottom: 10rpx;
  768. overflow: hidden;
  769. text-overflow: ellipsis;
  770. white-space: nowrap;
  771. }
  772. .price-row {
  773. display: flex;
  774. align-items: baseline;
  775. margin-bottom: 12rpx;
  776. .currency {
  777. font-family: 'Source Han Sans SC';
  778. font-weight: 500;
  779. font-size: 22rpx;
  780. color: #D81A00;
  781. }
  782. .price-val {
  783. font-family: 'Source Han Sans SC';
  784. font-weight: 500;
  785. font-size: 28rpx;
  786. color: #D81A00;
  787. margin-right: 12rpx;
  788. }
  789. .price-old {
  790. font-family: 'Source Han Sans SC';
  791. font-weight: 500;
  792. font-size: 22rpx;
  793. color: #999999;
  794. text-decoration: line-through;
  795. }
  796. }
  797. .add-btn {
  798. width: fit-content;
  799. height: 36rpx;
  800. line-height: 36rpx;
  801. background: linear-gradient(0deg, #4ED964 0%, #4ED964 100%);
  802. border-radius: 18rpx;
  803. padding: 0 20rpx;
  804. display: flex;
  805. align-items: center;
  806. justify-content: center;
  807. text {
  808. font-size: 22rpx;
  809. color: #fff;
  810. }
  811. .cart-symbol {
  812. width: 24rpx;
  813. height: 24rpx;
  814. margin-left: 6rpx;
  815. }
  816. }
  817. }
  818. }
  819. .bottom-safe-area {
  820. height: 30rpx
  821. }
  822. .red-packet-btn {
  823. width: 126rpx;
  824. height: 140rpx;
  825. background: transparent;
  826. border: none;
  827. padding: 0;
  828. margin: 0;
  829. display: flex;
  830. align-items: center;
  831. justify-content: center;
  832. &::after {
  833. border: none;
  834. }
  835. }
  836. </style>