2023-02-06 内容调整,提高密码安全性及界面内容

This commit is contained in:
2023-02-06 15:30:25 +08:00
parent 4826c68fb2
commit 366078f4b9
9 changed files with 489 additions and 350 deletions

4
ReadMe.md Normal file
View File

@ -0,0 +1,4 @@
2023-02-06
Xin-Laucher包更新后下载的框架内容初始化登录账号密码已修改
旧账号密码: admin/111111
新账号密码: admin/CRTECH@2023laucher

Binary file not shown.

View File

@ -1,4 +1,4 @@
<%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ page contentType="text/html;charset=UTF-8" %>
<head> <head>
<title>X·in管理端 - 修改密码</title> <title>X·in管理端 - 修改密码</title>
<script type="text/javascript" src="themes/js/vue.min.js"></script> <script type="text/javascript" src="themes/js/vue.min.js"></script>
@ -8,18 +8,19 @@
<script type="text/javascript" src="themes/js/moment.js"></script> <script type="text/javascript" src="themes/js/moment.js"></script>
<link rel="stylesheet" href="themes/css/index.css" type="text/css"> <link rel="stylesheet" href="themes/css/index.css" type="text/css">
</head> </head>
<style> <style>
.header{ .header {
height: 60px; height: 60px;
width: 100%; width: 100%;
} }
.header .logo{ .header .logo {
height: 60px; height: 60px;
width: 260px; width: 260px;
} }
.header .logo-image{ .header .logo-image {
height: 100%; height: 100%;
width: 100%; width: 100%;
background-repeat: no-repeat; background-repeat: no-repeat;
@ -27,30 +28,10 @@
background-size: 90%; background-size: 90%;
background-image: url('themes/img/xin.png'); background-image: url('themes/img/xin.png');
} }
.el-form{
width: 480px;
margin: auto;
margin-top: 40px;
}
.admin {
display: flex;
align-items: center;
border: 1px solid #DCDFE6;
background-color: #fff;
border-radius: 4px;
height: 40px;
margin-bottom: 20px;
}
.iconinfo { .el-form {
display: block; width: 480px;
width: 40px; margin: 40px auto auto;
text-align: center;
font-size: 14px;
font-weight: 600;
color: #999;
height: 40px;
line-height: 40px;
} }
#app { #app {
@ -72,7 +53,8 @@
width: 80%; width: 80%;
margin: 40px auto; margin: 40px auto;
} }
.title{
.title {
height: 60px; height: 60px;
width: 100%; width: 100%;
text-align: center; text-align: center;
@ -81,12 +63,13 @@
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
.system { .system {
font-size: 20px; font-size: 20px;
font-weight: 600; font-weight: 600;
} }
</style> </style>
<body>
<body> <body>
<div id="app"> <div id="app">
<div class="header"> <div class="header">
@ -100,13 +83,16 @@
</div> </div>
<el-form :model="from" id="passLogin" :rules="rules" ref="user" label-width="80px" @keyup.enter.native="login"> <el-form :model="from" id="passLogin" :rules="rules" ref="user" label-width="80px" @keyup.enter.native="login">
<el-form-item label="原密码" class="demo-dynamic" prop="pass"> <el-form-item label="原密码" class="demo-dynamic" prop="pass">
<el-input v-model="from.pass" size="small" placeholder="请输入原密码" type="password" show-password ></el-input> <el-input v-model="from.pass" size="small" placeholder="请输入原密码" type="password"
show-password></el-input>
</el-form-item> </el-form-item>
<el-form-item label="新密码" class="demo-dynamic" prop="editpass"> <el-form-item label="新密码" class="demo-dynamic" prop="editPass">
<el-input size="small" v-model="from.editpass" placeholder="请输入要修改的密码" type="password" show-password></el-input> <el-input size="small" v-model="from.editPass" placeholder="请输入要修改的密码" type="password"
show-password></el-input>
</el-form-item> </el-form-item>
<el-form-item label="确认密码" class="demo-dynamic" prop="checkpass"> <el-form-item label="确认密码" class="demo-dynamic" prop="checkPass">
<el-input size="small" v-model="from.checkpass" placeholder="请确认改改的密码" type="password" show-password></el-input> <el-input size="small" v-model="from.checkPass" placeholder="请确认改改的密码" type="password"
show-password></el-input>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<div style="text-align: center;"> <div style="text-align: center;">
@ -117,58 +103,86 @@
</div> </div>
</div> </div>
</body> </body>
<script> <script>
new Vue({ new Vue({
el: '#app', el: '#app',
data() { data() {
return { const validatePass = (rule, value, callback) => {
from: { if (value === '') {
pass: '', callback(new Error('请输入密码'));
editpass:'', } else {
checkpass:'' if (this.from.checkPass !== '') {
}, this.$refs.user.validateField('checkPass');
rules: { }
pass: [ callback();
{required: true, message: '请输入原密码', trigger: 'blur'},
],
editpass: [
{required: true, message: '请输入要修改的密码', trigger: 'blur'},
],
checkpass: [
{required: true, message: '请确认改改的密码', trigger: 'blur'},
],
}
}
},
methods: {
edit(user) {
this.$refs[user].validate((valid) => {
if(valid){
if(this.from.editpass == this.from.checkpass){
const that = this;
axios.post('/xinadmin/edit', this.from,{
headers: {
'token': sessionStorage.getItem("token")
}
}).then(function (res) {
console.log(res)
if (res.data.state == "success") {
that.$message.success('修改成功');
setTimeout(()=>{ //设置延迟执行
location.href = "login.jsp";
},2000);
}else{
that.$message.error("密码错误");
}
}).catch(function (error) {
console.log(error)
})
}else{
this.$message.error("两次密码不一致")
}
}
});
}
} }
}) };
const validatePass2 = (rule, value, callback) => {
if (value === '') {
callback(new Error('请再次输入密码'));
} else if (value !== this.from.editPass) {
callback(new Error('两次输入密码不一致!'));
} else {
callback();
}
};
return {
from: {
pass: '',
editPass: '',
checkPass: ''
},
rules: {
pass: [
{required: true, message: '请输入原密码', trigger: 'blur'},
],
editPass: [
{required: true, message: '请输入要修改的密码', trigger: 'blur'},
{
pattern: /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,16}$/g,
message: '密码必须包含大小写字母及数字允许特殊字符长度6-16'
},
{validator: validatePass, trigger: 'blur'}
],
checkPass: [
{required: true, message: '请再次输入修改的密码', trigger: 'blur'},
{validator: validatePass2, trigger: 'blur'}
]
}
}
},
methods: {
edit(user) {
this.$refs[user].validate((valid) => {
if (valid) {
if (this.from.editPass === this.from.checkPass) {
const that = this;
axios.post('/xinadmin/edit', this.from, {
headers: {
'token': sessionStorage.getItem("token")
}
}).then(function (res) {
console.log(res)
if (res.data.state === "success") {
that.$message.success('修改成功');
setTimeout(() => { //设置延迟执行
location.href = "login.jsp";
}, 2000);
} else {
that.$message.error(res.data.mes??"密码错误");
}
}).catch(function (error) {
console.log(error)
})
} else {
this.$message.error("两次密码不一致")
}
}
});
}
}
})
</script> </script>

View File

@ -1,4 +1,4 @@
<%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ page contentType="text/html;charset=UTF-8" %>
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
@ -12,12 +12,17 @@
<link rel="stylesheet" href="themes/css/index.css" type="text/css"> <link rel="stylesheet" href="themes/css/index.css" type="text/css">
<link rel="stylesheet" href="themes/css/main.css" type="text/css"> <link rel="stylesheet" href="themes/css/main.css" type="text/css">
</head> </head>
<body> <body>
<div id="app"> <div id="app">
<div class="header"> <div class="header">
<div class="logo"> <div class="logo" style="float: left">
<div class="logo-image"></div> <div class="logo-image"></div>
</div> </div>
<div style="float: right;margin-right: 20px;margin-top: 15px;">
<el-button type="primary" @click="openShow">修改密码</el-button>
</div>
</div> </div>
<div class="card-main"> <div class="card-main">
@ -32,7 +37,7 @@
<div class="company-lint"> <div class="company-lint">
<div class="company-name"> <div class="company-name">
<div class="company-logo"> <div class="company-logo">
<img src="themes/img/logo.png"> <img src="themes/img/logo.png" alt="超然X-in智慧管理平台">
</div> </div>
<div style="margin-left: 20px;">{{companyName}}</div> <div style="margin-left: 20px;">{{companyName}}</div>
</div> </div>
@ -46,10 +51,10 @@
@click="dialogCodeVisible = true">查看</el-link></span></div> @click="dialogCodeVisible = true">查看</el-link></span></div>
<div class="des">授权文件:<span style="color: green">正常</span> <div class="des">授权文件:<span style="color: green">正常</span>
<span> <span>
<el-link type="primary" :underline="false" <el-link type="primary" :underline="false"
style=" font-size: 12px;margin-left: 8px;" style=" font-size: 12px;margin-left: 8px;"
@click="dialogTableVisible = true">更换授权文件</el-link> @click="dialogTableVisible = true">更换授权文件</el-link>
</span> </span>
</div> </div>
</div> </div>
</div> </div>
@ -65,9 +70,9 @@
</div> </div>
<div class="pubg"> <div class="pubg">
<div class="applist"> <div class="applist">
<div class="app" v-for="(item,i) in single.applist" @click="showDetail(item)"> <div class="app" v-for="(item,i) in single.appList" @click="showDetail(item)">
<div class="app-det"> <div class="app-det">
<img :src="item.logo ? item.logo : 'themes/img/mk.png'"> <img :src="item.logo ? item.logo : 'themes/img/mk.png'" :alt="item.name">
</div> </div>
<div class="app-name">{{item.name}}</div> <div class="app-name">{{item.name}}</div>
<div class="app-des">版本:{{item.version}}</div> <div class="app-des">版本:{{item.version}}</div>
@ -83,7 +88,33 @@
</div> </div>
</div> </div>
<el-dialog title="授权码" :visible.sync="dialogCodeVisible"> <el-dialog title="修改密码" :visible.sync="showPassChange" width="500px" @close="closeShow"
:close-on-click-modal="false">
<el-form :model="from" id="passLogin" :rules="rules" ref="user"
label-width="80px" @keyup.enter.native="login">
<el-form-item label="原密码" class="demo-dynamic" prop="pass">
<el-input v-model="from.pass" size="small" placeholder="请输入原密码" type="password"
show-password clearable></el-input>
</el-form-item>
<el-form-item label="新密码" class="demo-dynamic" prop="editPass">
<el-input size="small" v-model="from.editPass" placeholder="请输入要修改的密码" type="password"
show-password clearable></el-input>
</el-form-item>
<el-form-item label="确认密码" class="demo-dynamic" prop="checkPass">
<el-input size="small" v-model="from.checkPass" placeholder="请确认改改的密码" type="password"
show-password clearable></el-input>
</el-form-item>
<el-form-item>
<div style="text-align: center;">
<el-button @click="closeShow">取 消</el-button>
<el-button type="primary" @click="edit('user')">确认修改</el-button>
</div>
</el-form-item>
</el-form>
</el-dialog>
<el-dialog title="授权码" :visible.sync="dialogCodeVisible" :close-on-click-modal="false">
<div class="demo-input-suffix"> <div class="demo-input-suffix">
<el-button style="float: right; margin-top: -25px" icon="el-icon-document-copy" @click="copy()" type="text"> <el-button style="float: right; margin-top: -25px" icon="el-icon-document-copy" @click="copy()" type="text">
复制授权码 复制授权码
@ -94,7 +125,7 @@
</div> </div>
</el-dialog> </el-dialog>
<el-dialog title="授权文件修改" :visible.sync="dialogTableVisible"> <el-dialog title="授权文件修改" :visible.sync="dialogTableVisible" :close-on-click-modal="false">
<div slot="header"> <div slot="header">
<span>上传授权文件</span> <span>上传授权文件</span>
</div> </div>
@ -120,151 +151,236 @@
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
<script> <script>
Vue.filter("dateFilter", function (date, formatPattern) { Vue.filter("dateFilter", function (date, formatPattern) {
return moment(date).format(formatPattern || "YYYY-MM-DD HH:mm:ss"); return moment(date).format(formatPattern || "YYYY-MM-DD HH:mm:ss");
}); });
const home = new Vue({ const home = new Vue({
el: '#app', el: '#app',
data() { data() {
return { const validatePass = (rule, value, callback) => {
single: [], if (value === '') {
dialogCodeVisible: false, callback(new Error('请输入密码'));
dialogTableVisible: false, } else {
rightDialogVisible: false, if (this.from.checkPass !== '') {
rightDialogTitle: '', this.$refs.user.validateField('checkPass');
tableData: [], }
callback();
companyName: '',
companyAddress: '',
companyIntroduce: ''
}
},
created: function () {
this.checkLogin();
this.singlecode();
},
//绑定方法
methods: {
singlecode() {
const that = this;
axios.get('/xinadmin/single', {}).then(function (res) {
if (res.data) {
if (res.data.license) {
that.single = res.data;
that.companyName = res.data.company.name;
that.companyAddress = res.data.company.address;
that.companyIntroduce = res.data.company.introduce;
} else {
location.href = "index.jsp"
}
}
}).catch(function (error) {
console.log(error)
})
},
checkLogin() {
const token = sessionStorage.getItem("token");
if (token == null) {
location.href = "login.jsp"
} else {
const str = new Date().getTime()
if ((+token + (2 * 60 * 60 * 1000) < str)) {
location.href = "login.jsp"
}
}
},
copy() {
this.$refs.copy.select()
document.execCommand('Copy')
this.$message.success('已复制到剪贴板')
},
uploadfile() {
this.$refs.upload.submit()
},
Success(response, file, fileList) {
if (response.state == "success") {
this.dialogTableVisible = false;
this.$notify({
title: '成功',
duration: 2000,
message: '校验通过',
type: 'success'
});
const that = this;
this.$confirm('授权文件已更新,是否立即重启相关应用?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
axios.get('/xinadmin/adminstarter', {}).then(function (res) {
that.$notify({
title: '重启中',
duration: 2000,
message: '正在重启相关应用,请稍侯....',
type: 'info'
});
setTimeout(() => {
location.reload();
}, 2000);
}).catch(function (error) {
console.log(error)
})
}).catch(() => {
that.$notify({
title: '警告',
duration: 2000,
message: '应用尚未重启,授权尚未生效,请稍后手动重启',
type: 'warning'
});
});
} else {
this.$notify.error({
title: '上传失败',
message: response.error
});
}
},
showDetail(item) {
this.rightDialogVisible = true;
this.rightDialogTitle = item.name + "授权参数详情";
let ary = new Array();
let data = item.params;
if (data != null) {
for (let i in data) {
let desc = data[i].name;
let value = data[i].value;
let valueType = data[i].valueType;
if (valueType == "number") {
if (value == -1)
value = "未限制数量";
else
value = "当前允许最大数量为: " + value + " , 请勿超出限制";
} else if (valueType == "boolean") {
if (value == data[i].falseDefault)
value = "未拥有此功能(或权限)";
else if (value == data[i].trueDefault)
value = "已拥有此功能(或权限)";
}
let param = {
code: i,
description: desc,
value: value,
};
ary.push(param);
}
}
this.tableData = ary;
},
closeDetail() {
this.rightDialogVisible = false;
this.rightDialogTitle = '';
this.tableData = [];
}
} }
}) };
const validatePass2 = (rule, value, callback) => {
if (value === '') {
callback(new Error('请再次输入密码'));
} else if (value !== this.from.editPass) {
callback(new Error('两次输入密码不一致!'));
} else {
callback();
}
};
return {
single: [],
dialogCodeVisible: false,
dialogTableVisible: false,
rightDialogVisible: false,
rightDialogTitle: '',
tableData: [],
companyName: '',
companyAddress: '',
companyIntroduce: '',
showPassChange: false,
from: {
pass: '',
editPass: '',
checkPass: ''
},
rules: {
pass: [
{required: true, message: '请输入原密码', trigger: 'blur'},
],
editPass: [
{required: true, message: '请输入要修改的密码', trigger: 'blur'},
{
pattern: /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,16}$/g,
message: '密码必须包含大小写字母及数字允许特殊字符长度6-16'
},
{validator: validatePass, trigger: 'blur'}
],
checkPass: [
{required: true, message: '请再次输入修改的密码', trigger: 'blur'},
{validator: validatePass2, trigger: 'blur'}
]
}
}
},
created: function () {
this.checkLogin();
this.singlecode();
},
//绑定方法
methods: {
singlecode() {
const that = this;
axios.get('/xinadmin/single', {}).then(function (res) {
if (res.data) {
if (res.data.license) {
that.single = res.data;
that.companyName = res.data.company.name;
that.companyAddress = res.data.company.address;
that.companyIntroduce = res.data.company.introduce;
} else {
location.href = "index.jsp"
}
}
}).catch(function (error) {
console.log(error)
})
},
checkLogin() {
const token = sessionStorage.getItem("token");
if (token == null) {
location.href = "login.jsp"
} else {
const str = new Date().getTime()
if ((+token + (2 * 60 * 60 * 1000) < str)) {
location.href = "login.jsp"
}
}
},
copy() {
this.$refs.copy.select()
document.execCommand('Copy')
this.$message.success('已复制到剪贴板')
},
uploadfile() {
this.$refs.upload.submit()
},
Success(response) {
if (response.state === "success") {
this.dialogTableVisible = false;
this.$notify({
title: '成功',
duration: 2000,
message: '校验通过',
type: 'success'
});
const that = this;
this.$confirm('授权文件已更新,是否立即重启相关应用?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
axios.get('/xinadmin/adminstarter', {}).then(function () {
that.$notify({
title: '重启中',
duration: 2000,
message: '正在重启相关应用,请稍侯....',
type: 'info'
});
setTimeout(() => {
location.reload();
}, 2000);
}).catch(function (error) {
console.log(error)
})
}).catch(() => {
that.$notify({
title: '警告',
duration: 2000,
message: '应用尚未重启,授权尚未生效,请稍后手动重启',
type: 'warning'
});
});
} else {
this.$notify.error({
title: '上传失败',
message: response.error
});
}
},
showDetail(item) {
this.rightDialogVisible = true;
this.rightDialogTitle = item.name + "授权参数详情";
let ary = [];
let data = item.params;
if (data != null) {
for (let i in data) {
let desc = data[i].name;
let value = data[i].value;
let valueType = data[i].valueType;
if (valueType === "number") {
if (value === -1)
value = "未限制数量";
else
value = "当前允许最大数量为: " + value + " , 请勿超出限制";
} else if (valueType === "boolean") {
if (value === data[i].falseDefault)
value = "未拥有此功能(或权限)";
else if (value === data[i].trueDefault)
value = "已拥有此功能(或权限)";
}
let param = {
code: i,
description: desc,
value: value,
};
ary.push(param);
}
}
this.tableData = ary;
},
closeDetail() {
this.rightDialogVisible = false;
this.rightDialogTitle = '';
this.tableData = [];
},
openShow() {
this.showPassChange = true
},
closeShow() {
this.form = {
pass: '',
editPass: '',
checkPass: ''
}
this.showPassChange = false
},
edit(user) {
this.$refs[user].validate((valid) => {
if (valid) {
if (this.from.editPass === this.from.checkPass) {
const that = this;
axios.post('/xinadmin/edit', this.from, {
headers: {
'token': sessionStorage.getItem("token")
}
}).then(function (res) {
if (res.data.state === "success") {
that.$message.success('修改成功');
setTimeout(() => { //设置延迟执行
location.href = "login.jsp";
}, 2000);
} else {
that.$message.error(res.data.mes??"密码错误");
}
}).catch(function (error) {
console.log(error)
})
} else {
this.$message.error("两次密码不一致")
}
}
});
}
}
})
</script> </script>
</body> </body>
</html> </html>

View File

@ -1,62 +1,67 @@
<%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ page contentType="text/html;charset=UTF-8" %>
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>授权中心</title> <title>授权中心</title>
<script type="text/javascript" src="themes/js/vue.min.js"></script> <script type="text/javascript" src="themes/js/vue.min.js"></script>
<script type="text/javascript" src="themes/js/index.js"></script> <script type="text/javascript" src="themes/js/index.js"></script>
<script type="text/javascript" src="themes/js/axios.min.js"></script> <script type="text/javascript" src="themes/js/axios.min.js"></script>
<script type="text/javascript" src="themes/js/jquery.js"></script> <script type="text/javascript" src="themes/js/jquery.js"></script>
<script type="text/javascript" src="themes/js/moment.js"></script> <script type="text/javascript" src="themes/js/moment.js"></script>
<link rel="stylesheet" href="themes/css/index.css" type="text/css"> <link rel="stylesheet" href="themes/css/index.css" type="text/css">
<link rel="stylesheet" href="themes/css/main.css" type="text/css"> <link rel="stylesheet" href="themes/css/main.css" type="text/css">
</head> </head>
<body> <body>
<div id="app"> <div id="app">
<div class="header"> <div class="header">
<div class="logo"> <div class="logo">
<div class="logo-image"></div> <div class="logo-image"></div>
</div>
</div>
<div class="no-license">
<el-card class="box-card" shadow="never" style="width:640px;margin: 10px auto 0 auto;">
<div slot="header" class="clearfix">
<span>本机授权码</span>
<el-button style="float: right; padding: 3px 0;" icon="el-icon-document-copy" @click="copy()"
type="text">复制授权码
</el-button>
</div>
<span class="tip">请联系您的商务经理或客服经理并将下方框体内的本机授权码发送给Ta以获取授权文件</span>
<div class="demo-input-suffix">
<el-input type="textarea" ref="copy" autosize="true" v-model="code" resize="none"
readonly="true"></el-input>
</div>
</el-card>
<el-card class="box-card" shadow="never" style="width:640px;margin: 10px auto 0 auto;">
<div slot="header">
<span>上传授权文件</span>
</div>
<span class="tip"></span>
<div align="center">
<el-upload class="upload-demo" accept enctype="multipart/form-data" drag action="/xinadmin/upload"
multiple="false" show-file-list="false"
drag="true" auto-upload="true" limit="1" :on-success="Success">
<i class="el-icon-upload" style="height: 10px;"></i>
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
<div class="el-upload__tip" slot="tip">请将您获得的授权文件(LICENSE)传入系统进行校验</div>
</el-upload>
</div>
</el-card>
</div> </div>
</div>
<div class="no-license">
<el-card class="box-card" shadow="never" style="width:640px;margin: 10px auto 0px auto;">
<div slot="header" class="clearfix">
<span>本机授权码</span>
<el-button style="float: right; padding: 3px 0;" icon="el-icon-document-copy" @click="copy()" type="text">复制授权码</el-button>
</div>
<span class="tip">请联系您的商务经理或客服经理并将下方框体内的本机授权码发送给Ta以获取授权文件</span>
<div class="demo-input-suffix">
<el-input type="textarea" ref="copy" autosize="true" v-model="code" resize="none" readonly="true"></el-input>
</div>
</el-card>
<el-card class="box-card" shadow="never" style="width:640px;margin: 10px auto 0px auto;">
<div slot="header">
<span>上传授权文件</span>
</div>
<span class="tip"></span>
<div align="center">
<el-upload class="upload-demo" accept enctype="multipart/form-data" drag action="/xinadmin/upload" multiple="false" show-file-list="false"
drag="true" auto-upload="true" limit="1" :on-success="Success">
<i class="el-icon-upload" style="height: 10px;"></i>
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
<div class="el-upload__tip" slot="tip">请将您获得的授权文件(LICENSE)传入系统进行校验</div>
</el-upload>
</div>
</el-card>
</div>
</div> </div>
<script> <script>
Vue.filter("dateFilter", function (date, formatPattern) { Vue.filter("dateFilter", function (date, formatPattern) {
return moment(date).format(formatPattern || "YYYY-MM-DD HH:mm:ss"); return moment(date).format(formatPattern || "YYYY-MM-DD HH:mm:ss");
}); });
new Vue({ new Vue({
el: '#app', el: '#app',
beforeCreate:function(){ beforeCreate: function () {
const that = this; const that = this;
axios.get('/xinadmin/code', {}).then(function (res) { axios.get('/xinadmin/code', {}).then(function (res) {
if (res.data) { if (res.data) {
if(res.data.license){ if (res.data.license) {
location.href = "login.jsp" location.href = "login.jsp"
}else{ } else {
that.code = res.data.code that.code = res.data.code
} }
@ -77,23 +82,23 @@
document.execCommand('Copy') document.execCommand('Copy')
this.$message.success('已复制到剪贴板') this.$message.success('已复制到剪贴板')
}, },
uploadfile(){ uploadFile() {
this.$refs.upload.submit() this.$refs.upload.submit()
}, },
Success(response, file, fileList) { Success(response) {
if(response.state == "success"){ if (response.state === "success") {
this.dialogTableVisible = false; this.dialogTableVisible = false;
this.$notify({ this.$notify({
title: '成功', title: '成功',
duration:2000, duration: 2000,
message: '上传成功', message: '上传成功',
type: 'success' type: 'success'
}); });
const that = this; const that = this;
axios.get('/xinadmin/adminstarter', {}).then(function (res) { axios.get('/xinadmin/adminstarter', {}).then(function () {
that.$notify({ that.$notify({
title: '重启中', title: '重启中',
duration:2000, duration: 2000,
message: '正在重启相关应用,请稍侯....', message: '正在重启相关应用,请稍侯....',
type: 'info' type: 'info'
}); });
@ -104,7 +109,7 @@
}).catch(function (error) { }).catch(function (error) {
console.log(error) console.log(error)
}) })
}else{ } else {
this.$notify.error({ this.$notify.error({
title: '上传失败', title: '上传失败',
message: response.error message: response.error

View File

@ -1,4 +1,4 @@
<%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ page contentType="text/html;charset=UTF-8" %>
<head> <head>
<title>X·in管理端</title> <title>X·in管理端</title>
<script type="text/javascript" src="themes/js/vue.min.js"></script> <script type="text/javascript" src="themes/js/vue.min.js"></script>
@ -30,8 +30,7 @@
.el-form { .el-form {
width: 480px; width: 480px;
margin: auto; margin: 40px auto auto;
margin-top: 40px;
} }
.el-input__inner { .el-input__inner {
@ -49,7 +48,7 @@
margin-bottom: 20px; margin-bottom: 20px;
} }
.iconinfo { .iconInfo {
display: block; display: block;
width: 40px; width: 40px;
text-align: center; text-align: center;
@ -95,7 +94,7 @@
font-weight: 600; font-weight: 600;
} }
</style> </style>
<body>
<body> <body>
<div id="app"> <div id="app">
<div class="header"> <div class="header">
@ -109,15 +108,15 @@
</div> </div>
<el-form id="passLogin" ref="user" label-width="80px" @keyup.enter.native="login"> <el-form id="passLogin" ref="user" label-width="80px" @keyup.enter.native="login">
<div class="admin"> <div class="admin">
<i class="el-icon-user-solid iconinfo"></i> <i class="el-icon-user-solid iconInfo"></i>
<el-input v-model="user.name" ref="name" placeholder="请输入用户名" clearable></el-input> <el-input v-model="user.name" ref="name" placeholder="请输入用户名" clearable></el-input>
</div> </div>
<div class="admin"> <div class="admin">
<i class="el-icon-key iconinfo"></i> <i class="el-icon-key iconInfo"></i>
<el-input placeholder="请输入密码" ref="pass" v-model="user.pass" type="password" show-password></el-input> <el-input placeholder="请输入密码" ref="pass" v-model="user.pass" type="password" show-password></el-input>
</div> </div>
<div> <div>
<el-checkbox label="记住密码" name="type" style="float: left" ></el-checkbox> <el-checkbox label="记住密码" name="type" style="float: left"></el-checkbox>
<div style="float: left;margin-left: 400px;margin-top: -30px;"> <div style="float: left;margin-left: 400px;margin-top: -30px;">
<el-button type="text">忘记密码?</el-button> <el-button type="text">忘记密码?</el-button>
</div> </div>
@ -129,59 +128,60 @@
</div> </div>
</div> </div>
</body> </body>
<script> <script>
new Vue({ new Vue({
el: '#app', el: '#app',
data() { data() {
return { return {
user: { user: {
name: '', name: '',
pass: '' pass: ''
},
}
}, },
created: function () { }
// this.checkLogin(); },
}, created: function () {
methods: { // this.checkLogin();
login() { },
if (!this.user.name) { methods: {
this.$message.error("用户名不能为空"); login() {
this.$refs.name.select() if (!this.user.name) {
return false; this.$message.error("用户名不能为空");
} else if (this.user.pass == "") { this.$refs.name.select()
this.$refs.pass.select() return false;
this.$message.error("密码不能为空"); } else if (this.user.pass === "") {
return false; this.$refs.pass.select()
} this.$message.error("密码不能为空");
const that = this; return false;
const data = {
name: this.user.name,
pass: this.user.pass
}
axios.post('/xinadmin/login', data).then(function (res) {
console.log(res.data)
if (res.data.state == "success") {
sessionStorage.setItem("token", res.data.token);
if (res.data.edit == 0) {
location.href = "editpass.jsp";
} else {
location.href = "home.jsp";
}
} else {
that.$message.error(res.data.mes);
}
})
},
checkLogin() {
const token = sessionStorage.getItem("token");
const str = new Date().getTime()
if (token) {
if ((+token + (2 * 60 * 60 * 1000) > str)) {
location.href = "home.jsp"
}
}
}
} }
}) const that = this;
const data = {
name: this.user.name,
pass: this.user.pass
}
axios.post('/xinadmin/login', data).then(function (res) {
console.log(res.data)
if (res.data.state === "success") {
sessionStorage.setItem("token", res.data.token);
if (res.data.edit === 0) {
location.href = "editpass.jsp";
} else {
location.href = "home.jsp";
}
} else {
that.$message.error(res.data.mes??res.data.mes);
}
})
},
checkLogin() {
const token = sessionStorage.getItem("token");
const str = new Date().getTime()
if (token) {
if ((+token + (2 * 60 * 60 * 1000) > str)) {
location.href = "home.jsp"
}
}
}
}
})
</script> </script>

Binary file not shown.

Binary file not shown.