diff --git a/src/components/LoginForm.vue b/src/components/LoginForm.vue index 9c06337..15505f9 100644 --- a/src/components/LoginForm.vue +++ b/src/components/LoginForm.vue @@ -27,7 +27,7 @@ import Open from '@/assets/img/login/open.png' import { useWebSocketStore, useUserStore } from '@/store' import { ref, watch } from 'vue' import { useRouter } from 'vue-router' -import { loginJSON } from '@/mock/command' +import { loginJSON, getAllUserJSON } from '@/mock/command' const props = defineProps({ handleShowKey: { @@ -50,6 +50,10 @@ const props = defineProps({ type: Boolean, default: false, }, + changeTab: { + type: Function, + default: () => {}, + }, }) const activeInput = ref(1) @@ -92,7 +96,6 @@ const handleLogin = () => { tip.value = '' webSocketStore?.sendCommandMsg(loginJSON(username.value, password.value)) // 前端自己校验 - console.log(userStore.allUserList) let flag = false userStore.allUserList?.map(item => { if (item.uid == username.value && password.value == item.passwd) { @@ -101,10 +104,13 @@ const handleLogin = () => { userStore.updatePermission(item.permission_level) userStore.updateLoginUser(item.uid) if (props.modal) { + props.changeTab(5) props.hideLoginModal() + // 判断是否在消毒中,如果在消毒中,将TAB切换到设置 } else { window.location.href = 'http://127.0.0.1/' } + console.log(props.modal) } }) if (!flag) { diff --git a/src/components/Progress.vue b/src/components/Progress.vue index c1fc738..3e9fee5 100644 --- a/src/components/Progress.vue +++ b/src/components/Progress.vue @@ -87,7 +87,7 @@

当前剩余

-

{{ deviceStore.nowlog || 0 }}log

+

{{ deviceStore.nowlog?.toFixed(2) || 0 }}log

- + @@ -331,7 +334,12 @@ import { useSettingStore, useUserStore, } from '@/store' -import { logoutJSON, getStateJSON, getAllSettingJSON } from '@/mock/command' +import { + logoutJSON, + getStateJSON, + getAllSettingJSON, + getAllUserJSON, +} from '@/mock/command' import { useRouter } from 'vue-router' @@ -381,6 +389,7 @@ const changeTab = index => { if (userStore.loginUserPermission == 3) { // 非管理员 // 如果不为管理员 则弹出登陆框 + webSocketStore?.sendCommandMsg(getAllUserJSON) loginModalVisible.value = true return } diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 8da8250..f4be580 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -7,7 +7,7 @@ export const useUserStore = defineStore({ allUserList: [], operUser: '', loginUser: '', - loginUserPermission: 2, + loginUserPermission: 3, } }, // actions diff --git a/src/store/modules/websocket.js b/src/store/modules/websocket.js index 7196b2e..c69920a 100644 --- a/src/store/modules/websocket.js +++ b/src/store/modules/websocket.js @@ -198,9 +198,9 @@ export const useWebSocketStore = defineStore({ auditStore.updatePage(page) break case 'login': - if (ackcode == 0) { - window.location.href = 'http://127.0.0.1/' - } + // if (ackcode == 0) { + // window.location.href = 'http://127.0.0.1/' + // } break case 'getAllRecords': break