You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
2.6 KiB

<template>
<view>
<view class="news">
<uni-section title="我的签名" type="line" style="padding:0 10rpx;">
<view style="width: 100%;height: 300rpx;background-color: aliceblue;border-radius: 20rpx;" @click="handleTosigeName()">
<image :src="Sign" mode="aspectFit" style=" width: 100%;height: 100%; "></image>
</view>
</uni-section>
</view>
<!-- 弹出搜索框 -->
<u-popup :show="fireModleshow" :round="10" style="text-align: center;">
<view style="align-items: center;padding: 0 10rpx;height: 60vh;">
<!-- 签字 -->
<view class="news">
<uni-forms label-width="80" label-position="top">
<uni-forms-item label="签字">
<view style="width: 100%;height: 250rpx;background-color: aliceblue;border-radius: 20rpx;" @click="handleTosigeName(1)">
<image :src="imgSign" mode="aspectFit" style="width: 100%;height: 100%; "></image>
</view>
</uni-forms-item>
</uni-forms>
<u-button @click="addSigin()" type="primary" size="small" style="width: 80%">确认</u-button>
</view>
</view>
</u-popup>
</view>
</template>
<script>
import { updateUserSignByUser, getUserSignByUserId, getUserProfile } from '@/api/system/user.js';
// 处理base64图片
import { pathToBase64, base64ToPath } from '@/js_sdk/mmmm-image-tools/index.js';
export default {
data() {
return {
id: '',
Sign: '',
imgSign: '',
fireModleshow: false
};
},
onLoad() {
this.getSign();
},
methods: {
getSign() {
getUserProfile().then(res => {
this.id = res.data.user.userId;
getUserSignByUserId(res.data.user.userId).then(res1 => {
if (res1.data === null) {
this.$modal.confirm('暂无签名,前往创建吗?').then(res => {
this.handleTosigeName();
});
} else {
this.Sign = res1.data.sign;
}
});
});
},
// 跳转电子签名
handleTosigeName() {
this.$tab.navigateTo('/pages/common/sign/sigenameTwo');
},
addSigin() {
updateUserSignByUser({ userId: this.id, sign: this.imgSign }).then(res1 => {
//发请求保存
this.fireModleshow = false;
this.getSign();
});
}
},
onShow() {
let that = this;
uni.$on('updateData', function(data) {
//签名参数
pathToBase64(data).then(res => {
that.imgSign = res;
that.fireModleshow = true;
});
//应该使用that,函数作用域问题
});
}
};
</script>
<style lang="scss" scoped>
page {
padding: 20rpx;
box-sizing: border-box;
.news {
background-color: #fff;
border-radius: 20rpx;
padding: 10rpx;
margin-bottom: 20rpx;
}
/deep/.uni-section .uni-section-header {
padding: 12px 0;
}
}
</style>
ll" style="width: 3