|
@@ -0,0 +1,66 @@
|
|
|
+<template>
|
|
|
+ <view class="container">
|
|
|
+ <serviceItem v-for="item of 5"></serviceItem>
|
|
|
+ </view>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+ import { getHomePageApi,getCurrentLocation } from '@/api/home';
|
|
|
+ import serviceItem from '@/components/service/index.vue';
|
|
|
+ export default{
|
|
|
+ data(){
|
|
|
+ return{
|
|
|
+ queryParams:{
|
|
|
+ region:null,//地区编码
|
|
|
+ longitude:null,//经度
|
|
|
+ latitude:null,//纬度
|
|
|
+ },
|
|
|
+ init_list:[]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ components:{
|
|
|
+ serviceItem
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ this.handlerInitLocation()
|
|
|
+ },
|
|
|
+ methods:{
|
|
|
+ // 获取当前经纬度
|
|
|
+ handlerInitLocation(){
|
|
|
+ uni.getLocation({
|
|
|
+ type: 'gcj02',
|
|
|
+ success: res => {
|
|
|
+ this.queryParams.longitude = res.longitude;
|
|
|
+ this.queryParams.latitude = res.longitude;
|
|
|
+ let point = {
|
|
|
+ latitude: res.longitude,
|
|
|
+ longitude: res.longitude
|
|
|
+ }
|
|
|
+ getCurrentLocation(point).then(rc=>{
|
|
|
+ this.queryParams.region = rc.data.id
|
|
|
+ this.handlerInitList()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ fail: (rs) => {
|
|
|
+ uni.showToast({
|
|
|
+ title:rs,
|
|
|
+ icon:'none'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 初始化列表信息
|
|
|
+ handlerInitList(){
|
|
|
+ getHomePageApi(this.queryParams).then(res=>{
|
|
|
+ console.log('getHomePageApi',res);
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+ .container{
|
|
|
+
|
|
|
+ }
|
|
|
+</style>
|