Browse Source

修改登录模式

zhangchuang 16 giờ trước cách đây
mục cha
commit
79f54bc1ca
1 tập tin đã thay đổi với 8 bổ sung4 xóa
  1. 8 4
      src/login/index.vue

+ 8 - 4
src/login/index.vue

@@ -37,8 +37,8 @@ import { sha256 } from "js-sha256";
 import { setLocalStorage } from "@/utils";
 
 const router = useRouter();
-const username = ref("admin");
-const password = ref("123456");
+const username = ref("");
+const password = ref("");
 const isRemember = ref(false);
 
 const onLogin = async () => {
@@ -47,8 +47,9 @@ const onLogin = async () => {
     return;
   }
   const data = {
-    username: "admin",
-    password: sha256("123456"),
+    username: username.value,
+    password: sha256(password.value),
+    clientType: "operator",
   };
   const res = (await postLogin(data)) as unknown as any;
   if (res.code === 200) {
@@ -56,6 +57,9 @@ const onLogin = async () => {
     setLocalStorage("avatar", res.data.avatar);
     setLocalStorage("tokenName", res.data.tokenName);
     setLocalStorage("tokenValue", res.data.tokenValue);
+    setLocalStorage("phone", res.data.phone);
+    setLocalStorage("name", res.data.name);
+    setLocalStorage("avatar", res.data.avatar);
     router.push({
       path: "/dashboard",
     });