Commit 5f1b87f1 by 杨翰文

fix: 先去掉生成

parent 62f69288
......@@ -204,22 +204,21 @@
}
.modal-container{
position: relative;
/* height: 10.65rem; */
}
.poster, .share-pic{
width: 6.51rem;
position: relative;
margin: 0rem auto 0rem;
position: relative;
}
.share-pic {
z-index: 100;
display: block;
}
.poster {
position: absolute;
/* position: absolute;
top: 0;
left: 50%;
transform: translate(-50%, 0);
transform: translate(-50%, 0); */
}
.poster.hide {
transform: translate(-2000px, -2000px);
......@@ -280,7 +279,7 @@
font-weight: bold;
color: #FFFFFF;
line-height: 0.8rem;
text-shadow: 0 0 10px rgba(0,0,0,0.7);
text-shadow: 0 0 0.1rem rgba(0,0,0,1);
}
.poster-content__content{
width: 4.12rem;
......@@ -290,7 +289,7 @@
font-weight: bold;
color: #FFFFFF;
line-height: 0.42rem;
text-shadow: 0 0 10px rgba(0,0,0,0.6);
text-shadow: 0 0 0.1rem rgba(0,0,0,1);
}
.poster-content__qrcode{
width: 1.07rem;
......@@ -354,7 +353,7 @@
<div @click.stop="refreshShareText" class="change-poster-btn">换一换</div>
<div class="poster" ref="postContent" >
<img :src="navs[activeIdx].share_image" class="poster-img" @load="generatePost"/>
<img :src="curShareImg" v-if="curShareImg" class="poster-img" @load="generatePost"/>
<div class="poster-content">
<div class="poster-content__title">{{userInfo.nickname}}的<br/>2020幸运打卡地:丹寨</div>
<div class="poster-content__content">{{shareDesc}}</div>
......@@ -365,7 +364,7 @@
</div>
</div>
</div>
<img :src="postData" alt="" v-if="postData" class="share-pic">
<!-- <img :src="postData" alt="" v-if="postData" class="share-pic"> -->
<div class="poster-action-box">
<div @click.stop="previewImg" class="poster-action-btn">保存图片并发送给好友</div>
<!-- <div @click.stop="shareToFirends" class="poster-action-btn">分享好友</div>-->
......@@ -396,7 +395,8 @@ var vueInstance = new Vue({
posterUrl:'',
navs:[],
userInfo:{},
postData: ''
postData: '',
curShareImg: ''
}
},
methods:{
......@@ -457,13 +457,24 @@ var vueInstance = new Vue({
generatePost() {
setTimeout(() => {
html2canvas(this.$refs.postContent, {
allowTaint: true,
useCORS: true,
backgroundColor: null
}).then((canvas) => {
this.postData = canvas.toDataURL();
});
// alert('start');
try {
html2canvas(this.$refs.postContent, {
allowTaint: true,
useCORS: true,
backgroundColor: null
}).then((canvas) => {
// alert(canvas);
this.postData = canvas.toDataURL();
// alert(this.postData);
}).catch(e => {
// alert(e);
});
} catch(e) {
// alert(e);
}
}, 200)
},
closeModal(){
......@@ -548,7 +559,7 @@ var vueInstance = new Vue({
// // this.posterUrl = currentInfo.poster
//this.showPoster = true
// showModal()
only!=='true' && this.generatePost();
only!==true && this.generatePost();
},
async bindShareEvent(){
......@@ -557,9 +568,10 @@ var vueInstance = new Vue({
this.showPoster = true
// showModal()
},
setActive(idx,initJsSdk=true){
async setActive(idx,initJsSdk=true){
this.activeIdx = Number(idx)
//this.shareDesc = this.navs[this.activeIdx].content
this.curShareImg = (await createImgByAsync(this.navs[this.activeIdx].share_image)).src;
if(initJsSdk)this.shareToFirends()
},
async _init_func(){
......@@ -575,7 +587,8 @@ var vueInstance = new Vue({
// this.setActive(idx)
// }
var userInfo = await getUserInfo();
userInfo.qrcode = (await createImgByAsync(userInfo.qrcode)).src
userInfo.qrcode = (await createImgByAsync(userInfo.qrcode)).src;
this.curShareImg = (await createImgByAsync(this.navs[this.activeIdx].share_image)).src;
console.log(userInfo);
this.$set(this,'userInfo',userInfo)
var largeShareName = `${userInfo.nickname}的`
......@@ -592,6 +605,11 @@ var vueInstance = new Vue({
})
this.loadReady = true
setTimeout(() => {
this.generatePost();
}, 1000);
}
},
created(){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment