yearning
16 小时以前 63fea2990e587837ed3dde2b9ac8f2b4ef729672
src/views/components/Signature.vue
@@ -2,10 +2,12 @@
  <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>
      <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" :src="imageUrl.includes('data:image/png') ? imageUrl : $qxueyou.qxyRes + imageUrl"></el-image>
    <div v-else class="image-slot"></div>
    <el-dialog 
@@ -68,6 +70,10 @@
    modelValue: {
      type: String,
      default: ''
    },
    disabled: {
      type: Boolean,
      default: false
    }
  },
  computed: {
@@ -193,9 +199,11 @@
      }
      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
      // 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){