policyInfo.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  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"
  27. border-radius="10" />
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. </z-paging>
  33. <view class="policybtn">
  34. <view class="policybtn-container">
  35. <view class="policybtn-content">
  36. <view>
  37. <u-button type="primary" @click="policySubmitBtnClick" class="policysubmitbtn">政策咨询</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({ type: 2 }).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. type: 2
  100. }
  101. });
  102. }
  103. },
  104. swiperChange(index) {
  105. // this.policyInfoTitle = this.bannerList[index]?.name || '';
  106. },
  107. /**
  108. * 获取列表
  109. * @param { Number } idx
  110. * @param { Number } pageNum
  111. * @param { Number } pageSize
  112. * @param { Number } artCategoryId
  113. */
  114. getList(idx, pageNum, pageSize, artCategoryId) {
  115. this.$u.api.policyInfo.getPolicyInfoList({
  116. pageNum,
  117. pageSize,
  118. artCategoryId
  119. }).then(res => {
  120. if (res.code === 200) {
  121. this.$refs.policyInfoPaging.complete(res.rows || []);
  122. } else {
  123. uni.showToast({
  124. icon: 'none',
  125. title: res.msg
  126. });
  127. this.$refs.policyInfoPaging.complete([]);
  128. }
  129. }).catch(err => {
  130. // console.log("err: ",err);
  131. uni.showToast({
  132. title: '系统异常!',
  133. type: 'error'
  134. });
  135. this.$refs.policyInfoPaging.complete([]);
  136. });
  137. },
  138. // tab栏切换
  139. tabsChange(index) {
  140. this.tabCurrent = index;
  141. this.getList(index, 1, 10, this.tabsList[index]?.text);
  142. },
  143. /**
  144. * 列表加载触发
  145. */
  146. policyInfoQueryList(pageNo, pageSize) {
  147. if (this.tabsList.length > 0) {
  148. this.getList(this.tabCurrent, pageNo, pageSize, this.tabsList[this.tabCurrent]?.text);
  149. }
  150. },
  151. /**
  152. * 政策咨询
  153. */
  154. policySubmitBtnClick() {
  155. let url =
  156. `${this.config.timChatUrl}?userID=${this.vuex_user.userId}&title=政策咨询&permission=1&type=retire`
  157. this.$u.route({
  158. url: '/pages/webView/webView',
  159. params: {
  160. url: encodeURIComponent(url)
  161. }
  162. })
  163. }
  164. }
  165. }
  166. </script>
  167. <style lang="scss" scoped>
  168. @import './scss/policyInfo.scss'
  169. </style>