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