policyInfo.vue 5.6 KB

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