Files
FirstUI-vue/pages/component/canvas/autograph/autograph.vue
2023-08-17 21:28:49 +08:00

111 lines
2.6 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!--本文件由FirstUI授权予新疆天衡创新研究院有限公司手机号 186 1407 25 4 9身份证尾号5A07X5专用请尊重知识产权勿私下传播违者追究法律责任-->
<template>
<view class="fui-wrap">
<view class="fui-page__hd">
<view class="fui-page__title fui-align__center" @tap="vip">Autograph <image
src="/static/images/index/light/icon_member_3x.png"></image>
</view>
<view class="fui-page__desc">Autograph 手写签名用于手写电子签名</view>
</view>
<view class="fui-page__bd">
<view class="fui-section__title">请在下方空白处签名</view>
<fui-autograph ref="autograph" @ready="ready"></fui-autograph>
<view class="fui-btn__box">
<fui-button type="gray" btn-size="medium" text="重签" bold :margin="['64rpx','0','24rpx']"
@click="redraw">
</fui-button>
<fui-button type="gray" btn-size="medium" text="完成" bold @click="complete">
</fui-button>
</view>
<view class="fui-autograph__box">
<text class="fui-text">您的签名</text>
<image :src="src" v-if="src" mode="widthFix" class="fui-img" @tap="preview"></image>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
canvasId: '',
src: ''
}
},
methods: {
vip() {
this.fui.href("/pages/my/qa/qa?index=2&title=VIP专属内容")
},
ready(e) {
// #ifdef MP-TOUTIAO
//仅允许边缘滑动返回
// tt.setSwipeBackMode(2);
// #endif
this.canvasId = e.canvasId
},
redraw() {
if (!this.canvasId) return;
this.src = '';
this.$refs.autograph.redraw()
},
complete() {
if (!this.canvasId || this.src) return;
this.$refs.autograph.drawComplete((res) => {
//res为签名图片
this.src = res;
})
},
preview() {
if (!this.src) return;
/*百度小程序只支持打开网络路径,不支持本地临时路径*/
// #ifndef MP-BAIDU
uni.previewImage({
// #ifdef MP-ALIPAY
enablesavephoto: true,
enableShowPhotoDownload: true,
// #endif
urls: [this.src]
})
// #endif
}
}
}
</script>
<style>
page {
font-weight: normal;
}
.fui-section__title {
margin-left: 32rpx;
}
.fui-btn__box {
width: 100%;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
}
.fui-autograph__box {
width: 100%;
height: 200rpx;
padding: 64rpx 32rpx;
box-sizing: border-box;
display: flex;
align-items: center;
}
.fui-text {
font-size: 24rpx;
color: #7f7f7f;
}
.fui-img {
display: block;
width: 200rpx;
}
</style>