|
@@ -1,7 +1,45 @@
|
|
|
-<script lang="ts" setup></script>
|
|
|
+<script lang="ts" setup>
|
|
|
+import { loginApi } from "@/api/login";
|
|
|
+import { store } from "@/store/store";
|
|
|
+
|
|
|
+const accountType = $ref("STUDENT_CODE");
|
|
|
+const accountValue = $ref("");
|
|
|
+const password = $ref("");
|
|
|
+// console.log(import.meta.env);
|
|
|
+const domain = import.meta.env.DEV
|
|
|
+ ? (import.meta.env.VITE_DEVELOPMENT_DOMAIN as string)
|
|
|
+ : "";
|
|
|
+const rootOrgId = 0;
|
|
|
+
|
|
|
+async function handleLoginClick() {
|
|
|
+ const res = await loginApi(
|
|
|
+ accountType,
|
|
|
+ accountValue,
|
|
|
+ password,
|
|
|
+ domain,
|
|
|
+ rootOrgId
|
|
|
+ );
|
|
|
+ console.log(res);
|
|
|
+
|
|
|
+ store.user = res.data.content;
|
|
|
+}
|
|
|
+</script>
|
|
|
|
|
|
<template>
|
|
|
<div>login</div>
|
|
|
+ <div>
|
|
|
+ <n-form>
|
|
|
+ <n-form-item label="学号">
|
|
|
+ <n-input v-model:value="accountValue" clearable />
|
|
|
+ </n-form-item>
|
|
|
+ <n-form-item label="密码">
|
|
|
+ <n-input v-model:value="password" clearable />
|
|
|
+ </n-form-item>
|
|
|
+ <n-form-item>
|
|
|
+ <n-button @click="handleLoginClick"> 登录 </n-button>
|
|
|
+ </n-form-item>
|
|
|
+ </n-form>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
|
|
|
<style scoped></style>
|