移动端
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.
 
 

193 rivejä
5.6 KiB

  1. <template>
  2. <div class="app-container">
  3. <van-row>
  4. <van-col span="2">
  5. <van-image src="../../static/images/index/logo.png" />
  6. </van-col>
  7. <van-col span="22" style="line-height: 29px;font-size: 20px;">农村产权交易平台</van-col>
  8. </van-row>
  9. <van-swipe class="my-swipe" :autoplay="3000" height="180" indicator-color="white" :show-indicators="false">
  10. <van-swipe-item v-for="(item,index) in bannerList" :key="index">
  11. <van-image :src="item.img" height="180" @click="goDetail(item.id)" />
  12. <p class="bannerTit">{{item.title}}</p>
  13. </van-swipe-item>
  14. </van-swipe>
  15. <div style="border-radius: 10px;overflow: hidden;">
  16. <van-grid :border="false" :column-num="3">
  17. <van-grid-item to="/news/index">
  18. <van-image src="../../static/images/icon/icon_new.png" width="40" height="40" />
  19. <p>新闻资讯</p>
  20. </van-grid-item>
  21. <van-grid-item to="/biddingHall">
  22. <van-image src="../../static/images/icon/icon_bidding.png" width="40" height="40" />
  23. <p>竞价大厅</p>
  24. </van-grid-item>
  25. <van-grid-item to="/notice/index">
  26. <van-image src="../../static/images/icon/icon_project.png" width="40" height="40" />
  27. <p>项目公告</p>
  28. </van-grid-item>
  29. <van-grid-item to="/policy">
  30. <van-image src="../../static/images/icon/icon_statute.png" width="40" height="40" />
  31. <p>政策法规</p>
  32. </van-grid-item>
  33. <van-grid-item to="/interaction/index">
  34. <van-image src="../../static/images/icon/icon_talk.png" width="40" height="40" />
  35. <p>互动交流</p>
  36. </van-grid-item>
  37. <van-grid-item to="/supply/index">
  38. <van-image src="../../static/images/icon/icon_need.png" width="40" height="40" />
  39. <p>个人供求</p>
  40. </van-grid-item>
  41. <!-- <van-grid-item to="/authenticRight">
  42. <van-image src="../../static/images/icon/icon_need.png" width="40" height="40" />
  43. <p>确权调查</p>
  44. </van-grid-item>-->
  45. </van-grid>
  46. </div>
  47. <p class="newTit">新闻资讯</p>
  48. <div style="border-radius: 10px;overflow: hidden;">
  49. <van-list
  50. v-model="loading"
  51. :finished="finished"
  52. finished-text="没有更多了"
  53. @load="getList()"
  54. >
  55. <!-- @load="newList"-->
  56. <van-cell v-for="item in newList" :key="item.id" :label="item.newsTime" :to="{name:'newDetail', query: {id:item.id}}">
  57. <!-- 使用 right-icon 插槽来自定义右侧图标 -->
  58. <template #title>
  59. <p class="newContent">{{item.title}}</p>
  60. </template>
  61. <template #right-icon>
  62. <van-image :src="item.img" class="search-icon" width="30%" v-if="item.img" />
  63. <van-image src="../../static/images/zwtpxw.jpg" class="search-icon" width="30%" v-else/>
  64. </template>
  65. </van-cell>
  66. </van-list>
  67. </div>
  68. </div>
  69. </template>
  70. <script>
  71. import { newList } from "@/api/index";
  72. export default {
  73. name: "index",
  74. data() {
  75. return {
  76. //是否显示加载
  77. loading: false,
  78. //是否滚动到底部
  79. finished: false,
  80. //查询参数
  81. queryParams: {
  82. pageNum: 1,
  83. pageSize: 5,
  84. deptId:100,
  85. number:2
  86. },
  87. //新闻集合
  88. newList:[],
  89. //轮播图集合
  90. bannerList:''
  91. };
  92. },
  93. created() {
  94. //this.getList();
  95. this.getBanner();
  96. },
  97. methods: {
  98. getList(){
  99. this.loading = true;
  100. this.queryParams.number = 2 ;
  101. this.queryParams.pageSize = 5 ;
  102. newList(this.queryParams).then(response => {
  103. for (var i = 0; i < response.rows.length; i++) {
  104. this.newList.push(response.rows[i]);
  105. var imgStrs = response.rows[i].content.match(/<IMG src=\"([^\"]*?)\">/gi)
  106. console.log(imgStrs)
  107. if (imgStrs != null && imgStrs != '') {
  108. this.newList[i].img = imgStrs[0].substr(10,(imgStrs[0].length-12));
  109. }
  110. }
  111. if(this.newList.length >= response.total){
  112. this.finished = true;
  113. return;
  114. }
  115. this.queryParams.pageNum += 1 ;
  116. this.loading = false;
  117. });
  118. },
  119. getBanner(){
  120. this.loading = true;
  121. this.queryParams.number = 1 ;
  122. this.queryParams.pageSize = 5 ;
  123. newList(this.queryParams).then(response => {
  124. this.bannerList = response.rows;
  125. for (var i = 0; i < response.rows.length; i++) {
  126. var imgStrs = response.rows[i].content.match(/<IMG src=\"([^\"]*?)\">/gi)
  127. if (imgStrs != null && imgStrs != '') {
  128. this.bannerList[i].img = imgStrs[0].substr(10,(imgStrs[0].length-12));
  129. }
  130. }
  131. this.loading = false;
  132. });
  133. },
  134. goDetail(id){
  135. console.log(id)
  136. window.location = 'news/newDetail?id='+id;
  137. }
  138. },
  139. };
  140. </script>
  141. <style scoped lang="scss">
  142. .app-container {
  143. padding: 6% 3% 0;
  144. }
  145. .bannerTit{
  146. position: absolute;
  147. bottom: 0;
  148. background: #000;
  149. opacity: 0.5;
  150. width: 100%;
  151. height: 0.8rem;
  152. line-height: 0.8rem;
  153. color: #eee;
  154. text-align: center;
  155. overflow: hidden;
  156. padding: 0 5%;
  157. }
  158. .link{
  159. color: #000;
  160. }
  161. .my-swipe {
  162. border-radius: 30px;
  163. margin-top: 0.4rem;
  164. margin-bottom: 0.4rem;
  165. }
  166. .my-swipe .van-swipe-item .van-image{
  167. width: 100%;
  168. }
  169. .van-grid-item p{
  170. margin-top: 10px;
  171. }
  172. .newTit{
  173. font-size: 0.45rem;
  174. margin: 0.4rem 0;
  175. font-family: Source Han Sans SC, Source Han Sans SC-Medium;
  176. font-weight: 500;
  177. text-align: left;
  178. color: #333333;
  179. }
  180. .newContent{
  181. display: -webkit-box;
  182. -webkit-box-orient: vertical;
  183. -webkit-line-clamp: 2;
  184. word-break: break-all;
  185. overflow: hidden;
  186. }
  187. .search-icon {
  188. line-height: inherit;
  189. margin-left: 10px;
  190. }
  191. </style>