Commit 1cd6ac20 authored by linxin's avatar linxin

add

parent a94f95d6
...@@ -82,14 +82,15 @@ export default { ...@@ -82,14 +82,15 @@ export default {
}, },
watch: {}, watch: {},
created () { created () {
this.getLocation() // this.getLocation()
}, },
beforeRouteEnter (to, from, next) { beforeRouteEnter (to, from, next) {
next(vm => { next(vm => {
// if (from.name === 'Login') { // if (from.name === 'Login') {
vm.moduleSeparateList = [...functionState.moduleSeparateList] vm.moduleSeparateList = [...functionState.moduleSeparateList]
vm.userQuery() vm.userQuery()
vm.guessingQuery() // 猜你喜欢查询 // vm.guessingQuery() // 猜你喜欢查询
vm.getLocation()
// } // }
}) })
...@@ -101,17 +102,21 @@ export default { ...@@ -101,17 +102,21 @@ export default {
let vm = this let vm = this
if (vum.Platform.isAndroid()) { // 安卓采用jsapi if (vum.Platform.isAndroid()) { // 安卓采用jsapi
var geolocation = new BMap.Geolocation() var geolocation = new BMap.Geolocation()
vm.hlsPopup.showLoading('数据加载中')
geolocation.getCurrentPosition(function (res) { geolocation.getCurrentPosition(function (res) {
vm.hlsPopup.hideLoading()
if (this.getStatus() === 0) { if (this.getStatus() === 0) {
// 判断是否是手动选择过定位 // 判断是否是手动选择过定位
if (window.localStorage.getItem('province')) { if (window.localStorage.getItem('province')) {
vm.city = window.localStorage.getItem('city') vm.city = window.localStorage.getItem('city')
vm.province = window.localStorage.getItem('province') vm.province = window.localStorage.getItem('province')
vm.guessingQuery(vm.city)
} else { } else {
// 没有就定位当前位置 // 没有就定位当前位置
console.log(res) console.log(res)
vm.city = res.address.city vm.city = res.address.city
vm.province = res.address.province vm.province = res.address.province
vm.guessingQuery(res.address.city)
} }
} }
}, {enableHighAccuracy: true}) }, {enableHighAccuracy: true})
...@@ -121,13 +126,16 @@ export default { ...@@ -121,13 +126,16 @@ export default {
if (window.localStorage.getItem('province')) { if (window.localStorage.getItem('province')) {
vm.city = window.localStorage.getItem('city') vm.city = window.localStorage.getItem('city')
vm.province = window.localStorage.getItem('province') vm.province = window.localStorage.getItem('province')
vm.guessingQuery(vm.city)
} else { } else {
vm.city = result.city vm.city = result.city
vm.province = result.province vm.province = result.province
vm.guessingQuery(result.city)
} }
}, function (error) { }, function (error) {
}) })
} }
// setTimeout(vm.guessingQuery(), 0)
}, },
goFunctionHome (data) { goFunctionHome (data) {
this.$router.push({ this.$router.push({
...@@ -169,12 +177,13 @@ export default { ...@@ -169,12 +177,13 @@ export default {
}) })
}, },
// 猜你喜欢 // 猜你喜欢
guessingQuery () { guessingQuery (e) {
console.log(e)
let vm = this let vm = this
let url = $config.basePath + 'guess_you_like_query' let url = $config.basePath + 'guess_you_like_query'
let param = { let param = {
'user_phone': window.localStorage.getItem('user_phone'), 'user_phone': window.localStorage.getItem('user_phone'),
'city': vm.city, 'city': e,
} }
vm.hlsPopup.showLoading('数据加载中') vm.hlsPopup.showLoading('数据加载中')
vm.$post(url, param).then(function (res) { vm.$post(url, param).then(function (res) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment