From 37b1176f4b37260bd455891898ed1258c6421607 Mon Sep 17 00:00:00 2001
From: rk <94314517@qq.com>
Date: 星期四, 21 八月 2025 15:28:00 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
small-program/App.vue | 91 +++++++++++++++++++++++++++------------------
1 files changed, 55 insertions(+), 36 deletions(-)
diff --git a/small-program/App.vue b/small-program/App.vue
index 9bfe61a..a57861a 100644
--- a/small-program/App.vue
+++ b/small-program/App.vue
@@ -1,11 +1,13 @@
<script>
import { mapState } from 'vuex'
+ var QQMapWX = require('@/utils/qqmap-wx-jssdk.js')
export default {
computed: {
...mapState(['userInfo','openid'])
},
- onLaunch: function() {
+ onLaunch: function() {
var that = this;
+ that.getLocaltionBiz()
if (!this.openid || this.openid =='') {
uni.login({
provider: 'weixin',
@@ -16,17 +18,6 @@
that.$store.commit('setToken', res.data.token)
that.$store.commit('setOpenid', res.data.openid)
that.$store.commit('setUserInfo', res.data.member)
- uni.getLocation({
- type: 'wgs84',
- success: (addr) => {
- that.$store.commit('setPosition', { latitude: addr.latitude, longitude: addr.longitude })
- that.$isResolve()
- },
- fail: (err) => {
- console.error('鑾峰彇浣嶇疆澶辫触', err);
- that.$isResolve()
- }
- });
}
}
@@ -35,32 +26,10 @@
var that = this
let res = this.$u.api.getMemberInfo({}).then(res =>{
if (res && res.code === 200) {
- that.$store.commit('setUserInfo', res.data)
- uni.getLocation({
- type: 'wgs84',
- success: (addr) => {
- that.$store.commit('setPosition', { latitude: addr.latitude, longitude: addr.longitude })
- that.$isResolve()
- },
- fail: (err) => {
- console.error('鑾峰彇浣嶇疆澶辫触', err);
- that.$isResolve()
- }
- });
+ that.$store.commit('setUserInfo', res.data)
} else {
that.$store.commit('setToken','')
- that.$store.commit('setUserInfo',{})
- uni.getLocation({
- type: 'wgs84',
- success: (addr) => {
- that.$store.commit('setPosition', { latitude: addr.latitude, longitude: addr.longitude })
- that.$isResolve()
- },
- fail: (err) => {
- console.error('鑾峰彇浣嶇疆澶辫触', err);
- that.$isResolve()
- }
- });
+ that.$store.commit('setUserInfo',{})
}
})
}
@@ -70,10 +39,60 @@
},
onHide: function() {
console.log('App Hide')
+ },
+ methods:{
+ getLocaltionBiz(){
+ var that =this
+ uni.getLocation({
+ type: 'wgs84',
+ success: (addr) => {
+ const locParam = { latitude: addr.latitude, longitude: addr.longitude ,address:'鑾峰彇鍦板潃澶辫触'};
+ var address =null
+ const qqmapsdk = new QQMapWX({
+ key: '4PXBZ-JLBC7-LCLXG-P2SZX-C4HYE-LDBLQ' //鑵捐鍦板浘鐢宠鐨刱ey锛堝悗缁渶瑕佸叕鍙告彁渚涳紝涓汉寮�鍙戣�呴搴︽湁闄愶級
+ });
+ // 鑵捐鍦板浘閫嗗湴鐞嗙紪鐮�
+ qqmapsdk.reverseGeocoder({
+ locParam,
+ success: function(res) {
+ console.log(res, '==================鑾峰彇鍦板潃');
+ let info = res.result;
+ locParam.province = info.address_component.province;
+ locParam.city = info.address_component.city;
+ locParam.area = info.address_component.district;
+ locParam.street = info.address_component.street;
+ var ta = info.address || '鍦板潃鑾峰彇澶辫触' ;
+ if(info.formatted_addresses && info.formatted_addresses.recommend){
+ ta =info.formatted_addresses.recommend
+ }
+ locParam.address =ta
+ that.$store.commit('setPosition',locParam)
+ that.$isResolve()
+ },
+ fail: (err) => {
+ console.error('鑾峰彇浣嶇疆澶辫触===========', err);
+ that.$store.commit('setPosition',locParam)
+ that.$isResolve()
+ }
+ });
+ // that.$store.commit('setPosition',locParam)
+ that.$isResolve()
+ },
+ fail: (err) => {
+ console.error('鑾峰彇浣嶇疆澶辫触', err);
+ that.$isResolve()
+ }
+ });
+ }
}
}
</script>
<style lang="scss">
@import "uview-ui/index.scss";
+
+ .toast-custom {
+ width: 500px !important;
+ font-size: 14px !important;
+ }
</style>
\ No newline at end of file
--
Gitblit v1.9.3