<template>
  <view>

    <view class="mt-115rpx">
      <uv-button block type="primary_btn1" shape="circle" open-type="getPhoneNumber"
                 @getphonenumber="getPhoneNumber">微信一键登录
      </uv-button>
      <view class="mt-31rpx">
        <cu-checkbox v-model="checkbox">
          <view class="flex items-center flex-wrap text-23rpx leading-33rpx text-hex-333333">
            <view class="text-hex-999999 float-left">
              登录即代表同意
            </view>
            <text>《用户协议》《隐私政策》</text>
            <text class="text-hex-999999">
              及
            </text>
            <text>《第三方SDK类服务商说明》</text>
          </view>
        </cu-checkbox>
      </view>
    </view>
  </view>
</template>

<script setup>
import CuCheckbox from "@/components/CuCheckbox/cu-checkbox.vue";
import {ref} from 'vue'
import {useUserStore} from "@/store/modules/user";

const userStore = useUserStore()
const checkbox = ref(false)

const getPhoneNumber = (e) => {

  const {appId, version} = uni.getAccountInfoSync().miniProgram
  userStore.wchatLogin({
    appId,
    version,
    type: 'getPhoneNumber',
    code: e.code
  })

  uni.switchTab({
    url: '/pages/tabbar/home',
  })

}
</script>

<style scoped lang="scss">

</style>