diff --git a/src/App.vue b/src/App.vue index 984be9a4..cb73053f 100644 --- a/src/App.vue +++ b/src/App.vue @@ -5,9 +5,9 @@ :date-locale="dateZhCN" :theme-overrides="getThemeOverrides" > - + - + diff --git a/src/components/AppleControlBtn/index.ts b/src/components/AppleControlBtn/index.ts new file mode 100644 index 00000000..aa632ff7 --- /dev/null +++ b/src/components/AppleControlBtn/index.ts @@ -0,0 +1,3 @@ +import AppleControlBtn from './index.vue'; + +export { AppleControlBtn }; diff --git a/src/components/AppleControlBtn/index.vue b/src/components/AppleControlBtn/index.vue new file mode 100644 index 00000000..bd428475 --- /dev/null +++ b/src/components/AppleControlBtn/index.vue @@ -0,0 +1,96 @@ + + + + diff --git a/src/components/MessageContent/index.vue b/src/components/MessageContent/index.vue index 1ad18eca..d2c97290 100644 --- a/src/components/MessageContent/index.vue +++ b/src/components/MessageContent/index.vue @@ -1,4 +1,3 @@ - diff --git a/src/layout/components/TransitionMain/index.vue b/src/layout/components/TransitionMain/index.vue index 3a34c8dd..73ec2715 100644 --- a/src/layout/components/TransitionMain/index.vue +++ b/src/layout/components/TransitionMain/index.vue @@ -1,10 +1,7 @@ diff --git a/src/main.ts b/src/main.ts index c36c90a2..2dde670e 100644 --- a/src/main.ts +++ b/src/main.ts @@ -3,7 +3,7 @@ import App from './App.vue' import router, { setupRouter } from '@/router' import i18n from '@/i18n/index' import { setupStore } from '@/store' -import { setupNaive, setupDirectives } from '@/plugins' +import { setupNaive, setupDirectives, setupCustomComponents } from '@/plugins' import { AppProvider } from '@/components/Application' import { setHtmlTheme } from '@/utils/style' @@ -15,9 +15,12 @@ async function appInit() { // 注册全局常用的 naive-ui 组件 setupNaive(app) - // 注册全局自定义指令,如:v-permission权限指令 + // 注册全局自定义指令 setupDirectives(app) + // 注册全局自定义组件 + setupCustomComponents(app) + // 挂载状态管理 setupStore(app) diff --git a/src/plugins/customComponents.ts b/src/plugins/customComponents.ts index 496717ce..9d3be473 100644 --- a/src/plugins/customComponents.ts +++ b/src/plugins/customComponents.ts @@ -1,7 +1,10 @@ +import type { App } from 'vue' +import { Skeleton } from '@/components/Skeleton' + /** * 全局注册自定义组件 待完善 * @param app */ -export function setupCustomComponents() { - // app.component() +export function setupCustomComponents(app: App) { + app.component('Skeleton', Skeleton) } diff --git a/src/plugins/icon.ts b/src/plugins/icon.ts new file mode 100644 index 00000000..d53f7012 --- /dev/null +++ b/src/plugins/icon.ts @@ -0,0 +1,45 @@ +import { + Close as CloseIcon, + Remove as RemoveIcon, + Resize as ResizeIcon, + EllipsisHorizontalSharp as EllipsisHorizontalCircleSharpIcon, + CopyOutline as CopyIcon, + Trash as TrashIcon, + Pencil as PencilIcon, + Hammer as HammerIcon, + ApertureSharp as ApertureSharpIcon, + DownloadOutline as DownloadIcon, + Open as OpenIcon +} from '@vicons/ionicons5' + +// ionicons5 在这里 +const ionicons5 = { + // 关闭 + CloseIcon, + // 移除(最小化) + RemoveIcon, + // 调整(最大化) + ResizeIcon, + // 省略号 + EllipsisHorizontalCircleSharpIcon, + // 复制 + CopyIcon, + // 删除(垃圾桶) + TrashIcon, + // 编辑1(笔) + PencilIcon, + // 编辑2(锤子) + HammerIcon, + // 预览 + ApertureSharpIcon, + // 下载 + DownloadIcon, + // 导出 + OpenIcon +} + +// https://www.xicons.org/#/ 还有很多 + +export const icon = { + ionicons5 +} diff --git a/src/plugins/index.ts b/src/plugins/index.ts index 49b639e2..c500f63a 100644 --- a/src/plugins/index.ts +++ b/src/plugins/index.ts @@ -1,3 +1,4 @@ -export { setupNaive } from '@/plugins/naive'; -export { setupDirectives } from '@/plugins/directives'; -export { setupCustomComponents } from '@/plugins/customComponents'; +export { setupNaive } from '@/plugins/naive' +export { setupDirectives } from '@/plugins/directives' +export { setupCustomComponents } from '@/plugins/customComponents' +export { icon } from '@/plugins/icon' diff --git a/src/plugins/naive.ts b/src/plugins/naive.ts index 301b2658..f8a48cf8 100644 --- a/src/plugins/naive.ts +++ b/src/plugins/naive.ts @@ -12,6 +12,7 @@ import { NMessageProvider, NDialogProvider, NInput, + NImage, NButton, NForm, NFormItem, @@ -97,6 +98,7 @@ const naive = create({ NCheckboxGroup, NCheckbox, NIcon, + NImage, NLayout, NLayoutHeader, NLayoutContent, diff --git a/src/settings/designSetting.ts b/src/settings/designSetting.ts index 738bdfbe..05affd02 100644 --- a/src/settings/designSetting.ts +++ b/src/settings/designSetting.ts @@ -53,7 +53,7 @@ export const asideWidth = '270' export const asideCollapsedWidth = '60' // 修改边框圆角 -export const borderRadius = '8px' +export const borderRadius = '4px' // 轮播间隔 export const carouselInterval = 4000 diff --git a/src/styles/common/_dark.scss b/src/styles/common/_dark.scss index 3926caa2..b3ea51d0 100644 --- a/src/styles/common/_dark.scss +++ b/src/styles/common/_dark.scss @@ -1,13 +1,22 @@ @import './var.scss'; $dark: ( + // 文字颜色 + color: $--color-text-4, //背景 background-color: $--color-dark-bg-1, //渐变背景 background-image: linear-gradient(120deg, $--color-dark-bg-1 0%, $--color-dark-bg-1 100%), + // 斑点背景 + background-point: + ( + linear-gradient($--color-dark-bg-1 14px, transparent 0), + linear-gradient(90deg, transparent 14px, $--color-text-2 0) + ), //毛玻璃 filter-color: $--filter-color-login-dark, // 物料市场背景 - items-top-bg: linear-gradient(180deg, $--color-dark-bg-1, rgba(23, 23, 26, 0)) + items-top-bg: + linear-gradient(180deg, $--color-dark-bg-1, rgba(23, 23, 26, 0)) ); diff --git a/src/styles/common/_light.scss b/src/styles/common/_light.scss index aa90513b..fdb3f0c9 100644 --- a/src/styles/common/_light.scss +++ b/src/styles/common/_light.scss @@ -1,11 +1,19 @@ @import './var.scss'; $light: ( + // 文字颜色 + color: $--color-text, //背景 background_color: $--color-light-fill-3, //渐变背景 background-image: linear-gradient(120deg, $--color-text-1 0%, $--color-text-1 100%), + // 斑点背景 + background-point: + ( + linear-gradient($--color-light-fill-1 14px, transparent 0), + linear-gradient(90deg, transparent 14px, $--color-dark-bg-5 0) + ), //毛玻璃 - filter-color: $--filter-color-login-light, + filter-color: $--filter-color-login-light ); diff --git a/src/styles/common/animation.scss b/src/styles/common/animation.scss index d27d32ed..09bdf463 100644 --- a/src/styles/common/animation.scss +++ b/src/styles/common/animation.scss @@ -1,3 +1,21 @@ +// 闪烁 +.animation-twinkle { + animation: twinkle 2s ease; + animation-iteration-count: infinite; + opacity: 1; +} +@keyframes twinkle { + 0% { + opacity: 1; + } + 50% { + opacity: 0.5; + } + 100% { + opacity: 1; + } +} + // 淡入淡出 .v-modal-enter { animation: v-modal-in 0.2s ease; @@ -34,4 +52,4 @@ } .list-complete-leave-active { position: absolute; -} \ No newline at end of file +} diff --git a/src/styles/common/mixins/mixins.scss b/src/styles/common/mixins/mixins.scss index 2f49982a..f0c6acb6 100644 --- a/src/styles/common/mixins/mixins.scss +++ b/src/styles/common/mixins/mixins.scss @@ -9,6 +9,12 @@ } } +@mixin deep() { + ::v-deep *{ + @content; + } +} + @mixin when($state) { @at-root { &.#{$state-prefix + $state} { @@ -46,10 +52,10 @@ } } -//获取字体颜色 -@mixin font-color($target) { +//获取斑点渐变颜色 +@mixin background-point($target) { @include themeify { - color: themed($target); + background-image: themed($target); } } @@ -58,4 +64,4 @@ @include themeify { border-color: themed($target); } -} \ No newline at end of file +} diff --git a/src/styles/common/style.scss b/src/styles/common/style.scss index 110eff9b..6c06f4a4 100644 --- a/src/styles/common/style.scss +++ b/src/styles/common/style.scss @@ -1,7 +1,26 @@ @import './var.scss'; @import './animation.scss'; +@import './mixins/mixins.scss'; // extends +// 过度 +.go-transition { + transition: all 0.2s; +} + +.go-flex-center { + display: flex; + justify-content: center; + align-items: center; +} + +.go-absolute-center { + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); +} + // 毛玻璃 .go-background-filter { backdrop-filter: $--filter-blur-base; @@ -15,6 +34,12 @@ overflow: hidden; } +// 背景斑点需配合 @mixin background-point 使用 +.go-point-bg { + @include fetch-theme('background-color'); + background-size: 15px 15px, 15px 15px; +} + // todo 使用 scss 循环写一套完整的 // margin .go-mt-0 { @@ -41,4 +66,4 @@ .go-px-0 { @extend .go-pt-0; @extend .go-pb-0; -} \ No newline at end of file +} diff --git a/src/styles/common/var.scss b/src/styles/common/var.scss index 313c3d80..50072326 100644 --- a/src/styles/common/var.scss +++ b/src/styles/common/var.scss @@ -4,11 +4,11 @@ $--color-warn: #fcbc40; $--color-success: #34c749; // 文字 -$--color-text: hsla(0, 0%, 100%, 1); -$--color-text-1: hsla(0, 0%, 100%, 0.9); -$--color-text-2: hsla(0, 0%, 100%, 0.7); -$--color-text-3: hsla(0, 0%, 100%, 0.5); -$--color-text-4: hsla(0, 0%, 100%, 0.3); +$--color-text: #1d2129; +$--color-text-1: #4e5969; +$--color-text-2: #86909c; +$--color-text-3: #c9cdd4; +$--color-text-4: #f2f3f5; // 白色 $--color-light-fill: #fff; diff --git a/src/utils/index.ts b/src/utils/index.ts index df68cc40..2fe04d55 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -1,4 +1,4 @@ -import { h, DefineComponent } from 'vue' +import { h } from 'vue' import { NIcon } from 'naive-ui' /** @@ -18,6 +18,43 @@ export const renderIcon = (icon: any) => { return () => h(NIcon, null, { default: () => h(icon) }) } +/** + * * render 弹出确认框 + * @param { Function } dialogFn dialog函数,暂时必须从页面传过来 + * @param { Object} params 配置参数 + */ +export const goDialog = ( + dialogFn: Function, + params: { + // 基本 + type: 'delete' + message?: string + onPositiveCallback?: Function + onNegativeCallback?: Function + // 渲染函数 + render?: boolean + contentFn?: Function + actionFn?: Function + } +) => { + const { type, message, onPositiveCallback, onNegativeCallback } = params + const tip = { + delete: '是否删除此数据' + } + dialogFn({ + title: '提示', + content: message || tip[type] || '', + positiveText: '确定', + negativeText: '取消', + onPositiveClick: () => { + onPositiveCallback && onPositiveCallback() + }, + onNegativeClick: () => { + onNegativeCallback && onNegativeCallback() + } + }) +} + /** * * 处理 vite 中无法使用 require 的问题 * @param name diff --git a/src/views/project/items/List/index.vue b/src/views/project/items/List/index.vue deleted file mode 100644 index 3f779ad4..00000000 --- a/src/views/project/items/List/index.vue +++ /dev/null @@ -1,105 +0,0 @@ - - - - - diff --git a/src/views/project/items/components/Card/20211219181327.png b/src/views/project/items/components/Card/20211219181327.png new file mode 100644 index 00000000..7be19aa3 Binary files /dev/null and b/src/views/project/items/components/Card/20211219181327.png differ diff --git a/src/views/project/items/components/Card/index.ts b/src/views/project/items/components/Card/index.ts new file mode 100644 index 00000000..eb4d8cfa --- /dev/null +++ b/src/views/project/items/components/Card/index.ts @@ -0,0 +1,3 @@ +import Card from './index.vue' + +export { Card } diff --git a/src/views/project/items/components/Card/index.vue b/src/views/project/items/components/Card/index.vue new file mode 100644 index 00000000..9bc1585b --- /dev/null +++ b/src/views/project/items/components/Card/index.vue @@ -0,0 +1,176 @@ + + + + + diff --git a/src/views/project/items/List/index.ts b/src/views/project/items/components/List/index.ts similarity index 100% rename from src/views/project/items/List/index.ts rename to src/views/project/items/components/List/index.ts diff --git a/src/views/project/items/components/List/index.vue b/src/views/project/items/components/List/index.vue new file mode 100644 index 00000000..5a153442 --- /dev/null +++ b/src/views/project/items/components/List/index.vue @@ -0,0 +1,62 @@ + + + + + diff --git a/src/views/project/items/index.d.ts b/src/views/project/items/index.d.ts new file mode 100644 index 00000000..d54bd15b --- /dev/null +++ b/src/views/project/items/index.d.ts @@ -0,0 +1,7 @@ +export type CardType = { + id: number | string + title: string // 标题 + lableId: string | number + label: string // 标签 + release: number // 0未发布 | 1已发布 +} diff --git a/src/views/project/items/index.vue b/src/views/project/items/index.vue index 0a89c2af..5c9351bf 100644 --- a/src/views/project/items/index.vue +++ b/src/views/project/items/index.vue @@ -5,7 +5,7 @@