Browse Source

修改密码加密

dev
caoyizhong 3 years ago
parent
commit
6d46ca7914
  1. 20
      public/index.html
  2. BIN
      src/assets/beiJing.jpg
  3. 2
      src/components/layouts/TabLayout.vue
  4. 2
      src/components/layouts/UserLayout.vue
  5. 2
      src/components/page/GlobalHeader.vue
  6. 6
      src/components/tools/Logo.vue
  7. 8
      src/components/tools/UserPassword.vue
  8. 2
      src/defaultSettings.js
  9. 144
      src/utils/encryption/signMd5Utils.js
  10. 240
      src/views/dashboard/NewHomePage.vue
  11. 34
      src/views/user/Login.vue

20
public/index.html vendored

@ -5,9 +5,9 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>Jeecg-Boot 企业级快速开发平台</title>
<link rel="icon" href="<%= BASE_URL %>logo.png">
<script src="<%= BASE_URL %>cdn/babel-polyfill/polyfill_7_2_5.js"></script>
<title>昊易信息管理平台</title>
<!-- <link rel="icon" href="<%= BASE_URL %>logo.png">-->
<!-- <script src="<%= BASE_URL %>cdn/babel-polyfill/polyfill_7_2_5.js"></script>-->
<link rel="stylesheet" href="<%= BASE_URL %>Cesium/Widgets/widgets.css">
<style>
html,
@ -248,14 +248,14 @@
<body>
<div id="app">
<div id="loader-wrapper">
<div id="loader"></div>
<div class="loader-section section-left"></div>
<div class="loader-section section-right"></div>
<div class="load_title">正在加载 Jeecg-Boot 快速开发平台,请耐心等待
<!-- <div id="loader-wrapper">-->
<!-- <div id="loader"></div>-->
<!-- <div class="loader-section section-left"></div>-->
<!-- <div class="loader-section section-right"></div>-->
<!-- <div class="load_title">正在加载 昊易信息管理平台,请耐心等待-->
</div>
</div>
<!-- </div>-->
<!-- </div>-->
</div>
<script src="<%= BASE_URL %>Cesium/Cesium.js"></script>
</body>

BIN
src/assets/beiJing.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 KiB

2
src/components/layouts/TabLayout.vue

@ -171,7 +171,7 @@
// update-begin-author:sunjianlei date:20200120 for:
changeTitle(title) {
let projectTitle = "Jeecg-Boot 企业级快速开发平台"
let projectTitle = "昊易信息管理平台"
//
if (this.$route.path === indexKey) {
document.title = projectTitle

2
src/components/layouts/UserLayout.vue

@ -65,7 +65,7 @@
.container {
width: 100%;
min-height: 100%;
background: #f0f2f5 url(~@/assets/background.png) no-repeat 50%;
background: #f0f2f5 url(~@assets/beiJing.jpg) no-repeat 50%;
background-size: 100%;
padding: 110px 0 144px;
position: relative;

2
src/components/page/GlobalHeader.vue

@ -17,7 +17,7 @@
:type="collapsed ? 'menu-unfold' : 'menu-fold'"
@click="toggle"/>
<span v-if="device === 'desktop'">欢迎进入 Jeecg-Boot 企业级快速开发平台</span>
<span v-if="device === 'desktop'">欢迎进入 昊易信息管理平台</span>
<span v-else>Jeecg-Boot</span>
<user-menu :theme="theme"/>

6
src/components/tools/Logo.vue

@ -3,8 +3,8 @@
<router-link :to="{name:'dashboard'}">
<!-- update-begin- author:sunjianlei --- date:20190814 --- for: logo颜色根据主题颜色变化 -->
<img v-if="navTheme === 'dark'" src="~@/assets/logo-white.png" alt="logo">
<img v-else src="~@/assets/logo.svg" alt="logo">
<!-- <img v-if="navTheme === 'dark'" src="~@/assets/logo-white.png" alt="logo">-->
<!-- <img v-else src="~@/assets/logo.svg" alt="logo">-->
<!-- update-begin- author:sunjianlei --- date:20190814 --- for: logo颜色根据主题颜色变化 -->
<h1 v-if="showTitle">{{ title }}</h1>
@ -21,7 +21,7 @@
props: {
title: {
type: String,
default: 'Jeecg-Boot Pro',
default: '昊易信息管理平台',
required: false
},
showTitle: {

8
src/components/tools/UserPassword.vue

@ -40,6 +40,7 @@
<script>
import { putAction } from '@/api/manage'
import signMd5Utils from '../../utils/encryption/signMd5Utils'
export default {
name: "UserPassword",
@ -110,8 +111,11 @@
//
this.form.validateFields((err, values) => {
if (!err) {
that.confirmLoading = true;
let params = Object.assign({username:this.username},values)
// that.confirmLoading = true;
values.password = signMd5Utils.md5password(values.password);
values.confirmpassword = signMd5Utils.md5password(values.confirmpassword);
// console.log(values.password);
let params = Object.assign({username: this.username },values)
console.log("修改密码提交数据",params)
putAction(this.url,params).then((res)=>{
if(res.success){

2
src/defaultSettings.js

@ -15,7 +15,7 @@
export default {
primaryColor: '#1890FF', // primary color of ant design
navTheme: 'light', // theme for nav menu
navTheme: 'dark', // theme for nav menu
layout: 'sidemenu', // nav menu position: sidemenu or topmenu
contentWidth: 'Fixed', // layout of content: Fluid or Fixed, only works when layout is topmenu
fixedHeader: false, // sticky header

144
src/utils/encryption/signMd5Utils.js

@ -0,0 +1,144 @@
import md5 from 'md5'
//签名密钥串(前后端要一致,正式发布请自行修改)
const signatureSecret = "dd05f1c54d63749eda95f9fa6d49v442a";
const salt='smallflameSpringBoot@123456';
export default class signMd5Utils {
/**
* json参数升序
* @param jsonObj 发送参数
*/
static sortAsc(jsonObj) {
let arr = new Array();
let num = 0;
for (let i in jsonObj) {
arr[num] = i;
num++;
}
let sortArr = arr.sort();
let sortObj = {};
for (let i in sortArr) {
sortObj[sortArr[i]] = jsonObj[sortArr[i]];
}
return sortObj;
}
static md5password(password){
return md5(salt.charAt(0) + salt.charAt(2) + password + salt.charAt(5) + salt.charAt(4));
}
/**
* @param url 请求的url,应该包含请求参数(url的?后面的参数)
* @param requestParams 请求参数(POST的JSON参数)
* @returns {string} 获取签名
*/
static getSign(url, requestParams) {
let urlParams = this.parseQueryString(url);
let jsonObj = this.mergeObject(urlParams, requestParams);
//console.log("sign jsonObj: ",jsonObj)
let requestBody = this.sortAsc(jsonObj);
// console.log("sign requestBody: ",requestBody)
return md5(JSON.stringify(requestBody) + signatureSecret).toUpperCase();
}
/**
* @param url 请求的url
* @returns {{}} 将url中请求参数组装成json对象(url的?后面的参数)
*/
static parseQueryString(url) {
let urlReg = /^[^\?]+\?([\w\W]+)$/,
paramReg = /([^&=]+)=([\w\W]*?)(&|$|#)/g,
urlArray = urlReg.exec(url),
result = {};
// 获取URL上最后带逗号的参数变量 sys/dict/getDictItems/sys_user,realname,username
//【这边条件没有encode】带条件参数例子:/sys/dict/getDictItems/sys_user,realname,id,username!='admin'%20order%20by%20create_time
let lastpathVariable = url.substring(url.lastIndexOf('/') + 1);
if(lastpathVariable.includes(",")){
if(lastpathVariable.includes("?")){
lastpathVariable = lastpathVariable.substring(0, lastpathVariable.indexOf("?"));
}
//解决Sign 签名校验失败 #2728
result["x-path-variable"] = decodeURIComponent(lastpathVariable);
}
if (urlArray && urlArray[1]) {
let paramString = urlArray[1], paramResult;
while ((paramResult = paramReg.exec(paramString)) != null) {
//数字值转为string类型,前后端加密规则保持一致
if(this.myIsNaN(paramResult[2])){
paramResult[2] = paramResult[2].toString()
}
result[paramResult[1]] = paramResult[2];
}
}
return result;
}
/**
* @returns {*} 将两个对象合并成一个
*/
static mergeObject(objectOne, objectTwo) {
if (objectTwo && Object.keys(objectTwo).length > 0) {
for (let key in objectTwo) {
if (objectTwo.hasOwnProperty(key) === true) {
//数字值转为string类型,前后端加密规则保持一致
if(this.myIsNaN(objectTwo[key])){
objectTwo[key] = objectTwo[key].toString()
}
objectOne[key] = objectTwo[key];
}
}
}
return objectOne;
}
static urlEncode(param, key, encode) {
if (param == null) return '';
let paramStr = '';
let t = typeof (param);
if (t == 'string' || t == 'number' || t == 'boolean') {
paramStr += '&' + key + '=' + ((encode == null || encode) ? encodeURIComponent(param) : param);
} else {
for (let i in param) {
let k = key == null ? i : key + (param instanceof Array ? '[' + i + ']' : '.' + i);
paramStr += this.urlEncode(param[i], k, encode);
}
}
return paramStr;
};
/**
* 接口签名用 生成header中的时间戳
* @returns {number}
*/
static getTimestamp(){
return new Date().getTime()
}
// /**
// * 获取客户端时间(签名参数 X_TIMESTAMP)
// * @returns {string}
// */
// static getDateTimeToString() {
// const date_ = new Date()
// const year = date_.getFullYear()
// let month = date_.getMonth() + 1
// let day = date_.getDate()
// if (month < 10) month = '0' + month
// if (day < 10) day = '0' + day
// let hours = date_.getHours()
// let mins = date_.getMinutes()
// let secs = date_.getSeconds()
// const msecs = date_.getMilliseconds()
// if (hours < 10) hours = '0' + hours
// if (mins < 10) mins = '0' + mins
// if (secs < 10) secs = '0' + secs
// if (msecs < 10) secs = '0' + msecs
// return year + '' + month + '' + day + '' + hours + '' + mins + '' + secs
// }
// true:数值型的,false:非数值型
static myIsNaN(value) {
return typeof value === 'number' && !isNaN(value);
}
}

240
src/views/dashboard/NewHomePage.vue

@ -208,113 +208,67 @@ name: "NewHomePage",
// data: ['', '']
},
grid: {
top: 70,
bottom: 50
top: 50,
left: 50,
bottom: 80
},
xAxis: [
// xAxis: [
// {
// type: 'category',
// axisTick: {
// alignWithLabel: true
// },
// axisLine: {
// onZero: false,
// lineStyle: {
// color: colors[1]
// }
// },
// axisPointer: {
// // label: {
// // formatter: function (params) {
// // return (
// // ' ' +
// // params.value +
// // (params.seriesData.length ? '' + params.seriesData[0].data : '')
// // );
// // }
// // }
// },
// // prettier-ignore
// data: ['', '', '', '', '', '', '', '', '', '', '', '']
// },
// {
// type: 'category',
// axisTick: {
// alignWithLabel: true
// },
// axisLine: {
// onZero: false,
// lineStyle: {
// color: colors[0]
// }
// },
// axisPointer: {
// // label: {
// // formatter: function (params) {
// // return (
// // ' ' +
// // params.value +
// // (params.seriesData.length ? '' + params.seriesData[0].data : '')
// // );
// // }
// // }
// },
// // prettier-ignore
// data: ['', '', '', '', '', '', '', '', '', '', '', '']
// }
// ],
xAxis:
{
type: 'category',
axisTick: {
alignWithLabel: true
},
axisLine: {
onZero: false,
lineStyle: {
color: colors[1]
}
},
axisPointer: {
// label: {
// formatter: function (params) {
// return (
// ' ' +
// params.value +
// (params.seriesData.length ? '' + params.seriesData[0].data : '')
// );
// }
// }
},
// prettier-ignore
data: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月']
},
{
type: 'category',
axisTick: {
alignWithLabel: true
},
axisLine: {
onZero: false,
lineStyle: {
color: colors[0]
}
},
axisPointer: {
// label: {
// formatter: function (params) {
// return (
// ' ' +
// params.value +
// (params.seriesData.length ? '' + params.seriesData[0].data : '')
// );
// }
// }
},
// prettier-ignore
data: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月']
}
],
// xAxis: [
// {
// type: 'category',
// axisTick: {
// alignWithLabel: true
// },
// axisLine: {
// onZero: false,
// lineStyle: {
// color: colors[1]
// }
// },
// axisPointer: {
// // label: {
// // formatter: function (params) {
// // return (
// // ' ' +
// // params.value +
// // (params.seriesData.length ? '' + params.seriesData[0].data : '')
// // );
// // }
// // }
// },
// // prettier-ignore
// data: ['', '', '', '', '', '', '', '', '', '', '', '']
// },
// {
// type: 'category',
// axisTick: {
// alignWithLabel: true
// },
// axisLine: {
// onZero: false,
// lineStyle: {
// color: colors[0]
// }
// },
// axisPointer: {
// // label: {
// // formatter: function (params) {
// // return (
// // ' ' +
// // params.value +
// // (params.seriesData.length ? '' + params.seriesData[0].data : '')
// // );
// // }
// // }
// },
// // prettier-ignore
// data: ['', '', '', '', '', '', '', '', '', '', '', '']
// }
// ],
yAxis: [
{
type: 'value'
@ -324,11 +278,11 @@ name: "NewHomePage",
{
name: '数据一',
type: 'line',
xAxisIndex: 1,
// smooth: true,
emphasis: {
focus: 'series'
},
// xAxisIndex: 1,
// // smooth: true,
// emphasis: {
// focus: 'series'
// },
data: [
2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3
]
@ -336,10 +290,10 @@ name: "NewHomePage",
{
name: '数据二',
type: 'line',
// smooth: true,
emphasis: {
focus: 'series'
},
// // smooth: true,
// emphasis: {
// focus: 'series'
// },
data: [
3.9, 5.9, 11.1, 18.7, 48.3, 69.2, 231.6, 46.6, 55.4, 18.4, 10.3, 0.7
]
@ -395,8 +349,18 @@ name: "NewHomePage",
}
]
};
let dimensionData = [
{ name: '一月', max: 6500 },
{ name: '二月', max: 16000 },
{ name: '三月', max: 30000 },
{ name: '四月', max: 38000 },
{ name: '五月', max: 52000 },
{ name: '六月', max: 25000 }
];
let a= [];
let option3 = {
// title: {
// text: 'Basic Radar Chart'
// },
@ -409,26 +373,50 @@ name: "NewHomePage",
//
type: 'shadow' // 线'line' | 'shadow'
},
formatter: '{a} <br/>{b} : {c} <br/>百分比 : {d}%' //{a}{b}{c}, {d}
// formatter: '{a} <br/>{b} : {c} ' //{a}{b}{c}, {d}
textStyle:{
align:'left' //
},
formatter: function (params,x,y) {
// console.log(params,"");
a= [];
dimensionData.forEach( (item,index) =>{
a.push(' '+item.name+' '+params.data.value[index]+'<br/>')
} )
return params.data.name+'<br/>'+a.join('');
}
},
grid: {
x: 45,//
y: 45,//
x2: 55, //
y2: 75, //
borderWidth: 1,
top: 150,
left: 50,
bottom: 80
},
// grid: {
// x: 45,//
// y: 75,//
// x2: 55, //
// y2: 75, //
// borderWidth: 1,
// },
radar: {
// shape: 'circle',
indicator: [
{ name: '一月', max: 6500 },
{ name: '二月', max: 16000 },
{ name: '三月', max: 30000 },
{ name: '四月', max: 38000 },
{ name: '五月', max: 52000 },
{ name: '六月', max: 25000 }
]
radar: '50%',
nameGap: 1,
center: ["50%","50%"],
name:{
textStyle: {
color:'rgb(15,15,16)',
},
formatter: function(name){
return name;
}
},
indicator: dimensionData,
},
series: [
{
name: '',

34
src/views/user/Login.vue

@ -1,5 +1,5 @@
<template>
<div class="main" style="background: rgba(0,0,0,.25)">
<div class="main" style="background: rgba(132,122,122,0.25);padding: 20px 20px;">
<a-form :form="form" class="user-layout-login" ref="formLogin" id="formLogin">
<a-tabs
:activeKey="customActiveKey"
@ -130,6 +130,10 @@
import { USER_INFO } from "@/store/mutation-types"
import ThirdLogin from './third/ThirdLogin'
import LoginSelectTenant from "./LoginSelectTenant";
import signMd5Utils from '../../utils/encryption/signMd5Utils'
export default {
components: {
LoginSelectTenant,
@ -200,25 +204,31 @@
that.loginBtn = true;
// 使
if (that.customActiveKey === 'tab1') {
signMd5Utils.myIsNaN();
that.form.validateFields([ 'username', 'password','inputCode', 'rememberMe' ], { force: true }, (err, values) => {
if (!err) {
loginParams.username = values.username
// update-begin- --- author:scott ------ date:20190805 ---- for:
//loginParams.password = md5(values.password)
//loginParams.password = encryption(values.password,that.encryptedString.key,that.encryptedString.iv)
loginParams.password = values.password
loginParams.remember_me = values.rememberMe
// update-begin- --- author:scott ------ date:20190805 ---- for:
loginParams.captcha = that.inputCodeContent
loginParams.checkKey = that.currdatetime
// loginParams.username = values.username
// // update-begin- --- author:scott ------ date:20190805 ---- for:
// //loginParams.password = md5(values.password)
// //loginParams.password = encryption(values.password,that.encryptedString.key,that.encryptedString.iv)
// loginParams.password = signMd5Utils.md5password(values.password);
// loginParams.remember_me = values.rememberMe;
// // update-begin- --- author:scott ------ date:20190805 ---- for:
// loginParams.captcha = that.inputCodeContent
// loginParams.checkKey = that.currdatetime
let loginParams={
username: values.username,
password: signMd5Utils.md5password(values.password),
remember_me: values.rememberMe,
captcha: that.inputCodeContent,
checkKey: that.currdatetime
}
console.log("登录参数",loginParams)
that.Login(loginParams).then((res) => {
this.$refs.loginSelect.show(res.result)
}).catch((err) => {
that.requestFailed(err);
});
}else {
that.loginBtn = false;
}

Loading…
Cancel
Save