Index.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <template>
  2. <view class="container">
  3. <view class="tabBox">
  4. <view class="tabItem" v-for="(item, index) in industryData" :key="index" :class="industryID == item.id ? 'active' : ''" @tap="onChangeState(item)">{{item.name}}</view>
  5. </view>
  6. <view class="hazardPublicityBox">
  7. <view class="hazardPublicityInfo" @tap="onHazardPublicityTo()">
  8. <view class="hazardPublicityTitle">
  9. <text>点击查看线索公示</text>
  10. <text>>></text>
  11. </view>
  12. </view>
  13. </view>
  14. <view class="contentBox">
  15. <z-paging ref="paging" v-model="noticeListData" @query="onGetNoticeNewsInfo" refresher-update-time-key="noticeList" :auto="false">
  16. <view class="listInfoBox">
  17. <view class="listInfo" v-for="(item, index) in noticeListData" :key="index" @tap="onNoticeViewTo(item.id)">
  18. <view class="listTitle">{{item.title}}</view>
  19. <view class="listContent" v-if="item.content">
  20. <image class="listContentImg" src="/static/img/common/noticeIcon.png"></image>
  21. <view class="listContentText">{{item.content}}</view>
  22. </view>
  23. </view>
  24. </view>
  25. </z-paging>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. var that
  31. export default {
  32. data() {
  33. return {
  34. tabIndex: '',
  35. industryData: [],
  36. industryID: '',
  37. industryName: '',
  38. noticeListData: [],
  39. isReLoad: false,
  40. }
  41. },
  42. onLoad() {
  43. that = this;
  44. that.onGetIndustryData(function(){
  45. that.$nextTick(function() {
  46. that.$refs.paging.reload()
  47. })
  48. })
  49. },
  50. methods: {
  51. onGetIndustryData(fun) {
  52. that.$admin.reqDirect({
  53. method: 'GET',
  54. url: '/api/v1/Snapshot/industry'
  55. }).then(res => {
  56. if (res && res.length > 0) {
  57. res.forEach((item, index) => {
  58. if (index == 0){
  59. that.industryID = item.id;
  60. that.industryName = item.name;
  61. }
  62. })
  63. that.industryData = res;
  64. }
  65. typeof fun === 'function' && fun();
  66. }, err => {
  67. that.$util.msg(err);
  68. })
  69. },
  70. onGetNoticeNewsInfo(pageNo, pageSize) {
  71. that.$admin.reqDirect({
  72. method: 'GET',
  73. url: '/api/v1/Snapshot/bulletions?IndustryId=' + that.industryID + '&QueryIndex=' + (pageNo - 1) + '&QueryCount=' + pageSize
  74. }).then(res => {
  75. if (res && res.length > 0) {
  76. res.forEach((item, index) => {
  77. item.creationTime = that.$util.formatTime(new Date(item.creationTime))
  78. })
  79. that.$refs.paging.complete(res);
  80. } else if (res && res.length == 0) {
  81. that.$refs.paging.complete([]);
  82. } else {
  83. that.$util.msg('网络出错!');
  84. that.$refs.paging.complete(false);
  85. }
  86. typeof fun === 'function' && fun();
  87. }, err => {
  88. if (!that.isReLoad) {
  89. that.isReLoad = true;
  90. that.onGetNoticeNewsInfo(pageNo, pageSize);
  91. } else {
  92. that.$util.msg(err);
  93. that.$refs.paging.complete(false);
  94. }
  95. })
  96. },
  97. // 切换状态
  98. onChangeState(obj) {
  99. if (that.industryID != obj.id){
  100. that.industryID = obj.id;
  101. that.industryName = obj.name;
  102. that.$refs.paging.reload();
  103. }
  104. },
  105. onNoticeViewTo(id) {
  106. uni.navigateTo({
  107. url: '/pagesBase/Notice/View?id=' + encodeURIComponent(id)
  108. })
  109. },
  110. onHazardPublicityTo(){
  111. uni.navigateTo({
  112. url: '/pagesBase/Notice/HazardPublicity?industryID=' + encodeURIComponent(that.industryID) + '&industryName=' + encodeURIComponent(that.industryName)
  113. })
  114. }
  115. }
  116. }
  117. </script>
  118. <style>
  119. .container {
  120. background-color: #f3f3f3;
  121. }
  122. .tabBox {
  123. background-color: #3e6ffd;
  124. padding: 0 20rpx;
  125. line-height: 48rpx;
  126. overflow-x: auto;
  127. white-space: nowrap;
  128. }
  129. .tabItem {
  130. padding: 20rpx 30rpx;
  131. margin: 16rpx 0;
  132. display: inline-block;
  133. width: auto;
  134. text-align: center;
  135. color: #fff;
  136. background-color: #6d91ff;
  137. font-size: 28rpx;
  138. position: relative;
  139. border-radius: 20rpx;
  140. }
  141. .tabItem + .tabItem{
  142. margin-left: 30rpx;
  143. }
  144. .active {
  145. color: #3e6ffd;
  146. background-color: #fff;
  147. font-weight: bold;
  148. box-shadow: 4rpx 5rpx 12rpx 0rpx #243979;
  149. }
  150. .hazardPublicityBox{
  151. color: #3e6ffd;
  152. margin: 30rpx 20rpx 0;
  153. }
  154. .hazardPublicityInfo{
  155. padding: 30rpx;
  156. border-radius: 10rpx;
  157. background-color: #fff;
  158. }
  159. .hazardPublicityTitle{
  160. color: #04a8f0;
  161. width: 100%;
  162. line-height: 46rpx;
  163. font-size: 28rpx;
  164. font-weight: bold;
  165. border-bottom: 2rpx #f1f1f1 solid;
  166. padding-bottom: 20rpx;
  167. display: flex;
  168. justify-content: space-between;
  169. align-items: center;
  170. }
  171. .contentBox {
  172. position: relative;
  173. height: calc(100vh - 250rpx);
  174. }
  175. .listInfo {
  176. margin: 30rpx 20rpx;
  177. padding: 30rpx;
  178. border-radius: 10rpx;
  179. background-color: #fff;
  180. }
  181. .listTitle {
  182. color: #000405;
  183. width: 100%;
  184. line-height: 46rpx;
  185. font-size: 32rpx;
  186. font-weight: bold;
  187. border-bottom: 2rpx #f1f1f1 solid;
  188. padding-bottom: 20rpx;
  189. white-space: nowrap;
  190. overflow: hidden;
  191. text-overflow: ellipsis;
  192. }
  193. .listContent{
  194. position: relative;
  195. padding-top: 20rpx;
  196. font-size: 28rpx;
  197. }
  198. .listContentImg{
  199. width: 40rpx;
  200. height: 40rpx;
  201. position: absolute;
  202. top: 24rpx;
  203. left: 0rpx;
  204. }
  205. .listContentText{
  206. padding-left: 50rpx;
  207. color: #333;
  208. line-height: 46rpx;
  209. white-space: pre-line;
  210. overflow: hidden;
  211. text-overflow: ellipsis;
  212. display: -webkit-box;
  213. -webkit-box-orient: vertical;
  214. /*行向垂直排列*/
  215. -webkit-line-clamp: 2;
  216. }
  217. </style>