chore:微信小程序分享给好友和微信分享功能一样
This commit is contained in:
@@ -112,10 +112,10 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 立即分享链接按钮:黄橙渐变,小圆角 -->
|
||||
<view @tap="copyLink" style="margin-top:20rpx;height:80rpx;display:flex;justify-content:center;align-items:center;background:linear-gradient(90deg,#FFC107 0%,#FF8F00 100%);border-radius:16rpx;box-shadow:0 4rpx 12rpx rgba(255,143,0,0.3);position:relative;z-index:1;">
|
||||
<!-- 立即分享链接按钮:黄橙渐变,小圆角,触发微信原生分享 -->
|
||||
<button open-type="share" @tap="onShareClick" style="margin-top:20rpx;height:80rpx;display:flex;justify-content:center;align-items:center;background:linear-gradient(90deg,#FFC107 0%,#FF8F00 100%);border-radius:16rpx;box-shadow:0 4rpx 12rpx rgba(255,143,0,0.3);position:relative;z-index:1;border:none;line-height:1;">
|
||||
<text style="font-size:28rpx;font-weight:700;color:#FFFFFF;">📤 {{ value.buttonText || '立即分享' }}</text>
|
||||
</view>
|
||||
</button>
|
||||
<!-- showLink -->
|
||||
<view v-if="isFeatureOn(value.showLink)" style="margin-top:20rpx;text-align:center;position:relative;z-index:1;">
|
||||
<text @tap="copyLink" style="font-size:22rpx;color:#999;text-decoration:underline;">{{ formatShareLink }}</text>
|
||||
@@ -171,10 +171,10 @@
|
||||
<text style="font-size:24rpx;color:#FF6B6B;font-weight:600;">复制推荐码</text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 立即分享链接按钮:红色背景全宽铺满 -->
|
||||
<view @tap="copyLink" style="margin-top:16rpx;height:76rpx;display:flex;justify-content:center;align-items:center;background:linear-gradient(90deg,#FF6B6B 0%,#FF4444 100%);border-radius:38rpx;box-shadow:0 4rpx 12rpx rgba(255,68,68,0.3);position:relative;z-index:1;">
|
||||
<!-- 立即分享链接按钮:红色背景全宽铺满,触发微信原生分享 -->
|
||||
<button open-type="share" @tap="onShareClick" style="margin-top:16rpx;height:76rpx;display:flex;justify-content:center;align-items:center;background:linear-gradient(90deg,#FF6B6B 0%,#FF4444 100%);border-radius:38rpx;box-shadow:0 4rpx 12rpx rgba(255,68,68,0.3);position:relative;z-index:1;border:none;line-height:1;">
|
||||
<text style="font-size:27rpx;font-weight:700;color:#FFFFFF;">📤 {{ value.buttonText || '立即分享' }}</text>
|
||||
</view>
|
||||
</button>
|
||||
<!-- showLink -->
|
||||
<view v-if="isFeatureOn(value.showLink)" style="margin-top:16rpx;text-align:center;position:relative;z-index:1;">
|
||||
<text @tap="copyLink" style="font-size:22rpx;color:#999;text-decoration:underline;">{{ formatShareLink }}</text>
|
||||
@@ -216,10 +216,10 @@
|
||||
<text style="font-size:24rpx;color:#FF6B6B;font-weight:600;">复制推荐码</text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 立即分享链接按钮:全宽铺满白底红边框 -->
|
||||
<view @tap="copyLink" style="margin-top:16rpx;height:76rpx;display:flex;justify-content:center;align-items:center;background:#FFFFFF;border:2rpx solid #FF6B6B;border-radius:38rpx;position:relative;z-index:1;">
|
||||
<!-- 立即分享链接按钮:全宽铺满白底红边框,触发微信原生分享 -->
|
||||
<button open-type="share" @tap="onShareClick" style="margin-top:16rpx;height:76rpx;display:flex;justify-content:center;align-items:center;background:#FFFFFF;border:2rpx solid #FF6B6B;border-radius:38rpx;position:relative;z-index:1;line-height:1;">
|
||||
<text style="font-size:27rpx;font-weight:600;color:#FF6B6B;">📤 {{ value.buttonText || '立即分享' }}</text>
|
||||
</view>
|
||||
</button>
|
||||
<!-- showLink -->
|
||||
<view v-if="isFeatureOn(value.showLink)" style="margin-top:16rpx;text-align:center;position:relative;z-index:1;">
|
||||
<text @tap="copyLink" style="font-size:22rpx;color:#999;text-decoration:underline;">{{ formatShareLink }}</text>
|
||||
@@ -263,10 +263,10 @@
|
||||
<text style="font-size:22rpx;">📋</text>
|
||||
<text style="font-size:24rpx;color:#FF8F00;font-weight:600;">复制推荐码</text>
|
||||
</view>
|
||||
<!-- 右下角:立即分享链接按钮(渐变橙色圆角胶囊,靠右,略低于左侧) -->
|
||||
<view @tap="copyLink" style="height:72rpx;display:flex;justify-content:center;align-items:center;background:linear-gradient(90deg,#FF9800 0%,#FF4444 100%);border-radius:36rpx;padding:0 40rpx;box-shadow:0 4rpx 12rpx rgba(255,68,68,0.25);margin-bottom:-4rpx;">
|
||||
<!-- 右下角:立即分享链接按钮(渐变橙色圆角胶囊,靠右,触发微信原生分享) -->
|
||||
<button open-type="share" @tap="onShareClick" style="height:72rpx;display:flex;justify-content:center;align-items:center;background:linear-gradient(90deg,#FF9800 0%,#FF4444 100%);border-radius:36rpx;padding:0 40rpx;box-shadow:0 4rpx 12rpx rgba(255,68,68,0.25);margin-bottom:-4rpx;border:none;line-height:1;">
|
||||
<text style="font-size:27rpx;font-weight:700;color:#FFFFFF;">📤 {{ value.buttonText || '立即分享' }}</text>
|
||||
</view>
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 换一个新码 -->
|
||||
@@ -686,9 +686,19 @@ export default {
|
||||
},
|
||||
onShareTimeline() {
|
||||
const v = this.nc;
|
||||
// 从H5分享链接中提取完整查询参数,与分享给好友保持一致
|
||||
var query = '';
|
||||
try {
|
||||
var shareLink = this.formatShareLink;
|
||||
var queryIndex = shareLink.indexOf('?');
|
||||
if (queryIndex >= 0) {
|
||||
query = shareLink.substring(queryIndex + 1); // id=13&uniacid=1&recommend_code=XXX
|
||||
}
|
||||
} catch(e) {}
|
||||
if (!query && this.code) query = 'recommend_code=' + encodeURIComponent(this.code);
|
||||
return {
|
||||
title: v.shareTitle || v.title || '邀您入驻低空经济产业平台',
|
||||
query: this.code ? ('recommend_code=' + encodeURIComponent(this.code)) : '',
|
||||
query: query,
|
||||
imageUrl: v.shareImageUrl || ''
|
||||
};
|
||||
},
|
||||
@@ -1036,9 +1046,20 @@ onShareClick() {
|
||||
});
|
||||
},
|
||||
extractMiniProgramPath() {
|
||||
// 直接生成落地页路径,不需要解析后端废弃shareLink
|
||||
// 从H5分享链接中提取完整查询参数,保持小程序分享与H5链接参数一致
|
||||
// H5链接如: http://xxx/hwappx/common/pages_tool/form/formdata?id=13&uniacid=1&recommend_code=XXX
|
||||
// 小程序路径如: /pages_tool/form/formdata?id=13&uniacid=1&recommend_code=XXX
|
||||
const shareLink = this.formatShareLink;
|
||||
try {
|
||||
var queryIndex = shareLink.indexOf('?');
|
||||
if (queryIndex >= 0) {
|
||||
var query = shareLink.substring(queryIndex); // ?id=13&uniacid=1&recommend_code=XXX
|
||||
return '/pages_tool/form/formdata' + query;
|
||||
}
|
||||
} catch(e) {}
|
||||
// 兜底:只带recommend_code
|
||||
if (!this.code) return '/pages_tool/form/formdata';
|
||||
return `/pages_tool/form/formdata?recommend_code=${encodeURIComponent(this.code)}`;
|
||||
return '/pages_tool/form/formdata?recommend_code=' + encodeURIComponent(this.code);
|
||||
},
|
||||
_persistRecommendInfo() {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user