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 @@ ...@@ -15,12 +15,12 @@
"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", "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",
"vue-slider-component": "^4.1.0-beta.1",
"vuex": "^4.0.0" "vuex": "^4.0.0"
}, },
"devDependencies": { "devDependencies": {
......
...@@ -4,11 +4,13 @@ ...@@ -4,11 +4,13 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <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"> <link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title> <title>找车</title>
<%= htmlWebpackPlugin.options.title %>
</title>
</head> </head>
<body> <body>
......
...@@ -3,8 +3,8 @@ module.exports = function (data) { ...@@ -3,8 +3,8 @@ module.exports = function (data) {
const shared = const shared =
`.icon {display: inline-block;background-image: url(I);background-size: Wpx Hpx;}` `.icon {display: inline-block;background-image: url(I);background-size: Wpx Hpx;}`
.replace("I", data.sprites[0].image) .replace("I", data.sprites[0].image)
.replace("W", data.sprites[0].total_width) .replace("W", data.sprites[0].total_width / 2)
.replace("H", data.sprites[0].total_height); .replace("H", data.sprites[0].total_height / 2);
const perSprite = data.sprites const perSprite = data.sprites
.map(function (sprite) { .map(function (sprite) {
...@@ -16,10 +16,10 @@ module.exports = function (data) { ...@@ -16,10 +16,10 @@ module.exports = function (data) {
return style return style
.replace(/N/g, sprite.name) .replace(/N/g, sprite.name)
.replace(/A/g, sprite.name.replace(/\-active$/g, "")) .replace(/A/g, sprite.name.replace(/\-active$/g, ""))
.replace(/W/g, sprite.width) .replace(/W/g, sprite.width / 2)
.replace(/H/g, sprite.height) .replace(/H/g, sprite.height / 2)
.replace(/X/g, sprite.offset_x) .replace(/X/g, sprite.offset_x / 2)
.replace(/Y/g, sprite.offset_y); .replace(/Y/g, sprite.offset_y / 2);
}) })
.join("\n"); .join("\n");
......
...@@ -34,15 +34,23 @@ export default { ...@@ -34,15 +34,23 @@ export default {
html, html,
body { body {
height: 100%; height: 100%;
// min-height: 100%; overflow: hidden;
// min-height: 100%;
} }
.warp-content { .warp-content {
height: 100%; height: 100%;
} }
* {
-webkit-tap-highlight-color: rgba(255, 255, 255, 0) !important;
-webkit-tap-highlight-color: transparent !important;
}
#app { #app {
height: 100%; height: 100%;
// min-height: 100%; position: fixed;
position: -ms-device-fixed;
top: 0px;
left: 0px;
right: 0px;
bottom: 0px;
} }
.curr-marker { .curr-marker {
display: inline-block; display: inline-block;
...@@ -57,7 +65,13 @@ body { ...@@ -57,7 +65,13 @@ body {
.map-container { .map-container {
width: 100%; width: 100%;
height: 100%; height: 100%;
position: fixed; // position: fixed;
z-index: 100; z-index: 100;
} }
button {
border-radius: 0;
border: none;
outline: none;
background: rgba(0, 0, 0, 0);
}
</style> </style>
...@@ -39,3 +39,8 @@ export const SET_FREQ = (params) => { ...@@ -39,3 +39,8 @@ export const SET_FREQ = (params) => {
export const ADD_FENCE = (params) => { export const ADD_FENCE = (params) => {
return request(params, `${prefix}/fence/add`, "POST"); 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 \ 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 \ No newline at end of file
...@@ -6,6 +6,7 @@ ...@@ -6,6 +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-search-content-background-color: #f5f6f7 !important;
--van-font-weight-bold: 600 !important; --van-font-weight-bold: 600 !important;
--van-search-action-text-color: var(--base-color) !important; --van-search-action-text-color: var(--base-color) !important;
--van-dropdown-menu-title-active-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 \ 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 \ 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 @@ ...@@ -5,13 +5,8 @@
</template> </template>
<script> <script>
import { Loading } from "vant";
export default { export default {
name: "LOADING", name: "LOADING",
components: {
["van-loading"]: Loading,
},
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
...@@ -2,18 +2,29 @@ ...@@ -2,18 +2,29 @@
<div class="map-box"> <div class="map-box">
<slot name="mapBox"></slot> <slot name="mapBox"></slot>
<div v-show="isUploaded"> <div v-show="isUploaded">
<a class="map-cmd-icon location" @click="getLocation"> <button
<span class="icon icon-location"></span> class="map-cmd-icon location"
</a> @click="getLocation"
<a class="map-cmd-icon refresh-car" @click="refresh"> 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> <span class="icon icon-refresh-car"></span>
</a> </button>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import { onMounted, ref } from "vue"; import { onMounted, ref } from "vue";
import { Toast } from "vant";
import "vant/es/toast/style";
export default { export default {
name: "mapContent", name: "mapContent",
props: {}, props: {},
...@@ -23,6 +34,7 @@ export default { ...@@ -23,6 +34,7 @@ export default {
let checkLoadedTimeoutId = ""; let checkLoadedTimeoutId = "";
const satelActive = ref(null); const satelActive = ref(null);
const roadActive = ref(null); const roadActive = ref(null);
const isGetLocation = ref(false);
onMounted(() => {}); onMounted(() => {});
const initMap = (id) => { const initMap = (id) => {
let check = () => { let check = () => {
...@@ -47,6 +59,7 @@ export default { ...@@ -47,6 +59,7 @@ export default {
let currMarker = null; let currMarker = null;
// 获取定位 // 获取定位
const getLocation = () => { const getLocation = () => {
isGetLocation.value = true;
map.plugin("AMap.Geolocation", function () { map.plugin("AMap.Geolocation", function () {
var geolocation = new window.AMap.Geolocation({ var geolocation = new window.AMap.Geolocation({
enableHighAccuracy: true, enableHighAccuracy: true,
...@@ -61,6 +74,7 @@ export default { ...@@ -61,6 +74,7 @@ export default {
if (currMarker) { if (currMarker) {
currMarker.setMap(null); currMarker.setMap(null);
} }
isGetLocation.value = false;
currMarker = new window.AMap.Marker({ currMarker = new window.AMap.Marker({
position: data.position, position: data.position,
content: '<span class="curr-marker"></span>', content: '<span class="curr-marker"></span>',
...@@ -69,7 +83,10 @@ export default { ...@@ -69,7 +83,10 @@ export default {
}); });
map.setFitView(); map.setFitView();
}); });
window.AMap.event.addListener(geolocation, "error", () => {}); window.AMap.event.addListener(geolocation, "error", () => {
Toast("获取定位失败");
isGetLocation.value = false;
});
}); });
}; };
// 刷新 // 刷新
...@@ -85,6 +102,7 @@ export default { ...@@ -85,6 +102,7 @@ export default {
roadActive, roadActive,
refresh, refresh,
isUploaded, isUploaded,
isGetLocation,
}; };
}, },
}; };
...@@ -104,13 +122,14 @@ export default { ...@@ -104,13 +122,14 @@ export default {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
box-shadow: 0px 5px 12px 0px rgba(0, 0, 0, 0.12);
} }
.location { .location {
bottom: 180px; bottom: 160px;
right: 20px; right: 20px;
} }
.refresh-car { .refresh-car {
bottom: 240px; bottom: 220px;
right: 20px; right: 20px;
} }
......
<template> <template>
<van-popup <van-popup
v-model:show="props.showPopup" :model-show="props.showPopup"
round round
@close="close" @close="close"
:close-on-click-overlay="true" :close-on-click-overlay="true"
...@@ -8,13 +8,15 @@ ...@@ -8,13 +8,15 @@
> >
<div class="content-box"> <div class="content-box">
<div class="btn-class"> <div class="btn-class">
<span class="cancel-btn" @click="cancel">取消</span> <button class="cancel-btn" @click="cancel">取消</button>
<span <button
class="save-btn" class="save-btn"
:class="isDisabled ? 'disabled' : ''" :class="isDisabled ? 'disabled' : ''"
@click="save" @click="save"
>{{ isDisabled ? "关闭" : "确定" }}</span v-preventReClick
> >
{{ isDisabled ? "关闭" : "确定" }}
</button>
</div> </div>
<slot></slot> <slot></slot>
</div> </div>
...@@ -72,10 +74,12 @@ export default defineComponent({ ...@@ -72,10 +74,12 @@ export default defineComponent({
padding-bottom: 40px; padding-bottom: 40px;
.btn-class { .btn-class {
padding: 15px; padding: 15px;
box-sizing: border-box;
border-bottom: 1px solid #f0f2f5; border-bottom: 1px solid #f0f2f5;
width: calc(100% - 40px); width: 100%;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
font-size: 14px;
.cancel-btn { .cancel-btn {
color: #6c737a; color: #6c737a;
} }
......
<template> <template>
<div> <div class="top-tab-class">
<van-tabs v-model:active="active" @click-tab="onTabClick"> <van-tabs v-model:active="active" @click-tab="onTabClick">
<van-tab <van-tab
v-for="(item, index) in tabRoutes" v-for="(item, index) in tabRoutes"
...@@ -29,20 +29,23 @@ export default { ...@@ -29,20 +29,23 @@ export default {
// 过滤tab // 过滤tab
const filterTabs = async (cb) => { const filterTabs = async (cb) => {
let source = routeQuery.source; let source = routeQuery.source;
// 有线设备 无设备调频 for (var i = routes.tabRoutes.length - 1; i >= 0; i--) {
if (source == 1) { if (routes.tabRoutes[i].name === "freq" && source == 1) {
routesArr.map((val, index) => { routesArr.splice(i, 1);
if (val.name === "freq") {
routesArr.splice(index, 1);
} }
}); if (
(routes.tabRoutes[i].name === "fence" && source == 0) ||
(routes.tabRoutes[i].name === "fence" &&
JSON.parse(localStorage.getItem("sharePage")))
) {
routesArr.splice(i, 1);
} }
if (source == 0) { if (
routesArr.map((val, index) => { routes.tabRoutes[i].name === "share" &&
if (val.name === "fence") { JSON.parse(localStorage.getItem("sharePage"))
routesArr.splice(index, 1); ) {
routesArr.splice(i, 1);
} }
});
} }
await cb(); await cb();
}; };
...@@ -62,8 +65,25 @@ export default { ...@@ -62,8 +65,25 @@ export default {
}, },
}; };
</script> </script>
<style lang="scss" scoped>
.top-tab-class {
height: 100%;
}
.tab-content {
height: 100%;
}
</style>
<style lang="scss"> <style lang="scss">
.van-tabs {
height: 100%;
}
.van-tabs__wrap { .van-tabs__wrap {
border-bottom: 1px solid #f0f2f5; border-bottom: 1px solid #f0f2f5;
} }
.van-tabs__content {
height: calc(100% - 45px);
}
.van-tab__panel {
height: 100%;
}
</style> </style>
...@@ -10,6 +10,19 @@ import "@/assets/icons"; ...@@ -10,6 +10,19 @@ import "@/assets/icons";
import SvgIcon from "@/components/svgIcon"; import SvgIcon from "@/components/svgIcon";
const app = createApp(App); 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); app.component("svg-icon", SvgIcon);
vant(app); vant(app);
app.use(store).use(router).mount("#app"); app.use(store).use(router).mount("#app");
......
import { createRouter, createWebHistory } from "vue-router"; import { createRouter, createWebHashHistory } from "vue-router";
import routes from "./routes"; import routes from "./routes";
const router = createRouter({ const router = createRouter({
history: createWebHistory("/miniapp/"), history: createWebHashHistory(),
routes: routes.baseRoutes, routes: routes.baseRoutes,
}); });
......
import axios from "axios"; import axios from "axios";
import { Dialog } from "vant"; import { Dialog } from "vant";
import store from "@/store"; import store from "@/store";
import wx from "wx";
// 测试 https://eshield.test.glsx.com.cn // 测试 https://eshield.test.glsx.com.cn
// 开发 https://eshield.dev.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({ const instance = axios.create({
// 创建axios实例,在这里可以设置请求的默认配置 // 创建axios实例,在这里可以设置请求的默认配置
timeout: 10 * 60 * 1000, // 设置超时时间60s timeout: 10 * 60 * 1000, // 设置超时时间60s
...@@ -40,18 +42,24 @@ instance.interceptors.request.use( ...@@ -40,18 +42,24 @@ instance.interceptors.request.use(
instance.interceptors.response.use( instance.interceptors.response.use(
(response) => { (response) => {
store.commit("hideLoading"); store.commit("hideLoading");
const serverCode = response.data.code, const serverCode = response.data.code;
token = response.headers["authorization"];
if (token || token === "") {
localStorage.setItem("token", token);
}
if (serverCode === 200) { if (serverCode === 200) {
if (response.status) { if (response.status) {
return Promise.resolve(response); return Promise.resolve(response);
} }
return Promise.resolve(response.data); return Promise.resolve(response.data);
} else { } 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); 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 { ...@@ -3,17 +3,16 @@ import {
List, List,
Search, Search,
Overlay, Overlay,
Picker, Tab,
Tabs,
Icon, Icon,
Button, Button,
DatetimePicker, DatetimePicker,
Progress,
RadioGroup,
Radio,
Slider,
DropdownMenu,
Field, Field,
Switch, Switch,
Cell,
Loading,
NoticeBar,
} from "vant"; } from "vant";
export function vant(app) { export function vant(app) {
...@@ -21,15 +20,14 @@ export function vant(app) { ...@@ -21,15 +20,14 @@ export function vant(app) {
app.use(List); app.use(List);
app.use(Search); app.use(Search);
app.use(Overlay); app.use(Overlay);
app.use(Picker);
app.use(Icon); app.use(Icon);
app.use(Button); app.use(Button);
app.use(DatetimePicker); app.use(DatetimePicker);
app.use(Progress);
app.use(RadioGroup);
app.use(Radio);
app.use(Slider);
app.use(DropdownMenu);
app.use(Field); app.use(Field);
app.use(Switch); app.use(Switch);
app.use(Tab);
app.use(Tabs);
app.use(Cell);
app.use(Loading);
app.use(NoticeBar);
} }
<template> <template>
<div> <div class="info-content">
<div class="settingControll" @click="showSettingDialog = true"> <button
class="settingControll"
@click="showSettingDialog = true"
v-preventReClick
>
<a class="icon icon-setting-btn"></a> <a class="icon icon-setting-btn"></a>
<span class="setting-text">设置</span> <span class="setting-text">设置</span>
</div> </button>
<popup <popup
:show="showSettingDialog" :show="showSettingDialog"
@btnCancel="showSettingDialog = false" @btnCancel="showSettingDialog = false"
...@@ -16,13 +20,15 @@ ...@@ -16,13 +20,15 @@
> >
<div class="setting-content"> <div class="setting-content">
<div class="type-btn"> <div class="type-btn">
<span <button
:class="selectedTypeItem === index ? 'active' : ''" :class="selectedTypeItem === index ? 'active' : ''"
v-for="(item, index) in fenceTypeList" v-for="(item, index) in fenceTypeList"
:key="index" :key="index"
@click="changeFenceType(index)" @click="changeFenceType(index)"
>{{ item }}</span v-preventReClick
> >
{{ item }}
</button>
</div> </div>
<div class="type-box" v-if="selectedTypeItem === 0"> <div class="type-box" v-if="selectedTypeItem === 0">
<div> <div>
...@@ -39,20 +45,20 @@ ...@@ -39,20 +45,20 @@
<div class="type-box" v-if="selectedTypeItem === 1"> <div class="type-box" v-if="selectedTypeItem === 1">
<div> <div>
<span class="label">{{ fenceTypeList[selectedTypeItem] }}</span> <span class="label">{{ fenceTypeList[selectedTypeItem] }}</span>
<a @click="changeProviceCity(1)" <button @click="changeProviceCity(1)" v-preventReClick>
><span <span
class="radio" class="radio"
:class="proviceCityType === 1 ? 'active' : ''" :class="proviceCityType === 1 ? 'active' : ''"
></span ></span
><span>跨省</span></a ><span>跨省</span>
> </button>
<a @click="changeProviceCity(2)" <button @click="changeProviceCity(2)" v-preventReClick>
><span <span
class="radio" class="radio"
:class="proviceCityType === 2 ? 'active' : ''" :class="proviceCityType === 2 ? 'active' : ''"
></span ></span
><span>跨市</span></a ><span>跨市</span>
> </button>
</div> </div>
</div> </div>
</div> </div>
...@@ -67,10 +73,10 @@ ...@@ -67,10 +73,10 @@
<script> <script>
import { defineComponent, onMounted, ref } from "vue"; import { defineComponent, onMounted, ref } from "vue";
import mapContent from "@/components/mapContent.vue"; import mapContent from "@/components/mapContent.vue";
import popup from "@/components/popup.vue";
import AMapLoader from "@amap/amap-jsapi-loader"; import AMapLoader from "@amap/amap-jsapi-loader";
import { CONSTANT } from "../constant"; import { CONSTANT } from "../constant";
import { Toast, Dialog } from "vant"; import { Toast, Dialog } from "vant";
import ADCODE from "@/utils/adcode";
import { useRoute } from "vue-router"; import { useRoute } from "vue-router";
import "vant/es/toast/style"; import "vant/es/toast/style";
import { GET_CAR_LOCATION_INFO, ADD_FENCE } from "@/api/index"; import { GET_CAR_LOCATION_INFO, ADD_FENCE } from "@/api/index";
...@@ -78,6 +84,7 @@ export default defineComponent({ ...@@ -78,6 +84,7 @@ export default defineComponent({
name: "FencePage", name: "FencePage",
components: { components: {
mapContent, mapContent,
popup,
}, },
setup() { setup() {
const mapContentRefs = ref(null); const mapContentRefs = ref(null);
...@@ -94,6 +101,7 @@ export default defineComponent({ ...@@ -94,6 +101,7 @@ export default defineComponent({
const routeQuery = route.query; const routeQuery = route.query;
const hasRadiusFence = ref(false); const hasRadiusFence = ref(false);
const hasProviceCityFence = ref(false); const hasProviceCityFence = ref(false);
const adcodeItemName = ref(null);
let district = null; let district = null;
onMounted(() => { onMounted(() => {
AMapLoader.load({ AMapLoader.load({
...@@ -110,7 +118,18 @@ export default defineComponent({ ...@@ -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) => { const changeFenceType = (index) => {
selectedTypeItem.value = index; selectedTypeItem.value = index;
...@@ -130,6 +149,7 @@ export default defineComponent({ ...@@ -130,6 +149,7 @@ export default defineComponent({
val["gpsLocation"].elng, val["gpsLocation"].elng,
val["gpsLocation"].elat val["gpsLocation"].elat
); );
drawMarker(currLnglat.value);
}); });
} else { } else {
Dialog({ message: "暂无数据" }); Dialog({ message: "暂无数据" });
...@@ -160,7 +180,6 @@ export default defineComponent({ ...@@ -160,7 +180,6 @@ export default defineComponent({
currentMap = currentMap currentMap = currentMap
? currentMap ? currentMap
: mapContentRefs.value.init("fenceContainer"); : mapContentRefs.value.init("fenceContainer");
drawMarker(currLnglat.value);
currentMap.setFitView(); currentMap.setFitView();
showSettingDialog.value = false; showSettingDialog.value = false;
hasRadiusFence.value = true; hasRadiusFence.value = true;
...@@ -172,13 +191,9 @@ export default defineComponent({ ...@@ -172,13 +191,9 @@ export default defineComponent({
} }
if (selectedTypeItem.value === 1 && proviceCityType.value) { if (selectedTypeItem.value === 1 && proviceCityType.value) {
getAdcodeByLatlng(currLnglat.value, (obj) => { getAdcodeByLatlng(currLnglat.value, (obj) => {
var adcodeItem = filterAdcodeObj(obj.adcode);
if (proviceCityType.value != adcodeItem.type) {
adcodeItem = filterAdcodeObj(adcodeItem.parentid);
}
ADD_FENCE({ ADD_FENCE({
shapeType: 4, shapeType: 4,
areaCode: adcodeItem.adcode, areaCode: obj.adcode,
lnglat: currLnglat.value.lng + "," + currLnglat.value.lat, lnglat: currLnglat.value.lng + "," + currLnglat.value.lat,
sn: routeQuery.sn, sn: routeQuery.sn,
}).then((res) => { }).then((res) => {
...@@ -186,7 +201,8 @@ export default defineComponent({ ...@@ -186,7 +201,8 @@ export default defineComponent({
Toast( Toast(
`设定${proviceCityType.value === 1 ? "跨省" : "跨市"}围栏成功` `设定${proviceCityType.value === 1 ? "跨省" : "跨市"}围栏成功`
); );
coverArea(adcodeItem.name, currentMap); adcodeItemName.value = obj.adName;
coverArea(obj.adName, currentMap);
currentMap.setFitView(); currentMap.setFitView();
hasProviceCityFence.value = true; hasProviceCityFence.value = true;
} }
...@@ -234,12 +250,24 @@ export default defineComponent({ ...@@ -234,12 +250,24 @@ export default defineComponent({
if (geocoderValue.value) { if (geocoderValue.value) {
var lnglatXY = [currLnglat.lng, currLnglat.lat]; var lnglatXY = [currLnglat.lng, currLnglat.lat];
geocoderValue.value.getAddress(lnglatXY, function (status, result) { geocoderValue.value.getAddress(lnglatXY, function (status, result) {
var _adcode = ""; let _adcode = "";
let _adName = "";
if (status === "complete" && result.info === "OK") { if (status === "complete" && result.info === "OK") {
_adcode = result.regeocode.addressComponent.adcode; _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 { } else {
setTimeout(function () { setTimeout(function () {
...@@ -247,17 +275,6 @@ export default defineComponent({ ...@@ -247,17 +275,6 @@ export default defineComponent({
}, 500); }, 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) => { const drawMarker = (currLnglat) => {
new window.AMap.Marker({ new window.AMap.Marker({
...@@ -269,6 +286,7 @@ export default defineComponent({ ...@@ -269,6 +286,7 @@ export default defineComponent({
map: currentMap, map: currentMap,
offset: new window.AMap.Pixel(-17, -26), offset: new window.AMap.Pixel(-17, -26),
}); });
currentMap.setFitView();
}; };
// 地图添加圆 // 地图添加圆
const createCircle = (lnglat, radius) => { const createCircle = (lnglat, radius) => {
...@@ -319,6 +337,7 @@ export default defineComponent({ ...@@ -319,6 +337,7 @@ export default defineComponent({
createCircle, createCircle,
hasRadiusFence, hasRadiusFence,
hasProviceCityFence, hasProviceCityFence,
adcodeItemName,
}; };
}, },
}); });
...@@ -336,6 +355,8 @@ export default defineComponent({ ...@@ -336,6 +355,8 @@ export default defineComponent({
flex-flow: column; flex-flow: column;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
box-shadow: 0px 5px 12px 0px rgba(0, 0, 0, 0.12);
border-radius: 6px;
.setting-text { .setting-text {
font-size: 16px; font-size: 16px;
display: inline-block; display: inline-block;
...@@ -343,7 +364,8 @@ export default defineComponent({ ...@@ -343,7 +364,8 @@ export default defineComponent({
} }
} }
.setting-content { .setting-content {
width: calc(100% - 32px); box-sizing: border-box;
width: 100%;
height: 100%; height: 100%;
padding: 10px 16px; padding: 10px 16px;
font-size: 14px; font-size: 14px;
...@@ -353,7 +375,7 @@ export default defineComponent({ ...@@ -353,7 +375,7 @@ export default defineComponent({
color: #111; color: #111;
font-weight: var(--van-font-weight-bold); font-weight: var(--van-font-weight-bold);
display: flex; display: flex;
span { button {
flex: 1; flex: 1;
border-radius: 5px; border-radius: 5px;
height: 36px; height: 36px;
...@@ -362,7 +384,7 @@ export default defineComponent({ ...@@ -362,7 +384,7 @@ export default defineComponent({
text-align: center; text-align: center;
line-height: 36px; line-height: 36px;
} }
span.active { button.active {
height: 34px; height: 34px;
line-height: 34px; line-height: 34px;
color: var(--base-color); color: var(--base-color);
...@@ -387,8 +409,9 @@ export default defineComponent({ ...@@ -387,8 +409,9 @@ export default defineComponent({
background: #f0f2f5; background: #f0f2f5;
border-radius: 4px; border-radius: 4px;
line-height: 40px; line-height: 40px;
margin-bottom: 0 !important;
} }
a { button {
display: flex; display: flex;
align-items: center; align-items: center;
margin-left: 15px; margin-left: 15px;
......
...@@ -11,14 +11,15 @@ ...@@ -11,14 +11,15 @@
<div class="content" v-if="openFreq"> <div class="content" v-if="openFreq">
<span class="title-text">选择模式</span> <span class="title-text">选择模式</span>
<div class="middle"> <div class="middle">
<span <button
v-for="(item, index) in typeList" v-for="(item, index) in typeList"
:key="index" :key="index"
@click="changeType(index)" @click="changeType(index)"
v-preventReClick
> >
<span class="radio" :class="type === index ? 'active' : ''"></span> <span class="radio" :class="type === index ? 'active' : ''"></span>
<span>{{ item }}</span> <span>{{ item }}</span>
</span> </button>
</div> </div>
<!-- 追车模式 --> <!-- 追车模式 -->
<div class="chas-car-content bottom" v-if="type === 0"> <div class="chas-car-content bottom" v-if="type === 0">
...@@ -36,49 +37,67 @@ ...@@ -36,49 +37,67 @@
<!-- 闹钟模式 --> <!-- 闹钟模式 -->
<div class="clock-content bottom" v-if="type === 1"> <div class="clock-content bottom" v-if="type === 1">
<div v-for="(item, index) in clockList" :key="index" class="clock-item"> <div v-for="(item, index) in clockList" :key="index" class="clock-item">
<span class="cont-left" @click="changeClockCheck(index)"> <button
class="cont-left"
@click="changeClockCheck(index)"
v-preventReClick
>
<svg-icon <svg-icon
:icon-class="item.checked ? 'checked' : 'check'" :icon-class="item.checked ? 'checked' : 'check'"
class="check-class" class="check-class"
></svg-icon> ></svg-icon>
<span class="lable">{{ item.name }}</span> <span class="lable">{{ item.name }}</span>
</span> </button>
<span class="cont-right" @click="onShowTimePicker(1, index)"> <button
class="cont-right"
@click="onShowTimePicker(1, index)"
v-preventReClick
>
<svg-icon icon-class="clock" class="clock-class"></svg-icon> <svg-icon icon-class="clock" class="clock-class"></svg-icon>
<span> <span>
{{ item.time }} {{ item.time }}
</span> </span>
</span> </button>
</div> </div>
</div> </div>
<!-- 星期模式 --> <!-- 星期模式 -->
<div class="week-content bottom" v-if="type === 2"> <div class="week-content bottom" v-if="type === 2">
<div class="week-top"> <div class="week-top">
<span <button
v-for="(item, index) in weekCheckboxItems" v-for="(item, index) in weekCheckboxItems"
:key="index" :key="index"
class="week-item" class="week-item"
@click="changeWeekCheck(index)" @click="changeWeekCheck(index)"
v-preventReClick
> >
<svg-icon <svg-icon
:icon-class="item.checked ? 'checked' : 'check'" :icon-class="item.checked ? 'checked' : 'check'"
class="check-class" class="check-class"
></svg-icon> ></svg-icon>
<span class="lable">{{ item.name }}</span> <span class="lable">{{ item.name }}</span>
</span> </button>
</div> </div>
<div class="time-cont"> <div class="time-cont">
<span class="label">上点时间</span> <span class="label">上点时间</span>
<span class="cont-right" @click="onShowTimePicker(2, weekSelectTime)"> <button
class="cont-right"
@click="onShowTimePicker(2, weekSelectTime)"
v-preventReClick
>
<svg-icon icon-class="clock" class="clock-class"></svg-icon> <svg-icon icon-class="clock" class="clock-class"></svg-icon>
<span> <span>
{{ weekSelectTime }} {{ weekSelectTime }}
</span> </span>
</span> </button>
</div> </div>
</div> </div>
<van-button class="save-btn" type="primary" @click="onSave" block <van-button
class="save-btn"
type="primary"
@click="onSave"
block
v-preventReClick
>保存</van-button >保存</van-button
> >
</div> </div>
...@@ -93,16 +112,15 @@ ...@@ -93,16 +112,15 @@
v-model="currentTime" v-model="currentTime"
class="time-picker" class="time-picker"
type="time" type="time"
title="选择时间"
:show-toolbar="false"
:filter="filter" :filter="filter"
@change="changeTime" @confirm="changeTime"
ref="dateTimePicker"
/> />
</popup> </popup>
</div> </div>
</template> </template>
<script> <script>
import { defineComponent, onMounted, ref } from "vue"; import { defineComponent, onMounted, ref, watch, nextTick } from "vue";
import { Toast } from "vant"; import { Toast } from "vant";
import "vant/es/toast/style"; import "vant/es/toast/style";
import popup from "@/components/popup.vue"; import popup from "@/components/popup.vue";
...@@ -114,7 +132,7 @@ export default defineComponent({ ...@@ -114,7 +132,7 @@ export default defineComponent({
popup, popup,
}, },
setup() { setup() {
const openFreq = ref(true); const openFreq = ref(false);
const type = ref(0); const type = ref(0);
const route = useRoute(); const route = useRoute();
let routeQuery = route.query; let routeQuery = route.query;
...@@ -141,6 +159,7 @@ export default defineComponent({ ...@@ -141,6 +159,7 @@ export default defineComponent({
const columns = ref([]); const columns = ref([]);
const showTimePicker = ref(false); const showTimePicker = ref(false);
const selectedId = ref(null); const selectedId = ref(null);
const dateTimePicker = ref(null);
onMounted(() => { onMounted(() => {
// 获取已设置调频数据 // 获取已设置调频数据
getInfoData(); getInfoData();
...@@ -148,10 +167,10 @@ export default defineComponent({ ...@@ -148,10 +167,10 @@ export default defineComponent({
const getInfoData = () => { const getInfoData = () => {
GET_FREQ_INFO({ sn: routeQuery.sn }).then((res) => { GET_FREQ_INFO({ sn: routeQuery.sn }).then((res) => {
if (res.code === 200) { if (res.code === 200) {
res; if ((res.data && res.data.type === 3) || !res.data) {
if (!res.data.type.toString()) {
openFreq.value = false; openFreq.value = false;
} else { } else {
openFreq.value = true;
type.value = res.data.type; type.value = res.data.type;
switch (res.data.type) { switch (res.data.type) {
case 0: case 0:
...@@ -160,8 +179,12 @@ export default defineComponent({ ...@@ -160,8 +179,12 @@ export default defineComponent({
case 1: case 1:
res.data.timer && res.data.timer &&
res.data.timer.split(",").forEach((val, index) => { res.data.timer.split(",").forEach((val, index) => {
if (val != "NA") {
clockList.value[index].checked = true; clockList.value[index].checked = true;
clockList.value[index].time = val; clockList.value[index].time = val;
} else {
clockList.value[index].checked = false;
}
}); });
break; break;
case 2: case 2:
...@@ -180,10 +203,10 @@ export default defineComponent({ ...@@ -180,10 +203,10 @@ export default defineComponent({
} }
}); });
}; };
// 切换模式 watch(
const changeType = (index) => { () => type.value,
type.value = index; (newVal) => {
switch (index) { switch (newVal) {
case 0: case 0:
Toast("适用于收车场景,指定设备每隔几分钟更新定位信息。"); Toast("适用于收车场景,指定设备每隔几分钟更新定位信息。");
break; break;
...@@ -194,6 +217,11 @@ export default defineComponent({ ...@@ -194,6 +217,11 @@ export default defineComponent({
Toast("适用于日常场景,可按需设置每周的设备回传次数。"); Toast("适用于日常场景,可按需设置每周的设备回传次数。");
break; break;
} }
}
);
// 切换模式
const changeType = (index) => {
type.value = index;
}; };
// 闹钟模式选择 // 闹钟模式选择
const changeClockCheck = (index) => { const changeClockCheck = (index) => {
...@@ -217,7 +245,7 @@ export default defineComponent({ ...@@ -217,7 +245,7 @@ export default defineComponent({
// 闹钟模式 // 闹钟模式
if (num === 1) { if (num === 1) {
selectedId.value = data; selectedId.value = data;
let time = clockList.value[data].value; let time = clockList.value[data].time;
currentTime.value = time; currentTime.value = time;
selectTime.value = time; selectTime.value = time;
} }
...@@ -236,20 +264,24 @@ export default defineComponent({ ...@@ -236,20 +264,24 @@ export default defineComponent({
}; };
// 时间选择确定 // 时间选择确定
const saveTime = () => { const saveTime = () => {
nextTick(() => {
let confirmBtn = dateTimePicker.value.$el.children[0].children[1];
confirmBtn.click();
});
showTimePicker.value = false;
};
const changeTime = (e) => {
selectTime.value = e;
if (type.value === 1) { if (type.value === 1) {
clockList.value.forEach((val, index) => { clockList.value.forEach((val, index) => {
if (index === selectedId.value) { if (index === selectedId.value) {
val.value = selectTime.value; val.time = e;
} }
}); });
} }
if (type.value === 2) { if (type.value === 2) {
weekSelectTime.value = selectTime.value; weekSelectTime.value = e;
} }
showTimePicker.value = false;
};
const changeTime = (e) => {
selectTime.value = e;
}; };
// 开启关闭调频 // 开启关闭调频
const switchOnChange = (e) => { const switchOnChange = (e) => {
...@@ -257,6 +289,25 @@ export default defineComponent({ ...@@ -257,6 +289,25 @@ export default defineComponent({
CLOSE_FREQ({ sn: routeQuery.sn }).then((res) => { CLOSE_FREQ({ sn: routeQuery.sn }).then((res) => {
if (res.code === 200) { if (res.code === 200) {
Toast("关闭调频成功"); Toast("关闭调频成功");
// 重置默认的调频数据
clockList.value = [
{ name: "第一组", time: "08:00", checked: true },
{ name: "第二组", time: "12:00" },
{ name: "第三组", time: "18:00" },
{ name: "第四组", time: "22:00" },
];
type.value = 0;
minuteNum.value = null;
weekCheckboxItems.value = [
{ name: "周一", id: "1", checked: true },
{ name: "周二", id: "2" },
{ name: "周三", id: "3" },
{ name: "周四", id: "4" },
{ name: "周五", id: "5" },
{ name: "周六", id: "6" },
{ name: "周日", id: "7" },
];
weekSelectTime.value = "10:00";
} }
}); });
} }
...@@ -273,23 +324,31 @@ export default defineComponent({ ...@@ -273,23 +324,31 @@ export default defineComponent({
if ( if (
!/^\d{1,3}$/.test(minuteNum.value) || !/^\d{1,3}$/.test(minuteNum.value) ||
minuteNum.value < 1 || minuteNum.value < 1 ||
minuteNum.value > 999 minuteNum.value > 5
) { ) {
return Toast("请输入1~999之间的数字"); return Toast("请输入1~5之间的数字");
} }
break; break;
case 1: case 1:
// eslint-disable-next-line no-case-declarations // eslint-disable-next-line no-case-declarations
let arr = []; let arr = [[], []];
clockList.value.forEach((val) => { clockList.value.forEach((val) => {
arr[0].push(val.checked ? val.time : "NA");
if (val.checked) { if (val.checked) {
arr.push(val.time); arr[1].push(val.time);
} }
}); });
if (arr.length <= 0) { if (arr[1].length <= 0) {
return Toast("请至少选择一组模式"); return Toast("请至少选择一组模式");
} }
OParams.timer = arr.join(","); // eslint-disable-next-line no-case-declarations
// let timeArr = clockList.value.map((item) => item.time);
// eslint-disable-next-line no-case-declarations
let timeArrSet = new Set(arr[1]);
if (arr[1].length != timeArrSet.size) {
return Toast("每组模式时间不可相同");
}
OParams.timer = arr[0].join(",");
break; break;
case 2: case 2:
// eslint-disable-next-line no-case-declarations // eslint-disable-next-line no-case-declarations
...@@ -336,21 +395,28 @@ export default defineComponent({ ...@@ -336,21 +395,28 @@ export default defineComponent({
onSave, onSave,
switchOnChange, switchOnChange,
getInfoData, getInfoData,
dateTimePicker,
}; };
}, },
}); });
</script> </script>
<style lang="scss">
.van-picker__toolbar {
display: none;
}
</style>
<style lang="scss" scoped> <style lang="scss" scoped>
.freq-page { .freq-page {
position: fixed; box-sizing: border-box;
width: calc(100% - 20px); width: 100%;
padding: 16px 10px; padding: 16px 10px;
height: 100%; height: 100%;
overflow: auto;
background: #f5f6f7; background: #f5f6f7;
color: #111; color: #111;
.top { .top {
width: calc(100% - 32px); box-sizing: border-box;
width: 100%;
height: 52px; height: 52px;
border-radius: 8px; border-radius: 8px;
padding: 0 16px; padding: 0 16px;
...@@ -367,7 +433,8 @@ export default defineComponent({ ...@@ -367,7 +433,8 @@ export default defineComponent({
margin: 16px 0 8px 24px; margin: 16px 0 8px 24px;
} }
.middle { .middle {
width: calc(100% - 32px); box-sizing: border-box;
width: 100%;
height: 52px; height: 52px;
border-radius: 8px; border-radius: 8px;
padding: 0 16px; padding: 0 16px;
...@@ -375,7 +442,7 @@ export default defineComponent({ ...@@ -375,7 +442,7 @@ export default defineComponent({
display: flex; display: flex;
align-items: center; align-items: center;
font-size: 14px; font-size: 14px;
span { button {
flex: 1; flex: 1;
display: flex; display: flex;
align-items: center; align-items: center;
...@@ -396,7 +463,8 @@ export default defineComponent({ ...@@ -396,7 +463,8 @@ export default defineComponent({
} }
} }
.bottom { .bottom {
width: calc(100% - 32px); box-sizing: border-box;
width: 100%;
padding: 24px 16px; padding: 24px 16px;
border-radius: 8px; border-radius: 8px;
margin-top: 16px; margin-top: 16px;
......
...@@ -112,34 +112,8 @@ export default defineComponent({ ...@@ -112,34 +112,8 @@ export default defineComponent({
}); });
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.icon-share { .info-content {
position: absolute; height: 100%;
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;
}
} }
@import "@/assets/css/share.scss";
</style> </style>
<template> <template>
<div class="monitor-tabContent"> <div class="info-content">
<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>
...@@ -170,14 +170,13 @@ export default { ...@@ -170,14 +170,13 @@ export default {
require("@/assets/images/car.png") + require("@/assets/images/car.png") +
'" style="transform: scale(0.5);" />', '" style="transform: scale(0.5);" />',
map: currentMap, map: currentMap,
offset: new window.AMap.Pixel(-8.5, -13), offset: new window.AMap.Pixel(-17, -26),
}); });
beginMarker = new window.AMap.Marker({ beginMarker = new window.AMap.Marker({
position: lnglat, position: lnglat,
content: content: '<span class="icon icon-begin" ></span>',
'<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(-17, -26),
visible: false, visible: false,
}); });
} else { } else {
...@@ -248,7 +247,8 @@ export default { ...@@ -248,7 +247,8 @@ export default {
} }
} }
.list-content-monitor { .list-content-monitor {
width: calc(100% - 30px); box-sizing: border-box;
width: 100%;
padding: 5px 15px 0 15px; padding: 5px 15px 0 15px;
font-size: 14px; font-size: 14px;
.list-item { .list-item {
...@@ -263,6 +263,7 @@ export default { ...@@ -263,6 +263,7 @@ export default {
flex-flow: column; flex-flow: column;
overflow: hidden; overflow: hidden;
padding-bottom: 14px; padding-bottom: 14px;
width: 100%;
border-bottom: 1px solid #f0f2f5; border-bottom: 1px solid #f0f2f5;
} }
.title { .title {
...@@ -274,7 +275,7 @@ export default { ...@@ -274,7 +275,7 @@ export default {
.time { .time {
color: #666; color: #666;
font-size: 12px; font-size: 12px;
margin-top: 5px; margin-top: 7px;
} }
} }
:last-child { :last-child {
...@@ -287,7 +288,7 @@ export default { ...@@ -287,7 +288,7 @@ export default {
transition: max-height 0.3s; transition: max-height 0.3s;
} }
.toggle-bottom-monitor.show { .toggle-bottom-monitor.show {
max-height: 80%; max-height: 60%;
transition: max-height 0.3s; transition: max-height 0.3s;
.list-content-monitor { .list-content-monitor {
overflow-y: scroll; overflow-y: scroll;
......
<template> <template>
<div> <div class="info-content">
<div class="searchControll" @click="showTimeDialog = true"> <div class="tab">
<a class="icon icon-screen-btn"></a> <div class="tabbar">
<span class="screen-text">筛选</span> <button
</div>
<popup
:show="showTimeDialog"
@btnCancel="showTimeDialog = false"
@btnSave="saveTime"
:position="'bottom'"
>
<div class="time-content">
<span
class="time_btn" class="time_btn"
v-for="(item, index) in timeBtnList" v-for="(item, index) in timeBtnList"
:key="index" :key="index"
:class="seledtedItem === index ? 'active' : ''" :class="seledtedItem === index ? 'active' : ''"
@click="selectTime(index)" @click="selectTime(index)"
>{{ index < 2 ? item : currentDateText }}</span v-preventReClick
> >
{{ index < 2 ? item : currentDateText }}
</button>
</div>
</div> </div>
<popup
:show="showTimePicker"
@btnCancel="showTimePicker = false"
@btnSave="saveTime"
:position="'bottom'"
>
<van-datetime-picker <van-datetime-picker
style="width: 100%" style="width: 100%"
v-if="showTimePicker"
:show-toolbar="false"
v-model="currentDate" v-model="currentDate"
:max-date="maxDate" :max-date="maxDate"
type="year-month" type="year-month"
title="选择年月"
:formatter="formatter" :formatter="formatter"
@change="change" @confirm="change"
ref="dateTimePicker"
/> />
</popup> </popup>
<mapContent @refreshCb="refreshCb" @getData="getData" ref="mapContentRefs"> <mapContent @refreshCb="refreshCb" @getData="getData" ref="mapContentRefs">
...@@ -56,6 +54,7 @@ ...@@ -56,6 +54,7 @@
:key="index" :key="index"
> >
<span class="icon icon-loc-icon"></span> <span class="icon icon-loc-icon"></span>
<div class="text-content">
<div class="left"> <div class="left">
<p class="title">{{ item.transferAddress }}</p> <p class="title">{{ item.transferAddress }}</p>
<p class="time"> <p class="time">
...@@ -66,15 +65,22 @@ ...@@ -66,15 +65,22 @@
</p> </p>
</div> </div>
<div class="right"> <div class="right">
<a <button
class="copy-adr" class="button-class copy-adr"
@click="copyAddress" @click="copyAddress"
v-preventReClick
:data-clipboard-text="item.transferAddress" :data-clipboard-text="item.transferAddress"
><i class="icon icon-copy"></i><span>复制</span></a
> >
<a class="navigate" @click="navigation(item)" <i class="icon icon-copy"></i><span>复制</span>
><i class="icon icon-navgation"></i><span>导航</span></a </button>
<button
class="button-class"
@click="navigation(item)"
v-preventReClick
> >
<i class="icon icon-navgation"></i><span>导航</span>
</button>
</div>
</div> </div>
</div> </div>
</div> </div>
...@@ -85,6 +91,7 @@ ...@@ -85,6 +91,7 @@
<script> <script>
import { defineComponent, nextTick, onMounted, ref, watch } from "vue"; import { defineComponent, nextTick, onMounted, ref, watch } from "vue";
import mapContent from "@/components/mapContent.vue"; import mapContent from "@/components/mapContent.vue";
import popup from "@/components/popup.vue";
import AMapLoader from "@amap/amap-jsapi-loader"; import AMapLoader from "@amap/amap-jsapi-loader";
import { CONSTANT } from "../constant"; import { CONSTANT } from "../constant";
import moment from "@/utils/moment"; import moment from "@/utils/moment";
...@@ -99,6 +106,7 @@ export default defineComponent({ ...@@ -99,6 +106,7 @@ export default defineComponent({
name: "ResidentPage", name: "ResidentPage",
components: { components: {
mapContent, mapContent,
popup,
}, },
setup() { setup() {
const route = useRoute(); const route = useRoute();
...@@ -108,7 +116,6 @@ export default defineComponent({ ...@@ -108,7 +116,6 @@ export default defineComponent({
const currentDateText = ref("自定义"); const currentDateText = ref("自定义");
const timeBtnList = ["7天", "30天", "自定义"]; const timeBtnList = ["7天", "30天", "自定义"];
const seledtedItem = ref(0); const seledtedItem = ref(0);
const showTimeDialog = ref(false);
const isShowAllList = ref(false); const isShowAllList = ref(false);
const residentList = ref([]); const residentList = ref([]);
const listScroll = ref(0); const listScroll = ref(0);
...@@ -118,6 +125,7 @@ export default defineComponent({ ...@@ -118,6 +125,7 @@ export default defineComponent({
]); ]);
const changey = ref(null); const changey = ref(null);
const maxDate = ref(new Date()); const maxDate = ref(new Date());
const dateTimePicker = ref(null);
let currentMap = null; let currentMap = null;
let routeQuery = route.query; let routeQuery = route.query;
let markerArr = []; let markerArr = [];
...@@ -174,17 +182,12 @@ export default defineComponent({ ...@@ -174,17 +182,12 @@ export default defineComponent({
return val; return val;
}; };
const saveTime = () => { const saveTime = () => {
showTimeDialog.value = false; showTimePicker.value = false;
if (seledtedItem.value === 2) { // 不显示picker顶部 确认时调用 自带的confirm 防止选择时间延迟
currentDateText.value = moment(currentDate.value).format("YYYY-MM"); nextTick(() => {
searchTime.value = [ let confirmBtn = dateTimePicker.value.$el.children[0].children[1];
moment(currentDate.value) confirmBtn.click();
.endOf("month") });
.format("YYYY-MM-DD HH:mm:ss"),
moment(currentDate.value).format("YYYY-MM-DD HH:mm:ss"),
];
}
getData();
}; };
onMounted(() => { onMounted(() => {
AMapLoader.load({ AMapLoader.load({
...@@ -196,9 +199,8 @@ export default defineComponent({ ...@@ -196,9 +199,8 @@ export default defineComponent({
mapContentRefs.value.initMap("residentContainer"); mapContentRefs.value.initMap("residentContainer");
}); });
}); });
// 选择时间 // 快捷选择时间
const selectTime = (e) => { const selectTime = (e) => {
seledtedItem.value = e;
switch (e) { switch (e) {
case 0: case 0:
searchTime.value = [ searchTime.value = [
...@@ -206,24 +208,33 @@ export default defineComponent({ ...@@ -206,24 +208,33 @@ export default defineComponent({
moment().format("YYYY-MM-DD HH:mm:ss"), moment().format("YYYY-MM-DD HH:mm:ss"),
]; ];
showTimePicker.value = false; showTimePicker.value = false;
currentDateText.value = "自定义"; seledtedItem.value = e;
getData();
break; break;
case 1: case 1:
searchTime.value = [ searchTime.value = [
moment().subtract(30, "day").format("YYYY-MM-DD HH:mm:ss"), moment().subtract(30, "day").format("YYYY-MM-DD HH:mm:ss"),
moment().format("YYYY-MM-DD HH:mm:ss"), moment().format("YYYY-MM-DD HH:mm:ss"),
]; ];
currentDateText.value = "自定义";
showTimePicker.value = false; showTimePicker.value = false;
seledtedItem.value = e;
getData();
break; break;
case 2: case 2:
showTimePicker.value = true; showTimePicker.value = true;
break; break;
} }
}; };
// 时间选择确定 // 自定义时间选择
const change = (e) => { const change = (e) => {
currentDate.value = e; currentDate.value = e;
currentDateText.value = moment(e).format("YYYY-MM");
searchTime.value = [
moment(e).format("YYYY-MM-DD HH:mm:ss"),
moment(e).endOf("month").format("YYYY-MM-DD HH:mm:ss"),
];
seledtedItem.value = timeBtnList.findIndex((item) => item == "自定义");
getData();
}; };
// 获取数据 // 获取数据
const getData = (map) => { const getData = (map) => {
...@@ -237,6 +248,8 @@ export default defineComponent({ ...@@ -237,6 +248,8 @@ export default defineComponent({
if (res.data.length > 0) { if (res.data.length > 0) {
init(currentMap, res.data); init(currentMap, res.data);
} else { } else {
currentMap.clearMap();
residentList.value = [];
Dialog({ message: "暂无数据" }); Dialog({ message: "暂无数据" });
} }
} }
...@@ -256,8 +269,7 @@ export default defineComponent({ ...@@ -256,8 +269,7 @@ export default defineComponent({
var lnglat = new window.AMap.LngLat(item.elng, item.elat); var lnglat = new window.AMap.LngLat(item.elng, item.elat);
var marker = new window.AMap.Marker({ var marker = new window.AMap.Marker({
position: lnglat, position: lnglat,
content: content: '<span class="icon icon-resident"></span>',
'<span class="icon icon-resident" 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),
}); });
...@@ -286,9 +298,8 @@ export default defineComponent({ ...@@ -286,9 +298,8 @@ export default defineComponent({
}; };
// 导航 // 导航
const navigation = (data) => { const navigation = (data) => {
console.log(data.transferAddress);
wx.miniProgram.navigateTo({ wx.miniProgram.navigateTo({
url: `../../pages/navgation/index?lat=${data.elat}&lng=${data.elng}&address=${data.transferAddress}`, url: `../../mapPackage/pages/tracking?lat=${data.elat}&lng=${data.elng}&address=${data.transferAddress}`,
}); });
}; };
// 复制地址 // 复制地址
...@@ -320,42 +331,57 @@ export default defineComponent({ ...@@ -320,42 +331,57 @@ export default defineComponent({
residentList, residentList,
selectTime, selectTime,
searchTime, searchTime,
showTimeDialog,
timeBtnList, timeBtnList,
changey, changey,
listScroll, listScroll,
saveTime, saveTime,
formatter, formatter,
maxDate, maxDate,
dateTimePicker,
}; };
}, },
}); });
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.searchControll { .info-content {
position: fixed; .map-box {
top: 70px; height: calc(100% - 44px) !important;
right: 12px; }
width: 40px; }
height: 52px; .tab {
height: 28px;
background: #fff; background: #fff;
z-index: 300; padding: 8px 16px;
.tabbar {
background: #f5f6f7;
border-radius: 6px;
height: 28px;
display: flex; display: flex;
flex-flow: column;
align-items: center;
justify-content: center; justify-content: center;
.screen-text { align-items: center;
font-size: 16px; .time_btn {
display: inline-block; height: 24px;
transform: scale(0.5); font-size: 14px;
line-height: 24px;
color: #6c737a;
flex: 1;
margin: 0 1px;
text-align: center;
}
.time_btn.active {
background: #fff;
border-radius: 4px;
color: var(--base-color);
}
} }
} }
.time-content { .time-content {
background: #fff; background: #fff;
color: #999; color: #999;
display: flex; display: flex;
width: calc(100% - 16px); box-sizing: border-box;
width: 100%;
padding: 20px 8px; padding: 20px 8px;
overflow: hidden; overflow: hidden;
.time_btn { .time_btn {
...@@ -397,21 +423,33 @@ export default defineComponent({ ...@@ -397,21 +423,33 @@ export default defineComponent({
} }
} }
.list-content-resident { .list-content-resident {
width: calc(100% - 30px); box-sizing: border-box;
padding: 5px 15px 0 15px; width: 100%;
padding-top: 5px;
font-size: 14px; font-size: 14px;
.list-item { .list-item {
height: 68px; height: 68px;
display: flex; display: flex;
width: 100%;
justify-content: space-between;
.icon-loc-icon { .icon-loc-icon {
margin-top: 7px; margin-top: 7px;
flex-shrink: 0;
} }
.text-content {
flex-shrink: 0;
border-bottom: 1px solid #f0f2f5;
display: flex;
flex: 1;
width: 0;
.left { .left {
padding: 12px 10px 12px 0; padding: 12px 10px 12px 0;
border-bottom: 1px solid #f0f2f5; flex: 1;
width: 0;
display: flex;
flex-flow: column;
.title { .title {
color: #000; color: #000;
width: 224px;
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
...@@ -427,16 +465,14 @@ export default defineComponent({ ...@@ -427,16 +465,14 @@ export default defineComponent({
} }
.right { .right {
padding: 12px 0;
border-bottom: 1px solid #f0f2f5;
display: flex; display: flex;
align-items: center; align-items: center;
a { button {
display: flex; display: flex;
flex-flow: column; flex-flow: column;
align-items: center; align-items: center;
} }
.navigate { .button-class {
i { i {
display: inline-block; display: inline-block;
} }
...@@ -446,15 +482,6 @@ export default defineComponent({ ...@@ -446,15 +482,6 @@ export default defineComponent({
transform: scale(0.5); transform: scale(0.5);
} }
} }
.copy-adr {
i {
display: inline-block;
}
span {
color: #6c737a;
font-size: 20px;
transform: scale(0.5);
}
} }
} }
} }
...@@ -482,4 +509,7 @@ export default defineComponent({ ...@@ -482,4 +509,7 @@ export default defineComponent({
border-radius: 4px; border-radius: 4px;
padding: 10px; padding: 10px;
} }
.van-picker__toolbar {
display: none;
}
</style> </style>
<template> <template>
<div> <div class="info-content">
<mapContent ref="mapContentRefs"> <mapContent ref="mapContentRefs">
<template #mapBox> <template #mapBox>
<div id="shareContainer" class="map-container"></div> <div id="shareContainer" class="map-container"></div>
......
...@@ -11,10 +11,18 @@ function resolve(dir) { ...@@ -11,10 +11,18 @@ function resolve(dir) {
return path.join(__dirname, ".", dir); return path.join(__dirname, ".", dir);
} }
module.exports = defineConfig({ module.exports = defineConfig({
publicPath: "/miniapp/", publicPath: "./",
transpileDependencies: true, transpileDependencies: true,
devServer: { devServer: {
port: 9527, port: 9527,
proxy: {
'/api': {
target: 'https://eshield.dev.glsx.com.cn/',
changeOrigin: true,
secure: false,
pathRewrite: { "^/api": "" },
}
}
}, },
chainWebpack: (config) => { chainWebpack: (config) => {
config.plugin("webpack-spritesmith").use(Spritesmith, [ 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!