Commit 2d6affb6 authored by caicaicai's avatar caicaicai

登录功能实现

parent ac6837b0
...@@ -65,8 +65,12 @@ export default new Vuex.Store({ ...@@ -65,8 +65,12 @@ export default new Vuex.Store({
state: { state: {
projectName:"鑫海数字矿山后台管理系统", projectName:"鑫海数字矿山后台管理系统",
platformName:"鑫海数字矿山后台管理平台", platformName:"鑫海数字矿山后台管理平台",
user:"",
}, },
mutations: { mutations: {
changeUser(userName){
state.user = userName;
}
}, },
actions: { actions: {
}, },
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<span>{{ $store.state.platformName }}</span> <span>{{ $store.state.platformName }}</span>
<div class="userInformationBar"> <div class="userInformationBar">
<div style="margin-right:10px;"> <div style="margin-right:10px;">
<span>{{userName}}</span> <span>{{$store.state.user}}</span>
<span class="iconfont icon-xiajiantou xiajiantou" style="font-size:18px;"></span> <span class="iconfont icon-xiajiantou xiajiantou" style="font-size:18px;"></span>
</div> </div>
<el-button type="primary" circle @click="handleFullScreen()" size="small" style="margin-right:10px;"><span :class="quanping"></span></el-button> <el-button type="primary" circle @click="handleFullScreen()" size="small" style="margin-right:10px;"><span :class="quanping"></span></el-button>
......
...@@ -5,21 +5,24 @@ ...@@ -5,21 +5,24 @@
<div class="loginTitle">登录窗口</div> <div class="loginTitle">登录窗口</div>
<div class="loginText">欢迎登录后台系统</div> <div class="loginText">欢迎登录后台系统</div>
<div class="loginInoputs"> <div class="loginInoputs">
<div class="userInpBody"> <el-form ref="loginForm" :model="loginForm">
<div class="userIcon"><img src="../imgs/yonghuming.png"></div> <el-form-item class="userInpBody">
<input type="text" id="userInp" placeholder="输入你的用户名" v-model="loginForm.username"> <div class="userIcon"><img src="../imgs/yonghuming.png"></div>
</div> <el-input v-model="loginForm.username" id="userInp" placeholder="输入你的用户名"></el-input>
<div class="passWordInpBody"> </el-form-item>
<div class="passWordIcon"><img src="../imgs/mima.png"></div> <el-form-item class="passWordInpBody">
<input type="password" id="passWordInp" placeholder="输入你的密码" v-model="loginForm.password"> <div class="passWordIcon"><img src="../imgs/mima.png"></div>
</div> <el-input type="password" v-model="loginForm.password" id="passWordInp" placeholder="输入你的密码"></el-input>
</el-form-item>
</el-form>
<button class="loginBtn" @click="LoginInitiation">安全登录</button> <button class="loginBtn" @click="LoginInitiation">安全登录</button>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import { httpGet } from "@/common/httpBean.js" import { httpGet, httpPost,httpPostForJson } from "@/common/httpBean.js"
import axios from "axios"
import {login,code} from "@/axios/api.js" import {login,code} from "@/axios/api.js"
import {encrypt} from "@/utils/rsaEncrypt.js" import {encrypt} from "@/utils/rsaEncrypt.js"
import Cookies from 'js-cookie' import Cookies from 'js-cookie'
...@@ -39,13 +42,12 @@ export default { ...@@ -39,13 +42,12 @@ export default {
// 获取验证码 // 获取验证码
this.getCode() this.getCode()
// 获取用户名密码等Cookie // 获取用户名密码等Cookie
//this.getCookie() this.getCookie()
}, },
methods:{ methods:{
getCode() { getCode() {
httpGet(code).then(res=> { httpGet(code).then(res=> {
//console.log(res.uuid); this.loginForm.uuid = res.uuid;
this.uuid = res.uuid;
}); });
}, },
getCookie() { getCookie() {
...@@ -63,10 +65,8 @@ export default { ...@@ -63,10 +65,8 @@ export default {
if(this.loginForm.userName == "" || this.loginForm.password == ""){ if(this.loginForm.userName == "" || this.loginForm.password == ""){
alert("请输入正确的用户名或密码!") alert("请输入正确的用户名或密码!")
}else{ }else{
httpGet(login).then( res => { this.$refs.loginForm.validate( valid => {
console.log(res); const user = {
this.$refs.loginForm.validate(valid => {
const user = {
username: this.loginForm.username, username: this.loginForm.username,
password: this.loginForm.password, password: this.loginForm.password,
uuid: this.loginForm.uuid uuid: this.loginForm.uuid
...@@ -74,7 +74,20 @@ export default { ...@@ -74,7 +74,20 @@ export default {
if (user.password !== this.cookiePass) { if (user.password !== this.cookiePass) {
user.password = encrypt(user.password) user.password = encrypt(user.password)
} }
if (valid) { if(valid){
httpPostForJson(login, user).then( res =>{
//console.log(res);
if(res.user.user.enabled){
//this.$store.commit('changeUser',res.user.user.nickName);
this.$router.push({path: 'homepage/mineMonitoring'});
}else{
// console.log(res);
this.$message({
message: "用户名密码错误",
type: 'error'
});
}
})
this.loading = true this.loading = true
if (user.rememberMe) { if (user.rememberMe) {
Cookies.set('username', user.username, { expires: Config.passCookieExpires }) Cookies.set('username', user.username, { expires: Config.passCookieExpires })
...@@ -83,13 +96,11 @@ export default { ...@@ -83,13 +96,11 @@ export default {
Cookies.remove('username') Cookies.remove('username')
Cookies.remove('password') Cookies.remove('password')
} }
} else { } else {
console.log('error submit!!') console.log('error submit!!')
return false return false
} }
})
}) })
this.$router.push({path: 'homepage/mineMonitoring'});
} }
} }
} }
...@@ -150,11 +161,13 @@ export default { ...@@ -150,11 +161,13 @@ export default {
height: 300px; height: 300px;
} }
.userInpBody{ .userInpBody{
display: flex;
padding: 2px; padding: 2px;
border: 1px solid rgb(18,70,113); border: 1px solid rgb(18,70,113);
margin-bottom: 20px; margin-bottom: 20px;
} }
.el-form-item__content{
display: flex;
}
.userIcon{ .userIcon{
padding: 15px; padding: 15px;
box-sizing: border-box; box-sizing: border-box;
...@@ -163,16 +176,16 @@ export default { ...@@ -163,16 +176,16 @@ export default {
background-color: rgb(18,70,113); background-color: rgb(18,70,113);
} }
#userInp{ #userInp{
margin-left: 10px; height: 100%;
width: 80%; width: 80%;
background: none; background: none;
outline: none; outline: none;
border: none; border: none;
font-size: 20px; font-size: 20px;
color: rgb(47,213,255); color: rgb(47,213,255);
letter-spacing: 3px; letter-spacing: 2px;
} }
::-webkit-input-placeholder { /* WebKit browsers */ .el-input input::-webkit-input-placeholder {
color:rgb(47,213,255); color:rgb(47,213,255);
} }
.passWordInpBody{ .passWordInpBody{
...@@ -189,14 +202,14 @@ export default { ...@@ -189,14 +202,14 @@ export default {
background-color: rgb(18,70,113); background-color: rgb(18,70,113);
} }
#passWordInp{ #passWordInp{
margin-left: 10px; height: 100%;
width: 80%; width: 80%;
background: none; background: none;
outline: none; outline: none;
border: none; border: none;
font-size: 20px; font-size: 20px;
color: rgb(47,213,255); color: rgb(47,213,255);
letter-spacing: 3px; letter-spacing: 2px;
} }
.loginBtn{ .loginBtn{
width: 100%; width: 100%;
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
</div> </div>
</div> </div>
<div class="intelligentDispatchRight"> <div class="intelligentDispatchRight">
<img src="../imgs/zhinengpaidan.png" style="margin-left:33px;"> <img src="../imgs/zhinengpaidan.png" style="margin-left:33px;" class="xuanzhuanAll">
<div style="color:#28F7FF;font-size:28px;text-align: center;">{{$store.state.a.intelligentDispatch.name}}</div> <div style="color:#28F7FF;font-size:28px;text-align: center;">{{$store.state.a.intelligentDispatch.name}}</div>
<img src="../imgs/juxing2.png" style="margin:10px 0px 0px 80px;"> <img src="../imgs/juxing2.png" style="margin:10px 0px 0px 80px;">
</div> </div>
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
</div> </div>
</div> </div>
<div class="environmentalMonitoringRight"> <div class="environmentalMonitoringRight">
<img src="../imgs/huanjingjiance.png" style="margin-left:33px;"> <img src="../imgs/huanjingjiance.png" style="margin-left:33px;" class="xuanzhuanAll">
<div style="color:#28F7FF;font-size:28px;text-align: center;">{{$store.state.a.environmentalMonitoring.name}}</div> <div style="color:#28F7FF;font-size:28px;text-align: center;">{{$store.state.a.environmentalMonitoring.name}}</div>
<img src="../imgs/juxing2.png" style="margin:10px 0px 0px 80px;"> <img src="../imgs/juxing2.png" style="margin:10px 0px 0px 80px;">
</div> </div>
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
</div> </div>
</div> </div>
<div class="locationSystemRight"> <div class="locationSystemRight">
<img src="../imgs/dingweixitong.png" style="margin-left:33px;"> <img src="../imgs/dingweixitong.png" style="margin-left:33px;" class="xuanzhuanAll">
<div style="color:#28F7FF;font-size:28px;text-align: center;">{{$store.state.a.locationSystem.name}}</div> <div style="color:#28F7FF;font-size:28px;text-align: center;">{{$store.state.a.locationSystem.name}}</div>
<img src="../imgs/juxing2.png" style="margin:10px 0px 0px 80px;"> <img src="../imgs/juxing2.png" style="margin:10px 0px 0px 80px;">
</div> </div>
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
<!-- 边坡在线监测 --> <!-- 边坡在线监测 -->
<div class="slopeMonitoring"> <div class="slopeMonitoring">
<div class="slopeMonitoringRight"> <div class="slopeMonitoringRight">
<img src="../imgs/bianpojiance.png" style="margin-left:33px;"> <img src="../imgs/bianpojiance.png" style="margin-left:33px;" class="xuanzhuanAll">
<div style="color:#28F7FF;font-size:28px;text-align: center;">{{$store.state.a.slopeMonitoring.name}}</div> <div style="color:#28F7FF;font-size:28px;text-align: center;">{{$store.state.a.slopeMonitoring.name}}</div>
<img src="../imgs/juxing2.png" style="margin:10px 0px 0px 80px;"> <img src="../imgs/juxing2.png" style="margin:10px 0px 0px 80px;">
</div> </div>
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
<!-- 生产自动化 --> <!-- 生产自动化 -->
<div class="productionAutomation"> <div class="productionAutomation">
<div class="productionAutomationRight"> <div class="productionAutomationRight">
<img src="../imgs/shengchanzidonghua.png" style="margin-left:33px;"> <img src="../imgs/shengchanzidonghua.png" style="margin-left:33px;" class="xuanzhuanAll">
<div style="color:#28F7FF;font-size:28px;text-align: center;">{{$store.state.a.productionAutomation.name}}</div> <div style="color:#28F7FF;font-size:28px;text-align: center;">{{$store.state.a.productionAutomation.name}}</div>
<img src="../imgs/juxing2.png" style="margin:10px 0px 0px 80px;"> <img src="../imgs/juxing2.png" style="margin:10px 0px 0px 80px;">
</div> </div>
...@@ -285,6 +285,14 @@ export default { ...@@ -285,6 +285,14 @@ export default {
.intelligentDispatchRight{ .intelligentDispatchRight{
width: 170px; width: 170px;
} }
.xuanzhuanAll{
animation:xuanzhuan 6s linear infinite;
}
/* @keyframes xuanzhuan{
0%{-webkit-transform:rotate(0deg);}
50%{-webkit-transform:rotate(-180deg);}
100%{-webkit-transform:rotate(-360deg);}
} */
/* 环境监测 */ /* 环境监测 */
.environmentalMonitoring{ .environmentalMonitoring{
top: 60%; top: 60%;
......
<template> <template>
<div> <div class="iframeBody">
<span>监控设置</span>
<div class="leftMenuBar">
<div style="color:#071E4C;font-weight:600;font-size:20px;margin-bottom:20px;">监控设置</div>
<div style="color:#071E4C;font-weight:600;font-size:17px;">
<div v-for="(item,index) in videoAreaArray" :key="index" style="margin-bottom:10px;cursor: pointer;" :class="index == videoAreaIndex ? 'leftMenuSelected' : '' " @click="videoMenuIndex(index)">
<span class="el-icon-camera-solid"> {{item}}</span>
</div>
</div>
</div>
<div class="rightVideoBox">
</div>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
data(){
return{
videoAreaArray:["采区监控","厂区监控","办公室监控","办公室监控1","办公室监控2"],
videoAreaIndex:0,
}
},
methods:{
videoMenuIndex(index){
this.videoAreaIndex = index;
}
},
} }
</script> </script>
<style> <style scoped>
*{
margin: 0;
padding: 0;
}
.iframeBody{
height: 100%;
display: flex;
width: 100%;
}
.leftMenuBar{
width: 10%;
height: 100%;
background-color: white;
padding: 20px;
box-sizing: border-box;
}
.rightVideoBox{
width: 90%;
height: 100%;
background-color: sandybrown;
display: flex;
flex-wrap: wrap;
justify-content: center;
}
.leftMenuSelected{
color: rgb(0,82,255);
}
.sonVideoBox{
width: 49.8%;
height: 49.8%;
border: 1px solid red;
}
</style> </style>
\ No newline at end of file
<template> <template>
<div class="iframeBody"> <div class="iframeBody">
<div class="leftMenuBar"> <div class="leftMenuBar">
<div style="color:#071E4C;font-weight:600;font-size:20px;margin-bottom:20px;">视频监控区域</div> <div style="color:#071E4C;font-weight:600;font-size:20px;margin-bottom:20px;">视频监控区域</div>
<div style="color:#071E4C;font-weight:600;font-size:17px;"> <div style="color:#071E4C;font-weight:600;font-size:17px;">
...@@ -10,7 +11,9 @@ ...@@ -10,7 +11,9 @@
</div> </div>
<div class="rightVideoBox"> <div class="rightVideoBox">
<div v-for="(item,index) in rightVideoBoxArray" :key="index" class="sonVideoBox">
</div>
</div> </div>
</div> </div>
...@@ -22,6 +25,7 @@ export default { ...@@ -22,6 +25,7 @@ export default {
return{ return{
videoAreaArray:["采区监控","厂区监控","办公室监控","办公室监控1","办公室监控2"], videoAreaArray:["采区监控","厂区监控","办公室监控","办公室监控1","办公室监控2"],
videoAreaIndex:0, videoAreaIndex:0,
rightVideoBoxArray:[4,4,4,4],
} }
}, },
methods:{ methods:{
...@@ -35,7 +39,6 @@ export default { ...@@ -35,7 +39,6 @@ export default {
<style scoped> <style scoped>
*{ *{
margin: 0; margin: 0;
padding: 0; padding: 0;
} }
...@@ -54,9 +57,17 @@ export default { ...@@ -54,9 +57,17 @@ export default {
.rightVideoBox{ .rightVideoBox{
width: 90%; width: 90%;
height: 100%; height: 100%;
background-color: bisque; background-color: white;
display: flex;
flex-wrap: wrap;
justify-content: center;
} }
.leftMenuSelected{ .leftMenuSelected{
color: rgb(0,82,255); color: rgb(0,82,255);
} }
.sonVideoBox{
width: 49.8%;
height: 49.8%;
border: 1px solid red;
}
</style> </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