feat: 日常更新

master
绝弹 2023-10-29 21:12:20 +08:00
parent 1133555ca2
commit 1d572cf8e4
18 changed files with 170 additions and 529 deletions

View File

@ -142,69 +142,50 @@ export interface UpdateUserDto {
roleIds?: number[];
}
export interface Permission {
/**
*
* @example "文章列表"
*/
name: string;
/**
*
* @example "post:list"
*/
slug: string;
/**
*
* @example "menu"
*/
type: "menu" | "api";
/**
*
* @example "文章列表"
*/
description: string;
/**
* ID
* @example 1
*/
id: number;
/**
*
* @format date-time
* @example "2022-01-01 10:10:10"
*/
createdAt: string;
/**
*
* @example "绝弹"
*/
createdBy: string;
/**
*
* @format date-time
* @example "2022-01-02 11:11:11"
*/
updatedAt: string;
/**
*
* @example "绝弹"
*/
updatedBy: string;
}
export interface CreateRoleDto {
/**
*
* @example "管理员"
*/
name: string;
/**
*
* @example "admin"
*/
slug: string;
/**
*
* @example "一段很长的描述"
*/
description?: string;
permissions?: Permission[];
/**
* ID
* @example [1]
*/
menuIds: number[];
}
export interface UpdateRoleDto {
permissionIds?: number[];
/**
*
* @example "管理员"
*/
name?: string;
/**
*
* @example "admin"
*/
slug?: string;
/**
*
* @example "一段很长的描述"
*/
description?: string;
permissions?: Permission[];
/**
* ID
* @example [1]
*/
menuIds?: number[];
}
export interface AuthUserDto {
@ -301,48 +282,22 @@ export interface UpdateLogDto {
demo?: string;
}
export interface CreatePermissionDto {
/**
*
* @example "权限名称"
*/
name: string;
/**
*
* @example "permission:permission"
*/
slug: string;
/** 权限描述 */
description?: string;
}
export interface UpdatePermissionDto {
id: number;
/**
*
* @example "权限名称"
*/
name?: string;
/**
*
* @example "permission:permission"
*/
slug?: string;
/** 权限描述 */
description?: string;
}
export interface CreateUploadDto {
export interface CreateFileDto {
/** @format binary */
file: File;
}
export interface Upload {
export interface File {
/**
*
* @example "xxx.jpg"
* @example "头像.jpg"
*/
name: string;
/**
*
* @example "一段很长的描述"
*/
description: string;
/**
*
* @example 1024
@ -397,6 +352,19 @@ export interface Upload {
updatedBy: string;
}
export interface UpdateFileDto {
/**
*
* @example "头像.jpg"
*/
name: string;
/**
*
* @example "一段很长的描述"
*/
description?: string;
}
export interface CreatePostDto {
/** 文章标题 */
title: string;
@ -816,6 +784,11 @@ export interface Dict {
description: string;
/** 字段类型 */
type: DictType;
/**
* ID
* @example 1
*/
typeId: number;
/**
* ID
* @example 1
@ -862,6 +835,11 @@ export interface UpdateDictTypeDto {
}
export interface CreateDictDto {
/**
*
* @example 1
*/
typeId: number;
/**
*
* @example "性别"
@ -878,6 +856,11 @@ export interface CreateDictDto {
export interface UpdateDictDto {
id: number;
/**
*
* @example 1
*/
typeId?: number;
/**
*
* @example "性别"
@ -1127,10 +1110,10 @@ export interface GetDictTypesParams {
export interface GetDictsParams {
/**
* (Swagger)
* @example "示例值"
* ID
* @example 1
*/
demo?: string;
typeId: number;
/**
*
* @default "id:desc"
@ -1667,17 +1650,17 @@ export namespace Log {
}
}
export namespace Permission {
export namespace File {
/**
* @description
* @tags permission
* @name AddPermission
* @request POST:/api/v1/permissions
* @description
* @tags file
* @name AddFile
* @request POST:/api/v1/file
*/
export namespace AddPermission {
export namespace AddFile {
export type RequestParams = {};
export type RequestQuery = {};
export type RequestBody = CreatePermissionDto;
export type RequestBody = CreateFileDto;
export type RequestHeaders = {};
export type ResponseBody = {
/**
@ -1694,119 +1677,6 @@ export namespace Permission {
data?: number;
};
}
/**
* @description
* @tags permission
* @name GetPermissions
* @request GET:/api/v1/permissions
*/
export namespace GetPermissions {
export type RequestParams = {};
export type RequestQuery = {};
export type RequestBody = never;
export type RequestHeaders = {};
export type ResponseBody = Response;
}
/**
* @description
* @tags permission
* @name GetPermission
* @request GET:/api/v1/permissions/{id}
*/
export namespace GetPermission {
export type RequestParams = {
id: string;
};
export type RequestQuery = {};
export type RequestBody = never;
export type RequestHeaders = {};
export type ResponseBody = {
/**
*
* @format int32
* @example 2000
*/
code: number;
/**
*
* @example "请求成功"
*/
message: string;
data?: string;
};
}
/**
* @description
* @tags permission
* @name SetPermission
* @request PATCH:/api/v1/permissions/{id}
*/
export namespace SetPermission {
export type RequestParams = {
id: string;
};
export type RequestQuery = {};
export type RequestBody = UpdatePermissionDto;
export type RequestHeaders = {};
export type ResponseBody = Response;
}
/**
* @description
* @tags permission
* @name DelPermission
* @request DELETE:/api/v1/permissions/{id}
*/
export namespace DelPermission {
export type RequestParams = {
id: string;
};
export type RequestQuery = {};
export type RequestBody = never;
export type RequestHeaders = {};
export type ResponseBody = {
/**
*
* @format int32
* @example 2000
*/
code: number;
/**
*
* @example "请求成功"
*/
message: string;
data?: string;
};
}
}
export namespace File {
/**
* @description
* @tags file
* @name AddFile
* @request POST:/api/v1/file
*/
export namespace AddFile {
export type RequestParams = {};
export type RequestQuery = {};
export type RequestBody = CreateUploadDto;
export type RequestHeaders = {};
export type ResponseBody = {
/**
*
* @format int32
* @example 2000
*/
code: number;
/**
*
* @example "请求成功"
*/
message: string;
data?: Upload;
};
}
/**
* @description
* @tags file
@ -1845,7 +1715,7 @@ export namespace File {
* @example "请求成功"
*/
message: string;
data?: Upload;
data?: File;
};
}
/**
@ -1856,10 +1726,10 @@ export namespace File {
*/
export namespace SetFile {
export type RequestParams = {
id: string;
id: number;
};
export type RequestQuery = {};
export type RequestBody = never;
export type RequestBody = UpdateFileDto;
export type RequestHeaders = {};
export type ResponseBody = {
/**
@ -1892,7 +1762,7 @@ export namespace File {
export type ResponseBody = Response;
}
/**
* @description
* @description
* @tags file
* @name GetFileByHash
* @request GET:/api/v1/file/hash/{hash}
@ -1916,7 +1786,7 @@ export namespace File {
* @example "请求成功"
*/
message: string;
data?: boolean;
data?: File;
};
}
}
@ -2525,10 +2395,10 @@ export namespace Dict {
export type RequestParams = {};
export type RequestQuery = {
/**
* (Swagger)
* @example "示例值"
* ID
* @example 1
*/
demo?: string;
typeId: number;
/**
*
* @default "id:desc"
@ -3271,15 +3141,15 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
});
},
};
permission = {
file = {
/**
*
*
*
* @tags permission
* @name AddPermission
* @request POST:/api/v1/permissions
* @tags file
* @name AddFile
* @request POST:/api/v1/file
*/
addPermission: (data: CreatePermissionDto, params: RequestParams = {}) => {
addFile: (data: CreateFileDto, params: RequestParams = {}) => {
return this.request<
{
/**
@ -3296,139 +3166,6 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
data?: number;
},
any
>({
path: `/api/v1/permissions`,
method: "POST",
body: data,
type: ContentType.Json,
format: "json",
...params,
});
},
/**
*
*
* @tags permission
* @name GetPermissions
* @request GET:/api/v1/permissions
*/
getPermissions: (params: RequestParams = {}) => {
return this.request<Response, any>({
path: `/api/v1/permissions`,
method: "GET",
format: "json",
...params,
});
},
/**
*
*
* @tags permission
* @name GetPermission
* @request GET:/api/v1/permissions/{id}
*/
getPermission: (id: string, params: RequestParams = {}) => {
return this.request<
{
/**
*
* @format int32
* @example 2000
*/
code: number;
/**
*
* @example "请求成功"
*/
message: string;
data?: string;
},
any
>({
path: `/api/v1/permissions/${id}`,
method: "GET",
format: "json",
...params,
});
},
/**
*
*
* @tags permission
* @name SetPermission
* @request PATCH:/api/v1/permissions/{id}
*/
setPermission: (id: string, data: UpdatePermissionDto, params: RequestParams = {}) => {
return this.request<Response, any>({
path: `/api/v1/permissions/${id}`,
method: "PATCH",
body: data,
type: ContentType.Json,
format: "json",
...params,
});
},
/**
*
*
* @tags permission
* @name DelPermission
* @request DELETE:/api/v1/permissions/{id}
*/
delPermission: (id: string, params: RequestParams = {}) => {
return this.request<
{
/**
*
* @format int32
* @example 2000
*/
code: number;
/**
*
* @example "请求成功"
*/
message: string;
data?: string;
},
any
>({
path: `/api/v1/permissions/${id}`,
method: "DELETE",
format: "json",
...params,
});
},
};
file = {
/**
*
*
* @tags file
* @name AddFile
* @request POST:/api/v1/file
*/
addFile: (data: CreateUploadDto, params: RequestParams = {}) => {
return this.request<
{
/**
*
* @format int32
* @example 2000
*/
code: number;
/**
*
* @example "请求成功"
*/
message: string;
data?: Upload;
},
any
>({
path: `/api/v1/file`,
method: "POST",
@ -3476,7 +3213,7 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
* @example "请求成功"
*/
message: string;
data?: Upload;
data?: File;
},
any
>({
@ -3494,7 +3231,7 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
* @name SetFile
* @request PATCH:/api/v1/file/{id}
*/
setFile: (id: string, params: RequestParams = {}) => {
setFile: (id: number, data: UpdateFileDto, params: RequestParams = {}) => {
return this.request<
{
/**
@ -3514,6 +3251,8 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
>({
path: `/api/v1/file/${id}`,
method: "PATCH",
body: data,
type: ContentType.Json,
format: "json",
...params,
});
@ -3536,7 +3275,7 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
},
/**
*
*
*
* @tags file
* @name GetFileByHash
@ -3556,7 +3295,7 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
* @example "请求成功"
*/
message: string;
data?: boolean;
data?: File;
},
any
>({

View File

@ -10,7 +10,7 @@
</div>
<slot name="content">
<a-scrollbar outer-class="h-full overflow-hidden" class="h-full overflow-auto" type="track">
<div class="m-4 p-4 bg-white overflow-hidden">
<div class="m-4 p-4 max-w-[1360px] mx-auto bg-white rounded overflow-hidden">
<slot></slot>
</div>
</a-scrollbar>

View File

@ -49,6 +49,7 @@
<script setup lang="ts">
import { useAniFormModal } from "@/components";
import { useUserStore } from "@/store";
import { delConfirm } from "@/utils";
import { Message } from "@arco-design/web-vue";
const userStore = useUserStore();
@ -56,6 +57,7 @@ const route = useRoute();
const router = useRouter();
const logout = async () => {
await delConfirm('退出后将跳转到登录页面,确定退出吗?')
userStore.clearUser();
Message.success("提示:已退出登陆!");
router.push({ path: "/login", query: { redirect: route.path } });

View File

@ -204,7 +204,7 @@ const tagItems = [
//
// min-height: 100vh;
overflow-y: hidden;
background-color: var(--color-fill-2);
background-color: #e4ebf1;
transition: padding 0.2s cubic-bezier(0.34, 0.69, 0.1, 1);
}
</style>

View File

@ -65,10 +65,10 @@
</template>
<script setup lang="ts">
import doc from "./data.json";
import editorModal from "./editor.vue";
import ejs from "ejs";
import template from "./page.ejs?raw";
import doc from "./components/data.json";
import editorModal from "./components/editor.vue";
import template from "./components/page.ejs?raw";
const content = ref("");
const { tags, routes } = doc;

View File

@ -1,8 +1,6 @@
<template>
<a-modal v-model:visible="modal.visible" title="上传文件" title-align="start" :footer="false" :width="732">
<a-alert class="mb-4">
提示支持大小在 1G 以内格式为.png.jpg.webp.mp4.ogg的文件
</a-alert>
<a-alert class="mb-4"> 提示支持大小在 1G 以内格式为.png.jpg.webp.mp4.ogg的文件 </a-alert>
<a-upload :custom-request="upload" draggable action="/api/v1/upload"></a-upload>
</a-modal>
</template>
@ -23,7 +21,7 @@ const upload = (option: RequestOption) => {
api.file
.addFile(
{
file: fileItem.file,
file: fileItem.file as any,
},
{
onUploadProgress(e) {

View File

@ -1,6 +1,6 @@
<template>
<BreadPage>
<div class="overflow-hidden grid grid-cols-[auto_auto_1fr]">
<div class="overflow-hidden h-full grid grid-cols-[auto_auto_1fr]">
<ani-group></ani-group>
<a-divider direction="vertical" :margin="16"></a-divider>
<div>
@ -116,7 +116,8 @@ const table = useTable({
field: "name",
label: "文件名称",
type: "search",
enableLoad: true,
searchable: true,
enterable: true,
itemProps: {
hideLabel: true,
},
@ -129,16 +130,22 @@ const table = useTable({
modify: {
title: "修改素材",
modalProps: {
width: 432,
width: 580,
},
items: [
{
field: "name",
label: "素材名称",
label: "名称",
type: "input",
},
{
field: "description",
label: "描述",
type: "textarea",
},
],
submit: ({ model }) => {
console.log(model);
return api.file.setFile(model.id, model);
},
},

View File

@ -21,7 +21,7 @@
<i class="icon-park-outline-folder-close align-[-2px]"></i>
<span class="flex-1 truncate">{{ item.name }}</span>
</div>
<div>
<div class="">
<a-dropdown>
<a-button size="small" type="text">
<template #icon>

View File

@ -3,7 +3,7 @@
<div class="py-2 px-4 bg-white">
<bread-crumb></bread-crumb>
</div>
<div class="grid grid-cols-[auto_1fr] gap-4 overflow-hidden bg-white p-4 m-4 rounded">
<div class="max-w-[1360px] mx-auto grid grid-cols-[auto_1fr] gap-4 overflow-hidden bg-white p-4 m-4 rounded">
<div>
<ani-group :current="current" @change="onTypeChange"></ani-group>
</div>
@ -20,8 +20,8 @@
<script setup lang="tsx">
import { DictType, api } from "@/api";
import { createColumn, updateColumn, useAniTable } from "@/components";
import aniGroup from "./components/group.vue";
import { useAniTable, createColumn, updateColumn } from "@/components";
const current = ref<DictType>();
const onTypeChange = (item: DictType) => {
@ -41,7 +41,7 @@ const [dictTable, dict] = useAniTable({
return (
<div>
<div>
{record.name}: {record.code}
<span class="text-gray-900">{record.name}</span>: {record.code}
</div>
<div class="text-gray-400 text-xs">{record.description}</div>
</div>
@ -103,7 +103,7 @@ const [dictTable, dict] = useAniTable({
},
{
field: "code",
label: "字典",
label: "字典",
type: "input",
},
{

View File

@ -1,16 +1,11 @@
<template>
<BreadPage>
<div class="">
<div class="">
<a-alert :closable="true" class="mb-4"> 仅展示近 90 天内的数据如需查看更多数据请联系管理员 </a-alert>
<Table v-bind="table">
<template #action>
<a-button type="primary" @click="visible = true">添加</a-button>
<ani-editor v-model:visible="visible"></ani-editor>
</template>
</Table>
</div>
</div>
<Table v-bind="table">
<template #action>
<a-button type="primary" @click="visible = true">添加</a-button>
<ani-editor v-model:visible="visible"></ani-editor>
</template>
</Table>
</BreadPage>
</template>

View File

@ -1,118 +0,0 @@
<template>
<BreadPage>
<Table v-bind="table"></Table>
</BreadPage>
</template>
<script setup lang="tsx">
import { api } from "@/api";
import { Table, createColumn, updateColumn, useTable } from "@/components";
const table = useTable({
data: async (model, paging) => {
return api.permission.getPermissions();
},
columns: [
{
title: "权限名称",
dataIndex: "username",
width: 200,
render({ record }) {
return (
<div class="flex flex-col overflow-hidden">
<span>{record.name}</span>
<span class="text-gray-400 text-xs truncate">@{record.slug}</span>
</div>
);
},
},
{
title: "权限描述",
dataIndex: "description",
},
createColumn,
updateColumn,
{
title: "操作",
type: "button",
width: 110,
buttons: [
{
type: "modify",
text: "修改",
},
{
type: 'delete',
text: '删除',
}
],
},
],
search: {
items: [
{
field: "name",
label: "权限名称",
type: "input",
required: false,
nodeProps: {
placeholder: '请输入名称关键字'
},
itemProps: {
hideLabel: true,
}
},
],
},
create: {
title: "添加权限",
items: [
{
field: "name",
label: "角色名称",
type: "input",
required: true,
},
{
field: "slug",
label: "角色标识",
type: "input",
},
{
field: "description",
label: "个人描述",
type: "textarea",
},
],
modalProps: {
width: 580,
maskClosable: false,
},
formProps: {
layout: "vertical",
},
submit: ({ model }) => {
return api.permission.addPermission(model);
},
},
modify: {
extend: true,
title: "修改权限",
submit: ({ model }) => {
return api.permission.setPermission(model.id, model);
},
},
});
</script>
<style scoped></style>
<route lang="json">
{
"meta": {
"sort": 10303,
"title": "权限管理",
"icon": "icon-park-outline-permissions"
}
}
</route>

View File

@ -88,19 +88,19 @@ const [roleTable, roleCtx] = useAniTable({
required: true,
},
{
field: "slug",
field: "code",
label: "角色标识",
type: "input",
},
{
field: "permissionIds",
label: "关联权限",
type: "select",
options: () => api.permission.getPermissions(),
nodeProps: {
multiple: true,
},
},
// {
// field: "menuIds",
// label: "",
// type: "select",
// options: () => api.menu.getMenus({ size: 0 }),
// nodeProps: {
// multiple: true,
// },
// },
{
field: "description",
label: "个人描述",

View File

@ -21,10 +21,9 @@ const table = useTable({
{
title: "用户昵称",
dataIndex: "username",
width: 180,
render: ({ record }) => (
<div class="flex items-center">
<a-avatar size={32}>
<a-avatar size={32} class="!bg-brand-500">
{record.avatar?.startsWith("/") ? <img src={record.avatar} alt="" /> : record.nickname?.[0]}
</a-avatar>
<span class="ml-2 flex-1 flex flex-col overflow-hidden">
@ -34,10 +33,6 @@ const table = useTable({
</div>
),
},
{
title: "用户描述",
dataIndex: "description",
},
{
title: "用户邮箱",
dataIndex: "email",
@ -73,6 +68,17 @@ const table = useTable({
search: {
button: true,
items: [
// {
// field: "nickname",
// label: "",
// type: "input",
// nodeProps: {
// placeholder: ''
// },
// itemProps: {
// hideLabel: true
// }
// },
{
field: "nickname",
label: "用户昵称",

View File

@ -3,7 +3,15 @@
@arcoblue-6: #08f;
body {
// --border-radius-small: 4px;
--border-radius-small: 4px;
div.arco-dropdown {
border: none;
}
div.arco-divider-horizontal {
border-color: var(--color-neutral-2);
}
li.arco-dropdown-option {
line-height: 32px;
@ -23,7 +31,7 @@ body {
overflow: hidden;
}
.arco-modal-header {
background: var(--color-fill-2);
background: var(--color-fill-3);
border-bottom: none;
}
.arco-modal-footer {
@ -59,7 +67,7 @@ body {
margin-top: 8px;
}
[class^="icon-"] {
font-size: 16px;
font-size: 14px;
vertical-align: -2px;
}
.arco-menu-item {
@ -80,7 +88,7 @@ body {
.arco-menu-inner {
padding: 0;
.arco-menu-icon {
margin-right: 8px;
margin-right: 10px;
}
.arco-menu-inline-header:hover {
background-color: var(--color-fill-2);
@ -121,6 +129,10 @@ body {
.arco-form-item-layout-inline:last-child {
margin-right: 0;
}
.ani-form-modal .arco-modal-body {
padding-bottom: 8px;
}
}
.dark {
.arco-menu-item.arco-menu-selected {

View File

@ -17,6 +17,7 @@ declare module '@vue/runtime-core' {
ACheckbox: typeof import('@arco-design/web-vue')['Checkbox']
ACheckboxGroup: typeof import('@arco-design/web-vue')['CheckboxGroup']
AConfigProvider: typeof import('@arco-design/web-vue')['ConfigProvider']
ADatePicker: typeof import('@arco-design/web-vue')['DatePicker']
ADivider: typeof import('@arco-design/web-vue')['Divider']
ADoption: typeof import('@arco-design/web-vue')['Doption']
ADrawer: typeof import('@arco-design/web-vue')['Drawer']
@ -67,7 +68,6 @@ declare module '@vue/runtime-core' {
Editor: typeof import('./../components/editor/index.vue')['default']
Header: typeof import('./../components/editor/panel-main/components/header.vue')['default']
ImagePicker: typeof import('./../components/editor/components/ImagePicker.vue')['default']
'Index.dev1': typeof import('./../components/breadcrumb/index.dev1.vue')['default']
InputColor: typeof import('./../components/editor/components/InputColor.vue')['default']
InputImage: typeof import('./../components/editor/components/InputImage.vue')['default']
Marquee: typeof import('./../components/editor/blocks/text/marquee.vue')['default']