|
|
|
|
@ -1,10 +1,10 @@
|
|
|
|
|
<template>
|
|
|
|
|
<div class="body">
|
|
|
|
|
<div class="body" id="signed">
|
|
|
|
|
<u-image class="bkg" :src="require('@/static/certificate-bkg.png')" mode="widthFix"></u-image>
|
|
|
|
|
<u-image class="city" mode="widthFix" width="100vw" :src="require('@/static/city.png')"></u-image>
|
|
|
|
|
<u-image class="people" mode="widthFix" :width="298" :src="require('@/static/people.png')"></u-image>
|
|
|
|
|
<u-image mode="widthFix" width="100vw" class="piaodai" :src="require('@/static/piaodai.png')"></u-image>
|
|
|
|
|
<u-image class="share" mode="scaleToFill" :width="99" :height="99" :src="require('@/static/share.png')"> mode=</u-image>
|
|
|
|
|
<u-image id="share-img" v-show="!isHidden" class="share-img" mode="scaleToFill" :width="99" :height="99" :src="require('@/static/share.png')" @click="$u.throttle(share)"> mode=</u-image>
|
|
|
|
|
<div class="content">
|
|
|
|
|
<u-image style="display:flex;align-items: center;margin: auto;" mode="widthFix" :width="335" :src="require('@/static/certificate-word.png')"></u-image>
|
|
|
|
|
|
|
|
|
|
@ -30,13 +30,137 @@
|
|
|
|
|
主办单位:中共苏州市委党史工作办公室 <br>
|
|
|
|
|
承办单位:江苏有线苏州分公司
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<transition name="share-pop" enter-active-class="fade-in" leave-to-class="fade-out">
|
|
|
|
|
<view class="share_cover" v-show="isShare" @click="isShare = false">
|
|
|
|
|
<image src="/static/toShare.png" class="share_cover_arrow"></image>
|
|
|
|
|
<view class="share_cover_word">
|
|
|
|
|
请点击右上角将它发送给指定朋友或分享到朋友圈
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</transition>
|
|
|
|
|
|
|
|
|
|
<view class="share" v-if="isHidden">
|
|
|
|
|
<view class="share-mask" @click="isHidden = false">
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
<view class="share-page">
|
|
|
|
|
<image :src="imgData" mode="widthFix"></image>
|
|
|
|
|
|
|
|
|
|
<view class="share-page__btn">
|
|
|
|
|
<view class="share-page__btn--share" @click="isShare = true">分享</view>
|
|
|
|
|
<view class="share-page__btn--save" @click="save">保存</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import {
|
|
|
|
|
ROOTPATH
|
|
|
|
|
} from '@/common/config.js'
|
|
|
|
|
import {base64ToFile} from '@/common/util'
|
|
|
|
|
import html2canvas from '@/lib/html2canvas.min.js'
|
|
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {};
|
|
|
|
|
return {
|
|
|
|
|
isShare: false,
|
|
|
|
|
isHidden: false,
|
|
|
|
|
imgData: '',
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
showShare () {
|
|
|
|
|
this.isShare = true
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
share() {
|
|
|
|
|
this.isHidden = true
|
|
|
|
|
|
|
|
|
|
uni.showLoading({
|
|
|
|
|
title: '图片生成中..'
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
let dom = document.querySelector('#signed')
|
|
|
|
|
html2canvas(dom, {
|
|
|
|
|
width: dom.clientWidth, //dom 原始宽度
|
|
|
|
|
height: dom.clientHeight,
|
|
|
|
|
scrollY: 0,
|
|
|
|
|
scrollX: 0,
|
|
|
|
|
useCORS: true,
|
|
|
|
|
ignoreElements:(element) => {
|
|
|
|
|
return element.attributes.id == 'share-img'
|
|
|
|
|
}
|
|
|
|
|
}).then(cnv => {
|
|
|
|
|
uni.hideLoading()
|
|
|
|
|
|
|
|
|
|
this.imgData = cnv.toDataURL('image/png', 1)
|
|
|
|
|
}).catch(err => {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: '生成失败,请重试',
|
|
|
|
|
icon: 'error'
|
|
|
|
|
})
|
|
|
|
|
this.isHidden = false
|
|
|
|
|
console.log(err);
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
save() {
|
|
|
|
|
this.$u.throttle(() => {
|
|
|
|
|
let sysinfo = uni.getSystemInfoSync();
|
|
|
|
|
console.log(sysinfo)
|
|
|
|
|
if (sysinfo) {
|
|
|
|
|
if (sysinfo.platform === 'android') {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: "请长按分享图片进行保存或者分享",
|
|
|
|
|
icon: "none"
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
let a = document.createElement("a")
|
|
|
|
|
a.href = this.imgData
|
|
|
|
|
a.setAttribute("download", "gmesign")
|
|
|
|
|
a.click()
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: "请长按分享图片进行保存或者分享",
|
|
|
|
|
icon: "none"
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let form = new FormData()
|
|
|
|
|
form.append('file', base64ToFile(this.imgData, 'sign'))
|
|
|
|
|
form.append('active_tag', 'map_point')
|
|
|
|
|
let vuex_token = this.vuex_token;
|
|
|
|
|
form.append('token', vuex_token)
|
|
|
|
|
let xhr = new XMLHttpRequest()
|
|
|
|
|
xhr.open('post', `${ROOTPATH}/api/mobile/upload-file`)
|
|
|
|
|
|
|
|
|
|
xhr.onreadystatechange = () => {
|
|
|
|
|
if (xhr.status === 200 && xhr.readyState === 4) {
|
|
|
|
|
let val = JSON.parse(xhr.responseText);
|
|
|
|
|
console.log(val);
|
|
|
|
|
this.$u.api.savePoster({
|
|
|
|
|
upload_id: val.id,
|
|
|
|
|
type: 1
|
|
|
|
|
}).then(res => {
|
|
|
|
|
// uni.showToast({
|
|
|
|
|
// title: "保存成功",
|
|
|
|
|
// icon: "none"
|
|
|
|
|
// })
|
|
|
|
|
}).catch(err => {
|
|
|
|
|
// uni.showToast({
|
|
|
|
|
// title: "保存成功",
|
|
|
|
|
// icon: "none"
|
|
|
|
|
// })
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
xhr.send(form)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
@ -95,7 +219,7 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.share {
|
|
|
|
|
.share-img {
|
|
|
|
|
animation: jello-horizontal 3.2s both infinite;
|
|
|
|
|
|
|
|
|
|
position: fixed;
|
|
|
|
|
@ -196,4 +320,128 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.share_cover {
|
|
|
|
|
background: rgba(0, 0, 0, 0.8);
|
|
|
|
|
position: fixed;
|
|
|
|
|
top: 0;
|
|
|
|
|
left: 0;
|
|
|
|
|
right: 0;
|
|
|
|
|
bottom: 0;
|
|
|
|
|
height: 100vh;
|
|
|
|
|
width: 100vw;
|
|
|
|
|
z-index: 100000;
|
|
|
|
|
|
|
|
|
|
.share_cover_word {
|
|
|
|
|
color: #FFFFFF;
|
|
|
|
|
font-size: 48rpx;
|
|
|
|
|
width: 60%;
|
|
|
|
|
margin: 400rpx auto;
|
|
|
|
|
text-align: center;
|
|
|
|
|
line-height: 40px;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.share_cover_arrow {
|
|
|
|
|
position: absolute;
|
|
|
|
|
right: 0;
|
|
|
|
|
top: 0;
|
|
|
|
|
width: 300rpx;
|
|
|
|
|
height: 400rpx;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.share {
|
|
|
|
|
min-height: 100vh;
|
|
|
|
|
overflow-y: scroll;
|
|
|
|
|
|
|
|
|
|
padding: 278rpx 0;
|
|
|
|
|
z-index: 2;
|
|
|
|
|
position: fixed;
|
|
|
|
|
top: 0;
|
|
|
|
|
left: 0;
|
|
|
|
|
right: 0;
|
|
|
|
|
|
|
|
|
|
&-mask {
|
|
|
|
|
background: rgba(0, 0, 0, 0.4);
|
|
|
|
|
|
|
|
|
|
position: fixed;
|
|
|
|
|
top: 0;
|
|
|
|
|
left: 0;
|
|
|
|
|
right: 0;
|
|
|
|
|
bottom: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&-page {
|
|
|
|
|
width: fit-content;
|
|
|
|
|
overflow: scroll;
|
|
|
|
|
|
|
|
|
|
transform: translate(-50%, -50%);
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: 50%;
|
|
|
|
|
left: 50%;
|
|
|
|
|
right: 0;
|
|
|
|
|
|
|
|
|
|
&>image {
|
|
|
|
|
width: 520rpx;
|
|
|
|
|
height: auto;
|
|
|
|
|
display: block;
|
|
|
|
|
border: 6rpx solid #F8E3CF;
|
|
|
|
|
box-shadow: 0rpx 4rpx 20rpx 0rpx rgba(19, 1, 2, 0.71);
|
|
|
|
|
|
|
|
|
|
margin: auto;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&__btn {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
|
|
|
|
padding-top: 52rpx;
|
|
|
|
|
|
|
|
|
|
&>view {
|
|
|
|
|
width: 230rpx;
|
|
|
|
|
height: 66rpx;
|
|
|
|
|
background: linear-gradient(0deg, #EFC495, #E9BC8A);
|
|
|
|
|
border-radius: 34rpx;
|
|
|
|
|
text-align: center;
|
|
|
|
|
font-weight: 400;
|
|
|
|
|
line-height: 66rpx;
|
|
|
|
|
font-size: 26rpx;
|
|
|
|
|
letter-spacing: 8rpx;
|
|
|
|
|
color: #C93E31;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&--share {
|
|
|
|
|
|
|
|
|
|
margin-right: 60rpx;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.fade-in {
|
|
|
|
|
animation: fade-in 1s cubic-bezier(0.390, 0.575, 0.565, 1.000) both;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@keyframes fade-in {
|
|
|
|
|
0% {
|
|
|
|
|
opacity: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
100% {
|
|
|
|
|
opacity: 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.fade-out {
|
|
|
|
|
animation: fade-out .8s ease-out both;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@keyframes fade-out {
|
|
|
|
|
0% {
|
|
|
|
|
opacity: 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
100% {
|
|
|
|
|
opacity: 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
|