Browse Source

Merge branch 'bug_fix' into feature

xiaowang
mk 1 year ago
parent
commit
c3bd38c311
  1. 6
      src/main.js
  2. 2
      src/views/communityPublicity/detail.vue
  3. 29
      src/views/selectAgency/index.vue
  4. 9
      vue.config.js

6
src/main.js

@ -12,7 +12,8 @@ import '@/plugins/vant'
import '@/assets/css/index.less'
// 移动端适配
import 'amfe-flexible'
// 请求
import http from "axios";
// icon
import './assets/icons'
import Android from '@/components/Android'
@ -25,11 +26,14 @@ import dayjs from 'dayjs'
Vue.prototype.$dayjs = dayjs
// 提示框封装
import { Tips } from '@/utils'
Vue.prototype.$http = http;
Vue.prototype.$tips = Tips
//开发环境使用,生产环境自动取消
import Vconsole from 'vconsole'
import Perfect from '@/components/Perfect'
import axios from 'axios'
axios.defaults.baseURL = '/geocode'
Vue.config.ignoredElements = ["wx-open-launch-weapp"];
Vue.component('Perfect', Perfect)
if (process.env.NODE_ENV !== 'production') {

2
src/views/communityPublicity/detail.vue

@ -17,7 +17,7 @@
<div class="flex1 flex flex-center1 flex-center2">
<van-button size="small" class="m-right7" round @click="communityPublicityGiveLike(info.id,'likes')">
<template #icon>
<img src="@/assets/images/icons/link.png" alt="" class="img_20">
<img :src="require(`@/assets/images/icons/${info.approveStatus === '0'?'link2':'link'}.png`)" alt="" class="img_20">
</template> 点赞{{ info.likes || 0 }} </van-button>
</div>
<div class="flex1 flex flex-center1 flex-center2">

29
src/views/selectAgency/index.vue

@ -34,7 +34,8 @@ export default {
address: null,
district: null,
show:true,
autoFlag:true
autoFlag:true,
latLng:null
};
},
created() {
@ -42,6 +43,9 @@ export default {
mounted() {
setConfig(['checkJsApi', 'openLocation', 'getLocation', 'updateAppMessageShareData', 'updateTimelineShareData'])
this.signWX()
if(this.latLng){
this.getAgency()
}
},
methods: {
restAddress() {
@ -66,8 +70,8 @@ export default {
wx.getLocation({
type: 'gcj02', // wgs84gpsopenLocation'gcj02'
success: function (res) {
var latLng = new qq.maps.LatLng(res.latitude, res.longitude)
getAddr.getAddress(latLng)
_this.latLng = new qq.maps.LatLng(res.latitude, res.longitude)
_this.getAddress()
},
cancel: function (res) {
alert('用户拒绝授权获取地理位置')
@ -77,18 +81,19 @@ export default {
wx.error(function (res) {
console.log('微信js-sdk 配置失败000' + res.errMsg)
})
//
var getAddr = new qq.maps.Geocoder({
complete: function (res) {
_this.address = res.detail
var allAddress = res.detail.addressComponents
var address = res.detail.address
console.log('地址:', address, allAddress.province, allAddress.city, allAddress.district)
_this.district = allAddress.district;
_this.getAgency(true)
},
//
getAddress() {
this.$http.get(`https://restapi.amap.com/v3/geocode/regeo?location=${this.latLng.lng},${this.latLng.lat}&key=2af5c38e8d31470a87b4671829e01d1a&radius=1000&extensions=all`).then((res) => {
if (res.status == 200) {
this.district = res.data.regeocode.addressComponent.district;
this.getAgency(true)
} else{
console.log(res);
}
})
},
backAuto(){
if(this.autoFlag) return
this.autoFlag = true;

9
vue.config.js

@ -38,6 +38,15 @@ module.exports = defineConfig({
pathRewrite: {
'^api': ''
}
},
'/geocode': {
target: `https://restapi.amap.com/v3`,
// target: `http://127.0.0.1:8080`,
changeOrigin: true,
ws: false,
pathRewrite: {
'/geocode': '/'
}
}
}
},

Loading…
Cancel
Save