policyInfo.vue 4.5 KB

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