Commit 91bf49b8 by zhangxw

页面完成

1 parent 0e78cabf
This diff could not be displayed because it is too large.
...@@ -15,7 +15,9 @@ ...@@ -15,7 +15,9 @@
"babel-plugin-import": "^1.13.5", "babel-plugin-import": "^1.13.5",
"clipboard": "^2.0.11", "clipboard": "^2.0.11",
"core-js": "^3.8.3", "core-js": "^3.8.3",
"element-plus": "^2.2.9",
"moment": "^2.29.1", "moment": "^2.29.1",
"svg-sprite-loader": "^6.0.11",
"vant": "^3.5.2", "vant": "^3.5.2",
"vue": "^3.2.13", "vue": "^3.2.13",
"vue-router": "^4.0.3", "vue-router": "^4.0.3",
...@@ -50,7 +52,9 @@ ...@@ -50,7 +52,9 @@
"parserOptions": { "parserOptions": {
"parser": "@babel/eslint-parser" "parser": "@babel/eslint-parser"
}, },
"rules": {} "rules": {
"indent": "off"
}
}, },
"browserslist": [ "browserslist": [
"> 1%", "> 1%",
......
...@@ -2,25 +2,42 @@ import request from "./request"; ...@@ -2,25 +2,42 @@ import request from "./request";
// 获取所有车辆数据 // 获取所有车辆数据
export const GET_ALL_CAR_LIST = (params) => { export const GET_ALL_CAR_LIST = (params) => {
return request(params, "");
};
// 搜索车辆数据
export const GET_CAR_DATA_BYSEARCH = (params) => {
return request(params, "/miniappserver/monitor/search"); return request(params, "/miniappserver/monitor/search");
}; };
// 获取车辆位置详细信息 // 获取车辆位置详细信息
export const GET_CAR_LOCATION_INFO = (params) => { export const GET_CAR_LOCATION_INFO = (params) => {
return request(params, "/trialdrive/api/vehicle/location"); return request(params, "/miniappserver/monitor/location");
}; };
// 获取常驻地数据 // 获取常驻地数据
export const GET_RESIDENT_DATA = (params) => { export const GET_RESIDENT_DATA = (params) => {
return request(params, ""); return request(params, "/miniappserver/monitor/location/residentList");
}; };
// 获取轨迹回放数据 // 获取轨迹回放数据
export const GET_REPLAY_DATA = (params) => { export const GET_REPLAY_DATA = (params) => {
return request(params, "/devicemonitor/api/track/playback"); // /devicemonitor/api/track/playback
// /miniappserver/monitor/location/trackPointList
return request(params, "/miniappserver/monitor/location/trackPointList");
};
// 获取已设置调频数据
export const GET_FREQ_INFO = (params) => {
return request(params, "/miniappserver/deviceFreq/getAdjFreqBySn");
};
// 关闭调频
export const CLOSE_FREQ = (params) => {
return request(params, "/miniappserver/deviceFreq/resetAdjFreq");
};
// 一键调频
export const SET_FREQ = (params) => {
return request(params, "/miniappserver/deviceFreq/adjFreq", "POST");
};
// 新增围栏
export const ADD_FENCE = (params) => {
return request(params, "/miniappserver/fence/add", "POST");
}; };
...@@ -17,18 +17,18 @@ ...@@ -17,18 +17,18 @@
width: 130px; width: 130px;
} }
.el-slider__bar { .el-slider__bar {
height: var(--el-slider-height); height: 2px;
background-color: var(--el-slider-main-bg-color); background-color: var(--base-color);
border-top-left-radius: var(--el-slider-border-radius); border-top-left-radius: 1px;
border-bottom-left-radius: var(--el-slider-border-radius); border-bottom-left-radius: 1px;
position: absolute; position: absolute;
} }
.el-slider__button-wrapper { .el-slider__button-wrapper {
height: var(--el-slider-button-wrapper-size); height: 16px;
width: var(--el-slider-button-wrapper-size); width: 16px;
position: absolute; position: absolute;
z-index: 1; z-index: 1;
top: var(--el-slider-button-wrapper-offset); top: -9px;
transform: translateX(-50%); transform: translateX(-50%);
background-color: transparent; background-color: transparent;
text-align: center; text-align: center;
...@@ -52,14 +52,15 @@ ...@@ -52,14 +52,15 @@
} }
.el-slider__button { .el-slider__button {
display: inline-block; display: inline-block;
width: var(--el-slider-button-size); width: 16px;
height: var(--el-slider-button-size); height: 16px;
vertical-align: middle; vertical-align: middle;
border: solid 2px var(--el-slider-main-bg-color); border: none;
background-color: var(--el-color-white); box-shadow: 0px 2px 8px 0px rgba(135,143,153,0.5000);
background-color: #fff;
border-radius: 50%; border-radius: 50%;
box-sizing: border-box; box-sizing: border-box;
transition: var(--el-transition-duration-fast); transition: .2s;
-webkit-user-select: none; -webkit-user-select: none;
user-select: none; user-select: none;
} }
...@@ -77,10 +78,10 @@ ...@@ -77,10 +78,10 @@
} }
.el-slider__stop { .el-slider__stop {
position: absolute; position: absolute;
top: -6px; top: -4px;
height: 10px; height: 6px;
width: 10px; width: 6px;
border-radius: 10px; border-radius: 6px;
background-color: #fff; background-color: #fff;
border: 2px solid #e4e7eb; border: 2px solid #e4e7eb;
} }
...@@ -94,37 +95,9 @@ ...@@ -94,37 +95,9 @@
position: absolute; position: absolute;
transform: translateX(-50%); transform: translateX(-50%);
font-size: 14px; font-size: 14px;
color: var(--el-color-info); color: #111;
margin-top: 15px; margin-top: 15px;
} }
.el-slider.is-vertical {
position: relative;
height: 100%;
flex: 0;
}
.el-slider.is-vertical .el-slider__runway {
width: var(--el-slider-height);
height: 100%;
margin: 0 16px;
}
.el-slider.is-vertical .el-slider__bar {
width: var(--el-slider-height);
height: auto;
border-radius: 0 0 3px 3px;
}
.el-slider.is-vertical .el-slider__button-wrapper {
top: auto;
left: var(--el-slider-button-wrapper-offset);
transform: translateY(50%);
}
.el-slider.is-vertical .el-slider__stop {
transform: translateY(50%);
}
.el-slider.is-vertical .el-slider__marks-text {
margin-top: 0;
left: 15px;
transform: translateY(50%);
}
.el-slider--large { .el-slider--large {
height: 40px; height: 40px;
} }
......
...@@ -6,4 +6,7 @@ ...@@ -6,4 +6,7 @@
--van-text-link-color: #0077FF !important; --van-text-link-color: #0077FF !important;
--van-blue: #0077FF !important; --van-blue: #0077FF !important;
--van-search-input-height: 32px !important; --van-search-input-height: 32px !important;
--van-font-weight-bold: 600 !important;
--van-search-action-text-color: var(--base-color) !important;
--van-dropdown-menu-title-active-text-color: var(--base-color) !important;
} }
\ No newline at end of file \ No newline at end of file
const req = require.context("./svg", false, /\.svg$/);
// 解析获取的.svg文件的文件名称并返回
const requireAll = (requireContext) => {
return requireContext.keys().map(requireContext);
};
requireAll(req);
<?xml version="1.0" encoding="UTF-8"?>
<svg width="20px" height="20px" viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>选中备份 2</title>
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="2-14找车-车辆窗口-设备调频-星期模式" transform="translate(-204.000000, -374.000000)">
<g id="编组-6" transform="translate(0.000000, 132.000000)">
<g id="Menu备份-5" transform="translate(12.000000, 182.000000)">
<g id="编组-4备份-2" transform="translate(0.000000, 8.000000)">
<g id="编组-5备份" transform="translate(16.000000, 52.000000)">
<g id="选中备份-2" transform="translate(176.000000, 0.000000)">
<rect id="矩形" x="0" y="0" width="20" height="20"></rect>
<rect id="矩形" stroke="#C4C8CC" fill="#FFFFFF" x="2.5" y="2.5" width="15" height="15" rx="2"></rect>
<path d="M4.86930191,8.95982997 L8.17974051,11.5439429 C8.17974051,11.5439429 8.36234281,11.6362088 8.59059569,11.5439429 L15.0272533,5.52055608 C15.0272533,5.52055608 16.1888069,5.27027934 15.973345,6.51631431 C15.1871406,7.32375211 8.8874347,14.2666776 8.8874347,14.2666776 C8.8874347,14.2666776 8.36234281,14.5666531 7.85996595,14.2666776 C7.35803015,13.7589924 4.00238204,10.0442882 4.00238204,10.0442882 C4.00238204,10.0442882 3.91041929,9.14458457 4.86930191,8.95982997 Z" id="路径" fill="#FFFFFF" fill-rule="nonzero"></path>
</g>
</g>
</g>
</g>
</g>
</g>
</g>
</svg>
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<svg width="20px" height="20px" viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>选中</title>
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="2-14找车-车辆窗口-设备调频-星期模式" transform="translate(-28.000000, -338.000000)">
<g id="编组-6" transform="translate(0.000000, 132.000000)">
<g id="Menu备份-5" transform="translate(12.000000, 182.000000)">
<g id="编组-4备份-2" transform="translate(0.000000, 8.000000)">
<g id="选中" transform="translate(16.000000, 16.000000)">
<rect id="矩形" x="0" y="0" width="20" height="20"></rect>
<rect id="矩形" fill="#0077FF" x="2" y="2" width="16" height="16" rx="2"></rect>
<path d="M4.86930191,8.95982997 L8.17974051,11.5439429 C8.17974051,11.5439429 8.36234281,11.6362088 8.59059569,11.5439429 L15.0272533,5.52055608 C15.0272533,5.52055608 16.1888069,5.27027934 15.973345,6.51631431 C15.1871406,7.32375211 8.8874347,14.2666776 8.8874347,14.2666776 C8.8874347,14.2666776 8.36234281,14.5666531 7.85996595,14.2666776 C7.35803015,13.7589924 4.00238204,10.0442882 4.00238204,10.0442882 C4.00238204,10.0442882 3.91041929,9.14458457 4.86930191,8.95982997 Z" id="路径" fill="#FFFFFF" fill-rule="nonzero"></path>
</g>
</g>
</g>
</g>
</g>
</g>
</svg>
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<svg width="18px" height="18px" viewBox="0 0 18 18" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>闹钟</title>
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="2-14找车-车辆窗口-设备调频-星期模式" transform="translate(-239.000000, -429.000000)">
<g id="编组-6" transform="translate(0.000000, 132.000000)">
<g id="Menu备份-5" transform="translate(12.000000, 182.000000)">
<g id="编组-4" transform="translate(0.000000, 96.000000)">
<g id="编组-3" transform="translate(16.000000, 8.000000)">
<g id="闹钟" transform="translate(211.000000, 11.000000)">
<rect id="矩形" x="0" y="0" width="18" height="18"></rect>
<path d="M8.9999655,3.7006587 C12.3973772,3.7006587 15.1515128,6.45479433 15.1515128,9.85220605 C15.1515128,13.2496178 12.3973772,16.0037534 8.9999655,16.0037534 C5.60255377,16.0037534 2.84841814,13.2496178 2.84841814,9.85220605 C2.84841814,6.45479433 5.60255377,3.7006587 8.9999655,3.7006587 Z M8.9999655,4.81912186 C6.22473885,4.81912186 3.9668813,7.07697941 3.9668813,9.85220605 C3.9668813,12.6274327 6.22473885,14.8852903 8.9999655,14.8852903 C11.7751921,14.8852903 14.0330497,12.6274327 14.0330497,9.85220605 C14.0330497,7.07697941 11.7751921,4.81912186 8.9999655,4.81912186 Z M8.76029482,6.12293032 C9.06914989,6.12293032 9.3195264,6.37245313 9.3195264,6.68025511 L9.3195264,6.68025511 L9.3195264,9.78535041 L12.4352452,9.78535041 C12.6350394,9.7853504 12.8196569,9.8915759 12.919554,10.0640128 C13.0194511,10.2364497 13.0194511,10.4489007 12.919554,10.6213376 C12.8196569,10.7937745 12.6350394,10.9 12.4352452,10.9 L12.4352452,10.9 L8.76029482,10.9 C8.45143975,10.9 8.20106324,10.6504772 8.20106324,10.3426752 L8.20106324,10.3426752 L8.20106324,6.68025511 C8.20106324,6.37245313 8.45143975,6.12293032 8.76029482,6.12293032 Z M5.37414762,2.00000048 C5.60930085,1.99986286 5.81941973,2.14634504 5.89991948,2.36653705 C5.98041923,2.58672906 5.91410064,2.83358571 5.73397319,2.9842363 L5.73397319,2.9842363 L2.91872154,5.33845586 C2.6821165,5.53630657 2.32937177,5.50554397 2.13084415,5.26974566 C1.93231652,5.03394736 1.96318437,4.68240537 2.1997894,4.48455465 L2.1997894,4.48455465 L5.01496117,2.13041471 C5.11550332,2.04607583 5.2427303,1.99988205 5.37414762,2.00000048 Z M12.6257834,2.00000035 C12.7571817,1.99985276 12.8843933,2.04605123 12.9848899,2.13041471 L12.9848899,2.13041471 L15.8001416,4.48455465 C15.9803222,4.63518172 16.0466887,4.88205871 15.9662018,5.1022825 C15.8857148,5.32250629 15.6755747,5.46901415 15.4403959,5.46887014 C15.3089762,5.46900225 15.1817446,5.4228068 15.0812095,5.33845586 L15.0812095,5.33845586 L12.2660377,2.98431592 C12.085857,2.83368884 12.0194905,2.58681185 12.0999775,2.36658806 C12.1804645,2.14636427 12.3906046,1.99985642 12.6257834,2.00000035 Z" id="形状结合" fill="#C0C5CC" fill-rule="nonzero"></path>
</g>
</g>
</g>
</g>
</g>
</g>
</g>
</svg>
\ No newline at end of file \ No newline at end of file
.icon {display: inline-block;background-image: url(sprite.png);background-size: 188px 164px;} .icon {display: inline-block;background-image: url(sprite.png);background-size: 232px 186px;}
.icon-checked { width: 20px; height: 20px; background-position: -128px -60px; } .icon-begin { width: 52px; height: 72px; background-position: -68px 0px; }
.icon-device { width: 14px; height: 14px; background-position: -168px -60px; } .icon-checked { width: 20px; height: 20px; background-position: -150px -156px; }
.icon-locate-sm { width: 14px; height: 14px; background-position: -68px -60px; } .icon-copy { width: 28px; height: 28px; background-position: -172px -112px; }
.icon-location { width: 24px; height: 24px; background-position: -164px -80px; } .icon-device { width: 14px; height: 14px; background-position: -64px -140px; }
.icon-off-car { width: 52px; height: 52px; background-position: -60px -80px; } .icon-loc-icon { width: 30px; height: 30px; background-position: 0px -156px; }
.icon-off-line { width: 20px; height: 20px; background-position: -148px -60px; } .icon-locate-sm { width: 14px; height: 14px; background-position: -78px -140px; }
.icon-offline-time { width: 14px; height: 14px; background-position: -82px -60px; } .icon-location { width: 24px; height: 24px; background-position: -30px -156px; }
.icon-on-car { width: 52px; height: 52px; background-position: -112px -80px; } .icon-navgation { width: 28px; height: 28px; background-position: -200px -112px; }
.icon-on-line { width: 24px; height: 24px; background-position: -164px -104px; } .icon-off-car { width: 52px; height: 52px; background-position: -172px -60px; }
.icon-online-time { width: 14px; height: 14px; background-position: -96px -60px; } .icon-off-line { width: 20px; height: 20px; background-position: -170px -156px; }
.icon-refresh-car { width: 24px; height: 24px; background-position: 0px -140px; } .icon-offline-time { width: 14px; height: 14px; background-position: -92px -140px; }
.icon-replay-pause { width: 60px; height: 60px; background-position: -68px 0px; } .icon-on-car { width: 52px; height: 52px; background-position: -120px -80px; }
.icon-replay-play { width: 60px; height: 60px; background-position: -128px 0px; } .icon-on-line { width: 24px; height: 24px; background-position: -54px -156px; }
.icon-replay-refresh { width: 60px; height: 60px; background-position: 0px -80px; } .icon-online-time { width: 14px; height: 14px; background-position: -106px -140px; }
.icon-put-away { width: 64px; height: 16px; background-position: 0px -140px; }
.icon-refresh-car { width: 24px; height: 24px; background-position: -78px -156px; }
.icon-replay-pause { width: 60px; height: 60px; background-position: 0px -80px; }
.icon-replay-play { width: 60px; height: 60px; background-position: -60px -80px; }
.icon-replay-refresh { width: 60px; height: 60px; background-position: -172px 0px; }
.icon-resident { width: 52px; height: 72px; background-position: -120px 0px; }
.icon-screen-btn { width: 24px; height: 24px; background-position: -102px -156px; }
.icon-setting-btn { width: 24px; height: 24px; background-position: -126px -156px; }
.icon-share { width: 68px; height: 80px; background-position: 0px 0px; } .icon-share { width: 68px; height: 80px; background-position: 0px 0px; }
.icon-typeList { width: 14px; height: 14px; background-position: -110px -60px; }
\ No newline at end of file \ No newline at end of file
.icon-typeList { width: 14px; height: 14px; background-position: -120px -140px; }
\ No newline at end of file \ No newline at end of file

12 KB | W: | H:

21.4 KB | W: | H:

src/assets/spritesmith-generated/sprite.png
src/assets/spritesmith-generated/sprite.png
src/assets/spritesmith-generated/sprite.png
src/assets/spritesmith-generated/sprite.png
  • 2-up
  • Swipe
  • Onion skin
<template> <template>
<div> <div>
<slot name="mapBox"></slot> <slot name="mapBox"></slot>
<slot name="screenBox"></slot>
<div v-show="isUploaded"> <div v-show="isUploaded">
<a class="map-cmd-icon location" @click="getLocation"> <a class="map-cmd-icon location" @click="getLocation">
<span class="icon icon-location"></span> <span class="icon icon-location"></span>
...@@ -41,6 +40,7 @@ export default { ...@@ -41,6 +40,7 @@ export default {
const init = (id) => { const init = (id) => {
map = new window.AMap.Map(id); map = new window.AMap.Map(id);
isUploaded.value = true; isUploaded.value = true;
context.emit("isUploaded", true);
context.emit("getData", map); context.emit("getData", map);
return map; return map;
}; };
......
export default {
name: "ElMarker",
props: {
mark: {
type: [String, Object],
},
},
render() {
let label = typeof this.mark === "string" ? this.mark : this.mark.text;
return (
<div class="el-slider__marks-text" style={this.mark.style || {}}>
{label}
</div>
);
},
};
<template>
<van-popup
v-model:show="props.showPopup"
round
@close="close"
:close-on-click-overlay="true"
:position="props.position"
>
<div class="content-box">
<div class="btn-class">
<span class="cancel-btn" @click="cancel">取消</span>
<span
class="save-btn"
:class="isDisabled ? 'disabled' : ''"
@click="save"
>{{ isDisabled ? "关闭" : "确定" }}</span
>
</div>
<slot></slot>
</div>
</van-popup>
</template>
<script>
import { defineComponent } from "vue";
export default defineComponent({
name: "PopupCom",
props: {
showPopup: {
type: Boolean,
default: false,
},
position: {
type: String,
},
isDisabled: {
type: Boolean,
default: false,
},
},
setup(props, { emit }) {
const cancel = () => {
emit("btnCancel");
};
const close = () => {
emit("btnCancel");
};
const save = () => {
if (props.isDisabled) {
emit("btnCancel");
} else {
emit("btnSave");
}
};
return {
cancel,
save,
props,
close,
};
},
});
</script>
<style lang="scss">
.content-box {
display: flex;
align-items: center;
background: #fff;
flex-flow: column;
border-radius: 0 0 16px 16px;
overflow: hidden;
padding-bottom: 40px;
.btn-class {
padding: 20px;
width: calc(100% - 40px);
display: flex;
justify-content: space-between;
.cancel-btn {
color: #6c737a;
}
.save-btn {
color: var(--base-color);
}
.save-btn.disabled {
color: #6c737a;
}
}
}
</style>
<template>
<div>
<van-overlay
:show="showOverlay"
@click="showOverlay = false"
:z-index="100000"
>
<span class="icon icon-share"></span>
<p class="tip">“点击右上角转发/分享”</p>
</van-overlay>
<slot></slot>
</div>
</template>
<script>
import { ref, defineComponent } from "vue";
export default defineComponent({
name: "SharePage",
props: {
isShowOverlay: {
type: Boolean,
default: false,
},
},
setup(props) {
const showOverlay = ref(false);
const share = () => {
showOverlay.value = true;
};
if (props.isShowOverlay) {
showOverlay.value = true;
}
return {
showOverlay,
share,
};
},
});
</script>
<style lang="scss" scoped>
.icon-share {
position: absolute;
top: 20px;
right: 65px;
}
.tip {
margin-top: 105px;
text-align: center;
color: #fff;
font-size: 16px;
}
</style>
<template>
<div
class="el-slider__button-wrapper"
@mouseenter="handleMouseEnter"
@mouseleave="handleMouseLeave"
@mousedown="onButtonDown"
@touchstart="onButtonDown"
:class="{ hover: hovering, dragging: dragging }"
:style="wrapperStyle"
ref="button"
tabindex="0"
@focus="handleMouseEnter"
@blur="handleMouseLeave"
></div>
</template>
<script>
export default {
name: "ElSliderButton",
components: {},
props: {
value: {
type: Number,
default: 0,
},
vertical: {
type: Boolean,
default: false,
},
tooltipClass: String,
},
data() {
return {
hovering: false,
dragging: false,
isClick: false,
startX: 0,
currentX: 0,
startY: 0,
currentY: 0,
startPosition: 0,
newPosition: null,
oldValue: this.value,
};
},
computed: {
disabled() {
return this.$parent.sliderDisabled;
},
max() {
return this.$parent.max;
},
min() {
return this.$parent.min;
},
step() {
return this.$parent.step;
},
showTooltip() {
return this.$parent.showTooltip;
},
precision() {
return this.$parent.precision;
},
currentPosition() {
return `${((this.value - this.min) / (this.max - this.min)) * 100}%`;
},
enableFormat() {
return this.$parent.formatTooltip instanceof Function;
},
formatValue() {
return (
(this.enableFormat && this.$parent.formatTooltip(this.value)) ||
this.value
);
},
wrapperStyle() {
return this.vertical
? { bottom: this.currentPosition }
: { left: this.currentPosition };
},
},
watch: {
dragging(val) {
this.$parent.dragging = val;
},
},
methods: {
displayTooltip() {
this.$refs.tooltip && (this.$refs.tooltip.showPopper = true);
},
hideTooltip() {
this.$refs.tooltip && (this.$refs.tooltip.showPopper = false);
},
handleMouseEnter() {
this.hovering = true;
this.displayTooltip();
},
handleMouseLeave() {
this.hovering = false;
this.hideTooltip();
},
onButtonDown(event) {
console.log(event);
if (this.disabled) return;
event.preventDefault();
this.onDragStart(event);
window.addEventListener("mousemove", this.onDragging);
window.addEventListener("touchmove", this.onDragging);
window.addEventListener("mouseup", this.onDragEnd);
window.addEventListener("touchend", this.onDragEnd);
window.addEventListener("contextmenu", this.onDragEnd);
},
onDragStart(event) {
this.dragging = true;
this.isClick = true;
if (event.type === "touchstart") {
event.clientY = event.touches[0].clientY;
event.clientX = event.touches[0].clientX;
}
if (this.vertical) {
this.startY = event.clientY;
} else {
this.startX = event.clientX;
}
this.startPosition = parseFloat(this.currentPosition);
this.newPosition = this.startPosition;
},
onDragging(event) {
if (this.dragging) {
this.isClick = false;
this.displayTooltip();
this.$parent.resetSize();
let diff = 0;
if (event.type === "touchmove") {
event.clientY = event.touches[0].clientY;
event.clientX = event.touches[0].clientX;
}
if (this.vertical) {
this.currentY = event.clientY;
diff =
((this.startY - this.currentY) / this.$parent.sliderSize) * 100;
} else {
this.currentX = event.clientX;
diff =
((this.currentX - this.startX) / this.$parent.sliderSize) * 100;
}
this.newPosition = this.startPosition + diff;
this.setPosition(this.newPosition);
}
},
onDragEnd() {
if (this.dragging) {
/*
* 防止在 mouseup 后立即触发 click,导致滑块有几率产生一小段位移
* 不使用 preventDefault 是因为 mouseup 和 click 没有注册在同一个 DOM 上
*/
setTimeout(() => {
this.dragging = false;
this.hideTooltip();
if (!this.isClick) {
this.setPosition(this.newPosition);
this.$parent.emitChange();
}
}, 0);
window.removeEventListener("mousemove", this.onDragging);
window.removeEventListener("touchmove", this.onDragging);
window.removeEventListener("mouseup", this.onDragEnd);
window.removeEventListener("touchend", this.onDragEnd);
window.removeEventListener("contextmenu", this.onDragEnd);
}
},
setPosition(newPosition) {
if (newPosition === null || isNaN(newPosition)) return;
if (newPosition < 0) {
newPosition = 0;
} else if (newPosition > 100) {
newPosition = 100;
}
const lengthPerStep = 100 / ((this.max - this.min) / this.step);
const steps = Math.round(newPosition / lengthPerStep);
let value =
steps * lengthPerStep * (this.max - this.min) * 0.01 + this.min;
value = parseFloat(value.toFixed(this.precision));
this.$emit("input", value);
this.$nextTick(() => {
this.displayTooltip();
this.$refs.tooltip && this.$refs.tooltip.updatePopper();
});
if (!this.dragging && this.value !== this.oldValue) {
this.oldValue = this.value;
}
},
},
};
</script>
<style scoped>
@import "./slider.css";
</style>
<template>
<div
class="el-slider"
role="slider"
:aria-valuemin="min"
:aria-valuemax="max"
>
<div
class="el-slider__runway"
:style="runwayStyle"
@click="onSliderClick"
ref="slider"
>
<div class="el-slider__bar" :style="barStyle"></div>
<slider-button
v-model="firstValue"
:tooltip-class="tooltipClass"
ref="button1"
>
</slider-button>
<div
class="el-slider__stop"
v-for="(item, key) in stops"
:key="key"
:style="getStopStyle(item)"
></div>
<template v-if="markList.length > 0">
<div>
<div
v-for="(item, key) in markList"
:style="getStopStyle(item.position)"
class="el-slider__stop el-slider__marks-stop"
:key="key"
></div>
</div>
<div class="el-slider__marks">
<slider-marker
:mark="item.mark"
v-for="(item, key) in markList"
:key="key"
:style="getStopStyle(item.position)"
>
</slider-marker>
</div>
</template>
</div>
</div>
</template>
<script>
import SliderButton from "./sliderButton.vue";
import SliderMarker from "./marker";
export default {
name: "ElSlider",
inject: {
elForm: {
default: "",
},
},
props: {
min: {
type: Number,
default: 0,
},
max: {
type: Number,
default: 100,
},
step: {
type: Number,
default: 1,
},
value: {
type: [Number, Array],
default: 0,
},
height: {
type: String,
},
debounce: {
type: Number,
default: 300,
},
label: {
type: String,
},
tooltipClass: String,
marks: Object,
},
components: {
SliderButton,
SliderMarker,
},
data() {
return {
firstValue: null,
secondValue: null,
oldValue: null,
dragging: false,
sliderSize: 1,
};
},
watch: {
value(val, oldVal) {
console.log(val);
if (
this.dragging ||
(Array.isArray(val) &&
Array.isArray(oldVal) &&
val.every((item, index) => item === oldVal[index]))
) {
return;
}
this.setValues();
},
dragging(val) {
if (!val) {
this.setValues();
}
},
firstValue(val) {
if (this.range) {
this.$emit("input", [this.minValue, this.maxValue]);
} else {
this.$emit("input", val);
}
},
secondValue() {
if (this.range) {
this.$emit("input", [this.minValue, this.maxValue]);
}
},
min() {
this.setValues();
},
max() {
this.setValues();
},
},
methods: {
valueChanged() {
if (this.range) {
return ![this.minValue, this.maxValue].every(
(item, index) => item === this.oldValue[index]
);
} else {
return this.value !== this.oldValue;
}
},
setValues() {
if (this.min > this.max) {
console.error(
"[Element Error][Slider]min should not be greater than max."
);
return;
}
const val = this.value;
if (this.range && Array.isArray(val)) {
if (val[1] < this.min) {
this.$emit("input", [this.min, this.min]);
} else if (val[0] > this.max) {
this.$emit("input", [this.max, this.max]);
} else if (val[0] < this.min) {
this.$emit("input", [this.min, val[1]]);
} else if (val[1] > this.max) {
this.$emit("input", [val[0], this.max]);
} else {
this.firstValue = val[0];
this.secondValue = val[1];
if (this.valueChanged()) {
this.dispatch("ElFormItem", "el.form.change", [
this.minValue,
this.maxValue,
]);
this.oldValue = val.slice();
}
}
} else if (!this.range && typeof val === "number" && !isNaN(val)) {
if (val < this.min) {
this.$emit("input", this.min);
} else if (val > this.max) {
this.$emit("input", this.max);
} else {
this.firstValue = val;
if (this.valueChanged()) {
this.dispatch("ElFormItem", "el.form.change", val);
this.oldValue = val;
}
}
}
},
setPosition(percent) {
const targetValue = this.min + (percent * (this.max - this.min)) / 100;
if (!this.range) {
this.$refs.button1.setPosition(percent);
return;
}
let button;
if (
Math.abs(this.minValue - targetValue) <
Math.abs(this.maxValue - targetValue)
) {
button = this.firstValue < this.secondValue ? "button1" : "button2";
} else {
button = this.firstValue > this.secondValue ? "button1" : "button2";
}
this.$refs[button].setPosition(percent);
},
onSliderClick(event) {
console.log(event);
if (this.dragging) return;
this.resetSize();
const sliderOffsetLeft = this.$refs.slider.getBoundingClientRect().left;
this.setPosition(
((event.clientX - sliderOffsetLeft) / this.sliderSize) * 100
);
this.emitChange();
},
resetSize() {
if (this.$refs.slider) {
this.sliderSize =
this.$refs.slider[`client${this.vertical ? "Height" : "Width"}`];
}
},
emitChange() {
this.$nextTick(() => {
this.$emit(
"change",
this.range ? [this.minValue, this.maxValue] : this.value
);
});
},
getStopStyle(position) {
return this.vertical
? { bottom: position + "%" }
: { left: position + "%" };
},
},
computed: {
stops() {
const stopCount = (this.max - this.min) / this.step;
const stepWidth = (100 * this.step) / (this.max - this.min);
const result = [];
for (let i = 1; i < stopCount; i++) {
result.push(i * stepWidth);
}
if (this.range) {
return result.filter((step) => {
return (
step < (100 * (this.minValue - this.min)) / (this.max - this.min) ||
step > (100 * (this.maxValue - this.min)) / (this.max - this.min)
);
});
} else {
return result.filter(
(step) =>
step > (100 * (this.firstValue - this.min)) / (this.max - this.min)
);
}
},
markList() {
if (!this.marks) {
return [];
}
const marksKeys = Object.keys(this.marks);
return marksKeys
.map(parseFloat)
.sort((a, b) => a - b)
.filter((point) => point <= this.max && point >= this.min)
.map((point) => ({
point,
position: ((point - this.min) * 100) / (this.max - this.min),
mark: this.marks[point],
}));
},
minValue() {
return Math.min(this.firstValue, this.secondValue);
},
maxValue() {
return Math.max(this.firstValue, this.secondValue);
},
barSize() {
return this.range
? `${(100 * (this.maxValue - this.minValue)) / (this.max - this.min)}%`
: `${(100 * (this.firstValue - this.min)) / (this.max - this.min)}%`;
},
barStart() {
return this.range
? `${(100 * (this.minValue - this.min)) / (this.max - this.min)}%`
: "0%";
},
precision() {
let precisions = [this.min, this.max, this.step].map((item) => {
let decimal = ("" + item).split(".")[1];
return decimal ? decimal.length : 0;
});
return Math.max.apply(null, precisions);
},
runwayStyle() {
return this.vertical ? { height: this.height } : {};
},
barStyle() {
return this.vertical
? {
height: this.barSize,
bottom: this.barStart,
}
: {
width: this.barSize,
left: this.barStart,
};
},
},
mounted() {
let valuetext;
if (this.range) {
if (Array.isArray(this.value)) {
this.firstValue = Math.max(this.min, this.value[0]);
this.secondValue = Math.min(this.max, this.value[1]);
} else {
this.firstValue = this.min;
this.secondValue = this.max;
}
this.oldValue = [this.firstValue, this.secondValue];
valuetext = `${this.firstValue}-${this.secondValue}`;
} else {
if (typeof this.value !== "number" || isNaN(this.value)) {
this.firstValue = this.min;
} else {
this.firstValue = Math.min(this.max, Math.max(this.min, this.value));
}
this.oldValue = this.firstValue;
valuetext = this.firstValue;
}
this.$el.setAttribute("aria-valuetext", valuetext);
// label screen reader
this.$el.setAttribute(
"aria-label",
this.label ? this.label : `slider between ${this.min} and ${this.max}`
);
this.resetSize();
window.addEventListener("resize", this.resetSize);
},
beforeUnmount() {
window.removeEventListener("resize", this.resetSize);
},
};
</script>
<style scoped>
@import "./slider.css";
</style>
<template>
<svg :class="svgClass" aria-hidden="true">
<use :xlink:href="iconName"></use>
</svg>
</template>
<script>
import { computed } from "@vue/reactivity";
export default {
name: "baseSvgIcon",
props: {
iconClass: { type: String },
className: { type: String },
},
setup(props) {
const iconName = computed(() => {
return props.iconClass ? `#icon-${props.iconClass}` : "#icon";
});
const svgClass = computed(() => {
return props.className ? "svg-icon " + props.className : "svg-icon";
});
return { iconName, svgClass };
},
};
</script>
<style scoped lang="scss">
.svg-icon {
width: 1em;
height: 1em;
vertical-align: -0.15em;
fill: currentColor;
overflow: hidden;
}
</style>
...@@ -7,75 +7,60 @@ ...@@ -7,75 +7,60 @@
:key="index" :key="index"
:name="item.name" :name="item.name"
> >
<slot :name="item.name"></slot> <div class="tab-content">
<slot :name="item.name"></slot>
</div>
</van-tab> </van-tab>
</van-tabs> </van-tabs>
<div v-show="active === 'share'">
<share ref="shareRefs" :isShowOverlay="true">
<div id="shareContainer" class="map-container"></div>
</share>
</div>
</div> </div>
</template> </template>
<script> <script>
import { defineComponent, nextTick, ref } from "vue"; import { ref } from "vue";
import routes from "@/router/routes"; import routes from "@/router/routes";
import { useRoute } from "vue-router"; import { useRoute } from "vue-router";
import AMapLoader from "@amap/amap-jsapi-loader"; export default {
import { CONSTANT } from "../constant";
export default defineComponent({
name: "TopTab", name: "TopTab",
setup() { setup(props, { emit }) {
const tabRoutes = ref([]); const tabRoutes = ref([]);
const active = ref(null); const active = ref(null);
const route = useRoute(); const route = useRoute();
let routeQuery = route.query; let routeQuery = route.query;
let map = null; let routesArr = JSON.parse(JSON.stringify(routes.tabRoutes));
let checkLoadedTimeoutId = ""; // 过滤tab
tabRoutes.value = routes.tabRoutes; const filterTabs = async (cb) => {
active.value = routeQuery.tabItem; let source = routeQuery.source;
const onTabClick = (e) => { // 有线设备 无设备调频
if (e.name === "share") { if (source == 1) {
nextTick(() => { routesArr.map((val, index) => {
console.log(active.value); if (val.name === "freq") {
AMapLoader.load({ routesArr.splice(index, 1);
key: CONSTANT.MAP_KEY, }
version: "1.4.8",
plugins: CONSTANT.MAP_PLUGINS,
}).then((AMap) => {
window.AMap = AMap;
if (map) return;
initMap("shareContainer");
});
}); });
} }
if (source == 0) {
routesArr.map((val, index) => {
if (val.name === "fence") {
routesArr.splice(index, 1);
}
});
}
await cb();
}; };
const initMap = (id) => { filterTabs(() => {
let check = () => { tabRoutes.value = routesArr;
checkLoadedTimeoutId && window.clearTimeout(checkLoadedTimeoutId); active.value = routeQuery.tabItem;
let AMap = window.AMap; });
if (AMap && typeof AMap.Map == "function") { const onTabClick = (e) => {
window.AMap = AMap; emit("changeTabItem", e);
init(id);
} else {
checkLoadedTimeoutId = check();
}
};
checkLoadedTimeoutId = check();
};
const init = (id) => {
console.log(id);
map = new window.AMap.Map(id);
console.log(map);
return map;
}; };
return { return {
tabRoutes, tabRoutes,
active, active,
onTabClick, onTabClick,
filterTabs,
}; };
}, },
}); };
</script> </script>
<style lang="scss"> <style lang="scss">
.van-tabs__wrap { .van-tabs__wrap {
......
export const MAP_KEY = "c3c66897b0c7c3170ba7f3b596e76e6b"; export const MAP_KEY = "75116f653f3b2e4568116dad8cd9b899";
// 地图插件 // 地图插件
export const MAP_PLUGINS = [ export const MAP_PLUGINS = [
......
...@@ -5,11 +5,15 @@ import "@/assets/spritesmith-generated/sprite.css"; ...@@ -5,11 +5,15 @@ import "@/assets/spritesmith-generated/sprite.css";
import router from "./router"; import router from "./router";
import { vant } from "@/utils/vant.config"; import { vant } from "@/utils/vant.config";
import "@/assets/css/style.css"; import "@/assets/css/style.css";
import "@/assets/icons";
import SvgIcon from "@/components/svgIcon";
const app = createApp(App); const app = createApp(App);
app.component("svg-icon", SvgIcon);
vant(app); vant(app);
app.use(store).use(router).mount("#app"); app.use(store).use(router).mount("#app");
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
console.log(to);
if (to.meta.title) { if (to.meta.title) {
document.title = to.meta.title; document.title = to.meta.title;
} }
......
...@@ -41,7 +41,7 @@ const tabRoutes = [ ...@@ -41,7 +41,7 @@ const tabRoutes = [
}, },
{ {
path: "/deviceFreq", path: "/deviceFreq",
name: "deviceFreq", name: "freq",
title: "设备调频", title: "设备调频",
component: () => import("../views/monitor.vue"), component: () => import("../views/monitor.vue"),
}, },
......
...@@ -2,9 +2,9 @@ import axios from "axios"; ...@@ -2,9 +2,9 @@ import axios from "axios";
import { Dialog } from "vant"; import { Dialog } from "vant";
import store from "@/store"; import store from "@/store";
// 测试 https://eshield.test.glsx.com.cn // 测试 https://eshield.test.glsx.com.cn
// 开发 // 开发 https://eshield.dev.glsx.com.cn
// 线上 // 线上
const BASE_URL = "https://eshield.test.glsx.com.cn"; const BASE_URL = "https://eshield.dev.glsx.com.cn";
const instance = axios.create({ const instance = axios.create({
// 创建axios实例,在这里可以设置请求的默认配置 // 创建axios实例,在这里可以设置请求的默认配置
timeout: 10 * 60 * 1000, // 设置超时时间60s timeout: 10 * 60 * 1000, // 设置超时时间60s
...@@ -18,7 +18,10 @@ instance.defaults.headers.post["Content-Type"] = "application/json"; ...@@ -18,7 +18,10 @@ instance.defaults.headers.post["Content-Type"] = "application/json";
/** 添加请求拦截器 **/ /** 添加请求拦截器 **/
instance.interceptors.request.use( instance.interceptors.request.use(
(config) => { (config) => {
store.commit("showLoading"); if (config.url.indexOf("/miniappserver/monitor/search") <= -1) {
// 下拉加载不显示loading
store.commit("showLoading");
}
config.headers["Authorization"] = localStorage.getItem("token") || ""; config.headers["Authorization"] = localStorage.getItem("token") || "";
return config; return config;
}, },
......
...@@ -11,6 +11,9 @@ import { ...@@ -11,6 +11,9 @@ import {
RadioGroup, RadioGroup,
Radio, Radio,
Slider, Slider,
DropdownMenu,
Field,
Switch,
} from "vant"; } from "vant";
export function vant(app) { export function vant(app) {
...@@ -26,4 +29,7 @@ export function vant(app) { ...@@ -26,4 +29,7 @@ export function vant(app) {
app.use(RadioGroup); app.use(RadioGroup);
app.use(Radio); app.use(Radio);
app.use(Slider); app.use(Slider);
app.use(DropdownMenu);
app.use(Field);
app.use(Switch);
} }
<template> <template>
<topTab ref="tabRefs"> <div>
<template #replay> <topTab ref="tabRefs" @changeTabItem="changeTabItem">
<replay /> <template #replay>
</template> <replay />
<template #monitor> </template>
<monitor /> <template #monitor>
</template> <MonitorPage ref="monitorRefs" />
<template #resident> </template>
<resident /> <template #resident>
</template> <resident />
<!-- <template #fence> </template>
<fence /> <template #share>
</template> --> <share>
</topTab> <van-overlay
:show="showOverlay"
@click="showOverlay = false"
:z-index="100000"
>
<span class="icon icon-share"></span>
<p class="tip">
点击右上角“&nbsp;<span class="fle"
><span class="sharebtn"></span
><span class="sharebtn middle"></span
><span class="sharebtn"></span></span
>&nbsp;”转发/分享
</p>
</van-overlay>
</share>
</template>
<template #fence>
<fence />
</template>
<template #freq>
<freq ref="freqRefs" />
</template>
</topTab>
</div>
</template> </template>
<script> <script>
import { defineComponent } from "vue"; import {
defineComponent,
onMounted,
ref,
getCurrentInstance,
nextTick,
onUnmounted,
} from "vue";
import topTab from "@/components/top-tab.vue"; import topTab from "@/components/top-tab.vue";
import replay from "./replay.vue"; import replay from "./replay.vue";
import monitor from "./monitor.vue"; import MonitorPage from "./monitor.vue";
import resident from "./resident.vue"; import resident from "./resident.vue";
// import fence from "./fence.vue"; import fence from "./fence.vue";
import share from "./share.vue";
import freq from "./freq.vue";
export default defineComponent({ export default defineComponent({
name: "InfoPage", name: "InfoPage",
components: { components: {
topTab, topTab,
replay, replay,
monitor, MonitorPage,
resident, resident,
// fence, fence,
share,
freq,
},
setup() {
const showOverlay = ref(true);
const tabRefs = ref(null);
const monitorRefs = ref(null);
const instance = getCurrentInstance();
onMounted(() => {
nextTick(() => {
monitorRefs.value = instance.refs.monitorRefs;
});
});
const changeTabItem = (e) => {
// 切换tab 清除定时器
if (e.name !== "monitor") {
instance.refs.monitorRefs &&
instance.refs.monitorRefs.timeoutId &&
clearTimeout(instance.refs.monitorRefs.timeoutId);
if (e.name === "freq") {
// 获取最新的设备调频数据
instance.refs.freqRefs && instance.refs.freqRefs.getInfoData();
}
if (e.name === "share") {
showOverlay.value = true;
}
} else {
instance.refs.monitorRefs && instance.refs.monitorRefs.getData();
}
};
onUnmounted(() => {
monitorRefs.value &&
monitorRefs.value.timeoutId &&
clearTimeout(monitorRefs.value.timeoutId);
});
return {
changeTabItem,
showOverlay,
tabRefs,
};
}, },
setup() {},
}); });
</script> </script>
<style lang="scss" scoped></style> <style lang="scss" scoped>
.icon-share {
position: absolute;
top: 20px;
right: 65px;
}
.tip {
margin-top: 105px;
text-align: center;
color: #fff;
font-size: 16px;
.fle {
display: inline-block;
width: 18px;
height: 22px;
vertical-align: middle;
}
.sharebtn {
display: inline-block;
width: 4px;
height: 4px;
margin: 1px;
background: #fff;
border-radius: 50%;
}
.sharebtn.middle {
width: 6px;
height: 6px;
margin: 0;
}
}
</style>
<template> <template>
<div> <div class="monitor-tabContent">
<mapContent @refreshCb="refreshCb" @getData="getData" ref="mapContentRefs"> <mapContent @refreshCb="refreshCb" @getData="getData" ref="mapContentRefs">
<template #mapBox> <template #mapBox>
<div id="monitorContainer" class="map-container"></div> <div id="monitorContainer" class="map-container"></div>
</template> </template>
</mapContent> </mapContent>
<transition name="van-fade"> </transition> <div
<div class="toggle-bottom" :class="isShowAllList ? '' : 'hidden'"> class="toggle-bottom-monitor"
:class="isShowAllList && locationList.length > 2 ? 'show' : 'hidden'"
>
<div class="toggle-btn" @click="showHideList"> <div class="toggle-btn" @click="showHideList">
<van-icon <span
:name=" v-if="!isShowAllList || locationList.length <= 2"
!isShowAllList && locationList.length > 2 class="ident-icon"
? 'arrow-up' ></span>
: 'arrow-down' <a v-else class="icon icon-put-away"></a>
"
/>
</div> </div>
<div class="list-content"> <div class="list-content-monitor">
<div <div
class="list-item" class="list-item"
v-for="(item, index) in locationList" v-for="(item, index) in locationList"
:key="index" :key="index"
> >
<p class="title">{{ item.transferAddress }}</p> <p class="title">
<span>{{ index + 1 }}</span
>&nbsp;&nbsp;{{ item.transferAddress }}
</p>
<p class="time">{{ item.time }}</p> <p class="time">{{ item.time }}</p>
</div> </div>
</div> </div>
...@@ -31,20 +34,21 @@ ...@@ -31,20 +34,21 @@
</template> </template>
<script> <script>
import { defineComponent, onMounted, ref } from "vue"; import { onMounted, ref, nextTick, watch } from "vue";
import mapContent from "@/components/mapContent.vue"; import mapContent from "@/components/mapContent.vue";
import AMapLoader from "@amap/amap-jsapi-loader"; import AMapLoader from "@amap/amap-jsapi-loader";
import { CONSTANT } from "../constant"; import { CONSTANT } from "../constant";
import { GET_RESIDENT_DATA } from "@/api/index"; import { GET_CAR_LOCATION_INFO } from "@/api/index";
import { useRoute } from "vue-router"; import { useRoute } from "vue-router";
import MAPGEO from "@/utils/mapgeo"; import MAPGEO from "@/utils/mapgeo";
import { Dialog } from "vant"; import { Dialog } from "vant";
import "vant/es/dialog/style"; import "vant/es/dialog/style";
export default defineComponent({ export default {
name: "MonitorPage", name: "MonitorPage",
components: { components: {
mapContent, mapContent,
}, },
setup() { setup() {
const route = useRoute(); const route = useRoute();
const mapContentRefs = ref(null); const mapContentRefs = ref(null);
...@@ -59,6 +63,8 @@ export default defineComponent({ ...@@ -59,6 +63,8 @@ export default defineComponent({
let beginMarker = null; let beginMarker = null;
let polyLine = null; let polyLine = null;
const timeoutId = ref(null); const timeoutId = ref(null);
const listScroll = ref(0);
const changey = ref(null);
const refreshCb = (map) => { const refreshCb = (map) => {
map.clearMap(); map.clearMap();
getData(); getData();
...@@ -81,14 +87,47 @@ export default defineComponent({ ...@@ -81,14 +87,47 @@ export default defineComponent({
mapContentRefs.value.initMap("monitorContainer"); mapContentRefs.value.initMap("monitorContainer");
}); });
}); });
watch(changey, (newVal) => {
let listNode = document.querySelector(".list-content-monitor");
let flag = false;
if (listScroll.value === 0) {
flag = true;
}
if (flag && newVal >= 100) {
isShowAllList.value = false;
}
if (newVal <= -100 && listNode.scrollTop === 0) {
// 上滑
isShowAllList.value = true;
}
});
let starty, endy;
nextTick(() => {
let touchNode = document.querySelector(".toggle-bottom-monitor");
let listNode = document.querySelector(".list-content-monitor");
const scroll = () => {
let scroolTop = listNode.scrollTop;
listScroll.value = scroolTop;
};
touchNode.addEventListener("touchstart", function (e) {
listNode.addEventListener("scroll", scroll(e), false);
listNode.removeEventListener("scroll", scroll(e), false);
starty = e.touches[0].pageY;
});
//结束点击时获得触点
touchNode.addEventListener("touchend", function (e) {
endy = e.changedTouches[0].pageY;
//判断触点差值
changey.value = endy - starty;
});
});
// 获取数据 // 获取数据
const getData = (map) => { const getData = (map) => {
currentMap = map ? map : currentMap; currentMap = map ? map : currentMap;
init(currentMap); GET_CAR_LOCATION_INFO({ sns: routeQuery.sn }).then((res) => {
GET_RESIDENT_DATA({ sns: routeQuery.sn }).then((res) => {
if (res.code === 200) { if (res.code === 200) {
if (res.data.length > 0) { if (res.data.length > 0) {
init(currentMap); init(currentMap, res.data);
} else { } else {
Dialog({ message: "暂无数据" }); Dialog({ message: "暂无数据" });
} }
...@@ -96,24 +135,15 @@ export default defineComponent({ ...@@ -96,24 +135,15 @@ export default defineComponent({
}); });
}; };
// marker渲染 // marker渲染
const init = (currentMap) => { const init = (currentMap, data) => {
let data = [ data.forEach((val) => {
{ (val.elat =
totalDuration: 2032460, val[routeQuery.locationType] && val[routeQuery.locationType].elat),
totalTimes: 1, (val.elng =
time: "2022-07-01 15:30:26", val[routeQuery.locationType] && val[routeQuery.locationType].elng);
longitude: "114.0736", val.time =
latitude: "30.606778", val[routeQuery.locationType] && val[routeQuery.locationType].dateTime;
blat: "30.610309854203035", });
blng: "114.08589711310412",
elat: "30.604489843507423",
elng: "114.07934400356585",
name: "鄂ADB1383",
standNo: "LA9XL44B0HBLG6389",
sn: "1500628541",
address: "湖北省武汉市东西湖区慈惠路毛家台(公交站)",
},
];
MAPGEO.transferAddressByGroup( MAPGEO.transferAddressByGroup(
{ {
data: data, data: data,
...@@ -129,13 +159,17 @@ export default defineComponent({ ...@@ -129,13 +159,17 @@ export default defineComponent({
firstPosLat = val.elat; firstPosLat = val.elat;
carMarker = new window.AMap.Marker({ carMarker = new window.AMap.Marker({
position: lnglat, position: lnglat,
content: '<span class="icon icon-car"></span>', content:
'<img src=" ' +
require("@/assets/images/car.png") +
'" style="transform: scale(0.5);" />',
map: currentMap, map: currentMap,
offset: new window.AMap.Pixel(-8.5, -13), offset: new window.AMap.Pixel(-8.5, -13),
}); });
beginMarker = new window.AMap.Marker({ beginMarker = new window.AMap.Marker({
position: lnglat, position: lnglat,
content: '<span class="icon icon-begin"></span>', content:
'<span class="icon icon-begin" style="transform: scale(0.5);"></span>',
map: currentMap, map: currentMap,
offset: new window.AMap.Pixel(-8.5, -13), offset: new window.AMap.Pixel(-8.5, -13),
visible: false, visible: false,
...@@ -159,9 +193,8 @@ export default defineComponent({ ...@@ -159,9 +193,8 @@ export default defineComponent({
}); });
currentMap.setFitView(); currentMap.setFitView();
timeoutId.value = setTimeout(function () { timeoutId.value = setTimeout(function () {
init(currentMap); getData();
}, 10 * 1000); }, 10 * 1000);
if (locationList.value.length > 6) locationList.value.shift();
} }
); );
}; };
...@@ -177,48 +210,57 @@ export default defineComponent({ ...@@ -177,48 +210,57 @@ export default defineComponent({
showHideList, showHideList,
isShowAllList, isShowAllList,
locationList, locationList,
listScroll,
changey,
timeoutId,
}; };
}, },
}); };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.toggle-bottom { .toggle-bottom-monitor {
position: fixed; position: fixed;
width: 100%; width: 100%;
left: 0px; left: 0px;
bottom: 0px; bottom: 0px;
z-index: 300; z-index: 300;
display: flex; display: flex;
border-radius: 20px; border-radius: 20px 20px 0 0;
max-height: 455px;
align-items: center; align-items: center;
flex-flow: column; flex-flow: column;
background-color: #fff; background-color: #fff;
padding-top: 10px; .toggle-btn {
.list-content { position: absolute;
padding-left: 10px; top: -20px;
overflow-y: scroll; .ident-icon {
display: inline-block;
width: 56px;
height: 4px;
border-radius: 2px;
background: #a2a2a4;
}
}
.list-content-monitor {
width: calc(100% - 30px);
padding: 5px 15px 0 15px;
font-size: 14px;
.list-item { .list-item {
padding: 5px 10px 5px 0; height: 39px;
border-bottom: 1px solid #ececec; border-bottom: 1px solid #f0f2f5;
padding: 14px 0;
display: flex;
flex-flow: column;
.title { .title {
color: #000; color: #000;
font-size: 16px; overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
} }
.time { .time {
color: #666; color: #666;
.navigate { font-size: 12px;
padding-left: 16px; margin-top: 5px;
background-size: 12px 12px;
float: right;
margin-left: 10px;
}
.copy-adr {
padding-left: 16px;
background-size: 12px 12px;
float: right;
}
} }
} }
:last-child { :last-child {
...@@ -226,7 +268,15 @@ export default defineComponent({ ...@@ -226,7 +268,15 @@ export default defineComponent({
} }
} }
} }
.toggle-bottom.hidden { .toggle-bottom-monitor.hidden {
max-height: 160px; max-height: 135px;
transition: max-height 0.3s;
}
.toggle-bottom-monitor.show {
max-height: 80%;
transition: max-height 0.3s;
.list-content-monitor {
overflow-y: scroll;
}
} }
</style> </style>
<template>
<div>
<mapContent ref="mapContentRefs">
<template #mapBox>
<div id="shareContainer" class="map-container"></div>
</template>
</mapContent>
<slot></slot>
</div>
</template>
<script>
import { ref, defineComponent, onMounted } from "vue";
import mapContent from "@/components/mapContent.vue";
import AMapLoader from "@amap/amap-jsapi-loader";
import { CONSTANT } from "../constant";
export default defineComponent({
name: "SharePage",
components: {
mapContent,
},
setup() {
const mapContentRefs = ref(null);
onMounted(() => {
AMapLoader.load({
key: CONSTANT.MAP_KEY,
version: "1.4.8",
plugins: CONSTANT.MAP_PLUGINS,
}).then((AMap) => {
window.AMap = AMap;
mapContentRefs.value.initMap("shareContainer");
});
});
return {
mapContentRefs,
};
},
});
</script>
<style lang="scss" scoped></style>
...@@ -2,20 +2,18 @@ const { defineConfig } = require("@vue/cli-service"); ...@@ -2,20 +2,18 @@ const { defineConfig } = require("@vue/cli-service");
const Spritesmith = require("webpack-spritesmith"); const Spritesmith = require("webpack-spritesmith");
const path = require("path"); const path = require("path");
const templateFunction = require("./sprite"); const templateFunction = require("./sprite");
const { VantResolver } = require("unplugin-vue-components/resolvers"); const {
VantResolver,
ElementPlusResolver,
} = require("unplugin-vue-components/resolvers");
const ComponentsPlugin = require("unplugin-vue-components/webpack"); const ComponentsPlugin = require("unplugin-vue-components/webpack");
function resolve(dir) {
return path.join(__dirname, ".", dir);
}
module.exports = defineConfig({ module.exports = defineConfig({
transpileDependencies: true, transpileDependencies: true,
devServer: { devServer: {
port: 9527, port: 9527,
proxy: {
"/api": {
target: "https://eshield.test.glsx.com.cn/",
ws: true,
changeOrigin: true,
pathRewrite: { "^/api": "" },
},
},
}, },
chainWebpack: (config) => { chainWebpack: (config) => {
config.plugin("webpack-spritesmith").use(Spritesmith, [ config.plugin("webpack-spritesmith").use(Spritesmith, [
...@@ -49,11 +47,22 @@ module.exports = defineConfig({ ...@@ -49,11 +47,22 @@ module.exports = defineConfig({
}, },
}, },
]); ]);
config.module.rules.delete("svg"); // 重点:删除默认配置中处理svg,
config.module
.rule("svg-sprite-loader")
.test(/\.svg$/)
.include.add(resolve("src/assets/icons")) // 处理svg目录
.end()
.use("svg-sprite-loader")
.loader("svg-sprite-loader")
.options({
symbolId: "icon-[name]",
});
}, },
configureWebpack: { configureWebpack: {
plugins: [ plugins: [
ComponentsPlugin({ ComponentsPlugin({
resolvers: [VantResolver()], resolvers: [VantResolver(), ElementPlusResolver()],
}), }),
], ],
externals: { externals: {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!