policyInfo.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. <!--
  2. * @title 政策资讯
  3. * @author Rockery(1113269755@qq.com)
  4. -->
  5. <template>
  6. <view class="policyInfo">
  7. <z-paging ref="policyInfoPaging" v-model="policyInfoList" @query="policyInfoQueryList">
  8. <view class="policyInfo-banner" slot="top">
  9. <u-swiper :list="bannerList" name="bannerUrl" border-radius="0" mode="round" height="372"
  10. img-mode="scaleToFill" @click="swiperClick" @change="swiperChange"></u-swiper>
  11. </view>
  12. <view class="policyInfo-title" slot="top">
  13. <view>{{ policyInfoTitle }}</view>
  14. </view>
  15. <!-- u-tabs-swiper -->
  16. <view class="policyInfo-tabsswiper" slot="top">
  17. <u-tabs bg-color="transparent" :list="tabsList" name="label" :is-scroll="true" :current="tabCurrent"
  18. font-size="30" @change="tabsChange" />
  19. </view>
  20. <view class="policyInfo-list">
  21. <view class="list-container" v-for="(item, index) in policyInfoList" :key="index + 'policyInfoList'"
  22. @click="$u.route('/pages/policyInfo/policyInfoDetails',{artId:item.artId})">
  23. <view class="item">
  24. <view class="title">{{item.artTitle}}</view>
  25. <view class="item-image">
  26. <u-image :src="item.artImage" mode="aspectFill" class="image" width="128" height="102" border-radius="10"/>
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. </z-paging>
  32. <view class="policybtn">
  33. <view class="policybtn-container">
  34. <view class="policybtn-content">
  35. <view>
  36. <u-button type="primary" @click="policySubmitBtnClick" class="policysubmitbtn">政策咨询(0851-863789)
  37. </u-button>
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. </template>
  44. <script>
  45. export default {
  46. data() {
  47. return {
  48. bannerList: [],
  49. policyInfoTitle: '中华人民共和国英雄烈士保护法',
  50. // 政策资讯列表
  51. policyInfoList: [],
  52. tabsList: [],
  53. tabCurrent: 0
  54. }
  55. },
  56. onLoad() {
  57. this.getPolicyType();
  58. },
  59. onShow() {
  60. this.getBannerList();
  61. },
  62. methods: {
  63. /**
  64. * 获取政策资讯类别
  65. */
  66. getPolicyType() {
  67. this.$u.api.getDictdataUrl({
  68. key: 'policy_type'
  69. }).then(res => {
  70. if (res.code == 200) {
  71. this.tabsList = res.data;
  72. this.getList(0, 1, 10, this.tabsList[0].text);
  73. } else {
  74. uni.showToast({
  75. icon: 'none',
  76. title: res.msg
  77. });
  78. }
  79. });
  80. },
  81. getBannerList() {
  82. this.$u.api.indexApi.indexBannerListApi().then(res => {
  83. if (!res) return;
  84. this.bannerList = res?.data || [];
  85. })
  86. },
  87. // 轮播图点击
  88. swiperClick(index) {
  89. if (this.bannerList[index].jumpUrl) {
  90. let url = this.bannerList[index].jumpUrl.split('#')[1];
  91. this.$u.route({
  92. url: url,
  93. });
  94. } else {
  95. this.$u.route({
  96. url: 'pages/bannerDetails/bannerDetails',
  97. params: {
  98. id: this.bannerList[index].id
  99. }
  100. });
  101. }
  102. },
  103. swiperChange(index) {
  104. // this.policyInfoTitle = this.bannerList[index]?.name || '';
  105. },
  106. /**
  107. * 获取列表
  108. * @param { Number } idx
  109. * @param { Number } pageNum
  110. * @param { Number } pageSize
  111. * @param { Number } artCategoryId
  112. */
  113. getList(idx, pageNum, pageSize, artCategoryId) {
  114. this.$u.api.policyInfo.getPolicyInfoList({
  115. pageNum,
  116. pageSize,
  117. artCategoryId
  118. }).then(res => {
  119. if (res.code === 200) {
  120. this.$refs.policyInfoPaging.complete(res.rows || []);
  121. } else {
  122. uni.showToast({
  123. icon: 'none',
  124. title: res.msg
  125. });
  126. this.$refs.policyInfoPaging.complete([]);
  127. }
  128. }).catch(err => {
  129. // console.log("err: ",err);
  130. uni.showToast({
  131. title: '系统异常!',
  132. type: 'error'
  133. });
  134. this.$refs.policyInfoPaging.complete([]);
  135. });
  136. },
  137. // tab栏切换
  138. tabsChange(index) {
  139. this.tabCurrent = index;
  140. this.getList(index, 1, 10, this.tabsList[index]?.text);
  141. },
  142. /**
  143. * 列表加载触发
  144. */
  145. policyInfoQueryList(pageNo, pageSize) {
  146. if (this.tabsList.length > 0) {
  147. this.getList(this.tabCurrent, pageNo, pageSize, this.tabsList[this.tabCurrent]?.text);
  148. }
  149. },
  150. /**
  151. * 政策咨询事件
  152. */
  153. policySubmitBtnClick() {
  154. this.$u.route({
  155. url: 'pages/questionConsulting/questionConsulting',
  156. params: {
  157. id: '9999'
  158. }
  159. });
  160. }
  161. }
  162. }
  163. </script>
  164. <style lang="scss" scoped>
  165. @import './scss/policyInfo.scss'
  166. </style>