修改分享

This commit is contained in:
张凯 2025-05-13 12:52:34 +08:00
parent 22271448ac
commit 7a1962f746
2 changed files with 166 additions and 59 deletions

View File

@ -1,6 +1,6 @@
<template> <template>
<view class="detail_all"> <view class="detail_all">
<view class="nav"> <view class="nav" @click="goHome">
<u-navbar :is-back="true" leftIconColor="#FFFFFF" :autoBack="true" :bgColor="background" <u-navbar :is-back="true" leftIconColor="#FFFFFF" :autoBack="true" :bgColor="background"
:titleStyle='titleStyle'> </u-navbar> :titleStyle='titleStyle'> </u-navbar>
</view> </view>
@ -199,48 +199,47 @@
<!-- 分享海报 --> <!-- 分享海报 -->
<u-overlay :show="overlay" class="pos"> <u-overlay :show="overlay" class="pos">
<view class="Poster"> <view class="Poster" id="Poster">
<span class="posterClose" @click="closeoo"> <span class="posterClose" @click="closeoo">
<image src="../../static/center/close.png" mode="" style="width: 64rpx;height: 64rpx;"></image> <image src="../../static/center/close.png" mode="" style="width: 64rpx;height: 64rpx;"></image>
</span> </span>
<image :src="path" mode="widthFix" style="width: 661rpx;height: 1075rpx;"></image> <view ref="painter" class="title_top">
<l-painter isCanvasToTempFilePath ref="painter" @success="(path = $event)" <view class="toutop">
css="width: 661rpx;height:1075rpx; padding-bottom: 40rpx; background-image: url('https://naweigetetest2.hschool.com.cn/uploads/20250512/cab87804899539e37ef155163ab12b54.png')"> <image class="toutu" :src="detail.user.avatar" />
<view class="toututt">{{detail.user.nickname}}的邀请</view>
<l-painter-view </view>
css="margin-left: 35rpx; margin-top: 24rpx; padding: 32rpx; box-sizing: border-box; background: #fff; border-radius: 16rpx; width: 690rpx; box-shadow: 0 20rpx 58rpx rgba(0,0,0,.15)"> <view class="center_con">
<l-painter-image :src="detail.user.avatar" <image v-if="detail.images" :src="detail.images[0]" class="cenimg" />
css="object-fit: cover; object-position: 50% 50%; width: 626rpx; height: 448rpx; border-radius: 12rpx;" /> <view class="center_text">
<view>
<l-painter-view css=" width: 626rpx;display: flex;alignItems: center;"> <view class="c1t1">{{ formattedTitle }}</view>
<l-painter-view> <view class="c2t2">{{ detail.price }}</view>
<l-painter-view css="margin-top: 24rpx;"> <view class="c3t3">地址{{ detail.address }}</view>
<l-painter-text :text="formattedTitle" css="color: #343434;font-size: 36rpx;" /> </view>
</l-painter-view> <view style="background-color: #ffffff;border-radius: 18rpx;">
<l-painter-text <l-painter>
css="line-clamp: 2; color: #333333; line-height: 1.8em; font-size: 26rpx;display: block; width: 380rpx; padding-right:32rpx; box-sizing: border-box" <l-painter-view css="margin:20rpx;">
:text="detail.price"></l-painter-text> <l-painter-qrcode css="width: 160rpx; height: 160rpx;margin:0 auto;" :text="qrUrl"></l-painter-qrcode>
<l-painter-text
css="line-clamp: 2; color: #333333; line-height: 1.8em; font-size: 26rpx;display: block;margin-bottom:30rpx; width: 380rpx; padding-right:32rpx; box-sizing: border-box"
:text="detail.address"></l-painter-text>
</l-painter-view>
<l-painter-view css="margin-top: 24rpx;">
<l-painter-qrcode css="width: 200rpx; height: 200rpx;" :text="qrUrl"></l-painter-qrcode>
</l-painter-view>
</l-painter-view>
</l-painter-view> </l-painter-view>
</l-painter> </l-painter>
</view> </view>
</view>
</view>
</view>
</view>
<view class="btnList"> <view class="btnList">
<span class="save" @click.stop="save()"> </span> <span class="save" @click="capturePage()"> </span>
<!-- <span class="sharePoster" @click.stop="sharePoster()"> <!-- <span class="sharePoster" @click.stop="sharePoster()">
</span> --> </span> -->
<button open-type="share" class="no-border-button" plain="true"> <button open-type="share" class="no-border-button" plain="true">
<span> </span> <span> </span>
</button> </button>
</view> </view>
<canvas
canvas-id="myCanvas"
style="position: absolute;top:256rpx;left: 48rpx; width: 661rpx;height:1075rpx; visibility: hidden;">
</canvas>
</u-overlay> </u-overlay>
</view> </view>
@ -289,6 +288,7 @@
img: 'width: 100%' img: 'width: 100%'
}, },
isShare:'',
value_slide:0, value_slide:0,
scrollTop: 0, scrollTop: 0,
overlay: false, overlay: false,
@ -329,18 +329,29 @@
}, },
}; };
}, },
//
onShareTimeline() { onShareAppMessage() {
return { return {
title: this.detail.title, // title: this.detail.title, //
imageUrl: this.detail.headimage, //httphttps imageUrl: this.detail.images[0], //httphttps
query: `id=${this.id}` path: `/pages/center/detail?id=${this.id}&isShare=1`
} }
}, },
//
// onShareTimeline() {
// return {
// title: this.detail.title, //
// imageUrl: this.detail.images[0], //httphttps
// query: `id=${this.id}&isShare=1`
// }
// },
onLoad(options) { onLoad(options) {
this.userInfo = uni.getStorageSync("userInfo") this.userInfo = uni.getStorageSync("userInfo")
this.id = options.id this.id = options.id
if(options.isShare){
this.isShare = options.isShare;
}
// this.id = 1 // this.id = 1
if (options.type == 2) { if (options.type == 2) {
this.type = 2 this.type = 2
@ -359,6 +370,32 @@
}, },
methods: { methods: {
capturePage() {
uni.canvasToTempFilePath({
x: 0, // x
y: 0, // y
width: uni.upx2px(750), // px
height: uni.upx2px(1334), // px
destWidth: 750, //
destHeight: 1334, //
canvasId: 'myCanvas', // Canvasid
success: function (res) {
console.log('tempFilePath:', res.tempFilePath); //
this.save(res.tempFilePath)
},
fail: function (err) {
console.error(err); //
}
});
},
//
goHome() {
if(this.isShare == 1){
uni.switchTab({
url: "/pages/index/index"
})
}
},
closeoo(){ closeoo(){
this.overlay = false; this.overlay = false;
}, },
@ -647,14 +684,9 @@
this.selectedTime = null this.selectedTime = null
this.buyShow = false this.buyShow = false
}, },
//
toIndex() {
uni.switchTab({
url: "/pages/index/index"
})
},
// //
save() { save(e) {
let base64 = this.path.replace(/^data:image\/\w+;base64,/, ""); // let base64 = this.path.replace(/^data:image\/\w+;base64,/, ""); //
let filePath = wx.env.USER_DATA_PATH + '/qrcode.png'; let filePath = wx.env.USER_DATA_PATH + '/qrcode.png';
uni.getFileSystemManager().writeFile({ uni.getFileSystemManager().writeFile({
@ -1475,25 +1507,96 @@
// border-radius: 10px !important; // border-radius: 10px !important;
background: #FFFFFF !important; background: #FFFFFF !important;
} }
.pos {
position: relative;
width: 100%;
height: 100%;
}
.Poster { .Poster {
position: relative; position: relative;
top: 21rpx; margin: 0 auto;
left: 30rpx;
width: 690rpx;
height: 1200rpx;
}
.posterClose { .posterClose {
position: absolute; position: absolute;
right: 8rpx; right: 8rpx;
top: 8rpx; top: 200rpx;
}
.title_top{
position: relative;
margin: 0 auto;
width: 661rpx;height:1075rpx;
background-image: url('https://naweigetetest2.hschool.com.cn/dyqc/fenxiang.png');
background-size: 100%;
background-repeat: no-repeat;
margin-top: 240rpx;
}
.toutop{
position: absolute;
top: 120rpx;
left: 30rpx;
display: flex;
align-items: center;
width: 80%;
.toutu{
width: 60rpx;
height: 60rpx;
border-radius: 134rpx 134rpx 134rpx 134rpx;
border: 2rpx solid #FFFFFF;
}
.toututt{
padding-left: 15rpx;
height: 36rpx;
font-family: PingFang SC Bold, PingFang SC Bold;
font-weight: 400;
font-size: 28rpx;
color: #3D3D3D;
line-height: 36rpx;
text-align: center;
font-style: normal;
text-transform: none;
}
}
.center_con{
padding-top: 200rpx;
.cenimg{
width: 620rpx;
height: 620rpx;
border-radius: 24rpx;
margin: 0 auto;
display: block;
}
.center_text{
display: flex;
align-items: center;
justify-content: space-around;
margin-top: 30rpx;
.c1t1{
color: #202020;font-size: 36rpx;
// margin-top: 30rpx;
}
.c2t2{
font-family: D-DIN-PRO, D-DIN-PRO;
font-weight: 900;
font-size: 28rpx;
color: #FF4810;
margin-top: 20rpx;
}
.c3t3{
margin-top: 20rpx;
font-family: PingFang SC Regular, PingFang SC Regular;
font-weight: 400;
font-size: 26rpx;
color: #9C9C9C;
}
}
} }
.pos {
position: relative;
} }
.btnList { .btnList {
width: 690rpx; width: 690rpx;
position: absolute; position: absolute;
@ -1501,6 +1604,10 @@
left: 30rpx; left: 30rpx;
display: flex; display: flex;
justify-content: space-evenly; justify-content: space-evenly;
// width: 750rpx;
// height: 247rpx;
// background: #FFFFFF;
// border-radius: 44rpx 44rpx 0rpx 0rpx;
span { span {
width: 250rpx; width: 250rpx;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB