This commit is contained in:
jia 2023-11-21 09:16:05 +08:00
parent cfbf1f93a7
commit 035badff12
3 changed files with 135 additions and 110 deletions

View File

@ -16,8 +16,9 @@
<view class="site-box1 flex_a_c_j_sb">
<view class="place_wrapper flex_a_c" @click="selectLocation">
<view class="iconfont icon-weizhi"></view>
<view class="town_name">{{street||'定位中' }}</view>
<view class="town_name rotate-box" @click.stop="getPositionFn()"><uni-icons type="loop" color="#fff"></uni-icons></view>
<view class="town_name">{{street||'定位中' }}</view>
<view class="town_name rotate-box" @click.stop="getPositionFn()"><uni-icons type="loop"
color="#fff"></uni-icons></view>
</view>
<navigator url="/pages/chat/customer_list/index?type=0" hover-class="none">
<view class="iconfont icon-xiaoxi" style="color: #fff"> </view>
@ -66,11 +67,11 @@
</u-transition>
</view>
</view>
<view class="location" v-if="isshow">
<view class="locationa"> 位置权限使用说明 </view>
<view class="locationb"> 用于向你推荐最近门店 </view>
<view class="locationx" @click.stop="isshow=false">x</view>
</view>
<view class="location" v-if="isshow">
<view class="locationa"> 位置权限使用说明 </view>
<view class="locationb"> 用于向你推荐最近门店 </view>
<view class="locationx" @click.stop="isshow=false">x</view>
</view>
<u-picker :defaultIndex="[0, 0]" :show="showPicker" ref="uPicker" :columns="columnData" @confirm="confirm"
@cancel="showPicker = false" @change="changeHandler" keyName="name"></u-picker>
<!-- <m-tabbar native>
@ -126,7 +127,7 @@
data() {
return {
locationArr: ({}),
isshow: false,
isshow: false,
emptyText: '暂无可用应用',
jurisdiction: false, //
mer_id: '',
@ -208,6 +209,26 @@
},
type: 3,
},
{
name: '里海直播',
icon: '/static/applet/live.png',
data: {
id: "__UNI__0E46DAD",
url: "https://lihai001.oss-cn-chengdu.aliyuncs.com/app/__UNI__0E46DAD.wgt",
},
type: 4,
},
{
name: 'oa小程序',
icon: '/static/applet/oa.png',
data: {
id: "__UNI__40723E1",
url: "https://lihai001.oss-cn-chengdu.aliyuncs.com/app/__UNI__40723E1.wgt",
},
type: 4
}
// {
// name: '',
// icon: '/static/applet/icons.png',
@ -217,17 +238,17 @@
// },
// type: 4,
// },
// {
// name: '',
// icon: '/static/applet/live.png',
// data: {
// id: "__UNI__0E46DAD",
// url:'https://lihai001.oss-cn-chengdu.aliyuncs.com/app/__UNI__0E46DAD.wgt',
// },
// type: 4,
// }
// {
// name: '',
@ -309,13 +330,16 @@
// #endif
methods: {
getPositionFn() {
this.street = '定位中'
this.$store.commit('setLocation', {lat: null, long: null})
uni.removeStorageSync('RejectTarget')
this.selfLocation()
},
getPositionFn() {
this.street = '定位中'
this.$store.commit('setLocation', {
lat: null,
long: null
})
uni.removeStorageSync('RejectTarget')
this.selfLocation()
},
scrolling() {
//
let scrollTop =
@ -416,12 +440,14 @@
case 1:
uniMP.loadMP(data);
break;
case 2: uniMP.loadMPx(data); break;
// case 2:
// // this.navigator(data);
// // uniMP.loadMPx(data);
// that.navigator(`/pages/moreProject/moreProject`);
// break;
case 2:
uniMP.loadMPx(data);
break;
// case 2:
// // this.navigator(data);
// // uniMP.loadMPx(data);
// that.navigator(`/pages/moreProject/moreProject`);
// break;
case 3:
uniMP.loadMPurl(data);
@ -441,10 +467,10 @@
// title: 'H5'
// })
// }
uni.showToast({
icon: 'none',
title: 'H5不支持打开小程序'
})
uni.showToast({
icon: 'none',
title: 'H5不支持打开小程序'
})
// #endif
},
@ -493,37 +519,36 @@
this.showPicker = false
},
selfLocation() {
if (uni.getStorageSync('RejectTarget')) return;
if (uni.getStorageSync('loction') == true) {
this.isshow = false
} else {
this.isshow = true
uni.setStorageSync('loction', true);
}
if(this.$store?.state?.storage?.location?.lat){
this.isshow = false
getGeocoder({
lat: this.$store.state.storage.location.lat,
long: this.$store.state.storage.location.long
}).then(res => {
let town = res.data.address_reference.town.title
let street_id = res.data.address_reference.town.id
this.street = res.data.address_reference.town.title;
this.$nextTick(() => {
this.$bus.$emit('value-updated', this.street + ',' +
street_id);
})
}).catch(err => {
this.isshow = false
uni.showToast({
title: err,
icon: 'none'
})
})
}
else uni.getLocation({
if (uni.getStorageSync('RejectTarget')) return;
if (uni.getStorageSync('loction') == true) {
this.isshow = false
} else {
this.isshow = true
uni.setStorageSync('loction', true);
}
if (this.$store?.state?.storage?.location?.lat) {
this.isshow = false
getGeocoder({
lat: this.$store.state.storage.location.lat,
long: this.$store.state.storage.location.long
}).then(res => {
let town = res.data.address_reference.town.title
let street_id = res.data.address_reference.town.id
this.street = res.data.address_reference.town.title;
this.$nextTick(() => {
this.$bus.$emit('value-updated', this.street + ',' +
street_id);
})
}).catch(err => {
this.isshow = false
uni.showToast({
title: err,
icon: 'none'
})
})
} else uni.getLocation({
type: 'wgs84',
timeout: '10',
success: (res) => {
@ -532,10 +557,10 @@
let latitude, longitude;
latitude = res.latitude.toString();
longitude = res.longitude.toString();
this.$store.commit('setLocation', {
lat: res.latitude.toFixed(6),
long: res.longitude.toFixed(6),
});
this.$store.commit('setLocation', {
lat: res.latitude.toFixed(6),
long: res.longitude.toFixed(6),
});
getGeocoder({
lat: latitude,
long: longitude
@ -555,14 +580,14 @@
title: err,
icon: 'none'
})
this.street = '定位失败'
this.street = '定位失败'
})
},
fail: (err) => {
this.isshow = false
uni.setStorageSync("RejectTarget", true)
Toast('定位失败,请检查定位权限是否开启')
this.street = '定位失败'
uni.setStorageSync("RejectTarget", true)
Toast('定位失败,请检查定位权限是否开启')
this.street = '定位失败'
}
});
},
@ -807,47 +832,47 @@
background-color: #fff;
padding-top: 28rpx;
}
.rotate-box {
transform: rotate(0deg);
transition: transform .5s ease-out;
}
.rotate-box:active {
transform: rotate(360deg);
}
.location {
background-color: #f6f6f6;
width: 680rpx;
height: 150rpx;
position: absolute;
top: 0;
z-index: 9999;
border-radius: 20rpx;
left: 50%;
margin-left: -340rpx;
margin-top: 80rpx;
padding-left: 20rpx;
.locationa {
font-size: 28rpx;
color: #000;
font-weight: 500;
margin-top: 30rpx;
margin-bottom: 15rpx;
}
.locationb {
font-size: 20rpx;
color: #5a5a5a;
}
.locationx{
color: #000;
position: absolute;
top: 10rpx;
right: 20rpx;
}
}
.rotate-box {
transform: rotate(0deg);
transition: transform .5s ease-out;
}
.rotate-box:active {
transform: rotate(360deg);
}
.location {
background-color: #f6f6f6;
width: 680rpx;
height: 150rpx;
position: absolute;
top: 0;
z-index: 9999;
border-radius: 20rpx;
left: 50%;
margin-left: -340rpx;
margin-top: 80rpx;
padding-left: 20rpx;
.locationa {
font-size: 28rpx;
color: #000;
font-weight: 500;
margin-top: 30rpx;
margin-bottom: 15rpx;
}
.locationb {
font-size: 20rpx;
color: #5a5a5a;
}
.locationx {
color: #000;
position: absolute;
top: 10rpx;
right: 20rpx;
}
}
</style>

BIN
static/applet/oa.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

BIN
static/img/missing-face.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB