Browse Source

消毒中登陆

master
maochaoying 2 years ago
parent
commit
d0ebef215a
  1. 10
      src/components/LoginForm.vue
  2. 2
      src/components/Progress.vue
  3. 4
      src/components/dialogs/LoginModal.vue
  4. 15
      src/pages/Home.vue
  5. 2
      src/store/modules/user.js
  6. 6
      src/store/modules/websocket.js

10
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) {

2
src/components/Progress.vue

@ -87,7 +87,7 @@
</svg>
<div class="left_log_wrap">
<p class="text">当前剩余</p>
<p class="val">{{ deviceStore.nowlog || 0 }}log</p>
<p class="val">{{ deviceStore.nowlog?.toFixed(2) || 0 }}log</p>
</div>
<div
class="btn"

4
src/components/dialogs/LoginModal.vue

@ -8,6 +8,7 @@
:handleHideKey="handleHideKey"
:hideLoginModal="hideLoginModal"
:modal="true"
:changeTab="changeTab"
/>
<svg
@click="closeModal"
@ -44,6 +45,9 @@ const props = defineProps({
hideLoginModal: {
type: Function,
},
changeTab: {
type: Function,
},
})
const input = ref('')

15
src/pages/Home.vue

@ -142,7 +142,6 @@
activeTab == 5 ? 'tab_btn style-btn active_btn' : 'style-btn tab_btn'
"
@click="changeTab(5)"
v-if="userStore.loginUserPermission != 3"
>
<svg
xmlns="http://www.w3.org/2000/svg"
@ -307,7 +306,11 @@
:input="input"
/>
</div>
<LoginModal v-if="loginModalVisible" :hideLoginModal="hideLoginModal" />
<LoginModal
:changeTab="changeTab"
v-if="loginModalVisible"
:hideLoginModal="hideLoginModal"
/>
</div>
</template>
@ -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
}

2
src/store/modules/user.js

@ -7,7 +7,7 @@ export const useUserStore = defineStore({
allUserList: [],
operUser: '',
loginUser: '',
loginUserPermission: 2,
loginUserPermission: 3,
}
},
// actions

6
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

Loading…
Cancel
Save