品牌管理
This commit is contained in:
		
							parent
							
								
									1c6c4aa91c
								
							
						
					
					
						commit
						29a483590a
					
				| 
						 | 
				
			
			@ -192,6 +192,10 @@ export const mer_admin = {
 | 
			
		|||
  changePassword: (data) => {
 | 
			
		||||
    return $http.put(`/merchant-api/auth/change/pwd`, data);
 | 
			
		||||
  },
 | 
			
		||||
  //修改简单密码
 | 
			
		||||
  simplePassword: (data) => {
 | 
			
		||||
    return $http.put(`/merchant-api/auth/update_password`, data);
 | 
			
		||||
  },
 | 
			
		||||
  //修改管理员
 | 
			
		||||
  editAdmin: (data) => {
 | 
			
		||||
    return $http.put(`/merchant-api/brand/change/administrator`, data);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,22 +1,27 @@
 | 
			
		|||
import Vue from 'vue'
 | 
			
		||||
import router from '@/router'
 | 
			
		||||
import store from '@/store'
 | 
			
		||||
import Vue from "vue";
 | 
			
		||||
import router from "@/router";
 | 
			
		||||
import store from "@/store";
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 获取uuid
 | 
			
		||||
 */
 | 
			
		||||
export function getUUID () {
 | 
			
		||||
  return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
 | 
			
		||||
    return (c === 'x' ? (Math.random() * 16 | 0) : ('r&0x3' | '0x8')).toString(16)
 | 
			
		||||
  })
 | 
			
		||||
export function getUUID() {
 | 
			
		||||
  return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
 | 
			
		||||
    return (c === "x" ? (Math.random() * 16) | 0 : "r&0x3" | "0x8").toString(
 | 
			
		||||
      16
 | 
			
		||||
    );
 | 
			
		||||
  });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 是否有权限
 | 
			
		||||
 * @param {*} key
 | 
			
		||||
 */
 | 
			
		||||
export function isAuth (key) {
 | 
			
		||||
  return JSON.parse(sessionStorage.getItem('permissions') || '[]').indexOf(key) !== -1 || false
 | 
			
		||||
export function isAuth(key) {
 | 
			
		||||
  return (
 | 
			
		||||
    JSON.parse(sessionStorage.getItem("permissions") || "[]").indexOf(key) !==
 | 
			
		||||
      -1 || false
 | 
			
		||||
  );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
| 
						 | 
				
			
			@ -25,83 +30,89 @@ export function isAuth (key) {
 | 
			
		|||
 * @param {*} id
 | 
			
		||||
 * @param {*} pid
 | 
			
		||||
 */
 | 
			
		||||
export function treeDataTranslate (data, id = 'id', pid = 'parentId') {
 | 
			
		||||
  var res = []
 | 
			
		||||
  var temp = {}
 | 
			
		||||
export function treeDataTranslate(data, id = "id", pid = "parentId") {
 | 
			
		||||
  var res = [];
 | 
			
		||||
  var temp = {};
 | 
			
		||||
  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++) {
 | 
			
		||||
    if (temp[data[k][pid]] && data[k][id] !== data[k][pid]) {
 | 
			
		||||
      if (!temp[data[k][pid]]['children']) {
 | 
			
		||||
        temp[data[k][pid]]['children'] = []
 | 
			
		||||
      if (!temp[data[k][pid]]["children"]) {
 | 
			
		||||
        temp[data[k][pid]]["children"] = [];
 | 
			
		||||
      }
 | 
			
		||||
      if (!temp[data[k][pid]]['_level']) {
 | 
			
		||||
        temp[data[k][pid]]['_level'] = 1
 | 
			
		||||
      if (!temp[data[k][pid]]["_level"]) {
 | 
			
		||||
        temp[data[k][pid]]["_level"] = 1;
 | 
			
		||||
      }
 | 
			
		||||
      data[k]['_level'] = temp[data[k][pid]]._level + 1
 | 
			
		||||
      temp[data[k][pid]]['children'].push(data[k])
 | 
			
		||||
      data[k]["_level"] = temp[data[k][pid]]._level + 1;
 | 
			
		||||
      temp[data[k][pid]]["children"].push(data[k]);
 | 
			
		||||
    } else {
 | 
			
		||||
      res.push(data[k])
 | 
			
		||||
      res.push(data[k]);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  return res
 | 
			
		||||
  return res;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 清除登录信息
 | 
			
		||||
 */
 | 
			
		||||
export function clearLoginInfo () {
 | 
			
		||||
  Vue.cookie.delete('token')
 | 
			
		||||
  store.commit('resetStore')
 | 
			
		||||
  router.options.isAddDynamicMenuRoutes = false
 | 
			
		||||
export function clearLoginInfo() {
 | 
			
		||||
  Vue.cookie.delete("token");
 | 
			
		||||
  store.commit("resetStore");
 | 
			
		||||
  sessionStorage.removeItem("password");
 | 
			
		||||
  sessionStorage.removeItem("role");
 | 
			
		||||
  sessionStorage.removeItem("userInfo");
 | 
			
		||||
  router.options.isAddDynamicMenuRoutes = false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// 深拷贝对象
 | 
			
		||||
export function deepClone(obj) {
 | 
			
		||||
  const _toString = Object.prototype.toString
 | 
			
		||||
  const _toString = Object.prototype.toString;
 | 
			
		||||
 | 
			
		||||
  // null, undefined, non-object, function
 | 
			
		||||
  if (!obj || typeof obj !== 'object') {
 | 
			
		||||
      return obj
 | 
			
		||||
  if (!obj || typeof obj !== "object") {
 | 
			
		||||
    return obj;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // DOM Node
 | 
			
		||||
  if (obj.nodeType && 'cloneNode' in obj) {
 | 
			
		||||
      return obj.cloneNode(true)
 | 
			
		||||
  if (obj.nodeType && "cloneNode" in obj) {
 | 
			
		||||
    return obj.cloneNode(true);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // Date
 | 
			
		||||
  if (_toString.call(obj) === '[object Date]') {
 | 
			
		||||
      return new Date(obj.getTime())
 | 
			
		||||
  if (_toString.call(obj) === "[object Date]") {
 | 
			
		||||
    return new Date(obj.getTime());
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // RegExp
 | 
			
		||||
  if (_toString.call(obj) === '[object RegExp]') {
 | 
			
		||||
      const flags = []
 | 
			
		||||
      if (obj.global) {
 | 
			
		||||
          flags.push('g')
 | 
			
		||||
      }
 | 
			
		||||
      if (obj.multiline) {
 | 
			
		||||
          flags.push('m')
 | 
			
		||||
      }
 | 
			
		||||
      if (obj.ignoreCase) {
 | 
			
		||||
          flags.push('i')
 | 
			
		||||
      }
 | 
			
		||||
  if (_toString.call(obj) === "[object RegExp]") {
 | 
			
		||||
    const flags = [];
 | 
			
		||||
    if (obj.global) {
 | 
			
		||||
      flags.push("g");
 | 
			
		||||
    }
 | 
			
		||||
    if (obj.multiline) {
 | 
			
		||||
      flags.push("m");
 | 
			
		||||
    }
 | 
			
		||||
    if (obj.ignoreCase) {
 | 
			
		||||
      flags.push("i");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
      return new RegExp(obj.source, flags.join(''))
 | 
			
		||||
    return new RegExp(obj.source, flags.join(""));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  const result = Array.isArray(obj) ? [] : obj.constructor ? new obj.constructor() : {}
 | 
			
		||||
  const result = Array.isArray(obj)
 | 
			
		||||
    ? []
 | 
			
		||||
    : obj.constructor
 | 
			
		||||
    ? new obj.constructor()
 | 
			
		||||
    : {};
 | 
			
		||||
 | 
			
		||||
  for (const key in obj) {
 | 
			
		||||
      result[key] = deepClone(obj[key])
 | 
			
		||||
    result[key] = deepClone(obj[key]);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  return result
 | 
			
		||||
  return result;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function isNumberStr(str) {
 | 
			
		||||
  return /^[+-]?(0|([1-9]\d*))(\.\d+)?$/g.test(str)
 | 
			
		||||
}
 | 
			
		||||
  return /^[+-]?(0|([1-9]\d*))(\.\d+)?$/g.test(str);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -9,17 +9,42 @@
 | 
			
		|||
<template>
 | 
			
		||||
  <div class="mod-home">
 | 
			
		||||
    <el-dialog
 | 
			
		||||
      title="提示:您的密码过于简单,请您修改密码"
 | 
			
		||||
      title="提示:当前密码安全级别较低,请您修改密码"
 | 
			
		||||
      :visible.sync="dialogVisible"
 | 
			
		||||
      width="30%"
 | 
			
		||||
      width="500px"
 | 
			
		||||
      :show-close="false"
 | 
			
		||||
      :destroy-on-close="true"
 | 
			
		||||
      :close-on-click-modal="false"
 | 
			
		||||
    >
 | 
			
		||||
      <span>这是一段信息</span>
 | 
			
		||||
      <el-form ref="ruleForm" :model="form" :rules="rules">
 | 
			
		||||
        <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">
 | 
			
		||||
        <!-- <el-button @click="dialogVisible = false">取 消</el-button> -->
 | 
			
		||||
        <el-button type="primary" @click="dialogVisible = false"
 | 
			
		||||
        <el-button type="primary" @click="confirmPassword"
 | 
			
		||||
          >确定并重新登入</el-button
 | 
			
		||||
        >
 | 
			
		||||
      </span>
 | 
			
		||||
| 
						 | 
				
			
			@ -28,10 +53,65 @@
 | 
			
		|||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import { clearLoginInfo } from "@/utils";
 | 
			
		||||
export default {
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      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() {
 | 
			
		||||
| 
						 | 
				
			
			@ -42,6 +122,27 @@ export default {
 | 
			
		|||
      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>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -630,7 +630,7 @@ export default {
 | 
			
		|||
                return callback(new Error("请输入银行卡号"));
 | 
			
		||||
              } else if (!Number.isInteger(+value)) {
 | 
			
		||||
                callback(new Error("银行卡号必须全为数字"));
 | 
			
		||||
              } else if (value.trim().length < 12 || value.trim().length > 19) {
 | 
			
		||||
              } else if (value.trim().length < 12 || value.trim().length > 20) {
 | 
			
		||||
                callback(new Error("银行卡号长度必须在12到19之间"));
 | 
			
		||||
              } else if (strBin.indexOf(value.substring(0, 2)) === -1) {
 | 
			
		||||
                callback(new Error("银行卡号开头6位不符合规范"));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue