<template>
  <cc-root-view>
    <view class="index_content">
      <cc-scroll-loading :meta="useModel?.metaData?.value" @load="method?.loadMore">
        <MyHeaderTitle />
        <MyShowData />
        <MyClassIfication />
        <MyToDeDone />
      </cc-scroll-loading>
    </view>
  </cc-root-view>
</template>
<script setup lang="ts">
import getUser from '@/common/libraries/userUserLogin'
import { onShareAppMessage, onShareTimeline, onShow } from '@dcloudio/uni-app'
import { getCurrentInstance } from 'vue'
import MyClassIfication from './components/Classification.vue'
import MyHeaderTitle from './components/HeaderTitle.vue'
import MyShowData from './components/ShowData.vue'
import MyToDeDone from './components/ToDeDone.vue'
import method from './method'
import useModel from './model'

onShow(async () => {
  // setTabBarData(0)
  await getCurrentInstance()?.appContext.config.globalProperties.$onLaunched
  if (getUser?.getLoginStatus()) {
    useModel.formData.value.page = 1
    useModel.listData.value = []
    method?.getCountGridHouse()
    method?.getCompanyEmployeeBacklogs()
    method?.getIndexCount()
  } else {
    useModel.userData.value = undefined
    useModel.listData.value = []
    useModel.metaData.value = { total: 0 }
  }
})

onShareAppMessage(() => {
  return {
    title: '',
    path: '/pages/index/index'
  }
})
onShareTimeline(() => {
  return {
    title: '',
    path: '/pages/index/index'
  }
})
</script>

<style lang="scss">
@import './style.scss';
</style>
