连云港陪玩陪聊
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
chunwan/components/share.vue

213 lines
4.6 KiB

3 months ago
<template>
<view>
<u-popup v-model="isShare" mode="bottom" border-radius="20" :mask-close-able="false">
<view class="share">
<template v-if="type==1">
<view class="title">分享至</view>
<view class="content">
1 month ago
<view class="item" @click="appShare('hb')">
3 months ago
<image src="@/static/icon-share-03.png"></image>
<view class="txt">生成海报</view>
</view>
1 month ago
<view class="item" @click="appShare('WXSceneSession',2)">
3 months ago
<image src="@/static/icon-share-01.png"></image>
<view class="txt">微信好友</view>
</view>
1 month ago
<view class="item" @click="appShare('WXSceneTimeline',2)">
3 months ago
<image src="@/static/icon-share-02.png"></image>
<view class="txt">朋友圈</view>
</view>
1 month ago
<view class="item" @click="appShare('src')">
3 months ago
<image src="@/static/icon-share-04.png"></image>
<view class="txt">复制链接</view>
</view>
</view>
<view class="fd">
2 months ago
<view class="btn" @click="closePopup()">取消</view>
3 months ago
</view>
</template>
<template v-if="type==2">
2 months ago
<view class="titles">分享<image @click="closePopup()" src="@/static/cha.png"></image></view>
3 months ago
<view class="content">
2 months ago
<view class="item" @click="appShare('WXSceneSession',1)">
3 months ago
<image src="@/static/icon-share-01.png"></image>
<view class="txt">微信</view>
</view>
2 months ago
<view class="item" @click="appShare('web',1)">
3 months ago
<image src="@/static/icon-share-04.png"></image>
<view class="txt">复制链接</view>
</view>
</view>
</template>
</view>
</u-popup>
</view>
</template>
<script>
export default {
name:"insufficient",
props: {
2 months ago
info: {
type: Object,
default: {}
},
3 months ago
isShare: {
type: Boolean,
default: false
},
type: {
type: Number,
default: 2
},
},
methods: {
confirm() {
uni.navigateTo({
url: "/pages/users/recharge/index"
})
2 months ago
},
closePopup() {
uni.$emit("closeSharePopup",false)
},
1 month ago
2 months ago
// APP分享
appShare(scene,type){
let that = this;
if(scene == 'web'){
uni.setClipboardData({
data: this.$articleShareUrl+this.info.id,
success: function () {
1 month ago
uni.getClipboardData({
success: function (res) {
uni.$emit("closeSharePopup",false)
uni.showToast({
title: "复制成功"
})
}
});
}
})
return ;
1 month ago
}
if(scene == 'src'){
1 month ago
uni.setClipboardData({
1 month ago
data: this.$userShareUrl+this.info.invitationCode,
1 month ago
success: function () {
2 months ago
uni.getClipboardData({
success: function (res) {
uni.$emit("closeSharePopup",false)
uni.showToast({
title: "复制成功"
})
}
});
}
})
return ;
1 month ago
}
if(scene == 'hb'){
uni.$emit("closeSharePopup",false)
uni.$emit("openHaibaoPopup",true)
return;
}
2 months ago
uni.showLoading({
title: '加载中',
mask: true
});
uni.share({
provider: "weixin",
1 month ago
scene,
2 months ago
type,
href: that.info.href,
title: that.info.title,
summary: that.info.summary,
imageUrl: that.info.imageUrl,
success: function(res) {
uni.showToast({
title: '分享成功',
icon: 'success'
})
uni.$emit("closeSharePopup",false)
uni.hideLoading();
},
fail: function(err) {
uni.showToast({
title: '分享失败',
icon: 'none',
duration: 2000
})
uni.$emit("closeSharePopup",false)
uni.hideLoading();
}
});
},
3 months ago
}
}
</script>
<style scoped lang="scss">
.share{
width: 100%;
background: #EEEFF0;
.title{
font-weight: 400;
font-size: 30rpx;
text-align: center;
color: #333333;
padding: 30rpx 0;
}
.titles{
font-weight: 400;
font-size: 30rpx;
text-align: left;
color: #333333;
padding: 30rpx;
image{
width: 44rpx;
height: 44rpx;
float: right;
}
}
.content{
display: flex;
align-items: flex-start;
justify-content: flex-start;
padding: 50rpx 0;
.item{
width: 25%;
text-align: center;
image{
width: 100rpx;
height: 100rpx;
}
.txt{
font-weight: 400;
font-size: 28rpx;
color: #333333;
margin-top: 20rpx;
}
}
}
.fd{
width: 100%;
height: 120rpx;
background: #FFFFFF;
display: flex;
align-items: center;
justify-content: center;
.btn{
width: 702rpx;
line-height: 90rpx;
background: linear-gradient(0deg, #000000, #3D3B38);
box-shadow: 0px 4rpx 18rpx 0px rgba(42,41,39,0.34);
border-radius: 90rpx;
text-align: center;
font-weight: 400;
font-size: 30rpx;
color: #FFFFFF;
}
}
}
</style>