commit
This commit is contained in:
@@ -10,12 +10,13 @@
|
||||
</el-collapse-transition>
|
||||
|
||||
<el-image fit="contain" v-show="!showQrCode" v-loading="loading"
|
||||
style="height: 100px;width: 100%" :src="qz">
|
||||
style="height: 100px;width: 100%" :src="imageUrl">
|
||||
<div slot="error" class="image-slot">
|
||||
<i class="el-icon-picture-outline"></i>
|
||||
</div>
|
||||
</el-image>
|
||||
<el-link type="danger" style="font-size: 12px;margin-top: 20px" @click="refresh();clear()" icon="el-icon-edit"
|
||||
<el-link type="danger" style="font-size: 12px;margin-top: 20px" @click="refresh();clear()"
|
||||
icon="el-icon-edit"
|
||||
v-show="!showQrCode">重签
|
||||
</el-link>
|
||||
</div>
|
||||
@@ -42,6 +43,14 @@ module.exports = {
|
||||
qz: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
value: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
is_value_base64: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
},
|
||||
model: {
|
||||
@@ -53,26 +62,37 @@ module.exports = {
|
||||
showQrCode: false,
|
||||
loading: true,
|
||||
postAddress: '',
|
||||
imageUrl: '',
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
refresh() {
|
||||
this.qz = ''
|
||||
},
|
||||
getImageUrl(value) {
|
||||
if (this.is_value_base64) {
|
||||
this.imageUrl = value
|
||||
} else {
|
||||
this.imageUrl = '/signature/getSignData?path=' + value
|
||||
}
|
||||
},
|
||||
startRequest() {
|
||||
this.qz = ''
|
||||
this.imageUrl = ''
|
||||
clearInterval(signatureInterval)
|
||||
const ts = new Date().getTime()
|
||||
this.postAddress = location.protocol + '//' + location.host + '/signature?prefix=' + this.prefix + '&id=' + ts
|
||||
const ts = new Date().getTime() + (Math.floor(Math.random() * (1000 - 1 + 1)) + 1).toString()
|
||||
console.log(ts)
|
||||
this.postAddress = location.protocol + '//' + location.host + '/signature?prefix=' + this.prefix + '&id=' + ts + "&is_value_base64=" + this.is_value_base64
|
||||
// this.postAddress = 'http://zhgh.jiangnan.edu.cn/signature?prefix=' + this.prefix + '&id=' + ts + "&is_value_base64=" + this.is_value_base64
|
||||
|
||||
this.showQrCode = true
|
||||
|
||||
console.log(this.postAddress)
|
||||
window.signatureInterval = setInterval(() => {
|
||||
$.get(base + "/signature/getBase64?prefix=" + this.prefix + "&id=" + ts).then(res => {
|
||||
$.get("/signature/getBase64?prefix=" + this.prefix + "&id=" + ts).then(res => {
|
||||
if (res != null) {
|
||||
this.$emit("change", res)
|
||||
this.$emit("update:qz", res)
|
||||
this.getImageUrl(res)
|
||||
this.qz = res
|
||||
this.loading = false
|
||||
this.save()
|
||||
@@ -81,23 +101,57 @@ module.exports = {
|
||||
})
|
||||
}, 1000 * 3)
|
||||
},
|
||||
save() {
|
||||
localStorage.setItem("signature", this.qz)
|
||||
async save() {
|
||||
if (this.is_value_base64) {
|
||||
localStorage.setItem("signature", this.qz)
|
||||
} else {
|
||||
return localStorage.setItem("signatureWelfare", this.qz)
|
||||
}
|
||||
},
|
||||
clear() {
|
||||
localStorage.removeItem("signature")
|
||||
if (this.is_value_base64) {
|
||||
localStorage.removeItem("signature")
|
||||
} else {
|
||||
localStorage.removeItem("signatureWelfare")
|
||||
}
|
||||
|
||||
},
|
||||
getSignature() {
|
||||
return localStorage.getItem("signature")
|
||||
if (this.is_value_base64) {
|
||||
return localStorage.getItem("signature")
|
||||
} else {
|
||||
return localStorage.getItem("signatureWelfare")
|
||||
}
|
||||
},
|
||||
async getMySign() {
|
||||
setTimeout(() => {
|
||||
if (this.qz) {
|
||||
this.getImageUrl(this.qz)
|
||||
} else {
|
||||
$.get("/mobile/common/signing/getMySign", {prefix: this.prefix}).then(data => {
|
||||
if (data) {
|
||||
this.getImageUrl(data)
|
||||
this.$emit("change", data)
|
||||
this.$emit("update:qz", data)
|
||||
this.qz = data
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
}, 500)
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getMySign()
|
||||
},
|
||||
watch: {
|
||||
'qz': {
|
||||
handler(s) {
|
||||
this.loading = !s
|
||||
if (!s) {
|
||||
const qz = this.getSignature()
|
||||
|
||||
if (!qz) {
|
||||
this.$emit("change", '')
|
||||
this.$emit("update:qz", '')
|
||||
@@ -107,7 +161,6 @@ module.exports = {
|
||||
this.$emit("change", qz)
|
||||
this.$emit("update:qz", qz)
|
||||
}
|
||||
|
||||
} else {
|
||||
this.qz = s
|
||||
this.showQrCode = false
|
||||
@@ -147,4 +200,4 @@ module.exports = {
|
||||
flex-direction: column;
|
||||
z-index: 999;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user