|
@@ -40,17 +40,18 @@
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
-import { reactive, ref } from "vue";
|
|
|
+import { reactive, ref, inject } from "vue";
|
|
|
import { useRouter } from "vue-router";
|
|
|
import loginLogo from "@/assets/login/login_logo.png";
|
|
|
import qiyeweixin from "@/assets/login/qiyeweixin.png";
|
|
|
import { UserFilled, Lock } from '@element-plus/icons-vue'
|
|
|
-import type { FormInstance, FormRules } from 'element-plus'
|
|
|
+import { ElMessage, type FormInstance, type FormRules } from 'element-plus'
|
|
|
import { useStore } from '@/store/index'
|
|
|
import { post } from "@/utils/request";
|
|
|
import { LOGIN } from "./api";
|
|
|
const { setRouters } = useStore()
|
|
|
const router = useRouter();
|
|
|
+const globalPopup = inject<GlobalPopup>('globalPopup')
|
|
|
const ruleFormRef = ref<FormInstance>();
|
|
|
const ruleForm = ref({
|
|
|
username: "",
|
|
@@ -75,11 +76,27 @@ const login = (formEl: FormInstance | undefined) => {
|
|
|
console.log(ruleForm.value);
|
|
|
post(LOGIN, { ...ruleForm.value }).then(res => {
|
|
|
console.log(res);
|
|
|
- setTimeout(() => {
|
|
|
- loginLoading.value = false;
|
|
|
- }, 1000)
|
|
|
+ globalPopup.showSuccess('登录成功')
|
|
|
+ // if(res.code == 'error') {
|
|
|
+ // ElMessage.error({
|
|
|
+ // message: "登录失败",
|
|
|
+ // type: "error",
|
|
|
+ // duration: 2000,
|
|
|
+ // })
|
|
|
+ // loginLoading.value = false;
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ // ElMessage.success({
|
|
|
+ // message: "登录成功",
|
|
|
+ // type: "success",
|
|
|
+ // duration: 2000,
|
|
|
+ // })
|
|
|
+ // setTimeout(() => {
|
|
|
+ // loginLoading.value = false;
|
|
|
+ // }, 1000)
|
|
|
// loginLoading.value = false;
|
|
|
}).catch(err => {
|
|
|
+ console.log(err)
|
|
|
loginLoading.value = false;
|
|
|
})
|
|
|
return
|