diff --git a/frontend/src/metersphere/common/components/MsDialogFooter.vue b/frontend/src/metersphere/common/components/MsDialogFooter.vue index d4beca93ad..b1330ed1f5 100644 --- a/frontend/src/metersphere/common/components/MsDialogFooter.vue +++ b/frontend/src/metersphere/common/components/MsDialogFooter.vue @@ -25,7 +25,10 @@ export default { type: Boolean, default: false }, - title: String + title: { + type: String, + default: null + } }, methods: { cancel() { diff --git a/frontend/src/permission.js b/frontend/src/permission.js index 547cdd39d2..44eed1a58e 100644 --- a/frontend/src/permission.js +++ b/frontend/src/permission.js @@ -37,7 +37,7 @@ router.beforeEach(async(to, from, next) => { store.dispatch('user/getInfo').then(() => { loadMenus(next, to) }).catch(() => { - store.dispatch('logout').then(() => { + store.dispatch('user/logout').then(() => { location.reload() // 为了重新实例化vue-router对象 避免bug }) }) @@ -65,7 +65,7 @@ router.beforeEach(async(to, from, next) => { }) export const loadMenus = (next, to) => { buildMenus().then(res => { - const asyncRouter = filterAsyncRouter(res.data.data) + const asyncRouter = filterAsyncRouter(res.data) asyncRouter.push({ path: '*', redirect: '/404', hidden: true }) store.dispatch('permission/GenerateRoutes', asyncRouter).then(() => { // 存储路由 router.addRoutes(asyncRouter) diff --git a/frontend/src/store/modules/user.js b/frontend/src/store/modules/user.js index df17042004..c16f94a5a7 100644 --- a/frontend/src/store/modules/user.js +++ b/frontend/src/store/modules/user.js @@ -46,7 +46,7 @@ const actions = { const { username, password } = userInfo return new Promise((resolve, reject) => { login({ username: username.trim(), password: password }).then(response => { - const { data } = response.data + const { data } = response commit('SET_TOKEN', data.token) setToken(data.token) resolve() @@ -60,7 +60,7 @@ const actions = { getInfo({ commit, state }) { return new Promise((resolve, reject) => { getInfo(state.token).then(response => { - const { data } = response.data + const { data } = response if (!data) { reject('Verification failed, please Login again.') diff --git a/frontend/src/utils/request.js b/frontend/src/utils/request.js index 30974f83e7..f2fc12e6eb 100644 --- a/frontend/src/utils/request.js +++ b/frontend/src/utils/request.js @@ -98,7 +98,7 @@ service.interceptors.response.use( // 请根据实际需求修改 service.interceptors.response.use(response => { checkAuth(response) - return response + return response.data }, error => { let msg if (error.response) { diff --git a/frontend/src/views/dataset/common/DatasetTableData.vue b/frontend/src/views/dataset/common/DatasetTableData.vue index be1ecd3d40..1c7f282525 100644 --- a/frontend/src/views/dataset/common/DatasetTableData.vue +++ b/frontend/src/views/dataset/common/DatasetTableData.vue @@ -23,6 +23,7 @@ export default { name: 'DatasetTableData', props: { + // eslint-disable-next-line vue/require-default-prop table: Object }, data() { diff --git a/frontend/src/views/dataset/group/Group.vue b/frontend/src/views/dataset/group/Group.vue index b0c2e8f70d..96d424f6d8 100644 --- a/frontend/src/views/dataset/group/Group.vue +++ b/frontend/src/views/dataset/group/Group.vue @@ -462,7 +462,7 @@ export default { tree(group) { groupTree(group).then(res => { - this.tData = res.data.data + this.tData = res.data }) }, @@ -473,7 +473,7 @@ export default { sort: 'type asc,create_time desc,name asc', sceneId: this.currGroup.id }).then(res => { - this.tableData = res.data.data + this.tableData = res.data }) } }, @@ -555,7 +555,7 @@ export default { this.sceneMode = true const sceneId = this.$store.state.dataset.sceneData getScene(sceneId).then(res => { - this.currGroup = res.data.data + this.currGroup = res.data }) } else { this.$router.push('/dataset') diff --git a/frontend/src/views/system/datasource/index.vue b/frontend/src/views/system/datasource/index.vue index 65fdae0a5a..d41269deff 100644 --- a/frontend/src/views/system/datasource/index.vue +++ b/frontend/src/views/system/datasource/index.vue @@ -361,7 +361,7 @@ export default { }, initTableData() { dsGrid(this.currentPage, this.pageSize, this.condition).then(response => { - const data = response.data.data + const data = response.data this.tableData = data.listObject this.total = data.itemCount }) diff --git a/frontend/src/views/system/dept/index.vue b/frontend/src/views/system/dept/index.vue index d89d6203cc..0f61519eeb 100644 --- a/frontend/src/views/system/dept/index.vue +++ b/frontend/src/views/system/dept/index.vue @@ -218,7 +218,9 @@ export default { treeByArr(arr) { if (!Array.isArray(arr) || !arr.length) return const map = {} - arr.forEach(item => map[item.id] = item) + arr.forEach(item => { + map[item.id] = item + }) const roots = [] arr.forEach(item => { @@ -236,7 +238,7 @@ export default { const _self = this const pid = row ? row.deptId : '0' getDeptTree(pid).then(response => { - let data = response.data.data + let data = response.data data = data.map(obj => { if (obj.subCount > 0) { obj.hasChildren = true @@ -244,7 +246,9 @@ export default { return obj }) if (!row) { - data.some(node => node.children = null) + data.some(node => { + node.children = null + }) _self.tableData = data _self.depts = null } else { @@ -267,7 +271,7 @@ export default { if (action === LOAD_ROOT_OPTIONS) { const _self = this !this.depts && getDeptTree('0').then(res => { - _self.depts = res.data.data.map(node => _self.normalizer(node)) + _self.depts = res.data.map(node => _self.normalizer(node)) callback() }) } @@ -275,7 +279,7 @@ export default { if (action === LOAD_CHILDREN_OPTIONS) { const _self = this getDeptTree(parentNode.id).then(res => { - parentNode.children = res.data.data.map(function(obj) { + parentNode.children = res.data.map(function(obj) { return _self.normalizer(obj) }) callback() @@ -375,7 +379,9 @@ export default { array2Tree(arr) { if (!Array.isArray(arr) || !arr.length) return const map = {} - arr.forEach(item => map[item.id] = item) + arr.forEach(item => { + map[item.id] = item + }) const roots = [] arr.forEach(item => { diff --git a/frontend/src/views/system/menu/index.vue b/frontend/src/views/system/menu/index.vue index 1478258fe5..de867829f6 100644 --- a/frontend/src/views/system/menu/index.vue +++ b/frontend/src/views/system/menu/index.vue @@ -284,7 +284,7 @@ export default { const pid = row ? row.menuId : '0' getMenusTree(pid).then(response => { - let data = response.data.data + let data = response.data data = data.map(obj => { if (obj.subCount > 0) { obj.hasChildren = true @@ -316,7 +316,7 @@ export default { if (action === LOAD_ROOT_OPTIONS) { const _self = this !this.menus && getMenusTree('0').then(res => { - _self.menus = res.data.data.map(node => _self.normalizer(node)) + _self.menus = res.data.map(node => _self.normalizer(node)) callback() }) } @@ -324,7 +324,7 @@ export default { if (action === LOAD_CHILDREN_OPTIONS) { const _self = this getMenusTree(parentNode.id).then(res => { - parentNode.children = res.data.data.map(function(obj) { + parentNode.children = res.data.map(function(obj) { return _self.normalizer(obj) }) callback() diff --git a/frontend/src/views/system/role/index.vue b/frontend/src/views/system/role/index.vue index 3561cd78e3..1e50453a14 100644 --- a/frontend/src/views/system/role/index.vue +++ b/frontend/src/views/system/role/index.vue @@ -142,7 +142,7 @@ export default { }, search() { roleGrid(this.currentPage, this.pageSize, this.condition).then(response => { - const data = response.data.data + const data = response.data this.total = data.itemCount this.tableData = data.listObject }) @@ -178,7 +178,7 @@ export default { getMenuDatas(node, resolve) { const pid = node.data.id ? node.data.id : '0' getMenusTree(pid).then(res => { - const datas = res.data.data + const datas = res.data const nodes = datas.map(data => this.formatNode(data)) resolve && resolve(nodes) }) @@ -194,7 +194,7 @@ export default { }, menuChange(menu) { getChild(menu.id).then(res => { - const childIds = res.data.data + const childIds = res.data if (this.menuIds.indexOf(menu.id) !== -1) { for (let i = 0; i < childIds.length; i++) { const index = this.menuIds.indexOf(childIds[i]) diff --git a/frontend/src/views/system/user/index.vue b/frontend/src/views/system/user/index.vue index ae266c7217..8b7f3fa30a 100644 --- a/frontend/src/views/system/user/index.vue +++ b/frontend/src/views/system/user/index.vue @@ -346,7 +346,7 @@ export default { }, search() { userLists(this.currentPage, this.pageSize, this.condition).then(response => { - const data = response.data.data + const data = response.data this.total = data.itemCount this.tableData = data.listObject }) @@ -380,7 +380,7 @@ export default { if (action === LOAD_ROOT_OPTIONS) { const _self = this !this.depts && getDeptTree('0').then(res => { - _self.depts = res.data.data.map(node => _self.normalizer(node)) + _self.depts = res.data.map(node => _self.normalizer(node)) callback() }) } @@ -388,7 +388,7 @@ export default { if (action === LOAD_CHILDREN_OPTIONS) { const _self = this getDeptTree(parentNode.id).then(res => { - parentNode.children = res.data.data.map(function(obj) { + parentNode.children = res.data.map(function(obj) { return _self.normalizer(obj) }) callback() @@ -421,7 +421,7 @@ export default { }, allRoles() { allRoles().then(res => { - this.roles = res.data.data + this.roles = res.data }) } diff --git a/frontend/src/views/system/user/index_back.vue b/frontend/src/views/system/user/index_back.vue index 6b10178542..b9c92b8c63 100644 --- a/frontend/src/views/system/user/index_back.vue +++ b/frontend/src/views/system/user/index_back.vue @@ -106,7 +106,7 @@ export default { const { currentPage, pageSize } = this.paginationConfig userLists(currentPage, pageSize, {}).then(response => { this.data = response.data.data.listObject - this.paginationConfig.total = response.data.data.itemCount + this.paginationConfig.total = response.data.itemCount }) } }