-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
370 additions
and
78 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,68 @@ | ||
<template> | ||
<div class="py-[24px] px-[12px] h-full"> | ||
<div class="pb-[24px] pt-[12px] px-[12px] h-full" v-loading="listLoading"> | ||
<div class="flex justify-between items-center text-[24px] pb-[12px]"> | ||
<h3 class="font-bold">Key</h3> | ||
<el-button type="primary" class="!bg-[#343e7e] !border-[#343e7e]">新增</el-button> | ||
<el-button type="primary" class="!bg-[#343e7e] !border-[#343e7e]" :disabled="createLoading" @click="addKey">新增 | ||
</el-button> | ||
</div> | ||
<el-scrollbar height="492px"> | ||
<div v-for="key in keyList" :key="key.id" class="relative"> | ||
<div class="box flex-col"> | ||
<div class="flex w-full justify-between items-center"> | ||
<div class="flex items-center"> | ||
<img :src="avatar" class="h-[32px] w-[32px]" alt=""/> | ||
<span class="self-end ml-[10px]">{{ key.name }}</span> | ||
</div> | ||
<span class="self-end"> <i class="iconfont icon-icon text-[16px] mr-[5px]"></i>{{ key.created_at }}</span> | ||
</div> | ||
<div class="my-[12px] w-full"> | ||
<el-input v-model="key.key" readonly/> | ||
</div> | ||
<el-divider border-style="dashed" class="!my-[0px]"/> | ||
<div class="mt-[12px] flex justify-between w-full"> | ||
<el-button plain @click="reset(key.id)">重置</el-button> | ||
<el-button type="primary" @click="copy(key.key)">复制</el-button> | ||
</div> | ||
</div> | ||
<div class="absolute right-[28px] top-0"> | ||
<el-popconfirm title="确认删除此Key?" confirm-button-text="确定" | ||
@confirm="remove(key.id)" | ||
cancel-button-text="取消"> | ||
<template #reference> | ||
<span class="iconfont icon-shanchu text-[18px] cursor-pointer hover:text-[#313d7d]"></span> | ||
</template> | ||
</el-popconfirm> | ||
</div> | ||
</div> | ||
</el-scrollbar> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import avatar from "@/assets/avatar.png"; | ||
import {useGetKeyList} from "@/hooks/key/useGetKeyList"; | ||
import {useCreateKey} from "@/hooks/key/useCreateKey"; | ||
import {useRegen} from "@/hooks/key/useRegen"; | ||
import {useCopy} from "@/hooks/useCopy"; | ||
import {useRemoveKey} from "@/hooks/key/useRemoveKey"; | ||
const {keyList, getKeyList, listLoading} = useGetKeyList() | ||
const {createKey, createLoading} = useCreateKey() | ||
const {regenKey} = useRegen() | ||
const {removeKey} = useRemoveKey() | ||
const {copy} = useCopy() | ||
const addKey = async () => { | ||
await createKey() | ||
await getKeyList() | ||
} | ||
const reset = async (id: number) => { | ||
await regenKey(id) | ||
await getKeyList() | ||
} | ||
const remove = async (id: number) => { | ||
await removeKey(id) | ||
await getKeyList() | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<template> | ||
<div class="pb-[24px] pt-[12px] px-[12px] h-full"> | ||
<div class="flex justify-between items-center text-[24px] pb-[12px]"> | ||
<h3 class="font-bold">推送</h3> | ||
</div> | ||
<div> | ||
<el-form :model="form" label-width="60px" :rules="rules" ref="Form"> | ||
<el-form-item label="类型"> | ||
<el-radio-group v-model="form.type"> | ||
<el-radio label="markdown">MarkDown</el-radio> | ||
<el-radio label="text">文本</el-radio> | ||
<el-radio label="image">图片</el-radio> | ||
</el-radio-group> | ||
</el-form-item> | ||
<el-form-item label="Key" prop="pushkey"> | ||
<el-input v-model="form.pushkey" placeholder="请填入Key"/> | ||
</el-form-item> | ||
<el-form-item label="标题" prop="text"> | ||
<el-input v-model="form.text" placeholder="请输入消息标题"/> | ||
</el-form-item> | ||
<el-form-item label="内容"> | ||
<el-input v-model="form.desp" type="textarea" :rows="12" resize="none" placeholder="请输入消息内容"/> | ||
</el-form-item> | ||
<el-form-item> | ||
<el-button type="primary" @click="onPush">发送</el-button> | ||
</el-form-item> | ||
</el-form> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import {useGetKeyList} from "@/hooks/key/useGetKeyList"; | ||
import {useGlobalStore} from "@/edge/popup/useGlobal"; | ||
import {storeToRefs} from "pinia"; | ||
import {usePushMessage} from "@/hooks/message/usePushMessage"; | ||
import {watch} from "vue"; | ||
const {onPush, Form, form, rules} = usePushMessage() | ||
const store = useGlobalStore() | ||
const {pushkeys} = storeToRefs(store) | ||
watch(() => pushkeys, () => { | ||
if (pushkeys.value.length > 0) { | ||
form.pushkey = pushkeys.value[0] | ||
} | ||
}, { | ||
deep: true, | ||
immediate: true | ||
}) | ||
useGetKeyList() | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,6 @@ | ||
// Generated by 'unplugin-auto-import' | ||
// We suggest you to commit this file into source control | ||
declare global { | ||
const ElButton: typeof import('element-plus/es')['ElButton'] | ||
const ElForm: typeof import('element-plus/es')['ElForm'] | ||
const ElFormItem: typeof import('element-plus/es')['ElFormItem'] | ||
const ElInput: typeof import('element-plus/es')['ElInput'] | ||
const ElPopconfirm: typeof import('element-plus/es')['ElPopconfirm'] | ||
|
||
} | ||
export {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import dayjs from "dayjs"; | ||
import {ElMessage} from "element-plus"; | ||
|
||
export const Utils = { | ||
format(date?: string | number | Date | dayjs.Dayjs | null | undefined) { | ||
return dayjs(date).format("YYYY/MM/DD"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.