wwf
16 小时以前 4e6f18dfa08e2f2f4f02aaa1b8e8e51852b7a9a1
src/views/main/components/Signature.vue
@@ -1,11 +1,17 @@
<template>
  <div class="signature">
    <el-row justify="space-between">
      <el-text>签名</el-text>
      <el-text v-if="imageUrl" @click="imageUrl=''">清除签名</el-text>
      <el-text v-else @click="signatureDialog=true">点击签名</el-text>
      <el-text>{{isRequire?'*':''}}签名</el-text>
      <template v-if="!disabled">
        <el-text v-if="imageUrl" @click="imageUrl=''">清除签名</el-text>
        <el-text v-else @click="signatureDialog=true">点击签名</el-text>
      </template>
    </el-row>
    <el-image v-if="imageUrl" :src="imageUrl"></el-image>
    <el-image
      v-if="imageUrl"
      style="width: 100%;"
      :src="imageUrl.includes('http') ? imageUrl : $qxueyou.qxyRes + imageUrl">
    </el-image>
    <div v-else class="image-slot"></div>
    <el-dialog 
@@ -68,6 +74,14 @@
    modelValue: {
      type: String,
      default: ''
    },
    isRequire: {
      type: Boolean,
      default: false
    },
    disabled: {
      type: Boolean,
      default: false
    }
  },
  computed: {
@@ -193,9 +207,10 @@
      }
      let base64 = this.editCanvas.toDataURL('image/png', 1)
      let smallBase64 = await this.resizedataURL(base64, 240, 80)
      // let url = await uploadByBase64(smallBase64, '签名')
      // if (!url) return false
      this.imageUrl = smallBase64
      let url = await uploadByBase64(smallBase64, '签名')
      if (!url) return false
      this.imageUrl = url
      this.$emit('update:modelValue', url)
      this.signatureDialog = false
    },
    resizedataURL: function(base64, wantedWidth, wantedHeight){