index.vue 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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.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. onShow(async () => {
  35. await searchConfig();
  36. await search();
  37. })
  38. // config信息
  39. const searchConfig = async () => {
  40. config.value = uni.getStorageSync('config');
  41. };
  42. // 查询
  43. const search = async () => {
  44. const info = {
  45. skip: 0,
  46. limit: 2,
  47. status: '0'
  48. }
  49. // const res = await $api('car', 'GET', info);
  50. // if (res.errcode === 0) {
  51. // list.value = list.value.concat(res.data)
  52. // total.value = res.total
  53. // } else {
  54. // uni.showToast({
  55. // title: res.errmsg || '',
  56. // icon: 'error',
  57. // });
  58. // }
  59. };
  60. const toCommon = (item) => {
  61. uni.navigateTo({
  62. url: `/pagesHome/search/index?type=${item.type || ''}`
  63. })
  64. };
  65. // 查看详情
  66. const toView = (item) => {
  67. uni.navigateTo({
  68. url: `/pagesHome/car/index?id=${item.id || item._id}`
  69. })
  70. };
  71. </script>
  72. <style lang="scss" scoped>
  73. .content {
  74. display: flex;
  75. flex-direction: column;
  76. width: 100vw;
  77. height: 100vh;
  78. }
  79. </style>