<template>
    <div class="page">
        <!-- pages/login/login.wxml -->
        <view class="login-page">
            <nav-bar class="nav-bar">
                <template #title>   <text class="student">登录</text> </template>
            </nav-bar>
            <view class="title">
                <text class="t1">乐业观山湖</text>
                <text class="t2">您最贴心的求职小伙伴</text>
            </view>
            <button class="login-btn" @click="login">授权手机号登录</button>
        </view>
        {{ res }}
    </div>
</template>

<script setup>
import NavBar from "@/components/navBar/index.vue";
import { xinhuaMpLogin } from "@/api/user.js";
import { setToken } from "@/utils/token";
const res = ref("");
const login = () => {
    xma.xh.getUserProfile({
        range: ["ACCOUNT", "MOBILE"],
        success(info) {
            xinhuaMpLogin({ encryptedData: info.data.uMobile, userType: "business" })
                .then(data => {
                    res.value = data;
                    setToken(data.token);
                })
                .catch(err => {
                    res.value = err;
                });
        },
        fail(err) {
            test.value = err;
        }
    });
    getLoginUserApi().then(res => {
        console.log(res);
    });
};
</script>

<style lang="scss" scoped>
.page {
    height: 100%;
    background-color: #eaf5ff;
}
.login-page {
    height: 100%;
    background-image: url("https://lygsh-image.wjzpgz.com/login/loginBG.png");
    background-repeat: no-repeat;
    background-position: 50% 50%;
    background-size: auto 100%;
    .student {
        font-size: 36rpx;
        font-weight: 600;
        color: #1b2026;
        text-align: center;
    }
    .title {
        display: flex;
        flex-direction: column;
        margin-top: 176rpx;
        text-align: center;
        .t1 {
            font-size: 80rpx;
            font-weight: normal;
            color: #0e2761;
        }
        .t2 {
            font-size: 24rpx;
            color: #1b2026;
        }
    }
    .login-btn {
        position: absolute;
        bottom: 336rpx;
        left: 50%;
        width: 640rpx;
        height: 96rpx;
        font-size: 34rpx;
        line-height: 96rpx;
        color: #ffffff;
        background-color: #1f86ff;
        transform: translate(-50%, 0);
    }
}
</style>
