Browse Source

update----用户管理激活,加密

huac 3 years ago
parent
commit
2f96df0637

+ 2 - 1
package.json

@@ -44,7 +44,8 @@
     "x2js": "^3.3.0",
     "xlsx": "^0.11.13",
     "xlsx-style": "^0.8.13",
-    "xterm": "3.12.0"
+    "xterm": "3.12.0",
+    "jssha": "^3.2.0"
   },
   "devDependencies": {
     "@vue/test-utils": "^1.0.0-beta.24",

+ 1 - 1
src/config/routerBefore.js

@@ -129,7 +129,7 @@ const routerBefore = function (router, constantRouterMap) {
       DoneCookie(to, from, next, flag)
     }
     //
-    function DoneCookie (to, from, next, a) {
+    function DoneCookie (to, from, next, flag) {
       if (getCookie('accessToken')) { // 判断是否有token
         if (window.top.document.URL === window.document.URL && !window.top.localStorage.getItem('ownPrivilege')) {
           store.dispatch('getOwnMenuUrl');

+ 6 - 2
src/views/index/components/login.vue

@@ -133,13 +133,15 @@
 import { cookieUserId, cookieTime, cookieUserName } from '@/config/config.js';
 import { setCookie, getCookie, formatDate } from '@/utils/util.js';
 import store from '@/store/index.js';
-
+import JsSHA from 'jssha'
+const shaObj = new JsSHA('SHA-1', 'TEXT', { encoding: 'UTF8' })
 export default {
     data () {
         return {
             store,
             loginBtnLoading: false,
             pwdShow: false,
+            shaObj,
             loginForm: {
                 loginName: '',
                 password: '',
@@ -203,7 +205,9 @@ export default {
                     // /*
                     // 登陆中 登录按钮不可用
                     this.loginBtnLoading = true;
-                    let form = this.loginForm;
+                    let form = JSON.parse(JSON.stringify(this.loginForm));
+                        this.shaObj.update(form.password)
+                        form.password = this.shaObj.getHash('HEX')
                     this.store.dispatch('index/login/login', form).then(res => {
                       if (res.code === '0') {
                         //  登录成功

+ 26 - 0
src/views/systemConfig/components/usersManage.vue

@@ -296,6 +296,11 @@
                                         v-privilege="activeMenu + 'DELETE'"
                                         style="color: #ff474e"
                                     >删除</el-dropdown-item>
+                                    <el-dropdown-item
+                                        :command="['active', scope.row]"
+                                        v-privilege="activeMenu + 'acitve'"
+                                        style="color: #ff474e"
+                                    >激活</el-dropdown-item>
                                 </el-dropdown-menu>
                             </el-dropdown>
                         </template>
@@ -703,6 +708,9 @@ export default {
                     break;
                 case 'tyqy':
                     this.editUser(item);
+                    break;
+                case 'active':
+                    this.activation(item);
                     break
             }
         },
@@ -844,6 +852,24 @@ export default {
                 this.postModal.items = [...this.postModal.items];
             }, 100);
         },
+        activation(item) {
+            let data = new FormData();
+            let that = this;
+            data.append("loginStatus", "1");
+            data.append("leave", "");
+            that.store
+                .dispatch("system/usersManage/editUser", {
+                id: item.userId,
+                form: data,
+                })
+                .then((res) => {
+                if (res.code === "0") {
+                    that.$message.success("该账户已成功激活");
+                } else {
+                    that.$message.error(res.message);
+                }
+                });
+            },
         // 选择
         postSelectChange (items) {
             this.postModal.items = items;