-
账号登陆
+
+
+
+
+

+

+
-
-
@@ -82,65 +72,72 @@
import { ref, reactive, onMounted } from 'vue';
import { useRouter } from 'vue-router';
import { login } from '@/api/account';
-import { getToken, setToken, setUser } from '@/utils/storage'
+import { getToken, setToken, setUser, setUserPass, getUserPass } from '@/utils/storage';
+import { ElLoading } from 'element-plus';
const router = useRouter();
-// import { usePythonBridge } from '@/utils/pythonBridge';
-
-// let inputValue = ref('999');
-// const output = ref('');
-// const { callPython, getPythonData } = usePythonBridge();
-
-
-
const formData = ref({
- userId: '',
- password: '',
-})
-
+ userId: getUserPass() == null ? '' : getUserPass().userId,
+ password: getUserPass() == null ? '' : getUserPass().password,
+});
const onSubmit = () => {
- console.log('submit!')
+ const loading = ElLoading.service({
+ lock: true,
+ text: 'Loading',
+ background: 'rgba(0, 0, 0, 0.7)',
+ });
+ console.log('submit!');
+ setUserPass(formData.value);
login({
userId: formData.value.userId,
password: formData.value.password,
- }).then(res => {
- console.log(res)
- setToken(res.currcode)
- setUser(res)
+ }).then((res) => {
+ loading.close();
+ setToken(res.currcode);
+ setUser(res);
router.push('/nav');
-
- })
-
-
-}
-
+ }).catch((err) => {
+ loading.close();
+ });
+};
+
+
\ No newline at end of file
diff --git a/src/views/hosts/hostsList.vue b/src/views/hosts/hostsList.vue
index 7119deb..a347b09 100644
--- a/src/views/hosts/hostsList.vue
+++ b/src/views/hosts/hostsList.vue
@@ -9,13 +9,22 @@
-
查询
+
查询