policyInfo.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <!--
  2. * @title 政策资讯
  3. * @author Rockery(1113269755@qq.com)
  4. -->
  5. <template>
  6. <view class="policyInfo">
  7. <z-paging ref="paging"
  8. v-model="policyInfoList"
  9. @query="queryList">
  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 dataList"
  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. dataList: []
  76. }
  77. },
  78. onLoad() {
  79. this.getPolicyType();
  80. },
  81. onShow() {
  82. this.getBannerList();
  83. },
  84. methods: {
  85. /**
  86. * 获取政策资讯类别
  87. */
  88. getPolicyType() {
  89. this.$u.api.getDictdataUrl({
  90. key: 'policy_type'
  91. }).then(res => {
  92. if (res.code == 200) {
  93. this.tabsList = res.data;
  94. this.getList(0, 1, 10, this.tabsList[0].text);
  95. } else {
  96. uni.showToast({
  97. icon: 'none',
  98. title: res.msg
  99. });
  100. }
  101. });
  102. },
  103. getBannerList() {
  104. this.$u.api.getIndexBannerList()
  105. .then(res => {
  106. if (!res) return;
  107. this.bannerList = res?.data || [];
  108. this.bannerList = [];
  109. this.bannerList.push({
  110. bannerUrl: require('@/static/jpeg/e2f3c933be411c565ec65cd49e832ac8.jpeg'),
  111. content: '<p>代码固定测试内容999998</p>',
  112. id: "999998",
  113. name: "代码固定测试999998"
  114. });
  115. this.bannerList.push({
  116. bannerUrl: require('@/static/jpeg/836ee345ca125ef429c04cfbabac0154.jpeg'),
  117. content: '<p>代码固定测试内容999999</p>',
  118. id: "999999",
  119. name: "代码固定测试999999"
  120. });
  121. // console.log('bannerList',JSON.parse(JSON.stringify(res)));
  122. })
  123. },
  124. // 轮播图点击
  125. swiperClick(index) {
  126. if (this.bannerList[index].jumpUrl) {
  127. let url = this.bannerList[index].jumpUrl.split('#')[1];
  128. this.$u.route({
  129. url: url,
  130. });
  131. } else {
  132. this.$u.route({
  133. url: 'pages/bannerDetails/bannerDetails',
  134. params: {
  135. id: this.bannerList[index].id
  136. }
  137. });
  138. }
  139. },
  140. swiperChange(index) {
  141. // this.policyInfoTitle = this.bannerList[index]?.name || '';
  142. },
  143. /**
  144. * 获取列表
  145. * @param { Number } idx
  146. * @param { Number } pageNum
  147. * @param { Number } pageSize
  148. * @param { Number } artCategoryId
  149. */
  150. getList(idx, pageNum, pageSize, artCategoryId) {
  151. this.$u.api.policyInfo.getPolicyInfoList({
  152. pageNum,
  153. pageSize,
  154. artCategoryId
  155. }).then(res => {
  156. if (res.code === 200) {
  157. this.dataList = res.rows;
  158. } else {
  159. uni.showToast({
  160. icon: 'none',
  161. title: res.msg
  162. });
  163. }
  164. }).catch(err => {
  165. // console.log("err: ",err);
  166. uni.showToast({
  167. title: '系统异常!',
  168. type: 'error'
  169. });
  170. });
  171. },
  172. // tab栏切换
  173. tabsChange(index) {
  174. this.tabCurrent = index;
  175. this.getList(index, 1, 10, this.tabsList[index]?.text);
  176. },
  177. /**
  178. * 列表加载触发
  179. */
  180. queryList(pageNo, pageSize) {
  181. if (this.tabsList.length > 0) {
  182. this.getList(this.tabCurrent, pageNo, pageSize, this.tabsList[this.tabCurrent]?.text);
  183. }
  184. },
  185. /**
  186. * 政策咨询事件
  187. */
  188. policySubmitBtnClick() {
  189. this.$u.route({
  190. url: 'pages/questionConsulting/questionConsulting',
  191. params: {
  192. id: '9999'
  193. }
  194. });
  195. }
  196. }
  197. }
  198. </script>
  199. <style lang="scss"
  200. scoped>
  201. @import './scss/policyInfo.scss'
  202. </style>