toGovernmentList.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <template>
  2. <!-- pages/me.wxml -->
  3. <view class="container">
  4. <uni-search-bar @confirm="search" :focus="true" v-model="searchValue" @blur="search" @input="search"
  5. style="width: 100%;"
  6. @cancel="cancel">
  7. </uni-search-bar>
  8. <view class="rnwdList">
  9. <view class="list" @tap="goDetails(item)" v-for="(item, index1) in qbwd" :key="index1">
  10. <span class="listTitle">{{ item.titleName }}</span>
  11. <view class="onePic" v-if="item.urls.length == 1">
  12. <image :src="loadImgSrc(item.urls[index2])" v-for="(v, index2) in item.urls" :key="index2">
  13. </image>
  14. </view>
  15. <view class="twoPic" v-if="item.urls.length == 2">
  16. <image :src="loadImgSrc(item.urls[index2])" v-for="(v, index2) in item.urls" :key="index2">
  17. </image>
  18. </view>
  19. <view class="threePic" v-if="item.urls.length == 3">
  20. <image :src="loadImgSrc(item.urls[index2])" v-for="(v, index2) in item.urls" :key="index2">
  21. </image>
  22. </view>
  23. <!-- <view class="jlSj">
  24. <span class="jf">
  25. {{ item.jf }}
  26. <em class="iconfont icon-jifen"></em>
  27. </span>
  28. <view class="ck">
  29. <span>
  30. <em class="iconfont icon-pinglun"></em>
  31. {{ item.pl }}
  32. </span>
  33. <span>
  34. <em class="iconfont icon-chakan"></em>
  35. {{ item.ck }}
  36. </span>
  37. <span>
  38. <em class="iconfont icon-shoucang"></em>
  39. {{ item.dz }}
  40. </span>
  41. </view>
  42. </view> -->
  43. </view>
  44. </view>
  45. <!-- 新增资讯按钮 -->
  46. <!-- <button class="addInfomarionBtn" @click="addInfomation()"></button> -->
  47. </view>
  48. </template>
  49. <script>
  50. import { listWxs ,listWx} from '@/api/information/information.js'
  51. // pages/me.js
  52. export default {
  53. data() {
  54. return {
  55. qbwd:[],
  56. listParams:{
  57. pageNum: 1,
  58. pageSize: 7,
  59. titleName: '',
  60. isGovernment:'',
  61. type: 10,
  62. flag:''
  63. },
  64. total:0,
  65. searchValue:''
  66. };
  67. },
  68. created(){
  69. },
  70. onReachBottom(){
  71. let pageNum = this.listParams.pageNum
  72. let pageSize = this.listParams.pageSize
  73. let total = this.total
  74. if(pageNum * pageSize >= total){
  75. uni.showToast({
  76. title:'暂无更多数据'
  77. })
  78. return
  79. } else {
  80. this.listParams.pageNum += 1;
  81. this.getList()
  82. }
  83. },
  84. methods:{
  85. search(){
  86. this.listParams.titleName = this.searchValue
  87. this.qbwd = []
  88. this.getList()
  89. },
  90. getList(){
  91. listWxs(this.listParams).then(res => {
  92. this.qbwd = [...this.qbwd,...res.rows]
  93. this.total = res.total
  94. })
  95. },
  96. goDetails(e) {
  97. let id = e.id || ''
  98. let type = 10
  99. uni.navigateTo({
  100. url: `../informationDetail/informationDetail?id=${id}&type=${type}`
  101. });
  102. },
  103. // 新增资讯
  104. addInfomation(){
  105. uni.navigateTo({
  106. url: `../informationAdd/informationAdd`
  107. });
  108. }
  109. },
  110. /**
  111. * 生命周期函数--监听页面加载
  112. */
  113. onLoad(options) {
  114. console.log(options)
  115. if(options.type!=null){
  116. this.listParams.type = options.type
  117. }
  118. if(options.type==null){
  119. this.listParams.isGovernment = 1
  120. }
  121. this.getList()
  122. // 查置顶
  123. listWx({}).then(e => {
  124. })
  125. },
  126. /**
  127. * 生命周期函数--监听页面初次渲染完成
  128. */
  129. onReady() {},
  130. /**
  131. * 生命周期函数--监听页面显示
  132. */
  133. onShow() {},
  134. /**
  135. * 生命周期函数--监听页面隐藏
  136. */
  137. onHide() {},
  138. /**
  139. * 生命周期函数--监听页面卸载
  140. */
  141. onUnload() {},
  142. /**
  143. * 页面相关事件处理函数--监听用户下拉动作
  144. */
  145. onPullDownRefresh() {},
  146. /**
  147. * 用户点击右上角分享
  148. */
  149. onShareAppMessage() {},
  150. };
  151. </script>
  152. <style>
  153. @import './index.css';
  154. .container{
  155. height: 100%;
  156. }
  157. </style>