<!-- 个人中心：支持装修 -->
<template>
  <s-layout
    title="我的"
    tabbar="/pages/index/user"
    navbar="custom"
    :bgStyle="template.page"
    :navbarStyle="template.style?.navbar"
    onShareAppMessage
  >
	
    <s-block v-for="(item, index) in template.components" :key="index" :styles="item.property.style">
      <s-block-item :type="item.id" :data="item.property" :styles="item.property.style" />
    </s-block>
  </s-layout>
</template>

<script setup>
  import { computed } from 'vue';
  import { onShow, onPageScroll, onPullDownRefresh,onLoad } from '@dcloudio/uni-app';
  import sheep from '@/sheep';
	import {
		closeShareModal,
		showAuthModal
	} from '@/sheep/hooks/useModal';
  // 隐藏原生tabBar
  uni.hideTabBar();

  const template = computed(() => sheep.$store('app').template.user);
  const isLogin = computed(() => sheep.$store('user').isLogin);

  onShow(() => {
    sheep.$store('user').updateUserData();
  });

  onPullDownRefresh(() => {
    sheep.$store('user').updateUserData();
    setTimeout(function () {
      uni.stopPullDownRefresh();
    }, 800);
  });

  onPageScroll(() => {});
  
  onLoad((options) => {
	  uni.setStorageSync("linkId",74)
	  console.log("user.vue设置了缓存",uni.getStorageSync('linkId'))
  	if (options.linkId) {
		sheep.$helper.toast('您只能通过分享注册');
  		uni.setStorageSync("linkId",options.linkId)
  	}
	if (!isLogin.value) {
		showAuthModal();
	}
  });
</script>

<style></style>
