上线登录
This commit is contained in:
@@ -23,8 +23,8 @@ whenever(ctrl_s, () => {})
|
||||
whenever(ctrl_r, () => {})
|
||||
|
||||
onMounted(async () => {
|
||||
// const data = await getMyProfile()
|
||||
// username.value = data
|
||||
const data = await getMyProfile()
|
||||
username.value = data
|
||||
})
|
||||
|
||||
watch(authed, (v) => {
|
||||
|
||||
@@ -2,7 +2,7 @@ import axios from "axios"
|
||||
import { router } from "./router"
|
||||
|
||||
const http = axios.create({
|
||||
baseURL: "http://localhost:8000/api",
|
||||
baseURL: "https://webapi.xuyue.cc/api",
|
||||
xsrfCookieName: "xsrfCookieName",
|
||||
xsrfHeaderName: "X-CSRFTOKEN",
|
||||
withCredentials: true,
|
||||
|
||||
@@ -68,9 +68,11 @@
|
||||
</n-tab-pane>
|
||||
<template #suffix>
|
||||
<n-flex align="center" class="suffix">
|
||||
<!-- <span>{{ username }}</span>
|
||||
<n-button v-if="!authed" @click="handleLogin">登录</n-button>
|
||||
<n-button v-else @click="handleLogout">退出</n-button> -->
|
||||
<span>{{ username }}</span>
|
||||
<n-button v-if="!authed" @click="handleLogin" secondary type="primary">
|
||||
登录
|
||||
</n-button>
|
||||
<n-button v-else @click="handleLogout">退出</n-button>
|
||||
</n-flex>
|
||||
</template>
|
||||
</n-tabs>
|
||||
|
||||
@@ -7,10 +7,14 @@
|
||||
>
|
||||
<n-form>
|
||||
<n-form-item label="用户名">
|
||||
<n-input v-model:value="name"></n-input>
|
||||
<n-input v-model:value="name" name="username"></n-input>
|
||||
</n-form-item>
|
||||
<n-form-item label="密码">
|
||||
<n-input v-model:value="password"></n-input>
|
||||
<n-input
|
||||
type="password"
|
||||
v-model:value="password"
|
||||
name="password"
|
||||
></n-input>
|
||||
</n-form-item>
|
||||
<n-alert
|
||||
type="error"
|
||||
@@ -19,7 +23,7 @@
|
||||
title="登录失败"
|
||||
></n-alert>
|
||||
<n-flex>
|
||||
<n-button @click="submit">登录</n-button>
|
||||
<n-button block @click="submit" type="primary">登录</n-button>
|
||||
</n-flex>
|
||||
</n-form>
|
||||
</n-modal>
|
||||
|
||||
Reference in New Issue
Block a user