邓洁:地理位置
This commit is contained in:
@@ -35,25 +35,37 @@
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
position: '定位1'
|
position: '定位12',
|
||||||
|
location: ''
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
options: {
|
options: {
|
||||||
styleIsolation: 'shared', // 解除样式隔离
|
styleIsolation: 'shared', // 解除样式隔离
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
console.log('createsd');
|
||||||
this.open()
|
this.open()
|
||||||
|
console.log('location', this.location);
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
location(val) {
|
||||||
|
console.log('foo变化了,变化后的值是', val)
|
||||||
|
// 具体操作=>doSomething
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
console.log('onshow');
|
||||||
|
// const location = this.open()
|
||||||
|
// console.log('location', this.location);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getLocation1() {
|
getLocation1() {
|
||||||
let qqmapsdk = new QQMapWX({
|
let qqmapsdk = new QQMapWX({
|
||||||
key: 'ZRKBZ-Q7FWL-GVZPK-MCRBU-4XFB5-ATBDB'
|
key: 'ZRKBZ-Q7FWL-GVZPK-MCRBU-4XFB5-ATBDB'
|
||||||
});
|
});
|
||||||
uni.getLocation({
|
uni.getFuzzyLocation({
|
||||||
type: 'wgs84',
|
type: 'wgs84',
|
||||||
// geocode: true, // 返回城市信息
|
success(res) {
|
||||||
// enableHighAccuracy: false, // 开启高精度模式
|
|
||||||
success: function(res) {
|
|
||||||
console.log('res.latitude', res.latitude);
|
console.log('res.latitude', res.latitude);
|
||||||
console.log('res.longitude', res.longitude);
|
console.log('res.longitude', res.longitude);
|
||||||
qqmapsdk.reverseGeocoder({
|
qqmapsdk.reverseGeocoder({
|
||||||
@@ -65,24 +77,24 @@
|
|||||||
console.log("解析地址成功", res);
|
console.log("解析地址成功", res);
|
||||||
console.log(re.result.ad_info.city, '成都市==');
|
console.log(re.result.ad_info.city, '成都市==');
|
||||||
console.log(re.result.ad_info.district, '武侯区==');
|
console.log(re.result.ad_info.district, '武侯区==');
|
||||||
this.position = re.result.ad_info.city
|
this.location = re.result.ad_info
|
||||||
console.log('thisposition', this.position);
|
console.log('success', this.location);
|
||||||
},
|
},
|
||||||
fail: (re) => {
|
fail: (re) => {
|
||||||
console.log(re, '失败信息');
|
console.log(re, '失败信息');
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
fail: () => {
|
fail(err) {
|
||||||
console.log("获取经纬度失败");
|
console.log("获取经纬度失败", err);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
//提示用户开启定位服务
|
//提示用户开启定位服务
|
||||||
open() {
|
open() {
|
||||||
var that=this
|
var that = this
|
||||||
uni.authorize({
|
uni.authorize({
|
||||||
scope: 'scope.userLocation',
|
scope: 'scope.userFuzzyLocation',
|
||||||
success: function() {
|
success: function() {
|
||||||
console.log('授权成功');
|
console.log('授权成功');
|
||||||
that.getLocation1()
|
that.getLocation1()
|
||||||
|
|||||||
@@ -59,9 +59,12 @@
|
|||||||
// 获取当前的地理位置、速度 配置
|
// 获取当前的地理位置、速度 配置
|
||||||
"scope.userLocation": {
|
"scope.userLocation": {
|
||||||
"desc": "你的位置信息将用于小程序位置接口的效果展示"
|
"desc": "你的位置信息将用于小程序位置接口的效果展示"
|
||||||
|
},
|
||||||
|
"scope.userFuzzyLocation": {
|
||||||
|
"desc": "你的位置信息将用于小程序位置的效果展示"
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"requiredPrivateInfos": ["choosePoi", "chooseAddress", "getFuzzyLocation"]
|
||||||
},
|
},
|
||||||
"mp-alipay": {
|
"mp-alipay": {
|
||||||
"usingComponents": true
|
"usingComponents": true
|
||||||
|
|||||||
12
pages.json
12
pages.json
@@ -98,10 +98,9 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
,{
|
, {
|
||||||
"path" : "pages/Partnerships/Partnerships",
|
"path": "pages/Partnerships/Partnerships",
|
||||||
"style" :
|
"style": {
|
||||||
{
|
|
||||||
"navigationBarTitleText": "成功合伙人",
|
"navigationBarTitleText": "成功合伙人",
|
||||||
"enablePullDownRefresh": false
|
"enablePullDownRefresh": false
|
||||||
}
|
}
|
||||||
@@ -146,6 +145,11 @@
|
|||||||
"navigationBarBackgroundColor": "#F8F8F8",
|
"navigationBarBackgroundColor": "#F8F8F8",
|
||||||
"backgroundColor": "#F8F8F8"
|
"backgroundColor": "#F8F8F8"
|
||||||
},
|
},
|
||||||
|
"permission": {
|
||||||
|
"scope.userFuzzyLocation": {
|
||||||
|
"desc": "你的位置信息将用于小程序位置的效果展示"
|
||||||
|
}
|
||||||
|
},
|
||||||
"uniIdRouter": {},
|
"uniIdRouter": {},
|
||||||
"condition": { //模式配置,仅开发期间生效
|
"condition": { //模式配置,仅开发期间生效
|
||||||
"current": 0, //当前激活的模式(list 的索引项)
|
"current": 0, //当前激活的模式(list 的索引项)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="nav-card">
|
<view class="nav-card">
|
||||||
<u-grid :col="4" customStyle="height: 334rpx;align-content: normal" >
|
<u-grid :col="4" customStyle="height: 334rpx;align-content: normal">
|
||||||
<u-grid-item v-for="(item, index) in navItems" :key="item.icon" @click="handleItemClick(index)">
|
<u-grid-item v-for="(item, index) in navItems" :key="item.icon" @click="handleItemClick(index)">
|
||||||
<u-icon :name="item.icon" :size="46"></u-icon>
|
<u-icon :name="item.icon" :size="46"></u-icon>
|
||||||
<view class="grid-text">{{ item.text }}</view>
|
<view class="grid-text">{{ item.text }}</view>
|
||||||
@@ -54,6 +54,11 @@
|
|||||||
// 在这里处理点击事件,并使用下标值
|
// 在这里处理点击事件,并使用下标值
|
||||||
console.log(`项目 ${index} 被点击了`);
|
console.log(`项目 ${index} 被点击了`);
|
||||||
// 或者执行其他需要的操作
|
// 或者执行其他需要的操作
|
||||||
|
if (index == 5) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/index/map/map'
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
:longitude="lng"></map>
|
:longitude="lng"></map>
|
||||||
</view>
|
</view>
|
||||||
<view class="down-shop">
|
<view class="down-shop">
|
||||||
<ShowShopListItem :shopInfo="shopList"></ShowShopListItem>
|
<ShowShopListItem :shopInfo="shopList" :is-adshow="true" :show-style="0"></ShowShopListItem>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@@ -45,11 +45,19 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
shopList: {
|
shopList: {
|
||||||
|
shopid: 1,
|
||||||
imageUrl: 'https://alifei01.cfp.cn/creative/vcg/800/new/VCG41175510742.jpg',
|
imageUrl: 'https://alifei01.cfp.cn/creative/vcg/800/new/VCG41175510742.jpg',
|
||||||
title: '琴行铺面转让',
|
title: '琴行铺面转让',
|
||||||
promotionNum: 23,
|
promotionNum: 23,
|
||||||
price: 5000,
|
price: 6000,
|
||||||
date: '2023-11-02'
|
date: '2023-11-02',
|
||||||
|
pos: '锦江区',
|
||||||
|
exactPos: '锦江区-汇源南路366号',
|
||||||
|
sqr: 100,
|
||||||
|
zrfText: "转让费:20万",
|
||||||
|
category: '餐饮美食',
|
||||||
|
uname: "张先生",
|
||||||
|
phoneNum: 13348946108,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -119,8 +127,8 @@
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
bottom: 60rpx;
|
bottom: 60rpx;
|
||||||
left: 10%;
|
left: 50%;
|
||||||
transform: translateX(-10%);
|
transform: translateX(-50%);
|
||||||
|
|
||||||
.list-border {
|
.list-border {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user