import { Apis } from '@/gen/Apis'
import { useWeAppAuthStore } from '../store/useWeAppAuthStore'
const auth = useWeAppAuthStore()
export default {
  onBindPhone() {
    console.log('auth?.userInfo:', auth?.data)
    if (!auth?.data?.user) {
      // 未绑定手机号
      uni.showModal({
        title: '登录',
        content: '请先登录体验更多功能！',
        success: function (res) {
          if (res.confirm) {
            uni.navigateTo({
              url: '/pages/login'
            })
            console.log('用户点击确定')
          } else if (res.cancel) {
            console.log('用户点击取消')
          }
        }
      })
      return false
    } else {
      return true
    }
  },
  getLoginStatus() {
    console.log('auth?.data?.user:', auth?.data?.user)
    if (!auth?.data?.user) {
      // 是否登录
      return false
    } else {
      return true
    }
  }
}
