| | |
| | | visitedViews: state => state.tagsView.visitedViews, |
| | | cachedViews: state => state.tagsView.cachedViews, |
| | | userName: state => state.user.userName, |
| | | userInfo: state => state.user.userInfo, |
| | | routes: state => state.router.routes |
| | | } |
| | | export default getters |
| | |
| | | import { constantRoutes } from '@/router' |
| | | import Cookies from 'js-cookie' |
| | | |
| | | let state = { |
| | | routes: constantRoutes |
| | |
| | | const mutations = { |
| | | initRoutes: (state) => { |
| | | state.routes = constantRoutes |
| | | var adminUserInfoString = Cookies.get('adminUserInfo'); |
| | | if (adminUserInfoString && JSON.parse(adminUserInfoString).role !== 3) { |
| | | state.routes.forEach(item => { |
| | | if (item.name === 'UserPage') { |
| | | item.children.forEach(child => { |
| | | if (child.name === 'UserTeacherPageList' || child.name === 'UserAdminPageList') { |
| | | child.hidden = true |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | if (adminUserInfoString && JSON.parse(adminUserInfoString).role === 3) { |
| | | state.routes.forEach(item => { |
| | | if (item.name === 'UserPage') { |
| | | item.children.forEach(child => { |
| | | if (child.name === 'UserTeacherPageList' || child.name === 'UserAdminPageList') { |
| | | child.hidden = false |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | |
| | | const actions = { |
| | | } |
| | | const actions = {} |
| | | |
| | | export default { |
| | | namespaced: true, |
| | |
| | | remember: false |
| | | }, |
| | | loginRules: { |
| | | userName: [{ required: true, trigger: 'blur'}], |
| | | password: [{ required: true, trigger: 'blur'}] |
| | | userName: [{ required: true, trigger: 'blur' }], |
| | | password: [{ required: true, trigger: 'blur' }] |
| | | }, |
| | | passwordType: 'password', |
| | | capsTooltip: false, |
| | |
| | | methods: { |
| | | updatePassword () { |
| | | if (this.updatePasswordForm.newPassword !== this.updatePasswordForm.confirmPassword) { |
| | | this.$message.error("两次输入的密码不一致") |
| | | this.$message.error('两次输入的密码不一致') |
| | | return |
| | | } |
| | | UserApi.updatePassword(this.updatePasswordForm).then(res => { |
| | |
| | | } |
| | | if (result && result.code === 1) { |
| | | _this.setUserName(_this.loginForm.userName) |
| | | _this.setUserInfo(result.data) |
| | | _this.$router.push({ path: '/dashboard' }) |
| | | } else { |
| | | _this.loading = false |
| | |
| | | } |
| | | }) |
| | | }, |
| | | ...mapMutations('user', ['setUserName']) |
| | | ...mapMutations('user', ['setUserName', 'setUserInfo']) |
| | | } |
| | | } |
| | | </script> |
| | |
| | | } |
| | | } |
| | | </style> |
| | | |