first commit
This commit is contained in:
@@ -0,0 +1,126 @@
|
||||
<!--#
|
||||
layout("/mobile/platform.html"){
|
||||
#-->
|
||||
|
||||
<style>
|
||||
#app {
|
||||
background: #FFFFFF;
|
||||
}
|
||||
|
||||
#signature {
|
||||
/*height: calc(100vh - 136px);*/
|
||||
height: 300px;
|
||||
background: #fff;
|
||||
border: 1px dashed grey;
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
.button-operation {
|
||||
display: flex;
|
||||
height: 50px;
|
||||
align-items: center;
|
||||
position: fixed;
|
||||
/*bottom: 0;*/
|
||||
width: 100%;
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
.button-operation > div {
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
margin: 0 10px;
|
||||
}
|
||||
|
||||
.button-operation > div > button {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<van-sticky>
|
||||
<van-nav-bar title="我的签名" left-arrow
|
||||
@click-left="history.go(-1)"></van-nav-bar>
|
||||
</van-sticky>
|
||||
<div id="signature"></div>
|
||||
<div class="button-operation">
|
||||
<div>
|
||||
<van-button type="danger" @click="reset">重写</van-button>
|
||||
</div>
|
||||
<div>
|
||||
<van-button type="info" @click="save">保存</van-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
<!--#include("/mobile/welfare/include/mixins.js"){}#-->
|
||||
|
||||
const vue = new Vue({
|
||||
el: '#app',
|
||||
mixins: [mobileMixins, welfareMixins],
|
||||
data() {
|
||||
return {
|
||||
userSign: {
|
||||
data: null
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
reset() {
|
||||
const val = $('#signature').jSignature("getData", "default")
|
||||
$('#signature').jSignature('clear')
|
||||
this.userSign.data = null
|
||||
},
|
||||
async save() {
|
||||
const slength = $("#signature").jSignature('getData', 'native').length
|
||||
if (slength === 0 && !this.userSign.data) {
|
||||
this.$toast('请先签字!')
|
||||
return
|
||||
}
|
||||
|
||||
const loading = this.$toast.loading({
|
||||
message: '保存中...',
|
||||
forbidClick: true,
|
||||
overlay: true,
|
||||
duration: 0
|
||||
})
|
||||
this.userSign.data = $('#signature').jSignature("getData", "default")
|
||||
const resp = await $.post('/mobile/welfare/mine/saveMySignature', this.userSign)
|
||||
loading.close()
|
||||
if (resp.code === 0) {
|
||||
this.userSign = resp.data
|
||||
this.$toast.success('保存成功!')
|
||||
}
|
||||
},
|
||||
async getSignature() {
|
||||
const resp = await $.get('/mobile/welfare/mine/getMySignature')
|
||||
if (resp.code === 0) {
|
||||
this.userSign = resp.data
|
||||
if (this.userSign.data) {
|
||||
$('#signature').jSignature("setData", resp.data.data)
|
||||
// $('#signature').jSignature("importData", resp.data.data)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
$('#signature').jSignature({
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
lineWidth: 1
|
||||
})
|
||||
document.body.addEventListener('touchmove', function (e) {
|
||||
e.preventDefault(); //阻止默认的处理方式(阻止下拉滑动的效果)
|
||||
}, {passive: false}); //passive 参数不能省略,用来兼容ios和android
|
||||
},
|
||||
created() {
|
||||
this.getSignature()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
Reference in New Issue
Block a user