Commit 0de0bcec authored by limeimei's avatar limeimei

2

parent 36e44c2d
Pipeline #2361 canceled with stages
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
methods: { methods: {
login() { login() {
localStorage.removeItem("token");
http.post("/sys/dev/user/login", { http.post("/sys/dev/user/login", {
autoLogin: true, autoLogin: true,
userLogin: 'sixiang', userLogin: 'sixiang',
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<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 class="top_item"><span class="top_item_title">设备总功率</span><span class="top_item_con">1111</span></div>
</div> </div>
<el-button @click="getList">123</el-button>
<div class="center"> <div class="center">
<div v-for="item in list" :key="item.id"> <div v-for="item in list" :key="item.id">
<div class="center_item"> <div class="center_item">
...@@ -45,13 +46,14 @@ ...@@ -45,13 +46,14 @@
methods: { methods: {
getList() { getList() {
console.log(localStorage.getItem('token')) console.log(localStorage.getItem('token'))
// return // return
http.post("/sys/dev/device/runtime/list", { http.post("/sys/dev/sn/model/list", {
currentPage: 1, // currentPage: 1,
deviceName: '6D8X05-X5NAGR', // deviceName: '6D8X05-X5NAGR',
identifier: 'gfConfluenceMachine', // identifier: 'gfTemperatureHumidity',
productKey: '1TOMLS7WC58409644', // productKey: '1TOMLS7WC58409644',
type: 'event' // type: 'event'
}).then((res) => { }).then((res) => {
if (res.code == 200) { if (res.code == 200) {
let arr = res.data.list[0].value.allPathElect let arr = res.data.list[0].value.allPathElect
......
<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> <template>
<div class="wrapper"> <div class="wrapper">
<div class="header"> <div class="top">
<el-tabs v-model="activeName" @tab-click="handleClick"> <div class="top_item"><span class="top_item_title">设备SN</span><span class="top_item_con">1111</span></div>
<el-tab-pane label="光伏智能直流汇流箱" name="0"> <div class="top_item"><span class="top_item_title">设备状态</span><span class="top_item_con">1111</span></div>
<Direct /> <div class="top_item"><span class="top_item_title">设备温度</span><span class="top_item_con">1111</span></div>
</el-tab-pane> <div class="top_item"><span class="top_item_title">设备总功率</span><span class="top_item_con">1111</span></div>
<el-tab-pane label="配置管理" name="second">光伏智能交流汇流箱</el-tab-pane>
<el-tab-pane label="角色管理" name="third">光伏智能并网箱</el-tab-pane>
</el-tabs>
</div> </div>
<div class="center">
<img src="@/assets/img/clock.png" alt="" class="item_img">
</div>
</div> </div>
</template> </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> <style scoped>
.wrapper { .wrapper {
/* background: #F4F7FC; */ 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;
}
/* :deep(.el-tabs) { .center {
--el-tabs-header-height: 70px; background: #FFFFFF;
display: flex;
margin-top: 40px;
padding: 152px;
}
.center_item {
width: 227px;
display: flex;
flex-direction: column;
align-items: center;
margin-top: 34px;
} }
:deep(.el-tabs__header) { .item_table_w {
margin: 0; display: flex;
background: white; flex-direction: column;
margin-left: 50px; border-right: 1px solid #E5E5E5;
width: 227px;
align-items: center;
margin-bottom: 38px;
} }
:deep(.el-tabs__nav-wrap::after) { .item_table {
height: 0px; 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: 264.07px;
height: 265px;
}
</style> </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">
<img src="@/assets/img/clock.png" alt="" class="item_img">
</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;
padding: 152px;
}
.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: 264.07px;
height: 265px;
}
</style>
\ No newline at end of file
...@@ -5,8 +5,12 @@ ...@@ -5,8 +5,12 @@
<el-tab-pane label="光伏智能直流汇流箱" name="0"> <el-tab-pane label="光伏智能直流汇流箱" name="0">
<Direct /> <Direct />
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="配置管理" name="second">光伏智能交流汇流箱</el-tab-pane> <el-tab-pane label="光伏智能交流汇流箱" name="second">
<el-tab-pane label="角色管理" name="third">光伏智能并网箱</el-tab-pane> <Exchange></Exchange>
</el-tab-pane>
<el-tab-pane label="角色管理" name="third">
<Grid></Grid>
</el-tab-pane>
</el-tabs> </el-tabs>
</div> </div>
...@@ -15,9 +19,13 @@ ...@@ -15,9 +19,13 @@
<script> <script>
import http from "../utils/http"; import http from "../utils/http";
import Direct from './direct.vue' import Direct from './direct.vue'
import Exchange from './exchange.vue'
import Grid from './grid.vue'
export default { export default {
components: { components: {
Direct Direct,
Exchange,
Grid
}, },
data() { data() {
return { return {
...@@ -37,15 +45,16 @@ ...@@ -37,15 +45,16 @@
methods: { methods: {
login() { login() {
localStorage.removeItem("token");
http.post("/sys/dev/user/login", { http.post("/sys/dev/user/login", {
autoLogin: true, autoLogin: true,
userLogin: 'sixiang', userLogin: 'sixiang',
userPassword: 'qwe123', userPassword: 'qwe123',
}).then((res) => { }).then((res) => {
if (res.code == 200) { if (res.code == 200) {
// localStorage.removeItem("token"); //
localStorage.setItem('token', res.data.token) localStorage.setItem('token', res.data.token)
console.log(localStorage.getItem('token')) // console.log(localStorage.getItem('token'))
} }
}); });
}, },
...@@ -68,14 +77,24 @@ ...@@ -68,14 +77,24 @@
::v-deep .el-tabs { ::v-deep .el-tabs {
--el-tabs-header-height: 70px; /* --el-tabs-header-height: 70px; */
} }
::v-deep .el-tabs__header { ::v-deep .header .el-tabs__header {
margin: 0; margin: 0;
background: white; background: white;
margin-left: 50px; margin-left: 50px;
display: flex;
margin-bottom: 30px;
}
::v-deep .el-tabs__item {
display: inline;
margin-right: 50px;
padding-bottom: 40px;
} }
::v-deep.el-tabs__nav-wrap::after { ::v-deep.el-tabs__nav-wrap::after {
......
...@@ -6,7 +6,7 @@ Vue.use(VueRouter) ...@@ -6,7 +6,7 @@ Vue.use(VueRouter)
const routes = [ const routes = [
{ {
path: '/index', path: '/',
name: 'home', name: 'home',
component: HomeView component: HomeView
}, },
......
...@@ -22,7 +22,7 @@ const http = { ...@@ -22,7 +22,7 @@ const http = {
post(url, params) { post(url, params) {
const config = { const config = {
method: "post", method: "post",
url: baseURL + url, url: url,
}; };
if (params) config.data = params; if (params) config.data = params;
return request(config); return request(config);
......
...@@ -14,7 +14,9 @@ const service = axios.create({ ...@@ -14,7 +14,9 @@ const service = axios.create({
}); });
// 2.请求拦截器 // 2.请求拦截器
service.interceptors.request.use( service.interceptors.request.use(
(config) => { (config) => {
console.log(1111111);
//发请求前做的一些处理,数据转化,配置请求头,设置token,设置loading等,根据需求去添加 //发请求前做的一些处理,数据转化,配置请求头,设置token,设置loading等,根据需求去添加
config.data = JSON.stringify(config.data); //数据转化,也可以使用qs转换 config.data = JSON.stringify(config.data); //数据转化,也可以使用qs转换
config.headers = { config.headers = {
...@@ -23,6 +25,7 @@ service.interceptors.request.use( ...@@ -23,6 +25,7 @@ service.interceptors.request.use(
// 这里可以用本地储存去拿token // 这里可以用本地储存去拿token
const token = localStorage.getItem("token"); //localStorage const token = localStorage.getItem("token"); //localStorage
// const session = sessionStorage.getItem('token') //sessionStorage // const session = sessionStorage.getItem('token') //sessionStorage
console.log(33333333)
if (token) { if (token) {
config.headers.Authorization = "Bearer " + token; //如果要求携带在请求头中 config.headers.Authorization = "Bearer " + token; //如果要求携带在请求头中
...@@ -30,7 +33,7 @@ service.interceptors.request.use( ...@@ -30,7 +33,7 @@ service.interceptors.request.use(
return config; return config;
}, },
(error) => { (error) => {
console.log(33333)
Promise.reject(error); Promise.reject(error);
} }
); );
...@@ -38,16 +41,15 @@ service.interceptors.request.use( ...@@ -38,16 +41,15 @@ service.interceptors.request.use(
// 3.响应拦截器 // 3.响应拦截器
service.interceptors.response.use( service.interceptors.response.use(
(response) => { (response) => {
console.log(response)
console.log(222222)
//接收到响应数据并成功后的一些共有的处理,关闭loading等 //接收到响应数据并成功后的一些共有的处理,关闭loading等
// token过期,请重新登录 // token过期,请重新登录
if (response.code == 401) { if (response.code == 401) {
localStorage.removeItem("token"); // localStorage.removeItem("token");
Message.warning(response.data.msg);
// Message.warning(response.data.msg);
router.replace("/");
// http.post("/sys/dev/user/login", { // http.post("/sys/dev/user/login", {
// autoLogin: true, // autoLogin: true,
......
...@@ -11,14 +11,14 @@ module.exports = { ...@@ -11,14 +11,14 @@ module.exports = {
// port: 8080, // 端口 // port: 8080, // 端口
// https: false, // https: false,
proxy: { proxy: {
"/api": { "/": {
// target: "http://192.168.1.168:8868/", // 代理的接口域名以及端口号; // target: "http://192.168.1.168:8868/", // 代理的接口域名以及端口号;
target: "http://120.77.240.215:8856", // 代理的接口域名以及端口号; target: "http://120.77.240.215:8856", // 代理的接口域名以及端口号;
ws: false, // 支持ws协议;websocket的缩写; ws: false, // 支持ws协议;websocket的缩写;
changeOrigin: true, // 是否跨域 changeOrigin: true, // 是否跨域
pathRewrite: { pathRewrite: {
// 路径替换 // 路径替换
"^/api": '', // "^/api": '',
}, },
}, },
}, },
......
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