policyInfo.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  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 class="policyInfo-foot">
  75. <view class="policyInfo-foot-container">
  76. <u-button type="primary" class="policybtn">政策咨询</u-button>
  77. </view>
  78. </view>
  79. </view>
  80. </template>
  81. <script>
  82. export default {
  83. data() {
  84. return {
  85. bannerList: [],
  86. tabsSwiperList: [
  87. {
  88. name: '法律'
  89. },
  90. {
  91. name: '行政法规'
  92. },
  93. {
  94. name: '部门规章'
  95. }
  96. ],
  97. current: 0,
  98. swiperCurrent: 0,
  99. loadStatus: ['loadmore','loadmore','loadmore'],
  100. dataList: [
  101. [],
  102. [
  103. {
  104. id: 1,
  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. id: 2,
  125. title: '退役士兵安置条例',
  126. imgUrl: require('@/static/jpeg/a72f1cb8e19d649902859638ea458812.jpg'),
  127. }
  128. ],
  129. []
  130. ]
  131. }
  132. },
  133. onLoad() {
  134. this.getDataList(0);
  135. },
  136. onShow() {
  137. this.getBannerList();
  138. },
  139. methods: {
  140. getBannerList(){
  141. this.$u.api.getIndexBannerList()
  142. .then(res=>{
  143. if(!res) return;
  144. this.bannerList = res?.data || [];
  145. this.bannerList = [];
  146. this.bannerList.push(
  147. {
  148. bannerUrl: require('@/static/jpeg/e2f3c933be411c565ec65cd49e832ac8.jpeg'),
  149. content: '<p>代码固定测试内容999998</p>',
  150. id: "999998",
  151. name: "代码固定测试999998"
  152. }
  153. );
  154. this.bannerList.push(
  155. {
  156. bannerUrl: require('@/static/jpeg/836ee345ca125ef429c04cfbabac0154.jpeg'),
  157. content: '<p>代码固定测试内容999999</p>',
  158. id: "999999",
  159. name: "代码固定测试999999"
  160. }
  161. );
  162. console.log('bannerList',JSON.parse(JSON.stringify(res)));
  163. })
  164. },
  165. // 轮播图点击
  166. swiperClick (index) {
  167. // console.log('swiperClick',index);
  168. if(this.bannerList[index].jumpUrl){
  169. let url = this.bannerList[index].jumpUrl.split('#')[1];
  170. this.$u.route({
  171. url: url,
  172. });
  173. }else{
  174. this.$u.route({
  175. url: 'pages/bannerDetails/bannerDetails',
  176. params: {
  177. id: this.bannerList[index].id
  178. }
  179. })
  180. }
  181. },
  182. // 页面数据
  183. getDataList(idx) {
  184. this.loadStatus.splice(idx,1,"nomore")
  185. },
  186. // tab栏切换
  187. tabsSwiperChange(index) {
  188. this.swiperCurrent = index;
  189. this.getDataList(index);
  190. },
  191. transition({ detail: { dx } }) {
  192. this.$refs.policyInfoTabsSwiper.setDx(dx);
  193. },
  194. animationfinish({ detail: { current } }) {
  195. this.$refs.policyInfoTabsSwiper.setFinishCurrent(current);
  196. this.swiperCurrent = current;
  197. this.current = current;
  198. },
  199. reachBottom() {
  200. this.loadStatus.splice(this.current,1,"loading");
  201. setTimeout(() => {
  202. this.getDataList(this.current);
  203. }, 1200);
  204. },
  205. }
  206. }
  207. </script>
  208. <style lang="scss"
  209. scoped>
  210. @import './scss/policyInfo.scss'
  211. </style>