|
@@ -0,0 +1,128 @@
|
|
|
+<!--
|
|
|
+ * @Author: your name
|
|
|
+ * @Date: 2021-01-11 11:14:26
|
|
|
+ * @LastEditTime: 2022-04-28 18:35:39
|
|
|
+ * @LastEditors: Please set LastEditors
|
|
|
+ * @Description: In User Settings Edit
|
|
|
+ * @FilePath: \vue3-element-admin\src\views\Login.vue
|
|
|
+-->
|
|
|
+<template>
|
|
|
+ <div style="background-color: #fff; height: 100%;"></div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup>
|
|
|
+import {SET_TOKEN, SET_UNAME, SET_USER_INFO} from "@/store/modules/app/type";
|
|
|
+import Common from "@/components/Common";
|
|
|
+import { ref, reactive, toRefs } from "vue";
|
|
|
+import { useStore } from "vuex";
|
|
|
+import { useRouter } from "vue-router";
|
|
|
+
|
|
|
+// const rules = {
|
|
|
+// phone: [{ required: true, message: "请输入用户名", trigger: "blur" }]
|
|
|
+// };
|
|
|
+
|
|
|
+const rules = {
|
|
|
+ userName: [{ required: true, message: "请输入用户名", trigger: "blur" }]
|
|
|
+ ,
|
|
|
+ pwd: [{ required: true, message: "请输入验证码", trigger: "blur" }
|
|
|
+ ],
|
|
|
+};
|
|
|
+
|
|
|
+const store = useStore();
|
|
|
+const router = useRouter();
|
|
|
+// 定义两个账号
|
|
|
+const guestAccount = { "pwd": "游客", "userName": "游客" };
|
|
|
+const regularAccount = { "pwd": "", "userName": "13797066447" };
|
|
|
+const form = reactive({
|
|
|
+ "pwd": "qz123456789",
|
|
|
+ "userName": "13797066447"
|
|
|
+});
|
|
|
+
|
|
|
+const { userName, pwd } = toRefs(form);
|
|
|
+const ref_form = ref(null);
|
|
|
+const success = ref(false);
|
|
|
+sessionStorage.clear();
|
|
|
+store.commit(`app/${SET_TOKEN}`, "");
|
|
|
+router.options.isAddDynamicMenuRoutes = false;
|
|
|
+
|
|
|
+
|
|
|
+const onSubmit = async () => {
|
|
|
+ const res = await VE_API.system.login(form);
|
|
|
+ if (res.code == 0) {
|
|
|
+ const { token, userName, djiCloudToken } = res.data;
|
|
|
+ store.commit(`app/${SET_TOKEN}`, token);
|
|
|
+ store.commit(`app/djiCloudToken`, djiCloudToken);
|
|
|
+ store.commit(`app/${SET_UNAME}`, userName);
|
|
|
+ res.data["token"] = undefined
|
|
|
+ res.data["x-auth-token"] = undefined
|
|
|
+ res.data["pwd"] = undefined
|
|
|
+ store.commit(`app/${SET_USER_INFO}`, JSON.stringify(res.data));
|
|
|
+ success.value = true;
|
|
|
+ router.push({ name: "Home" });
|
|
|
+ }
|
|
|
+};
|
|
|
+onSubmit()
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.ve_container {
|
|
|
+ position: absolute;
|
|
|
+ z-index: 1;
|
|
|
+ width: 400px;
|
|
|
+ top: calc(50%);
|
|
|
+ left: calc(50% - 250px);
|
|
|
+ transform: translateY(-50%);
|
|
|
+ transition: all 1s;
|
|
|
+ min-height: 273px;
|
|
|
+ text-align: center;
|
|
|
+ h1 {
|
|
|
+ font-size: 24px;
|
|
|
+ transition: all 1s;
|
|
|
+ font-weight: normal;
|
|
|
+ text-align: left;
|
|
|
+ margin-bottom: 36px;
|
|
|
+ }
|
|
|
+ .ve_form {
|
|
|
+ .ve_submit {
|
|
|
+ width: 100%;
|
|
|
+ height: 45px;
|
|
|
+ background: #0BC678;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+.backdrop-layer{
|
|
|
+ position: absolute;
|
|
|
+ top: 0px;
|
|
|
+ bottom: 0px;
|
|
|
+ left: 0px;
|
|
|
+ right: 0px;
|
|
|
+ background: url(@/assets/login_bg.jpg) no-repeat;
|
|
|
+ background-size:100% 100%;
|
|
|
+ z-index: 1;
|
|
|
+ overflow: hidden;
|
|
|
+}
|
|
|
+.head{
|
|
|
+ position: absolute;
|
|
|
+ left: 300px;
|
|
|
+ top: 100px;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ padding: 50px;
|
|
|
+ .title{
|
|
|
+ font-size: 30px;
|
|
|
+ font-weight: bold;
|
|
|
+ color:#006600;
|
|
|
+ float: left;
|
|
|
+ line-height: 50px;
|
|
|
+ margin-left: 20px;
|
|
|
+ }
|
|
|
+ .logo{
|
|
|
+ width: calc(167px * 0.5);
|
|
|
+ height: calc(245px * 0.5);
|
|
|
+ background: url('@/assets/logo-verticle.png') no-repeat;
|
|
|
+ background-size:100% 100%;
|
|
|
+ float: left;
|
|
|
+ z-index: 1000;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|