12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <template>
- <view class="home-page">
- <gf-yinsi @handleAgree="handleAgree"></gf-yinsi>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- }
- },
- onLoad() {
- },
- methods: {
- handleAgree(e) {
- uni.switchTab({
- url: "/pages/index/index"
- })
- if (uni.getStorageSync("city") && uni.getStorageSync("city").city_id) {
- this.$store.commit('setdefaultcity', uni.getStorageSync("city"))
- } else {
- this.$amapPlugin.getRegeo({
- success: (res) => {
- //成功回调
- // console.log(res[0]);
- this.$store.commit('setcity', {
- city: res[0].regeocodeData.addressComponent.city,
- userLocation: `${res[0].longitude},${res[0].latitude}`,
- city_id: '',
- province_id: '',
- })
- },
- fail: (info) => {
- //失败回调
- // console.log(info)
- this.$store.commit('setcity', {
- city: '温州市',
- userLocation: '120.699279,27.993849',
- city_id: 2,
- province_id: 1
- })
- }
- })
- }
- },
- }
- }
- </script>
- <style lang="scss">
- .home-page {}
- </style>
|