<template>
  <view class='content'>
    <view class='title'>
      欢迎登录VIP顾客中心
    </view>

    <image class='logo' :src='assetsUrl("ic_logo.jpeg")' />

    <button class='login-btn' @tap='wechatLogin'>
      微信登录
    </button>
    <view class='hint'>
      登录代表同意
      <text class='link'>
        用户协议、隐私政策，
      </text>
      并授权使用您的账号信息（如昵称、头像、收获地址）以便您统一管理
    </view>
  </view>
</template>

<script setup lang='ts'>
import { useUserStore } from '@/store';
import { assetsUrl } from '@/utils/assets';

const userStore = useUserStore();

function wechatLogin() {
  uni.showLoading();
  userStore.authLogin().then(() => {
    uni.hideLoading();
    uni.reLaunch({ url: '/pages/home/index' });
  });
}
</script>

<style lang='scss' scoped>
.content {
  background: #FFFFFF;
  height: 100vh;
}

.title {
  font-size: 60rpx;
  text-align: left;
  font-weight: 500;
  margin: 50rpx;
}

.logo {
  width: 300rpx;
  height: 300rpx;
  align-self: center;
  margin: 30rpx;
  border-radius: 50%;
}

.login-btn {
  padding: 12rpx 0;
  font-size: 30rpx;
  color: #FFFFFF;
  background-color: #1cbf1e;
  border: none;
  border-radius: 45rpx;
  margin: 100rpx 45rpx 0 45rpx;

  &::after {
    border: none;
  }
}

.hint {
  padding: 20rpx 50rpx;
  font-size: 20rpx;
  color: $u-tips-color;
  position: absolute;
  bottom: 0;

  .link {
    color: $u-warning;
  }
}
</style>
