156 lines
5.2 KiB
Vue
156 lines
5.2 KiB
Vue
<template>
|
||
<view>
|
||
<!-- 状态栏 -->
|
||
<status-nav :titleVal="'分享中心'" :statusTitle="true"></status-nav>
|
||
<!-- 自定义二级分类 -->
|
||
<!-- 列表 -->
|
||
<view :style="{paddingTop: statusHNH+'px'}" class="pad-zy32">
|
||
<view class="radius20 pad20 bacf mar-s20 col3">
|
||
<view class="fon28 bold mar-x40 pad-z10">我的分享</view>
|
||
<view class="disja">
|
||
<view @tap="goPage(index)" class="disac fc flexs width33" v-for="(item,index) in dataList" :key="index">
|
||
<view class="fon36 bold clips1">{{item.num}}</view>
|
||
<view class="fon26 mar-s25">{{item.title}}</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<!-- 分享按钮 -->
|
||
<view @tap="shareEv" class="disjcac radius20 posir" style="height: 90rpx;margin: 70rpx 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>
|
||
<!-- <button open-type="share" class="posia width100" style="opacity: 0;">分享给好友</button> -->
|
||
<!-- <button @tap="shareEv" class="posia width100" style="opacity: 0;">分享给好友</button> -->
|
||
</view>
|
||
</view>
|
||
<!-- 弹框 -->
|
||
<pu-po :isShowT="isShowT" :contentVal="'暂未开放此功能,请耐心等候'" :isCenter="true" :comfrimVal="'好的'" @comfirmev="isShowT=false"></pu-po>
|
||
<!-- 底部客服 -->
|
||
<public-customer :nbottom="100"></public-customer>
|
||
<!-- 弹框授权 -->
|
||
<empower @buttonH="buttonH" :vision="vision" :isWhere="2"></empower>
|
||
<!-- 弹框 -->
|
||
<auth-phone v-if="isShowP"></auth-phone>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
export default {
|
||
data() {
|
||
return {
|
||
statusHNH:uni.getStorageSync('statusHNH'),
|
||
publicColor:uni.getStorageSync('publicColor'),//主题颜色
|
||
isShowT:false,
|
||
imgSrc:'/static/public/shareh.png',
|
||
dataList:[
|
||
{num:'0',title:'积分'},
|
||
{num:'0',title:'分享人'},
|
||
{num:'0',title:'分享订单'},
|
||
],
|
||
imgSrcP:uni.getStorageSync('imgSrcP'),
|
||
vision:false,
|
||
isShowP:false,
|
||
}
|
||
},
|
||
onShareAppMessage(options) {
|
||
var ya = this;
|
||
var shareObj = {
|
||
title: '恒美植发', // 默认是小程序的名称(可以写slogan等)
|
||
path: '', // 默认是当前页面,必须是以‘/’开头的完整路径
|
||
imageUrl: ya.imgSrc, //自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
|
||
success: function(res){
|
||
// 转发成功之后的回调
|
||
if(res.errMsg == 'shareAppMessage:ok'){
|
||
let maiOjb = {
|
||
e:4,//内容分享
|
||
t:new Date().getTime()//当前时间戳
|
||
}
|
||
this.$toolAll.tools.maiDian(maiOjb)
|
||
}
|
||
},
|
||
fail: function(res){
|
||
// 转发失败之后的回调
|
||
if(res.errMsg == 'shareAppMessage:fail cancel'){
|
||
// 用户取消转发
|
||
}else if(res.errMsg == 'shareAppMessage:fail'){
|
||
// 转发失败,其中 detail message 为详细失败信息
|
||
}
|
||
}
|
||
};
|
||
return shareObj;
|
||
},
|
||
onShow() {
|
||
this.$toolAll.tools.isLogin()
|
||
},
|
||
onLoad(options) {
|
||
if(uni.getStorageSync('is_active')!=1){this.vision = true;}
|
||
if(options.invite_code!='' && options.invite_code!=undefined){
|
||
this.loginEv(options.invite_code);
|
||
} else if(options.source_code!='' && options.source_code!=undefined){
|
||
this.loginEv('',options.source_code,options.channel);
|
||
}
|
||
uni.getStorageSync('shareAll')!='' ? this.dataList[1].num = uni.getStorageSync('shareAll').share_users.total : this.dataList[1].num = 0
|
||
|
||
},
|
||
methods: {
|
||
loginEv(invite_code='',source='',channel=''){
|
||
uni.login({
|
||
provider: 'weixin',
|
||
success: (res)=> {
|
||
if (res.code) {
|
||
var params = {
|
||
code:res.code,
|
||
invite_code:invite_code,//用户邀请码
|
||
source_code:source,
|
||
channel:channel
|
||
}
|
||
this.$requst.post('user/login',params).then(res => {
|
||
if(res.data.token!=''){
|
||
if(res.data.is_active==0) {
|
||
this.vision = true;
|
||
}
|
||
}
|
||
},error => {})
|
||
}
|
||
},
|
||
});
|
||
},
|
||
buttonH(e){//授权成功
|
||
if(e) {
|
||
this.vision = false
|
||
this.isShowP = true
|
||
}
|
||
},
|
||
shareEv(){//分享事件
|
||
if(this.imgSrcP==''){
|
||
this.$toolAll.tools.showToast('请先前往个人海报申请海报')
|
||
} else {
|
||
wx.showShareImageMenu({
|
||
path: this.imgSrcP
|
||
})
|
||
this.$requst.post('user/record',{type:'other',action:'share',id:''}).then(res=>{console.log('分享成功:',res);},error=>{})
|
||
let maiOjb = {
|
||
e:4,//内容分享
|
||
t:new Date().getTime()//当前时间戳
|
||
}
|
||
this.$toolAll.tools.maiDian(maiOjb)
|
||
}
|
||
},
|
||
goPage(index){
|
||
let newUrl = ''
|
||
if(index==1) newUrl = '/pagesB/mysharer/mysharer'
|
||
uni.navigateTo({
|
||
url:newUrl
|
||
})
|
||
},
|
||
// shareEv(){
|
||
// this.isShowT = true
|
||
// }
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style>
|
||
</style>
|