Commit 903645f1 authored by “yiyousong”'s avatar “yiyousong”

feat:添加临时启停用效果

parent 109d41a5
#生产环境 #生产环境
NODE_ENV = "production" NODE_ENV = "production"
VUE_APP_API_PHP_URL=/basics_api VUE_APP_API_PHP_URL=zwfw_api/
...@@ -2,19 +2,22 @@ ...@@ -2,19 +2,22 @@
<div class="app"> <div class="app">
<router-view></router-view> <router-view></router-view>
<NetworkError :isShowError="isShowError"></NetworkError> <NetworkError :isShowError="isShowError"></NetworkError>
<EnabledDev :enabled="enabled"></EnabledDev>
</div> </div>
</template> </template>
<script> <script>
import local from "@/utils/local"; import local from "@/utils/local";
import NetworkError from "@/components/NetworkError.vue"; import NetworkError from "@/components/NetworkError.vue";
import EnabledDev from "@/components/EnabledDev.vue";
import mq from "@/mixin/mq"; import mq from "@/mixin/mq";
import { getHomeInfo, getSkinList } from "@/api"; import { getHomeInfo, getSkinList, getDeviceList } from "@/api";
import { mapMutations } from "vuex"; import { mapMutations } from "vuex";
export default { export default {
mixins: [mq], mixins: [mq],
components: { components: {
NetworkError, NetworkError,
EnabledDev,
}, },
data() { data() {
return { return {
...@@ -22,10 +25,12 @@ export default { ...@@ -22,10 +25,12 @@ export default {
devicenum: "", devicenum: "",
linkDom: null, // 换皮 linkDom: null, // 换皮
isShowError: false, isShowError: false,
enabled: 1,
}; };
}, },
watch: { watch: {
"$route.path"(newVal) { "$route.path"(newVal) {
this.getDeviceList();
if (newVal == "/" || newVal == "/home") { if (newVal == "/" || newVal == "/home") {
this.getHomeInfo(); this.getHomeInfo();
this.getSetinfo(); this.getSetinfo();
...@@ -59,7 +64,7 @@ export default { ...@@ -59,7 +64,7 @@ export default {
}, },
serviceInfo: { serviceInfo: {
homeUrl: "http://192.168.0.24:8080/#/", homeUrl: "http://192.168.0.24:8080/#/",
serverUrl: "http://192.168.0.98:11078/", serverUrl: "http://112.19.80.237:11078/",
}, },
devicenum: "18-93-7F-C0-AD-B5", devicenum: "18-93-7F-C0-AD-B5",
// devicenum: "B8-13-32-86-9F-04", // devicenum: "B8-13-32-86-9F-04",
...@@ -79,6 +84,7 @@ export default { ...@@ -79,6 +84,7 @@ export default {
window.addEventListener("offline", () => { window.addEventListener("offline", () => {
this.isShowError = true; this.isShowError = true;
}); });
this.getDevInfo();
}, },
methods: { methods: {
...mapMutations([ ...mapMutations([
...@@ -148,6 +154,24 @@ export default { ...@@ -148,6 +154,24 @@ export default {
} }
} }
}, },
async getDeviceList() {
let res = await getDeviceList({
page: 1,
size: -1,
});
if (res.data.code == 1) {
let { data } = res.data.data;
if (!data.length) return;
let { enabled } = data[0];
this.enabled = enabled;
}
},
// 轮询设备状态
getDevInfo() {
this.timer = setInterval(() => {
this.getDeviceList();
}, 1000 * 60);
},
}, },
}; };
</script> </script>
......
...@@ -117,9 +117,23 @@ export const getSkinList = (data) => { ...@@ -117,9 +117,23 @@ export const getSkinList = (data) => {
}; };
// 排队编号查询对应事项 // 排队编号查询对应事项
export const getMatterForFlownum = (params) => { export const getMatterForFlownum = (params) => {
let baseUrl = local.getLocal("serverUrl");
return request({ return request({
url: `${PHP_URL}/api/matter/matterForFlownum`, url: `${baseUrl}${PHP_URL}api/matter/matterForFlownum`,
method: "get", method: "get",
params, params,
}); });
}; };
//获取设备列表
export const getDeviceList = (data) => {
let baseUrl = local.getLocal("serverUrl");
let deviceCode = local.getLocal("devicenum");
return request({
url: `${baseUrl}sampleform/device/list`,
method: "post",
data: {
deviceCode,
...data,
},
});
};
<template>
<div class="enabled" v-show="!enabled">
<div class="enabled_box">
<img class="enabled_img" src="../assets/img/tingyong.png" />
</div>
</div>
</template>
<script>
export default {
props: {
enabled: {
type: Number,
required: true,
default: 1,
},
},
};
</script>
<style lang="less" scoped>
.enabled {
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.2);
position: fixed;
top: 0px;
left: 0px;
z-index: 9999;
display: flex;
align-items: center;
justify-content: center;
.enabled_box {
width: 400px;
height: 400px;
background-color: #fff;
border-radius: 4px;
.enabled_img {
width: 100%;
height: 100%;
}
}
}
</style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment