From e1ce334a93082eb36cf470d31a70b10d5db472ab Mon Sep 17 00:00:00 2001 From: sunzehua Date: Fri, 2 Feb 2024 13:23:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layouts/BasicLayout.vue | 41 +++++------ src/store/getters.js | 1 + src/store/modules/user.js | 75 +++++++++++---------- src/views/getway/index.vue | 1 - src/views/main/BookingLedger/list/index.vue | 33 +++++++-- 5 files changed, 91 insertions(+), 60 deletions(-) diff --git a/src/layouts/BasicLayout.vue b/src/layouts/BasicLayout.vue index a2fb94f..0718ece 100644 --- a/src/layouts/BasicLayout.vue +++ b/src/layouts/BasicLayout.vue @@ -7,16 +7,14 @@ :wrapClassName="`drawer-sider ${navTheme}`" :closable="false" :visible="collapsed" - @close="drawerClose" - > + @close="drawerClose"> + @menuSelect="menuSelect"> + :collapsible="true">
@@ -37,8 +34,7 @@ :theme="navTheme" :collapsed="collapsed" :device="device" - @toggle="toggle" - /> + @toggle="toggle" /> @@ -87,6 +83,9 @@ export default { // 动态主路由 mainMenu: state => state.permission.addRouters }), + ...mapGetters([ + 'FirstLoading' + ]), contentPaddingLeft() { if (!this.fixSidebar || this.isMobile()) { return '0' @@ -97,7 +96,7 @@ export default { return '80px' }, placeholderDivMinWidth() { - let width = this.collapsed ? '80px' : '230px' + const width = this.collapsed ? '80px' : '230px' return width } }, @@ -162,21 +161,23 @@ export default { } return left }, - menuSelect() {}, + menuSelect() { }, drawerClose() { this.collapsed = false }, setBookingInfo() { - this.setCarrierList() - this.setYardList() - this.setPackageList() - this.setIssuetypeList() - this.setBlfrtList() - this.setCtnallList() - this.setLineList() - this.setCodeCountryList() - this.setBookingSourcePage() - this.setBookingInitData() + if (this.FirstLoading) { + this.setCarrierList() + this.setYardList() + this.setPackageList() + this.setIssuetypeList() + this.setBlfrtList() + this.setCtnallList() + this.setLineList() + this.setCodeCountryList() + this.setBookingSourcePage() + this.setBookingInitData() + } } } } diff --git a/src/store/getters.js b/src/store/getters.js index 309a56f..3e69dbe 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -7,6 +7,7 @@ const getters = { token: state => state.user.token, avatar: state => state.user.avatar, nickname: state => state.user.name, + FirstLoading: state => state.user.FirstLoading, welcome: state => state.user.welcome, roles: state => state.user.roles, buttons: state => state.user.buttons, diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 667516b..fac857e 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -19,6 +19,7 @@ const user = { buttons: [], // 按钮权限 admintype: '', // 是否是超管 roles: [], + FirstLoading: true, messageNum: 0, info: {}, notices: [], // 接收的通知公告 @@ -90,6 +91,9 @@ const user = { }, SET_MESSAGENUM: (state, num) => { state.messageNum = num + }, + SET_LOADING: (state, flag) => { + state.FirstLoading = flag } }, @@ -116,8 +120,8 @@ const user = { }) }) }, - // 跨平台登录 - LoginWithCode({ commit }, userInfo) { + // 跨平台登录 + LoginWithCode({ commit }, userInfo) { return new Promise((resolve, reject) => { loginWithCode(userInfo) .then(response => { @@ -130,6 +134,7 @@ const user = { Vue.ls.set(ACCESS_TOKEN, result, 7 * 24 * 60 * 60 * 1000) Vue.ls.set('FIRSTFLAG', true, 7 * 24 * 60 * 60 * 1000) commit('SET_TOKEN', result) + commit('SET_LOADING', false) resolve() }) .catch(error => { @@ -211,20 +216,20 @@ const user = { }) }, - // 登出 - ClearnInfo({ commit, state }) { - return new Promise(resolve => { - commit('SET_TOKEN', '') - commit('SET_ROLES', []) - commit('SET_BUTTONS', []) - commit('SET_ADMINTYPE', '') - commit('SET_INFO', null) - Vue.ls.remove(ACCESS_TOKEN) - Vue.ls.remove(ALL_APPS_MENU) - Vue.ls.remove(DICT_TYPE_TREE_DATA) - resolve() - }) - }, + // 登出 + ClearnInfo({ commit, state }) { + return new Promise(resolve => { + commit('SET_TOKEN', '') + commit('SET_ROLES', []) + commit('SET_BUTTONS', []) + commit('SET_ADMINTYPE', '') + commit('SET_INFO', null) + Vue.ls.remove(ACCESS_TOKEN) + Vue.ls.remove(ALL_APPS_MENU) + Vue.ls.remove(DICT_TYPE_TREE_DATA) + resolve() + }) + }, // 加载所有字典数据 dictTypeData() { @@ -319,25 +324,25 @@ const user = { }) }, - // 加载所有货物状态 - configPageList() { - return new Promise((resolve, reject) => { - getconfigPage({ 'PageSize': 1000 }) - .then(data => { - if (data.success) { - const result = data.data.rows - Vue.ls.set('configPageList', result) - resolve() - } else { - // eslint-disable-next-line no-undef - reject(new Error(data.message)) - } - }) - .catch(error => { - reject(error) - }) - }) - }, + // 加载所有货物状态 + configPageList() { + return new Promise((resolve, reject) => { + getconfigPage({ 'PageSize': 1000 }) + .then(data => { + if (data.success) { + const result = data.data.rows + Vue.ls.set('configPageList', result) + resolve() + } else { + // eslint-disable-next-line no-undef + reject(new Error(data.message)) + } + }) + .catch(error => { + reject(error) + }) + }) + }, // 设置订舱列表 setBookingList({ commit }, obj) { diff --git a/src/views/getway/index.vue b/src/views/getway/index.vue index 757c6f5..37ffe68 100644 --- a/src/views/getway/index.vue +++ b/src/views/getway/index.vue @@ -98,7 +98,6 @@ export default { this.configPageList().then(res => {}) }, requestFailed(res) { - console.log(res) this.$message.error(res.message) } } diff --git a/src/views/main/BookingLedger/list/index.vue b/src/views/main/BookingLedger/list/index.vue index 9ec4173..d3e65a6 100644 --- a/src/views/main/BookingLedger/list/index.vue +++ b/src/views/main/BookingLedger/list/index.vue @@ -117,7 +117,7 @@ @cancel="cancelRemove"> - +