| | |
| | | <template> |
| | | <el-form class="login-form" |
| | | status-icon |
| | | :rules="loginRules" |
| | | ref="loginForm" |
| | | <div> |
| | | <el-form ref="loginForm" |
| | | :model="loginForm" |
| | | :rules="loginRules" |
| | | class="login-form" |
| | | label-width="0" |
| | | status-icon |
| | | > |
| | | |
| | | <el-form-item prop="selectInput"> |
| | |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item prop="username"> |
| | | <el-input size="small" |
| | | @keyup.enter.native="handleLogin" |
| | | v-model="loginForm.username" |
| | | <el-input v-model="loginForm.username" |
| | | :placeholder="$t('login.username')" |
| | | auto-complete="off" |
| | | :placeholder="$t('login.username')"> |
| | | size="small" |
| | | @keyup.enter.native="handleLogin"> |
| | | <i slot="prefix" class="icon-yonghu"/> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item prop="password"> |
| | | <el-input size="small" |
| | | @keyup.enter.native="handleLogin" |
| | | <el-input v-model="loginForm.password" |
| | | :placeholder="$t('login.password')" |
| | | :type="passwordType" |
| | | v-model="loginForm.password" |
| | | auto-complete="off" |
| | | :placeholder="$t('login.password')"> |
| | | <i class="el-icon-view el-input__icon" slot="suffix" @click="showPassword"/> |
| | | size="small" |
| | | @keyup.enter.native="handleLogin"> |
| | | <i slot="suffix" class="el-icon-view el-input__icon" @click="showPassword"/> |
| | | <i slot="prefix" class="icon-mima"/> |
| | | </el-input> |
| | | </el-form-item> |
| | | |
| | | <el-form-item> |
| | | <el-button type="primary" |
| | | <el-button class="login-submit" |
| | | size="small" |
| | | @click.native.prevent="handleLogin" |
| | | class="login-submit">{{$t('login.submit')}} |
| | | type="primary" |
| | | @click.native.prevent="handleLogin">{{ $t('login.submit') }} |
| | | </el-button> |
| | | </el-form-item> |
| | | |
| | | |
| | | |
| | | |
| | | <!--密码修改弹出框--> |
| | | </el-form> |
| | | <el-dialog title="修改密码" :visible.sync="dialogFormVisible" append-to-body > |
| | | <el-form :model="form" :rules="rules"> |
| | | <el-form-item label="原密码" :label-width="formLabelWidth" prop="oldname"> |
| | | <el-input v-model="form.oldPassword" autocomplete="off"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="新密码" :label-width="formLabelWidth" prop="newname"> |
| | | <el-input v-model="form.newPassword" autocomplete="off"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="确认密码" :label-width="formLabelWidth" prop="newname1"> |
| | | <el-input v-model="form.newPassword1" autocomplete="off"></el-input> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button @click="dialogFormVisible = false">取 消</el-button> |
| | | <el-button type="primary" @click="addok">确 定</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | </div> |
| | | |
| | | |
| | | </template> |
| | | |
| | | <script> |
| | | import {mapGetters} from "vuex"; |
| | | import {info} from "@/api/system/tenant"; |
| | | import {getTopUrl} from "@/util/util"; |
| | | |
| | | import {updatePassword} from "@/api/system/user.js" |
| | | import md5 from "js-md5"; |
| | | export default { |
| | | name: "userlogin", |
| | | data() { |
| | | return { |
| | | tenantMode: this.website.tenantMode, |
| | | ButtonList:[], |
| | | dialogFormVisible:false, |
| | | form: { |
| | | oldPassword: '', |
| | | newPassword: '', |
| | | newPassword1: '', |
| | | }, |
| | | rules: { |
| | | oldname: [ |
| | | { required: true, message: '请输入原密码', trigger: 'blur' } |
| | | ], |
| | | newname:[ |
| | | { required: true, message: '请输入新密码', trigger: 'blur' } |
| | | ], |
| | | newname1:[ |
| | | { required: true, message: '请输确认密码', trigger: 'blur' } |
| | | ] |
| | | }, |
| | | loginForm: { |
| | | //租户ID |
| | | tenantId: "000000", |
| | |
| | | deptId: '', |
| | | roleId: '' |
| | | }, |
| | | userinfo: [] |
| | | }; |
| | | }, |
| | | created() { |
| | |
| | | }, |
| | | props: [], |
| | | methods: { |
| | | addok(){ |
| | | this.dialogFormVisible = false |
| | | updatePassword(md5(this.form.oldPassword), this.form.newPassword, this.form.newPassword1).then(res=>{ |
| | | if(res.data.code==200){ |
| | | this.$message({ |
| | | type:"success", |
| | | message:"修改成功!" |
| | | }) |
| | | |
| | | this.$router.push({path: this.tagWel.value}) |
| | | } |
| | | }) |
| | | }, |
| | | // 绑定下拉菜单动态ID |
| | | selectchange(value) { |
| | | this.loginForm.tenantId=value |
| | |
| | | } |
| | | this.handleLogin(); |
| | | done(); |
| | | |
| | | }, |
| | | handleLogin() { |
| | | handleLogin: function () { |
| | | this.userInfo = this.$store.state.upadatastatus |
| | | this.$refs.loginForm.validate(valid => { |
| | | if (valid) { |
| | | const loading = this.$loading({ |
| | |
| | | spinner: "el-icon-loading" |
| | | }); |
| | | this.$store.dispatch("LoginByUsername", this.loginForm).then(() => { |
| | | if (this.userInfo.strategyUpdateStatus != 0) { |
| | | if (this.website.switchMode) { |
| | | const deptId = this.userInfo.dept_id; |
| | | const roleId = this.userInfo.role_id; |
| | |
| | | this.$store.dispatch("LogOut").then(() => { |
| | | loading.close(); |
| | | }); |
| | | return false; |
| | | } |
| | | return false |
| | | } |
| | | this.$router.push({path: this.tagWel.value}); |
| | | } else { |
| | | this.$message({ |
| | | type: "warning", |
| | | message: "密码策略已被修改,请重新修改密码!" |
| | | }) |
| | | setTimeout(()=>{ |
| | | this.dialogFormVisible=true |
| | | },1500) |
| | | } |
| | | console.log(this.userInfo) |
| | | |
| | | loading.close(); |
| | | }).catch(() => { |
| | | loading.close(); |