格式化代码
This commit is contained in:
parent
6061592084
commit
9193a609e9
@ -1,5 +1,5 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
// 一行最多 180 字符
|
// 超过最大值换行
|
||||||
printWidth: 148,
|
printWidth: 148,
|
||||||
// 使用 2 个空格缩进
|
// 使用 2 个空格缩进
|
||||||
tabWidth: 2,
|
tabWidth: 2,
|
||||||
@ -13,14 +13,14 @@ module.exports = {
|
|||||||
quoteProps: 'as-needed',
|
quoteProps: 'as-needed',
|
||||||
// jsx 不使用单引号,而使用双引号
|
// jsx 不使用单引号,而使用双引号
|
||||||
jsxSingleQuote: false,
|
jsxSingleQuote: false,
|
||||||
// 末尾不需要逗号
|
// 多行时尽可能打印尾随逗号。(例如,单行数组永远不会出现逗号结尾。) 可选值"<none|es5|all>",默认none
|
||||||
trailingComma: 'all',
|
trailingComma: 'none',
|
||||||
// 大括号内的首尾需要空格
|
// 在对象,数组括号与文字之间加空格 "{ foo: bar }"
|
||||||
bracketSpacing: true,
|
bracketSpacing: true,
|
||||||
// jsx 标签的反尖括号需要换行
|
// jsx 标签的反尖括号需要换行
|
||||||
jsxBracketSameLine: true,
|
jsxBracketSameLine: true,
|
||||||
bracketSameLine: true,
|
bracketSameLine: true,
|
||||||
// 箭头函数,只有一个参数的时候,也需要括号
|
// 箭头函数,always只有一个参数的时候,也需要括号,'avoid'箭头函数只有一个参数的时候可以忽略括号
|
||||||
arrowParens: 'always',
|
arrowParens: 'always',
|
||||||
// 每个文件格式化的范围是文件的全部内容
|
// 每个文件格式化的范围是文件的全部内容
|
||||||
rangeStart: 0,
|
rangeStart: 0,
|
||||||
@ -33,6 +33,6 @@ module.exports = {
|
|||||||
proseWrap: 'preserve',
|
proseWrap: 'preserve',
|
||||||
// 根据显示样式决定 html 要不要折行
|
// 根据显示样式决定 html 要不要折行
|
||||||
htmlWhitespaceSensitivity: 'css',
|
htmlWhitespaceSensitivity: 'css',
|
||||||
// 换行符使用 lf
|
// 换行符使用 lf 结尾是 可选值"<auto|lf|crlf|cr>"
|
||||||
endOfLine: 'auto',
|
endOfLine: 'auto'
|
||||||
};
|
}
|
||||||
|
|||||||
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@ -19,6 +19,9 @@
|
|||||||
"[ts]": {
|
"[ts]": {
|
||||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||||
},
|
},
|
||||||
|
"[js]": {
|
||||||
|
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||||
|
},
|
||||||
// 保存时 prettier 自动格式化
|
// 保存时 prettier 自动格式化
|
||||||
"editor.formatOnSave": true,
|
"editor.formatOnSave": true,
|
||||||
// 保存时自动启用 eslint --fix 自动修复
|
// 保存时自动启用 eslint --fix 自动修复
|
||||||
|
|||||||
@ -1,78 +1,5 @@
|
|||||||
import Cookies from 'js-cookie'
|
import Cookies from 'js-cookie'
|
||||||
|
|
||||||
// const state = {
|
|
||||||
// sidebar: {
|
|
||||||
// opened: Cookies.get('sidebarStatus') ? !!+Cookies.get('sidebarStatus') : true,
|
|
||||||
// withoutAnimation: false,
|
|
||||||
// hide: false
|
|
||||||
// },
|
|
||||||
// device: 'desktop',
|
|
||||||
// size: Cookies.get('size') || 'small',
|
|
||||||
// lang: Cookies.get('lang') || 'zh-cn'
|
|
||||||
// }
|
|
||||||
|
|
||||||
// const mutations = {
|
|
||||||
// TOGGLE_SIDEBAR: state => {
|
|
||||||
// if (state.sidebar.hide) {
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// state.sidebar.opened = !state.sidebar.opened
|
|
||||||
// state.sidebar.withoutAnimation = true
|
|
||||||
|
|
||||||
// if (state.sidebar.opened) {
|
|
||||||
// Cookies.set('sidebarStatus', 1)
|
|
||||||
// } else {
|
|
||||||
// Cookies.set('sidebarStatus', 0)
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// CLOSE_SIDEBAR: (state, withoutAnimation) => {
|
|
||||||
// Cookies.set('sidebarStatus', 0)
|
|
||||||
// state.sidebar.opened = false
|
|
||||||
// state.sidebar.withoutAnimation = withoutAnimation
|
|
||||||
// },
|
|
||||||
// TOGGLE_DEVICE: (state, device) => {
|
|
||||||
// state.device = device
|
|
||||||
// },
|
|
||||||
// SET_SIZE: (state, size) => {
|
|
||||||
// state.size = size
|
|
||||||
// Cookies.set('size', size)
|
|
||||||
// },
|
|
||||||
// SET_SIDEBAR_HIDE: (state, status) => {
|
|
||||||
// state.sidebar.hide = status
|
|
||||||
// },
|
|
||||||
// SET_LANG: (state, lang) => {
|
|
||||||
// state.lang = lang
|
|
||||||
// Cookies.set('lang', lang)
|
|
||||||
// },
|
|
||||||
// }
|
|
||||||
|
|
||||||
// const actions = {
|
|
||||||
// toggleSideBar({ commit }) {
|
|
||||||
// commit('TOGGLE_SIDEBAR')
|
|
||||||
// },
|
|
||||||
// closeSideBar({ commit }) {
|
|
||||||
// commit('CLOSE_SIDEBAR', '')
|
|
||||||
// },
|
|
||||||
// toggleDevice({ commit }, device) {
|
|
||||||
// commit('TOGGLE_DEVICE', device)
|
|
||||||
// },
|
|
||||||
// setSize({ commit }, size) {
|
|
||||||
// commit('SET_SIZE', size)
|
|
||||||
// },
|
|
||||||
// toggleSideBarHide({ commit }, status) {
|
|
||||||
// commit('SET_SIDEBAR_HIDE', status)
|
|
||||||
// },
|
|
||||||
// setLang({ commit }, lang) {
|
|
||||||
// commit('SET_LANG', lang)
|
|
||||||
// },
|
|
||||||
// }
|
|
||||||
|
|
||||||
// export default {
|
|
||||||
// namespaced: true,
|
|
||||||
// state,
|
|
||||||
// mutations,
|
|
||||||
// actions
|
|
||||||
// }
|
|
||||||
const useAppStore = defineStore('app', {
|
const useAppStore = defineStore('app', {
|
||||||
state: () => ({
|
state: () => ({
|
||||||
sidebar: {
|
sidebar: {
|
||||||
@ -106,7 +33,7 @@ const useAppStore = defineStore('app', {
|
|||||||
this.device = device
|
this.device = device
|
||||||
},
|
},
|
||||||
setSize(size) {
|
setSize(size) {
|
||||||
this.size = size;
|
this.size = size
|
||||||
Cookies.set('size', size)
|
Cookies.set('size', size)
|
||||||
},
|
},
|
||||||
toggleSideBarHide(status) {
|
toggleSideBarHide(status) {
|
||||||
|
|||||||
@ -5,8 +5,7 @@ import ParentView from '@/components/ParentView'
|
|||||||
import InnerLink from '@/layout/components/InnerLink'
|
import InnerLink from '@/layout/components/InnerLink'
|
||||||
|
|
||||||
// 匹配views里面所有的.vue文件
|
// 匹配views里面所有的.vue文件
|
||||||
const modules =
|
const modules = import.meta.glob('./../../views/**/*.vue')
|
||||||
import.meta.glob('./../../views/**/*.vue')
|
|
||||||
|
|
||||||
const usePermissionStore = defineStore('permission', {
|
const usePermissionStore = defineStore('permission', {
|
||||||
state: () => ({
|
state: () => ({
|
||||||
@ -31,9 +30,9 @@ const usePermissionStore = defineStore('permission', {
|
|||||||
},
|
},
|
||||||
// 生成路由
|
// 生成路由
|
||||||
generateRoutes() {
|
generateRoutes() {
|
||||||
return new Promise(resolve => {
|
return new Promise((resolve) => {
|
||||||
// 向后端请求路由数据
|
// 向后端请求路由数据
|
||||||
getRouters().then(res => {
|
getRouters().then((res) => {
|
||||||
const sdata = JSON.parse(JSON.stringify(res.data))
|
const sdata = JSON.parse(JSON.stringify(res.data))
|
||||||
const rdata = JSON.parse(JSON.stringify(res.data))
|
const rdata = JSON.parse(JSON.stringify(res.data))
|
||||||
const defaultData = JSON.parse(JSON.stringify(res.data))
|
const defaultData = JSON.parse(JSON.stringify(res.data))
|
||||||
@ -53,7 +52,7 @@ const usePermissionStore = defineStore('permission', {
|
|||||||
|
|
||||||
// 遍历后台传来的路由字符串,转换为组件对象
|
// 遍历后台传来的路由字符串,转换为组件对象
|
||||||
function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false) {
|
function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false) {
|
||||||
return asyncRouterMap.filter(route => {
|
return asyncRouterMap.filter((route) => {
|
||||||
if (type && route.children) {
|
if (type && route.children) {
|
||||||
route.children = filterChildren(route.children)
|
route.children = filterChildren(route.children)
|
||||||
}
|
}
|
||||||
@ -84,7 +83,7 @@ function filterChildren(childrenMap, lastRouter = false) {
|
|||||||
childrenMap.forEach((el, index) => {
|
childrenMap.forEach((el, index) => {
|
||||||
if (el.children && el.children.length) {
|
if (el.children && el.children.length) {
|
||||||
if (el.component === 'ParentView' && !lastRouter) {
|
if (el.component === 'ParentView' && !lastRouter) {
|
||||||
el.children.forEach(c => {
|
el.children.forEach((c) => {
|
||||||
c.path = el.path + '/' + c.path
|
c.path = el.path + '/' + c.path
|
||||||
if (c.children && c.children.length) {
|
if (c.children && c.children.length) {
|
||||||
children = children.concat(filterChildren(c.children, c))
|
children = children.concat(filterChildren(c.children, c))
|
||||||
@ -104,14 +103,14 @@ function filterChildren(childrenMap, lastRouter = false) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const loadView = (view) => {
|
export const loadView = (view) => {
|
||||||
let res;
|
let res
|
||||||
for (const path in modules) {
|
for (const path in modules) {
|
||||||
const dir = path.split('views/')[1].split('.vue')[0];
|
const dir = path.split('views/')[1].split('.vue')[0]
|
||||||
if (dir === view) {
|
if (dir === view) {
|
||||||
res = () => modules[path]();
|
res = () => modules[path]()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return res;
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
export default usePermissionStore
|
export default usePermissionStore
|
||||||
@ -1,7 +1,8 @@
|
|||||||
import defaultSettings from '@/settings'
|
import defaultSettings from '@/settings'
|
||||||
import { useDynamicTitle } from '@/utils/dynamicTitle'
|
import { useDynamicTitle } from '@/utils/dynamicTitle'
|
||||||
|
|
||||||
const { sideTheme, theme, showSettings, topNav, tagsView, fixedHeader, sidebarLogo, dynamicTitle, showFooter, showWatermark, watermarkText } = defaultSettings
|
const { sideTheme, theme, showSettings, topNav, tagsView, fixedHeader, sidebarLogo, dynamicTitle, showFooter, showWatermark, watermarkText } =
|
||||||
|
defaultSettings
|
||||||
|
|
||||||
const storageSetting = JSON.parse(localStorage.getItem('layout-setting')) || ''
|
const storageSetting = JSON.parse(localStorage.getItem('layout-setting')) || ''
|
||||||
const useSettingsStore = defineStore('settings', {
|
const useSettingsStore = defineStore('settings', {
|
||||||
@ -30,7 +31,7 @@ const useSettingsStore = defineStore('settings', {
|
|||||||
// 设置网页标题
|
// 设置网页标题
|
||||||
setTitle(title) {
|
setTitle(title) {
|
||||||
this.title = title
|
this.title = title
|
||||||
useDynamicTitle();
|
useDynamicTitle()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -1,6 +1,4 @@
|
|||||||
const useTagsViewStore = defineStore(
|
const useTagsViewStore = defineStore('tagsView', {
|
||||||
'tagsView',
|
|
||||||
{
|
|
||||||
state: () => ({
|
state: () => ({
|
||||||
visitedViews: [],
|
visitedViews: [],
|
||||||
cachedViews: []
|
cachedViews: []
|
||||||
@ -11,7 +9,7 @@ const useTagsViewStore = defineStore(
|
|||||||
this.addCachedView(view)
|
this.addCachedView(view)
|
||||||
},
|
},
|
||||||
addVisitedView(view) {
|
addVisitedView(view) {
|
||||||
if (this.visitedViews.some(v => v.path === view.path)) return
|
if (this.visitedViews.some((v) => v.path === view.path)) return
|
||||||
this.visitedViews.push(
|
this.visitedViews.push(
|
||||||
Object.assign({}, view, {
|
Object.assign({}, view, {
|
||||||
title: view.meta.title || 'no-name'
|
title: view.meta.title || 'no-name'
|
||||||
@ -25,7 +23,7 @@ const useTagsViewStore = defineStore(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
delView(view) {
|
delView(view) {
|
||||||
return new Promise(resolve => {
|
return new Promise((resolve) => {
|
||||||
this.delVisitedView(view)
|
this.delVisitedView(view)
|
||||||
this.delCachedView(view)
|
this.delCachedView(view)
|
||||||
resolve({
|
resolve({
|
||||||
@ -35,7 +33,7 @@ const useTagsViewStore = defineStore(
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
delVisitedView(view) {
|
delVisitedView(view) {
|
||||||
return new Promise(resolve => {
|
return new Promise((resolve) => {
|
||||||
for (const [i, v] of this.visitedViews.entries()) {
|
for (const [i, v] of this.visitedViews.entries()) {
|
||||||
if (v.path === view.path) {
|
if (v.path === view.path) {
|
||||||
this.visitedViews.splice(i, 1)
|
this.visitedViews.splice(i, 1)
|
||||||
@ -46,14 +44,14 @@ const useTagsViewStore = defineStore(
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
delCachedView(view) {
|
delCachedView(view) {
|
||||||
return new Promise(resolve => {
|
return new Promise((resolve) => {
|
||||||
const index = this.cachedViews.indexOf(view.name)
|
const index = this.cachedViews.indexOf(view.name)
|
||||||
index > -1 && this.cachedViews.splice(index, 1)
|
index > -1 && this.cachedViews.splice(index, 1)
|
||||||
resolve([...this.cachedViews])
|
resolve([...this.cachedViews])
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
delOthersViews(view) {
|
delOthersViews(view) {
|
||||||
return new Promise(resolve => {
|
return new Promise((resolve) => {
|
||||||
this.delOthersVisitedViews(view)
|
this.delOthersVisitedViews(view)
|
||||||
this.delOthersCachedViews(view)
|
this.delOthersCachedViews(view)
|
||||||
resolve({
|
resolve({
|
||||||
@ -63,15 +61,15 @@ const useTagsViewStore = defineStore(
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
delOthersVisitedViews(view) {
|
delOthersVisitedViews(view) {
|
||||||
return new Promise(resolve => {
|
return new Promise((resolve) => {
|
||||||
this.visitedViews = this.visitedViews.filter(v => {
|
this.visitedViews = this.visitedViews.filter((v) => {
|
||||||
return v.meta.affix || v.path === view.path
|
return v.meta.affix || v.path === view.path
|
||||||
})
|
})
|
||||||
resolve([...this.visitedViews])
|
resolve([...this.visitedViews])
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
delOthersCachedViews(view) {
|
delOthersCachedViews(view) {
|
||||||
return new Promise(resolve => {
|
return new Promise((resolve) => {
|
||||||
const index = this.cachedViews.indexOf(view.name)
|
const index = this.cachedViews.indexOf(view.name)
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
this.cachedViews = this.cachedViews.slice(index, index + 1)
|
this.cachedViews = this.cachedViews.slice(index, index + 1)
|
||||||
@ -82,7 +80,7 @@ const useTagsViewStore = defineStore(
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
delAllViews(view) {
|
delAllViews(view) {
|
||||||
return new Promise(resolve => {
|
return new Promise((resolve) => {
|
||||||
this.delAllVisitedViews(view)
|
this.delAllVisitedViews(view)
|
||||||
this.delAllCachedViews(view)
|
this.delAllCachedViews(view)
|
||||||
resolve({
|
resolve({
|
||||||
@ -92,14 +90,14 @@ const useTagsViewStore = defineStore(
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
delAllVisitedViews(view) {
|
delAllVisitedViews(view) {
|
||||||
return new Promise(resolve => {
|
return new Promise((resolve) => {
|
||||||
const affixTags = this.visitedViews.filter(tag => tag.meta.affix)
|
const affixTags = this.visitedViews.filter((tag) => tag.meta.affix)
|
||||||
this.visitedViews = affixTags
|
this.visitedViews = affixTags
|
||||||
resolve([...this.visitedViews])
|
resolve([...this.visitedViews])
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
delAllCachedViews(view) {
|
delAllCachedViews(view) {
|
||||||
return new Promise(resolve => {
|
return new Promise((resolve) => {
|
||||||
this.cachedViews = []
|
this.cachedViews = []
|
||||||
resolve([...this.cachedViews])
|
resolve([...this.cachedViews])
|
||||||
})
|
})
|
||||||
@ -113,8 +111,8 @@ const useTagsViewStore = defineStore(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
delRightTags(view) {
|
delRightTags(view) {
|
||||||
return new Promise(resolve => {
|
return new Promise((resolve) => {
|
||||||
const index = this.visitedViews.findIndex(v => v.path === view.path)
|
const index = this.visitedViews.findIndex((v) => v.path === view.path)
|
||||||
if (index === -1) {
|
if (index === -1) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -132,8 +130,8 @@ const useTagsViewStore = defineStore(
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
delLeftTags(view) {
|
delLeftTags(view) {
|
||||||
return new Promise(resolve => {
|
return new Promise((resolve) => {
|
||||||
const index = this.visitedViews.findIndex(v => v.path === view.path)
|
const index = this.visitedViews.findIndex((v) => v.path === view.path)
|
||||||
if (index === -1) {
|
if (index === -1) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -151,6 +149,6 @@ const useTagsViewStore = defineStore(
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
export default useTagsViewStore
|
export default useTagsViewStore
|
||||||
@ -25,7 +25,8 @@ const useUserStore = defineStore('user', {
|
|||||||
const code = userInfo.code
|
const code = userInfo.code
|
||||||
const uuid = userInfo.uuid
|
const uuid = userInfo.uuid
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
login(username, password, code, uuid).then(res => {
|
login(username, password, code, uuid)
|
||||||
|
.then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
setToken(res.data)
|
setToken(res.data)
|
||||||
this.token = res.data
|
this.token = res.data
|
||||||
@ -34,7 +35,8 @@ const useUserStore = defineStore('user', {
|
|||||||
console.log('login error ', res)
|
console.log('login error ', res)
|
||||||
reject(res) //catch处理
|
reject(res) //catch处理
|
||||||
}
|
}
|
||||||
}).catch(error => {
|
})
|
||||||
|
.catch((error) => {
|
||||||
reject(error)
|
reject(error)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -42,12 +44,12 @@ const useUserStore = defineStore('user', {
|
|||||||
/**
|
/**
|
||||||
* 三方授权登录
|
* 三方授权登录
|
||||||
* @param {*} data
|
* @param {*} data
|
||||||
* @param { *} param { authSource : ''}
|
* @param {*} param { authSource : ''}
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
oauthLogin(data, param) {
|
oauthLogin(data, param) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
oauthCallback(data, param).then(res => {
|
oauthCallback(data, param).then((res) => {
|
||||||
const { code, data } = res
|
const { code, data } = res
|
||||||
if (code == 200) {
|
if (code == 200) {
|
||||||
setToken(data.token)
|
setToken(data.token)
|
||||||
@ -66,11 +68,13 @@ const useUserStore = defineStore('user', {
|
|||||||
// 获取用户信息
|
// 获取用户信息
|
||||||
getInfo() {
|
getInfo() {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
getInfo().then(res => {
|
getInfo()
|
||||||
|
.then((res) => {
|
||||||
const data = res.data
|
const data = res.data
|
||||||
const avatar = data.user.avatar == "" ? defAva : data.user.avatar;
|
const avatar = data.user.avatar == '' ? defAva : data.user.avatar
|
||||||
|
|
||||||
if (data.roles && data.roles.length > 0) { // 验证返回的roles是否是一个非空数组
|
if (data.roles && data.roles.length > 0) {
|
||||||
|
// 验证返回的roles是否是一个非空数组
|
||||||
this.roles = data.roles
|
this.roles = data.roles
|
||||||
this.permissions = data.permissions
|
this.permissions = data.permissions
|
||||||
} else {
|
} else {
|
||||||
@ -82,29 +86,32 @@ const useUserStore = defineStore('user', {
|
|||||||
this.userInfo = data.user //新加
|
this.userInfo = data.user //新加
|
||||||
this.userId = data.user.userId //新加
|
this.userId = data.user.userId //新加
|
||||||
resolve(res)
|
resolve(res)
|
||||||
}).catch(error => {
|
})
|
||||||
console.error(error);
|
.catch((error) => {
|
||||||
reject("获取用户信息失败")
|
console.error(error)
|
||||||
|
reject('获取用户信息失败')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 退出系统
|
// 退出系统
|
||||||
logOut() {
|
logOut() {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
logout(this.token).then((res) => {
|
logout(this.token)
|
||||||
|
.then((res) => {
|
||||||
this.token = ''
|
this.token = ''
|
||||||
this.roles = []
|
this.roles = []
|
||||||
this.permissions = []
|
this.permissions = []
|
||||||
removeToken()
|
removeToken()
|
||||||
resolve(res)
|
resolve(res)
|
||||||
}).catch(error => {
|
})
|
||||||
|
.catch((error) => {
|
||||||
reject(error)
|
reject(error)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 前端 登出
|
// 前端 登出
|
||||||
fedLogOut() {
|
fedLogOut() {
|
||||||
return new Promise(resolve => {
|
return new Promise((resolve) => {
|
||||||
this.token = ''
|
this.token = ''
|
||||||
removeToken()
|
removeToken()
|
||||||
resolve()
|
resolve()
|
||||||
|
|||||||
@ -23,7 +23,7 @@ export default defineConfig(({ mode, command }) => {
|
|||||||
alias: alias,
|
alias: alias,
|
||||||
// 导入时想要省略的扩展名列表
|
// 导入时想要省略的扩展名列表
|
||||||
// https://cn.vitejs.dev/config/#resolve-extensions
|
// https://cn.vitejs.dev/config/#resolve-extensions
|
||||||
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue'],
|
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue']
|
||||||
},
|
},
|
||||||
css: {
|
css: {
|
||||||
devSourcemap: true //开发模式时启用
|
devSourcemap: true //开发模式时启用
|
||||||
@ -37,11 +37,11 @@ export default defineConfig(({ mode, command }) => {
|
|||||||
// 将js、css文件分离到单独文件夹
|
// 将js、css文件分离到单独文件夹
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
output: {
|
output: {
|
||||||
chunkFileNames: "static/js/[name]-[hash].js",
|
chunkFileNames: 'static/js/[name]-[hash].js',
|
||||||
entryFileNames: "static/js/[name]-[hash].js",
|
entryFileNames: 'static/js/[name]-[hash].js',
|
||||||
assetFileNames: "static/[ext]/[name]-[hash].[ext]"
|
assetFileNames: 'static/[ext]/[name]-[hash].[ext]'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
},
|
},
|
||||||
// vite 相关配置
|
// vite 相关配置
|
||||||
server: {
|
server: {
|
||||||
@ -60,7 +60,7 @@ export default defineConfig(({ mode, command }) => {
|
|||||||
ws: true,
|
ws: true,
|
||||||
rewrite: (path) => path.replace(/^\/msgHub/, '')
|
rewrite: (path) => path.replace(/^\/msgHub/, '')
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
Loading…
x
Reference in New Issue
Block a user