Index.vue 5.0 KB

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