| | |
| | | <div class="login-container" |
| | | ref="login" |
| | | @keyup.enter.native="handleLogin"> |
| | | <top-color v-show="false"></top-color> |
| | | <div class="login-time"> |
| | | {{time}} |
| | | </div> |
| | | <top-color v-show="false"> |
| | | </top-color> |
| | | <div class="login-weaper animated bounceInDown"> |
| | | <div class="login-border"> |
| | | <div class="login-main"> |
| | |
| | | import userAvatar from "./userAvatar"; |
| | | import {resetRouter} from '../../../router/router' |
| | | import {mapGetters} from "vuex"; |
| | | import {setStore} from "@/util/store"; |
| | | |
| | | export default { |
| | | components: {userAvatar,}, |
| | |
| | | methods: { |
| | | handleWitch() { |
| | | if (this.index === '0') { |
| | | console.log('this.userInfo',this.userInfo) |
| | | const {avatar, userId, userName, email, personName} = this.userInfo; |
| | | this.userForm = {avatar, userId, userName, email, personName}; |
| | | } else { |
| | |
| | | this.$refs.userForm.validate((valid) => { |
| | | if (valid) { |
| | | const params = { |
| | | id: this.userInfo.userId, |
| | | oid: this.userInfo.userOid, |
| | | name: this.userForm.userName, |
| | | email: this.userForm.email |
| | | } |
| | |
| | | type: "success", |
| | | message: "修改信息成功!" |
| | | }); |
| | | // 更新缓存 |
| | | this.userInfo.userName = this.userForm.userName; |
| | | this.userInfo.email = this.userForm.email; |
| | | setStore({ name: 'userInfo', content: this.userInfo }); |
| | | this.handleWitch(); |
| | | } else { |
| | | this.$message({ |
| | | type: "error", |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | done(); |
| | | }) |
| | | } else { |
| | | return false; |
| | |
| | | const reader = new FileReader(); |
| | | reader.onloadend = (result) => { |
| | | this.userInfo.avatar = reader.result; // 存储 Base64 字符串 |
| | | |
| | | setStore({ name: 'userInfo', content: this.userInfo }); |
| | | }; |
| | | reader.readAsDataURL(res.data); // 调用reader方法 |