优化登录跳转规则

This commit is contained in:
2026-08-24 22:22:15 +08:00
parent ba16f31270
commit ef50160ef5
8 changed files with 262 additions and 73 deletions
+56
View File
@@ -0,0 +1,56 @@
<template>
<div class="hello">
<el-input placeholder="请输入用户名" v-model="username" clearable>
</el-input>
<el-input
placeholder="请输入密码"
v-model="password"
show-password
></el-input>
<el-button
class="login-button"
type="primary"
native-type="submit"
@click="handleLogout"
>
退出
</el-button>
</div>
</template>
<script>
export default {
name: "ChatPage",
props: {},
data() {
return {
username: "",
password: "",
};
},
methods: {
handleLogout() {
this.$store.commit("SET_TOKEN", '');
this.$store.commit("SET_USERNAME", '');
this.$router.push("/login");
},
},
};
</script>
<style scoped>
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>
-38
View File
@@ -1,38 +0,0 @@
<template>
<div class="hello">
<el-input placeholder="请输入用户名" v-model="username" clearable> </el-input>
<el-input placeholder="请输入密码" v-model="password" show-password></el-input>
</div>
</template>
<script>
export default {
name: "IndexPage",
props: {
},
data() {
return {
username: '',
password: ''
}
}
};
</script>
<style scoped>
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>