From 473c4693da47d95681d738e09bab077cf16a2ef5 Mon Sep 17 00:00:00 2001 From: wally <18603454788@163.com> Date: Fri, 29 Oct 2021 14:59:12 +0800 Subject: [PATCH] feat: devices management;network config add device select --- src/App.vue | 29 ++++++------- src/components/device-select-and-status.vue | 42 ++++++++++++++++++ src/components/refresh.vue | 19 +++++++++ src/components/search-bar.vue | 5 +-- src/store/user.js | 4 +- src/views/device-list.vue | 47 ++++++++++++++++----- src/views/network-config.vue | 39 +++++++++++++---- 7 files changed, 145 insertions(+), 40 deletions(-) create mode 100644 src/components/device-select-and-status.vue create mode 100644 src/components/refresh.vue diff --git a/src/App.vue b/src/App.vue index c0ea327..332f8d1 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,7 +1,7 @@ + + diff --git a/src/components/refresh.vue b/src/components/refresh.vue new file mode 100644 index 0000000..be91fc9 --- /dev/null +++ b/src/components/refresh.vue @@ -0,0 +1,19 @@ + + + + + diff --git a/src/components/search-bar.vue b/src/components/search-bar.vue index 816731f..eb5c246 100644 --- a/src/components/search-bar.vue +++ b/src/components/search-bar.vue @@ -2,7 +2,7 @@ - + @@ -26,8 +26,7 @@ const store = useStore(); const devices = computed(() => store.state.device.devices); const onSubmit = () => { - searchDeviceForm.value.validate(valid => { - console.log(valid, { ...searchDevice }); + searchDeviceForm.value.validate(() => { const { device } = searchDevice; emit('search', { deviceId: device }); }); diff --git a/src/store/user.js b/src/store/user.js index 47689fe..72e8d3e 100644 --- a/src/store/user.js +++ b/src/store/user.js @@ -12,7 +12,7 @@ export default { }, userId({ user }) { if (!user) return null; - return user.userId; + return user.id; }, }, @@ -26,7 +26,7 @@ export default { state.user = user; if (user) { localStorage.setItem('token', user.token); - localStorage.setItem('user', user); + localStorage.setItem('user', JSON.stringify(user)); } else { localStorage.removeItem('token'); localStorage.removeItem('user'); diff --git a/src/views/device-list.vue b/src/views/device-list.vue index 35341ce..4d6c85b 100644 --- a/src/views/device-list.vue +++ b/src/views/device-list.vue @@ -17,23 +17,41 @@ - - - - - - - - - + + + + + + + + + @@ -59,11 +77,13 @@ diff --git a/src/views/network-config.vue b/src/views/network-config.vue index ac225a1..651f41e 100644 --- a/src/views/network-config.vue +++ b/src/views/network-config.vue @@ -1,4 +1,7 @@