<template>
  <BasicLayout>
    <view class="p-15">
      <BasicForm @register="register"> </BasicForm>
      <BasicSign ref="signCompRef" :title="signTitle"></BasicSign>
    </view>
    <template #bottom>
      <view class="flex-row items-center pb-10 pt-5">
        <u-button
          text="返回"
          class="ml-15 mr-7"
          :plain="true"
          @click="navigateBack"
        />
        <u-button
          text="签名"
          class="mr-15 mr-7"
          type="primary"
          @click="submit"
        />
      </view>
    </template>
  </BasicLayout>
</template>

<script setup lang="ts">
import { ref } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import { navigateBack, navigateTo } from "@/utils/uniapp";
import { cloneDeep } from "lodash";
const leaveId = ref<string | null>(null);
const signCompRef = ref<any>(null);
import { useForm } from "@/components/BasicForm/hooks/useForm";

const [register, { getValue }] = useForm({
  formsProps: {
    labelWidth: 120,
  },
  schema: [
    {
      field: "ttlx",
      label: "上传人像页",
      component: "BasicUpload",
      itemProps: {
        labelPosition: "top",
      },
      componentProps: {},
    },
    {
      field: "ttlx",
      label: "上传国徽页",
      component: "BasicUpload",
      itemProps: {
        labelPosition: "top",
      },
      componentProps: {},
    },
    {
      field: "ttlx",
      label: "第一学历毕业证",
      component: "BasicUpload",
      itemProps: {
        labelPosition: "top",
      },
      componentProps: {},
    },
    {
      field: "ttlx",
      label: "第一学历学位证",
      component: "BasicUpload",
      itemProps: {
        labelPosition: "top",
      },
      componentProps: {},
    },
    {
      field: "ttlx",
      label: "最高学历毕业证",
      component: "BasicUpload",
      itemProps: {
        labelPosition: "top",
      },
      componentProps: {},
    },
    {
      field: "ttlx",
      label: "最高学历学位证",
      component: "BasicUpload",
      itemProps: {
        labelPosition: "top",
      },
      componentProps: {},
    },
    {
      field: "ttlx",
      label: "普通话证明",
      component: "BasicUpload",
      itemProps: {
        labelPosition: "top",
      },
      componentProps: {},
    },
    {
      field: "ttlx",
      label: "教师资格证",
      component: "BasicUpload",
      itemProps: {
        labelPosition: "top",
      },
      componentProps: {},
    },
  ],
});

async function submit() {
  const data = await signCompRef.value.getSyncSignature();
  console.log(data);
}
</script>

<style lang="scss" scoped>
.delete-icon {
  position: absolute;
  right: 0;
  top: 0;
  z-index: 1;
}
</style>
