完成url获取用户账号功能
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
* @Author: Kane
|
||||
* @Date: 2023-02-28 00:57:21
|
||||
* @LastEditors: Kane
|
||||
* @FilePath: /deskop_task_schedule/code/web/task_schedule/src/components/login/Login.vue
|
||||
* @FilePath: /deskop_task_schedule/code/web/task_schedule/src/views/Login.vue
|
||||
* @Description:
|
||||
* 登录页面,路由默认指向这个页面
|
||||
* 1、判断url中的参数,取得用户信息,根据用户的部门改变路由
|
||||
@@ -10,15 +10,16 @@
|
||||
* Copyright (c) ${2022} by Kane, All Rights Reserved.
|
||||
-->
|
||||
<template>
|
||||
<span>{{ ui.p13uid }}</span>
|
||||
<br>
|
||||
<span>存储的P13:{{ ui.savedP13uid }}
|
||||
</span>
|
||||
<div class="page-wrap">
|
||||
<span v-show="ui.showNeedAccountTip">请在链接中提供用户的P13账号或P09工号。</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { reactive } from "vue";
|
||||
import { service as instance } from "@/utils/api/request";
|
||||
import { getParamsFromURL } from "@/utils/api/url";
|
||||
|
||||
|
||||
const URL = "http://222.76.244.118:11001/admin-system/account/p13_account_check";
|
||||
|
||||
@@ -29,40 +30,39 @@ export default {
|
||||
const ui = reactive({
|
||||
p13uid: "",
|
||||
savedP13uid: "",
|
||||
showNeedAccountTip: false,
|
||||
});
|
||||
|
||||
//根据url获取用户账号
|
||||
const urlParams = getParamsFromURL(window.location.href);
|
||||
|
||||
console.log(window.location.href);
|
||||
console.log(urlParams);
|
||||
|
||||
const userInfo = {
|
||||
p13account: "wangwei-202",
|
||||
password: "Kane@1983",
|
||||
};
|
||||
|
||||
instance.request(
|
||||
{
|
||||
method: "post",
|
||||
url: URL,
|
||||
data: userInfo,
|
||||
}
|
||||
)
|
||||
.then((response) =>
|
||||
{
|
||||
// debugger;
|
||||
const data = response.data;
|
||||
|
||||
if (data.success === true)
|
||||
{
|
||||
ui.savedP13uid = data.staff_info;
|
||||
}
|
||||
})
|
||||
.catch((error) =>
|
||||
{
|
||||
ui.savedP13uid = error;
|
||||
});
|
||||
if (urlParams.account == undefined)
|
||||
{
|
||||
ui.showNeedAccountTip = true;
|
||||
}
|
||||
|
||||
return { ui, };
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss"></style>
|
||||
<style scoped>
|
||||
.page-wrap {
|
||||
box-sizing: border-box;
|
||||
height: calc(100vh - 100px);
|
||||
width: calc(100vw - 100px);
|
||||
margin: 50px;
|
||||
border: 1px solid red;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
span {
|
||||
font-size: 30px;
|
||||
color: red;
|
||||
}
|
||||
</style>
|
Reference in New Issue
Block a user