policy.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <template>
  2. <view class="policy main-bg">
  3. <view v-if="show">
  4. <image class="header-img" src="../../../static/img.png"></image>
  5. <view class="list main-bg" v-if="list.length > 0">
  6. <view class="item" v-for="item in list" @click="goto(item)">
  7. <image class="item-img" src="/static/new.png"></image>
  8. <view class="item-right">
  9. <view class="item-right-name font-twenty font-color3">{{ item.noticeTitle ? item.noticeTitle : '' }}</view>
  10. <view class="item-right-time font-twenty-four font-color4">{{ item.createTime ? item.createTime : '' }}</view>
  11. </view>
  12. </view>
  13. </view>
  14. <view v-else>
  15. <u-empty text="暂无数据" mode="list"></u-empty>
  16. </view>
  17. </view>
  18. <view v-else>
  19. <view class="list-people main-bg" v-if="list.length > 0">
  20. <view class="item-people" v-for="item in list" @click="goto(item)">
  21. <image class="people-img" :src="image(item.picUrl)"></image>
  22. <view> {{ item.noticeTitle }}</view>
  23. </view>
  24. </view>
  25. <view v-else>
  26. <u-empty text="暂无数据" mode="list"></u-empty>
  27. </view>
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. import http from '@/common/http.js'
  33. import server from "@/api/index";
  34. export default {
  35. data() {
  36. return {
  37. list:[],
  38. show: false,
  39. type: null
  40. }
  41. },
  42. onLoad(e) {
  43. this.type = e.type;
  44. if(e.type === '004' || e.type === '005'){
  45. this.show = false;
  46. }else{
  47. this.show = true;
  48. }
  49. uni.startPullDownRefresh();
  50. },
  51. onPullDownRefresh() {
  52. this.getListFn();
  53. setTimeout(function () {
  54. uni.stopPullDownRefresh();
  55. }, 1000);
  56. },
  57. methods: {
  58. image(e) {
  59. return http.webUrl + e
  60. },
  61. getListFn(){
  62. server.getInfo({ noticeType: this.type }).then(res => {
  63. this.list = [];
  64. if(res){
  65. this.list = res
  66. }
  67. })
  68. },
  69. goto(item){
  70. uni.navigateTo({
  71. url: '/pages/soldier/home/detail?id=' + item.noticeId
  72. });
  73. }
  74. }
  75. }
  76. </script>
  77. <style lang="scss" scoped>
  78. .policy{
  79. width: 100%;
  80. min-height: 100vh;
  81. height: auto;
  82. .header-img{
  83. width: 100%;
  84. height: 392rpx;
  85. }
  86. .list{
  87. width: 100%;
  88. padding: 0rpx 30rpx;
  89. .item{
  90. height: 240rpx;
  91. background: #FFFFFF;
  92. padding: 30rpx;
  93. margin-top: 30rpx;
  94. display: flex;
  95. .item-img{
  96. width: 180rpx;
  97. height: 180rpx;
  98. }
  99. .item-right{
  100. width: calc(100% - 180rpx);
  101. padding-left: 30rpx;
  102. padding-top: 10rpx;
  103. .item-right-name{
  104. font-weight: 550;
  105. letter-spacing: 2rpx;
  106. line-height: 40rpx;
  107. height: 80rpx;
  108. text-overflow: -o-ellipsis-lastline;
  109. overflow: hidden;
  110. text-overflow: ellipsis;
  111. display: -webkit-box;
  112. -webkit-line-clamp: 2;
  113. -webkit-box-orient: vertical;
  114. }
  115. .item-right-time{
  116. padding-top: 20rpx;
  117. }
  118. }
  119. }
  120. }
  121. .list-people{
  122. width: 100%;
  123. padding: 30rpx 30rpx;
  124. display: flex;
  125. justify-content: space-between;
  126. flex-wrap: wrap;
  127. .item-people{
  128. width: calc(50% - 15rpx);
  129. height: 370rpx;
  130. margin-bottom: 20rpx;
  131. overflow: hidden;
  132. .people-img{
  133. width: 100%;
  134. height: 320rpx;
  135. border-radius: 16rpx;
  136. }
  137. .people-name{
  138. width: 100%;
  139. height: 50rpx;
  140. line-height: 50rpx;
  141. text-align: center;
  142. overflow: hidden;
  143. }
  144. }
  145. }
  146. }
  147. </style>