use absolute path for all routes

This commit is contained in:
RockYang
2023-09-07 10:27:18 +08:00
parent aada15fc41
commit 9bd83f3acf
9 changed files with 27 additions and 19 deletions

View File

@@ -102,7 +102,7 @@ const exportChat = () => {
justify-content center
.chat-box {
max-width 800px;
width 800px;
// 变量定义
--content-font-size: 16px;
--content-color: #c1c1c1;

View File

@@ -356,7 +356,7 @@ onMounted(() => {
ElMessage.error("加载会话列表失败!")
})
}).catch(() => {
router.push('login')
router.push('/login')
});
const clipboard = new Clipboard('.copy-reply');
@@ -417,7 +417,7 @@ const newChat = function () {
// 切换会话
const changeChat = (chat) => {
router.push("/chat/"+chat.chat_id)
router.push("/chat/" + chat.chat_id)
loadChat(chat)
}
@@ -750,7 +750,7 @@ const logout = function () {
activelyClose.value = true;
httpGet('/api/user/logout').then(() => {
removeUserToken();
router.push('login');
router.push('/login');
}).catch(() => {
ElMessage.error('注销失败!');
})

View File

@@ -17,7 +17,7 @@ checkSession().then(() => {
router.push("/chat")
}
}).catch(() => {
router.push("login")
router.push("/login")
})
</script>

View File

@@ -34,7 +34,7 @@
<el-row class="text-line">
还没有账号
<el-link type="primary" @click="router.push('register')">注册新账号</el-link>
<el-link type="primary" @click="router.push('/register')">注册新账号</el-link>
</el-row>
</div>
</div>
@@ -66,9 +66,9 @@ const password = ref(process.env.VUE_APP_PASS);
checkSession().then(() => {
if (isMobile()) {
router.push('mobile')
router.push('/mobile')
} else {
router.push('chat')
router.push('/chat')
}
}).catch(() => {
})
@@ -94,7 +94,7 @@ const login = function () {
if (isMobile()) {
router.push('/mobile')
} else {
router.push('chat')
router.push('/chat')
}
}).catch((e) => {
ElMessage.error('登录失败,' + e.message)

View File

@@ -75,7 +75,7 @@
<el-row class="text-line">
已经有账号
<el-link type="primary" @click="router.push('login')">登录</el-link>
<el-link type="primary" @click="router.push('/login')">登录</el-link>
</el-row>
</el-form>
</div>
@@ -144,7 +144,7 @@ const register = function () {
return ElMessage.error('请输入短信验证码');
}
httpPost('/api/user/register', formData.value).then(() => {
ElMessage.success({"message": "注册成功,即将跳转到登录页...", onClose: () => router.push("login")})
ElMessage.success({"message": "注册成功,即将跳转到登录页...", onClose: () => router.push("/login")})
}).catch((e) => {
ElMessage.error('注册失败,' + e.message)
})

View File

@@ -55,7 +55,7 @@ const username = ref(process.env.VUE_APP_ADMIN_USER);
const password = ref(process.env.VUE_APP_ADMIN_PASS);
checkAdminSession().then(() => {
router.push("admin")
router.push("/admin")
}).catch(() => {
})
onMounted(() => {
@@ -76,7 +76,7 @@ const login = function () {
httpPost('/api/admin/login', {username: username.value.trim(), password: password.value.trim()}).then(res => {
setAdminToken(res.data)
router.push("admin")
router.push("/admin")
}).catch((e) => {
ElMessage.error('登录失败,' + e.message)
})