policyInfo.vue 4.5 KB

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