Browse Source

添加用户

master
maochaoying 2 years ago
parent
commit
c22165a8f4
  1. 8
      .env
  2. 30
      src/components/Setting/components/User.vue
  3. 1
      src/mock/command.js

8
.env

@ -1,5 +1,5 @@
# VITE_BASE_WS1_URL=ws://192.168.8.10:19001/
# VITE_BASE_WS2_URL=ws://192.168.8.10:19002/
VITE_BASE_WS1_URL=ws://192.168.8.10:19001/
VITE_BASE_WS2_URL=ws://192.168.8.10:19002/
VITE_BASE_WS1_URL=ws://127.0.0.1:19001/
VITE_BASE_WS2_URL=ws://127.0.0.1:19002/
# VITE_BASE_WS1_URL=ws://127.0.0.1:19001/
# VITE_BASE_WS2_URL=ws://127.0.0.1:19002/

30
src/components/Setting/components/User.vue

@ -3,8 +3,9 @@
<div v-if="userFormVisible" class="add_user_form"> <div v-if="userFormVisible" class="add_user_form">
<p class="title">添加新用户</p> <p class="title">添加新用户</p>
<div class="form_wrap"> <div class="form_wrap">
<input type="text" class="username_form" />
<input v-model="newUserUserName" type="text" class="username_form" />
<input <input
v-model="newUserPassword"
:type="showAddPassword ? 'text' : 'password'" :type="showAddPassword ? 'text' : 'password'"
class="password_form" class="password_form"
/> />
@ -13,12 +14,12 @@
class="eye" class="eye"
@click="handleAddPasswordShow" @click="handleAddPasswordShow"
/> />
<p class="username_tips">*用户名限制信息</p>
<p class="password_tips">*用户名限制信息</p>
<!-- <p class="username_tips">*用户名限制信息</p>
<p class="password_tips">*用户名限制信息</p> -->
</div> </div>
<div class="btns"> <div class="btns">
<div class="btn style-btn" @click="returnList">返回</div> <div class="btn style-btn" @click="returnList">返回</div>
<div class="btn style-btn">添加</div>
<div class="btn style-btn" @click="addNewUserFunc">添加</div>
</div> </div>
</div> </div>
<div v-else-if="changePasswordVisible" class="change_password_form"> <div v-else-if="changePasswordVisible" class="change_password_form">
@ -136,6 +137,7 @@ import {
updateUserPermissionLevelJSON, updateUserPermissionLevelJSON,
delUserJSON, delUserJSON,
addUserJson, addUserJson,
getAllUserJSON,
} from '@/mock/command' } from '@/mock/command'
const showkeyboard = ref(false) const showkeyboard = ref(false)
@ -150,6 +152,9 @@ const onChange = a => {
updateUserNewPassword.value = a updateUserNewPassword.value = a
} }
const newUserUserName = ref('')
const newUserPassword = ref('')
const userStore = useUserStore() const userStore = useUserStore()
const webSocketStore = useWebSocketStore() const webSocketStore = useWebSocketStore()
const userFormVisible = ref(false) const userFormVisible = ref(false)
@ -230,12 +235,29 @@ const hideUserModal = () => {
userModalVisible.value = false userModalVisible.value = false
} }
const getAllUser = () => {
webSocketStore.sendCommandMsg(getAllUserJSON)
}
const handleOk = () => { const handleOk = () => {
if (userModalFlag.value == 1) { if (userModalFlag.value == 1) {
// //
webSocketStore.sendCommandMsg(delUserJSON(currDelUserId.value))
} else { } else {
// //
webSocketStore.sendCommandMsg(
updateUserPermissionLevelJSON(currDelUserId.value),
)
} }
getAllUser()
}
const addNewUserFunc = () => {
webSocketStore.sendCommandMsg(
addUserJson(newUserUserName.value, newUserPassword.value),
)
getAllUser()
returnList()
} }
</script> </script>

1
src/mock/command.js

@ -192,6 +192,7 @@ export const addUserJson = (uid, passwd) => {
messageId: 'addUser', messageId: 'addUser',
uid, uid,
passwd, passwd,
permission_level: 3,
} }
} }

Loading…
Cancel
Save