problem.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <template>
  2. <view class="index">
  3. <view class="indextop">
  4. <view class="sous_sear">
  5. <view class="sous_box" >
  6. <image :src="searimg" class="sous_img"></image>
  7. <input placeholder="请输入常见问题" v-model="formData.noticeTitle" class="sous_input"/>
  8. </view>
  9. <view class="sous_btn" @click="getSearFn">搜索</view>
  10. </view>
  11. <p style="height: 28upx; background-color: #f2f2f2;"></p>
  12. </view>
  13. <!-- 通知公告 -->
  14. <view class="probox">
  15. <scroll-view scroll-y class="scroll-view " upper-threshold="40" lower-threshold="40" @scrolltolower="bot_btn" >
  16. <view class="prolist" v-for="(ite,idx) in list" :key='idx' @click="goDetail(ite)">
  17. <view class="protit">{{ite.noticeTitle}}</view>
  18. <image :src="rimg" class="prorimg"></image>
  19. </view>
  20. <div class="shax" v-if="list.length>0">
  21. {{wtdt}}
  22. </div>
  23. <div class="zanwu " v-else><span>暂无数据</span></div>
  24. </scroll-view>
  25. </view>
  26. </view>
  27. </template>
  28. <script>
  29. import encoding from '@/js_sdk/encoding.js'
  30. // import dataTimePicke from '@/_components/picker/dataTimePicke.vue'
  31. export default {
  32. data() {
  33. return {
  34. searimg:require("@/static/image/search.png"),
  35. closeimg:require("@/static/image/del.png"),
  36. searchflag:false,
  37. rimg:require('@/static/image/icon_mine_listenter.png'),
  38. //列表数据
  39. list: [],
  40. roles:false,
  41. show: false,
  42. formData: { //上拉刷新
  43. pageNum: 1,
  44. pageSize: 20,
  45. noticeTitle:''
  46. },
  47. keyword: '',
  48. haveMore: true,
  49. wtdt: '上拉加载更多',
  50. telephone:'',
  51. importflag:false
  52. };
  53. },
  54. onShow() {
  55. let type = uni.getStorageSync('token')
  56. if (!type) {
  57. uni.redirectTo({
  58. url: '/pages/login/login'
  59. })
  60. }else{
  61. let roles=uni.getStorageSync('roles')||false
  62. this.roles=roles
  63. }
  64. this.importflag=false;
  65. },
  66. onLoad(option) {
  67. // 水印
  68. this.telephone = uni.getStorageSync('phone')||''
  69. // 水印
  70. this.formData.pageNum = 1;
  71. this.list = []
  72. // 修改 获取列表的
  73. this.lists(this.formData)
  74. },
  75. methods: {
  76. getSearFn(){
  77. this.list = [];
  78. this.formData.pageNum = 1;
  79. this.formData.pageSize=20;
  80. this.lists(this.formData)
  81. },
  82. goDetail(e) {
  83. uni.navigateTo({
  84. url: '/home/pages/recordthree/prodetail?&id=' + e.id
  85. })
  86. },
  87. lists(formData) {
  88. var params={}
  89. this.$http.get("boman-system/notice/list", formData).then(res => {
  90. //停止下拉加载
  91. uni.hideNavigationBarLoading()
  92. uni.stopPullDownRefresh()
  93. if (res.code == 200) {
  94. if (res.rows.length < formData.pageSize) {
  95. this.haveMore = false
  96. this.wtdt='到底了~';
  97. } else {
  98. var num=parseInt(res.rows.length)+parseInt(formData.pageSize)*parseInt(formData.pageNum-1)
  99. if(num<res.total){
  100. this.haveMore = true
  101. this.wtdt='上拉加载更多'
  102. }else{
  103. this.haveMore = false
  104. this.wtdt='到底了~';
  105. }
  106. }
  107. if(formData.pageNum==1){
  108. this.list = res.rows
  109. }else{
  110. this.list = this.list.concat(res.rows)
  111. }
  112. } else {
  113. uni.showToast({
  114. title: res.msg,
  115. duration: 1000,
  116. icon: 'none'
  117. });
  118. }
  119. })
  120. },
  121. //刷新
  122. bot_btn() {
  123. if (this.haveMore) {
  124. this.formData.pageNum++
  125. this.lists(this.formData)
  126. }
  127. },
  128. }
  129. }
  130. </script>
  131. <style lang="scss" scoped>
  132. .index{display: flex;flex-direction: column;height: 100vh;overflow: hidden;
  133. .indextop{flex: 0 0 auto;}
  134. }
  135. .probox{background: #FFFFFF;width: 100%;box-sizing: border-box;flex: 1;box-sizing: border-box;overflow: hidden;
  136. .prolist{padding: 20rpx 0rpx;border-bottom: 2rpx solid #e6e2e2;display: flex;align-items: center;width: 100%;
  137. .protit{font-size: 28rpx;color:#343434;flex: 1;}
  138. .prorimg{width:16rpx;height: 24rpx;flex: 0 0 auto;margin-left: 20rpx;}
  139. }
  140. }
  141. .scroll-view {
  142. height: 100%;
  143. padding: 0 30rpx;
  144. box-sizing: border-box;
  145. width: 100%;
  146. // max-height: calc(100vh - 401upx);
  147. }
  148. .shax {
  149. // height: 83upx;
  150. font-size: 25upx;
  151. color: #666;
  152. text-align: center;
  153. padding: 20rpx 0;
  154. }
  155. //暂无数据
  156. .zanwu {
  157. text-align: center;
  158. padding-top: 20upx;
  159. span {
  160. font-size: 24upx;
  161. }
  162. }
  163. .sous_sear{
  164. padding: 24rpx 34rpx;background: #FFFFFF;display: flex;
  165. .sous_box{height:88rpx;background: #F2F2F2;border-radius: 6rpx;display: flex;align-items: center;padding: 0 34rpx;box-sizing: border-box;flex: 1;
  166. .sous_img{width: 32rpx;height: 34rpx;margin-right: 18rpx;flex: 0 0 auto;}
  167. .sous_input{font-size: 30rpx;color: #333333;flex: 1;}
  168. }
  169. .sous_btn{
  170. flex: 0 0 auto;
  171. width: 118rpx;
  172. height: 88rpx;
  173. background: #009FE8;
  174. border-radius: 7rpx;
  175. margin-left: 30rpx;font-size: 32rpx;color: #FFFFFF;line-height: 88rpx;text-align: center;
  176. }
  177. }
  178. </style>