添加一言
This commit is contained in:
@@ -10,4 +10,4 @@
|
||||
|
||||
你的爱情可惜没如果,但是Python不可惜,因为Python有if(不愧是年度最佳烂梗
|
||||
|
||||
## 学好if就一句话:注意缩进!
|
||||
## 学好if就一句话:注意缩进!
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
会赢的!
|
||||
不是,你怎么说话带空格啊?
|
||||
你这身高绝对没有1米76
|
||||
优美的Python语言之f**k-string
|
||||
优美的Python语言之f\*\*k-string
|
||||
全都怪我,不该沉默时沉默
|
||||
可以看到的循环
|
||||
可以看到的循环
|
||||
|
||||
@@ -231,4 +231,4 @@ export function refreshUserProblemDisplayIds() {
|
||||
|
||||
export function getMetrics(userid: number) {
|
||||
return http.get("metrics", { params: { userid } })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import { Icon } from "@iconify/vue"
|
||||
import { NSpace, NTag } from "naive-ui"
|
||||
import { getProblemList, getRandomProblemID } from "oj/api"
|
||||
import { getProblemList } from "oj/api"
|
||||
import { filterEmptyValue, getTagColor } from "utils/functions"
|
||||
import { ProblemFiltered } from "utils/types"
|
||||
import { getProblemTagList } from "~/shared/api"
|
||||
import Hitokoto from "~/shared/components/Hitokoto.vue"
|
||||
import Pagination from "~/shared/components/Pagination.vue"
|
||||
import { isDesktop } from "~/shared/composables/breakpoints"
|
||||
import { useUserStore } from "~/shared/store/user"
|
||||
@@ -104,10 +105,10 @@ function clear() {
|
||||
query.difficulty = ""
|
||||
}
|
||||
|
||||
async function getRandom() {
|
||||
const res = await getRandomProblemID()
|
||||
router.push("/problem/" + res.data)
|
||||
}
|
||||
// async function getRandom() {
|
||||
// const res = await getRandomProblemID()
|
||||
// router.push("/problem/" + res.data)
|
||||
// }
|
||||
|
||||
watch(() => query.page, routerPush)
|
||||
watch(
|
||||
@@ -218,41 +219,48 @@ function rowProps(row: ProblemFiltered) {
|
||||
|
||||
<template>
|
||||
<n-flex vertical size="large">
|
||||
<n-space>
|
||||
<n-form :show-feedback="false" inline label-placement="left">
|
||||
<n-form-item label="题目难度">
|
||||
<n-select
|
||||
style="width: 120px"
|
||||
v-model:value="query.difficulty"
|
||||
:options="difficultyOptions"
|
||||
/>
|
||||
</n-form-item>
|
||||
<n-form-item>
|
||||
<n-input
|
||||
clearable
|
||||
class="input"
|
||||
v-model:value="query.keyword"
|
||||
placeholder="题号或者标题"
|
||||
/>
|
||||
</n-form-item>
|
||||
</n-form>
|
||||
<n-form :show-feedback="false" inline label-placement="left">
|
||||
<n-form-item>
|
||||
<n-flex align="center">
|
||||
<n-button @click="search(query.keyword)">搜索</n-button>
|
||||
<n-button @click="clear" quaternary>重置</n-button>
|
||||
<n-button @click="getRandom" quaternary>试试手气</n-button>
|
||||
</n-flex>
|
||||
</n-form-item>
|
||||
</n-form>
|
||||
<n-button @click="toggleShowTag()" quaternary icon-placement="right">
|
||||
<template #icon>
|
||||
<Icon v-if="showTag" icon="ph:caret-down"></Icon>
|
||||
<Icon v-else icon="ph:caret-up"></Icon>
|
||||
</template>
|
||||
标签
|
||||
</n-button>
|
||||
</n-space>
|
||||
<n-flex justify="space-between">
|
||||
<n-flex>
|
||||
<div>
|
||||
<n-form :show-feedback="false" inline label-placement="left">
|
||||
<n-form-item label="题目难度">
|
||||
<n-select
|
||||
style="width: 120px"
|
||||
v-model:value="query.difficulty"
|
||||
:options="difficultyOptions"
|
||||
/>
|
||||
</n-form-item>
|
||||
<n-form-item>
|
||||
<n-input
|
||||
clearable
|
||||
style="width: 200px"
|
||||
v-model:value="query.keyword"
|
||||
placeholder="题号或者标题"
|
||||
/>
|
||||
</n-form-item>
|
||||
</n-form>
|
||||
</div>
|
||||
<div>
|
||||
<n-form :show-feedback="false" inline label-placement="left">
|
||||
<n-form-item>
|
||||
<n-flex align="center">
|
||||
<n-button @click="search(query.keyword)">搜索</n-button>
|
||||
<n-button @click="clear" quaternary>重置</n-button>
|
||||
<!-- <n-button @click="getRandom" quaternary>试试手气</n-button> -->
|
||||
</n-flex>
|
||||
</n-form-item>
|
||||
</n-form>
|
||||
</div>
|
||||
<n-button @click="toggleShowTag()" quaternary icon-placement="right">
|
||||
<template #icon>
|
||||
<Icon v-if="showTag" icon="ph:caret-down"></Icon>
|
||||
<Icon v-else icon="ph:caret-up"></Icon>
|
||||
</template>
|
||||
标签
|
||||
</n-button>
|
||||
</n-flex>
|
||||
<Hitokoto v-if="isDesktop" />
|
||||
</n-flex>
|
||||
<n-collapse-transition :show="showTag">
|
||||
<n-flex>
|
||||
<n-tag
|
||||
@@ -281,16 +289,4 @@ function rowProps(row: ProblemFiltered) {
|
||||
/>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.tagTitle {
|
||||
line-height: 28px;
|
||||
}
|
||||
|
||||
.select {
|
||||
width: 120px;
|
||||
}
|
||||
|
||||
.input {
|
||||
width: 200px;
|
||||
}
|
||||
</style>
|
||||
<style scoped></style>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<n-input
|
||||
placeholder="用户(可选)"
|
||||
v-model:value="query.username"
|
||||
style="width: 200px;"
|
||||
style="width: 200px"
|
||||
clearable
|
||||
/>
|
||||
</n-form-item>
|
||||
@@ -13,7 +13,7 @@
|
||||
<n-input
|
||||
placeholder="题号(可选)"
|
||||
v-model:value="query.problem"
|
||||
style="width: 200px;"
|
||||
style="width: 200px"
|
||||
clearable
|
||||
/>
|
||||
</n-form-item>
|
||||
|
||||
@@ -60,9 +60,7 @@ async function saveProfile() {
|
||||
<n-form-item label="个性签名">
|
||||
<n-input v-model:value="userStore.profile.mood" />
|
||||
</n-form-item>
|
||||
<n-button @click="saveProfile">
|
||||
更改信息
|
||||
</n-button>
|
||||
<n-button @click="saveProfile">更改信息</n-button>
|
||||
</n-form>
|
||||
</n-flex>
|
||||
</template>
|
||||
|
||||
@@ -29,3 +29,7 @@ export function getProblemTagList() {
|
||||
export function getCaptcha() {
|
||||
return http.get("captcha")
|
||||
}
|
||||
|
||||
export function getHitokoto() {
|
||||
return http.get("hitokoto")
|
||||
}
|
||||
|
||||
42
src/shared/components/Hitokoto.vue
Normal file
42
src/shared/components/Hitokoto.vue
Normal file
@@ -0,0 +1,42 @@
|
||||
<script setup lang="ts">
|
||||
import { getHitokoto } from "../api"
|
||||
|
||||
const hitokoto = reactive({
|
||||
sentence: "",
|
||||
from: "",
|
||||
})
|
||||
|
||||
async function receive() {
|
||||
const res = await getHitokoto()
|
||||
hitokoto.sentence = res.data.hitokoto
|
||||
hitokoto.from = res.data.from
|
||||
}
|
||||
|
||||
onMounted(receive)
|
||||
</script>
|
||||
<template>
|
||||
<div class="hitokoto" @click="receive">
|
||||
<div class="sentence">{{ hitokoto.sentence }}</div>
|
||||
<div class="from">{{ "from " + hitokoto.from }}</div>
|
||||
</div>
|
||||
</template>
|
||||
<style scoped>
|
||||
.hitokoto {
|
||||
cursor: pointer;
|
||||
height: 34px;
|
||||
}
|
||||
|
||||
.hitokoto .sentence {
|
||||
max-width: 500px;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
word-break: break-all;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.hitokoto .from {
|
||||
float: right;
|
||||
font-size: 12px;
|
||||
color: grey;
|
||||
}
|
||||
</style>
|
||||
@@ -7,7 +7,7 @@ import Signup from "../components/Signup.vue"
|
||||
|
||||
<template>
|
||||
<n-layout position="absolute">
|
||||
<n-layout-header bordered style="padding: 8px;">
|
||||
<n-layout-header bordered style="padding: 8px">
|
||||
<Header class="header" />
|
||||
</n-layout-header>
|
||||
<n-layout-content
|
||||
@@ -22,7 +22,7 @@ import Signup from "../components/Signup.vue"
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.header {
|
||||
.header {
|
||||
max-width: 2000px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
|
||||
Reference in New Issue
Block a user