diff --git a/src/api/github.js b/src/api/github.js deleted file mode 100644 index 38e1067..0000000 --- a/src/api/github.js +++ /dev/null @@ -1,19 +0,0 @@ -import axios from 'axios' - -const service = axios.create() - -export function Commits(page) { - return service({ - url: - 'https://api.github.com/repos/flipped-aurora/gin-vue-admin/commits?page=' + - page, - method: 'get' - }) -} - -export function Members() { - return service({ - url: 'https://api.github.com/orgs/FLIPPED-AURORA/members', - method: 'get' - }) -} diff --git a/src/api/initdb.js b/src/api/initdb.js deleted file mode 100644 index f1eb2f4..0000000 --- a/src/api/initdb.js +++ /dev/null @@ -1,27 +0,0 @@ -import service from '@/utils/request' -// @Tags InitDB -// @Summary 初始化用户数据库 -// @Produce application/json -// @Param data body request.InitDB true "初始化数据库参数" -// @Success 200 {string} string "{"code":0,"data":{},"msg":"自动创建数据库成功"}" -// @Router /init/initdb [post] -export const initDB = (data) => { - return service({ - url: '/init/initdb', - method: 'post', - data, - donNotShowLoading: true - }) -} - -// @Tags CheckDB -// @Summary 初始化用户数据库 -// @Produce application/json -// @Success 200 {string} string "{"code":0,"data":{},"msg":"探测完成"}" -// @Router /init/checkdb [post] -export const checkDB = () => { - return service({ - url: '/init/checkdb', - method: 'post' - }) -} diff --git a/src/api/system.js b/src/api/system.js deleted file mode 100644 index ff41abf..0000000 --- a/src/api/system.js +++ /dev/null @@ -1,55 +0,0 @@ -import service from '@/utils/request' -// @Tags systrm -// @Summary 获取配置文件内容 -// @Security ApiKeyAuth -// @Produce application/json -// @Success 200 {string} string "{"success":true,"data":{},"msg":"返回成功"}" -// @Router /system/getSystemConfig [post] -export const getSystemConfig = () => { - return service({ - url: '/system/getSystemConfig', - method: 'post' - }) -} - -// @Tags system -// @Summary 设置配置文件内容 -// @Security ApiKeyAuth -// @Produce application/json -// @Param data body sysModel.System true -// @Success 200 {string} string "{"success":true,"data":{},"msg":"返回成功"}" -// @Router /system/setSystemConfig [post] -export const setSystemConfig = (data) => { - return service({ - url: '/system/setSystemConfig', - method: 'post', - data - }) -} - -// @Tags system -// @Summary 获取服务器运行状态 -// @Security ApiKeyAuth -// @Produce application/json -// @Success 200 {string} string "{"success":true,"data":{},"msg":"返回成功"}" -// @Router /system/getServerInfo [post] -export const getSystemState = () => { - return service({ - url: '/system/getServerInfo', - method: 'post', - donNotShowLoading: true - }) -} - -/** - * 重载服务 - * @param data - * @returns {*} - */ -export const reloadSystem = (data) => { - return service({ - url: '/system/reloadSystem', - method: 'post', - data - }) -} diff --git a/src/router/index.js b/src/router/index.js index 12940e2..d5203b2 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -15,31 +15,13 @@ const routes = [ name: 'Login', component: () => import('@/view/login/index.vue') }, - // { - // path: '/largeScreen', - // name: 'LargeScreen', - // meta: { - // title: '智能用电云平台', - // client: true, - // defaultMenu: true - // }, - // component: () => import('@/view/largeScreen/index.vue') - // }, - // { - // path: '/largeScreen2', - // name: 'largeScreen2', - // meta: { - // title: 'largeScreen2', - // }, - // component: () => import('@/view/largeScreen2/index.vue') - // }, { path: '/:catchAll(.*)', meta: { closeTab: true }, component: () => import('@/view/error/index.vue') - }, + } ] const router = createRouter({ diff --git a/src/utils/btnAuth.js b/src/utils/btnAuth.js deleted file mode 100644 index f94fa9b..0000000 --- a/src/utils/btnAuth.js +++ /dev/null @@ -1,6 +0,0 @@ -import { useRoute } from 'vue-router' -import { reactive } from 'vue' -export const useBtnAuth = () => { - const route = useRoute() - return route.meta.btns || reactive({}) -} diff --git a/src/utils/closeThisPage.js b/src/utils/closeThisPage.js deleted file mode 100644 index b2a0c05..0000000 --- a/src/utils/closeThisPage.js +++ /dev/null @@ -1,5 +0,0 @@ -import { emitter } from '@/utils/bus.js' - -export const closeThisPage = () => { - emitter.emit('closeThisPage') -} diff --git a/src/utils/date.js b/src/utils/date.js deleted file mode 100644 index 987a40d..0000000 --- a/src/utils/date.js +++ /dev/null @@ -1,44 +0,0 @@ -// 对Date的扩展,将 Date 转化为指定格式的String -// 月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符, -// 年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字) -// (new Date()).Format("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423 -// (new Date()).Format("yyyy-M-d h:m:s.S") ==> 2006-7-2 8:9:4.18 -// eslint-disable-next-line no-extend-native -Date.prototype.Format = function(fmt) { - const o = { - 'M+': this.getMonth() + 1, // 月份 - 'd+': this.getDate(), // 日 - 'h+': this.getHours(), // 小时 - 'm+': this.getMinutes(), // 分 - 's+': this.getSeconds(), // 秒 - 'q+': Math.floor((this.getMonth() + 3) / 3), // 季度 - 'S': this.getMilliseconds() // 毫秒 - } - const reg = /(y+)/ - if (reg.test(fmt)) { - const t = reg.exec(fmt)[1] - fmt = fmt.replace( - t, - (this.getFullYear() + '').substring(4 - t.length) - ) - } - for (let k in o) { - const regx = new RegExp('(' + k + ')') - if (regx.test(fmt)) { - const t = regx.exec(fmt)[1] - fmt = fmt.replace( - t, - t.length === 1 ? o[k] : ('00' + o[k]).substring(('' + o[k]).length) - ) - } - } - return fmt -} - -export function formatTimeToStr(times, pattern) { - let d = new Date(times).Format('yyyy-MM-dd hh:mm:ss') - if (pattern) { - d = new Date(times).Format(pattern) - } - return d.toLocaleString() -} diff --git a/src/utils/dictionary.js b/src/utils/dictionary.js index c67bb82..43e9104 100644 --- a/src/utils/dictionary.js +++ b/src/utils/dictionary.js @@ -74,12 +74,7 @@ export const getDict = async ( } // 字典文字展示方法 -export const showDictLabel = ( - dict, - code, - keyCode = 'value', - valueCode = 'label' -) => { +export const showDictLabel = (dict, code, keyCode = 'value', valueCode = 'label') => { if (!dict) { return '' } diff --git a/src/utils/downloadImg.js b/src/utils/downloadImg.js deleted file mode 100644 index 10506c7..0000000 --- a/src/utils/downloadImg.js +++ /dev/null @@ -1,20 +0,0 @@ -export const downloadImage = (imgsrc, name) => { - // 下载图片地址和图片名 - var image = new Image() - image.setAttribute('crossOrigin', 'anonymous') - image.onload = function () { - var canvas = document.createElement('canvas') - canvas.width = image.width - canvas.height = image.height - var context = canvas.getContext('2d') - context.drawImage(image, 0, 0, image.width, image.height) - var url = canvas.toDataURL('image/png') // 得到图片的base64编码数据 - - var a = document.createElement('a') // 生成一个a元素 - var event = new MouseEvent('click') // 创建一个单击事件 - a.download = name || 'photo' // 设置图片名称 - a.href = url // 将生成的URL设置为a.href属性 - a.dispatchEvent(event) // 触发a的单击事件 - } - image.src = imgsrc -} diff --git a/src/utils/format.js b/src/utils/format.js index dc5cf07..78b84e0 100644 --- a/src/utils/format.js +++ b/src/utils/format.js @@ -1,4 +1,3 @@ -import { formatTimeToStr } from '@/utils/date' import { getDict } from '@/utils/dictionary' import { ref } from 'vue' @@ -9,34 +8,26 @@ export const formatBoolean = (bool) => { return '' } } -export const formatDate = (time) => { - if (time !== null && time !== '') { - var date = new Date(time) - return formatTimeToStr(date, 'yyyy-MM-dd hh:mm:ss') - } else { - return '' - } -} export const filterDict = (value, options) => { // 递归查找函数 const findInOptions = (opts, targetValue) => { if (!opts || !Array.isArray(opts)) return null - + for (const item of opts) { if (item.value === targetValue) { return item } - + if (item.children && Array.isArray(item.children)) { const found = findInOptions(item.children, targetValue) if (found) return found } } - + return null } - + const rowLabel = findInOptions(options, value) return rowLabel && rowLabel.label } @@ -45,30 +36,30 @@ export const filterDataSource = (dataSource, value) => { // 递归查找函数 const findInDataSource = (data, targetValue) => { if (!data || !Array.isArray(data)) return null - + for (const item of data) { // 检查当前项是否匹配 if (item.value === targetValue) { return item } - + // 如果有children属性,递归查找 if (item.children && Array.isArray(item.children)) { const found = findInDataSource(item.children, targetValue) if (found) return found } } - + return null } - + if (Array.isArray(value)) { return value.map((item) => { const rowLabel = findInDataSource(dataSource, item) return rowLabel?.label }) } - + const rowLabel = findInDataSource(dataSource, value) return rowLabel?.label } @@ -78,8 +69,7 @@ export const getDictFunc = async (type) => { return dicts } -const path = - import.meta.env.VITE_BASE_PATH + ':' + import.meta.env.VITE_SERVER_PORT + '/' +const path = import.meta.env.VITE_BASE_PATH + ':' + import.meta.env.VITE_SERVER_PORT + '/' export const ReturnArrImg = (arr) => { const imgArr = [] if (arr instanceof Array) { @@ -144,10 +134,7 @@ export const setBodyPrimaryColor = (primaryColor, darkMode) => { } document.documentElement.style.setProperty('--el-color-primary', primaryColor) - document.documentElement.style.setProperty( - '--el-color-primary-bg', - addOpacityToColor(primaryColor, 0.4) - ) + document.documentElement.style.setProperty('--el-color-primary-bg', addOpacityToColor(primaryColor, 0.4)) for (let times = 1; times <= 2; times++) { document.documentElement.style.setProperty( `--el-color-primary-dark-${times}`, @@ -160,10 +147,7 @@ export const setBodyPrimaryColor = (primaryColor, darkMode) => { fmtColorFunc(primaryColor, times / 10) ) } - document.documentElement.style.setProperty( - `--el-menu-hover-bg-color`, - addOpacityToColor(primaryColor, 0.2) - ) + document.documentElement.style.setProperty(`--el-menu-hover-bg-color`, addOpacityToColor(primaryColor, 0.2)) } const baseUrl = ref(import.meta.env.VITE_BASE_API) @@ -178,7 +162,7 @@ export const CreateUUID = () => { d += performance.now() } return '00000000-0000-0000-0000-000000000000'.replace(/0/g, (c) => { - const r = (d + Math.random() * 16) % 16 | 0 // d是随机种子 + const r = ((d + Math.random() * 16) % 16) | 0 // d是随机种子 d = Math.floor(d / 16) return (c === '0' ? r : (r & 0x3) | 0x8).toString(16) }) diff --git a/src/utils/params.js b/src/utils/params.js deleted file mode 100644 index b03d539..0000000 --- a/src/utils/params.js +++ /dev/null @@ -1,14 +0,0 @@ -import { useParamsStore } from '@/pinia/modules/params' -/* - * 获取参数方法 使用示例 getParams('key').then(res) 或者 async函数下 const res = await getParams('key') - * const res = ref('') - * const fun = async () => { - * res.value = await getParams('test') - * } - * fun() - */ -export const getParams = async(key) => { - const paramsStore = useParamsStore() - await paramsStore.getParams(key) - return paramsStore.paramsMap[key] -} diff --git a/src/view/error/index.vue b/src/view/error/index.vue index ec91562..f058a27 100644 --- a/src/view/error/index.vue +++ b/src/view/error/index.vue @@ -4,17 +4,7 @@

页面被神秘力量吸走了

-

- 常见问题为当前此角色无当前路由,如果确定要使用本路由,请到角色管理进行分配 -

-

- 项目地址:https://github.com/flipped-aurora/gin-vue-admin -

+

常见问题为当前此角色无当前路由,如果确定要使用本路由,请到角色管理进行分配

返回首页
@@ -36,9 +26,9 @@ try { router.push({ name: userStore.userInfo.authority.defaultRouter }) } catch (error) { - emitter.emit('show-error', { + emitter.emit('show-error', { code: '401', - message: "检测到其他用户修改了路由权限,请重新登录", + message: '检测到其他用户修改了路由权限,请重新登录', fn: () => { userStore.ClearStorage() router.push({ name: 'Login', replace: true }) diff --git a/src/view/init/index.vue b/src/view/init/index.vue deleted file mode 100644 index 623c5e2..0000000 --- a/src/view/init/index.vue +++ /dev/null @@ -1,334 +0,0 @@ - - - - - diff --git a/src/view/layout/tabs/index.vue b/src/view/layout/tabs/index.vue index 6a6ad8a..22b2be6 100644 --- a/src/view/layout/tabs/index.vue +++ b/src/view/layout/tabs/index.vue @@ -283,10 +283,6 @@ ) const initPage = () => { - // 全局监听 关闭当前页面函数 - emitter.on('closeThisPage', () => { - removeTab(getFmtString(route)) - }) // 全局监听 关闭所有页面函数 emitter.on('closeAllPage', () => { closeAll() diff --git a/src/view/login/index.vue b/src/view/login/index.vue index 9fc83fb..f2477ad 100644 --- a/src/view/login/index.vue +++ b/src/view/login/index.vue @@ -56,15 +56,6 @@ >登 录 - @@ -73,13 +64,11 @@ banner -