index.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <template>
  2. <div class="industrialPolicy">
  3. <div class="peripheralBody">
  4. <van-tabs :active="active" @change="onChange">
  5. <!-- <van-tab title="全部" :name="0"></van-tab>-->
  6. <van-tab :title="item.name" :name="item.id" v-for="(item,index) in typeList"></van-tab>
  7. </van-tabs>
  8. <div class="peripheralBox">
  9. <div class="peripheralItem" v-for="item in peripheralList" @tap="toDetail(item)">
  10. <span class="peripheralName">{{item.title}}</span>
  11. <div class="peripheralItemRow2">{{item.releaseTime}} &nbsp;|&nbsp; 园区管委会</div>
  12. <div class="tagBox">
  13. <span class="periTag" v-for="tag in item.policySmallName">{{tag}}</span>
  14. </div>
  15. </div>
  16. </div>
  17. </div>
  18. </div>
  19. </template>
  20. <script>
  21. import { policyList,getUserLocalStorageInfo,policyListAll } from "@/js_sdk/http.js";
  22. export default {
  23. name: "peripheralService",
  24. data(){
  25. return{
  26. active: '',
  27. peripheralList:[
  28. {name:'关于入住企业规模发展奖励',type:['小类','大类']},
  29. {name:'关于入住企业规模发展奖励',type:['小类','大类']},
  30. ],
  31. typeList:[],
  32. userId:getUserLocalStorageInfo().userId,
  33. params: {
  34. pageNum: 1,
  35. pageSize: 10,
  36. policyBig: '', // auth.currUser().id
  37. groupId: '', // 园区
  38. status: 'published'
  39. },
  40. }
  41. },
  42. created(){
  43. this.selectPolicyType()
  44. },
  45. onPullDownRefresh() {
  46. this.peripheralList = []
  47. this.selectData()
  48. setTimeout(function () {
  49. uni.stopPullDownRefresh();
  50. }, 1000);
  51. },
  52. mounted() {
  53. },
  54. methods:{
  55. selectPolicyType() {
  56. policyListAll({}).then((res) => {
  57. console.log(res)
  58. if (res.data) {
  59. this.type = res.data
  60. this.typeList = []
  61. const list = []
  62. list.push({ id: '0', name: '全部' })
  63. res.data.forEach((item) => {
  64. if (item.type === 'big') {
  65. list.push({
  66. id: item.id,
  67. name: item.name,
  68. })
  69. }
  70. })
  71. this.typeList = list
  72. }
  73. this.onChange({detail:{
  74. name:''
  75. }})
  76. })
  77. },
  78. onChange(value) {
  79. console.log(value)
  80. this.peripheralList = []
  81. this.selectData(value.detail.name)
  82. },
  83. selectData(value) {
  84. const _this = this
  85. _this.params.policyBig = value
  86. policyList(_this.params).then((res) => {
  87. console.log(res)
  88. if (res.data) {
  89. res.data.forEach((res) => {
  90. const det = _this.getItemJson(res)
  91. console.log('det',det)
  92. const types = _this.type
  93. const smallNames = []
  94. types.forEach((i) => {
  95. if (det.policySmall){
  96. if (det.policySmall.search(i.id) !== -1) {
  97. smallNames.push(i.name)
  98. }
  99. }
  100. })
  101. det.policySmallName = smallNames
  102. _this.peripheralList.push(det)
  103. })
  104. }
  105. })
  106. },
  107. toDetail(item) {
  108. uni.navigateTo({
  109. url:'/pages/subPackages/industrialPolicy/detail?id='+item.id
  110. })
  111. },
  112. getItemJson(item) {
  113. item.releaseTime = this.$common.transServDate(item.releaseTime)
  114. return item
  115. }
  116. }
  117. }
  118. </script>
  119. <style lang="scss">
  120. .industrialPolicy{
  121. .peripheralBody{
  122. background: white;
  123. margin-top: 24rpx;
  124. padding: 32rpx;
  125. box-sizing: border-box;
  126. height: 1424rpx;
  127. .peripheralBox{
  128. margin-top: 8rpx;
  129. .peripheralItem{
  130. width: 686rpx;
  131. height: 204rpx;
  132. box-sizing: border-box;
  133. border-radius: 16rpx;
  134. background: #F5F7FA;
  135. padding: 32rpx;
  136. margin-top: 24rpx;
  137. .peripheralName{
  138. color:#222222;
  139. font-size: 32rpx;
  140. font-weight: 600;
  141. }
  142. .peripheralItemRow2{
  143. color: #888888;
  144. font-size: 28rpx;
  145. margin-top: 14rpx;
  146. }
  147. .tagBox{
  148. display: flex;
  149. flex-wrap: wrap;
  150. }
  151. .periTag{
  152. display: flex;
  153. align-items: center;
  154. justify-content: center;
  155. width: 92rpx;
  156. height: 48rpx;
  157. background: rgba(3, 101, 249, 0.20);
  158. color: rgba(3, 101, 249, 1);
  159. border-radius: 8rpx;
  160. margin: 16rpx 16rpx 0 0;
  161. font-size: 24rpx;
  162. }
  163. }
  164. }
  165. }
  166. }
  167. </style>