完善接口
This commit is contained in:
@ -82,6 +82,7 @@ export function userAddressDetails(data: IUserAddressDetailsParams) {
|
|||||||
export interface IGetCouponsParams {
|
export interface IGetCouponsParams {
|
||||||
id: number
|
id: number
|
||||||
numbers: number
|
numbers: number
|
||||||
|
type_id: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getCoupons(data: IGetCouponsParams) {
|
export function getCoupons(data: IGetCouponsParams) {
|
||||||
@ -93,6 +94,7 @@ export function getCoupons(data: IGetCouponsParams) {
|
|||||||
*/
|
*/
|
||||||
export interface IGetMyCouponsParams {
|
export interface IGetMyCouponsParams {
|
||||||
status: number
|
status: number
|
||||||
|
type_id: number
|
||||||
}
|
}
|
||||||
export function getMyCoupons(data: IGetMyCouponsParams) {
|
export function getMyCoupons(data: IGetMyCouponsParams) {
|
||||||
return http.Post('/api/UserCoupon/orderCoupinList', data)
|
return http.Post('/api/UserCoupon/orderCoupinList', data)
|
||||||
|
|||||||
@ -100,7 +100,7 @@
|
|||||||
const Coupons = {
|
const Coupons = {
|
||||||
// 初始化优惠券列表
|
// 初始化优惠券列表
|
||||||
handleInit: async (id: number, numbers: number) => {
|
handleInit: async (id: number, numbers: number) => {
|
||||||
const res = await getCoupons({id, numbers})
|
const res = await getCoupons({id, numbers, type_id: 1})
|
||||||
couponList.value = res
|
couponList.value = res
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@ -52,9 +52,7 @@
|
|||||||
import {ref} from 'vue'
|
import {ref} from 'vue'
|
||||||
import Coupon from '@/components/coupon/Coupon.vue'
|
import Coupon from '@/components/coupon/Coupon.vue'
|
||||||
import { getMyCoupons } from '@/api/user'
|
import { getMyCoupons } from '@/api/user'
|
||||||
import List from '@/pages/address/list.vue'
|
|
||||||
|
|
||||||
//
|
|
||||||
const tab = ref<number>(0)
|
const tab = ref<number>(0)
|
||||||
const tag = ref<Array<any>>([
|
const tag = ref<Array<any>>([
|
||||||
{label: '全部', value: 0 },
|
{label: '全部', value: 0 },
|
||||||
@ -84,7 +82,7 @@ import List from '@/pages/address/list.vue'
|
|||||||
|
|
||||||
const MyCoupon = {
|
const MyCoupon = {
|
||||||
handleInit: async () => {
|
handleInit: async () => {
|
||||||
const res: any = await getMyCoupons({status: currentTag.value})
|
const res: any = await getMyCoupons({status: currentTag.value, type_id: 1})
|
||||||
|
|
||||||
if (Array.isArray(res)) {
|
if (Array.isArray(res)) {
|
||||||
res.map((res) => {
|
res.map((res) => {
|
||||||
|
|||||||
@ -18,7 +18,7 @@
|
|||||||
</template>
|
</template>
|
||||||
</wd-navbar>
|
</wd-navbar>
|
||||||
<view class="tabs">
|
<view class="tabs">
|
||||||
<wd-tabs v-model="tab" swipeable slidable="always" :lazy="false" @click="orderList.handleChangeTabs">
|
<wd-tabs v-model="tab" swipeable slidable="always" :lazy="false" @click="OrderList.handleChangeTabs">
|
||||||
<wd-tab title="全部" :name="TeaSpecialistOrderStatusText.All"></wd-tab>
|
<wd-tab title="全部" :name="TeaSpecialistOrderStatusText.All"></wd-tab>
|
||||||
<wd-tab title="待付款" :name="TeaSpecialistOrderStatusText.Pending"></wd-tab>
|
<wd-tab title="待付款" :name="TeaSpecialistOrderStatusText.Pending"></wd-tab>
|
||||||
<wd-tab title="预约单" :name="TeaSpecialistOrderStatusText.Pay"></wd-tab>
|
<wd-tab title="预约单" :name="TeaSpecialistOrderStatusText.Pay"></wd-tab>
|
||||||
@ -31,35 +31,35 @@
|
|||||||
<view class="tabs mt-18rpx mx-30rpx">
|
<view class="tabs mt-18rpx mx-30rpx">
|
||||||
<!-- 这里可以尝试下不重新刷新获取列表 -->
|
<!-- 这里可以尝试下不重新刷新获取列表 -->
|
||||||
<!-- 全部 -->
|
<!-- 全部 -->
|
||||||
<mescroll-body ref="mescrollItem0" @init="mescrollInit" @down="downCallback" @up="orderList.upCallback" :down="downOption" :up="upOption" v-if="tab === 'all'">
|
<mescroll-body ref="mescrollItem0" @init="mescrollInit" @down="downCallback" @up="OrderList.upCallback" :down="downOption" :up="upOption" v-if="tab === 'all'">
|
||||||
<view class="mb-20rpx" v-for="(item, index) in list" :key="index">
|
<view class="mb-20rpx" v-for="(item, index) in list" :key="index">
|
||||||
<combo-card :type="OrderSource.TeaSpecialist" :order="item"></combo-card>
|
<combo-card :type="OrderSource.TeaSpecialist" :order="item"></combo-card>
|
||||||
</view>
|
</view>
|
||||||
</mescroll-body>
|
</mescroll-body>
|
||||||
|
|
||||||
<!-- 待付款 -->
|
<!-- 待付款 -->
|
||||||
<mescroll-body ref="mescrollItem1" @init="mescrollInit" @down="downCallback" @up="orderList.upCallback" :down="downOption" :up="upOption" v-if="tab === OrderStatus.Pending">
|
<mescroll-body ref="mescrollItem1" @init="mescrollInit" @down="downCallback" @up="OrderList.upCallback" :down="downOption" :up="upOption" v-if="tab === OrderStatus.Pending">
|
||||||
<view class="mb-20rpx" v-for="(item, index) in list" :key="index">
|
<view class="mb-20rpx" v-for="(item, index) in list" :key="index">
|
||||||
<combo-card :type="OrderSource.TeaSpecialist" :order="item"></combo-card>
|
<combo-card :type="OrderSource.TeaSpecialist" :order="item"></combo-card>
|
||||||
</view>
|
</view>
|
||||||
</mescroll-body>
|
</mescroll-body>
|
||||||
|
|
||||||
<!-- 预约单 -->
|
<!-- 预约单 -->
|
||||||
<mescroll-body ref="mescrollItem2" @init="mescrollInit" @down="downCallback" @up="orderList.upCallback" :down="downOption" :up="upOption" v-if="tab === OrderStatus.Reserved">
|
<mescroll-body ref="mescrollItem2" @init="mescrollInit" @down="downCallback" @up="OrderList.upCallback" :down="downOption" :up="upOption" v-if="tab === OrderStatus.Reserved">
|
||||||
<view class="mb-20rpx" v-for="(item, index) in list" :key="index">
|
<view class="mb-20rpx" v-for="(item, index) in list" :key="index">
|
||||||
<combo-card :type="OrderSource.TeaSpecialist" :order="item"></combo-card>
|
<combo-card :type="OrderSource.TeaSpecialist" :order="item"></combo-card>
|
||||||
</view>
|
</view>
|
||||||
</mescroll-body>
|
</mescroll-body>
|
||||||
|
|
||||||
<!-- 待确认 -->
|
<!-- 待确认 -->
|
||||||
<mescroll-body ref="mescrollItem2" @init="mescrollInit" @down="downCallback" @up="orderList.upCallback" :down="downOption" :up="upOption" v-if="tab === OrderStatus.Confirm">
|
<mescroll-body ref="mescrollItem2" @init="mescrollInit" @down="downCallback" @up="OrderList.upCallback" :down="downOption" :up="upOption" v-if="tab === OrderStatus.Confirm">
|
||||||
<view class="mb-20rpx" v-for="(item, index) in list" :key="index">
|
<view class="mb-20rpx" v-for="(item, index) in list" :key="index">
|
||||||
<combo-card :type="OrderSource.TeaSpecialist" :order="item"></combo-card>
|
<combo-card :type="OrderSource.TeaSpecialist" :order="item"></combo-card>
|
||||||
</view>
|
</view>
|
||||||
</mescroll-body>
|
</mescroll-body>
|
||||||
|
|
||||||
<!-- 已完结 -->
|
<!-- 已完结 -->
|
||||||
<mescroll-body ref="mescrollItem3" @init="mescrollInit" @down="downCallback" @up="orderList.upCallback" v-if="tab === OrderStatus.Finished">
|
<mescroll-body ref="mescrollItem3" @init="mescrollInit" @down="downCallback" @up="OrderList.upCallback" v-if="tab === OrderStatus.Finished">
|
||||||
<view class="mb-20rpx" v-for="(item, index) in list" :key="index">
|
<view class="mb-20rpx" v-for="(item, index) in list" :key="index">
|
||||||
<combo-card :type="OrderSource.TeaSpecialist" :order="item"></combo-card>
|
<combo-card :type="OrderSource.TeaSpecialist" :order="item"></combo-card>
|
||||||
</view>
|
</view>
|
||||||
@ -109,7 +109,7 @@
|
|||||||
uni.$off('refreshOrderList')
|
uni.$off('refreshOrderList')
|
||||||
})
|
})
|
||||||
|
|
||||||
const orderList = {
|
const OrderList = {
|
||||||
// 上拉加载的回调: 其中num:当前页 从1开始, size:每页数据条数,默认10
|
// 上拉加载的回调: 其中num:当前页 从1开始, size:每页数据条数,默认10
|
||||||
upCallback: (mescroll) => {
|
upCallback: (mescroll) => {
|
||||||
const filter = {
|
const filter = {
|
||||||
|
|||||||
37
src/hooks/usePay.ts
Normal file
37
src/hooks/usePay.ts
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
export function wxpay(opt) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
let params;
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
|
params = {
|
||||||
|
timeStamp: opt.timeStamp,
|
||||||
|
// 支付签名时间戳,注意微信jssdk中的所有使用timestamp字段均为小写。但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符
|
||||||
|
nonceStr: opt.nonceStr,
|
||||||
|
// 支付签名随机串,不长于 32 位
|
||||||
|
package: opt.package,
|
||||||
|
// 统一支付接口返回的prepay_id参数值,提交格式如:prepay_id=***)
|
||||||
|
signType: opt.signType,
|
||||||
|
// 签名方式,默认为'SHA1',使用新版支付需传入'MD5'
|
||||||
|
paySign: opt.paySign,
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
params = {
|
||||||
|
orderInfo: opt
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
console.log(params)
|
||||||
|
uni.requestPayment({
|
||||||
|
provider: 'wxpay',
|
||||||
|
...params,
|
||||||
|
success: res => {
|
||||||
|
resolve('success');
|
||||||
|
},
|
||||||
|
cancel: res => {
|
||||||
|
resolve('fail');
|
||||||
|
},
|
||||||
|
fail: res => {
|
||||||
|
resolve('fail');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
@ -27,7 +27,7 @@ export const getUrlCode = (): { [key: string]: string | undefined } => {
|
|||||||
*/
|
*/
|
||||||
export async function snsapiBaseAuthorize() {
|
export async function snsapiBaseAuthorize() {
|
||||||
// TODO 测试代码
|
// TODO 测试代码
|
||||||
wxSnsapiBaseLogin({code: '081kkz0w3wXuX53Hf83w3l4oy30kkz0z'}).then((res: IUserInfoVo) => {
|
wxSnsapiBaseLogin({code: '011ganGa10NGEK0reKGa1l3rpS2ganGX'}).then((res: IUserInfoVo) => {
|
||||||
console.log("登录成功 ~ snsapiBaseAuthorize ~ res:", res)
|
console.log("登录成功 ~ snsapiBaseAuthorize ~ res:", res)
|
||||||
// 映射 IUserLogin 到 IUserInfoVo
|
// 映射 IUserLogin 到 IUserInfoVo
|
||||||
useUserStore().setUserInfo(res)
|
useUserStore().setUserInfo(res)
|
||||||
|
|||||||
@ -356,14 +356,12 @@
|
|||||||
userInfo.value = userStore.userInfo
|
userInfo.value = userStore.userInfo
|
||||||
|
|
||||||
id.value = args.id || 0
|
id.value = args.id || 0
|
||||||
latitude.value = args.lat || 0
|
|
||||||
longitude.value = args.lng || 0
|
|
||||||
|
|
||||||
// 获取茶艺师详情
|
// 获取茶艺师详情
|
||||||
const res = await getTeaSpecialistDetails({
|
const res = await getTeaSpecialistDetails({
|
||||||
id: args.id,
|
id: args.id,
|
||||||
latitude: latitude.value,
|
latitude: uni.getStorageSync('latitude'),
|
||||||
longitude: longitude.value,
|
longitude: uni.getStorageSync('longitude'),
|
||||||
user_id: userInfo.value.id || 0
|
user_id: userInfo.value.id || 0
|
||||||
})
|
})
|
||||||
// 将返回的数据合并到 reactive 对象中
|
// 将返回的数据合并到 reactive 对象中
|
||||||
|
|||||||
@ -182,7 +182,9 @@
|
|||||||
|
|
||||||
// 经纬度缓存过期处理(1小时)
|
// 经纬度缓存过期处理(1小时)
|
||||||
const LOCATION_EXPIRE_KEY = 'location_expire_time'
|
const LOCATION_EXPIRE_KEY = 'location_expire_time'
|
||||||
const LOCATION_EXPIRE_MS = 60 * 60 * 1000 // 1小时
|
const LOCATION_EXPIRE_MS = 30 * 24 * 60 * 60 * 1000 // 1个月
|
||||||
|
const LOCATION_DENY_KEY = 'location_deny_time'
|
||||||
|
const LOCATION_DENY_INTERVAL = 60 * 1000 // 1分钟
|
||||||
const defaultCity = ref<string>(import.meta.env.VITE_DEFAULT_ADDRESS) // 默认城市
|
const defaultCity = ref<string>(import.meta.env.VITE_DEFAULT_ADDRESS) // 默认城市
|
||||||
const list = ref<Array<any>>([]) // 茶艺师列表
|
const list = ref<Array<any>>([]) // 茶艺师列表
|
||||||
const teaSpecialistName = ref<string>('') // 茶艺师名称
|
const teaSpecialistName = ref<string>('') // 茶艺师名称
|
||||||
@ -190,30 +192,54 @@
|
|||||||
const cityValue = ref<string>('')
|
const cityValue = ref<string>('')
|
||||||
|
|
||||||
onLoad(async () => {
|
onLoad(async () => {
|
||||||
|
// 获取茶艺师等级tab
|
||||||
|
getTeaSpecialistLevels().then((res:Array<any>) => {
|
||||||
|
TeaSpecialistLevels.push(...res)
|
||||||
|
})
|
||||||
|
|
||||||
// 检查缓存是否过期,超时则重新授权
|
// 检查缓存是否过期,超时则重新授权
|
||||||
await Index.handleEnsureLocationAuth()
|
await Index.handleEnsureLocationAuth()
|
||||||
|
|
||||||
// 获取城市列表
|
|
||||||
getCity({latitude: latitude.value, longitude: longitude.value}).then((res: any) => {
|
|
||||||
cityColumns.value = res.area_list.map(item => {
|
|
||||||
return {
|
|
||||||
label: item.getArea[0].name,
|
|
||||||
value: item.getArea[0].lat + ',' + item.getArea[0].lng
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
// getDecorate({id: 1}).then((res: any) => {
|
// getDecorate({id: 1}).then((res: any) => {
|
||||||
// const data = JSON.parse(res.data)
|
// const data = JSON.parse(res.data)
|
||||||
// console.log('装修数据:', data)
|
// console.log('装修数据:', data)
|
||||||
// })
|
// })
|
||||||
|
|
||||||
// 等待授权完成后再加载数据
|
|
||||||
getTeaSpecialistLevels().then((res:Array<any>) => {
|
|
||||||
TeaSpecialistLevels.push(...res)
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const Index = {
|
const Index = {
|
||||||
|
// 上拉加载的回调: 其中num:当前页 从1开始, size:每页数据条数,默认10
|
||||||
|
upCallback: (mescroll) => {
|
||||||
|
const filter = {
|
||||||
|
level_id: selectedLevel.value.join(',') || '0',
|
||||||
|
page: mescroll.num,
|
||||||
|
size: mescroll.size,
|
||||||
|
latitude: latitude.value,
|
||||||
|
longitude: longitude.value,
|
||||||
|
search: teaSpecialistName.value
|
||||||
|
}
|
||||||
|
|
||||||
|
getTeaSpecialist(filter).then((res: IIndexListResult) => {
|
||||||
|
const curPageData = res.list || [] // 当前页数据
|
||||||
|
if(mescroll.num == 1) list.value = [] // 第一页需手动制空列表
|
||||||
|
list.value = list.value.concat(curPageData) //追加新数据
|
||||||
|
mescroll.endSuccess(curPageData.length, Boolean(res.more))
|
||||||
|
}).catch(() => {
|
||||||
|
mescroll.endErr() // 请求失败, 结束加载
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
// 获取城市列表
|
||||||
|
handleGetCityList: () => {
|
||||||
|
getCity({latitude: latitude.value, longitude: longitude.value}).then((res: any) => {
|
||||||
|
cityColumns.value = res.area_list.map(item => {
|
||||||
|
return {
|
||||||
|
label: item.getArea[0].name,
|
||||||
|
value: item.getArea[0].lat + ',' + item.getArea[0].lng
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
// 设置经纬度缓存
|
// 设置经纬度缓存
|
||||||
handleSetLocationCache: (lat: number, lng: number) => {
|
handleSetLocationCache: (lat: number, lng: number) => {
|
||||||
uni.setStorageSync('latitude', lat)
|
uni.setStorageSync('latitude', lat)
|
||||||
@ -235,14 +261,10 @@
|
|||||||
|
|
||||||
// 初始化经纬度
|
// 初始化经纬度
|
||||||
handleEnsureLocationAuth: async () => {
|
handleEnsureLocationAuth: async () => {
|
||||||
|
// 检查缓存是否过期
|
||||||
if (!Index.handleCheckLocationCache()) {
|
if (!Index.handleCheckLocationCache()) {
|
||||||
// 超时,重新获取授权
|
// 超时,重新获取授权
|
||||||
await wxGetLocation((res) => {
|
await Index.handleRequestLocationAuth()
|
||||||
latitude.value = res.latitude
|
|
||||||
longitude.value = res.longitude
|
|
||||||
Index.handleSetLocationCache(latitude.value, longitude.value)
|
|
||||||
Index.handleSearch()
|
|
||||||
})
|
|
||||||
} else {
|
} else {
|
||||||
const lat = uni.getStorageSync('latitude')
|
const lat = uni.getStorageSync('latitude')
|
||||||
const lng = uni.getStorageSync('longitude')
|
const lng = uni.getStorageSync('longitude')
|
||||||
@ -250,16 +272,38 @@
|
|||||||
latitude.value = lat
|
latitude.value = lat
|
||||||
longitude.value = lng
|
longitude.value = lng
|
||||||
} else {
|
} else {
|
||||||
await wxGetLocation((res) => {
|
await Index.handleRequestLocationAuth()
|
||||||
latitude.value = res.latitude
|
|
||||||
longitude.value = res.longitude
|
|
||||||
Index.handleSetLocationCache(latitude.value, longitude.value)
|
|
||||||
Index.handleSearch()
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// 定位授权弹窗逻辑
|
||||||
|
handleRequestLocationAuth: async () => {
|
||||||
|
// 检查上次弹窗时间,1分钟内不再弹
|
||||||
|
const lastDeny = uni.getStorageSync(LOCATION_DENY_KEY)
|
||||||
|
if (lastDeny && Date.now() - lastDeny < LOCATION_DENY_INTERVAL) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
await wxGetLocation((res) => {
|
||||||
|
latitude.value = res.latitude
|
||||||
|
longitude.value = res.longitude
|
||||||
|
Index.handleSetLocationCache(latitude.value, longitude.value)
|
||||||
|
Index.handleSearch()
|
||||||
|
Index.handleGetCityList()
|
||||||
|
})
|
||||||
|
} catch (e) {
|
||||||
|
// 用户拒绝授权,记录弹窗时间
|
||||||
|
uni.setStorageSync(LOCATION_DENY_KEY, Date.now())
|
||||||
|
// 可选:弹窗提示
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '需要获取您的地理位置以提供更好的服务,请在授权弹窗中允许定位。',
|
||||||
|
showCancel: false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
// 选择城市
|
// 选择城市
|
||||||
handleSelectCity: (e: any) => {
|
handleSelectCity: (e: any) => {
|
||||||
cityValue.value = e.value
|
cityValue.value = e.value
|
||||||
@ -277,28 +321,6 @@
|
|||||||
getMescroll().resetUpScroll()
|
getMescroll().resetUpScroll()
|
||||||
},
|
},
|
||||||
|
|
||||||
// 上拉加载的回调: 其中num:当前页 从1开始, size:每页数据条数,默认10
|
|
||||||
upCallback: (mescroll) => {
|
|
||||||
const filter = {
|
|
||||||
level_id: selectedLevel.value.join(',') || '0',
|
|
||||||
page: mescroll.num,
|
|
||||||
size: mescroll.size,
|
|
||||||
latitude: latitude.value,
|
|
||||||
longitude: longitude.value,
|
|
||||||
search: teaSpecialistName.value
|
|
||||||
}
|
|
||||||
console.log('filter:', filter)
|
|
||||||
|
|
||||||
getTeaSpecialist(filter).then((res: IIndexListResult) => {
|
|
||||||
const curPageData = res.list || [] // 当前页数据
|
|
||||||
if(mescroll.num == 1) list.value = [] // 第一页需手动制空列表
|
|
||||||
list.value = list.value.concat(curPageData) //追加新数据
|
|
||||||
mescroll.endSuccess(curPageData.length, Boolean(res.more))
|
|
||||||
}).catch(() => {
|
|
||||||
mescroll.endErr() // 请求失败, 结束加载
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
handleClick: (item: any) => {
|
handleClick: (item: any) => {
|
||||||
// 处理点击事件
|
// 处理点击事件
|
||||||
console.log('Clicked item:', item)
|
console.log('Clicked item:', item)
|
||||||
@ -306,7 +328,7 @@
|
|||||||
|
|
||||||
// 跳转到预约茶艺师页面
|
// 跳转到预约茶艺师页面
|
||||||
handleToReserveTeaSpecialist: (id: number = 1) => {
|
handleToReserveTeaSpecialist: (id: number = 1) => {
|
||||||
router.navigateTo(`/pages/index/detail?id=${id}&lat=${latitude.value}&lng=${longitude.value}`)
|
router.navigateTo(`/pages/index/detail?id=${id}`)
|
||||||
},
|
},
|
||||||
|
|
||||||
// 选择茶艺师等级
|
// 选择茶艺师等级
|
||||||
|
|||||||
@ -57,15 +57,20 @@ export async function wxGetLocation(callback: (res: any) => void ) {
|
|||||||
wx.getLocation({
|
wx.getLocation({
|
||||||
type: 'gcj02', // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
|
type: 'gcj02', // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
// console.log(res);
|
uni.removeStorageSync('location_deny_time')
|
||||||
callback(res)
|
callback(res)
|
||||||
|
console.log('授权成功:' + res)
|
||||||
},
|
},
|
||||||
fail: function(res) {
|
fail: function(res) {
|
||||||
console.log('经纬度:' + res)
|
console.log('授权失败:' + res)
|
||||||
},
|
},
|
||||||
// complete:function(res){
|
complete:function(res){
|
||||||
// console.log(res)
|
console.log(res)
|
||||||
// }
|
if (res.errMsg === 'getLocation:cancel') {
|
||||||
|
// 用户拒绝授权
|
||||||
|
uni.setStorageSync('location_deny_time', Date.now())
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user