首页,我的 写扫码点餐之前提交1.0.0

This commit is contained in:
wwz
2025-02-13 16:49:13 +08:00
parent 6cea5aeb42
commit f2513ef13a
48 changed files with 7757 additions and 514 deletions

82
App.vue
View File

@@ -1,15 +1,79 @@
<script>
<script setup>
import {
useNavbarStore
} from '@/stores/navbarStore';
export default {
onLaunch: function() {
const store = useNavbarStore();
store.initNavbarHeight();
},
onShow: function() {},
onHide: function() {}
}
import {
APIgeocodelocation
} from "@/common/api/api.js"
import {
onLaunch
} from '@dcloudio/uni-app';
import {
getCurrentInstance
} from 'vue'
const {
proxy
} = getCurrentInstance()
// 小程序启动时执行
onLaunch(async () => {
// 标记应用启动完成
const store = useNavbarStore();
store.initNavbarHeight();
try {
uni.getLocation({
type: 'wgs84',
success: async (res) => {
let successres = await APIgeocodelocation({
lng: res.longitude,
lat: res.latitude,
})
if (successres.code == 0) {
let datastorage = {
country: successres.data.addressComponent.country, // "中国"
province: successres.data.addressComponent
.province, //province: "陕西省"
address: successres.data.addressComponent.city, //district: "西安市"
district: successres.data.addressComponent
.district, //district: "未央区"
lng: res.longitude,
lat: res.latitude,
}
uni.cache.set('getLocationstorage', datastorage);
proxy.$isResolve()
}
},
});
} catch (error) {
let successres = await APIgeocodelocation({
lng: '',
lat: '',
})
if (successres.code == 0) {
let datastorage = {
country: successres.data.addressComponent.country, // "中国"
province: successres.data.addressComponent
.province, //province: "陕西省"
address: successres.data.addressComponent.city, //district: "西安市"
district: successres.data.addressComponent
.district, //district: "未央区"
lng: res.longitude,
lat: res.latitude,
}
uni.cache.set('getLocationstorage', datastorage);
proxy.$isResolve()
}
}
});
// export default {
// onLaunch: async function() {
// },
// onShow: function() {},
// onHide: function() {}
// }
</script>
<style lang="scss">