| | |
| | | </span> |
| | | </view> |
| | | |
| | | <view class="icons share" @click="shareChange()"> |
| | | <!-- <view class="icons share" @click="shareChange()"> |
| | | <u-icon size="30" name="share-fill"></u-icon> |
| | | <view>分享</view> |
| | | </view> |
| | | </view> --> |
| | | <view class="icons share" style="margin-top: -15px;"> |
| | | <button open-type="share" class="custom-share-btn" plain="true" style="border: none;"> |
| | | <u-icon size="30" name="share-fill" :data-obj="item"></u-icon> |
| | | </button> |
| | | <view style="margin-top: -14px;">分享</view> |
| | | </view> |
| | | |
| | | |
| | | <view class="icons" @click="clickFavorite(goodsDetail.id)"> |
| | | <u-icon size="30" :color="favorite ? '#f2270c' : '#262626'" |
| | | :name="favorite ? 'heart-fill' : 'heart'"></u-icon> |
| | |
| | | import popups from "@/pages/product/popups/popups.vue"; //气泡框 |
| | | import takeDownFormSaleGoods from "@/pages/product/m-take-down-sale-goods/index.vue"; //下架框 |
| | | import setup from "@/pages/product/product/popup/popup.js"; |
| | | import { getSessionId, userAction } from "@/api/userAction.js"; |
| | | import { getSessionId, userAction,userShare } from "@/api/userAction.js"; |
| | | |
| | | import { getGoodsDetail } from "@/api/video.js" |
| | | import { |
| | |
| | | touchStartX: 0, |
| | | touchEndX: 0, |
| | | minSwipeDistance: 100, // 最小滑动距离,用于判断是否为有效滑动 |
| | | pageSessionNo:"", |
| | | actionParam:{ |
| | | sessionId:'', |
| | | actionType:"PAGE", |
| | | joinType:"SELF", |
| | | pageCode:"SWIPER_GOODS", |
| | | pageParams:"{}", |
| | | pageStatus:"JOIN", |
| | | pageType:"DETAIL" |
| | | } |
| | | pageSessionNo:"", |
| | | actionParam:{ |
| | | sessionId:'', |
| | | actionType:"PAGE", |
| | | joinType:"SELF", |
| | | pageCode:"RECOMMEND_VIDEO_LEFT_GOODS", |
| | | pageParams:"{}", |
| | | pageStatus:"JOIN", |
| | | pageType:"DETAIL" |
| | | }, |
| | | shareParam:{ |
| | | pageCode:"RECOMMEND_VIDEO_LEFT_GOODS", |
| | | shareOption:"{}", |
| | | pageType:"DETAIL" |
| | | }, |
| | | shareId:'', |
| | | }; |
| | | }, |
| | | |
| | |
| | | this.productRefHeight = windowHeight - bottomHeight + "px"; |
| | | }, |
| | | async onLoad(options) { |
| | | if(options.shareId){ |
| | | this.actionParam.shareId = options.shareId; |
| | | this.actionParam.joinType = 'SHARE'; |
| | | uni.setStorage({ |
| | | key: 'shareId', |
| | | data: options.shareId, |
| | | success: function () { |
| | | console.log('缓存shareId成功'); |
| | | } |
| | | }); |
| | | console.log('触发onLoad') |
| | | } |
| | | this.actionParam.pageParams = JSON.stringify(options) |
| | | |
| | | this.videoId = options.videoId; |
| | |
| | | |
| | | // #ifdef MP-WEIXIN |
| | | // 小程序默认分享 |
| | | uni.showShareMenu({ |
| | | withShareTicket: true, |
| | | menus: ["shareAppMessage", "shareTimeline"], |
| | | }); |
| | | // uni.showShareMenu({ |
| | | // withShareTicket: true, |
| | | // menus: ["shareAppMessage", "shareTimeline"], |
| | | // }); |
| | | // #endif |
| | | }, |
| | | onUnload() { |
| | | let param = this.actionParam; |
| | | let param = Object.assign({}, this.actionParam); |
| | | if (this.sendOnShow)return |
| | | param.pageStatus = "LEAVE" |
| | | userAction(param) |
| | | }, |
| | | onHide() { |
| | | this.startHidenTime = Date.now() |
| | | let param = this.actionParam; |
| | | let param = Object.assign({}, this.actionParam); |
| | | this.sendOnShow = true; |
| | | param.pageStatus = "LEAVE" |
| | | userAction(param) |
| | |
| | | getSessionId().then(res=>{ |
| | | this.pageSessionNo = res.data.data |
| | | if(this.pageSessionNo){ |
| | | let param = this.actionParam; |
| | | let param = Object.assign({}, this.actionParam); |
| | | param.sessionId = this.pageSessionNo |
| | | userAction(param) |
| | | } |
| | |
| | | // this.init(this.routerVal.id, this.routerVal.goodsId, this.routerVal.distributionId); |
| | | // } |
| | | }, |
| | | |
| | | onShareAppMessage(e){ |
| | | console.log(e) |
| | | return new Promise((resolve) => { |
| | | this.shareId = ''; |
| | | let shareObj ={ |
| | | id:e.id, |
| | | goodsId:e.goodsId |
| | | } |
| | | this.shareParam.shareOption = JSON.stringify(shareObj) |
| | | userShare(this.shareParam).then(res => { |
| | | this.shareId = res.data.data; |
| | | // 当获取到shareId后,再resolve分享配置 |
| | | resolve({ |
| | | title: this.goodsDetail.goodsName, |
| | | path: '/pages/product/goods' +'?id='+ e.id + '&goodsId=' + e.goodsId +'&shareId=' + this.shareId, |
| | | imageUrl: this.goodsDetail.goodsGalleryList[0], |
| | | success(e) { |
| | | console.log("分享成功", e); |
| | | }, |
| | | fail(e) { |
| | | console.log('分享失败', e); |
| | | } |
| | | }); |
| | | }).catch(err => { |
| | | // 处理错误情况,例如使用默认参数 |
| | | console.error('获取分享ID失败', err); |
| | | resolve({ |
| | | title: this.goodsDetail.goodsName, |
| | | path: '/pages/product/goods' +'?id='+ e.id+ '&goodsId=' + e.goodsId, |
| | | imageUrl: this.goodsDetail.goodsGalleryList[0], |
| | | }); |
| | | }); |
| | | }); |
| | | }, |
| | | methods: { |
| | | // 获取商品列表 |
| | | async getGoodsList() { |