policyInfo.vue 5.1 KB

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