修改组件和接口返回信息

This commit is contained in:
wangxiaowei
2025-11-05 16:28:25 +08:00
parent 9bfdf0b03e
commit 29bf4dae74
15 changed files with 537 additions and 54 deletions

View File

@ -13,13 +13,13 @@
<view class="home-bg w-[100%] fixed top-0 left-0 z-100">
<wd-navbar safeAreaInsetTop :bordered="false" custom-style="background-color: transparent !important;">
<template #left>
<view class="flex items-center line-1 w-130rpx" @click="home.toCity">
<view class="flex items-center line-1 w-130rpx" @click="Index.toCity">
<view class="mr-10rpx font-400 leading-44rpx text-32rpx pl-10rpx line-1">上海市</view>
<wd-img width="14rpx" height="9rpx" :src="`${OSS}icon/icon_arrow_down.png`" />
</view>
</template>
<template #title>
<view class="search-box flex items-center ml-26rpx" @click="home.toSearch">
<view class="search-box flex items-center ml-26rpx" @click="Index.toSearch">
<wd-search placeholder="搜索茶址名称" hide-cancel disabled :placeholder-left="true"
placeholderStyle="text-align:left;padding-left: 24rpx;line-heigt: 44rpx;color: #C9C9C9; font-size: 32rpx;font-weight: normal;">
</wd-search>
@ -32,7 +32,7 @@
<view class="mt-32rpx mx-30rpx">
<wd-swiper value-key="image" height="240rpx" indicatorPosition="bottom-left"
:indicator="{ type: 'dots-bar' }" :list="swiperList" v-model:current="current"
@click="home.handleClick" @change="home.onChange" mode="aspectFit"></wd-swiper>
@click="Index.handleClick" @change="Index.onChange" mode="aspectFit"></wd-swiper>
</view>
<view class="mt-40rpx flex items-center h-36rpx mx-30rpx">
@ -56,9 +56,9 @@
</view>
<view>
<mescroll-body @init="mescrollInit" @down="downCallback" @up="home.upCallback" top="28rpx"
<mescroll-body @init="mescrollInit" @down="downCallback" @up="Index.upCallback" top="28rpx"
:fixed="true">
<view class="relative p-20rp mb-24rpx" v-for="(item, index) in 100" :key="index" @click="home.handleToReserveRoom(item)">
<view class="relative p-20rp mb-24rpx" v-for="(item, index) in 100" :key="index" @click="Index.handleToReserveRoom(item)">
<view class="absolute top--28rpx left-0 z-1">
<wd-img width="110rpx" height="110rpx" :src="`${OSS}images/home/home_image4.png`"/>
</view>
@ -108,7 +108,8 @@
<script lang="ts" setup>
import { onPageScroll, onReachBottom } from '@dcloudio/uni-app'
import useMescroll from "@/uni_modules/mescroll-uni/hooks/useMescroll.js";
import useMescroll from "@/uni_modules/mescroll-uni/hooks/useMescroll.js"
import { handleEnsureLocationAuthHooks } from '@/hooks/useLocation'
const OSS = inject('OSS')
const navbarHeight = inject('navbarHeight')
@ -120,14 +121,18 @@
`${OSS}images/banner1.png`
])
const current = ref<number>(0)
/** 结束 **/
// 分页
const { mescrollInit, downCallback } = useMescroll(onPageScroll, onReachBottom) // 调用mescroll的hook
onLoad(() => {
onLoad(async() => {
// 获取用户经纬度(带缓存和授权逻辑)
const { lat, lng } = await handleEnsureLocationAuthHooks()
// 你可以在这里根据经纬度做后续处理,比如请求附近门店等
console.log('当前定位:', lat, lng)
})
const home = {
const Index = {
toCity: () => {
uni.navigateTo({
url: '/pages/city/city'