| | |
| | | status-icon |
| | | > |
| | | |
| | | <!-- <el-form-item prop="selectInput">--> |
| | | <!-- <el-select v-model="loginForm.value" placeholder="请选择组织" style="width: 326px" @change="selectchange">--> |
| | | <!-- <i slot="prefix" class="el-icon-s-operation"/>--> |
| | | <!-- <el-option--> |
| | | <!-- v-for="(item,index) in loginForm.region"--> |
| | | <!-- :key="index"--> |
| | | <!-- :label="item.TENANT_NAME"--> |
| | | <!-- :value="item.TENANT_ID">--> |
| | | <!-- </el-option>--> |
| | | <!-- </el-select>--> |
| | | <!-- </el-form-item>--> |
| | | <el-form-item prop="username"> |
| | | <el-input v-model="loginForm.username" |
| | | :placeholder="$t('login.username')" |
| | |
| | | @click.native.prevent="handleLogin">{{ $t('login.submit') }} |
| | | </el-button> |
| | | </el-form-item> |
| | | |
| | | <el-dialog |
| | | v-dialogDrag |
| | | :visible.sync="passwordVisible" |
| | | append-to-body="true" |
| | | class="avue-dialog" |
| | | style="margin-top: -15vh" |
| | | title="修改密码" |
| | | width="50%"> |
| | | <avue-form ref="changeForm" v-model="passwordForm" :option="passwordOption" @submit="submitSwitch"/> |
| | | </el-dialog> |
| | | |
| | | </el-form> |
| | | </template> |
| | |
| | | import {mapGetters} from "vuex"; |
| | | import {info} from "@/api/system/tenant"; |
| | | import {getTopUrl} from "@/util/util"; |
| | | import func from "@/util/func"; |
| | | import {changePassword} from "@/api/user"; |
| | | |
| | | export default { |
| | | name: "userlogin", |
| | | data() { |
| | | return { |
| | | userName: '', |
| | | passwordVisible: false, |
| | | passwordForm: {}, |
| | | passwordOption: { |
| | | submitText: '保存', |
| | | column: [ |
| | | { |
| | | label: '登陆密码', |
| | | prop: 'oldPassword', |
| | | span: 24, |
| | | labelWidth: "15%", |
| | | type: 'password', |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: '请输入登陆密码', |
| | | trigger: 'blur' |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | label: '新登陆密码', |
| | | prop: 'password', |
| | | span: 24, |
| | | labelWidth: "15%", |
| | | type: 'password', |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: '请输入新登陆密码', |
| | | trigger: 'blur' |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | label: '新密码登陆确认', |
| | | prop: 'confirmPassword', |
| | | span: 24, |
| | | labelWidth: "15%", |
| | | type: 'password', |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: '请确认登陆密码', |
| | | trigger: 'blur' |
| | | } |
| | | ] |
| | | } |
| | | ] |
| | | }, |
| | | tenantMode: this.website.tenantMode, |
| | | ButtonList: [], |
| | | loginForm: { |
| | |
| | | //角色ID |
| | | roleId: "", |
| | | //用户名 |
| | | username: "admin", |
| | | username: "", |
| | | //密码 |
| | | password: "", |
| | | selectInput: '', |
| | |
| | | }, |
| | | created() { |
| | | // this.getTenant(); |
| | | this.loginForm.username = this.userInfo.userName |
| | | }, |
| | | mounted() { |
| | | //在mounted获取首页下拉菜单数据 |
| | |
| | | done(); |
| | | }, |
| | | handleLogin() { |
| | | if (!this.loginForm.username) { |
| | | this.$message.error('请输入用户名'); |
| | | return; |
| | | } |
| | | if (!this.loginForm.password) { |
| | | this.$message.error('请输入密码'); |
| | | return; |
| | |
| | | spinner: "el-icon-loading" |
| | | }); |
| | | this.$store.dispatch("LoginByUsername", this.loginForm).then((data) => { |
| | | if (data.obj.passwordInfo) { |
| | | this.$message.warning(data.obj.passwordInfo); |
| | | if (data.obj.failCode !== 'loginSuccess') { |
| | | if (data.obj.failCode === 'passwordRemainDay') { |
| | | this.$message.warning(data.obj.passwordInfo); |
| | | this.$router.push({path: this.tagWel.value}); |
| | | loading.close(); |
| | | return; |
| | | } |
| | | |
| | | if (data.obj.failCode === 'userIsLocked') { |
| | | this.$message.error(`登录错误次数过多,账号被锁定【${data.obj.failMsgArray[0]}】分钟`); |
| | | loading.close(); |
| | | return; |
| | | } |
| | | |
| | | if (data.obj.failCode === 'userPwdNotEqual') { |
| | | this.$message.error('密码错误,请重新输入!'); |
| | | loading.close(); |
| | | return; |
| | | } |
| | | this.$message.error(data.msg); |
| | | |
| | | if (data.obj.mustChangePassword) { |
| | | this.passwordVisible = true; |
| | | } |
| | | } |
| | | |
| | | if (this.website.switchMode) { |
| | | const deptId = this.userInfo.deptOid; |
| | | const roleId = this.userInfo.userOid; |
| | |
| | | }); |
| | | return false; |
| | | } |
| | | } |
| | | ; |
| | | }; |
| | | |
| | | this.$router.push({path: this.tagWel.value}); |
| | | loading.close(); |
| | | }).catch((err) => { |
| | | console.log('err', err) |
| | | loading.close(); |
| | | |
| | | }); |
| | | } |
| | | }); |
| | |
| | | this.$parent.$refs.login.style.backgroundImage = `url(${data.data.backgroundUrl})`; |
| | | } |
| | | }) |
| | | } |
| | | }, |
| | | |
| | | submitSwitch(form, done) { |
| | | let userInfo = JSON.parse(localStorage.getItem('saber-userInfo')); |
| | | |
| | | let params = { |
| | | userName: this.loginForm.username, |
| | | oldPassword: func.encryptData(form.oldPassword, 'daliantan0v0vcip'), |
| | | password: func.encryptData(form.password, 'daliantan0v0vcip'), |
| | | confirmPassword: func.encryptData(form.confirmPassword, 'daliantan0v0vcip'), |
| | | } |
| | | changePassword(params).then(res => { |
| | | if (res.data.code === 200) { |
| | | this.$message.success('修改成功,即将跳转到首页'); |
| | | this.passwordVisible = false; |
| | | this.$refs.changeForm.resetFields(); |
| | | this.$store.dispatch("LoginByUsername", {...this.loginForm, password: form.confirmPassword}).then(data => { |
| | | if (data.obj.failCode !== 'loginSuccess' && data.obj.failCode !== 'passwordRemainDay') { |
| | | this.$message.error(data.msg); |
| | | } |
| | | this.$router.push({path: this.tagWel.value}); |
| | | }) |
| | | } |
| | | }).catch(err => { |
| | | console.log(err); |
| | | }) |
| | | done(); |
| | | }, |
| | | } |
| | | }; |
| | | </script> |