fix: import order

This commit is contained in:
chansee97 2024-09-14 08:09:20 +08:00
parent e450a029ac
commit 7da454563b
43 changed files with 117 additions and 117 deletions

View File

@ -1,16 +1,16 @@
import UnoCSS from '@unocss/vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import VueDevTools from 'vite-plugin-vue-devtools'
import Components from 'unplugin-vue-components/vite'
import AutoImport from 'unplugin-auto-import/vite'
import { NaiveUiResolver } from 'unplugin-vue-components/resolvers'
import viteCompression from 'vite-plugin-compression'
import Icons from 'unplugin-icons/vite'
import { FileSystemIconLoader } from 'unplugin-icons/loaders'
// https://github.com/antfu/unplugin-icons
import IconsResolver from 'unplugin-icons/resolver'
import Icons from 'unplugin-icons/vite'
import { NaiveUiResolver } from 'unplugin-vue-components/resolvers'
import Components from 'unplugin-vue-components/vite'
import viteCompression from 'vite-plugin-compression'
import VueDevTools from 'vite-plugin-vue-devtools'
/**
* @description: vite插件配置

View File

@ -1,7 +1,7 @@
<script setup lang="ts">
import { naiveI18nOptions } from '@/utils'
import { darkTheme } from 'naive-ui'
import { useAppStore } from './store'
import { naiveI18nOptions } from '@/utils'
const appStore = useAppStore()

View File

@ -1,9 +1,9 @@
<script setup lang="ts">
import { NFlex } from 'naive-ui'
import { useAppStore } from '@/store'
import IconSun from '~icons/icon-park-outline/sun-one'
import IconMoon from '~icons/icon-park-outline/moon'
import IconAuto from '~icons/icon-park-outline/laptop-computer'
import IconMoon from '~icons/icon-park-outline/moon'
import IconSun from '~icons/icon-park-outline/sun-one'
import { NFlex } from 'naive-ui'
const { t } = useI18n()

View File

@ -1,11 +1,11 @@
<script setup lang="ts">
import type { ToolbarNames } from 'md-editor-v3'
import { MdEditor } from 'md-editor-v3'
import { useAppStore } from '@/store'
import { MdEditor } from 'md-editor-v3'
// https://imzbf.github.io/md-editor-v3/zh-CN/docs
import 'md-editor-v3/lib/style.css'
import { useAppStore } from '@/store'
const model = defineModel<string>()

View File

@ -1,7 +1,7 @@
<script setup lang="ts">
import Quill from 'quill'
import 'quill/dist/quill.snow.css'
import { useTemplateRef } from 'vue'
import 'quill/dist/quill.snow.css'
defineOptions({
name: 'RichTextEditor',

View File

@ -1,6 +1,3 @@
import * as echarts from 'echarts/core'
import { BarChart, LineChart, PieChart, RadarChart } from 'echarts/charts'
import { useTemplateRef } from 'vue'
// 系列类型的定义后缀都为 SeriesOption
import type {
BarSeriesOption,
@ -8,7 +5,6 @@ import type {
PieSeriesOption,
RadarSeriesOption,
} from 'echarts/charts'
// 组件类型的定义后缀都为 ComponentOption
import type {
DatasetComponentOption,
@ -18,6 +14,9 @@ import type {
ToolboxComponentOption,
TooltipComponentOption,
} from 'echarts/components'
import { useAppStore } from '@/store'
import { BarChart, LineChart, PieChart, RadarChart } from 'echarts/charts'
import {
DatasetComponent, // 数据集组件
GridComponent,
@ -27,10 +26,11 @@ import {
TooltipComponent,
TransformComponent, // 内置数据转换器组件 (filter, sort)
} from 'echarts/components'
import * as echarts from 'echarts/core'
import { LabelLayout, UniversalTransition } from 'echarts/features'
import { CanvasRenderer } from 'echarts/renderers'
import { useAppStore } from '@/store'
import { useTemplateRef } from 'vue'
// 通过 ComposeOption 来组合出一个只有必须组件和图表的 Option 类型
export type ECOption = echarts.ComposeOption<

View File

@ -1,5 +1,5 @@
import { isArray, isString } from 'radash'
import { useAuthStore } from '@/store'
import { isArray, isString } from 'radash'
/** 权限判断 */
export function usePermission() {

View File

@ -1,6 +1,6 @@
<script setup lang="ts">
import LayoutSelector from './LayoutSelector.vue'
import { useAppStore } from '@/store'
import LayoutSelector from './LayoutSelector.vue'
const appStore = useAppStore()

View File

@ -1,6 +1,6 @@
<script setup lang="ts">
import { useRouteStore } from '@/store'
import { useBoolean } from '@/hooks'
import { useRouteStore } from '@/store'
const routeStore = useRouteStore()

View File

@ -1,10 +1,10 @@
<script setup lang="ts">
import { renderIcon } from '@/utils/icon'
import { useAuthStore } from '@/store'
import IconGithub from '~icons/icon-park-outline/github'
import IconUser from '~icons/icon-park-outline/user'
import IconLogout from '~icons/icon-park-outline/logout'
import { renderIcon } from '@/utils/icon'
import IconBookOpen from '~icons/icon-park-outline/book-open'
import IconGithub from '~icons/icon-park-outline/github'
import IconLogout from '~icons/icon-park-outline/logout'
import IconUser from '~icons/icon-park-outline/user'
const { t } = useI18n()

View File

@ -1,30 +1,30 @@
import Logo from './sider/Logo.vue'
import Menu from './sider/Menu.vue'
import BackTop from './common/BackTop.vue'
import Setting from './common/Setting.vue'
import SettingDrawer from './common/SettingDrawer.vue'
import Breadcrumb from './header/Breadcrumb.vue'
import CollapaseButton from './header/CollapaseButton.vue'
import FullScreen from './header/FullScreen.vue'
import Notices from './header/Notices.vue'
import UserCenter from './header/UserCenter.vue'
import Search from './header/Search.vue'
import UserCenter from './header/UserCenter.vue'
import Logo from './sider/Logo.vue'
import Menu from './sider/Menu.vue'
import TabBar from './tab/TabBar.vue'
import BackTop from './common/BackTop.vue'
import Setting from './common/Setting.vue'
import SettingDrawer from './common/SettingDrawer.vue'
export {
BackTop,
Breadcrumb,
CollapaseButton,
Menu,
Logo,
FullScreen,
Logo,
Menu,
Notices,
Search,
Setting,
SettingDrawer,
Notices,
UserCenter,
Search,
TabBar,
BackTop,
UserCenter,
}

View File

@ -1,15 +1,15 @@
<script setup lang="ts">
import type { RouteLocationNormalized } from 'vue-router'
import Reload from './Reload.vue'
import DropTabs from './DropTabs.vue'
import ContentFullScreen from './ContentFullScreen.vue'
import { useAppStore, useTabStore } from '@/store'
import IconRedo from '~icons/icon-park-outline/redo'
import IconClose from '~icons/icon-park-outline/close'
import IconDelete from '~icons/icon-park-outline/delete-four'
import IconFullwith from '~icons/icon-park-outline/fullwidth'
import IconRedo from '~icons/icon-park-outline/redo'
import IconLeft from '~icons/icon-park-outline/to-left'
import IconRight from '~icons/icon-park-outline/to-right'
import IconFullwith from '~icons/icon-park-outline/fullwidth'
import ContentFullScreen from './ContentFullScreen.vue'
import DropTabs from './DropTabs.vue'
import Reload from './Reload.vue'
const tabStore = useTabStore()
const appStore = useAppStore()

View File

@ -1,9 +1,9 @@
<script setup lang="ts">
import leftMenu from './leftMenu.layout.vue'
import topMenu from './topMenu.layout.vue'
import mixMenu from './mixMenu.layout.vue'
import { SettingDrawer } from './components'
import { useAppStore } from '@/store/app'
import { SettingDrawer } from './components'
import leftMenu from './leftMenu.layout.vue'
import mixMenu from './mixMenu.layout.vue'
import topMenu from './topMenu.layout.vue'
const appStore = useAppStore()
const layoutMap = {

View File

@ -1,4 +1,5 @@
<script lang="ts" setup>
import { useAppStore, useRouteStore } from '@/store'
import {
BackTop,
Breadcrumb,
@ -12,7 +13,6 @@ import {
TabBar,
UserCenter,
} from './components'
import { useAppStore, useRouteStore } from '@/store'
const routeStore = useRouteStore()
const appStore = useAppStore()

View File

@ -1,5 +1,6 @@
<script lang="ts" setup>
import type { MenuInst, MenuOption } from 'naive-ui'
import { useAppStore, useRouteStore } from '@/store'
import {
BackTop,
CollapaseButton,
@ -11,7 +12,6 @@ import {
TabBar,
UserCenter,
} from './components'
import { useAppStore, useRouteStore } from '@/store'
const routeStore = useRouteStore()
const appStore = useAppStore()

View File

@ -1,4 +1,5 @@
<script lang="ts" setup>
import { useAppStore, useRouteStore } from '@/store'
import {
BackTop,
FullScreen,
@ -10,7 +11,6 @@ import {
TabBar,
UserCenter,
} from './components'
import { useAppStore, useRouteStore } from '@/store'
const routeStore = useRouteStore()
const appStore = useAppStore()

View File

@ -1,8 +1,8 @@
import type { App } from 'vue'
import AppVue from './App.vue'
import AppLoading from './components/common/AppLoading.vue'
import { installRouter } from '@/router'
import { installPinia } from '@/store'
import AppVue from './App.vue'
import AppLoading from './components/common/AppLoading.vue'
async function setupApp() {
// 载入全局loading加载状态

View File

@ -1,8 +1,8 @@
import { createI18n } from 'vue-i18n'
import type { App } from 'vue'
import { local } from '@/utils'
import { createI18n } from 'vue-i18n'
import enUS from '../../locales/en_US.json'
import zhCN from '../../locales/zh_CN.json'
import { local } from '@/utils'
const { VITE_DEFAULT_LANG } = import.meta.env

View File

@ -1,7 +1,7 @@
import type { App } from 'vue'
import { createRouter, createWebHashHistory, createWebHistory } from 'vue-router'
import { routes } from './routes.inner'
import { setupRouterGuard } from './guard'
import { routes } from './routes.inner'
const { VITE_ROUTE_MODE = 'hash', VITE_BASE_URL } = import.meta.env
export const router = createRouter({

View File

@ -1,18 +1,18 @@
import { local } from '@/utils'
import { createAlova } from 'alova'
import VueHook, { type VueHookType } from 'alova/vue'
import adapterFetch from 'alova/fetch'
import { createServerTokenAuthentication } from 'alova/client'
import adapterFetch from 'alova/fetch'
import VueHook, { type VueHookType } from 'alova/vue'
import {
DEFAULT_ALOVA_OPTIONS,
DEFAULT_BACKEND_OPTIONS,
} from './config'
import {
handleBusinessError,
handleRefreshToken,
handleResponseError,
handleServiceResult,
} from './handle'
import {
DEFAULT_ALOVA_OPTIONS,
DEFAULT_BACKEND_OPTIONS,
} from './config'
import { local } from '@/utils'
const { onAuthRequired, onResponseRefreshToken } = createServerTokenAuthentication<VueHookType>({
// 服务端判定token过期

View File

@ -1,10 +1,10 @@
import { fetchUpdateToken } from '@/service'
import { useAuthStore } from '@/store'
import { local } from '@/utils'
import {
ERROR_NO_TIP_STATUS,
ERROR_STATUS,
} from './config'
import { useAuthStore } from '@/store'
import { fetchUpdateToken } from '@/service'
import { local } from '@/utils'
type ErrorStatus = keyof typeof ERROR_STATUS

View File

@ -1,6 +1,6 @@
import { createAlovaInstance } from './alova'
import { serviceConfig } from '@/../service.config'
import { generateProxyPattern } from '@/../build/proxy'
import { serviceConfig } from '@/../service.config'
import { createAlovaInstance } from './alova'
const isHttpProxy = import.meta.env.DEV && import.meta.env.VITE_HTTP_PROXY === 'Y'

View File

@ -1,4 +1,4 @@
export * from './api/system'
export * from './api/login'
export * from './api/list'
export * from './api/login'
export * from './api/system'
export * from './api/test'

View File

@ -1,8 +1,8 @@
import type { GlobalThemeOverrides } from 'naive-ui'
import { local, setLocale } from '@/utils'
import { colord } from 'colord'
import { set } from 'radash'
import themeConfig from './theme.json'
import { local, setLocale } from '@/utils'
export type TransitionAnimation = '' | 'fade-slide' | 'fade-bottom' | 'fade-scale' | 'zoom-fade' | 'zoom-out'
export type LayoutMode = 'leftMenu' | 'topMenu' | 'mixMenu'

View File

@ -1,8 +1,8 @@
import { router } from '@/router'
import { fetchLogin } from '@/service'
import { local } from '@/utils'
import { useRouteStore } from './router'
import { useTabStore } from './tab'
import { fetchLogin } from '@/service'
import { router } from '@/router'
import { local } from '@/utils'
interface AuthStatus {
userInfo: Api.Login.Info | null

View File

@ -1,10 +1,10 @@
import { clone, min, omit, pick } from 'radash'
import type { RouteRecordRaw } from 'vue-router'
import type { MenuOption } from 'naive-ui'
import { RouterLink } from 'vue-router'
import Layout from '@/layouts/index.vue'
import type { RouteRecordRaw } from 'vue-router'
import { usePermission } from '@/hooks'
import Layout from '@/layouts/index.vue'
import { $t, arrayToTree, renderIcon } from '@/utils'
import { clone, min, omit, pick } from 'radash'
import { RouterLink } from 'vue-router'
const metaFields: AppRoute.MetaKeys[]
= ['title', 'icon', 'requiresAuth', 'roles', 'keepAlive', 'hide', 'order', 'href', 'activeMenu', 'withoutTab', 'pinTab', 'menuType']

View File

@ -1,10 +1,10 @@
import type { MenuOption } from 'naive-ui'
import { createMenus, createRoutes, generateCacheRoutes } from './helper'
import { $t, local } from '@/utils'
import { router } from '@/router'
import { fetchUserRoutes } from '@/service'
import { staticRoutes } from '@/router/routes.static'
import { fetchUserRoutes } from '@/service'
import { useAuthStore } from '@/store/auth'
import { $t, local } from '@/utils'
import { createMenus, createRoutes, generateCacheRoutes } from './helper'
interface RoutesStatus {
isInitAuthRoute: boolean

View File

@ -1,6 +1,6 @@
import type { NDateLocale, NLocale } from 'naive-ui'
import { dateZhCN, zhCN } from 'naive-ui'
import { i18n } from '@/modules/i18n'
import { dateZhCN, zhCN } from 'naive-ui'
export function setLocale(locale: App.lang) {
i18n.global.locale.value = locale

View File

@ -1,5 +1,5 @@
export * from './array'
export * from './dict'
export * from './i18n'
export * from './icon'
export * from './storage'
export * from './array'
export * from './i18n'
export * from './dict'

View File

@ -1,6 +1,6 @@
<script setup lang="ts">
import { graphic } from 'echarts'
import { type ECOption, useEcharts } from '@/hooks'
import { graphic } from 'echarts'
const lineOptions = ref<ECOption>({
tooltip: {

View File

@ -1,6 +1,6 @@
<script setup lang="ts">
import { graphic } from 'echarts'
import { type ECOption, useEcharts } from '@/hooks'
import { graphic } from 'echarts'
const chartData = [
{ name: '1', value: 300 },

View File

@ -1,6 +1,6 @@
<script setup lang="ts">
import Chart from './components/chart.vue'
import { useAuthStore } from '@/store'
import Chart from './components/chart.vue'
const { userInfo } = useAuthStore()
</script>

View File

@ -1,6 +1,6 @@
<script setup lang="ts">
import { graphic } from 'echarts'
import { type ECOption, useEcharts } from '@/hooks'
import { graphic } from 'echarts'
//
const pieOptions = ref<ECOption>({

View File

@ -1,8 +1,8 @@
<script setup lang="ts">
import { useRequest } from 'alova/client'
import {
downloadFile,
} from '@/service'
import { useRequest } from 'alova/client'
const emit = defineEmits<{
update: [data: any]

View File

@ -1,10 +1,10 @@
<script setup lang="ts">
import { useRequest } from 'alova/client'
import {
fetchGet,
} from '@/service'
import { useRequest } from 'alova/client'
const emit = defineEmits<{
update: [data: any] //
}>()

View File

@ -1,20 +1,20 @@
<script setup lang="ts">
import Env from './components/Env.vue'
import Get from './components/Get.vue'
import Post from './components/Post.vue'
import FormPost from './components/FormPost.vue'
import Delete from './components/Delete.vue'
import Put from './components/Put.vue'
import UseRequest from './components/UseRequest.vue'
import NoToken from './components/NoToken.vue'
import DownLoad from './components/DownLoad.vue'
import DownLoadWithProgress from './components/DownLoadWithProgress.vue'
import Env from './components/Env.vue'
import FailedRequest from './components/FailedRequest.vue'
import FailedResponse from './components/FailedResponse.vue'
import FailedResponseWithoutTip from './components/FailedResponseWithoutTip.vue'
import Transform from './components/Transform.vue'
import FormPost from './components/FormPost.vue'
import Get from './components/Get.vue'
import NoToken from './components/NoToken.vue'
import Post from './components/Post.vue'
import Put from './components/Put.vue'
import RefreshToken from './components/RefreshToken.vue'
import TokenExpiration from './components/TokenExpiration.vue'
import Transform from './components/Transform.vue'
import UseRequest from './components/UseRequest.vue'
const msg = ref()
function handleUpdate(data: any) {

View File

@ -1,10 +1,10 @@
<script setup lang="tsx">
import type { DataTableColumns, FormInst } from 'naive-ui'
import { Gender } from '@/constants'
import { useBoolean } from '@/hooks'
import { fetchUserPage } from '@/service'
import { NButton, NPopconfirm, NSpace, NSwitch, NTag } from 'naive-ui'
import TableModal from './components/TableModal.vue'
import { fetchUserPage } from '@/service'
import { useBoolean } from '@/hooks'
import { Gender } from '@/constants'
const { bool: loading, setTrue: startLoading, setFalse: endLoading } = useBoolean(false)
const { bool: visible, setTrue: openModal } = useBoolean(false)

View File

@ -1,6 +1,6 @@
<script setup lang="ts">
import { useAuthStore } from '@/store'
import { usePermission } from '@/hooks'
import { useAuthStore } from '@/store'
const authStore = useAuthStore()
const { hasPermission } = usePermission()

View File

@ -1,7 +1,7 @@
<script setup lang="ts">
import type { FormInst } from 'naive-ui'
import { local } from '@/utils'
import { useAuthStore } from '@/store'
import { local } from '@/utils'
const emit = defineEmits(['update:modelValue'])

View File

@ -1,11 +1,11 @@
<script setup lang="tsx">
import type { DataTableColumns, FormInst } from 'naive-ui'
import CopyText from '@/components/custom/CopyText.vue'
import { Gender } from '@/constants'
import { useBoolean } from '@/hooks'
import { fetchUserPage } from '@/service'
import { NButton, NPopconfirm, NSpace, NSwitch, NTag } from 'naive-ui'
import TableModal from './components/TableModal.vue'
import { fetchUserPage } from '@/service'
import { useBoolean } from '@/hooks'
import { Gender } from '@/constants'
import CopyText from '@/components/custom/CopyText.vue'
const { bool: loading, setTrue: startLoading, setFalse: endLoading } = useBoolean(false)

View File

@ -1,11 +1,11 @@
<script setup lang="tsx">
import type { DataTableColumns } from 'naive-ui'
import CopyText from '@/components/custom/CopyText.vue'
import { useBoolean } from '@/hooks'
import { fetchDictList } from '@/service'
import { getDictByNet } from '@/utils'
import { NButton, NFlex, NPopconfirm } from 'naive-ui'
import DictModal from './components/DictModal.vue'
import { fetchDictList } from '@/service'
import { useBoolean } from '@/hooks'
import { getDictByNet } from '@/utils'
import CopyText from '@/components/custom/CopyText.vue'
const { bool: dictLoading, setTrue: startDictLoading, setFalse: endDictLoading } = useBoolean(false)
const { bool: contentLoading, setTrue: startContentLoading, setFalse: endContentLoading } = useBoolean(false)

View File

@ -3,8 +3,8 @@ import type {
FormItemRule,
} from 'naive-ui'
import HelpInfo from '@/components/common/HelpInfo.vue'
import { useBoolean } from '@/hooks'
import { Regex } from '@/constants'
import { useBoolean } from '@/hooks'
import { fetchRoleList } from '@/service'
interface Props {

View File

@ -1,11 +1,11 @@
<script setup lang="tsx">
import type { DataTableColumns } from 'naive-ui'
import CopyText from '@/components/custom/CopyText.vue'
import { useBoolean } from '@/hooks'
import { fetchAllRoutes } from '@/service'
import { arrayToTree, createIcon } from '@/utils'
import { NButton, NPopconfirm, NSpace, NTag } from 'naive-ui'
import TableModal from './components/TableModal.vue'
import { fetchAllRoutes } from '@/service'
import { useBoolean } from '@/hooks'
import { arrayToTree, createIcon } from '@/utils'
import CopyText from '@/components/custom/CopyText.vue'
const { bool: loading, setTrue: startLoading, setFalse: endLoading } = useBoolean(false)