From 6acc80f18a943864f44f7684a79b387e0d674766 Mon Sep 17 00:00:00 2001 From: XiaoDaiGua-Ray <443547225@qq.com> Date: Fri, 8 Sep 2023 15:13:36 +0800 Subject: [PATCH] =?UTF-8?q?v4.1.9=E9=83=A8=E5=88=86=E7=BB=86=E8=8A=82?= =?UTF-8?q?=E8=A1=A5=E5=85=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 2 + README.md | 50 +++---------------- cfg.ts | 4 +- src/app-components/app/AppAvatar/index.tsx | 2 +- .../provider/AppNaiveGlobalProvider/index.tsx | 9 ++-- .../index.tsx | 10 ++-- .../provider/AppStyleProvider/index.tsx | 4 +- src/{appConfig => app-config}/appConfig.ts | 0 src/{appConfig => app-config}/designConfig.ts | 0 src/{appConfig => app-config}/localConfig.ts | 0 src/{appConfig => app-config}/regexConfig.ts | 0 .../requestConfig.ts | 0 src/{appConfig => app-config}/routerConfig.ts | 0 src/axios/inject/request/provide.ts | 2 +- src/axios/instance.ts | 2 +- src/components/RayChart/index.tsx | 2 +- src/components/RayQRCode/src/index.tsx | 15 +++--- src/components/RayQRCode/src/props.ts | 9 ++++ src/components/RayQRCode/src/type.ts | 2 + .../RayTransitionComponent/index.vue | 2 +- src/dayjs/index.ts | 2 +- src/directives/modules/copy/index.ts | 35 +++++++------ src/directives/modules/copy/type.ts | 3 ++ src/layout/components/Menu/index.tsx | 2 +- src/layout/components/MenuTag/index.tsx | 2 +- .../components/SettingDrawer/index.tsx | 2 +- src/layout/components/SiderBar/index.tsx | 2 +- src/layout/default/ContentWrapper/index.tsx | 4 +- src/layout/index.tsx | 2 +- src/locales/helper.ts | 4 +- src/locales/index.ts | 2 +- src/locales/lang/zh-CN/views/login/index.json | 2 +- src/router/helper/helper.ts | 2 +- src/router/helper/permission.ts | 4 +- src/router/helper/routerCopilot.ts | 4 +- src/router/routes.ts | 2 +- src/store/index.ts | 7 ++- src/store/modules/keep-alive/index.ts | 2 +- src/store/modules/menu/helper.ts | 2 +- src/store/modules/setting/index.ts | 2 +- src/utils/element.ts | 2 +- src/views/login/components/Signin/index.tsx | 2 +- src/views/login/index.tsx | 2 +- 43 files changed, 98 insertions(+), 110 deletions(-) rename src/app-components/provider/{AppRequestCanceler => AppRequestCancelerProvider}/index.tsx (77%) rename src/{appConfig => app-config}/appConfig.ts (100%) rename src/{appConfig => app-config}/designConfig.ts (100%) rename src/{appConfig => app-config}/localConfig.ts (100%) rename src/{appConfig => app-config}/regexConfig.ts (100%) rename src/{appConfig => app-config}/requestConfig.ts (100%) rename src/{appConfig => app-config}/routerConfig.ts (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index e60912c4..dbd18e1c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ - 移除 qrcode.vue 依赖 - 更新 vue-hooks-plus 版本至 v1.8.2 - 移除 office 功能集成 +- 统一包命名方式 +- 更改 v-copy 实现细节(使用方式不变) ### Fixes diff --git a/README.md b/README.md index 144c050c..ad22f5e9 100644 --- a/README.md +++ b/README.md @@ -12,14 +12,16 @@ ## ✨ 特性 -- **最新技术栈**:使用 Vue3.x/vite4.x 等前端前沿技术开发 +- **最新技术栈**:使用 vue3.x/vite4.x/pinia 等前端前沿技术开发 - **TypeScript**:应用程序级 JavaScript 的语言 - **主题**:可配置的主题 - **国际化**:内置完善的国际化方案 - **Mock 数据**:内置 Mock 数据方案 - **权限**:内置完善的动态路由权限生成方案 - **组件**:二次封装了多个常用的组件 -- **Axios 请求**:二次封装 axios 库 +- **Axios 请求**:二次封装 axios 库,支持:取消、防抖、自动重复取消等功能 +- **缓存**:任意深度页面缓存 +- **SVG**:内置 svg icon 解决方案 ## 🪄 预览地址 @@ -37,7 +39,7 @@ ## 🪴 准备 -- [node](http://nodejs.org/) 和 [git](https://git-scm.com/) -项目开发环境 +- [Node](http://nodejs.org/) 和 [git](https://git-scm.com/) - 项目开发环境 - [Vite](https://vitejs.dev/) - 熟悉 vite 特性 - [Vue3](https://v3.vuejs.org/) - 熟悉 Vue 基础语法 - [TypeScript](https://www.typescriptlang.org/) - 熟悉 TypeScript 基本语法 @@ -63,73 +65,33 @@ git clone https://gh.yka.moe/https://github.com/XiaoDaiGua-Ray/ray-template.git ### 拉取依赖 ```sh -# pnpm - pnpm ``` -```sh -# npm - -npm install -``` - ### 启动项目 ```sh -# pnpm - pnpm dev ``` -```sh -# npm - -npm run dev -``` - ### 项目打包 ```sh -# pnpm - pnpm build ``` -```sh -# npm - -npm run build -``` - ### 预览项目 ```sh -# pnpm - pnpm preview ``` -```sh -# npm - -npm run preview -``` - ### 体积分析 ```sh -# pnpm - pnpm report ``` -```sh -# npm - -npm run report -``` - ## 🪴 项目活动  @@ -150,4 +112,4 @@ npm run report ## 📄 证书 -[MIT License](https://github.com/XiaoDaiGua-Ray/ray-template/blob/main/LICENSE) © 2022-PRESENT [Ray](https://github.com/XiaoDaiGua-Ray/ray-template) +[MIT License](https://github.com/XiaoDaiGua-Ray/ray-template/blob/main/LICENSE) © 2022-PRESENT [Ray](https://github.com/XiaoDaiGua-Ray) diff --git a/cfg.ts b/cfg.ts index 9ac1939b..9d803ba9 100644 --- a/cfg.ts +++ b/cfg.ts @@ -43,8 +43,8 @@ import { buildOptions, mixinCSSPlugin, } from './vite-plugin/index' -import { APP_THEME } from './src/appConfig/designConfig' -import { PRE_LOADING_CONFIG, SIDE_BAR_LOGO } from './src/appConfig/appConfig' +import { APP_THEME } from './src/app-config/designConfig' +import { PRE_LOADING_CONFIG, SIDE_BAR_LOGO } from './src/app-config/appConfig' import type { AppConfigExport } from '@/types/modules/cfg' diff --git a/src/app-components/app/AppAvatar/index.tsx b/src/app-components/app/AppAvatar/index.tsx index 777597a4..4e561648 100644 --- a/src/app-components/app/AppAvatar/index.tsx +++ b/src/app-components/app/AppAvatar/index.tsx @@ -22,7 +22,7 @@ import './index.scss' import { NAvatar, NSpace } from 'naive-ui' import { avatarProps, spaceProps } from 'naive-ui' -import { APP_CATCH_KEY } from '@/appConfig/appConfig' +import { APP_CATCH_KEY } from '@/app-config/appConfig' import { getStorage } from '@/utils/cache' import type { PropType } from 'vue' diff --git a/src/app-components/provider/AppNaiveGlobalProvider/index.tsx b/src/app-components/provider/AppNaiveGlobalProvider/index.tsx index cdbc4602..fe12f1d0 100644 --- a/src/app-components/provider/AppNaiveGlobalProvider/index.tsx +++ b/src/app-components/provider/AppNaiveGlobalProvider/index.tsx @@ -31,9 +31,9 @@ import { import { useSetting } from '@/store' import { naiveLocales } from '@/locales/helper' -const GlobalProvider = defineComponent({ +export default defineComponent({ name: 'GlobalProvider', - setup() { + setup(_, { expose }) { const settingStore = useSetting() const modelPrimaryColorOverride = computed( @@ -54,6 +54,7 @@ const GlobalProvider = defineComponent({ configProviderProps: computed(() => ({ theme: modelThemeValue.value, })), + notificationProviderProps: {}, }, ) @@ -62,6 +63,8 @@ const GlobalProvider = defineComponent({ window.$loadingBar = loadingBar // 注入 `loadingBar` window.$notification = notification // 注入 `notification` + expose() + return { modelPrimaryColorOverride, modelThemeValue, @@ -90,5 +93,3 @@ const GlobalProvider = defineComponent({ ) }, }) - -export default GlobalProvider diff --git a/src/app-components/provider/AppRequestCanceler/index.tsx b/src/app-components/provider/AppRequestCancelerProvider/index.tsx similarity index 77% rename from src/app-components/provider/AppRequestCanceler/index.tsx rename to src/app-components/provider/AppRequestCancelerProvider/index.tsx index 44f177d9..6aa15f36 100644 --- a/src/app-components/provider/AppRequestCanceler/index.tsx +++ b/src/app-components/provider/AppRequestCancelerProvider/index.tsx @@ -19,12 +19,14 @@ import { axiosCanceler } from '@/axios/helper/interceptor' -const AppRequestCanceler = defineComponent({ - name: 'AppRequestCanceler', - setup() { +const AppRequestCancelerProvider = defineComponent({ + name: 'AppRequestCancelerProvider', + setup(_, { expose }) { onBeforeRouteUpdate(() => { axiosCanceler.cancelAllRequest() }) + + expose() }, render() { return ( @@ -37,4 +39,4 @@ const AppRequestCanceler = defineComponent({ }, }) -export default AppRequestCanceler +export default AppRequestCancelerProvider diff --git a/src/app-components/provider/AppStyleProvider/index.tsx b/src/app-components/provider/AppStyleProvider/index.tsx index 7cd3c14d..d60a4edb 100644 --- a/src/app-components/provider/AppStyleProvider/index.tsx +++ b/src/app-components/provider/AppStyleProvider/index.tsx @@ -20,7 +20,7 @@ import type { SettingState } from '@/store/modules/setting/type' const AppStyleProvider = defineComponent({ name: 'AppStyleProvider', - setup() { + setup(_, { expose }) { const settingStore = useSetting() const { themeValue } = storeToRefs(settingStore) @@ -97,6 +97,8 @@ const AppStyleProvider = defineComponent({ immediate: true, }, ) + + expose() }, render() { return
diff --git a/src/appConfig/appConfig.ts b/src/app-config/appConfig.ts similarity index 100% rename from src/appConfig/appConfig.ts rename to src/app-config/appConfig.ts diff --git a/src/appConfig/designConfig.ts b/src/app-config/designConfig.ts similarity index 100% rename from src/appConfig/designConfig.ts rename to src/app-config/designConfig.ts diff --git a/src/appConfig/localConfig.ts b/src/app-config/localConfig.ts similarity index 100% rename from src/appConfig/localConfig.ts rename to src/app-config/localConfig.ts diff --git a/src/appConfig/regexConfig.ts b/src/app-config/regexConfig.ts similarity index 100% rename from src/appConfig/regexConfig.ts rename to src/app-config/regexConfig.ts diff --git a/src/appConfig/requestConfig.ts b/src/app-config/requestConfig.ts similarity index 100% rename from src/appConfig/requestConfig.ts rename to src/app-config/requestConfig.ts diff --git a/src/appConfig/routerConfig.ts b/src/app-config/routerConfig.ts similarity index 100% rename from src/appConfig/routerConfig.ts rename to src/app-config/routerConfig.ts diff --git a/src/axios/inject/request/provide.ts b/src/axios/inject/request/provide.ts index f2becd29..1b06c3c9 100644 --- a/src/axios/inject/request/provide.ts +++ b/src/axios/inject/request/provide.ts @@ -20,7 +20,7 @@ import { useAxiosInterceptor, axiosCanceler } from '@/axios/helper/interceptor' import { appendRequestHeaders } from '@/axios/helper/axiosCopilot' -import { APP_CATCH_KEY } from '@/appConfig/appConfig' +import { APP_CATCH_KEY } from '@/app-config/appConfig' import { getStorage } from '@/utils/cache' import type { diff --git a/src/axios/instance.ts b/src/axios/instance.ts index 5f717cf1..e968087a 100644 --- a/src/axios/instance.ts +++ b/src/axios/instance.ts @@ -17,7 +17,7 @@ */ import axios from 'axios' -import { AXIOS_CONFIG } from '@/appConfig/requestConfig' +import { AXIOS_CONFIG } from '@/app-config/requestConfig' import { useAxiosInterceptor, axiosCanceler } from '@/axios/helper/interceptor' import { setupResponseInterceptor, diff --git a/src/components/RayChart/index.tsx b/src/components/RayChart/index.tsx index bc6838ab..2fd661b4 100644 --- a/src/components/RayChart/index.tsx +++ b/src/components/RayChart/index.tsx @@ -46,7 +46,7 @@ import { cloneDeep, throttle } from 'lodash-es' import { on, off, completeSize } from '@/utils/element' import { call } from '@/utils/vue/index' import { setupChartTheme, loadingOptions } from './helper' -import { APP_THEME } from '@/appConfig/designConfig' +import { APP_THEME } from '@/app-config/designConfig' import type { PropType } from 'vue' import type { AnyFC, MaybeArray } from '@/types/modules/utils' diff --git a/src/components/RayQRCode/src/index.tsx b/src/components/RayQRCode/src/index.tsx index a7a33832..f66085c4 100644 --- a/src/components/RayQRCode/src/index.tsx +++ b/src/components/RayQRCode/src/index.tsx @@ -19,11 +19,9 @@ import { AwesomeQR } from 'awesome-qr' import { isValueType, downloadBase64File } from '@use-utils/hook' import { call } from '@/utils/vue/index' -import type { QRCodeRenderResponse } from './type' +import type { QRCodeRenderResponse, GIFBuffer } from './type' -const readGIFAsArrayBuffer = ( - url: string, -): Promise