whychdw
2019-07-05 7ab97c4ada45550abc7f440d60549b249726a9ff
src/views/login.vue
@@ -46,12 +46,16 @@
            }
        }
    },
    created: function() {
        sessionStorage.removeItem('store');
    },
    methods: {
        handleSubmit(name) {
            this.$refs[name].validate((valid) => {
                if (valid) {
                    this.$store.commit('setLogin', true);
                    this.$store.commit('setUserName', this.user.name);
                    sessionStorage.setItem("store",JSON.stringify(this.$store.state))
                    this.$router.push('/index');
                } else {
                    this.$Message.error('登录失败!用户名/密码错误');