policyInfo.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <!--
  2. * @title 政策资讯
  3. * @author Rockery(1113269755@qq.com)
  4. -->
  5. <template>
  6. <view class="policyInfo">
  7. <view class="policyInfo-banner">
  8. <u-swiper
  9. :list="bannerList"
  10. name="bannerUrl"
  11. border-radius="0"
  12. mode="round"
  13. height="440"
  14. img-mode="scaleToFill"
  15. @click="swiperClick"
  16. ></u-swiper>
  17. </view>
  18. <view class="policyInfo-title">
  19. <view>中华人民共和国英雄烈士保护法</view>
  20. </view>
  21. <view class="policyInfo-wrap">
  22. <view class="u-tabs-box policyInfo-tabsswiper">
  23. <u-tabs-swiper bg-color="transparent" ref="policyInfoTabsSwiper" :list="tabsSwiperList" :current="current" @change="tabsSwiperChange" :is-scroll="false"></u-tabs-swiper>
  24. </view>
  25. <swiper class="swiper-box" :current="swiperCurrent" @transition="transition" @animationfinish="animationfinish">
  26. <swiper-item class="swiper-item">
  27. <scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom">
  28. <view class="page-box">
  29. <view class="policyInfo-container" v-for="(lawItem, index) in dataList[0]" :key="index + 'lawItem'">
  30. <view class="item">
  31. <view class="title">{{lawItem.title}}</view>
  32. <view class="item-image">
  33. <image :src="lawItem.imgUrl" mode="aspectFill" class="image"></image>
  34. </view>
  35. </view>
  36. </view>
  37. <u-loadmore :status="loadStatus[0]" bgColor="#f2f2f2"></u-loadmore>
  38. </view>
  39. </scroll-view>
  40. </swiper-item>
  41. <swiper-item class="swiper-item">
  42. <scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom">
  43. <view class="page-box">
  44. <view class="policyInfo-container" v-for="(administrativeItem, index) in dataList[1]" :key="index + 'administrativeItem'">
  45. <view class="item">
  46. <view class="title">{{administrativeItem.title}}</view>
  47. <view class="item-image">
  48. <image :src="administrativeItem.imgUrl" mode="aspectFill" class="image"></image>
  49. </view>
  50. </view>
  51. </view>
  52. <u-loadmore :status="loadStatus[1]" bgColor="#f2f2f2"></u-loadmore>
  53. </view>
  54. </scroll-view>
  55. </swiper-item>
  56. </swiper-item>
  57. <swiper-item class="swiper-item">
  58. <scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom">
  59. <view class="page-box">
  60. <view class="policyInfo-container" v-for="(regulationsItem, index) in dataList[2]" :key="index + 'regulationsItem'">
  61. <view class="item">
  62. <view class="title">{{regulationsItem.title}}</view>
  63. <view class="item-image">
  64. <image :src="regulationsItem.imgUrl" mode="aspectFill" class="image"></image>
  65. </view>
  66. </view>
  67. </view>
  68. <u-loadmore :status="loadStatus[2]" bgColor="#f2f2f2"></u-loadmore>
  69. </view>
  70. </scroll-view>
  71. </swiper-item>
  72. </swiper>
  73. </view>
  74. </view>
  75. </template>
  76. <script>
  77. export default {
  78. data() {
  79. return {
  80. bannerList: [],
  81. tabsSwiperList: [
  82. {
  83. name: '法律'
  84. },
  85. {
  86. name: '行政法规'
  87. },
  88. {
  89. name: '部门规章'
  90. }
  91. ],
  92. current: 0,
  93. swiperCurrent: 0,
  94. loadStatus: ['loadmore','loadmore','loadmore'],
  95. dataList: [
  96. [],
  97. [
  98. {
  99. id: 1,
  100. title: '退役士兵安置条例',
  101. imgUrl: require('@/static/jpeg/a72f1cb8e19d649902859638ea458812.jpg'),
  102. },
  103. {
  104. id: 2,
  105. title: '军人抚恤优待条例',
  106. imgUrl: require('@/static/jpeg/a72f1cb8e19d649902859638ea458812.jpg'),
  107. },
  108. {
  109. id: 2,
  110. title: '烈士褒扬条例',
  111. imgUrl: require('@/static/jpeg/a72f1cb8e19d649902859638ea458812.jpg'),
  112. },
  113. {
  114. id: 2,
  115. title: '军队专业干部安置暂行办法',
  116. imgUrl: require('@/static/jpeg/a72f1cb8e19d649902859638ea458812.jpg'),
  117. },
  118. {
  119. id: 2,
  120. title: '退役士兵安置条例',
  121. imgUrl: require('@/static/jpeg/a72f1cb8e19d649902859638ea458812.jpg'),
  122. }
  123. ],
  124. []
  125. ]
  126. }
  127. },
  128. onLoad() {
  129. this.getDataList(0);
  130. },
  131. onShow() {
  132. this.getBannerList();
  133. },
  134. methods: {
  135. getBannerList(){
  136. this.$u.api.getIndexBannerList()
  137. .then(res=>{
  138. if(!res) return;
  139. this.bannerList = res?.data || [];
  140. this.bannerList = [];
  141. this.bannerList.push(
  142. {
  143. bannerUrl: require('@/static/jpeg/e2f3c933be411c565ec65cd49e832ac8.jpeg'),
  144. content: '<p>代码固定测试内容999998</p>',
  145. id: "999998",
  146. name: "代码固定测试999998"
  147. }
  148. );
  149. this.bannerList.push(
  150. {
  151. bannerUrl: require('@/static/jpeg/836ee345ca125ef429c04cfbabac0154.jpeg'),
  152. content: '<p>代码固定测试内容999999</p>',
  153. id: "999999",
  154. name: "代码固定测试999999"
  155. }
  156. );
  157. console.log('bannerList',JSON.parse(JSON.stringify(res)));
  158. })
  159. },
  160. // 轮播图点击
  161. swiperClick (index) {
  162. // console.log('swiperClick',index);
  163. if(this.bannerList[index].jumpUrl){
  164. let url = this.bannerList[index].jumpUrl.split('#')[1];
  165. this.$u.route({
  166. url: url,
  167. });
  168. }else{
  169. this.$u.route({
  170. url: 'pages/bannerDetails/bannerDetails',
  171. params: {
  172. id: this.bannerList[index].id
  173. }
  174. })
  175. }
  176. },
  177. // 页面数据
  178. getDataList(idx) {
  179. this.loadStatus.splice(idx,1,"nomore")
  180. },
  181. // tab栏切换
  182. tabsSwiperChange(index) {
  183. this.swiperCurrent = index;
  184. this.getDataList(index);
  185. },
  186. transition({ detail: { dx } }) {
  187. this.$refs.policyInfoTabsSwiper.setDx(dx);
  188. },
  189. animationfinish({ detail: { current } }) {
  190. this.$refs.policyInfoTabsSwiper.setFinishCurrent(current);
  191. this.swiperCurrent = current;
  192. this.current = current;
  193. },
  194. reachBottom() {
  195. this.loadStatus.splice(this.current,1,"loading");
  196. setTimeout(() => {
  197. this.getDataList(this.current);
  198. }, 1200);
  199. },
  200. }
  201. }
  202. </script>
  203. <style lang="scss"
  204. scoped>
  205. @import './scss/policyInfo.scss'
  206. </style>