| | |
| | | <!-- 仅h5有效 打开App --> |
| | | |
| | | <!-- 分享 --> |
| | | <shares v-if="enableShare && goodsDetail.id" :skuId="this.routerVal.id" :goodsId="this.routerVal.goodsId" :link=" |
| | | <!-- <shares v-if="enableShare && goodsDetail.id" :skuId="this.routerVal.id" :goodsId="this.routerVal.goodsId" :link=" |
| | | '/pages/product/goods?id=' + |
| | | this.routerVal.id + |
| | | '&goodsId=' + |
| | | this.routerVal.goodsId |
| | | " :thumbnail="goodsDetail.thumbnail" :goodsName="goodsDetail.goodsName" type="goods" |
| | | @close="enableShare = false" /> |
| | | --> |
| | | |
| | | <popups v-model="popupsSwitch" @tapPopup="handleNavbarList" :popData="navbarListData" :x="navbarListX" |
| | | :y="navbarListY" placement="top-start" /> |
| | | <view class="index"> |
| | |
| | | </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"></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 GoodsSwiper from "@/pages/product/product/goods/-goods-swiper.vue"; //轮播图组件 |
| | | import popupGoods from "@/pages/product/m-buy/goods.vue"; //购物车商品的模块 |
| | | import popupAddress from "@/pages/product/product/popup/address.vue"; //地址选择模块 |
| | | import shares from "@/pages/product/m-share/index.vue"; //分享 |
| | | |
| | | import popups from "@/pages/product/popups/popups.vue"; //气泡框 |
| | | import takeDownFormSaleGoods from "@/pages/product/m-take-down-sale-goods/index.vue"; //下架框 |
| | | import setup from "./product/popup/popup"; |
| | | import { getSessionId, userAction } from "@/api/userAction.js"; |
| | | import { |
| | | getSTSToken |
| | | } from '@/api/common.js' |
| | | import { getSessionId, userAction,userShare } from "@/api/userAction.js"; |
| | | import { getSTSToken } from '@/api/common.js' |
| | | export default { |
| | | components: { |
| | | popups, |
| | | shares, |
| | | PromotionLayout, |
| | | PromotionDetailsLayout, |
| | | PromotionAssembleLayout, |
| | |
| | | pageCode:"GOODS_DETAILS", |
| | | shareOption:"{}", |
| | | pageType:"DETAIL" |
| | | } |
| | | }, |
| | | shareId:'', |
| | | }; |
| | | }, |
| | | |
| | |
| | | |
| | | this.productRefHeight = windowHeight - bottomHeight + "px"; |
| | | }, |
| | | |
| | | |
| | | |
| | | onShareAppMessage(e) { |
| | | console.log("开始分享") |
| | | console.log(this.goodsDetail) |
| | | // 返回一个Promise |
| | | return new Promise((resolve) => { |
| | | |
| | | this.shareId = ''; |
| | | this.shareParam.shareOption = JSON.stringify(this.routerVal) |
| | | userShare(this.shareParam).then(res => { |
| | | this.shareId = res.data.data; |
| | | |
| | | |
| | | // 当获取到shareId后,再resolve分享配置 |
| | | resolve({ |
| | | title: this.goodsDetail.goodsName, |
| | | path: '/pages/product/goods' +'?id='+ this.routerVal.id + '&goodsId=' + this.routerVal.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='+ this.routerVal.id + '&goodsId=' + this.routerVal.goodsId, |
| | | imageUrl: this.goodsDetail.goodsGalleryList[0], |
| | | }); |
| | | }); |
| | | }); |
| | | }, |
| | | async onLoad (options) { |
| | | |
| | | if(option.shareId){ |
| | | this.actionParam.shareId = option.shareId; |
| | | this.actionParam.joinType = 'SHARE' |
| | | console.log('触发onLoad') |
| | | } |
| | | this.actionParam.pageParams = JSON.stringify(option) |
| | | if(options.q){ |
| | | const queryParam = { |
| | | id:'', |
| | |
| | | console.log(this.routerVal) |
| | | |
| | | // #ifdef MP-WEIXIN |
| | | // 小程序默认分享 |
| | | 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) |
| | | } |