Commit 36e44c2d authored by limeimei's avatar limeimei

2

parent 674b093c
Pipeline #2359 canceled with stages
...@@ -2527,6 +2527,19 @@ ...@@ -2527,6 +2527,19 @@
"lodash": "^4.17.14" "lodash": "^4.17.14"
} }
}, },
"async-validator": {
"version": "1.8.5",
"resolved": "https://registry.npmmirror.com/async-validator/-/async-validator-1.8.5.tgz",
"integrity": "sha512-tXBM+1m056MAX0E8TL2iCjg8WvSyXu0Zc8LNtYqrVeyoL3+esHRZ4SieE9fKQyyU09uONjnMEjrNBMqT0mbvmA==",
"requires": {
"babel-runtime": "6.x"
}
},
"asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmmirror.com/asynckit/-/asynckit-0.4.0.tgz",
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
},
"at-least-node": { "at-least-node": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmmirror.com/at-least-node/-/at-least-node-1.0.0.tgz", "resolved": "https://registry.npmmirror.com/at-least-node/-/at-least-node-1.0.0.tgz",
...@@ -2547,6 +2560,21 @@ ...@@ -2547,6 +2560,21 @@
"postcss-value-parser": "^4.2.0" "postcss-value-parser": "^4.2.0"
} }
}, },
"axios": {
"version": "1.6.7",
"resolved": "https://registry.npmmirror.com/axios/-/axios-1.6.7.tgz",
"integrity": "sha512-/hDJGff6/c7u0hDkvkGxR/oy6CbCs8ziCsC7SqmhjfozqiJGc8Z11wrv9z9lYfY4K8l+H9TpjcMDX0xOZmx+RA==",
"requires": {
"follow-redirects": "^1.15.4",
"form-data": "^4.0.0",
"proxy-from-env": "^1.1.0"
}
},
"babel-helper-vue-jsx-merge-props": {
"version": "2.0.3",
"resolved": "https://registry.npmmirror.com/babel-helper-vue-jsx-merge-props/-/babel-helper-vue-jsx-merge-props-2.0.3.tgz",
"integrity": "sha512-gsLiKK7Qrb7zYJNgiXKpXblxbV5ffSwR0f5whkPAaBAR4fhi6bwRZxX9wBlIc5M/v8CCkXUbXZL4N/nSE97cqg=="
},
"babel-loader": { "babel-loader": {
"version": "8.3.0", "version": "8.3.0",
"resolved": "https://registry.npmmirror.com/babel-loader/-/babel-loader-8.3.0.tgz", "resolved": "https://registry.npmmirror.com/babel-loader/-/babel-loader-8.3.0.tgz",
...@@ -2628,6 +2656,27 @@ ...@@ -2628,6 +2656,27 @@
} }
} }
}, },
"babel-runtime": {
"version": "6.26.0",
"resolved": "https://registry.npmmirror.com/babel-runtime/-/babel-runtime-6.26.0.tgz",
"integrity": "sha512-ITKNuq2wKlW1fJg9sSW52eepoYgZBggvOAHC0u/CYu/qxQ9EVzThCgR69BnSXLHjy2f7SY5zaQ4yt7H9ZVxY2g==",
"requires": {
"core-js": "^2.4.0",
"regenerator-runtime": "^0.11.0"
},
"dependencies": {
"core-js": {
"version": "2.6.12",
"resolved": "https://registry.npmmirror.com/core-js/-/core-js-2.6.12.tgz",
"integrity": "sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ=="
},
"regenerator-runtime": {
"version": "0.11.1",
"resolved": "https://registry.npmmirror.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz",
"integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg=="
}
}
},
"balanced-match": { "balanced-match": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmmirror.com/balanced-match/-/balanced-match-1.0.2.tgz", "resolved": "https://registry.npmmirror.com/balanced-match/-/balanced-match-1.0.2.tgz",
...@@ -3056,6 +3105,14 @@ ...@@ -3056,6 +3105,14 @@
"integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==",
"dev": true "dev": true
}, },
"combined-stream": {
"version": "1.0.8",
"resolved": "https://registry.npmmirror.com/combined-stream/-/combined-stream-1.0.8.tgz",
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
"requires": {
"delayed-stream": "~1.0.0"
}
},
"commander": { "commander": {
"version": "2.20.3", "version": "2.20.3",
"resolved": "https://registry.npmmirror.com/commander/-/commander-2.20.3.tgz", "resolved": "https://registry.npmmirror.com/commander/-/commander-2.20.3.tgz",
...@@ -3480,8 +3537,7 @@ ...@@ -3480,8 +3537,7 @@
"deepmerge": { "deepmerge": {
"version": "1.5.2", "version": "1.5.2",
"resolved": "https://registry.npmmirror.com/deepmerge/-/deepmerge-1.5.2.tgz", "resolved": "https://registry.npmmirror.com/deepmerge/-/deepmerge-1.5.2.tgz",
"integrity": "sha512-95k0GDqvBjZavkuvzx/YqVLv/6YYa17fz6ILMSf7neqQITCPbnfEnQvEgMPNjH4kgobe7+WIL0yJEHku+H3qtQ==", "integrity": "sha512-95k0GDqvBjZavkuvzx/YqVLv/6YYa17fz6ILMSf7neqQITCPbnfEnQvEgMPNjH4kgobe7+WIL0yJEHku+H3qtQ=="
"dev": true
}, },
"default-gateway": { "default-gateway": {
"version": "6.0.3", "version": "6.0.3",
...@@ -3610,6 +3666,11 @@ ...@@ -3610,6 +3666,11 @@
"object-keys": "^1.1.1" "object-keys": "^1.1.1"
} }
}, },
"delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmmirror.com/delayed-stream/-/delayed-stream-1.0.0.tgz",
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ=="
},
"depd": { "depd": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmmirror.com/depd/-/depd-2.0.0.tgz", "resolved": "https://registry.npmmirror.com/depd/-/depd-2.0.0.tgz",
...@@ -3746,6 +3807,19 @@ ...@@ -3746,6 +3807,19 @@
"integrity": "sha512-qRq74Mo7ChePOU6GHdfAJ0NREXU8vQTlVlfWz3wNygFay6xrd/fY2J7oGHwrhFeU30OVctGLdTh/FcnokTWpng==", "integrity": "sha512-qRq74Mo7ChePOU6GHdfAJ0NREXU8vQTlVlfWz3wNygFay6xrd/fY2J7oGHwrhFeU30OVctGLdTh/FcnokTWpng==",
"dev": true "dev": true
}, },
"element-ui": {
"version": "2.15.14",
"resolved": "https://registry.npmmirror.com/element-ui/-/element-ui-2.15.14.tgz",
"integrity": "sha512-2v9fHL0ZGINotOlRIAJD5YuVB8V7WKxrE9Qy7dXhRipa035+kF7WuU/z+tEmLVPBcJ0zt8mOu1DKpWcVzBK8IA==",
"requires": {
"async-validator": "~1.8.1",
"babel-helper-vue-jsx-merge-props": "^2.0.0",
"deepmerge": "^1.2.0",
"normalize-wheel": "^1.0.1",
"resize-observer-polyfill": "^1.5.0",
"throttle-debounce": "^1.0.1"
}
},
"emoji-regex": { "emoji-regex": {
"version": "8.0.0", "version": "8.0.0",
"resolved": "https://registry.npmmirror.com/emoji-regex/-/emoji-regex-8.0.0.tgz", "resolved": "https://registry.npmmirror.com/emoji-regex/-/emoji-regex-8.0.0.tgz",
...@@ -4120,8 +4194,17 @@ ...@@ -4120,8 +4194,17 @@
"follow-redirects": { "follow-redirects": {
"version": "1.15.6", "version": "1.15.6",
"resolved": "https://registry.npmmirror.com/follow-redirects/-/follow-redirects-1.15.6.tgz", "resolved": "https://registry.npmmirror.com/follow-redirects/-/follow-redirects-1.15.6.tgz",
"integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==", "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA=="
"dev": true },
"form-data": {
"version": "4.0.0",
"resolved": "https://registry.npmmirror.com/form-data/-/form-data-4.0.0.tgz",
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
"requires": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"mime-types": "^2.1.12"
}
}, },
"forwarded": { "forwarded": {
"version": "0.2.0", "version": "0.2.0",
...@@ -5174,14 +5257,12 @@ ...@@ -5174,14 +5257,12 @@
"mime-db": { "mime-db": {
"version": "1.52.0", "version": "1.52.0",
"resolved": "https://registry.npmmirror.com/mime-db/-/mime-db-1.52.0.tgz", "resolved": "https://registry.npmmirror.com/mime-db/-/mime-db-1.52.0.tgz",
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg=="
"dev": true
}, },
"mime-types": { "mime-types": {
"version": "2.1.35", "version": "2.1.35",
"resolved": "https://registry.npmmirror.com/mime-types/-/mime-types-2.1.35.tgz", "resolved": "https://registry.npmmirror.com/mime-types/-/mime-types-2.1.35.tgz",
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
"dev": true,
"requires": { "requires": {
"mime-db": "1.52.0" "mime-db": "1.52.0"
} }
...@@ -5421,6 +5502,11 @@ ...@@ -5421,6 +5502,11 @@
"integrity": "sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A==", "integrity": "sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A==",
"dev": true "dev": true
}, },
"normalize-wheel": {
"version": "1.0.1",
"resolved": "https://registry.npmmirror.com/normalize-wheel/-/normalize-wheel-1.0.1.tgz",
"integrity": "sha512-1OnlAPZ3zgrk8B91HyRj+eVv+kS5u+Z0SCsak6Xil/kmgEia50ga7zfkumayonZrImffAxPU/5WcyGhzetHNPA=="
},
"npm-run-path": { "npm-run-path": {
"version": "2.0.2", "version": "2.0.2",
"resolved": "https://registry.npmmirror.com/npm-run-path/-/npm-run-path-2.0.2.tgz", "resolved": "https://registry.npmmirror.com/npm-run-path/-/npm-run-path-2.0.2.tgz",
...@@ -6176,6 +6262,11 @@ ...@@ -6176,6 +6262,11 @@
} }
} }
}, },
"proxy-from-env": {
"version": "1.1.0",
"resolved": "https://registry.npmmirror.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="
},
"pseudomap": { "pseudomap": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmmirror.com/pseudomap/-/pseudomap-1.0.2.tgz", "resolved": "https://registry.npmmirror.com/pseudomap/-/pseudomap-1.0.2.tgz",
...@@ -6397,6 +6488,11 @@ ...@@ -6397,6 +6488,11 @@
"integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==", "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==",
"dev": true "dev": true
}, },
"resize-observer-polyfill": {
"version": "1.5.1",
"resolved": "https://registry.npmmirror.com/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz",
"integrity": "sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg=="
},
"resolve": { "resolve": {
"version": "1.22.8", "version": "1.22.8",
"resolved": "https://registry.npmmirror.com/resolve/-/resolve-1.22.8.tgz", "resolved": "https://registry.npmmirror.com/resolve/-/resolve-1.22.8.tgz",
...@@ -7019,6 +7115,11 @@ ...@@ -7019,6 +7115,11 @@
} }
} }
}, },
"throttle-debounce": {
"version": "1.1.0",
"resolved": "https://registry.npmmirror.com/throttle-debounce/-/throttle-debounce-1.1.0.tgz",
"integrity": "sha512-XH8UiPCQcWNuk2LYePibW/4qL97+ZQ1AN3FNXwZRBNPPowo/NRU5fAlDCSNBJIYCKbioZfuYtMhG4quqoJhVzg=="
},
"thunky": { "thunky": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmmirror.com/thunky/-/thunky-1.1.0.tgz", "resolved": "https://registry.npmmirror.com/thunky/-/thunky-1.1.0.tgz",
......
...@@ -7,7 +7,9 @@ ...@@ -7,7 +7,9 @@
"build": "vue-cli-service build" "build": "vue-cli-service build"
}, },
"dependencies": { "dependencies": {
"axios": "^1.6.7",
"core-js": "^3.8.3", "core-js": "^3.8.3",
"element-ui": "^2.15.14",
"vue": "^2.6.14", "vue": "^2.6.14",
"vue-router": "^3.5.1" "vue-router": "^3.5.1"
}, },
......
<template> <template>
<div id="app"> <div id="app">
<nav> <el-button @click="login ">登录</el-button>
<router-link to="/">Home</router-link> | <router-view />
<router-link to="/about">About</router-link>
</nav>
<router-view/>
</div> </div>
</template> </template>
<script>
import http from "./utils/http";
export default {
data() {
return {
};
},
methods: {
login() {
http.post("/sys/dev/user/login", {
autoLogin: true,
userLogin: 'sixiang',
userPassword: 'qwe123',
}).then((res) => {
if (res.code == 200) {
// localStorage.removeItem("token");
localStorage.setItem('token', res.data.token)
console.log(localStorage.getItem('token'))
}
});
},
// 关闭弹窗
handleClick(tab, event) {
// this.$refs.employees.resetFields();
// this.$emit("close");
},
},
};
</script>
<style> <style>
#app { html,
font-family: Avenir, Helvetica, Arial, sans-serif; body {
-webkit-font-smoothing: antialiased; padding: 0;
-moz-osx-font-smoothing: grayscale; margin: 0;
text-align: center; width: 100%;
color: #2c3e50; height: 100%;
} }
</style>
nav { \ No newline at end of file
padding: 30px;
}
nav a {
font-weight: bold;
color: #2c3e50;
}
nav a.router-link-exact-active {
color: #42b983;
}
</style>
<template> <template>
<div class="hello"> <div class="hello">
<h1>{{ msg }}</h1> <el-button type="primary" @click="goClick">登录</el-button>
<p>
For a guide and recipes on how to configure / customize this project,<br>
check out the
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
</p>
<h3>Installed CLI Plugins</h3>
<ul>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener">babel</a></li>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-router" target="_blank" rel="noopener">router</a></li>
</ul>
<h3>Essential Links</h3>
<ul>
<li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
<li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
<li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
<li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
<li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
</ul>
<h3>Ecosystem</h3>
<ul>
<li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
<li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
<li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li>
<li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
</ul>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
name: 'HelloWorld', name: 'HelloWorld',
props: { props: {
msg: String msg: String
},
methods: {
goClick() {
this.$router.push({ name: '/index' })
}
}
} }
}
</script> </script>
<!-- Add "scoped" attribute to limit CSS to this component only --> <!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped> <style scoped>
h3 { h3 {
margin: 40px 0 0; margin: 40px 0 0;
} }
ul {
list-style-type: none; ul {
padding: 0; list-style-type: none;
} padding: 0;
li { }
display: inline-block;
margin: 0 10px; li {
} display: inline-block;
a { margin: 0 10px;
color: #42b983; }
}
</style> a {
color: #42b983;
}
</style>
\ No newline at end of file
<template>
<div class="wrapper">
<div class="top">
<div class="top_item"><span class="top_item_title">设备SN</span><span class="top_item_con">1111</span></div>
<div class="top_item"><span class="top_item_title">设备状态</span><span class="top_item_con">1111</span></div>
<div class="top_item"><span class="top_item_title">设备温度</span><span class="top_item_con">1111</span></div>
<div class="top_item"><span class="top_item_title">设备总功率</span><span class="top_item_con">1111</span></div>
</div>
<div class="center">
<div v-for="item in list" :key="item.id">
<div class="center_item">
<el-button type="primary">通道{{item.id +1}}</el-button>
<div class="item_table_w">
<div class="item_table">
<div class="item_text"><span style="margin-right: 37px;">电流</span> <span>14A</span>
</div>
<div class="item_text2"><span style="margin-right: 37px;">电压</span><span>14A</span> </div>
</div>
<img src="@/assets/img/box.png" alt="" class="item_img">
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import http from "../utils/http";
export default {
data() {
return {
list: [],
};
},
created() {
// this.getList()
},
methods: {
getList() {
console.log(localStorage.getItem('token'))
// return
http.post("/sys/dev/device/runtime/list", {
currentPage: 1,
deviceName: '6D8X05-X5NAGR',
identifier: 'gfConfluenceMachine',
productKey: '1TOMLS7WC58409644',
type: 'event'
}).then((res) => {
if (res.code == 200) {
let arr = res.data.list[0].value.allPathElect
let arr2 = res.data.list[0].value.allPathPower
arr.map((item, index) => {
this.list.push({ id: index, voltage: arr2[index], electric: item })
})
}
});
},
// 关闭弹窗
handleClick() {
this.$refs.employees.resetFields();
this.$emit("close");
},
},
};
</script>
<style scoped>
.wrapper {
background: #F4F7FC;
height: 100vh;
padding: 40px;
}
.top {
display: flex;
}
.top_item {
width: 300px;
height: 150px;
background: #FFFFFF;
box-shadow: 0px 1px 4px 1px rgba(21, 34, 50, 0.08);
border-radius: 6px 6px 6px 6px;
display: flex;
flex-direction: column;
padding: 20px;
margin-right: 40px;
}
.top_item_title {
font-size: 18px;
color: #7E84A3;
margin-bottom: 34px;
}
.top_item_con {
font-size: 28px;
color: #131523;
}
.center {
background: #FFFFFF;
display: flex;
margin-top: 40px;
}
.center_item {
width: 227px;
display: flex;
flex-direction: column;
align-items: center;
margin-top: 34px;
}
.item_table_w {
display: flex;
flex-direction: column;
border-right: 1px solid #E5E5E5;
width: 227px;
align-items: center;
margin-bottom: 38px;
}
.item_table {
border: 1px solid #B1B1B1;
line-height: 32px;
width: 152px;
text-align: center;
font-size: 18px;
color: #333333;
margin: 14px 0 36px 0;
}
.item_text {
border-bottom: 1px solid #B1B1B1;
}
.item_img {
width: 35.76px;
height: 150.37px;
}
</style>
\ No newline at end of file
<script setup lang="ts">
import { ref, onMounted } from 'vue'
import Direct from './direct.vue'
import { UserService } from '/src/utils/api.ts'
onMounted(() => {
// login1()
})
const login1 = async () => {
const loginParams = {
autoLogin: true,
username: 'sixiang',
password: 'qwe123',
}
const res = await UserService.login1(loginParams)
// console.log(res)
}
let activeName = ref(0)
const handleClick = (tab) => {
console.log(tab.props.name)
}
</script>
<template>
<div class="wrapper">
<div class="header">
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="光伏智能直流汇流箱" name="0">
<Direct />
</el-tab-pane>
<el-tab-pane label="配置管理" name="second">光伏智能交流汇流箱</el-tab-pane>
<el-tab-pane label="角色管理" name="third">光伏智能并网箱</el-tab-pane>
</el-tabs>
</div>
</div>
</template>
<style scoped>
.wrapper {
/* background: #F4F7FC; */
}
/* :deep(.el-tabs) {
--el-tabs-header-height: 70px;
}
:deep(.el-tabs__header) {
margin: 0;
background: white;
margin-left: 50px;
}
:deep(.el-tabs__nav-wrap::after) {
height: 0px;
} */
</style>
\ No newline at end of file
<template>
<div class="wrapper">
<div class="header">
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="光伏智能直流汇流箱" name="0">
<Direct />
</el-tab-pane>
<el-tab-pane label="配置管理" name="second">光伏智能交流汇流箱</el-tab-pane>
<el-tab-pane label="角色管理" name="third">光伏智能并网箱</el-tab-pane>
</el-tabs>
</div>
</div>
</template>
<script>
import http from "../utils/http";
import Direct from './direct.vue'
export default {
components: {
Direct
},
data() {
return {
activeName: '0',
};
},
created() {
// this.login()
},
watch: {
},
methods: {
login() {
http.post("/sys/dev/user/login", {
autoLogin: true,
userLogin: 'sixiang',
userPassword: 'qwe123',
}).then((res) => {
if (res.code == 200) {
// localStorage.removeItem("token");
localStorage.setItem('token', res.data.token)
console.log(localStorage.getItem('token'))
}
});
},
// 关闭弹窗
handleClick(tab, event) {
// this.$refs.employees.resetFields();
// this.$emit("close");
},
},
};
</script>
<style scoped>
.wrapper {
/* background: #F4F7FC; */
}
::v-deep .el-tabs {
--el-tabs-header-height: 70px;
}
::v-deep .el-tabs__header {
margin: 0;
background: white;
margin-left: 50px;
}
::v-deep.el-tabs__nav-wrap::after {
height: 0px;
}
</style>
\ No newline at end of file
import Vue from 'vue' import Vue from 'vue'
import App from './App.vue' import App from './App.vue'
import router from './router' import router from './router'
import ElementUI from 'element-ui'
Vue.config.productionTip = false Vue.config.productionTip = false
Vue.use(ElementUI);
new Vue({ new Vue({
router, router,
......
import Vue from 'vue' import Vue from 'vue'
import VueRouter from 'vue-router' import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue' // import HomeView from '../views/HomeView.vue'
import HomeView from '../components/index.vue'
Vue.use(VueRouter) Vue.use(VueRouter)
const routes = [ const routes = [
{ {
path: '/', path: '/index',
name: 'home', name: 'home',
component: HomeView component: HomeView
}, },
...@@ -21,7 +21,7 @@ const routes = [ ...@@ -21,7 +21,7 @@ const routes = [
] ]
const router = new VueRouter({ const router = new VueRouter({
mode: 'history', mode: 'hash',
base: process.env.BASE_URL, base: process.env.BASE_URL,
routes routes
}) })
......
// 公用地址F
// const BASE_URL = '120.77.240.215' //测试环境
const BASE_URL = "/api"; //正式环境(端口5681,ws:5683),这里不加端口,socket位置会有冲突,端口在http.js文件里面加
// const BASE_URL = "192.168.1.132:5681/";
export default {
BASE_URL,
};
/**** http.js ****/
// 导入封装好的axios实例
import request from "./request";
import GLOBAL from "../utils/common";
const baseURL = GLOBAL.BASE_URL;
// 正式环境
const http = {
/**
* methods: 请求
* @param url 请求地址
* @param params 请求参数
*/
get(url, params) {
const config = {
method: "get",
url: baseURL + url,
};
if (params) config.params = params;
return request(config);
},
post(url, params) {
const config = {
method: "post",
url: baseURL + url,
};
if (params) config.data = params;
return request(config);
},
put(url, params) {
const config = {
method: "put",
url: baseURL + url,
};
if (params) config.params = params;
return request(config);
},
delete(url, params) {
const config = {
method: "delete",
url: baseURL + url,
};
if (params) config.params = params;
return request(config);
},
};
//导出
export default http;
/**** request.js ****/
// 导入axios
import axios from "axios";
import http from "./http";
import router from "../router";
// 使用element-ui Message做消息提醒
import { Message } from "element-ui";
//1. 创建新的axios实例,
const service = axios.create({
// 公共接口
baseURL: process.env.BASE_API,
// 超时时间 单位是ms,这里设置了3s的超时时间
timeout: 10 * 1000,
});
// 2.请求拦截器
service.interceptors.request.use(
(config) => {
//发请求前做的一些处理,数据转化,配置请求头,设置token,设置loading等,根据需求去添加
config.data = JSON.stringify(config.data); //数据转化,也可以使用qs转换
config.headers = {
"Content-Type": "application/json", //配置请求头
};
// 这里可以用本地储存去拿token
const token = localStorage.getItem("token"); //localStorage
// const session = sessionStorage.getItem('token') //sessionStorage
if (token) {
config.headers.Authorization = "Bearer " + token; //如果要求携带在请求头中
}
return config;
},
(error) => {
console.log(33333)
Promise.reject(error);
}
);
// 3.响应拦截器
service.interceptors.response.use(
(response) => {
console.log(response)
console.log(222222)
//接收到响应数据并成功后的一些共有的处理,关闭loading等
// token过期,请重新登录
if (response.code == 401) {
localStorage.removeItem("token");
// Message.warning(response.data.msg);
router.replace("/");
// http.post("/sys/dev/user/login", {
// autoLogin: true,
// userLogin: 'sixiang',
// userPassword: 'qwe123',
// }).then((res) => {
// if (res.code == 200) {
// localStorage.setItem('token', res.data.token)
// }
// });
}
return response.data;
},
(error) => {
console.log(error)
/***** 接收到异常响应的处理开始 *****/
if (error && error.response) {
// 1.公共错误处理
// 2.根据响应码具体处理
switch (error.response.status) {
case 400:
error.message = "错误请求";
break;
case 401:
error.message = "未授权,请重新登录";
break;
case 403:
error.message = "拒绝访问";
break;
case 404:
error.message = "请求错误,未找到该资源";
break;
case 405:
error.message = "请求方法未允许";
break;
case 408:
error.message = "请求超时";
break;
case 500:
error.message = "服务器端出错";
break;
case 501:
error.message = "网络未实现";
break;
case 502:
error.message = "网络错误";
break;
case 503:
error.message = "服务不可用";
break;
case 504:
error.message = "网络超时";
break;
case 505:
error.message = "http版本不支持该请求";
break;
default:
error.message = `连接错误${error.response.status}`;
}
} else {
// console.log(error)
// 超时处理
if (JSON.stringify(error).includes("timeout")) {
Message.error("服务器响应超时,请刷新当前页");
}
error.message = "连接服务器失败";
}
Message.error(error.message);
/***** 处理结束 *****/
//如果不需要错误处理,以上的处理过程都可省略
// return Promise.resolve(error.response);
}
);
//4.导入文件
export default service;
let webSocket = null;
let socketOpen = false;
let _that = null;
var isactive = false;
var lockReconnect = false; //避免ws重复连接
import common from "./common";
export const init = (item) => {
_that = item;
};
// 发送消息
export const doSend = (message) => {
if (socketOpen) {
webSocket.send(message);
}
};
export const doclose = () => {
if (socketOpen) {
isactive = true;
webSocket.close();
}
};
function convert(timestamp) {
var date = null;
if (timestamp.length == 10) {
date = new Date(timestamp * 1000);
} else {
date = new Date(timestamp);
}
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, "0");
const day = String(date.getDate()).padStart(2, "0");
const hours = String(date.getHours()).padStart(2, "0");
const minutes = String(date.getMinutes()).padStart(2, "0");
const seconds = String(date.getSeconds()).padStart(2, "0");
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
}
function reconnect() {
if (lockReconnect) return;
lockReconnect = true;
setTimeout(function () {
//没连接上会一直重连,设置延迟避免请求过多
contactSocket();
lockReconnect = false;
}, 2000);
}
// 初始化websocket
export const contactSocket = () => {
try {
if ("WebSocket" in window) {
webSocket = new WebSocket("ws://" + common.BASE_URL + ":5683" + "/ws");
socketOpen = true;
webSocket.onopen = function () {
console.log("连接成功!");
};
webSocket.onmessage = function (evt) {
var received_msg = evt.data;
var data = JSON.parse(received_msg);
// 判断是消息还是坐标
if (Array.isArray(data.label)) {
_that.$eventBus.$emit("location", data);
_that.$eventBus.$emit("people", data.alert);
} else {
if (data.timestamp) {
console.log(data, "收到告警");
var time = convert(data.timestamp);
_that.$eventBus.$emit("message", data);
if (!_that.$root.notify) {
switch (data.alertType) {
case "IN":
_that.$notify({
title: "非法进入",
type: "warning",
message: data.tag + "在" + time + "非法进入",
position: "bottom-right",
});
break;
case "OUT":
_that.$notify({
title: "非法离开",
type: "warning",
message: data.tag + "在" + time + "非法离开",
position: "bottom-right",
});
break;
case "STAY":
_that.$notify({
title: "非法停留",
type: "warning",
message: data.tag + "在" + time + "非法停留",
position: "bottom-right",
});
break;
case "BATTERY":
_that.$notify({
title: "低电量提醒",
type: "warning",
message: data.tag + "低电量提醒",
position: "bottom-right",
});
break;
}
}
}
}
};
webSocket.onclose = function () {
console.log("连接关闭!");
var token = localStorage.getItem('token')
if (token) {
reconnect();
}
};
webSocket.onerror = function () {
console.log("连接异常!");
};
}
} catch (e) {
reconnect();
}
};
<template> <template>
<div class="home"> <div class="home">
<img alt="Vue logo" src="../assets/logo.png"> <MainIndex />
<HelloWorld msg="Welcome to Your Vue.js App"/>
</div> </div>
</template> </template>
<script> <script>
// @ is an alias to /src // @ is an alias to /src
import HelloWorld from '@/components/HelloWorld.vue' import MainIndex from '../components/index.vue'
export default {
export default { name: 'HomeView',
name: 'HomeView', components: {
components: { MainIndex
HelloWorld }
} }
} </script>
</script> \ No newline at end of file
const { defineConfig } = require('@vue/cli-service') const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({ // module.exports = defineConfig({
transpileDependencies: true // transpileDependencies: true
}) // })
module.exports = {
publicPath: "/",
lintOnSave: false,
runtimeCompiler: true,
devServer: {
host: "localhost",
// port: 8080, // 端口
// https: false,
proxy: {
"/api": {
// target: "http://192.168.1.168:8868/", // 代理的接口域名以及端口号;
target: "http://120.77.240.215:8856", // 代理的接口域名以及端口号;
ws: false, // 支持ws协议;websocket的缩写;
changeOrigin: true, // 是否跨域
pathRewrite: {
// 路径替换
"^/api": '',
},
},
},
},
};
\ 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