2021-08-19 06:40:59 +00:00
|
|
|
|
<template>
|
|
|
|
|
<view>
|
|
|
|
|
<!-- 状态栏 -->
|
|
|
|
|
<status-nav :titleVal="'二维码海报'" :statusTitle="true"></status-nav>
|
|
|
|
|
<!-- 自定义二级分类 -->
|
|
|
|
|
<!-- 列表 -->
|
2022-02-15 08:02:16 +00:00
|
|
|
|
<view :style="{paddingTop: statusHNH+'px'}" class="pad-zy20 pad-x180">
|
2021-12-20 08:02:27 +00:00
|
|
|
|
<view class="tc mar-s20 col6 fon28">请选择海报背景后分享</view>
|
2021-10-22 03:07:32 +00:00
|
|
|
|
<view v-if="imgList.length!=0">
|
|
|
|
|
<view class="mar-s20 disjbac fw">
|
|
|
|
|
<image @tap="chooseImg(index)" v-for="(item,index) in imgList" :key="index" class="width100 radius20 mar-x20" :src="item" style="width: 48.5%;max-height: 474rpx" mode="aspectFill" lazy-load></image>
|
2021-08-19 06:40:59 +00:00
|
|
|
|
</view>
|
2021-10-22 03:07:32 +00:00
|
|
|
|
</view>
|
|
|
|
|
<view v-else 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>
|
|
|
|
|
<!-- 预览弹框 -->
|
2022-02-28 06:46:40 +00:00
|
|
|
|
<view v-if="showBtn" @tap.stop="showBtn=false" class="posAll disjcac fc pad-zy50" style="z-index: 11;">
|
2021-10-22 03:07:32 +00:00
|
|
|
|
<image :src="imgSrc" @tap.stop="showBtn=true" class="radius20" style="width: 80%;" mode="widthFix"></image>
|
2021-08-19 06:40:59 +00:00
|
|
|
|
<!-- 分享按钮 -->
|
2022-03-04 08:48:40 +00:00
|
|
|
|
<view @tap.stop="shareEv" class="disjcac radius20 posixzy" style="height: 90rpx;margin: 20rpx 80rpx;background-color: #38CE51;line-height: 90rpx;bottom: 40rpx;">
|
2021-10-22 03:07:32 +00:00
|
|
|
|
<view class="disac">
|
2021-08-19 06:40:59 +00:00
|
|
|
|
<image src="/static/public/sharef.png" style="width: 54rpx;height: 54rpx;" mode=""></image>
|
|
|
|
|
<view class="fon40 bold colf mar-z10">分享给好友</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
2021-10-22 03:07:32 +00:00
|
|
|
|
</view>
|
2021-08-19 06:40:59 +00:00
|
|
|
|
</view>
|
|
|
|
|
<!-- 弹框 -->
|
2021-10-22 03:07:32 +00:00
|
|
|
|
<pu-po :isShowT="imgList.length==0 && isHaib" :contentVal="'立即生成创意海报'" :clearVal="'暂不生成'" :comfrimVal="'立即生成'" @comfirmev="comfirmev" @cancleev="cancleev"></pu-po>
|
2021-08-26 09:57:04 +00:00
|
|
|
|
<!-- 底部客服 -->
|
2022-02-15 08:02:16 +00:00
|
|
|
|
<!-- <public-customer :nbottom="100"></public-customer> -->
|
2022-03-04 08:48:40 +00:00
|
|
|
|
<!-- 用户信息授权,手机号授权 -->
|
|
|
|
|
<auth-userInfo-mobileInfo></auth-userInfo-mobileInfo>
|
2022-02-15 08:02:16 +00:00
|
|
|
|
<!-- 底部tab -->
|
|
|
|
|
<foot-tab :titleList="titleList" :imgList="tabimgList" :newcurrent='-1'></foot-tab>
|
2021-08-19 06:40:59 +00:00
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import {base64ToPath} from '@/jsFile/base64-src.js';
|
|
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
2022-03-04 08:48:40 +00:00
|
|
|
|
statusHNH:uni.getStorageSync('electric_nav_height'),
|
2021-08-19 06:40:59 +00:00
|
|
|
|
publicColor:uni.getStorageSync('publicColor'),//主题颜色
|
|
|
|
|
isShowT:true,
|
2021-10-22 03:07:32 +00:00
|
|
|
|
imgList:uni.getStorageSync('imgSrcList'),
|
|
|
|
|
imgSrc:'',
|
|
|
|
|
showBtn:false,
|
2021-11-04 07:41:53 +00:00
|
|
|
|
isHaib:false,
|
2022-02-15 08:02:16 +00:00
|
|
|
|
titleList:[],//tab标题
|
|
|
|
|
tabimgList:[],//tab图标
|
2022-03-04 08:48:40 +00:00
|
|
|
|
shareFlag:true//是否允许点击分享
|
2021-08-19 06:40:59 +00:00
|
|
|
|
}
|
|
|
|
|
},
|
2021-12-02 09:31:26 +00:00
|
|
|
|
onLoad(options) {
|
2022-03-04 08:48:40 +00:00
|
|
|
|
if(uni.getStorageSync('phone_active')!=0){
|
|
|
|
|
this.$toolAll.tools.isLogin() ;
|
|
|
|
|
//如果还没有生成海报
|
|
|
|
|
if(uni.getStorageSync('imgSrcList')!='') this.imgSrcList = uni.getStorageSync('imgSrcList')//弹框关闭
|
|
|
|
|
else this.imgList = []
|
|
|
|
|
this.checkPoster();
|
|
|
|
|
this.$requst.post('index/mini-program-setting').then(res=>{
|
|
|
|
|
// log('数据:',res);
|
|
|
|
|
if(res.code==0){
|
|
|
|
|
if(res.data.length!=0){
|
|
|
|
|
if(res.data.footBar.length!=0){//底部导航
|
|
|
|
|
res.data.footBar.forEach(item=>{
|
|
|
|
|
let newName = item.name
|
|
|
|
|
let newObj = {
|
|
|
|
|
iconPath:this.$http + item.icon[0],
|
|
|
|
|
selectedIconPath:this.$http + item.icon[1],
|
|
|
|
|
}
|
|
|
|
|
if(item.key=="home"){
|
|
|
|
|
this.tabimgList[0] = newObj
|
|
|
|
|
this.titleList[0] = newName
|
|
|
|
|
}
|
|
|
|
|
if(item.key=="category"){
|
|
|
|
|
this.tabimgList[1] = newObj
|
|
|
|
|
this.titleList[1] = newName
|
|
|
|
|
}
|
|
|
|
|
if(item.key=="service"){
|
|
|
|
|
this.tabimgList[2] = newObj
|
|
|
|
|
this.titleList[2] = newName
|
|
|
|
|
}
|
|
|
|
|
if(item.key=="shop"){
|
|
|
|
|
this.tabimgList[3] = newObj
|
|
|
|
|
this.titleList[3] = newName
|
|
|
|
|
}
|
|
|
|
|
if(item.key=="my"){
|
|
|
|
|
this.tabimgList[4] = newObj
|
|
|
|
|
this.titleList[4] = newName
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
uni.setStorageSync('footTitle',this.titleList)
|
|
|
|
|
uni.setStorageSync('footimg',this.tabimgList)
|
|
|
|
|
this.titleList = uni.getStorageSync('footTitle')
|
|
|
|
|
this.tabimgList = uni.getStorageSync('footimg')
|
|
|
|
|
}
|
2022-02-15 08:02:16 +00:00
|
|
|
|
}
|
2022-03-04 08:48:40 +00:00
|
|
|
|
} else this.$toolAll.tools.showToast(res.msg);
|
|
|
|
|
},error=>{this.$toolAll.tools.showToast(error.msg);})
|
|
|
|
|
}
|
2021-08-19 06:40:59 +00:00
|
|
|
|
},
|
|
|
|
|
methods: {
|
2021-11-02 10:23:53 +00:00
|
|
|
|
checkPoster(){//查询海报模板
|
|
|
|
|
this.$requst.get('user/poster').then(res=>{
|
|
|
|
|
if(res.code==0){
|
|
|
|
|
if(res.data.list.length!=0){
|
|
|
|
|
res.data.list.forEach(item=>{
|
|
|
|
|
this.imgList.push(this.$http + item);
|
|
|
|
|
})
|
|
|
|
|
}
|
2022-03-04 08:48:40 +00:00
|
|
|
|
} else this.$toolAll.tools.showToast(res.msg);
|
|
|
|
|
},error=>{this.$toolAll.tools.showToast(error.msg);})
|
2021-11-02 10:23:53 +00:00
|
|
|
|
},
|
|
|
|
|
chooseImg(index){//选择海报模板,并生成海报
|
2021-11-04 07:41:53 +00:00
|
|
|
|
this.imgSrc = '';
|
2022-03-04 08:48:40 +00:00
|
|
|
|
this.showBtn = true;
|
2021-11-02 10:23:53 +00:00
|
|
|
|
this.$toolAll.tools.showToast('正在生成海报...','loading',10000);
|
|
|
|
|
this.$requst.post('user/poster-info',{poster_src:this.imgList[index]}).then(res=>{
|
|
|
|
|
if(res.code==0){
|
|
|
|
|
base64ToPath(res.data.poster).then(path => {
|
|
|
|
|
this.imgSrc = path;
|
|
|
|
|
}).catch(error => {})
|
|
|
|
|
this.$toolAll.tools.showToast('海报生成成功','none',1500);
|
|
|
|
|
} else {
|
|
|
|
|
this.$toolAll.tools.showToast('海报生成失败','none',1500);
|
2022-03-04 08:48:40 +00:00
|
|
|
|
this.showBtn = false;
|
2021-11-02 10:23:53 +00:00
|
|
|
|
}
|
2022-03-04 08:48:40 +00:00
|
|
|
|
}).catch(err=>{this.$toolAll.tools.showToast(err.msg);})
|
2021-10-22 03:07:32 +00:00
|
|
|
|
},
|
2021-08-19 06:40:59 +00:00
|
|
|
|
shareEv(){
|
2022-03-04 08:48:40 +00:00
|
|
|
|
this.$toolAll.tools.showToast('正在调起分享...');
|
|
|
|
|
if(this.shareFlag){
|
|
|
|
|
this.shareFlag = false;
|
|
|
|
|
wx.showShareImageMenu({
|
|
|
|
|
path: this.imgSrc,
|
|
|
|
|
success:(res=>{
|
|
|
|
|
this.shareFlag = true;
|
|
|
|
|
this.$requst.post('user/record',{type:'other',action:'share',id:''}).then(res=>{console.log('分享成功:',res);},error=>{})
|
|
|
|
|
// 调用tools.js中的种植埋点事件
|
|
|
|
|
this.$toolAll.tools.plantPoint(4);
|
|
|
|
|
}),
|
|
|
|
|
fail:(err=>{
|
|
|
|
|
this.shareFlag = true;
|
|
|
|
|
})
|
2021-10-22 03:07:32 +00:00
|
|
|
|
})
|
2022-03-04 08:48:40 +00:00
|
|
|
|
} else {this.$toolAll.tools.showToast('请勿重复点击');}
|
2021-08-19 06:40:59 +00:00
|
|
|
|
},
|
|
|
|
|
comfirmev(){//立即生成事件
|
|
|
|
|
this.$toolAll.tools.showToast('生成中...')
|
|
|
|
|
this.isShowT = false
|
2021-11-02 10:23:53 +00:00
|
|
|
|
// 单张海报
|
2021-08-19 06:40:59 +00:00
|
|
|
|
this.$requst.get('user/personal-poster').then(res=>{
|
|
|
|
|
// console.log('生成个人海报成功:',res);
|
|
|
|
|
if(res.code==0){
|
2021-10-22 03:07:32 +00:00
|
|
|
|
let newArr = [];
|
|
|
|
|
newArr.push(res.data.poster)
|
2021-08-19 06:40:59 +00:00
|
|
|
|
uni.hideToast()
|
2021-10-22 03:07:32 +00:00
|
|
|
|
newArr.forEach(item=>{
|
|
|
|
|
base64ToPath(item).then(path => {
|
|
|
|
|
this.imgList.push(path)
|
|
|
|
|
uni.setStorageSync('imgSrcList',this.imgList)
|
|
|
|
|
}).catch(error => {})
|
|
|
|
|
})
|
|
|
|
|
this.$toolAll.tools.showToast('生成海报成功');
|
|
|
|
|
this.isHaib = false
|
2022-03-04 08:48:40 +00:00
|
|
|
|
} else this.$toolAll.tools.showToast(res.msg);
|
|
|
|
|
},error=>{this.$toolAll.tools.showToast(error.msg);})
|
2021-08-19 06:40:59 +00:00
|
|
|
|
},
|
|
|
|
|
cancleev(){//暂不生成事件
|
|
|
|
|
uni.navigateBack({delta:1})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
</style>
|