Commit 698028d4 by 张晓玮

Merge branch 'v1.9.0' into 'master'

V1.9.0

See merge request !4
2 parents 45195ca4 7ef939f2
......@@ -15,12 +15,12 @@
"babel-plugin-import": "^1.13.5",
"clipboard": "^2.0.11",
"core-js": "^3.8.3",
"element-plus": "^2.2.9",
"moment": "^2.29.1",
"svg-sprite-loader": "^6.0.11",
"vant": "^3.5.2",
"vue": "^3.2.13",
"vue-router": "^4.0.3",
"vue-slider-component": "^4.1.0-beta.1",
"vuex": "^4.0.0"
},
"devDependencies": {
......
......@@ -4,11 +4,13 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no,maximum-scale=1.0"
id="viewportMeta">
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>
<%= htmlWebpackPlugin.options.title %>
</title>
<title>找车</title>
</head>
<body>
......
......@@ -3,8 +3,8 @@ module.exports = function (data) {
const shared =
`.icon {display: inline-block;background-image: url(I);background-size: Wpx Hpx;}`
.replace("I", data.sprites[0].image)
.replace("W", data.sprites[0].total_width)
.replace("H", data.sprites[0].total_height);
.replace("W", data.sprites[0].total_width / 2)
.replace("H", data.sprites[0].total_height / 2);
const perSprite = data.sprites
.map(function (sprite) {
......@@ -16,10 +16,10 @@ module.exports = function (data) {
return style
.replace(/N/g, sprite.name)
.replace(/A/g, sprite.name.replace(/\-active$/g, ""))
.replace(/W/g, sprite.width)
.replace(/H/g, sprite.height)
.replace(/X/g, sprite.offset_x)
.replace(/Y/g, sprite.offset_y);
.replace(/W/g, sprite.width / 2)
.replace(/H/g, sprite.height / 2)
.replace(/X/g, sprite.offset_x / 2)
.replace(/Y/g, sprite.offset_y / 2);
})
.join("\n");
......
......@@ -34,15 +34,23 @@ export default {
html,
body {
height: 100%;
// min-height: 100%;
// min-height: 100%;
overflow: hidden;
}
.warp-content {
height: 100%;
}
* {
-webkit-tap-highlight-color: rgba(255, 255, 255, 0) !important;
-webkit-tap-highlight-color: transparent !important;
}
#app {
height: 100%;
// min-height: 100%;
position: fixed;
position: -ms-device-fixed;
top: 0px;
left: 0px;
right: 0px;
bottom: 0px;
}
.curr-marker {
display: inline-block;
......@@ -57,7 +65,13 @@ body {
.map-container {
width: 100%;
height: 100%;
position: fixed;
// position: fixed;
z-index: 100;
}
button {
border-radius: 0;
border: none;
outline: none;
background: rgba(0, 0, 0, 0);
}
</style>
......@@ -39,3 +39,8 @@ export const SET_FREQ = (params) => {
export const ADD_FENCE = (params) => {
return request(params, `${prefix}/fence/add`, "POST");
};
// 校验分享时效性 是否可用
export const CHECK_SHARE = (params) => {
return request(params, `${prefix}/vehicle/sharedDetails`);
};
.icon-share {
position: absolute;
top: 20px;
right: 70px;
}
.tip {
margin-top: 120px;
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;
}
}
\ No newline at end of file
.el-slider {
width: 100%;
height: 32px;
display: flex;
align-items: center;
}
.el-slider__runway {
flex: 1;
height: 2px;
background-color: #e4e7eb;
border-radius: 2px;
position: relative;
cursor: pointer;
}
.el-slider__input {
flex-shrink: 0;
width: 130px;
}
.el-slider__bar {
height: 2px;
background-color: var(--base-color);
border-top-left-radius: 1px;
border-bottom-left-radius: 1px;
position: absolute;
}
.el-slider__button-wrapper {
height: 16px;
width: 16px;
position: absolute;
z-index: 1;
top: -9px;
transform: translateX(-50%);
background-color: transparent;
text-align: center;
-webkit-user-select: none;
user-select: none;
line-height: normal;
outline: 0;
}
.el-slider__button-wrapper::after {
display: inline-block;
content: "";
height: 100%;
vertical-align: middle;
}
.el-slider__button-wrapper.hover,
.el-slider__button-wrapper:hover {
cursor: grab;
}
.el-slider__button-wrapper.dragging {
cursor: grabbing;
}
.el-slider__button {
display: inline-block;
width: 16px;
height: 16px;
vertical-align: middle;
border: none;
box-shadow: 0px 2px 8px 0px rgba(135,143,153,0.5000);
background-color: #fff;
border-radius: 50%;
box-sizing: border-box;
transition: .2s;
-webkit-user-select: none;
user-select: none;
}
.el-slider__button.dragging,
.el-slider__button.hover,
.el-slider__button:hover {
transform: scale(1.2);
}
.el-slider__button.hover,
.el-slider__button:hover {
cursor: grab;
}
.el-slider__button.dragging {
cursor: grabbing;
}
.el-slider__stop {
position: absolute;
top: -4px;
height: 6px;
width: 6px;
border-radius: 6px;
background-color: #fff;
border: 2px solid #e4e7eb;
}
.el-slider__marks {
top: 0;
left: 12px;
width: 18px;
height: 100%;
}
.el-slider__marks-text {
position: absolute;
transform: translateX(-50%);
font-size: 14px;
color: #111;
margin-top: 15px;
}
.el-slider--large {
height: 40px;
}
.el-slider--small {
height: 24px;
}
\ No newline at end of file
......@@ -6,6 +6,7 @@
--van-text-link-color: #0077FF !important;
--van-blue: #0077FF !important;
--van-search-input-height: 32px !important;
--van-search-content-background-color: #f5f6f7 !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;
......

768 Bytes | W: | H:

1.55 KB | W: | H:

src/assets/icon/copy.png
src/assets/icon/copy.png
src/assets/icon/copy.png
src/assets/icon/copy.png
  • 2-up
  • Swipe
  • Onion skin

218 Bytes | W: | H:

423 Bytes | W: | H:

src/assets/icon/device.png
src/assets/icon/device.png
src/assets/icon/device.png
src/assets/icon/device.png
  • 2-up
  • Swipe
  • Onion skin

720 Bytes | W: | H:

1.48 KB | W: | H:

src/assets/icon/loc-icon.png
src/assets/icon/loc-icon.png
src/assets/icon/loc-icon.png
src/assets/icon/loc-icon.png
  • 2-up
  • Swipe
  • Onion skin

491 Bytes | W: | H:

1.13 KB | W: | H:

src/assets/icon/locate-sm.png
src/assets/icon/locate-sm.png
src/assets/icon/locate-sm.png
src/assets/icon/locate-sm.png
  • 2-up
  • Swipe
  • Onion skin

656 Bytes | W: | H:

1.31 KB | W: | H:

src/assets/icon/location.png
src/assets/icon/location.png
src/assets/icon/location.png
src/assets/icon/location.png
  • 2-up
  • Swipe
  • Onion skin

853 Bytes | W: | H:

1.74 KB | W: | H:

src/assets/icon/navgation.png
src/assets/icon/navgation.png
src/assets/icon/navgation.png
src/assets/icon/navgation.png
  • 2-up
  • Swipe
  • Onion skin

1.71 KB | W: | H:

3.65 KB | W: | H:

src/assets/icon/off-car.png
src/assets/icon/off-car.png
src/assets/icon/off-car.png
src/assets/icon/off-car.png
  • 2-up
  • Swipe
  • Onion skin

453 Bytes | W: | H:

1.05 KB | W: | H:

src/assets/icon/offline-time.png
src/assets/icon/offline-time.png
src/assets/icon/offline-time.png
src/assets/icon/offline-time.png
  • 2-up
  • Swipe
  • Onion skin

1.61 KB | W: | H:

3.52 KB | W: | H:

src/assets/icon/on-car.png
src/assets/icon/on-car.png
src/assets/icon/on-car.png
src/assets/icon/on-car.png
  • 2-up
  • Swipe
  • Onion skin

389 Bytes | W: | H:

834 Bytes | W: | H:

src/assets/icon/online-time.png
src/assets/icon/online-time.png
src/assets/icon/online-time.png
src/assets/icon/online-time.png
  • 2-up
  • Swipe
  • Onion skin

378 Bytes | W: | H:

743 Bytes | W: | H:

src/assets/icon/put-away.png
src/assets/icon/put-away.png
src/assets/icon/put-away.png
src/assets/icon/put-away.png
  • 2-up
  • Swipe
  • Onion skin

679 Bytes | W: | H:

1.34 KB | W: | H:

src/assets/icon/refresh-car.png
src/assets/icon/refresh-car.png
src/assets/icon/refresh-car.png
src/assets/icon/refresh-car.png
  • 2-up
  • Swipe
  • Onion skin

1.16 KB | W: | H:

1.09 KB | W: | H:

src/assets/icon/replay-pause.png
src/assets/icon/replay-pause.png
src/assets/icon/replay-pause.png
src/assets/icon/replay-pause.png
  • 2-up
  • Swipe
  • Onion skin

1.01 KB | W: | H:

1.11 KB | W: | H:

src/assets/icon/replay-play.png
src/assets/icon/replay-play.png
src/assets/icon/replay-play.png
src/assets/icon/replay-play.png
  • 2-up
  • Swipe
  • Onion skin

1.38 KB | W: | H:

1.95 KB | W: | H:

src/assets/icon/replay-refresh.png
src/assets/icon/replay-refresh.png
src/assets/icon/replay-refresh.png
src/assets/icon/replay-refresh.png
  • 2-up
  • Swipe
  • Onion skin

522 Bytes | W: | H:

1.21 KB | W: | H:

src/assets/icon/setting-btn.png
src/assets/icon/setting-btn.png
src/assets/icon/setting-btn.png
src/assets/icon/setting-btn.png
  • 2-up
  • Swipe
  • Onion skin

2.35 KB | W: | H:

5.14 KB | W: | H:

src/assets/icon/share.png
src/assets/icon/share.png
src/assets/icon/share.png
src/assets/icon/share.png
  • 2-up
  • Swipe
  • Onion skin

434 Bytes | W: | H:

916 Bytes | W: | H:

src/assets/icon/typeList.png
src/assets/icon/typeList.png
src/assets/icon/typeList.png
src/assets/icon/typeList.png
  • 2-up
  • Swipe
  • Onion skin
.icon {display: inline-block;background-image: url(sprite.png);background-size: 232px 186px;}
.icon-begin { width: 52px; height: 72px; background-position: -68px 0px; }
.icon-checked { width: 20px; height: 20px; background-position: -150px -156px; }
.icon-copy { width: 28px; height: 28px; background-position: -172px -112px; }
.icon-device { width: 14px; height: 14px; background-position: -64px -140px; }
.icon-loc-icon { width: 30px; height: 30px; background-position: 0px -156px; }
.icon-locate-sm { width: 14px; height: 14px; background-position: -78px -140px; }
.icon-location { width: 24px; height: 24px; background-position: -30px -156px; }
.icon-navgation { width: 28px; height: 28px; background-position: -200px -112px; }
.icon-off-car { width: 52px; height: 52px; background-position: -172px -60px; }
.icon-off-line { width: 20px; height: 20px; background-position: -170px -156px; }
.icon-offline-time { width: 14px; height: 14px; background-position: -92px -140px; }
.icon-on-car { width: 52px; height: 52px; background-position: -120px -80px; }
.icon-on-line { width: 24px; height: 24px; background-position: -54px -156px; }
.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-typeList { width: 14px; height: 14px; background-position: -120px -140px; }
\ No newline at end of file
.icon {display: inline-block;background-image: url(sprite.png);background-size: 192px 188px;}
.icon-battery-empty { width: 24px; height: 16px; background-position: -144px -124px; }
.icon-battery-enough { width: 24px; height: 16px; background-position: -168px -124px; }
.icon-begin { width: 26px; height: 36px; background-position: -140px -52px; }
.icon-copy { width: 28px; height: 28px; background-position: -144px -96px; }
.icon-device { width: 14px; height: 14px; background-position: -118px -68px; }
.icon-loc-icon { width: 30px; height: 30px; background-position: -88px -52px; }
.icon-locate-sm { width: 14px; height: 14px; background-position: -88px -82px; }
.icon-location { width: 24px; height: 24px; background-position: -28px -160px; }
.icon-navgation { width: 28px; height: 28px; background-position: 0px -160px; }
.icon-off-car { width: 52px; height: 52px; background-position: -88px 0px; }
.icon-offline-time { width: 14px; height: 14px; background-position: -102px -82px; }
.icon-on-car { width: 52px; height: 52px; background-position: -140px 0px; }
.icon-online-time { width: 14px; height: 14px; background-position: -116px -82px; }
.icon-put-away { width: 64px; height: 16px; background-position: 0px -144px; }
.icon-refresh-car { width: 24px; height: 24px; background-position: -52px -160px; }
.icon-replay-pause { width: 48px; height: 48px; background-position: 0px -96px; }
.icon-replay-play { width: 48px; height: 48px; background-position: -48px -96px; }
.icon-replay-refresh { width: 48px; height: 48px; background-position: -96px -96px; }
.icon-resident { width: 26px; height: 36px; background-position: -166px -52px; }
.icon-search { width: 16px; height: 16px; background-position: -118px -52px; }
.icon-setting-btn { width: 24px; height: 24px; background-position: -76px -160px; }
.icon-share { width: 88px; height: 96px; background-position: 0px 0px; }
.icon-typeList { width: 14px; height: 14px; background-position: -64px -144px; }
.icon-warning { width: 16px; height: 16px; background-position: -172px -96px; }
\ No newline at end of file

21.4 KB | W: | H:

37 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
......@@ -5,13 +5,8 @@
</template>
<script>
import { Loading } from "vant";
export default {
name: "LOADING",
components: {
["van-loading"]: Loading,
},
};
</script>
<style lang="scss" scoped>
......
......@@ -2,18 +2,29 @@
<div class="map-box">
<slot name="mapBox"></slot>
<div v-show="isUploaded">
<a class="map-cmd-icon location" @click="getLocation">
<span class="icon icon-location"></span>
</a>
<a class="map-cmd-icon refresh-car" @click="refresh">
<button
class="map-cmd-icon location"
@click="getLocation"
v-preventReClick
>
<span v-if="!isGetLocation" class="icon icon-location"></span>
<van-loading v-else color="#1989fa" />
</button>
<button
class="map-cmd-icon refresh-car"
@click="refresh"
v-preventReClick
>
<span class="icon icon-refresh-car"></span>
</a>
</button>
</div>
</div>
</template>
<script>
import { onMounted, ref } from "vue";
import { Toast } from "vant";
import "vant/es/toast/style";
export default {
name: "mapContent",
props: {},
......@@ -23,6 +34,7 @@ export default {
let checkLoadedTimeoutId = "";
const satelActive = ref(null);
const roadActive = ref(null);
const isGetLocation = ref(false);
onMounted(() => {});
const initMap = (id) => {
let check = () => {
......@@ -47,6 +59,7 @@ export default {
let currMarker = null;
// 获取定位
const getLocation = () => {
isGetLocation.value = true;
map.plugin("AMap.Geolocation", function () {
var geolocation = new window.AMap.Geolocation({
enableHighAccuracy: true,
......@@ -61,6 +74,7 @@ export default {
if (currMarker) {
currMarker.setMap(null);
}
isGetLocation.value = false;
currMarker = new window.AMap.Marker({
position: data.position,
content: '<span class="curr-marker"></span>',
......@@ -69,7 +83,10 @@ export default {
});
map.setFitView();
});
window.AMap.event.addListener(geolocation, "error", () => {});
window.AMap.event.addListener(geolocation, "error", () => {
Toast("获取定位失败");
isGetLocation.value = false;
});
});
};
// 刷新
......@@ -85,6 +102,7 @@ export default {
roadActive,
refresh,
isUploaded,
isGetLocation,
};
},
};
......@@ -104,13 +122,14 @@ export default {
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0px 5px 12px 0px rgba(0, 0, 0, 0.12);
}
.location {
bottom: 180px;
bottom: 160px;
right: 20px;
}
.refresh-car {
bottom: 240px;
bottom: 220px;
right: 20px;
}
......
<template>
<van-popup
v-model:show="props.showPopup"
:model-show="props.showPopup"
round
@close="close"
:close-on-click-overlay="true"
......@@ -8,13 +8,15 @@
>
<div class="content-box">
<div class="btn-class">
<span class="cancel-btn" @click="cancel">取消</span>
<span
<button class="cancel-btn" @click="cancel">取消</button>
<button
class="save-btn"
:class="isDisabled ? 'disabled' : ''"
@click="save"
>{{ isDisabled ? "关闭" : "确定" }}</span
v-preventReClick
>
{{ isDisabled ? "关闭" : "确定" }}
</button>
</div>
<slot></slot>
</div>
......@@ -72,10 +74,12 @@ export default defineComponent({
padding-bottom: 40px;
.btn-class {
padding: 15px;
box-sizing: border-box;
border-bottom: 1px solid #f0f2f5;
width: calc(100% - 40px);
width: 100%;
display: flex;
justify-content: space-between;
font-size: 14px;
.cancel-btn {
color: #6c737a;
}
......
<template>
<div>
<div class="top-tab-class">
<van-tabs v-model:active="active" @click-tab="onTabClick">
<van-tab
v-for="(item, index) in tabRoutes"
......@@ -29,20 +29,23 @@ export default {
// 过滤tab
const filterTabs = async (cb) => {
let source = routeQuery.source;
// 有线设备 无设备调频
if (source == 1) {
routesArr.map((val, index) => {
if (val.name === "freq") {
routesArr.splice(index, 1);
}
});
}
if (source == 0) {
routesArr.map((val, index) => {
if (val.name === "fence") {
routesArr.splice(index, 1);
}
});
for (var i = routes.tabRoutes.length - 1; i >= 0; i--) {
if (routes.tabRoutes[i].name === "freq" && source == 1) {
routesArr.splice(i, 1);
}
if (
(routes.tabRoutes[i].name === "fence" && source == 0) ||
(routes.tabRoutes[i].name === "fence" &&
JSON.parse(localStorage.getItem("sharePage")))
) {
routesArr.splice(i, 1);
}
if (
routes.tabRoutes[i].name === "share" &&
JSON.parse(localStorage.getItem("sharePage"))
) {
routesArr.splice(i, 1);
}
}
await cb();
};
......@@ -62,8 +65,25 @@ export default {
},
};
</script>
<style lang="scss" scoped>
.top-tab-class {
height: 100%;
}
.tab-content {
height: 100%;
}
</style>
<style lang="scss">
.van-tabs {
height: 100%;
}
.van-tabs__wrap {
border-bottom: 1px solid #f0f2f5;
}
.van-tabs__content {
height: calc(100% - 45px);
}
.van-tab__panel {
height: 100%;
}
</style>
......@@ -10,6 +10,19 @@ import "@/assets/icons";
import SvgIcon from "@/components/svgIcon";
const app = createApp(App);
// 防止重复快速点击自定义全局指令
app.directive("preventReClick", {
mounted(el, binding) {
el.addEventListener("click", () => {
if (!el.disabled) {
el.disabled = true;
setTimeout(() => {
el.disabled = false;
}, binding.value || 1000);
}
});
},
});
app.component("svg-icon", SvgIcon);
vant(app);
app.use(store).use(router).mount("#app");
......
import { createRouter, createWebHistory } from "vue-router";
import { createRouter, createWebHashHistory } from "vue-router";
import routes from "./routes";
const router = createRouter({
history: createWebHistory("/miniapp/"),
history: createWebHashHistory(),
routes: routes.baseRoutes,
});
......
import axios from "axios";
import { Dialog } from "vant";
import store from "@/store";
import wx from "wx";
// 测试 https://eshield.test.glsx.com.cn
// 开发 https://eshield.dev.glsx.com.cn
// 线上
const BASE_URL = "https://eshield.dev.glsx.com.cn";
/* eslint-disable */
const BASE_URL = process.env.NODE_ENV == "development" ? "/api" : location.origin;
const instance = axios.create({
// 创建axios实例,在这里可以设置请求的默认配置
timeout: 10 * 60 * 1000, // 设置超时时间60s
......@@ -40,18 +42,24 @@ instance.interceptors.request.use(
instance.interceptors.response.use(
(response) => {
store.commit("hideLoading");
const serverCode = response.data.code,
token = response.headers["authorization"];
if (token || token === "") {
localStorage.setItem("token", token);
}
const serverCode = response.data.code;
if (serverCode === 200) {
if (response.status) {
return Promise.resolve(response);
}
return Promise.resolve(response.data);
} else {
Dialog({ message: response.data.message });
Dialog.confirm({
message: response.data.message,
showCancelButton: false
}).then(() => {
if (serverCode == 603 || serverCode == 604) { // 登录失效
localStorage.removeItem("token");
wx.miniProgram.reLaunch({
url: `../../pages/login/index?isLoginOut=true`,
});
}
});
return Promise.reject(response.data.message);
}
},
......
let map = null;
function MapService() {
map = null;
}
MapService.prototype = {
init: (id) => {
map = new window.AMap.Map(id);
return map;
},
// 卫星地图切换
satelEvent: (satelActive) => {
let layers = map.getLayers();
let satelLayer = [new window.AMap.TileLayer.Satellite()];
let flag = true;
layers.filter((val) => {
if (val.CLASS_NAME === "AMap.TileLayer.Satellite") {
satelActive.value = false;
flag = false;
map.remove(satelLayer);
}
});
if (flag) {
satelActive.value = true;
map.add(satelLayer);
}
},
// 获取定位
getLocationEvent: (currMarker) => {
map.plugin("AMap.Geolocation", function () {
var geolocation = new window.AMap.Geolocation({
enableHighAccuracy: true,
timeout: 10000,
buttonOffset: new window.AMap.Pixel(10, 20),
zoomToAccuracy: true,
buttonPosition: "RB",
});
geolocation.getCurrentPosition();
window.AMap.event.addListener(geolocation, "complete", (data) => {
if (currMarker) {
currMarker.setMap(null);
}
currMarker = new window.AMap.Marker({
position: data.position,
content: '<span class="curr-marker"></span>',
map: map,
offset: new window.AMap.Pixel(-12, -12),
});
map.setFitView();
});
window.AMap.event.addListener(geolocation, "error", () => {});
});
},
// 切换路况
roadStatusEvent: (roadActive) => {
let layers = map.getLayers();
let roadLayer = [new window.AMap.TileLayer.Traffic()];
let flag = true;
layers.filter((val) => {
if (val.CLASS_NAME === "AMap.TileLayer.Traffic") {
roadActive.value = false;
flag = false;
map.remove(roadLayer);
}
});
if (flag) {
roadActive.value = true;
map.add(roadLayer);
}
},
// 地图放大
mapPlusEvent: () => {
map.zoomIn();
},
// 地图缩小
mapMinusEvent: () => {
map.zoomOut();
},
// 刷新
refresheEvent: (context) => {
context.emit("refreshCb", map);
},
};
const mapService = new MapService();
export default mapService;
......@@ -3,17 +3,16 @@ import {
List,
Search,
Overlay,
Picker,
Tab,
Tabs,
Icon,
Button,
DatetimePicker,
Progress,
RadioGroup,
Radio,
Slider,
DropdownMenu,
Field,
Switch,
Cell,
Loading,
NoticeBar,
} from "vant";
export function vant(app) {
......@@ -21,15 +20,14 @@ export function vant(app) {
app.use(List);
app.use(Search);
app.use(Overlay);
app.use(Picker);
app.use(Icon);
app.use(Button);
app.use(DatetimePicker);
app.use(Progress);
app.use(RadioGroup);
app.use(Radio);
app.use(Slider);
app.use(DropdownMenu);
app.use(Field);
app.use(Switch);
app.use(Tab);
app.use(Tabs);
app.use(Cell);
app.use(Loading);
app.use(NoticeBar);
}
<template>
<div>
<div class="settingControll" @click="showSettingDialog = true">
<div class="info-content">
<button
class="settingControll"
@click="showSettingDialog = true"
v-preventReClick
>
<a class="icon icon-setting-btn"></a>
<span class="setting-text">设置</span>
</div>
</button>
<popup
:show="showSettingDialog"
@btnCancel="showSettingDialog = false"
......@@ -16,13 +20,15 @@
>
<div class="setting-content">
<div class="type-btn">
<span
<button
:class="selectedTypeItem === index ? 'active' : ''"
v-for="(item, index) in fenceTypeList"
:key="index"
@click="changeFenceType(index)"
>{{ item }}</span
v-preventReClick
>
{{ item }}
</button>
</div>
<div class="type-box" v-if="selectedTypeItem === 0">
<div>
......@@ -39,20 +45,20 @@
<div class="type-box" v-if="selectedTypeItem === 1">
<div>
<span class="label">{{ fenceTypeList[selectedTypeItem] }}</span>
<a @click="changeProviceCity(1)"
><span
<button @click="changeProviceCity(1)" v-preventReClick>
<span
class="radio"
:class="proviceCityType === 1 ? 'active' : ''"
></span
><span>跨省</span></a
>
<a @click="changeProviceCity(2)"
><span
><span>跨省</span>
</button>
<button @click="changeProviceCity(2)" v-preventReClick>
<span
class="radio"
:class="proviceCityType === 2 ? 'active' : ''"
></span
><span>跨市</span></a
>
><span>跨市</span>
</button>
</div>
</div>
</div>
......@@ -67,10 +73,10 @@
<script>
import { defineComponent, onMounted, ref } from "vue";
import mapContent from "@/components/mapContent.vue";
import popup from "@/components/popup.vue";
import AMapLoader from "@amap/amap-jsapi-loader";
import { CONSTANT } from "../constant";
import { Toast, Dialog } from "vant";
import ADCODE from "@/utils/adcode";
import { useRoute } from "vue-router";
import "vant/es/toast/style";
import { GET_CAR_LOCATION_INFO, ADD_FENCE } from "@/api/index";
......@@ -78,6 +84,7 @@ export default defineComponent({
name: "FencePage",
components: {
mapContent,
popup,
},
setup() {
const mapContentRefs = ref(null);
......@@ -94,6 +101,7 @@ export default defineComponent({
const routeQuery = route.query;
const hasRadiusFence = ref(false);
const hasProviceCityFence = ref(false);
const adcodeItemName = ref(null);
let district = null;
onMounted(() => {
AMapLoader.load({
......@@ -110,7 +118,18 @@ export default defineComponent({
});
});
// 地图刷新
const refreshCb = () => {};
const refreshCb = (map) => {
map.clearMap();
getData(map);
if (hasRadiusFence.value) {
createCircle(currLnglat.value, radiusNum.value);
createPoint(currLnglat.value);
}
if (hasProviceCityFence.value && adcodeItemName.value) {
coverArea(adcodeItemName.value, map);
}
map.setFitView();
};
// 切换围栏类型
const changeFenceType = (index) => {
selectedTypeItem.value = index;
......@@ -130,6 +149,7 @@ export default defineComponent({
val["gpsLocation"].elng,
val["gpsLocation"].elat
);
drawMarker(currLnglat.value);
});
} else {
Dialog({ message: "暂无数据" });
......@@ -160,7 +180,6 @@ export default defineComponent({
currentMap = currentMap
? currentMap
: mapContentRefs.value.init("fenceContainer");
drawMarker(currLnglat.value);
currentMap.setFitView();
showSettingDialog.value = false;
hasRadiusFence.value = true;
......@@ -172,13 +191,9 @@ export default defineComponent({
}
if (selectedTypeItem.value === 1 && proviceCityType.value) {
getAdcodeByLatlng(currLnglat.value, (obj) => {
var adcodeItem = filterAdcodeObj(obj.adcode);
if (proviceCityType.value != adcodeItem.type) {
adcodeItem = filterAdcodeObj(adcodeItem.parentid);
}
ADD_FENCE({
shapeType: 4,
areaCode: adcodeItem.adcode,
areaCode: obj.adcode,
lnglat: currLnglat.value.lng + "," + currLnglat.value.lat,
sn: routeQuery.sn,
}).then((res) => {
......@@ -186,7 +201,8 @@ export default defineComponent({
Toast(
`设定${proviceCityType.value === 1 ? "跨省" : "跨市"}围栏成功`
);
coverArea(adcodeItem.name, currentMap);
adcodeItemName.value = obj.adName;
coverArea(obj.adName, currentMap);
currentMap.setFitView();
hasProviceCityFence.value = true;
}
......@@ -234,12 +250,24 @@ export default defineComponent({
if (geocoderValue.value) {
var lnglatXY = [currLnglat.lng, currLnglat.lat];
geocoderValue.value.getAddress(lnglatXY, function (status, result) {
var _adcode = "";
let _adcode = "";
let _adName = "";
if (status === "complete" && result.info === "OK") {
_adcode = result.regeocode.addressComponent.adcode;
_adcode = _adcode.substr(0, 4) + "00";
_adName =
proviceCityType.value == 1
? result.regeocode.addressComponent.province
: proviceCityType.value == 2
? result.regeocode.addressComponent.city
: "";
_adcode =
proviceCityType.value == 1
? _adcode.substr(0, 2) + "0000"
: proviceCityType.value == 2
? _adcode.substr(0, 4) + "00"
: "";
}
cb({ adcode: _adcode });
cb({ adcode: _adcode, adName: _adName });
});
} else {
setTimeout(function () {
......@@ -247,17 +275,6 @@ export default defineComponent({
}, 500);
}
};
// 省市区code过滤
const filterAdcodeObj = (adcode) => {
adcode = adcode.toString().substr(0, 4) + "00";
for (var i = 0, len = ADCODE.length; i < len; i++) {
var item = ADCODE[i];
if (adcode == item.adcode) {
return item;
}
}
return null;
};
// 添加标记
const drawMarker = (currLnglat) => {
new window.AMap.Marker({
......@@ -269,6 +286,7 @@ export default defineComponent({
map: currentMap,
offset: new window.AMap.Pixel(-17, -26),
});
currentMap.setFitView();
};
// 地图添加圆
const createCircle = (lnglat, radius) => {
......@@ -319,6 +337,7 @@ export default defineComponent({
createCircle,
hasRadiusFence,
hasProviceCityFence,
adcodeItemName,
};
},
});
......@@ -336,6 +355,8 @@ export default defineComponent({
flex-flow: column;
align-items: center;
justify-content: center;
box-shadow: 0px 5px 12px 0px rgba(0, 0, 0, 0.12);
border-radius: 6px;
.setting-text {
font-size: 16px;
display: inline-block;
......@@ -343,7 +364,8 @@ export default defineComponent({
}
}
.setting-content {
width: calc(100% - 32px);
box-sizing: border-box;
width: 100%;
height: 100%;
padding: 10px 16px;
font-size: 14px;
......@@ -353,7 +375,7 @@ export default defineComponent({
color: #111;
font-weight: var(--van-font-weight-bold);
display: flex;
span {
button {
flex: 1;
border-radius: 5px;
height: 36px;
......@@ -362,7 +384,7 @@ export default defineComponent({
text-align: center;
line-height: 36px;
}
span.active {
button.active {
height: 34px;
line-height: 34px;
color: var(--base-color);
......@@ -387,8 +409,9 @@ export default defineComponent({
background: #f0f2f5;
border-radius: 4px;
line-height: 40px;
margin-bottom: 0 !important;
}
a {
button {
display: flex;
align-items: center;
margin-left: 15px;
......
......@@ -112,34 +112,8 @@ export default defineComponent({
});
</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;
.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;
}
.info-content {
height: 100%;
}
@import "@/assets/css/share.scss";
</style>
<template>
<div class="monitor-tabContent">
<div class="info-content">
<mapContent @refreshCb="refreshCb" @getData="getData" ref="mapContentRefs">
<template #mapBox>
<div id="monitorContainer" class="map-container"></div>
......@@ -170,14 +170,13 @@ export default {
require("@/assets/images/car.png") +
'" style="transform: scale(0.5);" />',
map: currentMap,
offset: new window.AMap.Pixel(-8.5, -13),
offset: new window.AMap.Pixel(-17, -26),
});
beginMarker = new window.AMap.Marker({
position: lnglat,
content:
'<span class="icon icon-begin" style="transform: scale(0.5);"></span>',
content: '<span class="icon icon-begin" ></span>',
map: currentMap,
offset: new window.AMap.Pixel(-8.5, -13),
offset: new window.AMap.Pixel(-17, -26),
visible: false,
});
} else {
......@@ -248,7 +247,8 @@ export default {
}
}
.list-content-monitor {
width: calc(100% - 30px);
box-sizing: border-box;
width: 100%;
padding: 5px 15px 0 15px;
font-size: 14px;
.list-item {
......@@ -263,6 +263,7 @@ export default {
flex-flow: column;
overflow: hidden;
padding-bottom: 14px;
width: 100%;
border-bottom: 1px solid #f0f2f5;
}
.title {
......@@ -274,7 +275,7 @@ export default {
.time {
color: #666;
font-size: 12px;
margin-top: 5px;
margin-top: 7px;
}
}
:last-child {
......@@ -287,7 +288,7 @@ export default {
transition: max-height 0.3s;
}
.toggle-bottom-monitor.show {
max-height: 80%;
max-height: 60%;
transition: max-height 0.3s;
.list-content-monitor {
overflow-y: scroll;
......
<template>
<div>
<div class="info-content">
<mapContent ref="mapContentRefs">
<template #mapBox>
<div id="shareContainer" class="map-container"></div>
......
......@@ -11,10 +11,18 @@ function resolve(dir) {
return path.join(__dirname, ".", dir);
}
module.exports = defineConfig({
publicPath: "/miniapp/",
publicPath: "./",
transpileDependencies: true,
devServer: {
port: 9527,
proxy: {
'/api': {
target: 'https://eshield.dev.glsx.com.cn/',
changeOrigin: true,
secure: false,
pathRewrite: { "^/api": "" },
}
}
},
chainWebpack: (config) => {
config.plugin("webpack-spritesmith").use(Spritesmith, [
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!