吉光研途前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

299 lines
7.3 KiB

4 days ago
4 days ago
4 days ago
4 days ago
4 days ago
4 days ago
4 days ago
4 days ago
4 days ago
  1. <template>
  2. <view class="page__view">
  3. <view class="bg"></view>
  4. <view class="main">
  5. <!-- 搜索栏 -->
  6. <view class="section search">
  7. <uv-search v-model="keyword" placeholder="输入关键词搜索" bgColor="#FBFBFB" @custom="search" @search="search">
  8. <template #prefix>
  9. <image class="search-icon" src="@/static/image/icon-search.png" mode="widthFix"></image>
  10. </template>
  11. </uv-search>
  12. </view>
  13. <!-- 轮播图 -->
  14. <view class="section swiper">
  15. <uv-swiper :list="bannerList" keyName="image" indicator indicatorMode="dot" indicatorActiveColor="#4883F9" indicatorInactiveColor="#FFFFFF" height="239rpx"></uv-swiper>
  16. </view>
  17. <view class="section card" v-for="(group, gIdx) in list" :key="group.id">
  18. <view class="card-header">
  19. <view class="card-header-title">{{ group.label }}</view>
  20. <view class="card-header-tag">JGYT</view>
  21. </view>
  22. <view class="card-content">
  23. <template v-if="gIdx === 0">
  24. <view class="card-item card-row" v-for="item in group.children" :key="item.id" @click="jumpToCategory(item)">
  25. <view class="flex info">
  26. <image class="info-icon" :src="item.icon" mode="widthFix"></image>
  27. <view class="info-label">{{ item.label }}</view>
  28. </view>
  29. <button class="btn">查看</button>
  30. </view>
  31. </template>
  32. <template v-else>
  33. <view class="card-box">
  34. <view class="card-item info" v-for="item in group.children" :key="item.id" @click="jumpToCategory(item)">
  35. <image class="info-icon" :src="item.icon" mode="widthFix"></image>
  36. <view class="info-label">{{ item.label }}</view>
  37. </view>
  38. </view>
  39. </template>
  40. </view>
  41. </view>
  42. </view>
  43. <tabber select="home" />
  44. </view>
  45. </template>
  46. <script>
  47. import tabber from '@/components/base/tabbar.vue'
  48. export default {
  49. components: {
  50. tabber,
  51. },
  52. data() {
  53. return {
  54. keyword: '',
  55. bannerList: [],
  56. list: [],
  57. }
  58. },
  59. onLoad() {
  60. this.fetchBanner()
  61. this.getData()
  62. },
  63. methods: {
  64. getData() {
  65. // todo
  66. this.list = [
  67. {
  68. id: '001',
  69. label: '导航检索',
  70. children: [
  71. { id: '0011', label: 'AHCI', icon: '/static/image/temp-4.png', },
  72. { id: '0012', label: 'EI会议', icon: '/static/image/temp-9.png', },
  73. { id: '0013', label: 'EI源刊', icon: '/static/image/temp-10.png', },
  74. { id: '0014', label: 'ESCI', icon: '/static/image/temp-5.png', },
  75. { id: '0015', label: 'SCI', icon: '/static/image/temp-6.png', },
  76. { id: '0016', label: 'Scoupus', icon: '/static/image/temp-7.png', },
  77. { id: '0017', label: 'SSCI', icon: '/static/image/temp-8.png', },
  78. ],
  79. },
  80. {
  81. id: '002',
  82. label: '精选内容',
  83. children: [
  84. { id: '0021', label: 'AHCI', icon: '/static/image/temp-4.png', },
  85. { id: '0022', label: 'EI会议', icon: '/static/image/temp-9.png', },
  86. { id: '0023', label: 'AHCI', icon: '/static/image/temp-4.png', },
  87. { id: '0024', label: 'EI会议', icon: '/static/image/temp-9.png', },
  88. ],
  89. },
  90. {
  91. id: '003',
  92. label: '精选内容',
  93. children: [
  94. { id: '0031', label: 'AHCI', icon: '/static/image/temp-4.png', },
  95. { id: '0032', label: 'EI会议', icon: '/static/image/temp-9.png', },
  96. { id: '0033', label: 'AHCI', icon: '/static/image/temp-4.png', },
  97. { id: '0034', label: 'EI会议', icon: '/static/image/temp-9.png', },
  98. ],
  99. },
  100. ]
  101. },
  102. search() {
  103. uni.navigateTo({
  104. url: '/pages_order/search/index?search=' + this.keyword
  105. })
  106. this.keyword = ''
  107. },
  108. // 获取轮播图
  109. async fetchBanner() {
  110. try {
  111. // todo
  112. // this.bannerList = (await this.$fetch('queryBannerList'))?.records
  113. this.bannerList = [
  114. { image: '/static/image/temp-1.png' },
  115. { image: '/static/image/temp-2.png' },
  116. { image: '/static/image/temp-3.png' },
  117. { image: '/static/image/temp-2.png' },
  118. ]
  119. } catch (err) {
  120. }
  121. },
  122. jumpToCategory(obj) {
  123. const { id, label } = obj
  124. uni.navigateTo({
  125. url: `/pages_order/search/index?cid=${id}&title=${label}`
  126. })
  127. },
  128. },
  129. }
  130. </script>
  131. <style scoped lang="scss">
  132. .bg {
  133. width: 100%;
  134. height: 438rpx;
  135. background-image: linear-gradient(#4883F9, #4883F9, #4883F9, #FCFDFF);
  136. }
  137. .main {
  138. position: absolute;
  139. top: 0;
  140. left: 0;
  141. width: 100%;
  142. padding: 192rpx 0 182rpx 0;
  143. }
  144. .section {
  145. margin: 0 18rpx 0 18rpx;
  146. }
  147. .search {
  148. width: calc(100% - 20rpx * 2);
  149. background-color: #FFFFFF;
  150. border-radius: 37rpx;
  151. padding: 13rpx 0 13rpx 18rpx;
  152. box-sizing: border-box;
  153. display: flex;
  154. align-items: center;
  155. /deep/ .uv-search__action {
  156. color: $uni-color;
  157. padding: 10rpx 18rpx;
  158. }
  159. &-icon {
  160. width: 26rpx;
  161. height: auto;
  162. }
  163. }
  164. .swiper {
  165. margin-top: 29rpx;
  166. margin-bottom: 26rpx;
  167. border-radius: 25rpx;
  168. overflow: hidden;
  169. /deep/ .uv-swiper-indicator__wrapper__dot {
  170. width: 15rpx;
  171. height: 15rpx;
  172. }
  173. /deep/ .uv-swiper-indicator__wrapper__dot--active {
  174. width: 15rpx;
  175. }
  176. }
  177. .card {
  178. margin-bottom: 35rpx;
  179. width: calc(100% - 20rpx * 2);
  180. box-sizing: border-box;
  181. padding-bottom: 45rpx;
  182. background-image: linear-gradient(164deg,#cfecfe 88rpx, #fcfdfe 176rpx);
  183. border: 3rpx solid #FFFFFF;
  184. border-radius: 25rpx;
  185. box-shadow: 0px 3rpx 6rpx 0rpx rgba(0,0,0,0.16);
  186. &-header {
  187. position: relative;
  188. width: 100%;
  189. box-sizing: border-box;
  190. padding: 46rpx 0 17rpx 33rpx;
  191. overflow: hidden;
  192. &-title {
  193. font-size: 42rpx;
  194. font-weight: 800;
  195. color: #000000;
  196. }
  197. &-tag {
  198. position: absolute;
  199. top: -40rpx;
  200. right: 12rpx;
  201. font-size: 156rpx;
  202. font-weight: 800;
  203. color: rgba(255,255,255,0.3);
  204. }
  205. }
  206. &-content {
  207. padding: 0 30rpx;
  208. box-sizing: border-box;
  209. }
  210. &-item {
  211. display: flex;
  212. align-items: center;
  213. justify-content: flex-start;
  214. column-gap: 50rpx;
  215. padding: 26rpx 28rpx;
  216. box-sizing: border-box;
  217. background: #f3f6fd;
  218. border-radius: 28rpx;
  219. box-shadow: 0rpx 3rpx 6rpx 0rpx rgba(0,0,0,0.16);
  220. }
  221. .info {
  222. &-icon {
  223. width: 80rpx;
  224. height: auto;
  225. }
  226. &-label {
  227. font-size: 32rpx;
  228. font-weight: 400;
  229. color: #000000;
  230. }
  231. }
  232. &-row {
  233. justify-content: space-between;
  234. padding: 15rpx 35rpx;
  235. & + & {
  236. margin-top: 33rpx;
  237. }
  238. .info {
  239. column-gap: 33rpx;
  240. }
  241. .btn {
  242. padding: 7rpx 30rpx;
  243. font-size: 28rpx;
  244. font-weight: 400;
  245. color: #4883F9;
  246. background: #FFFFFF;
  247. border-radius: 27rpx;
  248. }
  249. }
  250. &-box {
  251. display: grid;
  252. grid-template-columns: repeat(2, 1fr);
  253. column-gap: 34rpx;
  254. row-gap: 26rpx;
  255. .info {
  256. column-gap: 50rpx;
  257. }
  258. }
  259. }
  260. </style>