<template>
  <view class="sign">
    <uv-form-item
      :labelWidth="100"
      :label="item?.taskFiledValue"
      :borderBottom="false"
      labelPosition="top"
      :required="item?.isMustfill == '1'"
    >
      <view class="sign-box" @click="signatureClick">
        <view class="signature">
          <image v-if="imgShow" :src="imgUrl" mode="aspectFit" class="image" alt="" />
          <text v-else>签 名 区</text>
        </view>
      </view>
    </uv-form-item>
  </view>
</template>

<script setup lang="ts">
import { onMounted, ref } from 'vue'
let props = defineProps({
  item: Object,
  sendParams: Object
})
const signatureClick = () => {
  uni.navigateTo({
    url: `/pages-sub-task/signature/index?type=task&taskFiledKey=${props?.item?.taskFiledKey}`
  })
}

const imgShow = ref(false)
const imgUrl = ref()
const imgInfo = (url: string) => {
  imgShow.value = true
  imgUrl.value = import.meta.env.VITE_APP_URL + url
}
onMounted(() => {
  uni.$on('imgShow', function (data) {
    imgInfo(data)
  })
})
</script>

<style lang="scss" scoped>
.sign-box {
  padding: 20rpx;
  background: #ffffff;
  .signature {
    margin: 0 auto;
    width: 80%;
    height: 150rpx;
    border-radius: 30rpx;
    border: 1px solid #ccc;
    line-height: 150rpx;
    text-align: center;
    text {
      color: #d7d7d7;
      font-size: 50rpx;
    }
    .image {
      height: 150rpx;
    }
  }
}
</style>
