mirror of
https://github.com/zclzone/vue-naive-admin.git
synced 2025-04-30 22:29:01 +08:00
style: lint
This commit is contained in:
parent
2264512a8b
commit
520db7ec6e
@ -6,5 +6,5 @@
|
||||
* Copyright © 2023 Ronnie Zhang(大脸怪) | https://isme.top
|
||||
**********************************/
|
||||
|
||||
export { pluginPagePathes } from './page-pathes'
|
||||
export { pluginIcons } from './icons'
|
||||
export { pluginPagePathes } from './page-pathes'
|
||||
|
@ -29,10 +29,10 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { darkTheme, dateZhCN, zhCN } from 'naive-ui'
|
||||
import { layoutSettingVisible } from './settings'
|
||||
import { LayoutSetting } from '@/components'
|
||||
import { useAppStore, useTabStore } from '@/store'
|
||||
import { darkTheme, dateZhCN, zhCN } from 'naive-ui'
|
||||
import { layoutSettingVisible } from './settings'
|
||||
|
||||
const layouts = new Map()
|
||||
function getLayout(name) {
|
||||
|
@ -94,8 +94,8 @@
|
||||
|
||||
<script setup>
|
||||
import { MeModal } from '@/components'
|
||||
import { useAppStore } from '@/store'
|
||||
import { useModal } from '@/composables'
|
||||
import { useAppStore } from '@/store'
|
||||
|
||||
const appStore = useAppStore()
|
||||
const [modalRef] = useModal()
|
||||
|
@ -14,8 +14,8 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { getPresetColors } from '@arco-design/color'
|
||||
import { useAppStore } from '@/store'
|
||||
import { getPresetColors } from '@arco-design/color'
|
||||
|
||||
const appStore = useAppStore()
|
||||
|
||||
|
@ -7,8 +7,8 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { useDark, useToggle } from '@vueuse/core'
|
||||
import { useAppStore } from '@/store'
|
||||
import { useDark, useToggle } from '@vueuse/core'
|
||||
|
||||
const appStore = useAppStore()
|
||||
const isDark = useDark()
|
||||
|
@ -1,6 +1,6 @@
|
||||
export { default as AppCard } from './AppCard.vue'
|
||||
export { default as TheFooter } from './TheFooter.vue'
|
||||
export { default as AppPage } from './AppPage.vue'
|
||||
export { default as CommonPage } from './CommonPage.vue'
|
||||
export { default as LayoutSetting } from './LayoutSetting.vue'
|
||||
export { default as TheFooter } from './TheFooter.vue'
|
||||
export { default as ToggleTheme } from './ToggleTheme.vue'
|
||||
|
@ -1,3 +1,3 @@
|
||||
export { default as MeModal } from './modal/index.vue'
|
||||
export { default as MeCrud } from './crud/index.vue'
|
||||
export { default as MeQueryItem } from './crud/QueryItem.vue'
|
||||
export { default as MeModal } from './modal/index.vue'
|
||||
|
@ -1,4 +1,4 @@
|
||||
export * from './useAliveData'
|
||||
export * from './useCrud'
|
||||
export * from './useForm'
|
||||
export * from './useModal'
|
||||
export * from './useAliveData'
|
||||
|
@ -21,9 +21,9 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { useAuthStore, usePermissionStore, useUserStore } from '@/store'
|
||||
import { RoleSelect } from '@/layouts/components'
|
||||
import api from '@/api'
|
||||
import { RoleSelect } from '@/layouts/components'
|
||||
import { useAuthStore, usePermissionStore, useUserStore } from '@/store'
|
||||
|
||||
const router = useRouter()
|
||||
const userStore = useUserStore()
|
||||
|
@ -1,8 +1,8 @@
|
||||
export { default as RoleSelect } from './RoleSelect.vue'
|
||||
export { default as UserAvatar } from './UserAvatar.vue'
|
||||
export { default as MenuCollapse } from './MenuCollapse.vue'
|
||||
export { default as BreadCrumb } from './BreadCrumb.vue'
|
||||
export { default as AppTab } from './tab/index.vue'
|
||||
export { default as Fullscreen } from './Fullscreen.vue'
|
||||
export { default as MenuCollapse } from './MenuCollapse.vue'
|
||||
export { default as RoleSelect } from './RoleSelect.vue'
|
||||
export { default as SideLogo } from './SideLogo.vue'
|
||||
export { default as SideMenu } from './SideMenu.vue'
|
||||
export { default as Fullscreen } from './Fullscreen.vue'
|
||||
export { default as AppTab } from './tab/index.vue'
|
||||
export { default as UserAvatar } from './UserAvatar.vue'
|
||||
|
@ -36,8 +36,8 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import ContextMenu from './ContextMenu.vue'
|
||||
import { useTabStore } from '@/store'
|
||||
import ContextMenu from './ContextMenu.vue'
|
||||
|
||||
const router = useRouter()
|
||||
const tabStore = useTabStore()
|
||||
|
@ -27,10 +27,10 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import SideBar from './sidebar/index.vue'
|
||||
import AppHeader from './header/index.vue'
|
||||
import { useAppStore } from '@/store'
|
||||
import { AppTab } from '@/layouts/components'
|
||||
import { useAppStore } from '@/store'
|
||||
import AppHeader from './header/index.vue'
|
||||
import SideBar from './sidebar/index.vue'
|
||||
|
||||
const appStore = useAppStore()
|
||||
</script>
|
||||
|
@ -24,9 +24,9 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import SideBar from './sidebar/index.vue'
|
||||
import AppHeader from './header/index.vue'
|
||||
import { useAppStore } from '@/store'
|
||||
import AppHeader from './header/index.vue'
|
||||
import SideBar from './sidebar/index.vue'
|
||||
|
||||
const appStore = useAppStore()
|
||||
</script>
|
||||
|
@ -23,8 +23,8 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import SideBar from './sidebar/index.vue'
|
||||
import { useAppStore } from '@/store'
|
||||
import SideBar from './sidebar/index.vue'
|
||||
|
||||
const appStore = useAppStore()
|
||||
</script>
|
||||
|
10
src/main.js
10
src/main.js
@ -8,16 +8,16 @@
|
||||
* Copyright © 2023 Ronnie Zhang(大脸怪) | https://isme.top
|
||||
**********************************/
|
||||
|
||||
import 'uno.css'
|
||||
import '@/styles/reset.css'
|
||||
import '@/styles/global.scss'
|
||||
|
||||
import { createApp } from 'vue'
|
||||
import App from './App.vue'
|
||||
import { setupDirectives } from './directives'
|
||||
|
||||
import { setupRouter } from './router'
|
||||
import { setupStore } from './store'
|
||||
import { setupNaiveDiscreteApi } from './utils'
|
||||
import { setupDirectives } from './directives'
|
||||
import '@/styles/global.scss'
|
||||
import '@/styles/reset.css'
|
||||
import 'uno.css'
|
||||
|
||||
async function bootstrap() {
|
||||
const app = createApp(App)
|
||||
|
@ -6,8 +6,8 @@
|
||||
* Copyright © 2023 Ronnie Zhang(大脸怪) | https://isme.top
|
||||
**********************************/
|
||||
|
||||
import { useAuthStore, usePermissionStore, useUserStore } from '@/store'
|
||||
import api from '@/api'
|
||||
import { useAuthStore, usePermissionStore, useUserStore } from '@/store'
|
||||
import { getPermissions, getUserInfo } from '@/store/helper'
|
||||
|
||||
const WHITE_LIST = ['/login', '/404']
|
||||
|
@ -7,8 +7,8 @@
|
||||
**********************************/
|
||||
|
||||
import { createRouter, createWebHashHistory, createWebHistory } from 'vue-router'
|
||||
import { setupRouterGuards } from './guards'
|
||||
import { basicRoutes } from './basic-routes'
|
||||
import { setupRouterGuards } from './guards'
|
||||
|
||||
export const router = createRouter({
|
||||
history:
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { basePermissions } from '@/settings'
|
||||
import api from '@/api'
|
||||
import { basePermissions } from '@/settings'
|
||||
|
||||
export async function getUserInfo() {
|
||||
const res = await api.getUser()
|
||||
|
@ -6,10 +6,10 @@
|
||||
* Copyright © 2023 Ronnie Zhang(大脸怪) | https://isme.top
|
||||
**********************************/
|
||||
|
||||
import { defineStore } from 'pinia'
|
||||
import { useDark } from '@vueuse/core'
|
||||
import { generate, getRgbStr } from '@arco-design/color'
|
||||
import { defaultLayout, defaultPrimaryColor, naiveThemeOverrides } from '@/settings'
|
||||
import { generate, getRgbStr } from '@arco-design/color'
|
||||
import { useDark } from '@vueuse/core'
|
||||
import { defineStore } from 'pinia'
|
||||
|
||||
export const useAppStore = defineStore('app', {
|
||||
state: () => ({
|
||||
|
@ -6,8 +6,8 @@
|
||||
* Copyright © 2023 Ronnie Zhang(大脸怪) | https://isme.top
|
||||
**********************************/
|
||||
|
||||
import { defineStore } from 'pinia'
|
||||
import { usePermissionStore, useRouterStore, useTabStore, useUserStore } from '@/store'
|
||||
import { defineStore } from 'pinia'
|
||||
|
||||
export const useAuthStore = defineStore('auth', {
|
||||
state: () => ({
|
||||
|
@ -1,6 +1,6 @@
|
||||
export * from './app'
|
||||
export * from './auth'
|
||||
export * from './permission'
|
||||
export * from './router'
|
||||
export * from './tab'
|
||||
export * from './user'
|
||||
export * from './router'
|
||||
|
@ -6,9 +6,9 @@
|
||||
* Copyright © 2023 Ronnie Zhang(大脸怪) | https://isme.top
|
||||
**********************************/
|
||||
|
||||
import { isExternal } from '@/utils'
|
||||
import { hyphenate } from '@vueuse/core'
|
||||
import { defineStore } from 'pinia'
|
||||
import { isExternal } from '@/utils'
|
||||
|
||||
export const usePermissionStore = defineStore('permission', {
|
||||
state: () => ({
|
||||
|
@ -7,29 +7,10 @@
|
||||
* Copyright © 2023 Ronnie Zhang(大脸怪) | https://isme.top
|
||||
**********************************/
|
||||
|
||||
import { resolveResError } from './helpers'
|
||||
import { useAuthStore } from '@/store'
|
||||
import { resolveResError } from './helpers'
|
||||
|
||||
export function setupInterceptors(axiosInstance) {
|
||||
function reqResolve(config) {
|
||||
// 处理不需要token的请求
|
||||
if (config.needToken === false) {
|
||||
return config
|
||||
}
|
||||
|
||||
const { accessToken } = useAuthStore()
|
||||
if (accessToken) {
|
||||
// token: Bearer + xxx
|
||||
config.headers.Authorization = `Bearer ${accessToken}`
|
||||
}
|
||||
|
||||
return config
|
||||
}
|
||||
|
||||
function reqReject(error) {
|
||||
return Promise.reject(error)
|
||||
}
|
||||
|
||||
const SUCCESS_CODES = [0, 200]
|
||||
function resResolve(response) {
|
||||
const { data, status, config, statusText, headers } = response
|
||||
@ -49,6 +30,29 @@ export function setupInterceptors(axiosInstance) {
|
||||
return Promise.resolve(data ?? response)
|
||||
}
|
||||
|
||||
axiosInstance.interceptors.request.use(reqResolve, reqReject)
|
||||
axiosInstance.interceptors.response.use(resResolve, resReject)
|
||||
}
|
||||
|
||||
function reqResolve(config) {
|
||||
// 处理不需要token的请求
|
||||
if (config.needToken === false) {
|
||||
return config
|
||||
}
|
||||
|
||||
const { accessToken } = useAuthStore()
|
||||
if (accessToken) {
|
||||
// token: Bearer + xxx
|
||||
config.headers.Authorization = `Bearer ${accessToken}`
|
||||
}
|
||||
|
||||
return config
|
||||
}
|
||||
|
||||
function reqReject(error) {
|
||||
return Promise.reject(error)
|
||||
}
|
||||
|
||||
async function resReject(error) {
|
||||
if (!error || !error.response) {
|
||||
const code = error?.code
|
||||
@ -64,7 +68,3 @@ export function setupInterceptors(axiosInstance) {
|
||||
const message = resolveResError(code, data?.message ?? error.message, needTip)
|
||||
return Promise.reject({ code, message, error: error.response?.data || error.response })
|
||||
}
|
||||
|
||||
axiosInstance.interceptors.request.use(reqResolve, reqReject)
|
||||
axiosInstance.interceptors.response.use(resResolve, resReject)
|
||||
}
|
||||
|
@ -7,9 +7,9 @@
|
||||
* Copyright © 2023 Ronnie Zhang(大脸怪) | https://isme.top
|
||||
**********************************/
|
||||
|
||||
import * as NaiveUI from 'naive-ui'
|
||||
import { isNullOrUndef } from '@/utils'
|
||||
import { useAppStore } from '@/store'
|
||||
import { isNullOrUndef } from '@/utils'
|
||||
import * as NaiveUI from 'naive-ui'
|
||||
|
||||
export function setupMessage(NMessage) {
|
||||
class Message {
|
||||
|
@ -22,8 +22,8 @@
|
||||
|
||||
<script setup>
|
||||
import { MeModal } from '@/components'
|
||||
import { sleep } from '@/utils'
|
||||
import { useModal } from '@/composables'
|
||||
import { sleep } from '@/utils'
|
||||
|
||||
const text = ref('')
|
||||
const [$modal1, okLoading1] = useModal()
|
||||
|
@ -160,13 +160,13 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import * as echarts from 'echarts/core'
|
||||
import { GridComponent, LegendComponent, TooltipComponent } from 'echarts/components'
|
||||
import { useUserStore } from '@/store'
|
||||
import { BarChart, LineChart, PieChart } from 'echarts/charts'
|
||||
import { GridComponent, LegendComponent, TooltipComponent } from 'echarts/components'
|
||||
import * as echarts from 'echarts/core'
|
||||
import { UniversalTransition } from 'echarts/features'
|
||||
import { CanvasRenderer } from 'echarts/renderers'
|
||||
import VChart from 'vue-echarts'
|
||||
import { useUserStore } from '@/store'
|
||||
|
||||
const userStore = useUserStore()
|
||||
|
||||
|
@ -101,10 +101,10 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { useAuthStore } from '@/store'
|
||||
import { lStorage, throttle } from '@/utils'
|
||||
import { useStorage } from '@vueuse/core'
|
||||
import api from './api'
|
||||
import { lStorage, throttle } from '@/utils'
|
||||
import { useAuthStore } from '@/store'
|
||||
|
||||
const authStore = useAuthStore()
|
||||
const router = useRouter()
|
||||
|
@ -6,8 +6,8 @@
|
||||
* Copyright © 2023 Ronnie Zhang(大脸怪) | https://isme.top
|
||||
**********************************/
|
||||
|
||||
import axios from 'axios'
|
||||
import { request } from '@/utils'
|
||||
import axios from 'axios'
|
||||
|
||||
export default {
|
||||
getMenuTree: () => request.get('/permission/menu/tree'),
|
||||
|
@ -38,8 +38,8 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { withModifiers } from 'vue'
|
||||
import { NButton } from 'naive-ui'
|
||||
import { withModifiers } from 'vue'
|
||||
import api from '../api'
|
||||
import ResAddOrEdit from './ResAddOrEdit.vue'
|
||||
|
||||
|
@ -159,12 +159,12 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import pagePathes from 'isme:page-pathes'
|
||||
import icons from 'isme:icons'
|
||||
import api from '../api'
|
||||
import QuestionLabel from './QuestionLabel.vue'
|
||||
import { MeModal } from '@/components'
|
||||
import { useForm, useModal } from '@/composables'
|
||||
import icons from 'isme:icons'
|
||||
import pagePathes from 'isme:page-pathes'
|
||||
import api from '../api'
|
||||
import QuestionLabel from './QuestionLabel.vue'
|
||||
|
||||
const props = defineProps({
|
||||
menus: {
|
||||
|
@ -11,7 +11,7 @@
|
||||
<div class="flex">
|
||||
<n-spin size="small" :show="treeLoading">
|
||||
<MenuTree
|
||||
v-model:currentMenu="currentMenu"
|
||||
v-model:current-menu="currentMenu"
|
||||
class="w-320 shrink-0"
|
||||
:tree-data="treeData"
|
||||
@refresh="initData"
|
||||
@ -92,11 +92,11 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { MeCrud } from '@/components'
|
||||
import { NButton, NSwitch } from 'naive-ui'
|
||||
import api from './api'
|
||||
import MenuTree from './components/MenuTree.vue'
|
||||
import ResAddOrEdit from './components/ResAddOrEdit.vue'
|
||||
import api from './api'
|
||||
import { MeCrud } from '@/components'
|
||||
|
||||
const treeData = ref([])
|
||||
const treeLoading = ref(false)
|
||||
|
@ -95,10 +95,10 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { NButton, NSwitch } from 'naive-ui'
|
||||
import api from './api'
|
||||
import { MeCrud, MeModal, MeQueryItem } from '@/components'
|
||||
import { useCrud } from '@/composables'
|
||||
import { NButton, NSwitch } from 'naive-ui'
|
||||
import api from './api'
|
||||
|
||||
defineOptions({ name: 'RoleMgt' })
|
||||
|
||||
|
@ -67,11 +67,11 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { MeCrud, MeQueryItem } from '@/components'
|
||||
import { formatDateTime } from '@/utils'
|
||||
import { NAvatar, NButton, NSwitch, NTag } from 'naive-ui'
|
||||
import { h } from 'vue'
|
||||
import api from './api'
|
||||
import { MeCrud, MeQueryItem } from '@/components'
|
||||
import { formatDateTime } from '@/utils'
|
||||
|
||||
defineOptions({ name: 'RoleUser' })
|
||||
const route = useRoute()
|
||||
|
@ -110,11 +110,11 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { NAvatar, NButton, NSwitch, NTag } from 'naive-ui'
|
||||
import api from './api'
|
||||
import { formatDateTime } from '@/utils'
|
||||
import { MeCrud, MeModal, MeQueryItem } from '@/components'
|
||||
import { useCrud } from '@/composables'
|
||||
import { formatDateTime } from '@/utils'
|
||||
import { NAvatar, NButton, NSwitch, NTag } from 'naive-ui'
|
||||
import api from './api'
|
||||
|
||||
defineOptions({ name: 'UserMgt' })
|
||||
|
||||
|
@ -105,11 +105,11 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import api from './api'
|
||||
import { MeModal } from '@/components'
|
||||
import { useForm, useModal } from '@/composables'
|
||||
import { useUserStore } from '@/store'
|
||||
import { getUserInfo } from '@/store/helper'
|
||||
import api from './api'
|
||||
|
||||
const userStore = useUserStore()
|
||||
const required = {
|
||||
|
@ -6,9 +6,9 @@
|
||||
* Copyright © 2023 Ronnie Zhang(大脸怪) | https://isme.top
|
||||
**********************************/
|
||||
|
||||
import { defineConfig, presetAttributify, presetIcons, presetUno } from 'unocss'
|
||||
import presetRemToPx from '@unocss/preset-rem-to-px'
|
||||
import { FileSystemIconLoader } from '@iconify/utils/lib/loader/node-loaders'
|
||||
import presetRemToPx from '@unocss/preset-rem-to-px'
|
||||
import { defineConfig, presetAttributify, presetIcons, presetUno } from 'unocss'
|
||||
import { getIcons } from './build/index.js'
|
||||
|
||||
const icons = getIcons()
|
||||
|
@ -7,15 +7,15 @@
|
||||
**********************************/
|
||||
|
||||
import path from 'node:path'
|
||||
import { defineConfig, loadEnv } from 'vite'
|
||||
import Vue from '@vitejs/plugin-vue'
|
||||
import VueDevTools from 'vite-plugin-vue-devtools'
|
||||
import VueJsx from '@vitejs/plugin-vue-jsx'
|
||||
import Unocss from 'unocss/vite'
|
||||
import AutoImport from 'unplugin-auto-import/vite'
|
||||
import Components from 'unplugin-vue-components/vite'
|
||||
import { NaiveUiResolver } from 'unplugin-vue-components/resolvers'
|
||||
import Components from 'unplugin-vue-components/vite'
|
||||
import { defineConfig, loadEnv } from 'vite'
|
||||
import removeNoMatch from 'vite-plugin-router-warn'
|
||||
import VueJsx from '@vitejs/plugin-vue-jsx'
|
||||
import VueDevTools from 'vite-plugin-vue-devtools'
|
||||
import { pluginIcons, pluginPagePathes } from './build/plugin-isme'
|
||||
|
||||
export default defineConfig(({ mode }) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user