Browse Source

Merge branch 'bug_fix' into feature

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

2
src/views/communityPublicity/detail.vue

@ -17,7 +17,7 @@
<div class="flex1 flex flex-center1 flex-center2"> <div class="flex1 flex flex-center1 flex-center2">
<van-button size="small" class="m-right7" round @click="communityPublicityGiveLike(info.id,'likes')"> <van-button size="small" class="m-right7" round @click="communityPublicityGiveLike(info.id,'likes')">
<template #icon> <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> </template> 点赞{{ info.likes || 0 }} </van-button>
</div> </div>
<div class="flex1 flex flex-center1 flex-center2"> <div class="flex1 flex flex-center1 flex-center2">

29
src/views/selectAgency/index.vue

@ -34,7 +34,8 @@ export default {
address: null, address: null,
district: null, district: null,
show:true, show:true,
autoFlag:true autoFlag:true,
latLng:null
}; };
}, },
created() { created() {
@ -42,6 +43,9 @@ export default {
mounted() { mounted() {
setConfig(['checkJsApi', 'openLocation', 'getLocation', 'updateAppMessageShareData', 'updateTimelineShareData']) setConfig(['checkJsApi', 'openLocation', 'getLocation', 'updateAppMessageShareData', 'updateTimelineShareData'])
this.signWX() this.signWX()
if(this.latLng){
this.getAgency()
}
}, },
methods: { methods: {
restAddress() { restAddress() {
@ -66,8 +70,8 @@ export default {
wx.getLocation({ wx.getLocation({
type: 'gcj02', // wgs84gpsopenLocation'gcj02' type: 'gcj02', // wgs84gpsopenLocation'gcj02'
success: function (res) { success: function (res) {
var latLng = new qq.maps.LatLng(res.latitude, res.longitude) _this.latLng = new qq.maps.LatLng(res.latitude, res.longitude)
getAddr.getAddress(latLng) _this.getAddress()
}, },
cancel: function (res) { cancel: function (res) {
alert('用户拒绝授权获取地理位置') alert('用户拒绝授权获取地理位置')
@ -77,18 +81,19 @@ export default {
wx.error(function (res) { wx.error(function (res) {
console.log('微信js-sdk 配置失败000' + res.errMsg) console.log('微信js-sdk 配置失败000' + res.errMsg)
}) })
// },
var getAddr = new qq.maps.Geocoder({ //
complete: function (res) { getAddress() {
_this.address = res.detail 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) => {
var allAddress = res.detail.addressComponents if (res.status == 200) {
var address = res.detail.address this.district = res.data.regeocode.addressComponent.district;
console.log('地址:', address, allAddress.province, allAddress.city, allAddress.district) this.getAgency(true)
_this.district = allAddress.district; } else{
_this.getAgency(true) console.log(res);
} }
}) })
}, },
backAuto(){ backAuto(){
if(this.autoFlag) return if(this.autoFlag) return
this.autoFlag = true; this.autoFlag = true;

9
vue.config.js

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

Loading…
Cancel
Save