<template>
    <view class="login-box" v-show="showLoginModal">
        <button open-type="getUserInfo" @click="getUserInfo">授权登录</button>
    </view>
</template>

<script>
import { mapState } from "vuex";
export default {
    name: "component-auth-login",
    data() {
        return {};
    },
    props: {},
    components: {},
    computed: {
        ...mapState("user", {
            showLoginModal: (state) => state.showLoginModal,
        }),
    },
    created() {},
    mounted() {},
    methods: {
        getUserInfo() {
            this.$store.dispatch("user/userInfo");
            setTimeout(() => {
                this.$store.commit("user/showLoginModal", false);
            }, 2000);
        },
    },
};
</script>

<style lang="less" scoped>
.login-box {
    z-index: 25;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #e0e0e0;
}
</style>