Commit e7924b6b authored by 786817560's avatar 786817560

Merge branch 'ren' into develop

parents 7f3cd95f 23f9c091
...@@ -2,12 +2,12 @@ ...@@ -2,12 +2,12 @@
* @Descrip: 主页 * @Descrip: 主页
* @Author: your name * @Author: your name
* @Date: 2019-10-10 14:25:15 * @Date: 2019-10-10 14:25:15
* @LastEditTime: 2019-10-12 17:22:27 * @LastEditTime: 2019-10-14 13:57:37
* @LastEditors: Please set LastEditors * @LastEditors: Please set LastEditors
--> -->
<template> <template>
<h-view id="homePage" class="public-style" title="徐工租赁"> <h-view id="homePage" class="public-style" title="徐工租赁">
<h-header class="bar-custom"> <h-header :proportion="[7,8,0]" class="bar-custom">
<div slot="left" class="h-header-btn"> <div slot="left" class="h-header-btn">
<!-- <i class="ion-ios-arrow-back" /> --> <!-- <i class="ion-ios-arrow-back" /> -->
<img class="locations" src="@/assets/homePage/location.png" alt="" @click="location"> <img class="locations" src="@/assets/homePage/location.png" alt="" @click="location">
...@@ -74,6 +74,7 @@ export default { ...@@ -74,6 +74,7 @@ export default {
data () { data () {
return { return {
city: '', city: '',
province: '',
functionList: [ functionList: [
{ {
functionIcon: require('@/assets/homePage/product-select.png'), functionIcon: require('@/assets/homePage/product-select.png'),
...@@ -107,26 +108,24 @@ export default { ...@@ -107,26 +108,24 @@ export default {
{ {
// 定位 // 定位
getLocation () { getLocation () {
// let url = 'http://api.map.baidu.com/location/ip?ak=2h7McXV8X4CmFkYEuhPGWLKWpdQrdHCg&coor=bd09ll'
// this.hlsHttp.post(url).then(function (res) {
// console.log(res)
// })
// this.getAddress = function () {
let vm = this let vm = this
var geolocation = new BMap.Geolocation() var geolocation = new BMap.Geolocation()
geolocation.getCurrentPosition(function (res) { geolocation.getCurrentPosition(function (res) {
// debugger // debugger
if (this.getStatus() === 0) { if (this.getStatus() === 0) {
console.log('定位。。。。', res.address.city) console.log('定位。。。。', res.address)
vm.city = res.address.city // 判断是否是手动选择过定位
// $rootScope.city = res.address.city if (window.localStorage.getItem('province')) {
// $rootScope.addr = '' console.log('ssss', window.localStorage.getItem('province'))
vm.city = window.localStorage.getItem('city')
vm.province = window.localStorage.getItem('province')
} else { } else {
// $rootScope.city = '' // 没有就定位当前位置
// $rootScope.addr = '' vm.city = res.address.city
vm.province = res.address.province
}
} }
}, {enableHighAccuracy: true}) }, {enableHighAccuracy: true})
// }
}, },
goFunctionHome (data) { goFunctionHome (data) {
// if (data.functionState === 'NaturePersonReadOnly') { // if (data.functionState === 'NaturePersonReadOnly') {
...@@ -156,15 +155,23 @@ export default { ...@@ -156,15 +155,23 @@ export default {
location () { location () {
this.$router.push({ this.$router.push({
name: 'Location', name: 'Location',
params: {
province: this.province,
city: this.city,
},
}) })
}, },
}, },
} }
</script> </script>
<style lang='less' scoped> <style lang='less' scoped>
#homePage { #homePage {
.h-header .h-header-left .h-header-btn:first-of-type { .h-header .h-header-left .h-header-btn:first-of-type {
padding-left: 0.2rem; padding-left: 0.2rem;
}
.h-header .h-header-center div{
text-align: left!important;
} }
.locations { .locations {
height: 24px; height: 24px;
...@@ -253,7 +260,7 @@ export default { ...@@ -253,7 +260,7 @@ export default {
} }
} }
.item-content { .item-content {
width: 90%; // width: 90%;
height: 110px; height: 110px;
// border: 1px solid #ccc; // border: 1px solid #ccc;
.top { .top {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Descrip""/>User Settings Edit * @Descrip""/>User Settings Edit
* @Author: your name * @Author: your name
* @Date: 2019-10-11 09:39:51 * @Date: 2019-10-11 09:39:51
* @LastEditTime: 2019-10-11 15:55:47 * @LastEditTime: 2019-10-14 14:05:34
* @LastEditors: Please set LastEditors * @LastEditors: Please set LastEditors
--> -->
<template> <template>
...@@ -23,12 +23,12 @@ ...@@ -23,12 +23,12 @@
</div> </div>
<list-item> <list-item>
<item> <item :proportion="[5,2]">
<section slot="name" class="place">{{ places }}</section> <section slot="name" class="place">{{ places }}</section>
<section slot="content" class="relocation"> <section slot="content" class="relocation">
<div> <div>
<img src="@/assets/homePage/relocation.png" alt=""> <img src="@/assets/homePage/relocation.png" alt="">
<p>重新定位</p> <p @click="relocation">重新定位</p>
</div> </div>
</section> </section>
...@@ -42,15 +42,18 @@ ...@@ -42,15 +42,18 @@
<p :class="{styles:!flag}" @click="changeStyle(1)">{{ province }}</p> <p :class="{styles:!flag}" @click="changeStyle(1)">{{ province }}</p>
<p :class="{styles:flag}" @click="changeStyle(2)">{{ city }}</p> <p :class="{styles:flag}" @click="changeStyle(2)">{{ city }}</p>
</div> </div>
<!-- 省份 -->
<list-item v-if="province_flag" :item-height="40"> <list-item v-if="province_flag" :item-height="40">
<item v-for="(item,index) in lists" :key="index"> <item v-for="(item,index) in lists" :key="index" :proportion="[5,2]">
<section slot="name" @click="selectProvince(item)">{{ item }}</section> <section slot="name" @click="selectProvince(item)">{{ item.province_name }}</section>
</item> </item>
</list-item> </list-item>
<!-- 城市 -->
<list-item v-if="!province_flag" :item-height="40"> <list-item v-if="!province_flag" :item-height="40">
<item v-for="(item,index) in cityList" :key="index"> <item v-for="(item,index) in cityList" :key="index" :proportion="[5,2]">
<section slot="name" @click="selectCity(item)">{{ item }}</section> <section slot="name" @click="selectCity(item.city_name)">{{ item.city_name }}</section>
</item> </item>
</list-item> </list-item>
</h-content> </h-content>
...@@ -65,18 +68,54 @@ export default { ...@@ -65,18 +68,54 @@ export default {
province_flag: true, province_flag: true,
province: '请选择省', province: '请选择省',
city: '请选择市', city: '请选择市',
places: '江苏省-徐州市', places: '',
lists: ['北京省', '浙江省', '四川省'], lists: [],
cityList: ['北京市', '成都市', '上海市', '广州市'], cityList: [],
} }
}, },
computed: {}, computed: {},
watch: {}, watch: {},
created () {
// 判断是否是初次进入,不是就显示手动绑定的位置
if (window.localStorage.getItem('province')) {
this.places = window.localStorage.getItem('province') + '-' + window.localStorage.getItem('city')
} else {
this.places = this.$route.params.province + '-' + this.$route.params.city
}
this.selectLocation()
},
methods: methods:
{ {
// 重新定位到当前位置
relocation () {
let vm = this
var geolocation = new BMap.Geolocation()
geolocation.getCurrentPosition(function (res) {
// debugger
if (this.getStatus() === 0) {
console.log('定位。。。。', res.address)
window.localStorage.setItem('province', res.address.province)
window.localStorage.setItem('city', res.address.city)
vm.places = window.localStorage.getItem('province') + '-' + window.localStorage.getItem('city')
}
}, {enableHighAccuracy: true})
},
// 省份查询
selectLocation () {
let vm = this
let url = process.env.basePath + 'fnd_province_query'
let param = {}
vm.hlsHttp.post(url, param).then(function (res) {
console.log(res)
vm.lists = res.lists
})
},
switchCity () { switchCity () {
}, },
// 省份与城市切换
changeStyle (val) { changeStyle (val) {
console.log(val) console.log(val)
if (val === 1) { if (val === 1) {
...@@ -86,8 +125,20 @@ export default { ...@@ -86,8 +125,20 @@ export default {
this.flag = true this.flag = true
} }
}, },
// 城市查询
selectProvince (val) { selectProvince (val) {
this.province = val this.province = val.province_name
let url = process.env.basePath + 'fnd_city_query'
let param = {
province_id: val.province_id,
}
let vm = this
this.hlsHttp.post(url, param).then(function (res) {
console.log(res)
// this.lists = res.lists
vm.cityList = res.lists
})
this.flag = !this.flag this.flag = !this.flag
this.province_flag = false this.province_flag = false
}, },
...@@ -98,6 +149,9 @@ export default { ...@@ -98,6 +149,9 @@ export default {
onConfirm: (data) => { onConfirm: (data) => {
console.log(data) console.log(data)
if (data) { if (data) {
// window.sessionStorage.setItem('bp_class', item.bp_class)
window.localStorage.setItem('province', this.province)
window.localStorage.setItem('city', val)
this.places = this.province + '-' + val this.places = this.province + '-' + val
this.city = val this.city = val
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Description: In User Settings Edit * @Description: In User Settings Edit
* @Author: your name * @Author: your name
* @Date: 2019-09-24 12:34:06 * @Date: 2019-09-24 12:34:06
* @LastEditTime: 2019-10-11 09:47:23 * @LastEditTime: 2019-10-14 13:47:34
* @LastEditors: Please set LastEditors * @LastEditors: Please set LastEditors
*/ */
import Vue from 'vue' import Vue from 'vue'
...@@ -85,7 +85,7 @@ export default new Router({ ...@@ -85,7 +85,7 @@ export default new Router({
path: '/home-page', path: '/home-page',
component: HomePage, component: HomePage,
name: 'HomePage', name: 'HomePage',
meta: {keepAlive: true}, meta: {keepAlive: false},
}, },
{ {
path: '/location', path: '/location',
......
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