邓洁 : 定位框只显示确认按钮

This commit is contained in:
邓洁
2023-11-20 21:14:35 +08:00
parent aaee754194
commit 75ce1ab591
3 changed files with 96 additions and 19 deletions

View File

@@ -1,27 +1,22 @@
<template>
<view class="container">
<view class="tabs-bg" />
<view class="tabs-bg"></view>
<view class="tabs">
<view class="title-view" v-for="(item, index) in title" :key="item" @click="changeActiveIndex(index)"
:class="{isActive: activeIndex === index}">
<text>{{item}}</text>
<view class="arrow" v-if="activeIndex !== index">
<u-image src="/static/dropdown/dp_icon_lxia.png" width="14rpx" height="11rpx" />
<u-image src="/static/dropdown/dp_icon_lxia.png" width="14rpx" height="11rpx"></u-image>
</view>
<view class="arrow" v-if="activeIndex === index">
<u-image src="/static/dropdown/dp_icon_hlxia.png" width="14rpx" height="11rpx" />
<u-image src="/static/dropdown/dp_icon_hlxia.png" width="14rpx" height="11rpx"></u-image>
</view>
</view>
</view>
<view class="item-border">
<DropDownItem
v-if="activeIndex !== -1"
:list="tablist"
@cancelDrop="cancelDrop"
@getQueryInfo="getQueryInfo"
:type="title[activeIndex]"
/>
<DropDownItem v-if="activeIndex !== -1" :list="tablist" @cancelDrop="cancelDrop" @getQueryInfo="getQueryInfo"
:type="title[activeIndex]" />
</view>
</view>
</template>
@@ -60,9 +55,9 @@
}
},
created() {
this.postlist[0]=JSON.parse(uni.getStorageSync('classList'))
this.postlist[0] = JSON.parse(uni.getStorageSync('classList'))
// this.postlist[0].unshift('全部')
this.postlist[1]=JSON.parse(uni.getStorageSync('regionList'))
this.postlist[1] = JSON.parse(uni.getStorageSync('regionList'))
},
methods: {
changeActiveIndex(index) {

View File

@@ -46,14 +46,13 @@
options: {
styleIsolation: 'shared', // 解除样式隔离
},
created() {
},
created() {},
methods: {
//点击轮播图
handleSwiperList(currentNum, bannerURL) {
const item=bannerURL[currentNum]
const item = bannerURL[currentNum]
uni.navigateTo({
url: item.link+`?id=${item.param}&type=${item.type}`
url: item.link + `?id=${item.param}&type=${item.type}`
})
},
}

View File

@@ -179,6 +179,32 @@
},
fail(err) {
console.log("获取经纬度失败", err);
uni.getSystemInfo({
success: (res) => {
if (!res.locationEnabled || !res.locationAuthorized) {
uni.showModal({
content: '检测到您没打开手机系统定位权限,请确保手机系统定位已开启',
confirmText: "确认",
showCancel: false,
success: (res) => {
if (res.confirm) {
// uni.openSetting({
// success: (res) => {
// console.log(res);
that.getUserLocation();
// }
// })
} else {
console.log('取消');
return false;
}
}
})
} else {
that.getUserLocation()
}
}
})
},
});
},
@@ -189,20 +215,77 @@
success: function(res) {
if (res.authSetting['scope.userFuzzyLocation']) {
console.log('用户已经授权定位权限');
uni.getSystemInfo({
success: (res) => {
if (!res.locationEnabled || !res.locationAuthorized) {
uni.showModal({
content: '检测到您没打开手机系统定位权限,请确保手机系统定位已开启',
confirmText: "确认",
showCancel: false,
success: (res) => {
if (res.confirm) {
// uni.openSetting({
// success: (res) => {
// console.log(res);
that.getUserLocation();
// }
// })
} else {
console.log('取消');
return false;
}
}
})
} else {
that.getUserLocation()
}
}
})
// that.getUserLocation()
} else {
console.log('用户未授权定位权限');
uni.authorize({
scope: 'scope.userFuzzyLocation',
success: function() {
console.log('授权成功');
that.getUserLocation()
uni.getSystemInfo({
success: (res) => {
if (!res.locationEnabled || !res.locationAuthorized) {
// uni.showToast({
// title: '请确保手机系统定位已开启',
// icon: 'none',
// duration: 2000,
// })
uni.showModal({
content: '检测到您没打开手机系统定位权限,请确保手机系统定位已开启',
confirmText: "确认",
showCancel: false,
success: (res) => {
if (res.confirm) {
// uni.openSetting({
// success: (res) => {
// console.log(res);
that.getUserLocation();
// }
// })
} else {
console.log('取消');
return false;
}
}
})
} else {
that.getUserLocation()
}
}
})
},
fail: function() {
console.log('授权失败');
uni.showModal({
content: '检测到您没打开获取信息功能权限,是否去设置打开?',
content: '检测到您没打开手机系统定位权限,请确保手机系统定位已开启',
confirmText: "确认",
cancelText: '取消',
showCancel: false,
success: (res) => {
if (res.confirm) {
uni.openSetting({