<script setup>
import {reactive} from "vue";
import XInput from "../../components/XInput.vue";
import {toPage} from "../../utils/uils.js";
import SendMsg from "../../components/SendMsg.vue";
import {useUserStore} from "../../pinia/UserStore/index.js";

const {login} = useUserStore();

const form = reactive({
    phone: null,
    verificationCode: null,
});

const success = async () => {
    login();
    toPage('/pages/home/index');
}
</script>

<template>
    <view class="!px-[34rpx] !flex flex-col gap-[40rpx]">
        <x-input v-model:model-value="form.phone" placeholder="请输入手机号"></x-input>
        <send-msg v-model:model-value="form.verificationCode"></send-msg>
        <tui-button class="!mt-[80rpx]" @click="success">登录</tui-button>
        <tui-button @click="toPage('/pages/register/index')" class="!mt-[40rpx]" plain link>
            <image class="!h-[26rpx]" mode="heightFix" src="../../static/icons/去注册.png"></image>
        </tui-button>
    </view>
</template>

<style scoped>

</style>
