Compare commits
No commits in common. "79458b216c9295cfc5a59b3bfb897d9d8a290348" and "a945702461427e188c89f9f2131f66c915175655" have entirely different histories.
79458b216c
...
a945702461
|
@ -192,10 +192,6 @@ export const mer_admin = {
|
||||||
changePassword: (data) => {
|
changePassword: (data) => {
|
||||||
return $http.put(`/merchant-api/auth/change/pwd`, data);
|
return $http.put(`/merchant-api/auth/change/pwd`, data);
|
||||||
},
|
},
|
||||||
//修改简单密码
|
|
||||||
simplePassword: (data) => {
|
|
||||||
return $http.put(`/merchant-api/auth/update_password`, data);
|
|
||||||
},
|
|
||||||
//修改管理员
|
//修改管理员
|
||||||
editAdmin: (data) => {
|
editAdmin: (data) => {
|
||||||
return $http.put(`/merchant-api/brand/change/administrator`, data);
|
return $http.put(`/merchant-api/brand/change/administrator`, data);
|
||||||
|
|
|
@ -1,16 +1,14 @@
|
||||||
import Vue from "vue";
|
import Vue from 'vue'
|
||||||
import router from "@/router";
|
import router from '@/router'
|
||||||
import store from "@/store";
|
import store from '@/store'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取uuid
|
* 获取uuid
|
||||||
*/
|
*/
|
||||||
export function getUUID () {
|
export function getUUID () {
|
||||||
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
|
||||||
return (c === "x" ? (Math.random() * 16) | 0 : "r&0x3" | "0x8").toString(
|
return (c === 'x' ? (Math.random() * 16 | 0) : ('r&0x3' | '0x8')).toString(16)
|
||||||
16
|
})
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -18,10 +16,7 @@ export function getUUID() {
|
||||||
* @param {*} key
|
* @param {*} key
|
||||||
*/
|
*/
|
||||||
export function isAuth (key) {
|
export function isAuth (key) {
|
||||||
return (
|
return JSON.parse(sessionStorage.getItem('permissions') || '[]').indexOf(key) !== -1 || false
|
||||||
JSON.parse(sessionStorage.getItem("permissions") || "[]").indexOf(key) !==
|
|
||||||
-1 || false
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -30,89 +25,83 @@ export function isAuth(key) {
|
||||||
* @param {*} id
|
* @param {*} id
|
||||||
* @param {*} pid
|
* @param {*} pid
|
||||||
*/
|
*/
|
||||||
export function treeDataTranslate(data, id = "id", pid = "parentId") {
|
export function treeDataTranslate (data, id = 'id', pid = 'parentId') {
|
||||||
var res = [];
|
var res = []
|
||||||
var temp = {};
|
var temp = {}
|
||||||
for (var i = 0; i < data.length; i++) {
|
for (var i = 0; i < data.length; i++) {
|
||||||
temp[data[i][id]] = data[i];
|
temp[data[i][id]] = data[i]
|
||||||
}
|
}
|
||||||
for (var k = 0; k < data.length; k++) {
|
for (var k = 0; k < data.length; k++) {
|
||||||
if (temp[data[k][pid]] && data[k][id] !== data[k][pid]) {
|
if (temp[data[k][pid]] && data[k][id] !== data[k][pid]) {
|
||||||
if (!temp[data[k][pid]]["children"]) {
|
if (!temp[data[k][pid]]['children']) {
|
||||||
temp[data[k][pid]]["children"] = [];
|
temp[data[k][pid]]['children'] = []
|
||||||
}
|
}
|
||||||
if (!temp[data[k][pid]]["_level"]) {
|
if (!temp[data[k][pid]]['_level']) {
|
||||||
temp[data[k][pid]]["_level"] = 1;
|
temp[data[k][pid]]['_level'] = 1
|
||||||
}
|
}
|
||||||
data[k]["_level"] = temp[data[k][pid]]._level + 1;
|
data[k]['_level'] = temp[data[k][pid]]._level + 1
|
||||||
temp[data[k][pid]]["children"].push(data[k]);
|
temp[data[k][pid]]['children'].push(data[k])
|
||||||
} else {
|
} else {
|
||||||
res.push(data[k]);
|
res.push(data[k])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return res;
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 清除登录信息
|
* 清除登录信息
|
||||||
*/
|
*/
|
||||||
export function clearLoginInfo () {
|
export function clearLoginInfo () {
|
||||||
Vue.cookie.delete("token");
|
Vue.cookie.delete('token')
|
||||||
store.commit("resetStore");
|
store.commit('resetStore')
|
||||||
sessionStorage.removeItem("password");
|
router.options.isAddDynamicMenuRoutes = false
|
||||||
sessionStorage.removeItem("role");
|
|
||||||
sessionStorage.removeItem("userInfo");
|
|
||||||
router.options.isAddDynamicMenuRoutes = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 深拷贝对象
|
// 深拷贝对象
|
||||||
export function deepClone(obj) {
|
export function deepClone(obj) {
|
||||||
const _toString = Object.prototype.toString;
|
const _toString = Object.prototype.toString
|
||||||
|
|
||||||
// null, undefined, non-object, function
|
// null, undefined, non-object, function
|
||||||
if (!obj || typeof obj !== "object") {
|
if (!obj || typeof obj !== 'object') {
|
||||||
return obj;
|
return obj
|
||||||
}
|
}
|
||||||
|
|
||||||
// DOM Node
|
// DOM Node
|
||||||
if (obj.nodeType && "cloneNode" in obj) {
|
if (obj.nodeType && 'cloneNode' in obj) {
|
||||||
return obj.cloneNode(true);
|
return obj.cloneNode(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Date
|
// Date
|
||||||
if (_toString.call(obj) === "[object Date]") {
|
if (_toString.call(obj) === '[object Date]') {
|
||||||
return new Date(obj.getTime());
|
return new Date(obj.getTime())
|
||||||
}
|
}
|
||||||
|
|
||||||
// RegExp
|
// RegExp
|
||||||
if (_toString.call(obj) === "[object RegExp]") {
|
if (_toString.call(obj) === '[object RegExp]') {
|
||||||
const flags = [];
|
const flags = []
|
||||||
if (obj.global) {
|
if (obj.global) {
|
||||||
flags.push("g");
|
flags.push('g')
|
||||||
}
|
}
|
||||||
if (obj.multiline) {
|
if (obj.multiline) {
|
||||||
flags.push("m");
|
flags.push('m')
|
||||||
}
|
}
|
||||||
if (obj.ignoreCase) {
|
if (obj.ignoreCase) {
|
||||||
flags.push("i");
|
flags.push('i')
|
||||||
}
|
}
|
||||||
|
|
||||||
return new RegExp(obj.source, flags.join(""));
|
return new RegExp(obj.source, flags.join(''))
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = Array.isArray(obj)
|
const result = Array.isArray(obj) ? [] : obj.constructor ? new obj.constructor() : {}
|
||||||
? []
|
|
||||||
: obj.constructor
|
|
||||||
? new obj.constructor()
|
|
||||||
: {};
|
|
||||||
|
|
||||||
for (const key in obj) {
|
for (const key in obj) {
|
||||||
result[key] = deepClone(obj[key]);
|
result[key] = deepClone(obj[key])
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isNumberStr(str) {
|
export function isNumberStr(str) {
|
||||||
return /^[+-]?(0|([1-9]\d*))(\.\d+)?$/g.test(str);
|
return /^[+-]?(0|([1-9]\d*))(\.\d+)?$/g.test(str)
|
||||||
}
|
}
|
|
@ -9,42 +9,17 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="mod-home">
|
<div class="mod-home">
|
||||||
<el-dialog
|
<el-dialog
|
||||||
title="提示:当前密码安全级别较低,请您修改密码"
|
title="提示:您的密码过于简单,请您修改密码"
|
||||||
:visible.sync="dialogVisible"
|
:visible.sync="dialogVisible"
|
||||||
width="500px"
|
width="30%"
|
||||||
:show-close="false"
|
:show-close="false"
|
||||||
:destroy-on-close="true"
|
:destroy-on-close="true"
|
||||||
:close-on-click-modal="false"
|
:close-on-click-modal="false"
|
||||||
>
|
>
|
||||||
<el-form ref="ruleForm" :model="form" :rules="rules">
|
<span>这是一段信息</span>
|
||||||
<el-form-item
|
|
||||||
label="新密码"
|
|
||||||
:label-width="formLabelWidth"
|
|
||||||
prop="password"
|
|
||||||
>
|
|
||||||
<el-input
|
|
||||||
placeholder="请输入新密码"
|
|
||||||
style="width: 240px; margin-right: 20px"
|
|
||||||
v-model="form.password"
|
|
||||||
show-password
|
|
||||||
></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item
|
|
||||||
prop="isPassword"
|
|
||||||
label="确认新密码:"
|
|
||||||
:label-width="formLabelWidth"
|
|
||||||
>
|
|
||||||
<el-input
|
|
||||||
style="width: 240px"
|
|
||||||
placeholder="请再次输入新密码"
|
|
||||||
v-model="form.isPassword"
|
|
||||||
show-password
|
|
||||||
></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
<span slot="footer" class="dialog-footer">
|
<span slot="footer" class="dialog-footer">
|
||||||
<!-- <el-button @click="dialogVisible = false">取 消</el-button> -->
|
<!-- <el-button @click="dialogVisible = false">取 消</el-button> -->
|
||||||
<el-button type="primary" @click="confirmPassword"
|
<el-button type="primary" @click="dialogVisible = false"
|
||||||
>确定并重新登入</el-button
|
>确定并重新登入</el-button
|
||||||
>
|
>
|
||||||
</span>
|
</span>
|
||||||
|
@ -53,65 +28,10 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { clearLoginInfo } from "@/utils";
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
formLabelWidth: "120px",
|
|
||||||
form: {
|
|
||||||
isPassword: "",
|
|
||||||
password: "",
|
|
||||||
},
|
|
||||||
rules: {
|
|
||||||
password: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: "请输入新密码",
|
|
||||||
trigger: "blur",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
min: 8,
|
|
||||||
max: 12,
|
|
||||||
message:
|
|
||||||
"密码由8-12位字母、数字、特殊符号(~、@、#、$、%、*)的组成,请重新输入",
|
|
||||||
trigger: "blur",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
trigger: "blur",
|
|
||||||
validator: (rule, value, callback) => {
|
|
||||||
var passwordreg =
|
|
||||||
/(?=.*\d)(?=.*[a-zA-Z])(?=.*[^a-zA-Z0-9]).{8,12}/;
|
|
||||||
if (!passwordreg.test(value)) {
|
|
||||||
callback(
|
|
||||||
new Error(
|
|
||||||
"密码由8-12位字母、数字、特殊符号(~、@、#、$、%、*)的组成,请重新输入"
|
|
||||||
)
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
callback();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
isPassword: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: "请输入确认密码",
|
|
||||||
trigger: "blur",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
trigger: "blur",
|
|
||||||
validator: (rule, value, callback) => {
|
|
||||||
if (value != this.form.password) {
|
|
||||||
callback(new Error("密码输入不一致"));
|
|
||||||
} else {
|
|
||||||
callback();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
@ -122,27 +42,6 @@ export default {
|
||||||
this.dialogVisible = true;
|
this.dialogVisible = true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
|
||||||
confirmPassword() {
|
|
||||||
this.$refs.ruleForm.validate((valid) => {
|
|
||||||
console.log(valid);
|
|
||||||
if (valid) {
|
|
||||||
this.$api.mer_admin
|
|
||||||
.simplePassword({
|
|
||||||
password: this.form.password,
|
|
||||||
})
|
|
||||||
.then((res) => {
|
|
||||||
this.$api.logout().then(({ data }) => {
|
|
||||||
clearLoginInfo();
|
|
||||||
this.$router.push({ name: "login" });
|
|
||||||
});
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -630,7 +630,7 @@ export default {
|
||||||
return callback(new Error("请输入银行卡号"));
|
return callback(new Error("请输入银行卡号"));
|
||||||
} else if (!Number.isInteger(+value)) {
|
} else if (!Number.isInteger(+value)) {
|
||||||
callback(new Error("银行卡号必须全为数字"));
|
callback(new Error("银行卡号必须全为数字"));
|
||||||
} else if (value.trim().length < 12 || value.trim().length > 20) {
|
} else if (value.trim().length < 12 || value.trim().length > 19) {
|
||||||
callback(new Error("银行卡号长度必须在12到19之间"));
|
callback(new Error("银行卡号长度必须在12到19之间"));
|
||||||
} else if (strBin.indexOf(value.substring(0, 2)) === -1) {
|
} else if (strBin.indexOf(value.substring(0, 2)) === -1) {
|
||||||
callback(new Error("银行卡号开头6位不符合规范"));
|
callback(new Error("银行卡号开头6位不符合规范"));
|
||||||
|
|
Loading…
Reference in New Issue