index.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <script setup>
  2. import {
  3. ref
  4. } from "vue";
  5. import {
  6. onLoad,
  7. } from "@dcloudio/uni-app";
  8. import {
  9. getIntermediaryType,
  10. } from "@/api/work/intermediaryService.js";
  11. // 获取种类
  12. let loading = ref(true);
  13. let kindList = ref([]);
  14. const getKindList = () => {
  15. loading.value = true
  16. getIntermediaryType().then(res => {
  17. loading.value = false;
  18. kindList.value = res.data.type;
  19. }).catch(() => {
  20. loading.value = false;
  21. })
  22. };
  23. // 跳转页面
  24. const goToPage = (id, title) => {
  25. uni.navigateTo({
  26. url: `/pages/intermediaryService/index?id=${id}&title=${title}`
  27. })
  28. };
  29. onLoad(() => {
  30. getKindList();
  31. })
  32. </script>
  33. <template>
  34. <view class="container">
  35. <page-title>中介服务库</page-title>
  36. <view class="bg">
  37. <view class="search">
  38. <view class="search-item" v-for="(item,index) in kindList" :key="index" @click="goToPage(item.id,item.title)">
  39. <view class="search-item-icon"></view>
  40. <view class="search-item-text">{{item.title??"--"}}</view>
  41. </view>
  42. </view>
  43. </view>
  44. <u-loading-page :loading="loading"></u-loading-page>
  45. </view>
  46. </template>
  47. <style lang="scss" scoped>
  48. .bg {
  49. position: absolute;
  50. top: 5%;
  51. left: 0;
  52. width: 100%;
  53. min-height: 95%;
  54. padding-top: 100rpx;
  55. // border-radius: 40rpx 40rpx 0rpx 0rpx;
  56. background-color: #fff;
  57. }
  58. .search {
  59. display: flex;
  60. flex-wrap: wrap;
  61. gap: 40rpx;
  62. .search-item {
  63. width: 220rpx;
  64. height: 188rpx;
  65. .search-item-icon {
  66. width: 96rpx;
  67. height: 78rpx;
  68. margin: 38rpx auto 40rpx;
  69. background-image: url('@/static/policy-file.png');
  70. background-size: 100% 100%;
  71. }
  72. .search-item-text {
  73. max-width: 146rpx;
  74. min-height: 40rpx;
  75. margin: 0 auto;
  76. text-align: center;
  77. line-height: 40rpx;
  78. font-weight: 400;
  79. color: #343437;
  80. font-size: 24rpx;
  81. background: #E2ECFF;
  82. border-radius: 8rpx
  83. }
  84. }
  85. }
  86. </style>