增加定位功能

This commit is contained in:
Gao xiaosong
2020-06-13 01:38:36 +08:00
parent b23f9a2272
commit ba199ff02d
15 changed files with 170 additions and 117 deletions

View File

@ -59,17 +59,17 @@ export default {
},
onHide() {
console.log("离开授权页面,11111");
this.UPDATE_AUTHORIZATIONPAGE(false);
this.updateAuthorizationPage(false);
this.changeAuthorization(false);
},
onUnload() {
console.log("离开授权页面,11111");
this.UPDATE_AUTHORIZATIONPAGE(false);
this.updateAuthorizationPage(false);
this.changeAuthorization(false);
},
methods: {
...mapActions(["changeAuthorization", "setUserInfo"]),
...mapMutations(["UPDATE_AUTHORIZATIONPAGE", "CHANGE_TABTAR"]),
...mapMutations(["updateAuthorizationPage",]),
back() {
this.$yrouter.switchTab({
@ -111,7 +111,7 @@ export default {
},
onUnload() {
console.log("离开授权页面,11111");
this.UPDATE_AUTHORIZATIONPAGE(false);
this.updateAuthorizationPage(false);
this.changeAuthorization(false);
},
mounted() {

View File

@ -130,6 +130,7 @@
</template>
<script>
// import { swiper, swiperSlide } from "vue-awesome-swiper";
import { mapState, mapMutations, mapActions } from 'vuex';
import GoodList from '@/components/GoodList';
import PromotionGood from '@/components/PromotionGood';
@ -233,6 +234,7 @@
};
},
onShow: function() {
this.getLocation()
let that = this;
uni.showLoading({
title: '加载中'
@ -257,6 +259,7 @@
});
},
methods: {
...mapActions(["getLocation"]),
goRoll(item){
if(item.uniapp_url){
this.$yrouter.push(item.uniapp_url)

View File

@ -43,20 +43,33 @@
</view>
<view class="iconfont icon-jiantou"></view>
</view>
<view class="store-info" v-if="system_store.id !== undefined">
<text class="title">门店信息</text>
<view class="store-info">
<view class="title acea-row row-between-wrapper">
<view>门店信息</view>
<text @click="goEvaluateList(id)" class="praise">
更多
<text class="iconfont icon-jiantou"></text>
</text>
</view>
<view class="info acea-row row-between-wrapper">
<view class="picTxt acea-row row-between-wrapper">
<view class="pictrue">
<image :src="system_store.image" />
<image :src="systemStore.image" />
</view>
<view class="text">
<view class="name line1">{{ system_store.name }}</view>
<view class="name line1">{{ systemStore.name }}</view>
<view class="address acea-row row-middle" @click="showChang">
<text class="addressTxt line1">{{system_store._detailed_address}}</text>
<text class="addressTxt">{{systemStore.address}}</text>
<text class="iconfont icon-youjian"></text>
</view>
</view>
<view class="addressBox">
<a
:href="'tel:'+systemStore.phone"
class="iconfont icon-dadianhua01 font-color-red phone"
></a>
<view class="addressTxt corlor-yshop">距离{{systemStore.distance}}千米</view>
</view>
</view>
</view>
</view>
@ -142,13 +155,13 @@
<view class="generate-posters acea-row row-middle on" v-if="posters">
<view class="item" @click="setPosterImageStatus">
<view class="iconfont icon-haibao"></view>
<view >生成海报</view>
<view>生成海报</view>
</view>
</view>
<view class="generate-posters acea-row row-middle" v-if="!posters">
<view class="generate-posters acea-row row-middle" v-if="!posters">
<view class="item" @click="setPosterImageStatus">
<view class="iconfont icon-haibao"></view>
<view >生成海报</view>
<view>生成海报</view>
</view>
</view>
<view class="mask" @touchmove.prevent @click="listenerActionClose" v-show="posters"></view>
@ -158,7 +171,7 @@
height="100%"
frameborder="0"
scrolling="no"
:src="'https://apis.map.qq.com/uri/v1/geocoder?coord=' +system_store.latitude +',' +system_store.longitude +'&referer=' +mapKey"
:src="'https://apis.map.qq.com/uri/v1/geocoder?coord=' +systemStore.latitude +',' +systemStore.longitude +'&referer=' +mapKey"
></iframe>
</view>
<view class="posterCanvasWarp">
@ -255,18 +268,16 @@ export default {
observeParents: true
},
goodList: [],
system_store: {},
systemStore: {},
qqmapsdk: null,
productConClass: "product-con"
};
},
computed: mapGetters(["isLogin"]),
computed: mapGetters(["isLogin", "location"]),
mounted: function() {
let url = handleQrCode();
console.log(url);
if (url && url.productId) {
this.id = url.productId;
} else {
this.id = this._route.query.id;
}
@ -299,25 +310,22 @@ export default {
}
});
},
showChang: function() {
if (isWeixin()) {
let config = {
latitude: this.system_store.latitude,
longitude: this.system_store.longitude,
name: this.system_store.name,
address: this.system_store._detailed_address
};
} else {
if (!this.mapKey) {
uni.showToast({
title: "暂无法使用查看地图请配置您的腾讯地图key",
icon: "none",
duration: 2000
});
return;
}
this.mapShow = true;
showChang: function(data) {
let config = {
latitude: data.latitude,
longitude: data.longitude,
name: data.name,
address: data._detailed_address
};
if (!this.mapKey) {
uni.showToast({
title: "暂无法使用查看地图请配置您的腾讯地图key",
icon: "none",
duration: 2000
});
return;
}
this.mapShow = true;
},
updateTitle() {
// document.title = this.storeInfo.storeName || this.$yroute.meta.title;
@ -340,13 +348,14 @@ export default {
//产品详情接口;
productCon: function() {
let that = this;
let from = {};
let from = this.location;
if (this.$deviceType == "app") {
from.from = "app";
}
uni.showLoading({ title: "加载中", mask: true });
getProductDetail(that.id, from)
.then(res => {
console.log(res);
that.$set(that, "storeInfo", res.data.storeInfo);
// 给 attr 赋值,将请求回来的规格赋值给 attr
that.$set(that.attr, "productAttr", res.data.productAttr);
@ -365,7 +374,7 @@ export default {
}
that.posterData.price = that.storeInfo.price;
that.posterData.code = that.storeInfo.codeBase;
// that.system_store = res.data.system_store;
that.systemStore = res.data.systemStore;
let good_list = res.data.goodList || [];
let goodArray = [];
let count = Math.ceil(good_list.length / 6);
@ -703,12 +712,16 @@ export default {
}
.product-con .store-info .info .picTxt {
width: 6.15 * 100rpx;
width: 100%;
display: flex;
align-items: center;
}
.product-con .store-info .info .picTxt .pictrue {
width: 0.76 * 100rpx;
height: 0.76 * 100rpx;
margin-right: 0.2 * 100rpx;
}
.product-con .store-info .info .picTxt .pictrue image {
@ -718,7 +731,7 @@ export default {
}
.product-con .store-info .info .picTxt .text {
width: 5.22 * 100rpx;
flex: 1;
}
.product-con .store-info .info .picTxt .text .name {
@ -738,12 +751,25 @@ export default {
margin-left: 0.1 * 100rpx;
}
.product-con .store-info .info .picTxt .text .address .addressTxt {
width: 4.8 * 100rpx;
.product-con .store-info .info .picTxt .addressBox {
display: flex;
flex-direction: column;
align-items: flex-end;
}
.product-con .store-info .info .picTxt .addressBox .iconfont {
font-size: 0.4 * 100rpx;
}
.product-con .store-info .info .picTxt .addressBox .addressTxt {
font-size: 0.24 * 100rpx;
color: #00c17b;
}
.product-con .store-info .info .iconfont {
font-size: 0.4 * 100rpx;
.product-con .store-info .praise {
font-size: 0.28 * 100rpx;
color: #808080;
}
.product-con .store-info .praise .iconfont {
font-size: 0.28 * 100rpx;
}
.product-con .superior {

View File

@ -174,7 +174,7 @@ export default {
})
.then(res => {
var data = res.data;
that.$store.commit("LOGIN", data.token, dayjs(data.expires_time));
that.$store.commit("login", data.token, dayjs(data.expires_time));
handleGetUserInfo();
})
.catch(err => {
@ -305,7 +305,7 @@ export default {
spread: cookie.get("spread")
})
.then(({ data }) => {
this.$store.commit("LOGIN", data.token, dayjs(data.expires_time));
this.$store.commit("login", data.token, dayjs(data.expires_time));
handleGetUserInfo();
// let replace=this.$yroute.query.replace
// if(replace){

View File

@ -149,7 +149,7 @@ export default {
.then(({ data }) => {
uni.hideLoading();
const expires_time = dayjs(data.expires_time);
store.commit("LOGIN", data.token, expires_time);
store.commit("login", data.token, expires_time);
that.$emit("changeswitch", false);
location.reload();
})
@ -164,7 +164,7 @@ export default {
} else {
cookie.set("loginType", "wechat", 60);
uni.hideLoading();
this.$store.commit("LOGOUT");
this.$store.commit("logout");
this.$emit("changeswitch", false);
}
},
@ -204,7 +204,7 @@ export default {
avatar: userInfo.avatar
}).then(
res => {
this.$store.dispatch("USERINFO", true);
this.$store.dispatch("userInfo", true);
this.$uni.showToast({
title: res.msg,
icon: "none",
@ -229,7 +229,7 @@ export default {
if (res.confirm) {
getLogout()
.then(res => {
this.$store.commit("LOGOUT");
this.$store.commit("logout");
clearAuthStatus();
location.href = location.origin;
})

View File

@ -115,9 +115,6 @@
</view>
</view>
<view class="myService">
<view class="title acea-row row-middle">
<text>我的服务</text>
</view>
<view class="serviceList acea-row row-middle">
<template v-for="(item, MyMenusIndex) in MyMenus">
<view
@ -129,7 +126,8 @@
<view class="pictrue">
<image :src="item.pic" />
</view>
<view>{{ item.name }}</view>
<view class="cell">{{ item.name }}</view>
<text class="iconfont icon-jiantou"></text>
</view>
</template>
</view>
@ -188,7 +186,7 @@ export default {
},
computed: mapGetters(["userInfo"]),
methods: {
...mapMutations(["UPDATE_AUTHORIZATIONPAGE", "CHANGE_TABTAR"]),
...mapMutations(["updateAuthorizationPage", "CHANGE_TABTAR"]),
goReturnList() {
this.$yrouter.push("/pages/order/ReturnList/index");
},
@ -240,7 +238,7 @@ export default {
.then(res => {
console.log(res);
// this.User();
thit.$store.dispatch("USERINFO", true);
thit.$store.dispatch("userInfo", true);
uni.hideLoading();
uni.showToast({
title: res.msg,
@ -250,7 +248,7 @@ export default {
})
.catch(error => {
uni.hideLoading();
thit.$store.dispatch("USERINFO", true);
thit.$store.dispatch("userInfo", true);
console.log(error);
uni.showToast({
title:
@ -353,7 +351,7 @@ export default {
},
onHide() {
console.log('离开用户中心')
this.UPDATE_AUTHORIZATIONPAGE(false);
this.updateAuthorizationPage(false);
}
};
</script>