index.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <template>
  2. <view class="content">
  3. <view class="one">
  4. <u-swiper :list="config.file" height="240px" indicator indicatorMode="line" circular></u-swiper>
  5. </view>
  6. <view class="two">
  7. 正在申办
  8. </view>
  9. <view class="thr">
  10. <view class="list" v-for="(item, index) in menuList" :key="index" @click="toCommon(item.route)">
  11. <image class="image" mode="aspectFill" :src="item.file&&item.file.length>0?item.file[0].url:''"></image>
  12. <view class="left">
  13. <view class="name">{{item.title}}</view>
  14. <view class="other">{{item.brief}}</view>
  15. </view>
  16. <view class="right">
  17. <u-icon name="arrow-right" size="20"></u-icon>
  18. </view>
  19. </view>
  20. </view>
  21. </view>
  22. </template>
  23. <script setup lang="ts">
  24. import { getCurrentInstance, ref } from 'vue';
  25. //该依赖已内置不需要单独安装
  26. import { onShow, onPullDownRefresh } from "@dcloudio/uni-app";
  27. // 请求接口
  28. const $api = getCurrentInstance()?.appContext.config.globalProperties.$api;
  29. const $config = getCurrentInstance()?.appContext.config.globalProperties.$config;
  30. // 基本信息
  31. const config = ref({ logo: [], file: [] });
  32. const list = ref([]);
  33. const total = ref(0);
  34. const menuList = ref([]);
  35. onShow(async () => {
  36. await searchConfig();
  37. await searchOther();
  38. await search();
  39. })
  40. // config信息
  41. const searchConfig = async () => {
  42. config.value = uni.getStorageSync('config');
  43. };
  44. // 其他查询信息
  45. const searchOther = async () => {
  46. const res = await $api('module', 'GET', { is_use: '0' });
  47. if (res.errcode === 0) {
  48. menuList.value = res.data
  49. } else {
  50. uni.showToast({
  51. title: res.errmsg || '',
  52. icon: 'error',
  53. });
  54. }
  55. };
  56. // 查询
  57. const search = async () => {
  58. const info = {
  59. skip: 0,
  60. limit: 2,
  61. status: '0'
  62. }
  63. // const res = await $api('car', 'GET', info);
  64. // if (res.errcode === 0) {
  65. // list.value = list.value.concat(res.data)
  66. // total.value = res.total
  67. // } else {
  68. // uni.showToast({
  69. // title: res.errmsg || '',
  70. // icon: 'error',
  71. // });
  72. // }
  73. };
  74. const toCommon = (item) => {
  75. uni.navigateTo({
  76. url: `/pagesHome/search/index?type=${item.type || ''}`
  77. })
  78. };
  79. // 查看详情
  80. const toView = (item) => {
  81. uni.navigateTo({
  82. url: `/pagesHome/car/index?id=${item.id || item._id}`
  83. })
  84. };
  85. </script>
  86. <style lang="scss" scoped>
  87. .content {
  88. display: flex;
  89. flex-direction: column;
  90. background-color: var(--f1Color);
  91. .thr {
  92. margin: 2vw 0;
  93. .list {
  94. display: flex;
  95. justify-content: space-between;
  96. align-items: center;
  97. background-color: var(--mainColor);
  98. margin: 2vw 2vw 0 2vw;
  99. padding: 3vw;
  100. border-radius: 2vw;
  101. .image {
  102. width: 18vw;
  103. height: 18vw;
  104. border-radius: 18vw;
  105. }
  106. .left {
  107. width: 60vw;
  108. .name {
  109. font-weight: bold;
  110. font-size: var(--font16Size);
  111. }
  112. .other {
  113. margin: 2vw 0 0 0;
  114. font-size: var(--font12Size);
  115. color: var(--f85Color);
  116. }
  117. }
  118. }
  119. }
  120. }
  121. </style>