<template>
  <div id="index_login_container" class="animation-slide-right">
    <view class="solid-bottom text-xl padding text-center">
      <text class=" text-bold title_color">欢迎来到水母星球！</text>
    </view>
    <view class="text-df text-center slogen">在此你将会体验到操控专注力的神奇感觉</view>
    <div class="sub_slogen text-center">
      现在，开始你的专注力旅程吧!
    </div>

    <div class="text-center padding">
      <button class="cu-btn lg cu-btn-primary text-white text-center" @click="to_regist(0)">开始体验</button>
    </div>
    <view class="text-center text-xs">
      <text class="text-gray">如果您在我们的实体店，请在店员的指导下链接脑环</text>
    </view>
    <view class="text-center text-lg padding" @click="to_regist(1)">
      <text class="text-gray under_line">账号登录</text>
    </view>
    <van-toast id="van-toast"/>

  </div>
</template>
<script>
import Toast from '../../../static/vant/toast/toast';

export default {
  name: "login_container",
  methods: {
    to_regist($status) {
      this.$emit('changeStatus', 'regist')
      this.$emit('changeTitle', $status)
    },
    to_scan() {
      this.$emit('to_scan', 'scan')
    }
  },
  onLoad(options) {
    // 原有的code
    let $_code = wx.getStorageSync('code')

    if (options.q) {
      let url = decodeURIComponent(options.q)
      let $code = url.match(/\?code=(.*)/)[1];

      this.$store.commit('set_invite_code', $code)
      console.log('1---' + $_code, '2---' + $code)
      //判断新的code 和 旧的code 是否一致 不一致则重新登录
      if ($_code && $_code != $code) {
        Toast.fail('该用户已绑定邀请码')
      }

    }
    else {
      // 跳转到关于水母页面
      this.$emit('changeStatus', 'scan')
    }
  }
}
</script>
<style>

</style>
