Merge branch 'dev' of http://192.168.0.75:3000/bonus/gz-att-web-new into dev
This commit is contained in:
commit
45bec7b884
|
|
@ -60,8 +60,8 @@ const user = {
|
||||||
actions: {
|
actions: {
|
||||||
// 登录
|
// 登录
|
||||||
Login({ commit }, userInfo) {
|
Login({ commit }, userInfo) {
|
||||||
const username = userInfo.username.trim()
|
const username = userInfo.usernameEncryption.trim()
|
||||||
const password = userInfo.password
|
const password = userInfo.passwordEncryption
|
||||||
const code = userInfo.code
|
const code = userInfo.code
|
||||||
const uuid = userInfo.uuid
|
const uuid = userInfo.uuid
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,66 @@
|
||||||
|
import CryptoJS from 'crypto-js'
|
||||||
|
|
||||||
|
const cbc_key = CryptoJS.enc.Utf8.parse("zhst@bonus@zhst@")
|
||||||
|
const cbc_iv = CryptoJS.enc.Utf8.parse("1234567812345678")
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AES CBC模式加密
|
||||||
|
* @param {string} word - 需要加密的字符串
|
||||||
|
* @returns {string} - 加密后的字符串
|
||||||
|
*/
|
||||||
|
export function encryptCBC(word) {
|
||||||
|
const srcs = CryptoJS.enc.Utf8.parse(word)
|
||||||
|
const encrypted = CryptoJS.AES.encrypt(srcs, cbc_key, {
|
||||||
|
iv: cbc_iv,
|
||||||
|
mode: CryptoJS.mode.CBC,
|
||||||
|
padding: CryptoJS.pad.Pkcs7
|
||||||
|
})
|
||||||
|
return encrypted.toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AES CBC模式解密
|
||||||
|
* @param {string} word - 需要解密的字符串
|
||||||
|
* @returns {string} - 解密后的字符串
|
||||||
|
*/
|
||||||
|
export function decryptCBC(word) {
|
||||||
|
const decrypted = CryptoJS.AES.decrypt(word, cbc_key, {
|
||||||
|
iv: cbc_iv,
|
||||||
|
mode: CryptoJS.mode.CBC,
|
||||||
|
padding: CryptoJS.pad.Pkcs7
|
||||||
|
})
|
||||||
|
return decrypted.toString(CryptoJS.enc.Utf8)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日期格式化
|
||||||
|
* @param {string} fmt - 格式化模板,如 "yyyy-MM-dd hh:mm:ss"
|
||||||
|
* @param {Date} date - 需要格式化的日期对象
|
||||||
|
* @returns {string} - 格式化后的日期字符串
|
||||||
|
*/
|
||||||
|
export function dateFtt(fmt, date) {
|
||||||
|
const o = {
|
||||||
|
"M+": date.getMonth() + 1, // 月份
|
||||||
|
"d+": date.getDate(), // 日
|
||||||
|
"h+": date.getHours(), // 小时
|
||||||
|
"m+": date.getMinutes(), // 分
|
||||||
|
"s+": date.getSeconds(), // 秒
|
||||||
|
"q+": Math.floor((date.getMonth() + 3) / 3), // 季度
|
||||||
|
"S": date.getMilliseconds() // 毫秒
|
||||||
|
}
|
||||||
|
|
||||||
|
if (/(y+)/.test(fmt)) {
|
||||||
|
fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length))
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const k in o) {
|
||||||
|
if (new RegExp("(" + k + ")").test(fmt)) {
|
||||||
|
fmt = fmt.replace(
|
||||||
|
RegExp.$1,
|
||||||
|
RegExp.$1.length === 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return fmt
|
||||||
|
}
|
||||||
|
|
@ -141,6 +141,7 @@
|
||||||
import { getCodeImg } from "@/api/login";
|
import { getCodeImg } from "@/api/login";
|
||||||
import Cookies from "js-cookie";
|
import Cookies from "js-cookie";
|
||||||
import { encrypt, decrypt } from '@/utils/jsencrypt'
|
import { encrypt, decrypt } from '@/utils/jsencrypt'
|
||||||
|
import { encryptCBC} from '@/utils/aes'
|
||||||
import {getUserById} from "@/api/system/userInfo";
|
import {getUserById} from "@/api/system/userInfo";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
@ -154,7 +155,9 @@ export default {
|
||||||
rememberMe: false,
|
rememberMe: false,
|
||||||
userAgreement: false,
|
userAgreement: false,
|
||||||
code: "",
|
code: "",
|
||||||
uuid: ""
|
uuid: "",
|
||||||
|
usernameEncryption:"",
|
||||||
|
passwordEncryption:"",
|
||||||
},
|
},
|
||||||
loginRules: {
|
loginRules: {
|
||||||
username: [
|
username: [
|
||||||
|
|
@ -227,6 +230,10 @@ export default {
|
||||||
Cookies.remove("password");
|
Cookies.remove("password");
|
||||||
Cookies.remove('rememberMe');
|
Cookies.remove('rememberMe');
|
||||||
}
|
}
|
||||||
|
this.loginForm.usernameEncryption = encryptCBC(this.loginForm.username);
|
||||||
|
this.loginForm.passwordEncryption = encryptCBC(this.loginForm.password);
|
||||||
|
|
||||||
|
console.log("qqq",this.loginForm)
|
||||||
this.$store.dispatch("Login", this.loginForm).then(() => {
|
this.$store.dispatch("Login", this.loginForm).then(() => {
|
||||||
this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
|
this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
|
||||||
// this.$router.push({ path: this.redirect || "/gz-att/" }).catch(()=>{});
|
// this.$router.push({ path: this.redirect || "/gz-att/" }).catch(()=>{});
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,12 @@ export default {
|
||||||
newPassword: [
|
newPassword: [
|
||||||
{ required: true, message: "新密码不能为空", trigger: "blur" },
|
{ required: true, message: "新密码不能为空", trigger: "blur" },
|
||||||
{ min: 6, max: 20, message: "长度在 6 到 20 个字符", trigger: "blur" },
|
{ min: 6, max: 20, message: "长度在 6 到 20 个字符", trigger: "blur" },
|
||||||
{ pattern: /^[^<>"'|\\]+$/, message: "不能包含非法字符:< > \" ' \\\ |", trigger: "blur" }
|
{ pattern: /^[^<>"'|\\]+$/, message: "不能包含非法字符:< > \" ' \\\ |", trigger: "blur" },
|
||||||
|
{
|
||||||
|
pattern: /^(?!.*(?:123456|password|admin|abc123|111111|123123))(?=.*[A-Z])(?=.*[a-z])(?=.*\d).+$/,
|
||||||
|
message: "密码不能是常见弱密码,必须包含大小写字母和数字",
|
||||||
|
trigger: "blur"
|
||||||
|
}
|
||||||
],
|
],
|
||||||
confirmPassword: [
|
confirmPassword: [
|
||||||
{ required: true, message: "确认密码不能为空", trigger: "blur" },
|
{ required: true, message: "确认密码不能为空", trigger: "blur" },
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue