Commit d05e3edb authored by 沈良进's avatar 沈良进

二级城市页面对接

parent d68d3ce9
...@@ -390,6 +390,13 @@ export default { ...@@ -390,6 +390,13 @@ export default {
this.dateRange = { from: this.msg.startDate, to: this.msg.endDate }; this.dateRange = { from: this.msg.startDate, to: this.msg.endDate };
this.goSearchHandler(); this.goSearchHandler();
}, },
mounted() {
var CategoryName = this.getUrlKey("CategoryName", window.location.href);
if(CategoryName) {
this.goodsType.find(item => item.Name === CategoryName)
}
console
},
methods: { methods: {
handleSelected(target) { handleSelected(target) {
console.log("handleSelected", target); console.log("handleSelected", target);
......
...@@ -94,15 +94,12 @@ ...@@ -94,15 +94,12 @@
class="card-img q-mb-xs" class="card-img q-mb-xs"
:src="detail.ImageList[1] || detail.ImageList[0]" :src="detail.ImageList[1] || detail.ImageList[0]"
/> />
<img <div class="card-img" id="map"></div>
class="card-img"
src="https://imgfile.oytour.com/Upload/DMC/202110131151571540000000139.jpeg"
/>
</div> </div>
</div> </div>
<div class="flex justify-between q-mt-sm"> <div class="flex justify-between q-mt-sm">
<div v-for="item in navList" :key="item.img" class="nav-item"> <div v-for="item in navList" :key="item.img" class="nav-item" @click="navClick(item)">
<img <img
class="nav-img" class="nav-img"
:src="require(`../../assets/img/${item.img}.png`)" :src="require(`../../assets/img/${item.img}.png`)"
...@@ -112,14 +109,14 @@ ...@@ -112,14 +109,14 @@
</div> </div>
<div class="top-title">TOP榜单</div> <div class="top-title">TOP榜单</div>
<div>本地销量最好的商品</div> <div>本地销量最好的商品</div>
<div class="mt" style="height: 500px; width: 1200px; overflow-x: auto;"> <div class="mt" style="width: 1200px; overflow-x: auto;">
<div style="width: auto"> <div style="width: 2920px">
<topCard v-for="item in detail.TopList" :data="item" :key="item.ID" /></div> <topCard @click.native="navToDetail(item)" v-for="item in detail.TopList" :data="item" :key="item.ID" /></div>
</div> </div>
<div class="top-title">最新推荐</div> <div class="top-title">最新推荐</div>
<div>已售出商品的最新榜單</div> <div>已售出商品的最新榜單</div>
<div class="flex justify-between flex-wrap mt"> <div class="flex justify-between flex-wrap mt">
<likeCard v-for="item in detail.NewList" :data="item" :key="item.ID" /> <likeCard @click.native="navToDetail(item)" v-for="item in detail.NewList" :data="item" :key="item.ID" />
</div> </div>
<div class="top-title">關於{{detail.AreaName}}</div> <div class="top-title">關於{{detail.AreaName}}</div>
<div class="flex justify-between"> <div class="flex justify-between">
...@@ -131,7 +128,7 @@ ...@@ -131,7 +128,7 @@
</div> </div>
</div> </div>
<!-- <div class="top-title">當地天氣</div> --> <!-- <div class="top-title">當地天氣</div> -->
<div> <div class="mt pt">
<!-- <div class="flex"> <!-- <div class="flex">
<div class="time-item" v-for="item in 4" :key="item"> <div class="time-item" v-for="item in 4" :key="item">
<div class="f16">12月-2月</div> <div class="f16">12月-2月</div>
...@@ -145,7 +142,7 @@ ...@@ -145,7 +142,7 @@
:src="require(`../../assets/img/info-time.png`)" :src="require(`../../assets/img/info-time.png`)"
/> />
<div> <div>
<div class="f16 bold">時區</div> <div class="f16 bold">時區 {{detail.TimeZones}}</div>
<!-- <div>-12° -17°</div> --> <!-- <div>-12° -17°</div> -->
</div> </div>
</div> </div>
...@@ -155,7 +152,7 @@ ...@@ -155,7 +152,7 @@
:src="require('../../assets/img/info-currency.png')" :src="require('../../assets/img/info-currency.png')"
/> />
<div> <div>
<div class="f16 bold">貨幣</div> <div class="f16 bold">貨幣 {{detail.CurrencyName}}</div>
<!-- <div>-12° -17°</div> --> <!-- <div>-12° -17°</div> -->
</div> </div>
</div> </div>
...@@ -165,7 +162,7 @@ ...@@ -165,7 +162,7 @@
:src="require(`../../assets/img/info-ele.png`)" :src="require(`../../assets/img/info-ele.png`)"
/> />
<div> <div>
<div class="f16 bold">電壓</div> <div class="f16 bold">電壓 {{detail.Voltage}}</div>
<!-- <div>-12° -17°</div> --> <!-- <div>-12° -17°</div> -->
</div> </div>
</div> </div>
...@@ -176,12 +173,14 @@ ...@@ -176,12 +173,14 @@
/> />
<div> <div>
<div class="f16 bold q-mt-xs">旅遊時間</div> <div class="f16 bold q-mt-xs">旅遊時間</div>
<!-- <div>-12° -17°</div> --> <div v-for="(item, index) in detail.BestTravelTimeList" :key="index">
<span class="bold">{{item.Month}}</span><span class="q-ml-sm ">{{item.Description}}</span>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<nearCity :cityList="detail.AdjacentCityList" /> <nearCity :name="detail.AreaName" :cityList="detail.AdjacentCityList" />
</div> </div>
</div> </div>
</template> </template>
...@@ -196,11 +195,11 @@ export default { ...@@ -196,11 +195,11 @@ export default {
detail: null, detail: null,
navList: [ navList: [
{ {
title: "光行程", title: "光行程",
img: "nav-map", img: "nav-map",
}, },
{ {
title: "景點門票", title: "景点门票",
img: "nav-ticket", img: "nav-ticket",
}, },
{ {
...@@ -216,11 +215,35 @@ export default { ...@@ -216,11 +215,35 @@ export default {
}, },
mounted() { mounted() {
this.getData(); this.getData();
this.createMap(); var newStartDate = new Date();
this.addMarker(); var newStartDateStr = this.formatDate(
this.addLabel() newStartDate.getFullYear(),
newStartDate.getMonth() + 1,
newStartDate.getDate()
);
var newEndDate = this.AddMonth(newStartDateStr, 2);
var newEndDateStr = this.formatDate(
newEndDate.getFullYear(),
newEndDate.getMonth() + 1,
newEndDate.getDate()
);
this.searchDate = newStartDateStr;
this.searchEndDate = newEndDateStr;
}, },
methods: { methods: {
navClick(item) {
this.CommonJump(
"/search",
{
qsearchKey: this.detail.AreaName,
qsearchDate: this.searchDate,
qsearchEndDate: this.searchEndDate,
CategoryName: item.title}
);
},
navToDetail(item) {
console.log('navToDetail', item)
},
getData() { getData() {
this.$q.loading.show(); this.$q.loading.show();
this.apipost( this.apipost(
...@@ -229,6 +252,11 @@ export default { ...@@ -229,6 +252,11 @@ export default {
(r) => { (r) => {
this.detail = r.data.data this.detail = r.data.data
this.$q.loading.hide(); this.$q.loading.hide();
this.$nextTick(() => {
this.createMap();
this.addMarker();
this.addLabel()
})
}, },
null null
); );
...@@ -238,9 +266,21 @@ export default { ...@@ -238,9 +266,21 @@ export default {
return; return;
} }
let map = new BMapGL.Map("baidu-map"); // 创建地图实例 let map = new BMapGL.Map("baidu-map"); // 创建地图实例
let point = new BMapGL.Point(116.404, 39.915); // 创建点坐标
map.centerAndZoom(point, 15); // 初始化地图,设置中心点坐标和地图级别
this.map = map; this.map = map;
var myGeo = new BMapGL.Geocoder();
const that = this
let address = '日本东京'
console.log('address', address)
myGeo.getPoint(address, function(point){
if(point){
console.log('get point', point)
that.point = point
let pointA = new BMapGL.Point(point.lng, point.lat); // 创建点坐标
map.centerAndZoom(pointA, 8); // 初始化地图,设置中心点坐标和地图级别
}else{
alert('您选择的地址没有解析到结果!');
}
},'东京')
}, },
addMarker() { addMarker() {
let icon = require(`../../assets/img/info-time.png`); let icon = require(`../../assets/img/info-time.png`);
...@@ -255,13 +295,13 @@ export default { ...@@ -255,13 +295,13 @@ export default {
// 需要指定大图的偏移位置,此做法与css sprites技术类似。 // 需要指定大图的偏移位置,此做法与css sprites技术类似。
// imageOffset: new BMapGL.Size(0, 0 - 25) // 设置图片偏移 // imageOffset: new BMapGL.Size(0, 0 - 25) // 设置图片偏移
}); });
let point = new BMapGL.Point(116.404, 39.915); // 创建点坐标 let point = new BMapGL.Point(this.point.lng, this.point.lat); // 创建点坐标
// 创建标注对象并添加到地图 // 创建标注对象并添加到地图
var marker = new BMapGL.Marker(point, { icon: myIcon }); var marker = new BMapGL.Marker(point, { icon: myIcon });
this.map.addOverlay(marker); this.map.addOverlay(marker);
}, },
addLabel() { addLabel() {
var point = new BMapGL.Point(116.404, 39.915); var point = new BMapGL.Point(this.point.lng, this.point.lat);
var content = "label"; var content = "label";
var label = new BMapGL.Label(content, { var label = new BMapGL.Label(content, {
// 创建文本标注 // 创建文本标注
......
<style scoped> <style scoped>
.title { .title {
font-size: 26px; font-size: 26px;
font-family: Microsoft JhengHei; font-family: Microsoft JhengHei;
font-weight: bold; font-weight: bold;
color: #000000; color: #000000;
line-height: 44px; line-height: 44px;
margin-top: 30px; margin-top: 30px;
margin-bottom: 10px; margin-bottom: 10px;
} }
.card { .card {
width: 210px; width: 210px;
height: 290px; height: 290px;
border-radius: 10px; border-radius: 10px;
margin-right: 20px; margin-right: 20px;
} }
.card-img { .card-img {
width: 210px; width: 210px;
height: 290px; height: 290px;
border-radius: 10px; border-radius: 10px;
object-fit: cover; object-fit: cover;
} }
.info { .info {
position: absolute; position: absolute;
...@@ -29,43 +29,63 @@ object-fit: cover; ...@@ -29,43 +29,63 @@ object-fit: cover;
.all { .all {
margin: 20px auto; margin: 20px auto;
width: 320px; width: 320px;
height: 42px; height: 42px;
border: 1px solid #474747; border: 1px solid #474747;
border-radius: 8px; border-radius: 8px;
} }
</style> </style>
<template> <template>
<div> <div>
<div class="title">附近的城市</div> <div class="title">附近的城市</div>
<div class="flex"> <div class="flex">
<div class="relative card" v-for="item in cityList" :key="item.Id"> <div
<img @click="navToSearch(item)"
class="card-img" class="relative card"
:src="item.ImageList[0]" v-for="item in cityList"
/> :key="item.Id"
<div class="info"> >
<div>{{item.AreaName}}</div> <img class="card-img" :src="item.ImageList[0]" />
<!-- <div>10Km</div> --> <div class="info">
<div>{{ item.AreaName }}</div>
<!-- <div>10Km</div> -->
</div>
</div> </div>
</div> </div>
<div class="flex flex-center">
<q-btn
@click="navToSearch()"
label="所有目的地"
class="all"
unelevated
></q-btn>
</div>
</div> </div>
<div class="flex flex-center">
<q-btn
label="所有目的地"
class="all"
unelevated></q-btn>
</div>
</div>
</template> </template>
<script> <script>
export default { export default {
props: { props: {
cityList: { cityList: {
default: () => [] default: () => [],
} },
name: {
default: () => ({}),
},
}, },
data() { data() {
return {}; return {};
} },
methods: {
navToSearch(item) {
console.log("navToDetail", item);
let params = {
qsearchDate: this.searchDate,
qsearchEndDate: this.searchEndDate,
};
if (item) {
params.qsearchKey = item.AreaName
}
this.CommonJump("/search", params);
},
},
}; };
</script> </script>
\ No newline at end of file
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