| | |
| | | <Checkbox v-model="user.remember">记住密码</Checkbox> |
| | | </FormItem> |
| | | <FormItem style="text-align:right"> |
| | | <Button type="primary" long @click="handleSubmit('user')">登陆</Button> |
| | | <Button type="primary" long @click="handleSubmit('user')">登录</Button> |
| | | </FormItem> |
| | | </Form> |
| | | </div> |
| | |
| | | } |
| | | } |
| | | }, |
| | | 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('登录失败!用户名/密码错误'); |