增加加密

This commit is contained in:
BianLzhaoMin 2025-05-23 09:36:09 +08:00
parent 5cd462507a
commit 5bb151c352
2 changed files with 123 additions and 298 deletions

View File

@ -1,186 +0,0 @@
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
server_tokens off;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
client_max_body_size 100M;
client_body_buffer_size 100M;
fastcgi_buffer_size 128k;
fastcgi_buffers 8 128k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;
#gzip on;
server {
listen 80;
server_name localhost;
charset utf-8;
location /nxdt {
# 网站根目录,此处使用容器内的路径
alias /usr/local/www/nxdt;
# 默认首页
index index.html;
# 尝试从磁盘找到请求的文件,如果不存在则跳转到 index.html
try_files $uri $uri/ /nxdt/index.html;
}
location /option {
# 网站根目录,此处使用容器内的路径
alias /usr/local/www/option;
# 默认首页
index index.html;
# 尝试从磁盘找到请求的文件,如果不存在则跳转到 index.html
try_files $uri $uri/ /option/index.html;
}
location /search-tool {
# 网站根目录,此处使用容器内的路径
alias /usr/local/www/search-tool;
# 默认首页
index index.html;
# 尝试从磁盘找到请求的文件,如果不存在则跳转到 index.html
try_files $uri $uri/ /search-tool/index.html;
}
location /zhgd-ht {
# 网站根目录,此处使用容器内的路径
alias /usr/local/www/zhgd-ht;
# 默认首页
index index.html;
# 尝试从磁盘找到请求的文件,如果不存在则跳转到 index.html
try_files $uri $uri/ /zhgd-ht/index.html;
}
location /zhgd-web {
# 网站根目录,此处使用容器内的路径
alias /usr/local/www/zhgd-web;
# 默认首页
index index.html;
# 尝试从磁盘找到请求的文件,如果不存在则跳转到 index.html
try_files $uri $uri/ /zhgd-web/sg_login.html;
}
location /smartSiteScreen {
# 网站根目录,此处使用容器内的路径
alias /usr/local/www/smartSiteScreen;
# 默认首页
index index.html;
# 尝试从磁盘找到请求的文件,如果不存在则跳转到 index.html
try_files $uri $uri/ /smartSiteScreen/index.html;
}
location /output {
# 网站根目录,此处使用容器内的路径
alias /usr/local/www/output;
# 默认首页
index index.html;
# 尝试从磁盘找到请求的文件,如果不存在则跳转到 index.html
try_files $uri $uri/ /output/index.html;
}
#location / {
# # 网站根目录,此处使用容器内的路径
# root /usr/local/www/;
# # 默认首页
# index index.html;
# # 尝试从磁盘找到请求的文件,如果不存在则跳转到 index.html
# try_files $uri $uri/ /index.html;
# }
location /file/ {
rewrite ^/file/(.*)$ /$1 break; #必须的写这个使用nginx的rewrite对uri进行重写 下面这行也要改为api
proxy_pass http://192.168.0.14:19300/; #跨域转发路由地址
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /dev-api/ {
rewrite ^/dev-api/(.*)$ /$1 break; #必须的写这个使用nginx的rewrite对uri进行重写 下面这行也要改为api
proxy_pass http://192.168.0.14:28080/; #跨域转发路由地址
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /nxdt-api/ {
rewrite ^/dev-api/(.*)$ /$1 break; #必须的写这个使用nginx的rewrite对uri进行重写 下面这行也要改为api
proxy_pass http://192.168.0.14:18080/; #跨域转发路由地址
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /zhgd/ {
rewrite ^/dev-api/(.*)$ /$1 break; #必须的写这个使用nginx的rewrite对uri进行重写 下面这行也要改为api
proxy_pass http://192.168.0.14:13030/zhgd/; #跨域转发路由地址
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /prod-api/ {
rewrite ^/dev-api/(.*)$ /$1 break; #必须的写这个使用nginx的rewrite对uri进行重写 下面这行也要改为api
proxy_pass http://192.168.0.14:18080/; #跨域转发路由地址
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /option-api/ {
rewrite ^/option-api/(.*)$ /$1 break; #必须的写这个使用nginx的rewrite对uri进行重写 下面这行也要改为api
proxy_pass http://192.168.0.14:21666/; #跨域转发路由地址
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /screen/ {
#rewrite ^.+api/?(.*)$ /$1 break; #这样写有问题,在网上看有人这样写,发现有问题
rewrite ^/screen/(.*)$ /$1 break; #必须的写这个使用nginx的rewrite对uri进行重写 下面这行也要改为api
proxy_pass http://192.168.0.14:28080/; #跨域转发路由地址
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /search-tool-api/ {
#rewrite ^.+api/?(.*)$ /$1 break; #这样写有问题,在网上看有人这样写,发现有问题
rewrite ^/screen/(.*)$ /$1 break; #必须的写这个使用nginx的rewrite对uri进行重写 下面这行也要改为api
proxy_pass http://192.168.0.14:58089/; #跨域转发路由地址
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
#location ~* \.pdf$ {
# add_header Content-Type application/pdf;
#}
}
}

View File

@ -1,69 +1,84 @@
<template> <template>
<div class="login"> <div class="login">
<div class="login-main" :element-loading-text="loadingMsg" v-loading="loading"> <div
<!-- <h3 class="login-title">登录</h3> --> class="login-main"
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" status-icon> :element-loading-text="loadingMsg"
<el-form-item prop="userName"> v-loading="loading"
<el-input v-model="dataForm.userName" placeholder="帐号"></el-input> >
</el-form-item> <!-- <h3 class="login-title">登录</h3> -->
<el-form-item prop="password"> <el-form
<el-input v-model="dataForm.password" type="password" placeholder="密码"></el-input> :model="dataForm"
</el-form-item> :rules="dataRule"
<!-- <el-form-item prop="verCode"> ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
status-icon
>
<el-form-item prop="userName">
<el-input v-model="dataForm.userName" placeholder="帐号"></el-input>
</el-form-item>
<el-form-item prop="password">
<el-input
v-model="dataForm.password"
type="password"
placeholder="密码"
></el-input>
</el-form-item>
<!-- <el-form-item prop="verCode">
<el-input style="width:60%!important;float:left" v-model="dataForm.verCode" placeholder="验证码"></el-input> <el-input style="width:60%!important;float:left" v-model="dataForm.verCode" placeholder="验证码"></el-input>
<img @click="getVerCode()" :src="codeImg" width="100" height="40" class="head_pic" style="float:right" /> <img @click="getVerCode()" :src="codeImg" width="100" height="40" class="head_pic" style="float:right" />
</el-form-item> --> </el-form-item> -->
<el-form-item> <el-form-item>
<el-button class="login-btn-submit" type="primary" @click="dataFormSubmit()">登录</el-button> <el-button
</el-form-item> class="login-btn-submit"
</el-form> type="primary"
</div> @click="dataFormSubmit()"
>登录</el-button
>
</el-form-item>
</el-form>
</div>
</div> </div>
</template> </template>
<script> <script>
import AES from "@/plugins/cryptoJs/aes"; import AES from "@/plugins/cryptoJs/aes";
import { userLogin } from "@/api/account" import { userLogin } from "@/api/account";
import Mqtt from '../../components/mqtt.vue' import Mqtt from "../../components/mqtt.vue";
export default { export default {
name: 'login', name: "login",
components: { components: {
Mqtt Mqtt,
}, },
data() { data() {
return { return {
dataForm: { dataForm: {
userName: '', userName: "",
password: '', password: "",
uuid: '', uuid: "",
captcha: '', captcha: "",
verCode:"", verCode: "",
codeId:"" codeId: "",
}, },
dataRule: { dataRule: {
userName: [ userName: [
{ required: true, message: '帐号不能为空', trigger: 'blur' } { required: true, message: "帐号不能为空", trigger: "blur" },
], ],
password: [ password: [
{ required: true, message: '密码不能为空', trigger: 'blur' } { required: true, message: "密码不能为空", trigger: "blur" },
], ],
// verCode: [ // verCode: [
// { required: true, message: '', trigger: 'blur' } // { required: true, message: '', trigger: 'blur' }
// ] // ]
}, },
captchaPath: '', captchaPath: "",
loading: false, //loading loading: false, //loading
loadingMsg: "", loadingMsg: "",
codeImg:"", codeImg: "",
codeId:"" codeId: "",
}; };
}, },
mounted() { mounted() {},
methods: {
},
methods:{
createLoad() { createLoad() {
this.loading = true; this.loading = true;
this.loadingMsg = "登录中..."; this.loadingMsg = "登录中...";
@ -73,101 +88,97 @@ export default {
this.loadingMsg = ""; this.loadingMsg = "";
}, },
// //
dataFormSubmit () { dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => { this.$refs["dataForm"].validate((valid) => {
if (valid) { if (valid) {
sessionStorage.removeItem("token") sessionStorage.removeItem("token");
this.createLoad(); this.createLoad();
var userPossword = AES.encrypt(this.dataForm.password) var userPossword = AES.encrypt(this.dataForm.password);
var username = AES.encrypt(this.dataForm.userName) var username = AES.encrypt(this.dataForm.userName);
// let param = new URLSearchParams() // let param = new URLSearchParams()
// param.append('userName', this.dataForm.password) // param.append('userName', this.dataForm.password)
// param.append('password', this.dataForm.password) // param.append('password', this.dataForm.password)
let Content = { let Content = {
'username': this.dataForm.userName, // 'username': this.dataForm.userName,
'password': this.dataForm.password, username,
// 'password': userPossword, // 'password': this.dataForm.password,
password: userPossword,
// 'verCode' :this.dataForm.verCode, // 'verCode' :this.dataForm.verCode,
// 'codeId' :this.dataForm.codeId // 'codeId' :this.dataForm.codeId
}; };
// console.log(Content) // console.log(Content)
userLogin(Content).then(res => { userLogin(Content)
if (res.code == "200") { .then((res) => {
console.log("success") if (res.code == "200") {
this.clearLoad(); console.log("success");
sessionStorage.setItem('token',res.token) this.clearLoad();
this.$router.replace({ name: 'fullScreen' }) sessionStorage.setItem("token", res.token);
this.$router.replace({ name: "fullScreen" });
// setToken(res.returnData.token); // setToken(res.returnData.token);
// this.$router.replace({ name: 'home' }) // this.$router.replace({ name: 'home' })
} else { } else {
// this.getVerCode(); // this.getVerCode();
this.$message({ this.$message({
message: res.message, message: res.message,
type: "warning" type: "warning",
}); });
setTimeout(() => {
this.clearLoad();
}, 300);
}
})
.catch((err) => {
console.log(err);
setTimeout(() => { setTimeout(() => {
this.clearLoad(); this.clearLoad();
}, 300); }, 300);
} });
}).catch(err => {
console.log(err);
setTimeout(() => {
this.clearLoad();
}, 300);
});
} }
}) });
} },
},
};
}
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.login{ .login {
width: 100%; width: 100%;
height: 100%; height: 100%;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
background-image: url("../../assets/images/loginBg.png"); background-image: url("../../assets/images/loginBg.png");
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: 100% 100%; background-size: 100% 100%;
.login-main { .login-main {
margin-left: 35%; margin-left: 35%;
position: absolute; position: absolute;
top: 20%; top: 20%;
left: 30% ; left: 30%;
padding: 1.875rem 0.75rem 2.25rem; padding: 1.875rem 0.75rem 2.25rem;
width: 18%; width: 18%;
min-height: 15%; min-height: 15%;
background-color: #fff; background-color: #fff;
} }
.login-title { .login-title {
font-size: 0.6rem; font-size: 0.6rem;
} }
.login-captcha { .login-captcha {
overflow: hidden; overflow: hidden;
> img { > img {
width: 100%;
cursor: pointer;
}
}
.login-btn-submit {
width: 100%; width: 100%;
margin-top: 0.5rem; cursor: pointer;
} }
.el-input { }
width: 100% !important; .login-btn-submit {
} width: 100%;
} margin-top: 0.5rem;
}
.el-input {
width: 100% !important;
}
}
</style> </style>