refactor: 更换 ESLint 配置为 @antfu/eslint-config

This commit is contained in:
2024-05-10 22:29:45 +08:00
parent 5101dd12d9
commit bfc8e42bad
148 changed files with 7314 additions and 5046 deletions

View File

@@ -1,7 +1,7 @@
import { defineStore } from 'pinia'
import { listOptionDict, type BasicConfigResp } from '@/apis'
import { computed, reactive, toRefs } from 'vue'
import { generate, getRgbStr } from '@arco-design/color'
import { type BasicConfigResp, listOptionDict } from '@/apis'
import defaultSettings from '@/config/setting.json'
const storeSetup = () => {
@@ -20,6 +20,17 @@ const storeSetup = () => {
return obj
})
// 设置主题色
const setThemeColor = (color: string) => {
if (!color) return
settingConfig.themeColor = color
const list = generate(settingConfig.themeColor, { list: true, dark: settingConfig.theme === 'dark' })
list.forEach((color: string, index: number) => {
const rgbStr = getRgbStr(color)
document.body.style.setProperty(`--primary-${index + 1}`, rgbStr)
})
}
// 切换主题 暗黑模式|简白模式
const toggleTheme = (dark: boolean) => {
if (dark) {
@@ -32,17 +43,6 @@ const storeSetup = () => {
setThemeColor(settingConfig.themeColor)
}
// 设置主题色
const setThemeColor = (color: string) => {
if (!color) return
settingConfig.themeColor = color
const list = generate(settingConfig.themeColor, { list: true, dark: settingConfig.theme === 'dark' })
list.forEach((color: string, index: number) => {
const rgbStr = getRgbStr(color)
document.body.style.setProperty(`--primary-${index + 1}`, rgbStr)
})
}
// 初始化主题
const initTheme = () => {
if (!settingConfig.themeColor) return

View File

@@ -1,11 +1,11 @@
import { ref } from 'vue'
import { defineStore } from 'pinia'
import type { RouteRecordRaw } from 'vue-router'
import { constantRoutes } from '@/router'
import ParentView from '@/components/ParentView/index.vue'
import { getUserRoute, type RouteItem } from '@/apis'
import { mapTree, toTreeArray } from 'xe-utils'
import { cloneDeep, omit } from 'lodash-es'
import { constantRoutes } from '@/router'
import ParentView from '@/components/ParentView/index.vue'
import { type RouteItem, getUserRoute } from '@/apis'
import { transformPathToName } from '@/utils'
const Layout = () => import('@/layout/index.vue')
@@ -58,7 +58,7 @@ const formatAsyncRoutes = (menus: RouteItem[]) => {
title: item.title,
hidden: item.isHidden,
keepAlive: item.isCache,
alwaysShow: item.type == 1,
alwaysShow: item.type === 1,
icon: item.icon
}
}

View File

@@ -1,9 +1,9 @@
import { defineStore } from 'pinia'
import { ref } from 'vue'
import router from '@/router'
import type { RouteRecordRaw, RouteRecordName } from 'vue-router'
import { useRouteStore } from '@/stores'
import type { RouteRecordName, RouteRecordRaw } from 'vue-router'
import _XEUtils_ from 'xe-utils'
import router from '@/router'
import { useRouteStore } from '@/stores'
const storeSetup = () => {
const tagList = ref<RouteRecordRaw[]>([]) // 保存页签tab的数组

View File

@@ -1,19 +1,19 @@
import { defineStore } from 'pinia'
import { ref, reactive, computed } from 'vue'
import { computed, reactive, ref } from 'vue'
import { resetRouter } from '@/router'
import {
accountLogin as accountLoginApi,
phoneLogin as phoneLoginApi,
emailLogin as emailLoginApi,
socialLogin as socialLoginApi,
logout as logoutApi,
getUserInfo as getUserInfoApi,
type AccountLoginReq,
type PhoneLoginReq,
type EmailLoginReq,
type UserInfo
type PhoneLoginReq,
type UserInfo,
accountLogin as accountLoginApi,
emailLogin as emailLoginApi,
getUserInfo as getUserInfoApi,
logout as logoutApi,
phoneLogin as phoneLoginApi,
socialLogin as socialLoginApi
} from '@/apis'
import { setToken, clearToken, getToken } from '@/utils/auth'
import { clearToken, getToken, setToken } from '@/utils/auth'
import { resetHasRouteFlag } from '@/router/permission'
import getAvatar from '@/utils/avatar'
@@ -76,6 +76,15 @@ const storeSetup = () => {
token.value = res.data.token
}
// 退出登录回调
const logoutCallBack = async () => {
roles.value = []
permissions.value = []
pwdExpiredShow.value = true
resetToken()
resetRouter()
}
// 退出登录
const logout = async () => {
try {
@@ -87,15 +96,6 @@ const storeSetup = () => {
}
}
// 退出登录回调
const logoutCallBack = async () => {
roles.value = []
permissions.value = []
pwdExpiredShow.value = true
resetToken()
resetRouter()
}
// 获取用户信息
const getInfo = async () => {
const res = await getUserInfoApi()