Commit 8b03ef4b authored by liumiss's avatar liumiss

地图

parent bd2c2bce
module.exports = { module.exports = {
presets: ["@vue/app"] presets: ["@vue/app"],
plugins: [
['import', {
libraryName: 'vant',
libraryDirectory: 'es',
style: true
}, 'vant']
]
}; };
...@@ -711,6 +711,15 @@ ...@@ -711,6 +711,15 @@
"regexpu-core": "^4.5.4" "regexpu-core": "^4.5.4"
} }
}, },
"@babel/polyfill": {
"version": "7.4.4",
"resolved": "https://registry.npmjs.org/@babel/polyfill/-/polyfill-7.4.4.tgz",
"integrity": "sha512-WlthFLfhQQhh+A2Gn5NSFl0Huxz36x86Jn+E9OW7ibK8edKPq+KLy4apM1yDpQ8kJOVi1OVjpP4vSDLdrI04dg==",
"requires": {
"core-js": "^2.6.5",
"regenerator-runtime": "^0.13.2"
}
},
"@babel/preset-env": { "@babel/preset-env": {
"version": "7.3.4", "version": "7.3.4",
"resolved": "https://registry.npm.taobao.org/@babel/preset-env/download/@babel/preset-env-7.3.4.tgz", "resolved": "https://registry.npm.taobao.org/@babel/preset-env/download/@babel/preset-env-7.3.4.tgz",
...@@ -766,7 +775,6 @@ ...@@ -766,7 +775,6 @@
"version": "7.5.5", "version": "7.5.5",
"resolved": "https://registry.npm.taobao.org/@babel/runtime/download/@babel/runtime-7.5.5.tgz", "resolved": "https://registry.npm.taobao.org/@babel/runtime/download/@babel/runtime-7.5.5.tgz",
"integrity": "sha1-dPulbTXvvspEQJHHhQzNSU/S8TI=", "integrity": "sha1-dPulbTXvvspEQJHHhQzNSU/S8TI=",
"dev": true,
"requires": { "requires": {
"regenerator-runtime": "^0.13.2" "regenerator-runtime": "^0.13.2"
} }
...@@ -980,11 +988,15 @@ ...@@ -980,11 +988,15 @@
"integrity": "sha1-aQoUdbhPKohP0HzXl8APXzE1bqg=", "integrity": "sha1-aQoUdbhPKohP0HzXl8APXzE1bqg=",
"dev": true "dev": true
}, },
"@vant/icons": {
"version": "1.1.13",
"resolved": "https://registry.npmjs.org/@vant/icons/-/icons-1.1.13.tgz",
"integrity": "sha512-r2EoKDQ4Xh82fo5jVY/m/+LZFfRhHp+ViagySExzlJ7t6JFtmK1OqB6HdFkXXbfEzB/48BvGoPVifFoYzke6KQ=="
},
"@vue/babel-helper-vue-jsx-merge-props": { "@vue/babel-helper-vue-jsx-merge-props": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npm.taobao.org/@vue/babel-helper-vue-jsx-merge-props/download/@vue/babel-helper-vue-jsx-merge-props-1.0.0.tgz", "resolved": "https://registry.npm.taobao.org/@vue/babel-helper-vue-jsx-merge-props/download/@vue/babel-helper-vue-jsx-merge-props-1.0.0.tgz",
"integrity": "sha1-BI/leZWNpAj7eosqPsBQtQpmEEA=", "integrity": "sha1-BI/leZWNpAj7eosqPsBQtQpmEEA="
"dev": true
}, },
"@vue/babel-plugin-transform-vue-jsx": { "@vue/babel-plugin-transform-vue-jsx": {
"version": "1.0.0", "version": "1.0.0",
...@@ -1711,6 +1723,15 @@ ...@@ -1711,6 +1723,15 @@
"integrity": "sha1-l6ERlkmyEa0zaR2fn0hqjsn74KM=", "integrity": "sha1-l6ERlkmyEa0zaR2fn0hqjsn74KM=",
"dev": true "dev": true
}, },
"amap-js": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/amap-js/-/amap-js-1.2.1.tgz",
"integrity": "sha512-kEgT6dyNalnQF90PAZ1GPZbhAvanT0xtPFcOa00gkHO6HzEm8pKpi/tMrPa3DryiMQ7V6EGJCGSzhx3MHum+hw==",
"requires": {
"@babel/polyfill": "^7.2.5",
"http-jsonp": "^1.1.1"
}
},
"amdefine": { "amdefine": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npm.taobao.org/amdefine/download/amdefine-1.0.1.tgz", "resolved": "https://registry.npm.taobao.org/amdefine/download/amdefine-1.0.1.tgz",
...@@ -2085,6 +2106,16 @@ ...@@ -2085,6 +2106,16 @@
"object.assign": "^4.1.0" "object.assign": "^4.1.0"
} }
}, },
"babel-plugin-import": {
"version": "1.12.0",
"resolved": "https://registry.npmjs.org/babel-plugin-import/-/babel-plugin-import-1.12.0.tgz",
"integrity": "sha512-3Fo7sJ2Hm71y1VJS7eMA/E7J5+roKJmzwia5BxzUQREBs6CRylwtvQq8m39W8nplG4Y7rZwOCndh5MzRTSmHpA==",
"dev": true,
"requires": {
"@babel/helper-module-imports": "^7.0.0",
"@babel/runtime": "^7.0.0"
}
},
"babel-plugin-module-resolver": { "babel-plugin-module-resolver": {
"version": "3.2.0", "version": "3.2.0",
"resolved": "https://registry.npm.taobao.org/babel-plugin-module-resolver/download/babel-plugin-module-resolver-3.2.0.tgz", "resolved": "https://registry.npm.taobao.org/babel-plugin-module-resolver/download/babel-plugin-module-resolver-3.2.0.tgz",
...@@ -6361,6 +6392,11 @@ ...@@ -6361,6 +6392,11 @@
} }
} }
}, },
"http-jsonp": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/http-jsonp/-/http-jsonp-1.1.1.tgz",
"integrity": "sha512-ZXegkBJDtoCGzGjnsoHuandNUJGe5jwIdeetVJIOLYJUO7mzR9SOjFQv9acO3zekHALLiPMnNJbt1LLDzprU3A=="
},
"http-parser-js": { "http-parser-js": {
"version": "0.4.10", "version": "0.4.10",
"resolved": "https://registry.npm.taobao.org/http-parser-js/download/http-parser-js-0.4.10.tgz", "resolved": "https://registry.npm.taobao.org/http-parser-js/download/http-parser-js-0.4.10.tgz",
...@@ -9485,8 +9521,7 @@ ...@@ -9485,8 +9521,7 @@
"regenerator-runtime": { "regenerator-runtime": {
"version": "0.13.3", "version": "0.13.3",
"resolved": "https://registry.npm.taobao.org/regenerator-runtime/download/regenerator-runtime-0.13.3.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fregenerator-runtime%2Fdownload%2Fregenerator-runtime-0.13.3.tgz", "resolved": "https://registry.npm.taobao.org/regenerator-runtime/download/regenerator-runtime-0.13.3.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fregenerator-runtime%2Fdownload%2Fregenerator-runtime-0.13.3.tgz",
"integrity": "sha1-fPanfY9cb2Drc8X8GVWyzrAea/U=", "integrity": "sha1-fPanfY9cb2Drc8X8GVWyzrAea/U="
"dev": true
}, },
"regenerator-transform": { "regenerator-transform": {
"version": "0.14.1", "version": "0.14.1",
...@@ -11443,6 +11478,17 @@ ...@@ -11443,6 +11478,17 @@
"spdx-expression-parse": "^3.0.0" "spdx-expression-parse": "^3.0.0"
} }
}, },
"vant": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/vant/-/vant-2.1.3.tgz",
"integrity": "sha512-trrMTGNXPOKvQz2fMNMyQi7rvvF5u5mmbBAqmEyHMHUAQzO9JJYck9jyVbB7tQ8KvKFl8arvVXJqIkFghQeMtw==",
"requires": {
"@babel/runtime": "7.x",
"@vant/icons": "1.1.13",
"@vue/babel-helper-vue-jsx-merge-props": "^1.0.0",
"vue-lazyload": "1.2.3"
}
},
"vary": { "vary": {
"version": "1.1.2", "version": "1.1.2",
"resolved": "http://registry.npm.taobao.org/vary/download/vary-1.1.2.tgz", "resolved": "http://registry.npm.taobao.org/vary/download/vary-1.1.2.tgz",
...@@ -11536,6 +11582,11 @@ ...@@ -11536,6 +11582,11 @@
"integrity": "sha1-J1b0bLMlgFTF9HI96K5+hzAqHM8=", "integrity": "sha1-J1b0bLMlgFTF9HI96K5+hzAqHM8=",
"dev": true "dev": true
}, },
"vue-lazyload": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/vue-lazyload/-/vue-lazyload-1.2.3.tgz",
"integrity": "sha512-DC0ZwxanbRhx79tlA3zY5OYJkH8FYp3WBAnAJbrcuoS8eye1P73rcgAZhyxFSPUluJUTelMB+i/+VkNU/qVm7g=="
},
"vue-loader": { "vue-loader": {
"version": "15.7.1", "version": "15.7.1",
"resolved": "https://registry.npm.taobao.org/vue-loader/download/vue-loader-15.7.1.tgz?cache=0&sync_timestamp=1563435501637&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fvue-loader%2Fdownload%2Fvue-loader-15.7.1.tgz", "resolved": "https://registry.npm.taobao.org/vue-loader/download/vue-loader-15.7.1.tgz?cache=0&sync_timestamp=1563435501637&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fvue-loader%2Fdownload%2Fvue-loader-15.7.1.tgz",
......
...@@ -8,9 +8,11 @@ ...@@ -8,9 +8,11 @@
"lint": "vue-cli-service lint" "lint": "vue-cli-service lint"
}, },
"dependencies": { "dependencies": {
"amap-js": "^1.2.1",
"amfe-flexible": "^2.2.1", "amfe-flexible": "^2.2.1",
"core-js": "^2.6.5", "core-js": "^2.6.5",
"cube-ui": "~1.12.15", "cube-ui": "~1.12.15",
"vant": "^2.1.3",
"vue": "^2.6.10", "vue": "^2.6.10",
"vue-router": "^3.0.3" "vue-router": "^3.0.3"
}, },
...@@ -20,6 +22,7 @@ ...@@ -20,6 +22,7 @@
"@vue/cli-service": "^3.10.0", "@vue/cli-service": "^3.10.0",
"@vue/eslint-config-prettier": "^5.0.0", "@vue/eslint-config-prettier": "^5.0.0",
"babel-eslint": "^10.0.1", "babel-eslint": "^10.0.1",
"babel-plugin-import": "^1.12.0",
"eslint": "^5.16.0", "eslint": "^5.16.0",
"eslint-plugin-prettier": "^3.1.0", "eslint-plugin-prettier": "^3.1.0",
"eslint-plugin-vue": "^5.0.0", "eslint-plugin-vue": "^5.0.0",
......
...@@ -16,12 +16,10 @@ ...@@ -16,12 +16,10 @@
continue.</strong> continue.</strong>
</noscript> </noscript>
<div id="app"></div> <div id="app"></div>
<!-- built files will be auto injected -->
<script type="text/javascript" <script type="text/javascript"
src="https://webapi.amap.com/maps?v=1.4.15&key=c066bb79c8747e4d84aa9e86276f8174&plugin=AMap.Geolocation,AMap.Scale,AMap.OverView,AMap.ToolBar"></script> src="https://webapi.amap.com/maps?v=1.4.15&key=55a08526973b576b5d43ad51aa46932f&plugin=AMap.Geolocation,AMap.Scale,AMap.OverView,AMap.ToolBar"></script>
<!-- <script type="text/javascript" src="https://cache.amap.com/lbs/static/addToolbar.js"></script> --> <script src="//webapi.amap.com/ui/1.0/main.js"></script>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -14,4 +14,18 @@ export const getCode = (phone, type = 'login_or_register') => request('/common/s ...@@ -14,4 +14,18 @@ export const getCode = (phone, type = 'login_or_register') => request('/common/s
export const loginByCode = (phone, code) => request('login/code', { export const loginByCode = (phone, code) => request('login/code', {
phone, phone,
code code
}, 'get'); }, 'get');
\ No newline at end of file
// 新增收货地址
export const addReceivingAddress = (Data) => request('/user/address', Data, 'POST');
// 编辑收货地址
export const editReceivingAddress = (Data) => request('/user/address/update', Data, 'POST');
// 获取收货地址
export const getReceivingAddress = () => request('/user/address', {}, 'GET');
// 删除收货地址
export const deleteReceivingAddress = (address_id) => request('/user/address/delete', { address_id }, 'POST');
html, body html, body
height: 100% height: 100%
overflow: hidden overflow: hidden
\ No newline at end of file font-size:16px
background: #f7f8fa
@import "./variable" @import "./variable"
@import '~common/stylus/mixin.styl';
@import '~common/stylus/base.styl';
.cube-checker-item {
boder-1px();
}
.cube-form-item_required .cube-form-label::before .cube-form-item_required .cube-form-label::before
display:none display:none
...@@ -7,7 +13,9 @@ ...@@ -7,7 +13,9 @@
.text-primary{ .text-primary{
color:$color-light-blue color:$color-light-blue
} }
.text-light-grey{
color:$color-light-grey
}
.text-extra-small{ .text-extra-small{
font-size: $font-size-12 font-size: $font-size-12
...@@ -23,4 +31,43 @@ ...@@ -23,4 +31,43 @@
} }
.text-extra-large{ .text-extra-large{
font-size: $font-size-20 font-size: $font-size-20
} }
\ No newline at end of file
.line::after {
position: absolute;
box-sizing: border-box;
content: " ";
pointer-events: none;
right: 0;
bottom: 0;
left: 16px;
border-bottom: 1px solid #ebedf0;
-webkit-transform: scaleY(0.5);
transform: scaleY(0.5);
}
.section{
margin-top:10px;
background-color: #fff;
}
.section-hd{
line-height: 40px;
padding:4px 10px;
font-size: 18px;
font-weight: 600;
}
.cube-loading{
display: flex;
justify-content: center;
height: 100px;
align-items: center;
}
.cube-slide-dots{
bottom:4px;
}
.cube-slide-dots span{
height:2px;
}
\ No newline at end of file
import CubePage from "../../components/cube-page.vue";
function plugin (Vue){
if(plugin.installed)return;
Vue.component('cube-page',CubePage)
}
export default plugin;
\ No newline at end of file
export function MAP(key='c066bb79c8747e4d84aa9e86276f8174') { export function MAP(key = 'c066bb79c8747e4d84aa9e86276f8174') {
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
window.init = function () { window.init = function () {
resolve(AMap) resolve(AMap)
}; };
let script = document.createElement("script"); let script = document.createElement("script");
script.type = "text/javascript"; script.type = "text/javascript";
script.src = "//webapi.amap.com/maps?v=1.4.6&key="+key+"&callback=init"; script.src = "//webapi.amap.com/maps?v=1.4.6&key=" + key + "&callback=init";
script.onerror = reject; script.onerror = reject;
document.head.appendChild(script); document.head.appendChild(script);
}) })
} }
// 获取地理位置
export const mapGeolocation = (map) => {
let location = null;
map.plugin("AMap.Geolocation", function () { export default {
var geolocation = new AMap.Geolocation({ onRouterLink(vm,route, query) {
// 是否使用高精度定位,默认:true if (query) {
enableHighAccuracy: true, vm.$router.push({ name: route, query: query })
// 设置定位超时时间,默认:无穷大 return;
timeout: 10000, }
// 定位按钮的停靠位置的偏移量,默认:Pixel(10, 20) vm.$router.push({ name: route })
buttonOffset: new AMap.Pixel(10, 20), }
// 定位成功后调整地图视野范围使定位位置及精度范围视野内可见,默认:false
zoomToAccuracy: true,
// 定位按钮的排放位置, RB表示右下
buttonPosition: "RB"
});
geolocation.getCurrentPosition();
AMap.event.addListener(geolocation, "complete", function (data) {
location = data;
console.log(data)
});
AMap.event.addListener(geolocation, "error", function (data) {
console.log(data);
});
});
return location;
} }
\ No newline at end of file
<template>
<div class="cube-page" :class="type">
<!-- <header class="header">
<h1>{{title}}</h1>
<i @click="back" class="cubeic-back"></i>
</header> -->
<div class="wrapper">
<section v-show="desc" class="desc"><slot name="desc">{{desc}}</slot></section>
<main class="content">
<slot name="content">{{content}}</slot>
</main>
</div>
</div>
</template>
<script type="text/ecmascript-6">
export default {
props: {
title: {
type: String,
default: '',
required: true
},
type: {
type: String,
default: ''
},
desc: {
type: String,
default: ''
},
content: {
type: String,
default: ''
}
},
methods: {
back() {
this.$router.back()
}
}
}
</script>
<style lang="stylus" rel="stylesheet/stylus">
@import "~@/common/stylus/variable.styl"
.cube-page
position: absolute
z-index: 10
top: 0
left: 0
width: 100%
height: 100%
background: #f7f8fa
.header
position: relative
height: 44px
line-height: 44px
text-align: center
background-color: #edf0f4
box-shadow: 0 1px 6px #ccc
-webkit-backface-visibility: hidden
backface-visibility: hidden
z-index: 5
h1
font-size: 16px
font-weight: 700
.cubeic-back
position: absolute
top: 0
left: 0
padding: 0 15px
color: #fc9153
>.wrapper
height: calc(100% - 44px)
overflow-x: hidden
overflow-y: auto
// -webkit-overflow-scrolling: touch
.desc
padding: 10px
margin: 10px 0
line-height: 20px
font-size: 14px
.content
// margin: 10px
&.option-demo
.wrapper
background-color: $color-white
.title
font-size: $fontsize-large
font-weight: 500
color: $color-dark-grey
padding: 15px
border-bottom: 1px solid rgba(0, 0, 0, .1)
margin-bottom: 15px
.options
margin-bottom: 15px
.option-list
.group
margin-bottom: 15px
border: 1px solid rgba(0, 0, 0, .1)
border-radius: $radius-size-medium
.item
height: 52px
border-bottom: 1px solid rgba(0, 0, 0, .1)
&.sub
font-size: $fontsize-medium
background-color: $color-light-grey-opacity
&.first
box-shadow: 0 1px 1px 1px #eee inset
&.last
border-bottom: none
.demo
margin-bottom: 15px
.methods
.method-list
.group
margin-bottom: 15px
border: 1px solid rgba(0, 0, 0, .1)
border-radius: $radius-size-medium
.item
button
height: 40px
font-size: $fontsize-large
.item
background-color: $color-active-light-gray
border-bottom: 1px solid rgba(0, 0, 0, .1)
button
width: 100%
border-bottom-left-radius: $radius-size-medium
border-bottom-right-radius: $radius-size-medium
background-color: $color-orange
box-shadow: 0 0 0 1px $color-orange
border: none
outline: none
color: $color-white
</style>
<template>
<div>
<div class="van-search" style="background: rgb(255, 255, 255);">
<div class="van-search__content van-search__content--square">
<div class="van-cell van-cell--borderless van-field">
<div class="van-field__left-icon">
<i class="van-icon cubeic-search text-medium"></i>
</div>
<div class="van-cell__value van-cell__value--alone">
<div class="van-field__body">
<input type="search" placeholder="请输入搜索关键词" class="van-field__control text-base" />
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<style lang="css" scoped>
.van-search,
.van-search__content {
display: flex;
}
.van-search {
-webkit-box-align: center;
-webkit-align-items: center;
align-items: center;
box-sizing: border-box;
padding: 10px 12px;
}
.van-search__content {
-webkit-box-flex: 1;
-webkit-flex: 1;
flex: 1;
padding-left: 8px;
background-color: #f7f8fa;
border-radius: 2px;
}
.van-search__content--round {
border-radius: 17px;
}
.van-search__label {
padding: 0 5px;
color: #323233;
font-size: 14px;
line-height: 34px;
}
.van-search .van-cell {
-webkit-box-flex: 1;
-webkit-flex: 1;
flex: 1;
padding: 5px 8px 5px 0;
background-color: transparent;
}
.van-search .van-cell__left-icon {
color: #969799;
}
.van-search--show-action {
padding-right: 0;
}
.van-search input::-webkit-search-cancel-button,
.van-search input::-webkit-search-decoration,
.van-search input::-webkit-search-results-button,
.van-search input::-webkit-search-results-decoration {
display: none;
}
.van-search .van-cell {
display: flex;
flex: 1;
font-size: 14px;
line-height: 24px;
padding: 5px 8px 5px 0;
background-color: transparent;
}
.van-cell__value {
position: relative;
overflow: hidden;
color: #969799;
text-align: right;
vertical-align: middle;
}
.van-field__body {
display: flex;
align-items: center;
height: 100%;
}
.van-search input {
display: block;
box-sizing: border-box;
width: 100%;
margin: 0;
padding: 0;
color: #323233;
text-align: left;
background-color: transparent;
border: 0;
resize: none;
}
.van-search__action {
padding: 0 8px;
color: #323233;
font-size: 14px;
line-height: 34px;
}
.van-search__action:active {
background-color: #f2f3f5;
}
</style>
\ No newline at end of file
<template>
<div class>
<li class="card" v-for="(item,index) in options" :key="item.id">
<div @click="onItemClick(item, index)" class="card-inner">
<div class="card-thumb">
<van-image width="90" height="90" fit="contain" :src="$globalUrlFile+item.icon"></van-image>
</div>
<div class="card-content">
<h2 class="card-title" v-html="item.name"></h2>
<p class="item-desc" v-html="item.category_name"></p>
</div>
</div>
</li>
</div>
</template>
<script>
var b = {
shop_id: 1,
name: "清吧",
address: "重庆市,市辖区,涪陵区",
icon: "files/shop/77/image/a4558aa3-ccb2-4f2c-b5db-1461a25c12a9.jpg",
phone: "15389926297",
shop_type: "restaurant",
category_name: "其他",
address_detail: "聚贤大道116号"
};
export default {
data() {
return {};
},
props: ["options"],
computed: {},
methods: {}
};
</script>
<style lang="stylus" scoped>
.card {
position: relative;
box-sizing: border-box;
padding: 8px 16px;
color: #323233;
font-size: 12px;
// border-bottom: 1px solid #eee;
// background-color: #fafafa;
.card-inner {
display: flex;
}
.card-thumb {
position: relative;
flex: none;
margin-right: 8px;
}
.card-content {
position: relative;
display: flex;
flex: 1;
flex-direction: column;
min-width: 0;
min-height: 90px;
border-bottom: 1px solid #eee;
}
.card-title {
min-height: 34px;
font-weight: 600;
line-height: 24px;
display: -webkit-box;
overflow: hidden;
text-overflow: ellipsis;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
}
</style>
...@@ -17,7 +17,7 @@ const $http = axios.create({ ...@@ -17,7 +17,7 @@ const $http = axios.create({
}); });
$http.interceptors.request.use(config => { $http.interceptors.request.use(config => {
let defaultOpstion = { identity: "shop" }; let defaultOpstion = { identity: "normal" };
if (config.method == 'get' || config.method == 'delete') { if (config.method == 'get' || config.method == 'delete') {
Object.assign(config.params, defaultOpstion) Object.assign(config.params, defaultOpstion)
} else { } else {
......
...@@ -46,7 +46,8 @@ import { ...@@ -46,7 +46,8 @@ import {
Swipe, Swipe,
Sticky, Sticky,
ScrollNav, ScrollNav,
ScrollNavBar ScrollNavBar,
RecycleList
} from 'cube-ui' } from 'cube-ui'
Vue.use(Button) Vue.use(Button)
...@@ -86,3 +87,5 @@ Vue.use(Swipe) ...@@ -86,3 +87,5 @@ Vue.use(Swipe)
Vue.use(Sticky) Vue.use(Sticky)
Vue.use(ScrollNav) Vue.use(ScrollNav)
Vue.use(ScrollNavBar) Vue.use(ScrollNavBar)
Vue.use(RecycleList)
...@@ -5,25 +5,46 @@ import vuex from 'vuex' ...@@ -5,25 +5,46 @@ import vuex from 'vuex'
import 'amfe-flexible' import 'amfe-flexible'
import store from './store' import store from './store'
import './cube-ui' import './cube-ui'
import './vant';
import VueAMap from 'vue-amap'; import VueAMap from 'vue-amap';
import './common/stylus/index.styl' import './common/stylus/index.styl'
import { globalUrlFile, defaultImg } from '../src/config/env'
import components from './common/utils/components'
Vue.config.productionTip = false; Vue.config.productionTip = false;
// 全局注册组件
Vue.use(components);
Vue.use(vuex); Vue.use(vuex);
Vue.use(VueAMap); Vue.use(VueAMap);
// setTimeout(() => {
VueAMap.initAMapApiLoader({
key: 'c066bb79c8747e4d84aa9e86276f8174', // VueAMap.initAMapApiLoader({
// key:'41db0da27afa32dc85f51cceb4cfcf9a', // key: 'c066bb79c8747e4d84aa9e86276f8174',
plugin: ['AMap.Geolocation', 'AMap.Autocomplete', 'AMap.PlaceSearch', 'AMap.Scale', 'AMap.OverView', 'AMap.ToolBar', 'AMap.MapType', 'AMap.PolyEditor', 'AMap.CircleEditor'], // // key:'41db0da27afa32dc85f51cceb4cfcf9a',
// 默认高德 sdk 版本为 1.4.4 // plugin: ['AMap.Geolocation', 'AMap.Autocomplete', 'AMap.PlaceSearch', 'AMap.Scale', 'AMap.OverView', 'AMap.ToolBar', 'AMap.MapType', 'AMap.PolyEditor', 'AMap.CircleEditor'],
v: '1.4.4', // // 默认高德 sdk 版本为 1.4.4
uiVersion: '1.0.11' // 版本号 // v: '1.4.4',
}); // uiVersion: '1.0.11' // 版本号
// }, 200); // });
Vue.use(VueAMap);
VueAMap.initAMapApiLoader({
key: '55a08526973b576b5d43ad51aa46932f',
plugin: ['AMap.Geolocation','AMap.Autocomplete', 'AMap.PlaceSearch', 'AMap.Scale', 'AMap.OverView', 'AMap.ToolBar', 'AMap.MapType', 'AMap.PolyEditor', 'AMap.CircleEditor'],
// 默认高德 sdk 版本为 1.4.4
v: '1.4.4',
uiVersion: '1.0.11' // 版本号
});
Vue.prototype.$defaultImg = defaultImg;// 图片所在域名地址
Vue.prototype.$globalUrlFile = globalUrlFile;// 文件所在域名地址
......
...@@ -4,7 +4,11 @@ const home = r => require.ensure([], () => r(require('./views/home/index.vue'))) ...@@ -4,7 +4,11 @@ const home = r => require.ensure([], () => r(require('./views/home/index.vue')))
const login = r => require.ensure([], () => r(require('./views/login/login.vue'))) const login = r => require.ensure([], () => r(require('./views/login/login.vue')))
const orderIndex = r => require.ensure([], () => r(require('./views/order/index.vue'))) const orderIndex = r => require.ensure([], () => r(require('./views/order/index.vue')))
const mineIndex = r => require.ensure([], () => r(require('./views/mine/index.vue'))) const mineIndex = r => require.ensure([], () => r(require('./views/mine/index.vue')))
// const login = r => require.ensure([], () => r(require('./views/login/login.vue'))) const sellAddress = r => require.ensure([], () => r(require('./views/address/select-address.vue')))
const addAddress = r => require.ensure([], () => r(require('./views/address/add-address.vue')))
const address = r => require.ensure([], () => r(require('./views/address/address.vue')))
const choiseLocation = r => require.ensure([], () => r(require('./views/location/choise.vue')))
Vue.use(Router); Vue.use(Router);
...@@ -31,7 +35,36 @@ export default new Router({ ...@@ -31,7 +35,36 @@ export default new Router({
path: "/mine", path: "/mine",
name: "mineIndex", name: "mineIndex",
component: mineIndex component: mineIndex
} },
{
path: "/address/select",
name: "sellAddress",
component: sellAddress
},
{
path: '/address/add',
name: 'addAddress',
component: addAddress,
meta: { title: '新增地址', keepAlive: false }
},
{
path: '/address',
name: 'address',
component: address,
meta: { title: '收货地址', keepAlive: false }
},
/*{
path: '/address/edit/:id',
name: 'editAddress',
component: editAddress,
meta: { title: '修改地址', keepAlive: false }
}, */
{
path: '/location/choise',
name: 'choiseLocation',
component: choiseLocation,
meta: { title: '收货地址', keepAlive: false }
},
] ]
}); });
...@@ -2,13 +2,34 @@ import { mapGeolocation } from '../common/utils/mUtils' ...@@ -2,13 +2,34 @@ import { mapGeolocation } from '../common/utils/mUtils'
export default { export default {
// 获取当前地理位置 // 获取当前地理位置
GET_LOCATION(commit, map) { GET_LOCATION({ commit, state }, map) {
let msg = mapGeolocation(map) // if (state.location && state.location.lat) return;
map.plugin("AMap.Geolocation", function () {
console.log(msg) var geolocation = new AMap.Geolocation({
let location = { lat: msg.position.lat, lng: msg.position.lng, formattedAddress: msg.position.formattedAddress }; enableHighAccuracy: true,//是否使用高精度定位,默认:true
commit('RECORD_ADDRESS', location) timeout: 10000, //超过10秒后停止定位,默认:无穷大
maximumAge: 0, //定位结果缓存0毫秒,默认:0
convert: true, //自动偏移坐标,偏移后的坐标为高德坐标,默认:true
showButton: true, //显示定位按钮,默认:true
buttonPosition: 'LB', //定位按钮停靠位置,默认:'LB',左下角
buttonOffset: new AMap.Pixel(10, 20),//定位按钮与设置的停靠位置的偏移量,默认:Pixel(10, 20)
showMarker: true, //定位成功后在定位到的位置显示点标记,默认:true
showCircle: true, //定位成功后用圆圈表示定位精度范围,默认:true
panToLocation: true, //定位成功后将定位到的位置作为地图中心点,默认:true
zoomToAccuracy: true //定位成功后调整地图视野范围使定位位置及精度范围视野内可见,默认:false
});
geolocation.getCurrentPosition();
AMap.event.addListener(geolocation, "complete", function (data) {
let location = { lat: data.position.lat, lng: data.position.lng, formattedAddress: data.formattedAddress };
commit('RECORD_ADDRESS', location)
console.log(data)
});
AMap.event.addListener(geolocation, "error", function (data) {
console.log(data);
});
});
}, },
} }
\ No newline at end of file
...@@ -6,7 +6,9 @@ import actions from './actions' ...@@ -6,7 +6,9 @@ import actions from './actions'
Vue.use(Vuex) Vue.use(Vuex)
const state = { const state = {
location:{} location:{lat:'',lng:'',formattedAddress:''}
// location:'定位中'
} }
export default new Vuex.Store({ export default new Vuex.Store({
state, state,
......
export default { export default {
// 记录当前地理位置 // 记录当前地理位置
RECORD_ADDRESS(state, { RECORD_ADDRESS(state, info) {
lat, state.location = info;
lng, console.log( info)
formattedAddress },
}) { // 重新定位
state.location = {lat,lng,formattedAddress}; REFRESH_LOCATION(state, info) {
state.location = info;
console.log( info)
}, },
} }
\ No newline at end of file
import Vue from 'vue'
import {
Search,
Image,
Grid,
GridItem,
AddressList,
Row, Col,
Cell, CellGroup ,
Field,
Button
} from 'vant'
Vue.use(Search)
Vue.use(Image)
Vue.use(Grid)
Vue.use(GridItem)
Vue.use(AddressList);
Vue.use(Row).use(Col);
Vue.use(Cell).use(CellGroup);
Vue.use(Field)
Vue.use(Button)
<template>
<div class="add-address">
<van-cell-group>
<van-field v-model="receiverName" label="联系人" placeholder="姓名" clearable />
<van-row class="sex">
<van-col span="10" offset="7">
<cube-checker v-model="checkerSex" :options="sexOptions" type="radio" class="text-base" />
</van-col>
</van-row>
<van-field v-model="receiverTel" label="电话" type="tel" placeholder="手机号" clearable />
<van-field
ref="area"
class="area"
v-model="receiverArea"
label="地址"
placeholder="选择收货地址"
@click="onChoiseLocation('choiseLocation')"
@focus="$refs.area.blur()"
/>
<van-field v-model="detailedAddress" clearable label="门牌号" placeholder="例:5号楼230室" />
<van-row class="van-cell">
<van-col span="7" class="van-cell__title van-field__label"><span>标签</span></van-col>
<van-col span="18">
<cube-checker
v-model="checkerType"
:options="typeOptions"
type="radio"
class="text-base"
/>
</van-col>
</van-row>
</van-cell-group>
<div class="van-address-edit__buttons">
<van-button class="save" type="danger" size="large" @click="onSave">确定</van-button>
</div>
</div>
</template>
<script>
import { addReceivingAddress } from "../../common/serve";
import utils from "../../common/utils/mUtils";
export default {
data() {
return {
checkerSex: [],
sexOptions: [
{
value: 1,
text: "先生"
},
{
value: 2,
text: "女士"
}
],
checkerType: [],
typeOptions: [
{
value: 1,
text: "家"
},
{
value: 2,
text: "公司"
},
{
value: 3,
text: "学校"
}
],
receiverName: "", //收货人姓名
receiverTel: "", //收货人手机号
detailedAddress: "", //详细地址
receiverArea: "", //收货地址
show: false //默认不显示地区选择
};
},
computed: {},
methods: {
//添加收货地址
async onSave() {
let Data = {
name: "地址名",
address: "地址信息",
lat: "121.513211",
lng: "31.300676",
phone: this.receiverTel,
user_name: this.receiverName,
address_detail: this.detailedAddress,
address_suffix: "231",
area: {},
is_default: 1
};
let res = await addReceivingAddress(Data);
if (res.code === 0) {
this.$toast.success("添加地址成功");
if (this.orderAddress) {
this.$router.push({ name: "confirmOrder" });
} else {
this.$router.push({ name: "address" });
}
}
},
onChoiseLocation(route) {
utils.onRouterLink(this,route);
}
}
};
</script>
<style lang="stylus" rel="stylesheet/stylus">
@import '~common/stylus/mixin.styl';
@import '~common/stylus/variable.styl';
.sex {
padding: 10px 0;
}
.van-cell__title span{
font-weight: 600;
}
.cube-checker-item {
border-1px();
line-height: 14px;
&_active {
border-1px($color-light-blue);
color: $color-light-blue;
background: #f5fbff;
}
}
.van-address-edit__buttons {
padding: 32px 16px;
}
</style>
\ No newline at end of file
<template>
<div>
123
</div>
</template>
<template>
<cube-page type="recycle-list" title="RecycleList">
<div slot="content" class="scroll-list-wrap">
<van-search placeholder="请输入搜索关键词" shape="round"></van-search>
<div class="scroll-list-wrap">
<cube-scroll ref="scroll">
<section class="section">
<div class="cube-index-list-anchor">当前定位</div>
<van-cell :title="curLocation" icon="shop-o">
<i slot="icon" class="cubeic-navigation text-primary text-medium"></i>
<span slot="right-icon" class="text-primary" @click="onRefreshLocation">重新定位</span>
</van-cell>
</section>
<section class="section">
<van-cell>
<span slot="title" class="text-extra-small text-light-grey">收货地址</span>
<span slot="right-icon" class="text-primary" @click="onLink('address')">管理地址</span>
</van-cell>
<van-row v-for="address in addressList" :key="address.id">
<van-col span="22" offset="2">
<div class="van-cell van-address-item line">
<div class="van-cell__value van-cell__value--alone van-address-item__value">
<div class="van-address-item__name">{{address.area}}</div>
<div class>{{address.address_detail}}</div>
<div class="text-light-grey">{{address.name}}&nbsp;&nbsp;{{address.tel}}</div>
</div>
</div>
</van-col>
</van-row>
<van-row>
<van-col span="22" offset="2">
<van-cell title="新增地址" is-link class="text-primary" @click="onLink('addAddress')" />
</van-col>
</van-row>
</section>
</cube-scroll>
</div>
</div>
</cube-page>
</template>
<script>
import { getReceivingAddress } from "../../common/serve";
import { mapState } from "vuex";
import utils from "../../common/utils/mUtils";
let map = {};
export default {
data() {
return {
chosenAddressId: "-1", // 字符串类型!!!
addressList: []
};
},
computed: {
...mapState(["location"]),
curLocation() {
return this.location.formattedAddress
? this.location.formattedAddress
: "定位中...";
}
},
created() {
setTimeout(() => {
map = new AMap.Map("amap", {
resizeEnable: true,
zoom: 16
});
this.$store.dispatch("GET_LOCATION", map);
}, 20);
this.getReceivingAddress();
},
methods: {
async getReceivingAddress() {
let res = await getReceivingAddress();
let _data = res.data;
_data.forEach(el => {
let _obj = {
id: el.id.toString(),
name: el.name,
tel: el.phone,
address: el.area.full_name + "," + el.address_detail,
area_id: el.area_id,
area: el.area.full_name,
address_detail: el.address_detail,
user_name: el.name,
is_default: el.is_default
};
this.addressList.push(_obj);
});
},
onSelect() {},
onRefreshLocation() {
// 重新定位后,调用定位api
this.$store.commit("REFRESH_LOCATION", "定位中...");
this.$store.dispatch("GET_LOCATION", map);
},
onLink(route) {
utils.onRouterLink({ name: route });
}
}
};
</script>
<style scoped>
.cube-page > .wrapper .content {
margin: 0;
}
.cube-index-list-anchor {
background-color: transparent;
}
.van-address-item__name {
font-weight: 600;
}
</style>
<template> <template>
<div> <cube-page type="recycle-list" title="RecycleList">
<div class="scroll-list-wrap"> <div slot="content" class="scroll-list-wrap">
<cube-sticky :pos="scrollY"> <cube-loading v-if="loading" :size="40"></cube-loading>
<cube-scroll :scroll-events="scrollEvents" @scroll="scrollHandler"> <cube-sticky v-else :pos="scrollY">
<div class="location"> <cube-scroll
ref="scroll"
:scroll-events="scrollEvents"
@scroll="scrollHandler"
:data="msg"
:options="options"
@pulling-down="onPullingDown"
@pulling-up="onPullingUp"
>
<cube-loading v-if="loading" :size="40"></cube-loading>
<!-- 收货地址定位 -->
<div class="location" @click="onRouterLink('sellAddress')">
<i class="cubeic-location text-primary text-extra-large"></i> <i class="cubeic-location text-primary text-extra-large"></i>
<span class="text-medium">中国创业实训基地</span> <span class="text-medium">{{location.formattedAddress?location.formattedAddress:'定位中...'}}</span>
<div class="location-action">
<i class="cubeic-select text-extra-small"></i>
</div>
<div id="amap"></div> <div id="amap"></div>
</div> </div>
<ul>
<li>title</li> <!-- 搜索框 -->
</ul>
<cube-sticky-ele ele-key="11"> <cube-sticky-ele ele-key="11">
<ul class="sticky-header"> <ul class="sticky-header">
<van-search></van-search> <van-search placeholder="请输入搜索关键词" shape="round"></van-search>
</ul> </ul>
</cube-sticky-ele> </cube-sticky-ele>
<ul>
<li v-for="(item,index) in shops" :key="index">{{item}}</li> <!-- 轮播图 -->
</ul> <section class="slide-container">
<cube-slide ref="slide" :data="slideData" :interval="3000">
<cube-slide-item
v-for="(item, index) in slideData"
:key="index"
@click.native="onSlideEvent(item, index)"
>
<a :href="item.url">
<van-image width="100%" :src="item.image"></van-image>
</a>
</cube-slide-item>
</cube-slide>
</section>
<section>
<van-grid :border="false">
<van-grid-item v-for="(grid,index) in gridsData" :key="index" :text="grid.name">
<div slot="icon">
<van-image width="36" height="36" :src="grid.img"></van-image>
</div>
</van-grid-item>
</van-grid>
</section>
<!-- 附近商家 -->
<section class="section">
<div class="section-hd">附件商家</div>
<ul class="cards">
<shop-list :options="shopsData"></shop-list>
</ul>
</section>
</cube-scroll> </cube-scroll>
</cube-sticky> </cube-sticky>
</div> </div>
<footGuide default="home"></footGuide> <footGuide default="home"></footGuide>
</div> </cube-page>
</template> </template>
<script> <script>
import CubePage from "../../components/cube-page.vue";
import footGuide from "../../components/footer"; import footGuide from "../../components/footer";
import vanSearch from "../../components/search"; import shopList from "../../components/shop-list";
import { mapGeolocation, MAP } from "../../common/utils/mUtils"; import { mapGeolocation, MAP } from "../../common/utils/mUtils";
import { mapState } from "vuex";
var map = {}; var map = {};
var b = { var b = {
code: 0, shop_id: 1,
data: { name: "清吧",
shop_id: 1, address: "重庆市,市辖区,涪陵区",
name: "清吧", icon: "files/shop/77/image/a4558aa3-ccb2-4f2c-b5db-1461a25c12a9.jpg",
address: "重庆市,市辖区,涪陵区", phone: "15389926297",
icon: "files/shop/22/image/f41c3564-6c41-4ed1-9526-fe23f560c839.jpg", shop_type: "restaurant",
phone: "15389926297", category_name: "其他",
shop_type: "restaurant", address_detail: "聚贤大道116号"
category_name: "其他",
address_detail: "聚贤大道116号"
},
message: ""
}; };
var c = [
{
url: "http://www.didichuxing.com/",
image:
"https://y.gtimg.cn/music/photo_new/T003R720x288M000001pf9Sy13Evav.jpg?max_age=2592000"
},
{
url: "http://www.didichuxing.com/",
image:
"https://y.gtimg.cn/music/photo_new/T003R720x288M000001EwfWs4QSIl6.jpg?max_age=2592000"
},
{
url: "http://www.didichuxing.com/",
image:
"https://y.gtimg.cn/music/photo_new/T003R720x288M000001pf9Sy13Evav.jpg?max_age=2592000"
}
];
var d = [
{
img:
"https://fuss10.elemecdn.com/2/35/696aa5cf9820adada9b11a3d14bf5jpeg.jpeg",
name: "甜品饮料"
},
{
img:
"https://fuss10.elemecdn.com/4/34/ea0d51c9608310cf41faa5de6b8efjpeg.jpeg",
name: "甜品饮料1"
},
{
img:
"https://fuss10.elemecdn.com/2/35/696aa5cf9820adada9b11a3d14bf5jpeg.jpeg",
name: "甜品饮料2"
},
{
img:
"https://fuss10.elemecdn.com/4/34/ea0d51c9608310cf41faa5de6b8efjpeg.jpeg",
name: "甜品饮料3"
},
{
img:
"https://fuss10.elemecdn.com/2/35/696aa5cf9820adada9b11a3d14bf5jpeg.jpeg",
name: "甜品饮料4"
}
];
export default { export default {
data() { data() {
return { return {
location: [121.50886, 31.25373], loading: false,
shops: [b, b, b],
gridsData: d,
shopsData: [b, b, b],
scrollEvents: ["scroll"], scrollEvents: ["scroll"],
scrollY: 0 scrollY: 0,
msg: [], // 用来渲染列表的数组
options: {
pullDownRefresh: {
threshold: 90,
stop: 40
// txt: "刷新成功"
}, // 配置下拉刷新
pullUpLoad: {
threshold: 0,
txt: {
// more: "上拉加载更多",
// noMore: "没有更多数据"
}
} // 配置上拉加载,若要关闭可直接 pullUpLoad:false
},
slideData: c
}; };
}, },
created() { created() {
setTimeout(() => {
MAP() map = new AMap.Map("amap", {
.then(function(AMap) { resizeEnable: true,
zoom: 16
map = new AMap.Map("amap", { });
resizeEnable: true, this.$store.dispatch("GET_LOCATION", map);
zoom: 15 }, 20);
}); if (this.location.lat) {
this.$store.dispatch("GET_LOCATION", map); this.loading = false;
}) }
.catch(err => { },
computed: {
}); ...mapState(["location"])
/* setTimeout(() => {
map = new AMap.Map("amap", {
resizeEnable: true,
zoom: 15
});
this.$store.dispatch("GET_LOCATION", map);
// this.location = mapGeolocation(map);
}, 20); */
}, },
components: { components: {
footGuide, footGuide,
vanSearch CubePage,
shopList
}, },
methods: { methods: {
scrollHandler({ y }) { scrollHandler({ y }) {
this.scrollY = -y; this.scrollY = -y;
},
onBtnClick() {},
onSlideEvent(item, index) {
console.log(item, index);
},
onRouterLink(route,query){
if(query){
this.$router.push({name:route,query:query})
return;
}
this.$router.push({name:route})
},
// 获取数据
loadData() {
return;
api
.allMsg({})
.then(res => {
if (res.Code == 200) {
this.msg = res.Response;
}
})
.catch(err => {
console.log(err);
});
},
// 触发下拉刷新
onPullingDown() {
console.log("下拉刷新");
// 模拟更新数据
setTimeout(() => {
if (Math.random() > 0.5) {
// 如果有新数据
console.log("有新数据");
this.msg.unshift(1);
} else {
// 如果没有新数据,调用 forceUpdate(), 显示成功文案,延迟 stopTime 时间完成刷新
this.$refs.scroll.forceUpdate();
}
}, 1000);
},
// 触发上拉加载
onPullingUp() {
console.log("上拉加载");
// 模拟更新数据
setTimeout(() => {
if (Math.random() > 0.5) {
// 如果有新数据
let newPage = [1, 2, 3, 4, 5, 6];
console.log("有新数据");
this.msg = this.msg.concat(newPage);
} else {
// 如果没有新数据
this.$refs.scroll.forceUpdate();
}
}, 1000);
} }
} }
}; };
</script> </script>
<style lang="stylus" scoped> <style lang="stylus" scoped>
.cube-page {
background-color: #fff;
}
.scroll-list-wrap { .scroll-list-wrap {
position: fixed; position: fixed;
top: 0; top: 0;
...@@ -98,4 +258,31 @@ export default { ...@@ -98,4 +258,31 @@ export default {
left: 0; left: 0;
right: 0; right: 0;
} }
.location {
height: 50px;
line-height: 50px;
padding: 0 10px;
.location-action {
position: absolute;
right: 0;
top: 0;
left: 60%;
background-color: #fff;
}
}
.slide-container {
height: 100px;
margin: 10px;
border-radius: 2px;
overflow: hidden;
box-shadow: 0 2px 10px #ddd;
}
.cards {
overflow: hidden;
background-color: #fff;
}
</style> </style>
\ No newline at end of file
<template>
<div>
<div class="amap-page-container">
<el-amap
vid="amap"
:plugin="plugin"
:center="center"
:map-manager="amapManager"
:zoom="zoom"
:events="events"
:scrollWheel="false"
class="amap-demo"
></el-amap>
</div>
<div class="location-box">
<cube-scroll ref="scroll">
<van-cell-group>
<van-cell
v-for="(item,index) in poisData"
:key="index"
icon="location-o"
:title="item.name"
:label="item.address"
@click="selectAddress(item.id)"
/>
</van-cell-group>
<cube-loading v-if="poisData==null" :size="20">正在定位</cube-loading>
</cube-scroll>
</div>
</div>
</template>
<script>
import VueAMap from "vue-amap";
let amapManager = new VueAMap.AMapManager();
export default {
computed: {
lang() {
return this.$store.state.lang;
}
},
data() {
let self = this;
return {
zoom: 16,
center: [121.59996, 31.197646],
center2: [121.59996, 31.197646],
amapManager,
nowLocation: {
id: null,
address: null
},
poisData: null,
lng: 0,
lat: 0,
lng2: 0,
lat2: 0,
loaded: false,
plugin: [
{
pName: "Geolocation",
events: {
init(o) {
// o 是高德地图定位插件实例
o.getCurrentPosition((status, result) => {
if (result && result.position) {
self.lng = result.position.lng;
self.lat = result.position.lat;
self.center = [self.lng, self.lat];
self.loaded = true;
self.$nextTick();
} else {
self.loaded = true;
}
});
}
}
}
],
events: {
init(map) {
AMapUI.loadUI(["misc/PositionPicker"], function(PositionPicker) {
var positionPicker = new PositionPicker({
mode: "dragMap", //设定为拖拽地图模式,可选'dragMap'、'dragMarker',默认为'dragMap'
map: map //依赖地图对象
});
positionPicker.on("success", function(positionResult) {
self.nowLocation = positionResult.regeocode.pois[0];
console.log(positionResult);
self.lng2 = positionResult.position.lng;
self.lat2 = positionResult.position.lat;
self.center2 = [self.lng2, self.lat2];
if (self.loaded) {
self.poisData = positionResult.regeocode.pois;
}
});
positionPicker.start();
//TODO:事件绑定、结果处理等
});
AMapUI.loadUI(["control/BasicControl"], function(BasicControl) {
//缩放控件
map.addControl(
new BasicControl.Zoom({
position: "rb", //left top,左上角
showZoomNum: false //显示zoom值
})
);
});
}
}
};
},
methods: {
selectAddress(id) {
let pItem = null;
for (let i = 0; this.poisData.length; i++) {
if (this.poisData[i].id == id) {
pItem = this.poisData[i];
break;
}
}
const curChoise = this.poisData.find(item => item.id == id);
console.log(curChoise)
},
goBack() {
/* if(this.locationRequest){
this.$router.push({name: this.locationRequest,params:{action:true}});
}else{
this.$router.push({name: 'dish',params:{action:true}});
} */
},
projectCallBackData() {},
add() {
this.$router.push({ name: "addressAdd", params: { action: true } });
}
}
};
</script>
<style scoped>
.amap-demo {
height: 200px;
}
.location-box {
position: absolute;
top: 250px;
bottom: 0;
left: 0;
right: 0;
margin: auto;
}
.van-cell__title span {
font-size: 14px;
}
</style>
\ No newline at end of file
...@@ -5,6 +5,12 @@ function resolve(dir) { ...@@ -5,6 +5,12 @@ function resolve(dir) {
} }
module.exports = { module.exports = {
configureWebpack: {
externals: {
'AMap': 'AMap',
'AMapUI': 'AMapUI'
}
},
css: { css: {
loaderOptions: { loaderOptions: {
stylus: { stylus: {
...@@ -31,5 +37,5 @@ module.exports = { ...@@ -31,5 +37,5 @@ module.exports = {
.use(webpack.ContextReplacementPlugin, .use(webpack.ContextReplacementPlugin,
[/moment[/\\]locale$/, /zh-cn/]) [/moment[/\\]locale$/, /zh-cn/])
}, },
baseUrl: '' lintOnSave: false
} }
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