93 lines
1.8 KiB
Vue
93 lines
1.8 KiB
Vue
|
<template>
|
||
|
<view>
|
||
|
<status-container titlet="我的分享" returnc="#FFFFFF"></status-container>
|
||
|
<!-- 分享图 -->
|
||
|
<image :src="shareImg" mode="widthFix" lazy-load></image>
|
||
|
<!-- 底部按钮 -->
|
||
|
<view class="bottom-btn">
|
||
|
<view @tap="downloadImgEv">下载图片</view>
|
||
|
</view>
|
||
|
</view>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
import pitera from '@/components/nothing/pitera.vue';
|
||
|
import yzQr from '@/components/yz-qr/yz-qr.vue';
|
||
|
import {base64ToPath} from '@/jsFile/base64-src.js';
|
||
|
export default {
|
||
|
components:{
|
||
|
pitera,
|
||
|
yzQr
|
||
|
},
|
||
|
data() {
|
||
|
return {
|
||
|
shareImg:'',
|
||
|
}
|
||
|
},
|
||
|
onLoad() {
|
||
|
uni.showToast({
|
||
|
title:'正在生成推广码',
|
||
|
icon:'loading',
|
||
|
duration:10000
|
||
|
})
|
||
|
// 生成推广码
|
||
|
createPoster({introducer:wx.getStorageSync('introducer')}).then(res=>{
|
||
|
this.shareImg = res.data.path;
|
||
|
uni.hideLoading();
|
||
|
}).catch(err=>{
|
||
|
uni.hideLoading();
|
||
|
uni.showToast({
|
||
|
title:'生成失败',
|
||
|
icon:'none',
|
||
|
position:'bottom'
|
||
|
})
|
||
|
setTimeout(()=>{
|
||
|
uni.navigateBack({delta:1})
|
||
|
},1000)
|
||
|
})
|
||
|
},
|
||
|
methods: {
|
||
|
// 下载图片
|
||
|
downloadImgEv(){
|
||
|
uni.downloadFile({
|
||
|
url: this.shareImg,
|
||
|
success: (res) => {
|
||
|
uni.saveImageToPhotosAlbum({
|
||
|
filePath: res.tempFilePath,
|
||
|
success: ()=> {
|
||
|
console.log('save success');
|
||
|
},
|
||
|
fail: () => {
|
||
|
uni.showToast({title:'保存失败',icon:'error'})
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
<style>
|
||
|
image {
|
||
|
width: 100%;
|
||
|
}
|
||
|
.bottom-btn {
|
||
|
position: fixed;
|
||
|
bottom: 0;
|
||
|
left: 0;
|
||
|
right: 0;
|
||
|
padding: 20rpx;
|
||
|
display: flex;
|
||
|
justify-content: flex-end;
|
||
|
box-shadow: 0rpx -3rpx 20rpx rgba(0,0,0,.05);
|
||
|
}
|
||
|
.bottom-btn view {
|
||
|
background-color: #eb5d10;
|
||
|
color: #FFFFFF;
|
||
|
padding: 20rpx 40rpx;
|
||
|
border-radius: 80rpx;
|
||
|
font-size: 36rpx;
|
||
|
}
|
||
|
</style>
|