import Layout from "@/components/layout/Layout";
import { View } from "@tarojs/components";
import Taro, { useDidShow } from "@tarojs/taro";
import React from "react";
import { usePageContent } from "./hooks";

const BizCardTpl02 = React.lazy(() =>
  import("@/components/business").then((module) => ({
    default: module.BizCardTpl02,
  })),
);

export default function Index() {
  const { pageLoading, pageContent, refresherConfig, loadPageContent } = usePageContent();

  useDidShow(async () => {
    await loadPageContent("测试身份编码");
    Taro.switchTab({ url: "/pages/index/index" });
    console.log("Page shown.");
  });
  
  return (
    <Layout loadding={pageLoading}>
      <Layout.Header hideBack={false}>{pageContent}</Layout.Header>
      <Layout.Container
        className="bg-bg-gray"
        refresherConfig={refresherConfig}
      >
        <View className="space-y-4 p-3">
            <BizCardTpl02 />
            <BizCardTpl02 />
        </View>
      </Layout.Container>
      {/* <Layout.Footer>
        <View className="flex items-center text-title pt-3">
           <View className="flex-1 text-center border-r border-gray-300 text-primary">首页</View>
           <View className="flex-1 text-center border-r border-gray-300">产品</View>
           <View className="flex-1 text-center border-r border-gray-300">案例</View>
           <View className="flex-1 text-center">我的</View>
        </View>
      </Layout.Footer> */}
    </Layout>
  );
}
