修改公寓位置单位
This commit is contained in:
@@ -50,20 +50,20 @@
|
||||
<div class="figure flexflex" v-if="item.distance?.distance">
|
||||
距离
|
||||
<div class="school">{{ item.distance.alias }}</div>
|
||||
<div class="mile">{{ item.distance.distance }}公里</div>
|
||||
<div class="mile">{{ item.distance.distance }}km</div>
|
||||
</div>
|
||||
<div class="vehicle-list flex1 flexflex">
|
||||
<div class="vehicle-item flexacenter" v-if="item.distance?.walking_duration > 0">
|
||||
<img class="vehicle-icon" src="@/assets/img/apartmentDetail/walk-icon.png" />
|
||||
{{ item.distance.walking_duration }}时长(分)
|
||||
{{ calculateDuration(item.distance.walking_duration) }}
|
||||
</div>
|
||||
<div class="vehicle-item flexacenter" v-if="item.distance?.transit_duration > 0">
|
||||
<img class="vehicle-icon" src="@/assets/img/apartmentDetail/taxi-icon.png" />
|
||||
{{ item.distance.transit_duration }}时长(分)
|
||||
{{ calculateDuration(item.distance.transit_duration) }}
|
||||
</div>
|
||||
<div class="vehicle-item flexacenter" v-if="item.distance?.driving_duration > 0">
|
||||
<img class="vehicle-icon" src="@/assets/img/apartmentDetail/subway-icon.png" />
|
||||
{{ item.distance.driving_duration }}时长(分)
|
||||
{{ calculateDuration(item.distance.driving_duration) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,88 +1,86 @@
|
||||
function setSeoTitle(title) {
|
||||
document.title = "港校租房-" + title
|
||||
document.title = "港校租房-" + title;
|
||||
}
|
||||
|
||||
// 跳转 url
|
||||
function redirectToExternalWebsite(url) {
|
||||
const link = document.createElement("a")
|
||||
link.href = url
|
||||
link.target = "_blank"
|
||||
link.click()
|
||||
const link = document.createElement("a");
|
||||
link.href = url;
|
||||
link.target = "_blank";
|
||||
link.click();
|
||||
}
|
||||
|
||||
// 跳转登录
|
||||
function goTologin() {
|
||||
let url = encodeURIComponent(location.href)
|
||||
redirectToExternalWebsite(`https://passport.gter.net/?referer=${url}`)
|
||||
let url = encodeURIComponent(location.href);
|
||||
redirectToExternalWebsite(`https://passport.gter.net/?referer=${url}`);
|
||||
}
|
||||
|
||||
// 复制方法
|
||||
function copyToClipboard(text) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const textareaEle = document.createElement("textarea")
|
||||
document.body.appendChild(textareaEle)
|
||||
const textareaEle = document.createElement("textarea");
|
||||
document.body.appendChild(textareaEle);
|
||||
// 2. 将需要复制的文本传入输入框, 并调用 select 方法, 选中输入框中文本
|
||||
textareaEle.value = text
|
||||
textareaEle.select()
|
||||
textareaEle.readOnly = "readOnly"
|
||||
textareaEle.value = text;
|
||||
textareaEle.select();
|
||||
textareaEle.readOnly = "readOnly";
|
||||
// 3. 调用复制选中文本的方法
|
||||
document.execCommand("copy")
|
||||
document.execCommand("copy");
|
||||
// 4. 销毁输入框
|
||||
document.body.removeChild(textareaEle)
|
||||
resolve()
|
||||
document.body.removeChild(textareaEle);
|
||||
resolve();
|
||||
// navigator.clipboard.writeText(text).then(() => {
|
||||
// resolve()
|
||||
// }).catch((err) => {
|
||||
// reject()
|
||||
// });
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
// 转换 秒数
|
||||
function secondsToHoursMinutes(seconds, type) {
|
||||
// 计算小时数
|
||||
const hours = Math.floor(seconds / 3600)
|
||||
const hours = Math.floor(seconds / 3600);
|
||||
// 计算剩余的秒数
|
||||
const remainingSecondsAfterHours = seconds % 3600
|
||||
const remainingSecondsAfterHours = seconds % 3600;
|
||||
// 计算分钟数
|
||||
const minutes = Math.floor(remainingSecondsAfterHours / 60)
|
||||
const minutes = Math.floor(remainingSecondsAfterHours / 60);
|
||||
// 计算剩余的秒数
|
||||
const remainingSeconds = remainingSecondsAfterHours % 60
|
||||
const remainingSeconds = remainingSecondsAfterHours % 60;
|
||||
|
||||
let text = ""
|
||||
let text = "";
|
||||
if (type == "chinese") {
|
||||
if (hours != 0) text += hours + "小时"
|
||||
if (minutes != 0) text += minutes + "分钟"
|
||||
if (remainingSeconds != 0 && minutes == 0) text += remainingSeconds + "秒"
|
||||
if (hours != 0) text += hours + "小时";
|
||||
if (minutes != 0) text += minutes + "分钟";
|
||||
if (remainingSeconds != 0 && minutes == 0) text += remainingSeconds + "秒";
|
||||
} else {
|
||||
if (hours != 0) text += hours + "h"
|
||||
if (minutes != 0) text += minutes + "min"
|
||||
if (remainingSeconds != 0 && minutes == 0) text += remainingSeconds + "s"
|
||||
if (hours != 0) text += hours + "h";
|
||||
if (minutes != 0) text += minutes + "min";
|
||||
if (remainingSeconds != 0 && minutes == 0) text += remainingSeconds + "s";
|
||||
}
|
||||
return text
|
||||
return text;
|
||||
}
|
||||
|
||||
// 转换 米数
|
||||
function metersToKilometers(input, type) {
|
||||
let text = ""
|
||||
if (input >= 1000) text = (input / 1000).toFixed(1) + (type == "chinese" ? "公里" : "km")
|
||||
else text = input + (type == "chinese" ? "米" : "m")
|
||||
return text
|
||||
let text = "";
|
||||
if (input >= 1000) text = (input / 1000).toFixed(1) + (type == "chinese" ? "公里" : "km");
|
||||
else text = input + (type == "chinese" ? "米" : "m");
|
||||
return text;
|
||||
}
|
||||
|
||||
// 计算路程时间
|
||||
const calculateDuration = seconds => {
|
||||
if (seconds < 60) return `${seconds}s`;
|
||||
const minutes = seconds / 60;
|
||||
if (minutes < 60) return `${Math.floor(minutes)}min`;
|
||||
const calculateDuration = (minutes) => {
|
||||
if (minutes < 60) return `${minutes}min`;
|
||||
else {
|
||||
const hours = minutes / 60;
|
||||
return `${hours.toFixed(1).replace(/\.0$/, '')}h`;
|
||||
}
|
||||
return `${hours.toFixed(2).replace(/\.0$/, "")}h`;
|
||||
}
|
||||
};
|
||||
|
||||
// 计算路程公里数
|
||||
const calculateDistance = value => (value / 1000).toFixed(1);
|
||||
const calculateDistance = (value) => (value / 1000).toFixed(1);
|
||||
|
||||
module.exports = {
|
||||
calculateDistance,
|
||||
@@ -93,4 +91,4 @@ module.exports = {
|
||||
copyToClipboard,
|
||||
secondsToHoursMinutes,
|
||||
metersToKilometers,
|
||||
}
|
||||
};
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
<div class="figure flexacenter" v-if="distancePitch?.alias">
|
||||
距离
|
||||
<div class="school">{{ distancePitch.alias }}</div>
|
||||
{{ distancePitch.distance }}公里
|
||||
{{ distancePitch.distance }}km
|
||||
<div class="btn" @click="openSelectSchool">[切换院校]</div>
|
||||
</div>
|
||||
|
||||
@@ -108,17 +108,17 @@
|
||||
{{ item }}
|
||||
</div> -->
|
||||
|
||||
<div class="item flexcenter" v-if="distancePitch.walking_duration > 0">
|
||||
<div class="item flexcenter" v-if="distancePitch?.walking_duration > 0">
|
||||
<img class="icon" src="@/assets/img/apartmentDetail/walk-icon.png" />
|
||||
{{ distancePitch.walking_duration }}时长(分)
|
||||
{{ calculateDuration(distancePitch.walking_duration) }}
|
||||
</div>
|
||||
<div class="item flexcenter" v-if="distancePitch.transit_duration > 0">
|
||||
<div class="item flexcenter" v-if="distancePitch?.transit_duration > 0">
|
||||
<img class="icon" src="@/assets/img/apartmentDetail/subway-icon.png" />
|
||||
{{ distancePitch.transit_duration }}时长(分)
|
||||
{{ calculateDuration(distancePitch.transit_duration) }}
|
||||
</div>
|
||||
<div class="item flexcenter" v-if="distancePitch.driving_duration > 0">
|
||||
<div class="item flexcenter" v-if="distancePitch?.driving_duration > 0">
|
||||
<img class="icon" src="@/assets/img/apartmentDetail/taxi-icon.png" />
|
||||
{{ distancePitch.driving_duration }}时长(分)
|
||||
{{ calculateDuration(distancePitch.driving_duration) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -193,7 +193,7 @@
|
||||
</div>
|
||||
<div class="explain two-line-text">{{ spotObj.content }}</div>
|
||||
</div>
|
||||
<img class="inspect-img" :src="spotObj.sources[0]?.thumbnail" />
|
||||
<img v-if="spotObj.sources[0]?.thumbnail" class="inspect-img" :src="spotObj.sources[0]?.thumbnail" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -613,24 +613,24 @@
|
||||
<img class="select-img" src="@/assets/img/apartmentDetail/u1834.png" />
|
||||
</div>
|
||||
<div class="select-info flex1">
|
||||
<div class="select-name">{{ item.name }}</div>
|
||||
<div class="select-name" v-if="item.name">{{ item.name }}</div>
|
||||
<div class="distance flexacenter">
|
||||
距离
|
||||
<div class="abbreviation">{{ item.alias }}</div>
|
||||
{{ item.distance }}公里
|
||||
{{ item.distance }}km
|
||||
</div>
|
||||
<div class="vehicle flexflex flex1">
|
||||
<div class="item flexcenter" v-if="item.walking_duration > 0">
|
||||
<img class="vehicle-icon" src="@/assets/img/apartmentDetail/walk-icon.png" />
|
||||
{{ item.walking_duration }}时长(分)
|
||||
{{ calculateDuration(item.walking_duration) }}
|
||||
</div>
|
||||
<div class="item flexcenter" v-if="item.transit_duration > 0">
|
||||
<img class="vehicle-icon" src="@/assets/img/apartmentDetail/subway-icon.png" />
|
||||
{{ item.transit_duration }}时长(分)
|
||||
{{ calculateDuration(item.transit_duration) }}
|
||||
</div>
|
||||
<div class="item flexcenter" v-if="item.driving_duration > 0">
|
||||
<img class="vehicle-icon" src="@/assets/img/apartmentDetail/taxi-icon.png" />
|
||||
{{ item.driving_duration }}时长(分)
|
||||
{{ calculateDuration(item.driving_duration) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -948,7 +948,7 @@ const init = () => {
|
||||
getDetailsHeight();
|
||||
getLikeList();
|
||||
getMapDistance();
|
||||
getComment();
|
||||
if (info.value.fieldtrips == 1) getComment();
|
||||
});
|
||||
|
||||
if (data.withsameapartments > 0) dualBrandData();
|
||||
@@ -968,7 +968,8 @@ const getDetailsHeight = () => {
|
||||
|
||||
// 切换 详情 显示
|
||||
const openDetails = () => {
|
||||
isHideDetails.value = !isHideDetails.value;
|
||||
isHideDetails.value = false;
|
||||
|
||||
let target = messageEle.value;
|
||||
let header = target.querySelector(".details-header");
|
||||
let box = target.querySelector(".text");
|
||||
@@ -1455,7 +1456,7 @@ const getMapDistance = () => {
|
||||
// obj,
|
||||
// };
|
||||
// arr.push(target);
|
||||
if (element.sid == sid) pitch = element
|
||||
if (element.sid == sid) pitch = element;
|
||||
});
|
||||
|
||||
if (pitch == null) pitch = distance[0];
|
||||
@@ -1471,7 +1472,7 @@ const openSelectSchool = () => {
|
||||
isSelectSchool.value = true;
|
||||
|
||||
nextTick(() => {
|
||||
return
|
||||
return;
|
||||
const item = selectSchoolRef.value.querySelector(`.item${distancePitch.value.sid}`);
|
||||
if (!item) return;
|
||||
selectSchoolRef.value.scrollTo({ top: item.offsetTop - 20, behavior: "smooth" });
|
||||
@@ -2032,6 +2033,7 @@ const cutRemarkType = (value) => (remarkTypeid.value = value);
|
||||
|
||||
.select-list {
|
||||
max-height: 500px;
|
||||
min-height: 300px;
|
||||
overflow: auto;
|
||||
position: relative;
|
||||
.select-item {
|
||||
@@ -2047,7 +2049,7 @@ const cutRemarkType = (value) => (remarkTypeid.value = value);
|
||||
}
|
||||
|
||||
&:last-of-type {
|
||||
border-radius: 0 0 16px 16px;
|
||||
// border-radius: 0 0 16px 16px;
|
||||
}
|
||||
|
||||
.select-icon {
|
||||
@@ -2071,12 +2073,13 @@ const cutRemarkType = (value) => (remarkTypeid.value = value);
|
||||
font-style: normal;
|
||||
font-size: 16px;
|
||||
color: #000000;
|
||||
margin-bottom: 7px;
|
||||
}
|
||||
|
||||
.distance {
|
||||
font-size: 14px;
|
||||
color: #555555;
|
||||
margin-top: 7px;
|
||||
// margin-top: 7px;
|
||||
padding-bottom: 7px;
|
||||
|
||||
.abbreviation {
|
||||
|
||||
Reference in New Issue
Block a user