Commit fbba4b23 by yuzhenWang

Merge branch 'feature-20260203-解决外部跳转页面登录问题' into 'dev'

修复分享产品,分享数据没数据

See merge request !107
parents 14704ba0 54bb458d
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
<uni-popup ref="timePopup" type="bottom" :maskClick="false"> <uni-popup ref="timePopup" type="bottom" :maskClick="false">
<view class="timeBox"> <view class="timeBox">
<view class="titleBox"> <view class="titleBox">
<view @click="cancel" style="color:#333;">取消</view> <view @click.stop="cancel" style="color:#333;">取消</view>
<view style="color:#20279b;" @click="confirm">确定</view> <view style="color:#20279b;" @click.stop="confirm">确定</view>
</view> </view>
<picker-view :indicator-style="indicatorStyle" :value="value" @change="bindChange" class="picker-view"> <picker-view :indicator-style="indicatorStyle" :value="value" @change="bindChange" class="picker-view">
<picker-view-column v-if="showYear"> <picker-view-column v-if="showYear">
...@@ -178,6 +178,7 @@ export default { ...@@ -178,6 +178,7 @@ export default {
immediate: true, immediate: true,
handler(newVal) { handler(newVal) {
if (newVal && (newVal.year || newVal.month || newVal.day)) { if (newVal && (newVal.year || newVal.month || newVal.day)) {
this.updateSelectedDate(newVal); this.updateSelectedDate(newVal);
} else { } else {
// 没有传入有效日期时,清空显示 // 没有传入有效日期时,清空显示
......
...@@ -491,7 +491,11 @@ ...@@ -491,7 +491,11 @@
link: `${shareURL}/pages/lanch/index?fileId=${this.fileId}&coursesharing=1&serialsNo=${nanoid()}&shareCode=${shareCode}&shareUserId=${this.userId}&jumpUrl=${jumptime}&landingPage=courseDetail&miniShare=1`, link: `${shareURL}/pages/lanch/index?fileId=${this.fileId}&coursesharing=1&serialsNo=${nanoid()}&shareCode=${shareCode}&shareUserId=${this.userId}&jumpUrl=${jumptime}&landingPage=courseDetail&miniShare=1`,
imgUrl: this.courseInfo.displayImage, //图片 imgUrl: this.courseInfo.displayImage, //图片
sharePage:'courseDetail',//分享的哪个页面 sharePage:'courseDetail',//分享的哪个页面
commonId: shareCode commonId: shareCode,
userId:this.userId,
fileId:this.fileId,
shareCode:shareCode,
isSaveShare:'1',//是否存贮分享便于统计分享数据
} }
wx.miniProgram.postMessage({ wx.miniProgram.postMessage({
data:{ data:{
...@@ -835,22 +839,24 @@ ...@@ -835,22 +839,24 @@
const jumptime = Date.parse(new Date()) / 1000 const jumptime = Date.parse(new Date()) / 1000
if(dataHandling.h5RuntimeEnv() == 'wechat-miniprogram'){ if(dataHandling.h5RuntimeEnv() == 'wechat-miniprogram'){
let newLink = '' let newLink = ''
if(uni.getStorageSync('loginType')=='codelogin'){
newLink = `${shareURL}/pages/lanch/index?fileId=${this.fileId}&coursesharing=1&serialsNo=${nanoid()}&shareCode=${shareCode}&shareUserId=${this.userId}&jumpUrl=${jumptime}&landingPage=courseDetail&miniShare=1`
}else {
newLink = `${shareURL}/pages/lanch/index?fileId=${this.fileId}&landingPage=courseDetail&miniShare=1`
}
let shareInfo = { let shareInfo = {
title: this.courseInfo.fileTitle, title: this.courseInfo.fileTitle,
// desc: '加入我们开启学习之旅', // desc: '加入我们开启学习之旅',
desc:this.courseInfo.fileSynopsis, desc:this.courseInfo.fileSynopsis,
// link: `${shareURL}/pages/lanch/index?fileId=${this.fileId}&coursesharing=1&serialsNo=${nanoid()}&shareCode=${shareCode}&shareUserId=${this.userId}&jumpUrl=${jumptime}&landingPage=courseDetail&miniShare=1`,
link: newLink,
// link: shareURL + "/pages/courseDetail/courseDetail?fileId=" + this.fileId, //分享链接
imgUrl: this.courseInfo.displayImage, //图片 imgUrl: this.courseInfo.displayImage, //图片
sharePage:'courseDetail',//分享的哪个页面 sharePage:'courseDetail',//分享的哪个页面
commonId: shareCode commonId: shareCode,
shareCode:shareCode,
isSaveShare:'1',//是否存贮分享便于统计分享数据
fileId:this.fileId,
} }
if(uni.getStorageSync('loginType')=='codelogin'){
shareInfo.userId = this.userId
newLink = `${shareURL}/pages/lanch/index?fileId=${this.fileId}&coursesharing=1&serialsNo=${nanoid()}&shareCode=${shareCode}&shareUserId=${this.userId}&jumpUrl=${jumptime}&landingPage=courseDetail&miniShare=1`
}else {
newLink = `${shareURL}/pages/lanch/index?fileId=${this.fileId}&landingPage=courseDetail&miniShare=1`
}
shareInfo.link = newLink
wx.miniProgram.postMessage({ wx.miniProgram.postMessage({
data:{ data:{
type:'share', type:'share',
...@@ -1369,48 +1375,7 @@ ...@@ -1369,48 +1375,7 @@
// fileFirstImage:'' // fileFirstImage:''
// } // }
}, },
sendMessageToMiniProgram() {
// 确保wx对象已存在
if (typeof wx === 'undefined') {
console.error('微信JS-SDK未加载');
return false;
}
// 构建要传递的数据
const messageData = {
type: 'showOrderPopup',
action: 'purchase',
orderCodeUrl: this.orderCodeUrl,
title: this.courseInfo.fileTitle,
price: this.courseInfo.coursePrice,
fileId: this.fileId,
timestamp: Date.now()
};
console.log('准备发送消息到小程序:', messageData);
try {
if (wx.miniProgram) {
wx.miniProgram.postMessage({
data: messageData
});
// 2. 然后触发导航(让消息被接收)这种方法不行
wx.miniProgram.navigateBack({
delta: 0 // 后退0层,相当于刷新当前页
});
console.log('消息发送并触发接收成功');
} else {
console.error('wx.miniProgram不存在');
return false;
}
return true;
} catch (error) {
console.error('发送消息失败:', error);
return false;
}
},
startPolling() { startPolling() {
// 先清除可能存在的旧定时器 // 先清除可能存在的旧定时器
......
...@@ -392,13 +392,13 @@ ...@@ -392,13 +392,13 @@
title: this.shareItem.fileTitle, title: this.shareItem.fileTitle,
desc: this.shareItem.fileSynopsis, desc: this.shareItem.fileSynopsis,
link: `${shareURL}/pages/lanch/index?fileId=${this.shareItem.fileId}&coursesharing=1&serialsNo=${nanoid()}&shareCode=${shareCode}&shareUserId=${this.userId}&jumpUrl=${jumptime}&landingPage=courseDetail&miniShare=1`, link: `${shareURL}/pages/lanch/index?fileId=${this.shareItem.fileId}&coursesharing=1&serialsNo=${nanoid()}&shareCode=${shareCode}&shareUserId=${this.userId}&jumpUrl=${jumptime}&landingPage=courseDetail&miniShare=1`,
// link: shareURL + "/pages/courseDetail/courseDetail?fileId=" + this.shareItem.fileId +
// '&coursesharing=1' + '&serialsNo=' + nanoid() + '&shareCode=' + shareCode +
// '&shareUserId=' +
// this.userId + '&jumpUrl=' + jumptime + "&", //分享链接
imgUrl: this.shareItem.displayImage, //图片 imgUrl: this.shareItem.displayImage, //图片
commonId: this.shareItem.fileId, commonId: this.shareItem.fileId,
sharePage: 'courseDetail' //分享出去得页面 sharePage: 'courseDetail', //分享出去得页面
userId:this.userId,
fileId:this.shareItem.fileId,
shareCode:shareCode,
isSaveShare:'1',//是否存贮分享便于统计分享数据
} }
wx.miniProgram.postMessage({ wx.miniProgram.postMessage({
data: { data: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment