hengmei-two/pagesB/personalPoster/personalPoster.vue

77 lines
2.4 KiB
Vue

<template>
<view>
<!-- 状态栏 -->
<status-nav :titleVal="'二维码海报'" :statusTitle="true"></status-nav>
<!-- 自定义二级分类 -->
<!-- 列表 -->
<view :style="{paddingTop: statusHNH+'px'}" class="pad-zy36 pad-x20">
<view v-show="imgSrc!=''">
<view class="mar-s20">
<image class="width100 radius20" :src="imgSrc" mode="widthFix" lazy-load></image>
</view>
<!-- 分享按钮 -->
<view @tap="shareEv" class="disjcac radius20 posir" style="height: 90rpx;margin: 20rpx 80rpx 0 80rpx;background-color: #38CE51;line-height: 90rpx;">
<view class="disac">
<image src="/static/public/sharef.png" style="width: 54rpx;height: 54rpx;" mode=""></image>
<view class="fon40 bold colf mar-z10">分享给好友</view>
</view>
</view>
</view>
<view v-show="imgSrc==''" class="disjcac fc" style="margin-top: 50%;">
<image class="zanw-img mar-x50" src="/static/public/zanwn.png" mode="aspectFill"></image>
<view class="fon24 col3 mar-s50" style="margin-top: 30%;">暂无内容</view>
</view>
</view>
<!-- 弹框 -->
<pu-po :isShowT="imgSrc==''" :contentVal="'立即生成创意海报'" :clearVal="'暂不生成'" :comfrimVal="'立即生成'" @comfirmev="comfirmev" @cancleev="cancleev"></pu-po>
</view>
</template>
<script>
import {base64ToPath} from '@/jsFile/base64-src.js';
export default {
data() {
return {
statusHNH:uni.getStorageSync('statusHNH'),
publicColor:uni.getStorageSync('publicColor'),//主题颜色
isShowT:true,
imgSrc:uni.getStorageSync('imgSrcP'),
isHaib:false
}
},
onLoad() {
//如果还没有生成海报
this.imgSrc = uni.getStorageSync('imgSrcP')//弹框关闭
},
methods: {
shareEv(){
wx.showShareImageMenu({
path: this.imgSrc
})
},
comfirmev(){//立即生成事件
this.$toolAll.tools.showToast('生成中...')
this.isShowT = false
this.$requst.get('user/personal-poster').then(res=>{
// console.log('生成个人海报成功:',res);
if(res.code==0){
this.imgSrc = res.data.poster
uni.hideToast()
this.$toolAll.tools.showToast('生成海报成功')
base64ToPath(this.imgSrc).then(path => {
this.imgSrc = path
uni.setStorageSync('imgSrcP',path)
}).catch(error => {})
}
},error=>{})
},
cancleev(){//暂不生成事件
uni.navigateBack({delta:1})
}
}
}
</script>
<style>
</style>