Commit 84cec1468b757df47e0dca0c27a394b79709e716
1 parent
b1b89d35
1. 开发登录界面 根据用户名获取到对应仓库,选取仓库后再登录
Showing
5 changed files
with
49 additions
and
33 deletions
jeecg-boot-master/ant-design-vue-jeecg/src/api/api.js
... | ... | @@ -45,6 +45,7 @@ const searchByKeywords = (params)=>getAction("/sys/sysDepart/searchBy",params) |
45 | 45 | const deleteByDepartId = (params)=>deleteAction("/sys/sysDepart/delete",params); |
46 | 46 | |
47 | 47 | //二级部门管理 |
48 | +export const getWarehouseByUserCode = (params)=>postAction('/sys/getWarehouseByUserCode', params); | |
48 | 49 | const queryDepartPermission = (params)=>getAction("/sys/permission/queryDepartPermission",params); |
49 | 50 | const saveDepartPermission = (params)=>postAction("/sys/permission/saveDepartPermission",params); |
50 | 51 | const queryTreeListForDeptRole = (params)=>getAction("/sys/sysDepartPermission/queryTreeListForDeptRole",params); |
... | ... | @@ -92,6 +93,7 @@ const checkRuleByCode = (params) => getAction('/sys/checkRule/checkByCode', para |
92 | 93 | //加载我的通告信息 |
93 | 94 | const getUserNoticeInfo= (params)=>getAction("/sys/sysAnnouncementSend/getMyAnnouncementSend",params); |
94 | 95 | const getTransitURL = url => `/sys/common/transitRESTful?url=${encodeURIComponent(url)}` |
96 | + | |
95 | 97 | // 中转HTTP请求 |
96 | 98 | export const transitRESTful = { |
97 | 99 | get: (url, parameter) => getAction(getTransitURL(url), parameter), |
... | ... |
jeecg-boot-master/ant-design-vue-jeecg/src/views/user/Login.vue
... | ... | @@ -3,7 +3,7 @@ |
3 | 3 | <a-form-model class="user-layout-login" @keyup.enter.native="handleSubmit"> |
4 | 4 | <a-tabs :activeKey="customActiveKey" :tabBarStyle="{ textAlign: 'center', borderBottom: 'unset' }" @change="handleTabClick"> |
5 | 5 | <a-tab-pane key="tab1" tab="账号密码登录"> |
6 | - <login-account ref="alogin" @validateFail="validateFail" @success="requestSuccess" @fail="requestFailed"></login-account> | |
6 | + <login-account ref="alogin" @validateFail="validateFail" @success="requestSuccess" @fail="requestFailed"></login-account> | |
7 | 7 | </a-tab-pane> |
8 | 8 | |
9 | 9 | <!-- <a-tab-pane key="tab2" tab="手机号登录">--> |
... | ... | @@ -21,6 +21,7 @@ |
21 | 21 | <!-- </router-link>--> |
22 | 22 | <!-- </a-form-model-item>--> |
23 | 23 | |
24 | + | |
24 | 25 | <a-form-item style="margin-top:24px"> |
25 | 26 | <a-button size="large" type="primary" htmlType="submit" class="login-button" :loading="loginBtn" @click.stop.prevent="handleSubmit" :disabled="loginBtn">确定 |
26 | 27 | </a-button> |
... | ... | @@ -61,6 +62,7 @@ export default { |
61 | 62 | loginBtn: false, |
62 | 63 | requiredTwoStepCaptcha: false, |
63 | 64 | stepCaptchaVisible: false, |
65 | + querySource:{}, | |
64 | 66 | encryptedString:{ |
65 | 67 | key:"", |
66 | 68 | iv:"", |
... | ... | @@ -89,6 +91,7 @@ export default { |
89 | 91 | }) |
90 | 92 | }, |
91 | 93 | |
94 | + | |
92 | 95 | //登录 |
93 | 96 | handleSubmit () { |
94 | 97 | this.loginBtn = true; |
... | ... |
jeecg-boot-master/ant-design-vue-jeecg/src/views/user/LoginAccount.vue
... | ... | @@ -2,7 +2,7 @@ |
2 | 2 | <div> |
3 | 3 | <a-form-model ref="form" :model="model" :rules="validatorRules"> |
4 | 4 | <a-form-model-item required prop="username"> |
5 | - <a-input v-model="model.username" size="large" placeholder="请输入帐户名 / admin"> | |
5 | + <a-input v-model="model.username" size="large" placeholder="请输入帐户名 / admin" @keyup="getWarehouse"> | |
6 | 6 | <a-icon slot="prefix" type="user" :style="{ color: 'rgba(0,0,0,.25)' }"/> |
7 | 7 | </a-input> |
8 | 8 | </a-form-model-item> |
... | ... | @@ -12,6 +12,18 @@ |
12 | 12 | </a-input> |
13 | 13 | </a-form-model-item> |
14 | 14 | |
15 | + <a-form-item> | |
16 | + <a-select | |
17 | + show-search | |
18 | + prop="warehouseCode" | |
19 | + v-model="model.warehouseCode" | |
20 | + placeholder="请选择仓库" | |
21 | + option-filter-prop="children" | |
22 | + > | |
23 | + <a-select-option v-for="item in warehouseList" :key="item.name" :value="item.code">{{ item.name }}</a-select-option> | |
24 | + </a-select> | |
25 | + </a-form-item> | |
26 | + | |
15 | 27 | <!-- <a-row :gutter="0">--> |
16 | 28 | <!-- <a-col :span="16">--> |
17 | 29 | <!-- <a-form-model-item required prop="inputCode">--> |
... | ... | @@ -33,6 +45,7 @@ |
33 | 45 | import { getAction } from '@/api/manage' |
34 | 46 | import Vue from 'vue' |
35 | 47 | import { mapActions } from 'vuex' |
48 | + import {getWarehouseByUserCode} from '@/api/api' | |
36 | 49 | |
37 | 50 | export default { |
38 | 51 | name: 'LoginAccount', |
... | ... | @@ -42,9 +55,12 @@ |
42 | 55 | randCodeImage: '', |
43 | 56 | currdatetime: '', |
44 | 57 | loginType: 0, |
58 | + warehouseList: {}, | |
59 | + querySource:{}, | |
45 | 60 | model:{ |
46 | 61 | username: '', |
47 | 62 | password: '', |
63 | + warehouseCode: '', | |
48 | 64 | // inputCode: '' |
49 | 65 | }, |
50 | 66 | validatorRules:{ |
... | ... | @@ -55,6 +71,7 @@ |
55 | 71 | password: [{ |
56 | 72 | required: true, message: '请输入密码!', validator: 'click' |
57 | 73 | }], |
74 | + warehouseCode: [{ required: true, message: '请选择职级' }] , | |
58 | 75 | // inputCode: [{ |
59 | 76 | // required: true, message: '请输入验证码!' |
60 | 77 | // }] |
... | ... | @@ -64,7 +81,9 @@ |
64 | 81 | }, |
65 | 82 | created() { |
66 | 83 | this.handleChangeCheckCode(); |
84 | + this.getWarehouse(); | |
67 | 85 | }, |
86 | + | |
68 | 87 | methods:{ |
69 | 88 | ...mapActions(['Login']), |
70 | 89 | /**刷新验证码*/ |
... | ... | @@ -83,6 +102,20 @@ |
83 | 102 | this.requestCodeSuccess=false |
84 | 103 | }) |
85 | 104 | }, |
105 | + | |
106 | + | |
107 | + getWarehouse() { | |
108 | + const that = this; | |
109 | + this.querySource.username = that.model.username; | |
110 | + let obj = getWarehouseByUserCode(that.querySource); | |
111 | + obj.then((res) => { | |
112 | + that.warehouseList = res.result; | |
113 | + if (res.code != 200) { | |
114 | + that.warehouseList = {}; | |
115 | + } | |
116 | + }) | |
117 | + }, | |
118 | + | |
86 | 119 | // 判断登录类型 |
87 | 120 | handleUsernameOrEmail (rule, value, callback) { |
88 | 121 | const regex = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/; |
... | ... | @@ -128,6 +161,7 @@ |
128 | 161 | let loginParams = { |
129 | 162 | username: this.model.username, |
130 | 163 | password: this.model.password, |
164 | + warehouseCode: this.model.warehouseCode, | |
131 | 165 | checkKey: this.currdatetime, |
132 | 166 | remember_me: rememberMe, |
133 | 167 | } |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/LoginController.java
... | ... | @@ -66,6 +66,7 @@ public class LoginController { |
66 | 66 | Result<JSONObject> result = new Result<JSONObject>(); |
67 | 67 | String username = sysLoginModel.getUsername(); |
68 | 68 | String password = sysLoginModel.getPassword(); |
69 | + String warehouseCode = sysLoginModel.getWarehouseCode(); | |
69 | 70 | //update-begin--Author:scott Date:20190805 for:暂时注释掉密码加密逻辑,有点问题 |
70 | 71 | //前端密码加密,后端进行密码解密 |
71 | 72 | //password = AesEncryptUtil.desEncrypt(sysLoginModel.getPassword().replaceAll("%2B", "\\+")).trim();//密码解密 |
... | ... | @@ -615,8 +616,9 @@ public class LoginController { |
615 | 616 | */ |
616 | 617 | @PostMapping("/getWarehouseByUserCode") |
617 | 618 | @ResponseBody |
618 | - public Result getWarehouseByUserCode(@RequestBody String loginName) | |
619 | + public Result getWarehouseByUserCode(@RequestBody SysUser sysUser) | |
619 | 620 | { |
621 | + String loginName = sysUser.getUsername(); | |
620 | 622 | if (StringUtils.isNotEmpty(loginName)) |
621 | 623 | { |
622 | 624 | List<Map<String, Object>> list = sysUserService.getWarehouseByUserCode(loginName); |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/model/SysLoginModel.java
... | ... | @@ -2,6 +2,7 @@ package org.jeecg.modules.system.model; |
2 | 2 | |
3 | 3 | import io.swagger.annotations.ApiModel; |
4 | 4 | import io.swagger.annotations.ApiModelProperty; |
5 | +import lombok.Data; | |
5 | 6 | |
6 | 7 | /** |
7 | 8 | * 登录表单 |
... | ... | @@ -9,47 +10,21 @@ import io.swagger.annotations.ApiModelProperty; |
9 | 10 | * @Author scott |
10 | 11 | * @since 2019-01-18 |
11 | 12 | */ |
13 | +@Data | |
12 | 14 | @ApiModel(value="登录对象", description="登录对象") |
13 | 15 | public class SysLoginModel { |
14 | 16 | @ApiModelProperty(value = "账号") |
15 | 17 | private String username; |
16 | 18 | @ApiModelProperty(value = "密码") |
17 | 19 | private String password; |
20 | + @ApiModelProperty(value = "仓库编码") | |
21 | + private String warehouseCode; | |
18 | 22 | @ApiModelProperty(value = "验证码") |
19 | 23 | private String captcha; |
20 | 24 | @ApiModelProperty(value = "验证码key") |
21 | 25 | private String checkKey; |
22 | 26 | |
23 | - public String getUsername() { | |
24 | - return username; | |
25 | - } | |
26 | 27 | |
27 | - public void setUsername(String username) { | |
28 | - this.username = username; | |
29 | - } | |
30 | 28 | |
31 | - public String getPassword() { | |
32 | - return password; | |
33 | - } | |
34 | 29 | |
35 | - public void setPassword(String password) { | |
36 | - this.password = password; | |
37 | - } | |
38 | - | |
39 | - public String getCaptcha() { | |
40 | - return captcha; | |
41 | - } | |
42 | - | |
43 | - public void setCaptcha(String captcha) { | |
44 | - this.captcha = captcha; | |
45 | - } | |
46 | - | |
47 | - public String getCheckKey() { | |
48 | - return checkKey; | |
49 | - } | |
50 | - | |
51 | - public void setCheckKey(String checkKey) { | |
52 | - this.checkKey = checkKey; | |
53 | - } | |
54 | - | |
55 | -} | |
56 | 30 | \ No newline at end of file |
31 | +} | |
... | ... |