index.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <template>
  2. <view class="fui-wrap">
  3. <view class="search-content">
  4. <u-search placeholder="请输入关键字" v-model="keyword" @custom="onSearch" @search="onSearch"></u-search>
  5. </view>
  6. <u-swiper :list="list" imgMode="aspectFill" :radius='0' :height="240" />
  7. <u-notice-bar :text="msg" :more-icon="false" color="#5af" bg-color="#d6e8f7"></u-notice-bar>
  8. <view style="width: 100%; margin-top: 20rpx">
  9. <u-grid
  10. :border="false"
  11. :col="3"
  12. @click="click"
  13. >
  14. <u-grid-item
  15. v-for="(baseListItem,baseListIndex) in baseList"
  16. :key="baseListIndex"
  17. >
  18. <view class="grid-item-icon" :style="{backgroundColor: baseListItem.bgColor}">
  19. <image :src="baseListItem.icon"></image>
  20. </view>
  21. <text class="grid-text">{{ baseListItem.title }}</text>
  22. </u-grid-item>
  23. </u-grid>
  24. </view>
  25. <u-gap height="10" bgColor="#bbb"></u-gap>
  26. <view class="u-page">
  27. <view class="u-page-title">
  28. <view class="line"></view>
  29. <view class="rectangle"></view>
  30. <view class="rectangle"></view>
  31. <view class="title-content">最新资讯</view>
  32. <view class="rectangle"></view>
  33. <view class="rectangle"></view>
  34. <view class="line"></view>
  35. </view>
  36. <item-list :ds="indexList" :onItemClick="onContentClick" />
  37. </view>
  38. </view>
  39. </template>
  40. <script>
  41. import { fetchContentInfo } from '@/common/api';
  42. import ItemList from '@/components/ItemList/index.vue';
  43. import { getImageUrl } from '@/util';
  44. export default {
  45. components: {
  46. ItemList,
  47. },
  48. data() {
  49. return {
  50. keyword: '',
  51. list: [
  52. '/static/images/swiper/title.png',
  53. ],
  54. msg: '加快建设交通强国大会将于2024年8月在南京召开',
  55. baseList: [
  56. {
  57. name: 'photo',
  58. icon: '/static/images/icons/meeting_info.svg',
  59. bgColor: '#6abff9',
  60. title: '大会介绍',
  61. },
  62. {
  63. name: 'lock',
  64. icon: '/static/images/icons/meeting_apply.svg',
  65. bgColor: '#f1b06c',
  66. title: '会议报名',
  67. },
  68. {
  69. name: 'star',
  70. icon: '/static/images/icons/meeting_point.svg',
  71. title: '会议指南',
  72. bgColor: '#ee794d',
  73. },
  74. {
  75. name: 'star',
  76. icon: '/static/images/icons/meeting_doc.svg',
  77. title: '交流材料汇编',
  78. bgColor: '#e66b66',
  79. },
  80. {
  81. name: 'star',
  82. icon: '/static/images/icons/meeting_traffic.svg',
  83. title: '交通指引',
  84. bgColor: '#82cf92',
  85. },
  86. {
  87. name: 'star',
  88. icon: '/static/images/icons/meeting_contact.svg',
  89. title: '联系我们',
  90. bgColor: '#4a75f6',
  91. },
  92. ],
  93. indexList: [],
  94. };
  95. },
  96. onLoad() {
  97. this.loadmore();
  98. },
  99. methods: {
  100. click() {
  101. },
  102. onContentClick(item) {
  103. uni.navigateTo({
  104. url: `/pages/detail/index?id=${item.id}`,
  105. });
  106. },
  107. async loadmore() {
  108. const res = await fetchContentInfo({
  109. pageNum: 1,
  110. pageSize: 99,
  111. });
  112. this.indexList = res.rows.map(item => {
  113. return {
  114. id: item.id,
  115. imgUrl: getImageUrl(item.thumbnail),
  116. title: item.title,
  117. date: item.createTime,
  118. };
  119. });
  120. },
  121. onSearch(val) {
  122. debugger
  123. uni.navigateTo({
  124. url: `/pages/tabbar/news/index?keyword=${val}`,
  125. });
  126. },
  127. },
  128. onShareAppMessage() {
  129. return {
  130. title: 'First UI组件库',
  131. };
  132. },
  133. };
  134. </script>
  135. <style lang="scss" src="./index.scss">
  136. </style>