Skip to content

Commit

Permalink
feat: steam 喜加一信息
Browse files Browse the repository at this point in the history
  • Loading branch information
tomiaa12 committed Nov 14, 2023
1 parent 147e7f1 commit fe9fe59
Show file tree
Hide file tree
Showing 7 changed files with 140 additions and 51 deletions.
3 changes: 2 additions & 1 deletion src/.vitepress/catalog/OnLineApp.ts
Expand Up @@ -24,7 +24,8 @@ export const OnLineApp = [
text: "工具",
collapsed: true,
items: [
{ text: "IP归属地", link: "/docs/在线应用/工具/IP归属地" },
{ text: "steam 喜加一", link: "/docs/在线应用/工具/steam喜加一" },
{ text: "IP 归属地", link: "/docs/在线应用/工具/IP归属地" },
]
}
]
2 changes: 2 additions & 0 deletions src/api/index.ts
Expand Up @@ -23,3 +23,5 @@ export const translate = (query: string) => http.post(`/translate`, { query })
export const rsdjs = (query: string) => http.get(`/rsdjs`)

export const ipInfo = (ip: string) => http.get(`/ipInfo`, { params: { ip } })

export const steamplusone = () => http.get(`/steamplusone`)
5 changes: 4 additions & 1 deletion src/docs/在线应用/工具/IP归属地.md
Expand Up @@ -2,6 +2,9 @@
import ipInfo from "./components/ipInfo.vue"
</script>

# IP 归属地查询

<ClientOnly>
<ipInfo />
</ClientOnly>
</ClientOnly>

93 changes: 45 additions & 48 deletions src/docs/在线应用/工具/components/ipInfo.vue
@@ -1,51 +1,47 @@
<template>
<div>
<el-input
v-model="txt"
placeholder="请输入"
size="large"
clearable
>
<template #append>
<el-button
type="primary"
:disabled="!txt"
@click="enter"
>
搜 索
</el-button>
</template>
</el-input>
<div v-if="info.status === 'Error'">出错了</div>
<el-descriptions
v-else-if="info.status === 'SUCCESS'"
:title="info.location.other.info"

>
<el-descriptions-item label="省:">
{{ info.location.data.province }}
</el-descriptions-item>
<el-descriptions-item label="市:">
{{ info.location.data.city }}
</el-descriptions-item>
<el-descriptions-item label="区:">
{{ info.location.data.district }}
</el-descriptions-item>
<el-descriptions-item label="IP:">
{{ info.location.info.text }}
</el-descriptions-item>
<el-descriptions-item label="类型:">
{{ info.location.info.type }}
</el-descriptions-item>
<el-descriptions-item label="中国大陆:">
{{ info.location.info.cnip ? '' : '' }}
</el-descriptions-item>
<el-descriptions-item label="邮编:">
{{ info.location.info.postal }}
</el-descriptions-item>

</el-descriptions>
</div>
<el-input
v-model="txt"
placeholder="请输入"
size="large"
clearable
>
<template #append>
<el-button
type="primary"
:disabled="!txt"
@click="enter"
>
搜 索
</el-button>
</template>
</el-input>
<div v-if="info.status === 'Error'">出错了</div>
<el-descriptions
v-else-if="info.status === 'SUCCESS'"
:title="info.location.other.info"
>
<el-descriptions-item label="省:">
{{ info.location.data.province }}
</el-descriptions-item>
<el-descriptions-item label="市:">
{{ info.location.data.city }}
</el-descriptions-item>
<el-descriptions-item label="区:">
{{ info.location.data.district }}
</el-descriptions-item>
<el-descriptions-item label="IP:">
{{ info.location.info.text }}
</el-descriptions-item>
<el-descriptions-item label="类型:">
{{ info.location.info.type }}
</el-descriptions-item>
<el-descriptions-item label="中国大陆:">
{{ info.location.info.cnip ? "" : "" }}
</el-descriptions-item>
<el-descriptions-item label="邮编:">
{{ info.location.info.postal }}
</el-descriptions-item>
</el-descriptions>
</template>

<script setup lang="ts">
Expand All @@ -64,7 +60,8 @@ const enter = async () => {
margin-top: 1em;
}
.el-input{
.el-input {
max-width: 450px;
margin-top: 1em;
}
</style>
77 changes: 77 additions & 0 deletions src/docs/在线应用/工具/components/steamplusone.vue
@@ -0,0 +1,77 @@
<template>
<KTable
v-loading="loading"
:data="info"
:options="options"
@edit="edit"
/>
</template>

<script setup lang="ts">
import { onMounted, ref } from "vue"
import { steamplusone } from "@/api"
import type { TableProps } from "@tomiaa/vue3-components"
import { KTable } from "@tomiaa/vue3-components"
const info = ref()
const loading = ref(true)
onMounted(async () => {
try {
const { data } = await steamplusone()
info.value = data
} finally {
loading.value = false
}
})
const options: TableProps["options"] = [
{
label: "名称",
prop: "name",
},
{
label: "类型",
prop: "type",
},
{
label: "入库期限",
prop: "perpetual",
},
{
label: "平台",
prop: "source",
},
{
label: "开始时间",
prop: "starttime",
},
{
label: "结束时间",
prop: "endtime",
},
{
action: true,
actionConfig: {
editText: "立即获取",
showDelete: false,
custom(list, scope) {
list[0].type = "primary"
return list
},
},
},
]
const edit = ({ row }) => {
window.open(row.url)
}
</script>
<style lang="scss" scoped>
.el-descriptions {
margin-top: 1em;
}
.el-input {
max-width: 450px;
}
</style>
9 changes: 9 additions & 0 deletions src/docs/在线应用/工具/steam喜加一.md
@@ -0,0 +1,9 @@
<script setup lang="ts">
import steamplusone from "./components/steamplusone.vue"
</script>

# steam 喜加一信息

<ClientOnly>
<steamplusone />
</ClientOnly>
2 changes: 1 addition & 1 deletion src/docs/文章/vue3组件/表格分页.md
Expand Up @@ -188,7 +188,7 @@ import { KTable } from "@tomiaa/vue3-components"
| actionConfig.showEdit | 显示编辑/确认 | boolean | true |
| actionConfig.showDelete | 显示删除/取消 | boolean | true |
| editRowEnterText | 编辑行时确认文字 | string | 确定 |
| editRowCloseText | 编辑行是取消文字 | string | 确定 |
| editRowCloseText | 编辑行是取消文字 | string | 取消 |
| actionConfig.custom | 函数自定义操作栏 | function | |
| editable | 单元格开启编辑 | boolean | false |
| editableConfig | 单元格编辑配置,该值存在即视为 editable 为 true | object | |
Expand Down

0 comments on commit fe9fe59

Please sign in to comment.