Commit 4c80f4cf by yuzhenWang

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

cffp分享数据统计,返回小程序多次统计发布生产

See merge request !108
parents fbba4b23 e6b5aaad
<template> <template>
<view class="container"> <view class="container">
<!-- 禁用弹窗 --> <!-- 禁用弹窗 -->
<restrictedTip ref="restrictedTip"/> <restrictedTip ref="restrictedTip" />
<view v-if="!mpCffp"> <view v-if="!mpCffp">
<view class="shareheader" style="" v-if="coursesharing != 1 || deviceType==3"> <view class="shareheader" style="" v-if="coursesharing != 1 || deviceType==3">
<!-- #ifdef APP --> <!-- #ifdef APP -->
<view class="iconfont icon-youjiantou" style="margin-left: 30rpx;" @click="goBack()"></view> <view class="iconfont icon-youjiantou" style="margin-left: 30rpx;" @click="goBack()"></view>
<!-- #endif --> <!-- #endif -->
<view class="share-entrance" > <view class="share-entrance">
<view style="z-index: 99999;"> <view style="z-index: 99999;">
<uni-popup ref="share" type="top" safeArea backgroundColor="#F4F2F3" :maskClick='true' <uni-popup ref="share" type="top" safeArea backgroundColor="#F4F2F3" :maskClick='true'
@change="maskClick"> @change="maskClick">
<uni-popup-share @select="sharechange"></uni-popup-share> <uni-popup-share @select="sharechange"></uni-popup-share>
</uni-popup> </uni-popup>
</view> </view>
<!-- v-if="isWxH5" --> <!-- v-if="isWxH5" -->
<view v-if="isWxH5" style="width: 40rpx;height: 40rpx;padding-right: 20rpx;"> <view v-if="isWxH5" style="width: 40rpx;height: 40rpx;padding-right: 20rpx;">
<image class="image" @click="reinvite" src="../../static/fastentry/Slice122.png" mode=""></image> <image class="image" @click="reinvite" src="../../static/fastentry/Slice122.png" mode="">
</view> </image>
<view class="" style="width: 40rpx;height: 40rpx; "> </view>
<image class="image" @click="shareToggle" src="../../static/fastentry/Slice12.png" mode=""></image> <view class="" style="width: 40rpx;height: 40rpx; ">
</view> <image class="image" @click="shareToggle" src="../../static/fastentry/Slice12.png" mode="">
</image>
</view>
</view> </view>
</view> </view>
</view> </view>
<!-- 课程banner图 --> <!-- 课程banner图 -->
<!-- v-show="!sliceshare" --> <!-- v-show="!sliceshare" -->
<view class="courseBannerBox" v-if="!sliceshare && bannerViewType == '1'"> <view class="courseBannerBox" v-if="!sliceshare && bannerViewType == '1'">
<video v-if="isRenderVideo" id="myVideo" :src="courseInfo.filePathOss" :initial-time="viewTime" <video v-if="isRenderVideo" id="myVideo" :src="courseInfo.filePathOss" :initial-time="viewTime"
object-fit="contain" class="videoBox" :poster="courseInfo.fileFirstImage" :title="courseInfo.fileTitle" object-fit="contain" class="videoBox" :poster="courseInfo.fileFirstImage" :title="courseInfo.fileTitle"
@play="playVideo" @pause="pause" @timeupdate="timeupdate" style="width: 100vw;height: 312.5rpx;" @play="playVideo" @pause="pause" @timeupdate="timeupdate"
></video> style="width: 100vw;height: 312.5rpx;"></video>
</view> </view>
<view class="swiperBox" v-if="bannerViewType == '2'"> <view class="swiperBox" v-if="bannerViewType == '2'">
<uni-swiper-dot <uni-swiper-dot :dots-styles="{
:dots-styles="{
backgroundColor: 'rgba(145, 151, 201, .5)', backgroundColor: 'rgba(145, 151, 201, .5)',
selectedBackgroundColor: 'rgba(255, 255, 255, 1)', selectedBackgroundColor: 'rgba(255, 255, 255, 1)',
bottom:100, bottom:100,
selectedBorder: '10rpx rgba(255, 255, 255, 1) solid', selectedBorder: '10rpx rgba(255, 255, 255, 1) solid',
width:8 width:8
}" :info="swiperList" :current="current" mode="default"> }" :info="swiperList" :current="current" mode="default">
<swiper autoplay :indicator-dots="true" :interval="3000" circular class="swiper-box" @change="changeSwiper"> <swiper autoplay :indicator-dots="true" :interval="3000" circular class="swiper-box"
@change="changeSwiper">
<swiper-item v-for="(item,index) in swiperList" :key="index" class="swiper-item-no-gap"> <swiper-item v-for="(item,index) in swiperList" :key="index" class="swiper-item-no-gap">
<view class="swiper-item"> <view class="swiper-item">
<image style="height: 100%;width: 100%;display: block;" :src="item['filePath']" mode="aspectFill"></image> <image style="height: 100%;width: 100%;display: block;" :src="item['filePath']"
mode="aspectFill"></image>
</view> </view>
</swiper-item> </swiper-item>
</swiper> </swiper>
</uni-swiper-dot> </uni-swiper-dot>
</view> </view>
<!-- 课程详情图 --> <!-- 课程详情图 -->
...@@ -66,11 +69,12 @@ ...@@ -66,11 +69,12 @@
<h4>{{courseInfo.fileTitle}}</h4> <h4>{{courseInfo.fileTitle}}</h4>
<view>{{courseInfo.fileSynopsis}}</view> <view>{{courseInfo.fileSynopsis}}</view>
</view> </view>
</view> </view>
<view class="dataBox"> <view class="dataBox">
<strong v-if="(courseInfo.status==1 || courseInfo.status==2 )&& courseInfo.coursePrice !== 0">{{Number(courseInfo.coursePrice).toFixed(2)}}</strong> <strong
v-if="(courseInfo.status==1 || courseInfo.status==2 )&& courseInfo.coursePrice !== 0">{{Number(courseInfo.coursePrice).toFixed(2)}}</strong>
<text v-if="courseInfo.coursePrice != 0">{{courseInfo.salesNumber}}{{showName}}</text> <text v-if="courseInfo.coursePrice != 0">{{courseInfo.salesNumber}}{{showName}}</text>
</view> </view>
...@@ -125,7 +129,8 @@ ...@@ -125,7 +129,8 @@
<view> <view>
<p><text class="lecturerName">{{lecturerInfo.lecturerName}}</text></p> <p><text class="lecturerName">{{lecturerInfo.lecturerName}}</text></p>
<template v-if="lecturerInfo?.lecturerRankNames"> <template v-if="lecturerInfo?.lecturerRankNames">
<p v-for="(item,index) in lecturerInfo.lecturerRankNames.split(',')" :key="index" class="lecturerTitle"> <p v-for="(item,index) in lecturerInfo.lecturerRankNames.split(',')" :key="index"
class="lecturerTitle">
<text>{{item}}</text> <text>{{item}}</text>
</p> </p>
</template> </template>
...@@ -137,38 +142,27 @@ ...@@ -137,38 +142,27 @@
<view v-html="lecturerInfo?.lecturerIntroduce" class="lecturerText richTextContent"></view> <view v-html="lecturerInfo?.lecturerIntroduce" class="lecturerText richTextContent"></view>
</view> </view>
<view v-if="!mpCffp"> <view v-if="!mpCffp">
<view class="buyBox" @click="saveOrder()" v-if="(courseInfo.status == 1 || courseInfo.status == 2) && courseInfo.coursePrice != 0"> <view class="buyBox" @click="saveOrder()"
v-if="(courseInfo.status == 1 || courseInfo.status == 2) && courseInfo.coursePrice != 0">
<text>{{showName}}</text> <text>{{showName}}</text>
</view> </view>
</view> </view>
<view v-if="mpCffp" class="shareBuyBox"> <view v-if="mpCffp" class="shareBuyBox">
<view class="rightShare" @click="reinvite"> <view class="rightShare" @click="reinvite">
<loadingIcon <loadingIcon :loading="isLoading" v-if="isLoading" loadColor="#20269B" />
:loading="isLoading"
v-if="isLoading"
loadColor="#20269B"
/>
<text style="margin-left: 5rpx;">分享</text> <text style="margin-left: 5rpx;">分享</text>
</view> </view>
<view class="leftBuy" @click="saveOrder()" v-if="(courseInfo.status == 1 || courseInfo.status == 2) && courseInfo.coursePrice != 0"> <view class="leftBuy" @click="saveOrder()"
<loadingIcon v-if="(courseInfo.status == 1 || courseInfo.status == 2) && courseInfo.coursePrice != 0">
:loading="isOrderLoading" <loadingIcon :loading="isOrderLoading" v-if="isOrderLoading" />
v-if="isOrderLoading"
/>
<text style="margin-left: 5rpx;">{{showName}}</text> <text style="margin-left: 5rpx;">{{showName}}</text>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<boot-page <boot-page loginSource="产品详情" v-if="sharelogin" :wayType="wayType" ref="sharelogin" @close="close"></boot-page>
loginSource="产品详情"
v-if="sharelogin"
:wayType="wayType"
ref="sharelogin"
@close="close"
></boot-page>
<uni-share-wx ref="sharewx"></uni-share-wx> <uni-share-wx ref="sharewx"></uni-share-wx>
<!-- <view class="markBox" @click="shareTipsFlag=false" v-if="shareTipsFlag"> <!-- <view class="markBox" @click="shareTipsFlag=false" v-if="shareTipsFlag">
<view class="guideImgBox"> <view class="guideImgBox">
...@@ -181,13 +175,16 @@ ...@@ -181,13 +175,16 @@
</view> --> </view> -->
<!-- 分享得向导图 --> <!-- 分享得向导图 -->
<ShareGuide :show.sync="shareTipsFlag" @close="shareTipsFlag=false"></ShareGuide> <ShareGuide :show.sync="shareTipsFlag" @close="shareTipsFlag=false"></ShareGuide>
<login-popup ref="loginPopupCom" @confirm="c_confirmLoginPopup" @canle="canleLogin" ></login-popup> <login-popup ref="loginPopupCom" @confirm="c_confirmLoginPopup" @canle="canleLogin"></login-popup>
<verify-popup ref="verifyPopupCom" title="温馨提示" content="请问您确认预约本课程吗?" @confirm="c_confirmVerifyPopup" @canle="canleVerify" > <verify-popup ref="verifyPopupCom" title="温馨提示" content="请问您确认预约本课程吗?" @confirm="c_confirmVerifyPopup"
@canle="canleVerify">
</verify-popup> </verify-popup>
<uni-popup ref="subscribeSuccessPopup" :mask-click="false"> <uni-popup ref="subscribeSuccessPopup" :mask-click="false">
<view class="loginPopupBox" style="text-align: center;width: 630rpx;padding-top: 35rpx;letter-spacing: 1rpx;"> <view class="loginPopupBox"
<view style="display: flex;align-items: center;;justify-content: center;font-size: 32rpx;font-weight: bold;color: #20269B;margin:40rpx 0 60rpx 0;"> style="text-align: center;width: 630rpx;padding-top: 35rpx;letter-spacing: 1rpx;">
<view
style="display: flex;align-items: center;;justify-content: center;font-size: 32rpx;font-weight: bold;color: #20269B;margin:40rpx 0 60rpx 0;">
<view style="width: 6%;margin-right: 10rpx;margin-bottom: -10rpx;"> <view style="width: 6%;margin-right: 10rpx;margin-bottom: -10rpx;">
<image src="../../static/images/correct.png" mode="widthFix"></image> <image src="../../static/images/correct.png" mode="widthFix"></image>
</view> </view>
...@@ -199,37 +196,22 @@ ...@@ -199,37 +196,22 @@
{{successMessage}} {{successMessage}}
</view> </view>
<view style="margin-top: 10rpx;"> <view style="margin-top: 10rpx;">
<view @click="c_closeSubscribeSuccessPopup"><button class="popup_replenish_button2" size="mini">关闭</button> <view @click="c_closeSubscribeSuccessPopup"><button class="popup_replenish_button2"
size="mini">关闭</button>
</view> </view>
</view> </view>
</view> </view>
</uni-popup> </uni-popup>
<partner-tip-popup <partner-tip-popup ref="partnerTipPopup" @join="gotoJoinPartner" @continue="continueShare" />
ref="partnerTipPopup"
@join="gotoJoinPartner"
@continue="continueShare"
/>
<!-- 海报弹窗 --> <!-- 海报弹窗 -->
<sharePosterPop <sharePosterPop ref="sharePosterPop" :generatedImage="generatedImage" @closePoster="closePoster"
ref="sharePosterPop" :shareTxt="posterShareTxt" :imgType="posterImgType"></sharePosterPop>
:generatedImage="generatedImage"
@closePoster="closePoster"
:shareTxt="posterShareTxt"
:imgType="posterImgType"
></sharePosterPop>
<!-- #ifdef H5 --> <!-- #ifdef H5 -->
<view class="generateImageBox" ref="captureElement" v-if="!generatedImage"> <view class="generateImageBox" ref="captureElement" v-if="!generatedImage">
<view class="imgBox"> <view class="imgBox">
<img <img v-if="showImg" class="posterImg" @load="handleBgImageLoad" @error="handleBgImageError"
v-if="showImg" style="display: block;" :src="shareItem.fileFirstImage+'?t='+Math.random()" crossorigin="anonymous"
class="posterImg" alt="防缓存图片" />
@load="handleBgImageLoad"
@error="handleBgImageError"
style="display: block;"
:src="shareItem.fileFirstImage+'?t='+Math.random()"
crossorigin="anonymous"
alt="防缓存图片"
/>
</view> </view>
<view class="txtBox"> <view class="txtBox">
<view class="descriptionTxt"> <view class="descriptionTxt">
...@@ -242,12 +224,9 @@ ...@@ -242,12 +224,9 @@
<view class="left"> <view class="left">
<view class="top"> <view class="top">
<view style="width: 100rpx;"> <view style="width: 100rpx;">
<image <image :src="companyLogo" mode="widthFix"></image>
:src="companyLogo"
mode="widthFix"
></image>
</view> </view>
<view class="companyName">银盾家办</view> <view class="companyName">银盾家办</view>
</view> </view>
<view class="bottom"> <view class="bottom">
...@@ -256,15 +235,12 @@ ...@@ -256,15 +235,12 @@
</view> </view>
<!-- 二维码容器 --> <!-- 二维码容器 -->
<view class="qrcode-container"> <view class="qrcode-container">
<canvas <canvas canvas-id="qrcode" class="qrcode-canvas"
canvas-id="qrcode" :style="{width: qrCodeSize + 'px', height: qrCodeSize + 'px'}"></canvas>
class="qrcode-canvas"
:style="{width: qrCodeSize + 'px', height: qrCodeSize + 'px'}"
></canvas>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<!-- #endif --> <!-- #endif -->
</view> </view>
...@@ -279,13 +255,13 @@ ...@@ -279,13 +255,13 @@
import VerifyPopup from "@/components/unipopup/verifyPopup.vue"; import VerifyPopup from "@/components/unipopup/verifyPopup.vue";
import UniShareWx from "@/uni_modules/uni-share-wx/index.vue"; import UniShareWx from "@/uni_modules/uni-share-wx/index.vue";
import dataHandling from "@/util/dataHandling"; import dataHandling from "@/util/dataHandling";
import {hshare,setWechatShare,initJssdkShare} from '@/util/fiveshare'; import { hshare, setWechatShare, initJssdkShare } from '@/util/fiveshare';
import {nanoid} from 'nanoid'; import { nanoid } from 'nanoid';
import common from '../../common/common'; import common from '../../common/common';
import {baseURL,apiURL,cffpURL,companyInfo,shareURL} from "@/environments/environment"; import { baseURL, apiURL, cffpURL, companyInfo, shareURL } from "@/environments/environment";
import sharePosterPop from '@/components/commonPopup/sharePosterPop.vue'; import sharePosterPop from '@/components/commonPopup/sharePosterPop.vue';
import UQRCode from 'uqrcodejs'; import UQRCode from 'uqrcodejs';
import { elementToImage } from '@/util/htmlToImage'; import { elementToImage } from '@/util/htmlToImage';
import loadingIcon from '@/components/loading/loading.vue'; import loadingIcon from '@/components/loading/loading.vue';
import ShareGuide from '@/components/ShareGuide/ShareGuide.vue'; import ShareGuide from '@/components/ShareGuide/ShareGuide.vue';
import wx from 'weixin-js-sdk' import wx from 'weixin-js-sdk'
...@@ -303,21 +279,21 @@ ...@@ -303,21 +279,21 @@
}, },
data() { data() {
return { return {
pollingTimer :null ,// 轮询定时器 pollingTimer: null, // 轮询定时器
miniShareInfo :{},//通过小程序分享出去的信息 miniShareInfo: {}, //通过小程序分享出去的信息
sharePosterObj:{}, sharePosterObj: {},
userInfo: {}, userInfo: {},
wayType:'1', //登陆的类型 wayType: '1', //登陆的类型
partnerType:'',//是否是合伙人 partnerType: '', //是否是合伙人
addSystemType:'', //因为会从其他公众号跳转过来所以接受一下公众号的类型 addSystemType: '', //因为会从其他公众号跳转过来所以接受一下公众号的类型
systemType:companyInfo.systemType, systemType: companyInfo.systemType,
showName:'购买', showName: '购买',
successMessage:'', successMessage: '',
show:false, show: false,
isWxH5:false, isWxH5: false,
bannerViewType: '1', bannerViewType: '1',
swiperList: [], swiperList: [],
current : 0, current: 0,
isWeixin: false, isWeixin: false,
isRenderVideo: false, isRenderVideo: false,
fileId: null, fileId: null,
...@@ -354,9 +330,9 @@ ...@@ -354,9 +330,9 @@
ios: 'https://apps.apple.com/cn/app/%E6%98%AF%E5%A5%BD/id1457958161', ios: 'https://apps.apple.com/cn/app/%E6%98%AF%E5%A5%BD/id1457958161',
scheme: 'com.qdxxzy.user://' scheme: 'com.qdxxzy.user://'
}, },
deviceType:null, deviceType: null,
shareTipsFlag:false, shareTipsFlag: false,
src: '', src: '',
danmuList: [{ danmuList: [{
text: '第 1s 出现的弹幕', text: '第 1s 出现的弹幕',
color: '#ff0000', color: '#ff0000',
...@@ -369,77 +345,77 @@ ...@@ -369,77 +345,77 @@
} }
], ],
danmuValue: '', danmuValue: '',
qrCodeUrl: 'https://example.com',//二维码的链接地址 qrCodeUrl: 'https://example.com', //二维码的链接地址
qrCodeSize: 100,//二维码的尺寸 qrCodeSize: 100, //二维码的尺寸
companyLogo : '../../static/suplogo.png', companyLogo: '../../static/suplogo.png',
generatedImage:'',//生成的海报图片, generatedImage: '', //生成的海报图片,
shareItem:{fileFirstImage:''}, shareItem: { fileFirstImage: '' },
showImg:false, showImg: false,
mpCffp:'', mpCffp: '',
isLoading: false, isLoading: false,
posterDesTxt:'', posterDesTxt: '',
isOrderLoading:false, isOrderLoading: false,
posterShareTxt:'长按图片分享给朋友', posterShareTxt: '长按图片分享给朋友',
orderCodeUrl:'', orderCodeUrl: '',
posterImgType:'sharePoster' posterImgType: 'sharePoster'
}; };
}, },
methods: { methods: {
gotoJoinPartner(){ gotoJoinPartner() {
dataHandling.pocessTracking( dataHandling.pocessTracking(
'加盟', '加盟',
`用户在产品详情未加盟时点击了加盟按钮`, `用户在产品详情未加盟时点击了加盟按钮`,
'点击', '点击',
2, 2,
'产品详情', '产品详情',
'pages/courseDetail/courseDetail' 'pages/courseDetail/courseDetail'
) )
uni.navigateTo({ uni.navigateTo({
url: '/myPackageA/applyFranchise/applyFranchise' url: '/myPackageA/applyFranchise/applyFranchise'
}) })
this.$refs.partnerTipPopup.close() this.$refs.partnerTipPopup.close()
}, },
// 打开微信分享啊 // 打开微信分享啊
reinvite() { reinvite() {
//小程序没登录进入到系统,要回到小程序去登录 //小程序没登录进入到系统,要回到小程序去登录
if(uni.getStorageSync('mpCffp')&&!uni.getStorageSync('dataToken')){ if (uni.getStorageSync('mpCffp') && !uni.getStorageSync('dataToken')) {
this.jumpMplogin() this.jumpMplogin()
return return
} }
// 未登录去登录 // 未登录去登录
if(!uni.getStorageSync('loginType') ||uni.getStorageSync('loginType') == 'visitor'){ if (!uni.getStorageSync('loginType') || uni.getStorageSync('loginType') == 'visitor') {
dataHandling.pocessTracking( dataHandling.pocessTracking(
'分享', '分享',
`用户在产品详情未登录时点击产品分享按钮`, `用户在产品详情未登录时点击产品分享按钮`,
'点击', '点击',
2, 2,
'产品详情', '产品详情',
'pages/courseDetail/courseDetail' 'pages/courseDetail/courseDetail'
) )
this.sharelogin = true, this.sharelogin = true,
this.wayType = '2' this.wayType = '2'
return return
} }
// 已登录,未成为合伙人 // 已登录,未成为合伙人
if(this.userInfo&&!this.userInfo['partnerType']) { if (this.userInfo && !this.userInfo['partnerType']) {
dataHandling.pocessTracking( dataHandling.pocessTracking(
'分享', '分享',
`用户在产品详情未加盟时点击产品分享按钮`, `用户在产品详情未加盟时点击产品分享按钮`,
'点击', '点击',
2, 2,
'产品详情', '产品详情',
'pages/courseDetail/courseDetail' 'pages/courseDetail/courseDetail'
) )
this.$refs.partnerTipPopup.open() this.$refs.partnerTipPopup.open()
return return
} }
this.continueShare() this.continueShare()
}, },
continueShare(){ continueShare() {
this.userId = uni.getStorageSync('cffp_userId') this.userId = uni.getStorageSync('cffp_userId')
const shareCode = nanoid() + this.userId const shareCode = nanoid() + this.userId
const jumptime = Date.parse(new Date()) / 1000 const jumptime = Date.parse(new Date()) / 1000
// if(this.mpCffp){ // if(this.mpCffp){
// if(uni.getStorageSync('posterItem')){ // if(uni.getStorageSync('posterItem')){
// this.shareItem = JSON.parse(JSON.stringify(uni.getStorageSync('posterItem'))) // this.shareItem = JSON.parse(JSON.stringify(uni.getStorageSync('posterItem')))
...@@ -449,7 +425,7 @@ ...@@ -449,7 +425,7 @@
// let newLink = shareURL + "/pages/courseDetail/courseDetail?fileId=" + this.fileId + // let newLink = shareURL + "/pages/courseDetail/courseDetail?fileId=" + this.fileId +
// '&coursesharing=1' + '&serialsNo=' + nanoid() + '&shareCode=' + shareCode + '&shareUserId=' + // '&coursesharing=1' + '&serialsNo=' + nanoid() + '&shareCode=' + shareCode + '&shareUserId=' +
// this.userId + '&jumpUrl=' + jumptime + "&" // this.userId + '&jumpUrl=' + jumptime + "&"
// this.qrCodeUrl = newLink // this.qrCodeUrl = newLink
// this.showImg = true // this.showImg = true
// this.isLoading = true // this.isLoading = true
...@@ -472,55 +448,55 @@ ...@@ -472,55 +448,55 @@
} }
this.$refs.sharewx.open(dataWXform) this.$refs.sharewx.open(dataWXform)
dataHandling.pocessTracking( dataHandling.pocessTracking(
'分享', '分享',
`用户在产品详情点击分享按钮,分享${this.courseInfo.fileTitle}`, `用户在产品详情点击分享按钮,分享${this.courseInfo.fileTitle}`,
'点击', '点击',
2, 2,
'产品详情', '产品详情',
'pages/courseDetail/courseDetail' 'pages/courseDetail/courseDetail'
) )
// #endif // #endif
//#ifdef H5 //#ifdef H5
this.shareTipsFlag = true; this.shareTipsFlag = true;
if(dataHandling.h5RuntimeEnv() == 'wechat-miniprogram'){ if (dataHandling.h5RuntimeEnv() == 'wechat-miniprogram') {
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: `${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, userId: this.userId,
fileId:this.fileId, fileId: this.fileId,
shareCode:shareCode, shareCode: shareCode,
isSaveShare:'1',//是否存贮分享便于统计分享数据 isSaveShare: '1', //是否存贮分享便于统计分享数据
} }
wx.miniProgram.postMessage({ wx.miniProgram.postMessage({
data:{ data: {
type:'share', type: 'share',
shareData:JSON.stringify(shareInfo) shareData: JSON.stringify(shareInfo)
} }
}) })
return return
} }
this.getshareData2(shareCode,jumptime) this.getshareData2(shareCode, jumptime)
// #endif // #endif
this.$refs.partnerTipPopup.close() this.$refs.partnerTipPopup.close()
this.wayType = '1' this.wayType = '1'
}, },
canleLogin(){ canleLogin() {
this.show=false; this.show = false;
}, },
canleVerify(){ canleVerify() {
this.show=false; this.show = false;
}, },
//关闭预约成功弹窗 //关闭预约成功弹窗
c_closeSubscribeSuccessPopup() { c_closeSubscribeSuccessPopup() {
this.show=false; this.show = false;
this.$refs.subscribeSuccessPopup.close(); this.$refs.subscribeSuccessPopup.close();
}, },
//预约成功组件点击确认后的回调函数 //预约成功组件点击确认后的回调函数
...@@ -531,10 +507,10 @@ ...@@ -531,10 +507,10 @@
}).then((res) => { }).then((res) => {
if (res['success']) { if (res['success']) {
this.$refs.verifyPopupCom.canle(); this.$refs.verifyPopupCom.canle();
this.show=true; this.show = true;
this.successMessage=res['message']; this.successMessage = res['message'];
this.$refs.subscribeSuccessPopup.open(); this.$refs.subscribeSuccessPopup.open();
} else { } else {
uni.showToast({ uni.showToast({
title: res['message'], title: res['message'],
...@@ -550,9 +526,9 @@ ...@@ -550,9 +526,9 @@
this.$refs.verifyPopupCom.open(); this.$refs.verifyPopupCom.open();
}, },
//关闭登录 //关闭登录
close(val,loginTypeSync,type) { close(val, loginTypeSync, type) {
// 直接点击了关闭登录的叉号 // 直接点击了关闭登录的叉号
if(type){ if (type) {
this.sharelogin = false this.sharelogin = false
return return
} }
...@@ -562,25 +538,25 @@ ...@@ -562,25 +538,25 @@
this.loginType = loginTypeSync; this.loginType = loginTypeSync;
uni.setStorageSync('cffp_userId', this.userId); uni.setStorageSync('cffp_userId', this.userId);
this.courseDetail(); this.courseDetail();
if(JSON.parse(uni.getStorageSync('cffp_userInfo'))){ if (JSON.parse(uni.getStorageSync('cffp_userInfo'))) {
this.userInfo = JSON.parse(uni.getStorageSync('cffp_userInfo')) this.userInfo = JSON.parse(uni.getStorageSync('cffp_userInfo'))
} }
if(this.wayType == '2' && !this.userInfo['partnerType']){ if (this.wayType == '2' && !this.userInfo['partnerType']) {
this.$refs.partnerTipPopup.open() this.$refs.partnerTipPopup.open()
return return
} }
if(this.wayType == '2' && this.userInfo['partnerType']){ if (this.wayType == '2' && this.userInfo['partnerType']) {
this.continueShare() this.continueShare()
return return
} }
if(loginTypeSync == 'codelogin'&&this.wayType=='1'){ if (loginTypeSync == 'codelogin' && this.wayType == '1') {
setTimeout(() => { setTimeout(() => {
if(this.courseInfo.status == 1){ if (this.courseInfo.status == 1) {
this.jumppurchase(); this.jumppurchase();
} }
}, 500) }, 500)
}else{ } else {
this.startTime = Date.parse(new Date()) / 1000; this.startTime = Date.parse(new Date()) / 1000;
uni.setStorageSync('h5_startTime', this.startTime) uni.setStorageSync('h5_startTime', this.startTime)
setTimeout(() => { setTimeout(() => {
...@@ -591,30 +567,31 @@ ...@@ -591,30 +567,31 @@
this.sharelogin = false this.sharelogin = false
this.wayType = '1' this.wayType = '1'
} }
}, },
isWx_Miniprogram(){ isWx_Miniprogram() {
// 判断是否在微信内 // 判断是否在微信内
// #ifdef APP-PLUS // #ifdef APP-PLUS
this.isWxH5 = true; this.isWxH5 = true;
// #endif // #endif
// #ifndef APP-PLUS // #ifndef APP-PLUS
if(this.isWeiXin()){ if (this.isWeiXin()) {
this.isWxH5 = true; this.isWxH5 = true;
}else{ } else {
this.isWxH5 = false; this.isWxH5 = false;
} }
// #endif // #endif
}, },
/** /**
* 判断是否为微信浏览器 * 判断是否为微信浏览器
* 兼容ios * 兼容ios
* */ * */
isWeiXin() { isWeiXin() {
return /micromessenger/i.test(navigator.userAgent.toLowerCase()) || typeof navigator.wxuserAgent !== 'undefined' return /micromessenger/i.test(navigator.userAgent.toLowerCase()) || typeof navigator.wxuserAgent !==
}, 'undefined'
},
goBack() { goBack() {
uni.navigateBack({ uni.navigateBack({
delta: 1 delta: 1
...@@ -624,18 +601,18 @@ ...@@ -624,18 +601,18 @@
maskClick(val) { maskClick(val) {
this.sliceshare = val.show this.sliceshare = val.show
}, },
shareToggle() { shareToggle() {
this.sliceshare = true this.sliceshare = true
this.$refs.share.open() this.$refs.share.open()
}, },
sharechange(val) { sharechange(val) {
if(val.tabbar){ if (val.tabbar) {
uni.switchTab({ uni.switchTab({
url: val.link url: val.link
}) })
return return
}else{ } else {
uni.navigateTo({ uni.navigateTo({
url: val.link url: val.link
}) })
...@@ -644,27 +621,27 @@ ...@@ -644,27 +621,27 @@
// 订单保存 // 订单保存
saveOrder() { saveOrder() {
//小程序没登录进入到系统,要回到小程序去登录 //小程序没登录进入到系统,要回到小程序去登录
if(uni.getStorageSync('mpCffp')&&!uni.getStorageSync('dataToken')){ if (uni.getStorageSync('mpCffp') && !uni.getStorageSync('dataToken')) {
this.jumpMplogin() this.jumpMplogin()
return return
} }
this.loginType = uni.getStorageSync('loginType'); this.loginType = uni.getStorageSync('loginType');
if (this.loginType === 'visitor') { if (this.loginType === 'visitor') {
this.wayType = '1' this.wayType = '1'
if(this.systemType == 'IOS'){ if (this.systemType == 'IOS') {
this.$refs.loginPopupCom.open(); this.$refs.loginPopupCom.open();
this.show=true; this.show = true;
}else{ } else {
this.sharelogin = true; this.sharelogin = true;
} }
} else { } else {
if (this.coursesharing == '1') { if (this.coursesharing == '1') {
this.h5jump() this.h5jump()
} else { } else {
if(this.systemType == 'IOS'){ if (this.systemType == 'IOS') {
this.$refs.verifyPopupCom.open(); this.$refs.verifyPopupCom.open();
this.show=true; this.show = true;
}else{ } else {
this.jumppurchase(); this.jumppurchase();
} }
} }
...@@ -673,54 +650,54 @@ ...@@ -673,54 +650,54 @@
h5jump() { h5jump() {
let h5userId = uni.getStorageSync('cffp_userId'); let h5userId = uni.getStorageSync('cffp_userId');
if (h5userId) { if (h5userId) {
if(this.systemType == 'IOS'){ if (this.systemType == 'IOS') {
this.show=true; this.show = true;
this.$refs.verifyPopupCom.open(); this.$refs.verifyPopupCom.open();
}else{ } else {
this.jumppurchase(); this.jumppurchase();
} }
} else { } else {
if(this.systemType == 'IOS'){ if (this.systemType == 'IOS') {
this.show=true; this.show = true;
this.$refs.loginPopupCom.open(); this.$refs.loginPopupCom.open();
}else{ } else {
this.sharelogin = true; this.sharelogin = true;
} }
} }
}, },
jumppurchase() { jumppurchase() {
if(uni.getStorageSync('cffp_userInfo')){ if (uni.getStorageSync('cffp_userInfo')) {
this.userInfo = JSON.parse(uni.getStorageSync('cffp_userInfo')) this.userInfo = JSON.parse(uni.getStorageSync('cffp_userInfo'))
} }
// 登录并且是禁用状态 // 登录并且是禁用状态
if(this.userInfo.userIsActive==2){ if (this.userInfo.userIsActive == 2) {
this.$refs.restrictedTip.open() this.$refs.restrictedTip.open()
return return
} }
let orderPlatform = '' let orderPlatform = ''
// 不同得公司主题不同得购买平台 // 不同得公司主题不同得购买平台
// #ifdef APP // #ifdef APP
if(companyInfo.companyType=='1'){ if (companyInfo.companyType == '1') {
orderPlatform = 'JS-FX-APP' orderPlatform = 'JS-FX-APP'
} }
if(companyInfo.companyType=='2'){ if (companyInfo.companyType == '2') {
orderPlatform = 'YDFO-FX-APP' orderPlatform = 'YDFO-FX-APP'
} }
// #endif // #endif
// #ifdef H5 // #ifdef H5
if(companyInfo.companyType=='1'){ if (companyInfo.companyType == '1') {
orderPlatform = 'JS-FX-H5' orderPlatform = 'JS-FX-H5'
} }
if(companyInfo.companyType=='2'){ if (companyInfo.companyType == '2') {
orderPlatform = 'YDFO-FX-H5' orderPlatform = 'YDFO-FX-H5'
} }
// #endif // #endif
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
if(companyInfo.companyType=='1'){ if (companyInfo.companyType == '1') {
orderPlatform = 'JS-FX-MP' orderPlatform = 'JS-FX-MP'
} }
if(companyInfo.companyType=='2'){ if (companyInfo.companyType == '2') {
orderPlatform = 'YDFO-FX-MP' orderPlatform = 'YDFO-FX-MP'
} }
// #endif // #endif
...@@ -729,7 +706,7 @@ ...@@ -729,7 +706,7 @@
productType: '1', productType: '1',
productId: this.courseInfo.fileId, productId: this.courseInfo.fileId,
userId: uni.getStorageSync('cffp_userId'), userId: uni.getStorageSync('cffp_userId'),
shareUserId: this.shareUserId , shareUserId: this.shareUserId,
shareReadId: this.shareReadId, shareReadId: this.shareReadId,
shareCode: this.shareCode, shareCode: this.shareCode,
dataSource: this.coursesharing == 1 ? '2' : this.dataSource dataSource: this.coursesharing == 1 ? '2' : this.dataSource
...@@ -741,21 +718,21 @@ ...@@ -741,21 +718,21 @@
this.userId = uni.getStorageSync('cffp_userId') this.userId = uni.getStorageSync('cffp_userId')
} }
dataHandling.pocessTracking( dataHandling.pocessTracking(
'购买', '购买',
`用户在产品中心点击购买按钮,购买${this.courseInfo.fileTitle}`, `用户在产品中心点击购买按钮,购买${this.courseInfo.fileTitle}`,
'点击', '点击',
2, 2,
'产品详情', '产品详情',
'pages/courseDetail/courseDetail' 'pages/courseDetail/courseDetail'
) )
// 如果是商城跳转到cffp得购买直接弹出海报框 // 如果是商城跳转到cffp得购买直接弹出海报框
// if(this.mpCffp){ // if(this.mpCffp){
// // if(uni.getStorageSync('posterItem')){ // // if(uni.getStorageSync('posterItem')){
// // this.shareItem = JSON.parse(JSON.stringify(uni.getStorageSync('posterItem'))) // // this.shareItem = JSON.parse(JSON.stringify(uni.getStorageSync('posterItem')))
// // } // // }
// // 因为是从家办商城小程序跳转到cffp的,所以这里购买要带家办商城的token, // // 因为是从家办商城小程序跳转到cffp的,所以这里购买要带家办商城的token,
// let dataToken = uni.getStorageSync('dataToken') // let dataToken = uni.getStorageSync('dataToken')
// console.log('家办商城dataToken',dataToken); // console.log('家办商城dataToken',dataToken);
...@@ -817,7 +794,7 @@ ...@@ -817,7 +794,7 @@
}).then(res => { }).then(res => {
if (res['success']) { if (res['success']) {
this.courseInfo = this.shareItem = res['data']['data']; this.courseInfo = this.shareItem = res['data']['data'];
if(this.courseInfo.filePathOss != null && Number(this.courseInfo.filePathOss)){ if (this.courseInfo.filePathOss != null && Number(this.courseInfo.filePathOss)) {
this.bannerViewType = "2"; this.bannerViewType = "2";
this.getBanner(Number(this.courseInfo.filePathOss)); this.getBanner(Number(this.courseInfo.filePathOss));
} }
...@@ -837,36 +814,38 @@ ...@@ -837,36 +814,38 @@
// #ifdef H5 // #ifdef H5
const shareCode = nanoid() + this.userId const shareCode = nanoid() + this.userId
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 = ''
let shareInfo = { let shareInfo = {
title: this.courseInfo.fileTitle, title: this.courseInfo.fileTitle,
// desc: '加入我们开启学习之旅', // desc: '加入我们开启学习之旅',
desc:this.courseInfo.fileSynopsis, desc: this.courseInfo.fileSynopsis,
imgUrl: this.courseInfo.displayImage, //图片 imgUrl: this.courseInfo.displayImage, //图片
sharePage:'courseDetail',//分享的哪个页面 sharePage: 'courseDetail', //分享的哪个页面
commonId: shareCode, commonId: shareCode,
shareCode:shareCode, shareCode: shareCode,
isSaveShare:'1',//是否存贮分享便于统计分享数据 isSaveShare: '1', //是否存贮分享便于统计分享数据
fileId:this.fileId, fileId: this.fileId,
} }
if(uni.getStorageSync('loginType')=='codelogin'){ if (uni.getStorageSync('loginType') == 'codelogin') {
shareInfo.userId = this.userId 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` newLink =
}else { `${shareURL}/pages/lanch/index?fileId=${this.fileId}&coursesharing=1&serialsNo=${nanoid()}&shareCode=${shareCode}&shareUserId=${this.userId}&jumpUrl=${jumptime}&landingPage=courseDetail&miniShare=1`
newLink = `${shareURL}/pages/lanch/index?fileId=${this.fileId}&landingPage=courseDetail&miniShare=1` } else {
newLink =
`${shareURL}/pages/lanch/index?fileId=${this.fileId}&landingPage=courseDetail&miniShare=1`
} }
shareInfo.link = newLink shareInfo.link = newLink
wx.miniProgram.postMessage({ wx.miniProgram.postMessage({
data:{ data: {
type:'share', type: 'share',
shareData:JSON.stringify(shareInfo) shareData: JSON.stringify(shareInfo)
} }
}) })
return return
} }
this.getshareData2(shareCode, jumptime,0) this.getshareData2(shareCode, jumptime, 0)
// #endif // #endif
} }
}) })
...@@ -880,7 +859,7 @@ ...@@ -880,7 +859,7 @@
packFileId: this.courseInfo.packFileId packFileId: this.courseInfo.packFileId
}).then(res => { }).then(res => {
if (res['success']) { if (res['success']) {
if(res['data'] && res['data']['data']){ if (res['data'] && res['data']['data']) {
this.relatedCoursesLists = res['data']['data']['relatedCourseList']; this.relatedCoursesLists = res['data']['data']['relatedCourseList'];
this.nonRequiredCount = res['data']['data']['nonRequiredCount']; this.nonRequiredCount = res['data']['data']['nonRequiredCount'];
this.requiredCount = res['data']['data']['requiredCount']; this.requiredCount = res['data']['data']['requiredCount'];
...@@ -977,27 +956,27 @@ ...@@ -977,27 +956,27 @@
}) })
}, },
sendDanmu: function() { sendDanmu: function() {
this.videoContext.sendDanmu({ this.videoContext.sendDanmu({
text: this.danmuValue, text: this.danmuValue,
color: this.getRandomColor() color: this.getRandomColor()
}); });
this.danmuValue = ''; this.danmuValue = '';
}, },
videoErrorCallback: function(e) { videoErrorCallback: function(e) {
uni.showModal({ uni.showModal({
content: e.target.errMsg, content: e.target.errMsg,
showCancel: false showCancel: false
}) })
}, },
getRandomColor: function() { getRandomColor: function() {
const rgb = [] const rgb = []
for (let i = 0; i < 3; ++i) { for (let i = 0; i < 3; ++i) {
let color = Math.floor(Math.random() * 256).toString(16) let color = Math.floor(Math.random() * 256).toString(16)
color = color.length == 1 ? '0' + color : color color = color.length == 1 ? '0' + color : color
rgb.push(color) rgb.push(color)
} }
return '#' + rgb.join('') return '#' + rgb.join('')
}, },
// 点击播放 // 点击播放
playVideo(e) { playVideo(e) {
this.isPauseFlag = false; this.isPauseFlag = false;
...@@ -1031,7 +1010,7 @@ ...@@ -1031,7 +1010,7 @@
} }
} }
}, },
timeupdate(e) { timeupdate(e) {
this.totalTime = e.detail.duration; this.totalTime = e.detail.duration;
// 播放进度变化 // 播放进度变化
this.viewTime = e.detail.currentTime > this.totalTime ? this.totalTime : e.detail.currentTime; this.viewTime = e.detail.currentTime > this.totalTime ? this.totalTime : e.detail.currentTime;
...@@ -1044,9 +1023,7 @@ ...@@ -1044,9 +1023,7 @@
content: '购买之后才可继续播放哦~', content: '购买之后才可继续播放哦~',
showCancel: false, showCancel: false,
success: function(res) { success: function(res) {
if (res.confirm) { if (res.confirm) {} else if (res.cancel) {}
} else if (res.cancel) {
}
} }
}); });
this.videoContext.seek(0); this.videoContext.seek(0);
...@@ -1070,65 +1047,66 @@ ...@@ -1070,65 +1047,66 @@
} }
}) })
}, },
getshareData2(shareCode,jumptime,type=1) { getshareData2(shareCode, jumptime, type = 1) {
let newLink = type==1?shareURL + "/pages/courseDetail/courseDetail?fileId=" + this.fileId + let newLink = type == 1 ? shareURL + "/pages/courseDetail/courseDetail?fileId=" + this.fileId +
'&coursesharing=1' + '&serialsNo=' + nanoid() + '&shareCode=' + shareCode + '&shareUserId=' + '&coursesharing=1' + '&serialsNo=' + nanoid() + '&shareCode=' + shareCode + '&shareUserId=' +
this.userId + '&jumpUrl=' + jumptime + "&" this.userId + '&jumpUrl=' + jumptime + "&" :
: shareURL + "/pages/courseDetail/courseDetail?fileId=" + this.fileId shareURL + "/pages/courseDetail/courseDetail?fileId=" + this.fileId
let data = { let data = {
title: this.courseInfo.fileTitle, title: this.courseInfo.fileTitle,
// desc: '加入我们开启学习之旅', // desc: '加入我们开启学习之旅',
desc:this.courseInfo.fileSynopsis, desc: this.courseInfo.fileSynopsis,
link: newLink, //分享链接 link: newLink, //分享链接
imgUrl: this.courseInfo.displayImage, //图片 imgUrl: this.courseInfo.displayImage, //图片
} }
console.log('data',data); console.log('data', data);
//安卓机型获取当前页面路径 //安卓机型获取当前页面路径
let url = window.location.href.split('#')[0]; let url = window.location.href.split('#')[0];
//ios机型获取当前页面路径 //ios机型获取当前页面路径
let ua = navigator.userAgent.toLowerCase(); let ua = navigator.userAgent.toLowerCase();
let isWeixin = ua.indexOf('micromessenger') !== -1; let isWeixin = ua.indexOf('micromessenger') !== -1;
if (isWeixin) { if (isWeixin) {
let isiOS = /(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent); //ios终端 let isiOS = /(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent); //ios终端
if (isiOS && window.sessionStorage.getItem('firstEntryUrl')) { if (isiOS && window.sessionStorage.getItem('firstEntryUrl')) {
url = window.sessionStorage.getItem('firstEntryUrl').split('#')[0]; url = window.sessionStorage.getItem('firstEntryUrl').split('#')[0];
} }
} }
hshare(data, url) hshare(data, url)
if(type==1){ if (type == 1) {
this.submitsuessc(shareCode,jumptime) this.submitsuessc(shareCode, jumptime)
} }
if(type == 1){ if (type == 1) {
dataHandling.pocessTracking( dataHandling.pocessTracking(
'点击', '点击',
`用户在产品中心点击分享按钮,分享${this.courseInfo.fileTitle}`, `用户在产品中心点击分享按钮,分享${this.courseInfo.fileTitle}`,
'点击', '点击',
2, 2,
'产品详情', '产品详情',
'pages/courseDetail/courseDetail' 'pages/courseDetail/courseDetail'
) )
} }
}, },
// H5 自定义分享 // H5 自定义分享
getshareData() { getshareData() {
let data = { let data = {
title: this.courseInfo.fileTitle, title: this.courseInfo.fileTitle,
// desc: '加入我们开启学习之旅', // desc: '加入我们开启学习之旅',
desc:this.courseInfo.fileSynopsis, desc: this.courseInfo.fileSynopsis,
link: window.location.href, //分享链接 link: window.location.href, //分享链接
imgUrl: this.courseInfo.displayImage, //图片 imgUrl: this.courseInfo.displayImage, //图片
} }
var url = window.location.href.split('#')[0] var url = window.location.href.split('#')[0]
hshare(data, url) hshare(data, url)
},
},
// 唤醒app 测试 // 唤醒app 测试
JsApiTicketApi() { JsApiTicketApi() {
let WxConfigRequestVO = { let WxConfigRequestVO = {
url: window.location.href.split('#')[0], url: window.location.href.split('#')[0],
systemType:this.addSystemType? this.addSystemType:'1' systemType: this.addSystemType ? this.addSystemType : '1'
} }
api.Wxshare(WxConfigRequestVO).then(res => { api.Wxshare(WxConfigRequestVO).then(res => {
jWeixin.config({ jWeixin.config({
...@@ -1141,23 +1119,23 @@ ...@@ -1141,23 +1119,23 @@
openTagList: ['wx-open-launch-app', 'wx-open-launch-weapp'] openTagList: ['wx-open-launch-app', 'wx-open-launch-weapp']
}); });
jWeixin.ready(function(res1) { jWeixin.ready(function(res1) {
}); });
jWeixin.error(function(res2) { jWeixin.error(function(res2) {
}); });
}) })
}, },
submitsuessc(shareCode,jumptime){ submitsuessc(shareCode, jumptime) {
let platform = uni.getSystemInfoSync().platform let platform = uni.getSystemInfoSync().platform
let UserShareRequestVO = { let UserShareRequestVO = {
systemType: platform == 'ios'? '1': '0', systemType: platform == 'ios' ? '1' : '0',
userId: uni.getStorageSync('cffp_userId'), userId: uni.getStorageSync('cffp_userId'),
businessType: '1', // 分享类型 businessType: '1', // 分享类型
businessId: this.fileId, // 课程Id businessId: this.fileId, // 课程Id
shareUrl: shareURL + "/pages/courseDetail/courseDetail?fileId=" + this.fileId + shareUrl: shareURL + "/pages/courseDetail/courseDetail?fileId=" + this.fileId +
'&coursesharing=1' + '&serialsNo=' + nanoid() + '&shareCode=' + shareCode + '&shareUserId=' + '&coursesharing=1' + '&serialsNo=' + nanoid() + '&shareCode=' + shareCode + '&shareUserId=' +
this.userId + '&jumpUrl=' + jumptime + "&", // 分享链接 this.userId + '&jumpUrl=' + jumptime + "&", // 分享链接
shareType: '2', // 分享类型(1:图片分享; 2:链接分享) shareType: '2', // 分享类型(1:图片分享; 2:链接分享)
shareToWhere: 3, //分享到哪儿(1好友 2朋友圈) shareToWhere: 3, //分享到哪儿(1好友 2朋友圈)
shareCode: shareCode shareCode: shareCode
...@@ -1173,35 +1151,35 @@ ...@@ -1173,35 +1151,35 @@
}, },
getBanner(itemType) { getBanner(itemType) {
//加载轮播图 //加载轮播图
api.getBanner({ fileCategory: 7, itemType: itemType}).then(res => { api.getBanner({ fileCategory: 7, itemType: itemType }).then(res => {
if (res['success']) { if (res['success']) {
this.swiperList = res['data']['homeItemList'] this.swiperList = res['data']['homeItemList']
} }
}) })
}, },
changeSwiper(e) { changeSwiper(e) {
if (e.detail.source == 'touch') { if (e.detail.source == 'touch') {
this.current = e.detail.current this.current = e.detail.current
} }
}, },
queryInfo(){ queryInfo() {
api.queryInfo({userId:uni.getStorageSync('cffp_userId')}).then(res=>{ api.queryInfo({ userId: uni.getStorageSync('cffp_userId') }).then(res => {
if(res['success']){ if (res['success']) {
delete res.data.commonResult delete res.data.commonResult
const cffp_userInfo = { const cffp_userInfo = {
...res.data ...res.data
} }
uni.setStorageSync('cffp_userInfo', JSON.stringify(cffp_userInfo)) uni.setStorageSync('cffp_userInfo', JSON.stringify(cffp_userInfo))
this.realName = res.data.realName; this.realName = res.data.realName;
} }
}) })
}, },
init() { init() {
if (!uni.getStorageSync('loginType')&& uni.getStorageSync('loginType')=='visitor') { if (!uni.getStorageSync('loginType') && uni.getStorageSync('loginType') == 'visitor') {
api.loginVerification({ api.loginVerification({
"loginType": 1, "loginType": 1,
}).then((res) => { }).then((res) => {
if (res['success']) { if (res['success']) {
this.userId = String(res['data']['userId']); this.userId = String(res['data']['userId']);
...@@ -1209,257 +1187,259 @@ ...@@ -1209,257 +1187,259 @@
uni.setStorageSync('cffp_userId', this.userId); uni.setStorageSync('cffp_userId', this.userId);
uni.setStorageSync('loginType', 'visitor'); uni.setStorageSync('loginType', 'visitor');
uni.setStorageSync('uni-token', res.data['token']); uni.setStorageSync('uni-token', res.data['token']);
} }
}) })
} }
}, },
// 海报分享方法 // 海报分享方法
// 背景图片加载成功 // 背景图片加载成功
handleBgImageLoad() { handleBgImageLoad() {
this.generateQrcodeAndCapture(); this.generateQrcodeAndCapture();
}, },
// 背景图片加载失败 // 背景图片加载失败
handleBgImageError() { handleBgImageError() {
console.log('产品图片加载完成'); console.log('产品图片加载完成');
// uni.showToast({ // uni.showToast({
// title:'海报生成失败,图片' // title:'海报生成失败,图片'
// }) // })
}, },
// 顺序执行:生成二维码 -> 截图 // 顺序执行:生成二维码 -> 截图
async generateQrcodeAndCapture() { async generateQrcodeAndCapture() {
try { try {
// uni.showLoading({ // uni.showLoading({
// title: '准备生成分享图...' // title: '准备生成分享图...'
// }); // });
// 1. 先生成二维码 // 1. 先生成二维码
console.log('开始生成二维码...'); console.log('开始生成二维码...');
await this.makeQrcode(); await this.makeQrcode();
console.log('二维码生成完成'); console.log('二维码生成完成');
// 2. 等待500ms确保渲染完成 // 2. 等待500ms确保渲染完成
await new Promise(resolve => setTimeout(resolve, 1500)); await new Promise(resolve => setTimeout(resolve, 1500));
// 3. 执行截图 // 3. 执行截图
console.log('开始截图...'); console.log('开始截图...');
await this.captureImage(); await this.captureImage();
console.log('截图完成'); console.log('截图完成');
// uni.hideLoading(); // uni.hideLoading();
} catch (error) { } catch (error) {
console.error('生成分享图失败:', error); console.error('生成分享图失败:', error);
// uni.hideLoading(); // uni.hideLoading();
// this.retryGenerate(); // this.retryGenerate();
} }
}, },
// 生成二维码 // 生成二维码
makeQrcode() { makeQrcode() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// 创建实例 // 创建实例
const qr = new UQRCode(); const qr = new UQRCode();
// 设置二维码内容 // 设置二维码内容
qr.data = this.qrCodeUrl; qr.data = this.qrCodeUrl;
// 设置二维码大小 // 设置二维码大小
qr.size = this.qrCodeSize; qr.size = this.qrCodeSize;
// 设置前景色(二维码颜色) // 设置前景色(二维码颜色)
qr.foregroundColor = '#000000'; qr.foregroundColor = '#000000';
// 设置背景色 // 设置背景色
qr.backgroundColor = '#FFFFFF'; qr.backgroundColor = '#FFFFFF';
// 设置边距 // 设置边距
qr.margin = 10; qr.margin = 10;
// 设置纠错等级 // 设置纠错等级
qr.errorCorrectLevel = UQRCode.errorCorrectLevel.H; qr.errorCorrectLevel = UQRCode.errorCorrectLevel.H;
try { try {
// 调用制作二维码方法 // 调用制作二维码方法
qr.make(); qr.make();
// 获取canvas上下文 // 获取canvas上下文
const ctx = uni.createCanvasContext('qrcode', this); const ctx = uni.createCanvasContext('qrcode', this);
// 清空画布 // 清空画布
ctx.clearRect(0, 0, this.qrCodeSize, this.qrCodeSize); ctx.clearRect(0, 0, this.qrCodeSize, this.qrCodeSize);
// 将二维码绘制到canvas上 // 将二维码绘制到canvas上
qr.canvasContext = ctx; qr.canvasContext = ctx;
qr.drawCanvas(); qr.drawCanvas();
// 绘制完成 // 绘制完成
ctx.draw(true, () => { ctx.draw(true, () => {
console.log('二维码绘制完成'); console.log('二维码绘制完成');
resolve(); resolve();
}); });
} catch (err) { } catch (err) {
reject(err); reject(err);
} }
}); });
}, },
// 截图方法 // 截图方法
async captureImage() { async captureImage() {
try { try {
// uni.showLoading({ // uni.showLoading({
// title: '正在生成图片...' // title: '正在生成图片...'
// }); // });
// 获取DOM元素(在H5环境下) // 获取DOM元素(在H5环境下)
const element = this.$refs.captureElement.$el; const element = this.$refs.captureElement.$el;
// 调用工具函数生成图片 // 调用工具函数生成图片
const imageData = await elementToImage(element); const imageData = await elementToImage(element);
this.generatedImage=imageData this.generatedImage = imageData
this.isLoading = false this.isLoading = false
this.isOrderLoading = false this.isOrderLoading = false
this.$refs.sharePosterPop.toggleDropdown() this.$refs.sharePosterPop.toggleDropdown()
// 压缩图片 // 压缩图片
// const compressedImage = await this.compressImage(imageData); // const compressedImage = await this.compressImage(imageData);
// this.generatedImage = compressedImage; // this.generatedImage = compressedImage;
} catch (error) { } catch (error) {
console.error('截图失败:', error); console.error('截图失败:', error);
throw error; // 抛出错误以便外部捕获 throw error; // 抛出错误以便外部捕获
} finally { } finally {
// uni.hideLoading(); // uni.hideLoading();
} }
}, },
compressImage(base64) { compressImage(base64) {
return new Promise((resolve) => { return new Promise((resolve) => {
const img = new Image(); const img = new Image();
img.src = base64; img.src = base64;
img.onload = () => { img.onload = () => {
const canvas = document.createElement('canvas'); const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d'); const ctx = canvas.getContext('2d');
// 设置压缩后的宽高 // 设置压缩后的宽高
const maxWidth = 800; const maxWidth = 800;
const maxHeight = 1200; const maxHeight = 1200;
let width = img.width; let width = img.width;
let height = img.height; let height = img.height;
if (width > maxWidth) { if (width > maxWidth) {
height *= maxWidth / width; height *= maxWidth / width;
width = maxWidth; width = maxWidth;
} }
if (height > maxHeight) { if (height > maxHeight) {
width *= maxHeight / height; width *= maxHeight / height;
height = maxHeight; height = maxHeight;
} }
canvas.width = width; canvas.width = width;
canvas.height = height; canvas.height = height;
ctx.drawImage(img, 0, 0, width, height); ctx.drawImage(img, 0, 0, width, height);
// 降低质量 // 降低质量
resolve(canvas.toDataURL('image/jpeg', 0.7)); resolve(canvas.toDataURL('image/jpeg', 0.7));
}; };
}); });
}, },
// 关闭海报弹窗 // 关闭海报弹窗
closePoster(){ closePoster() {
this.showImg = false this.showImg = false
this.generatedImage = '' this.generatedImage = ''
// this.shareItem = { // this.shareItem = {
// fileFirstImage:'' // fileFirstImage:''
// } // }
}, },
startPolling() { startPolling() {
// 先清除可能存在的旧定时器 // 先清除可能存在的旧定时器
if (this.pollingTimer) { if (this.pollingTimer) {
clearInterval(this.pollingTimer) clearInterval(this.pollingTimer)
this.pollingTimer = null this.pollingTimer = null
} }
// 每3秒轮询一次,最多轮询100次(5分钟) // 每3秒轮询一次,最多轮询100次(5分钟)
let count = 0 let count = 0
const maxCount = 100 const maxCount = 100
this.pollingTimer = setInterval(() => { this.pollingTimer = setInterval(() => {
count++ count++
uni.showModal({ uni.showModal({
content:count content: count
}) })
}, 1000) // 3秒轮询一次 }, 1000) // 3秒轮询一次
}, },
// 新增:停止轮询 // 新增:停止轮询
stopPolling () { stopPolling() {
if (this.pollingTimer) { if (this.pollingTimer) {
clearInterval(this.pollingTimer) clearInterval(this.pollingTimer)
this.pollingTimer = null this.pollingTimer = null
} }
}, },
// 跳转到小程序登录 // 跳转到小程序登录
jumpMplogin(){ jumpMplogin() {
let currentUrl = ``; let currentUrl = ``;
if(this.miniShareInfo.miniShare){ if (this.miniShareInfo.miniShare) {
if(uni.getStorageSync('loginType')=='codelogin'){ if (uni.getStorageSync('loginType') == 'codelogin') {
currentUrl = `${shareURL}/pages/lanch/index?fileId=${this.miniShareInfo.fileId}&coursesharing=1&serialsNo=${this.miniShareInfo.serialsNo}&shareCode=${this.miniShareInfo.shareCode}&shareUserId=${this.miniShareInfo.shareUserId}&jumpUrl=${this.miniShareInfo.jumpUrl}&landingPage=courseDetail&miniShare=1` currentUrl =
}else { `${shareURL}/pages/lanch/index?fileId=${this.miniShareInfo.fileId}&coursesharing=1&serialsNo=${this.miniShareInfo.serialsNo}&shareCode=${this.miniShareInfo.shareCode}&shareUserId=${this.miniShareInfo.shareUserId}&jumpUrl=${this.miniShareInfo.jumpUrl}&landingPage=courseDetail&miniShare=1`
currentUrl = `${shareURL}/pages/lanch/index?fileId=${this.miniShareInfo.fileId}&landingPage=courseDetail&miniShare=1` } else {
currentUrl =
`${shareURL}/pages/lanch/index?fileId=${this.miniShareInfo.fileId}&landingPage=courseDetail&miniShare=1`
} }
}else { } else {
currentUrl = `${shareURL}/pages/lanch/index?fileId=${this.fileId}&landingPage=courseDetail&noShare=1` currentUrl = `${shareURL}/pages/lanch/index?fileId=${this.fileId}&landingPage=courseDetail&noShare=1`
} }
let data = { let data = {
type:'login', type: 'login',
h5SystemType:'cffp', h5SystemType: 'cffp',
link: encodeURIComponent(currentUrl), link: encodeURIComponent(currentUrl),
miniShare:this.miniShareInfo.miniShare?this.miniShareInfo.miniShare:''//是否从小程序的分享卡片进入的 miniShare: this.miniShareInfo.miniShare ? this.miniShareInfo.miniShare : '' //是否从小程序的分享卡片进入的
} }
wx.miniProgram.postMessage({ wx.miniProgram.postMessage({
data:{ data: {
type:'login', type: 'login',
shareData:JSON.stringify(data) shareData: JSON.stringify(data)
} }
}) })
wx.miniProgram.navigateBack({ wx.miniProgram.navigateBack({
delta:1 delta: 1
}) })
} }
}, },
onLoad(option) { onLoad(option) {
// 通过小程序的分享卡片进来的,保存分享参数 // 通过小程序的分享卡片进来的,保存分享参数
if(option.miniShare){ if (option.miniShare) {
this.miniShareInfo = option this.miniShareInfo = option
} }
this.sharePosterObj = uni.getStorageSync('sharePosterObj') || {}; this.sharePosterObj = uni.getStorageSync('sharePosterObj') || {};
// console.log('sharePosterObj======',this.sharePosterObj); // console.log('sharePosterObj======',this.sharePosterObj);
// 如果通过海报分享进入系统,海报分享人为合伙人且普通客户完成购买了,那么海报分享人可以获得销售佣金 // 如果通过海报分享进入系统,海报分享人为合伙人且普通客户完成购买了,那么海报分享人可以获得销售佣金
this.shareUserId = this.sharePosterObj.inviteUserId || ''; this.shareUserId = this.sharePosterObj.inviteUserId || '';
if(companyInfo.companyType == '1'){ if (companyInfo.companyType == '1') {
this.companyLogo='../../static/myteam/Group1633.png'; this.companyLogo = '../../static/myteam/Group1633.png';
}else if(this.companyType == '2'){ } else if (this.companyType == '2') {
this.companyLogo='../../static/suplogo.png'; this.companyLogo = '../../static/suplogo.png';
} }
if(option.addSystemType){ if (option.addSystemType) {
this.addSystemType = option.addSystemType this.addSystemType = option.addSystemType
} }
if(this.systemType == 'IOS'){ if (this.systemType == 'IOS') {
this.showName = '预约'; this.showName = '预约';
this.show = false; this.show = false;
} }
this.fileId = option.fileId; this.fileId = option.fileId;
this.courseInfo.packFileId = option.packFileId; this.courseInfo.packFileId = option.packFileId;
this.deviceType = common.checkDeviceType(); this.deviceType = common.checkDeviceType();
if (option.coursesharing) { if (option.coursesharing) {
...@@ -1473,44 +1453,44 @@ ...@@ -1473,44 +1453,44 @@
this.getuserRead() this.getuserRead()
let endTime = Date.parse(new Date()) / 1000; let endTime = Date.parse(new Date()) / 1000;
let startTime = uni.getStorageSync('h5_startTime') let startTime = uni.getStorageSync('h5_startTime')
uni.setStorageSync('h5_coursesharing', this.coursesharing); uni.setStorageSync('h5_coursesharing', this.coursesharing);
this.getshareData() this.getshareData()
} }
let dataForm = JSON.parse(JSON.stringify(uni.getStorageSync('cffp_userInfo'))) let dataForm = JSON.parse(JSON.stringify(uni.getStorageSync('cffp_userInfo')))
this.realName = dataForm.realName; this.realName = dataForm.realName;
if(!this.realName){ if (!this.realName) {
this.queryInfo(); this.queryInfo();
} }
// this.switchTab(1); // this.switchTab(1);
}, },
onShow() { onShow() {
this.isLoading = false this.isLoading = false
if(uni.getStorageSync('mpCffp')){ if (uni.getStorageSync('mpCffp')) {
this.mpCffp = uni.getStorageSync('mpCffp') this.mpCffp = uni.getStorageSync('mpCffp')
} }
this.showImg = false this.showImg = false
this.generatedImage = '' this.generatedImage = ''
this.shareItem={fileFirstImage:''}, this.shareItem = { fileFirstImage: '' },
this.loginType = uni.getStorageSync('loginType') this.loginType = uni.getStorageSync('loginType')
this.init(); this.init();
this.isWx_Miniprogram(); this.isWx_Miniprogram();
this.tabType = 1; this.tabType = 1;
this.wayType = '1' this.wayType = '1'
this.courseDetail(); this.courseDetail();
uni.setStorageSync('entryUrl',window.location.href.split('#')[0]) uni.setStorageSync('entryUrl', window.location.href.split('#')[0])
if(uni.getStorageSync('cffp_userInfo')){ if (uni.getStorageSync('cffp_userInfo')) {
this.userInfo = JSON.parse(uni.getStorageSync('cffp_userInfo')) this.userInfo = JSON.parse(uni.getStorageSync('cffp_userInfo'))
} }
this.userId = uni.getStorageSync('cffp_userId') this.userId = uni.getStorageSync('cffp_userId')
// #ifdef H5 // #ifdef H5
initJssdkShare(() => { initJssdkShare(() => {
setWechatShare(); setWechatShare();
}, window.location.href); }, window.location.href);
// #endif // #endif
}, },
onReady() { onReady() {
this.videoContext = uni.createVideoContext('myVideo'); this.videoContext = uni.createVideoContext('myVideo');
...@@ -1524,13 +1504,13 @@ ...@@ -1524,13 +1504,13 @@
} }
} }
// #ifdef H5 // #ifdef H5
initJssdkShare(() => { initJssdkShare(() => {
setWechatShare(); setWechatShare();
}, window.location.href); }, window.location.href);
// #endif // #endif
}, },
onHide() { onHide() {
this.$nextTick(()=>{ this.$nextTick(() => {
this.$refs.sharePosterPop.closeDropdown() this.$refs.sharePosterPop.closeDropdown()
}) })
} }
...@@ -1538,96 +1518,111 @@ ...@@ -1538,96 +1518,111 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.container{ .container {
width: 100%; width: 100%;
height: auto; height: auto;
box-sizing: border-box; box-sizing: border-box;
position: relative; position: relative;
.generateImageBox{
.generateImageBox {
position: absolute; position: absolute;
top:-100%; top: -100%;
z-index: -1; z-index: -1;
border-radius: 20rpx; border-radius: 20rpx;
width: 100%; width: 100%;
box-sizing: border-box; box-sizing: border-box;
background-color: #fff; background-color: #fff;
.imgBox{
.imgBox {
box-sizing: border-box; box-sizing: border-box;
width: 100%; width: 100%;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
padding: 20rpx; padding: 20rpx;
.posterImg{
.posterImg {
width: 900rpx; width: 900rpx;
height: 900rpx; height: 900rpx;
} }
} }
.txtBox{
.txtBox {
padding: 20rpx; padding: 20rpx;
.descriptionTxt{
.descriptionTxt {
font-size: 45rpx; font-size: 45rpx;
} }
.productNum{
.productNum {
font-size: 45rpx; font-size: 45rpx;
font-weight: 500; font-weight: 500;
margin: 10rpx 0; margin: 10rpx 0;
color: rgba(255, 74, 50, 1); color: rgba(255, 74, 50, 1);
} }
.generateImageBottom{
.generateImageBottom {
width: 100%; width: 100%;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
.left{ .left {
min-width: 500rpx; min-width: 500rpx;
.top{
.top {
width: 100%; width: 100%;
display: flex; display: flex;
align-items: center; align-items: center;
image{
image {
width: 100%; width: 100%;
} }
.companyName{
.companyName {
min-width: 300rpx; min-width: 300rpx;
color: #333; color: #333;
font-size: 35rpx; font-size: 35rpx;
} }
} }
.bottom{
.bottom {
font-size: 30rpx; font-size: 30rpx;
color: #999; color: #999;
margin-top: 10rpx; margin-top: 10rpx;
font-weight: 500; font-weight: 500;
} }
} }
.qrcode-container { .qrcode-container {
background: #fff; background: #fff;
padding: 10rpx; padding: 10rpx;
border-radius: 10rpx; border-radius: 10rpx;
box-shadow: 0 0 10rpx rgba(0,0,0,0.1); box-shadow: 0 0 10rpx rgba(0, 0, 0, 0.1);
.qrcode-canvas { .qrcode-canvas {
display: block; display: block;
} }
} }
} }
} }
} }
} }
page { page {
padding: 0; padding: 0;
} }
.loginPopupBox { .loginPopupBox {
margin-top: 8vh; margin-top: 8vh;
padding: 20rpx 30rpx; padding: 20rpx 30rpx;
border-radius: 20rpx; border-radius: 20rpx;
font-size: 30rpx; font-size: 30rpx;
background: #fff; background: #fff;
.popup_replenish_button2 { .popup_replenish_button2 {
color: rgba(9, 44, 171, 1); color: rgba(9, 44, 171, 1);
background-color: #fff; background-color: #fff;
...@@ -1637,12 +1632,15 @@ ...@@ -1637,12 +1632,15 @@
font-size: 30rpx; font-size: 30rpx;
} }
} }
.swiperBox { .swiperBox {
height: 930rpx; height: 930rpx;
} }
.swiper-box { .swiper-box {
height: 930rpx; height: 930rpx;
} }
.swiper-item { .swiper-item {
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
display: flex; display: flex;
...@@ -1653,7 +1651,7 @@ ...@@ -1653,7 +1651,7 @@
height: 930rpx; height: 930rpx;
color: #fff; color: #fff;
} }
.courseBannerBox { .courseBannerBox {
// background-color: #ebebeb; // background-color: #ebebeb;
// display: flex; // display: flex;
...@@ -1675,6 +1673,7 @@ ...@@ -1675,6 +1673,7 @@
justify-content: space-between; justify-content: space-between;
margin-bottom: 16rpx; margin-bottom: 16rpx;
box-sizing: border-box; box-sizing: border-box;
h4 { h4 {
font-size: 40rpx; font-size: 40rpx;
} }
...@@ -1752,7 +1751,8 @@ ...@@ -1752,7 +1751,8 @@
padding: 40rpx 150rpx 0; padding: 40rpx 150rpx 0;
background-color: #fff; background-color: #fff;
color: #666; color: #666;
font-size: 32rpx; font-size: 32rpx;
text.actived { text.actived {
border-bottom: 2px solid #20269B; border-bottom: 2px solid #20269B;
color: #333; color: #333;
...@@ -1847,6 +1847,7 @@ ...@@ -1847,6 +1847,7 @@
font-size: 16rpx; font-size: 16rpx;
margin-left: 10rpx; margin-left: 10rpx;
} }
.totalCourseCount { .totalCourseCount {
color: #20269B; color: #20269B;
font-size: 24rpx; font-size: 24rpx;
...@@ -1897,7 +1898,8 @@ ...@@ -1897,7 +1898,8 @@
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
.shareBuyBox{
.shareBuyBox {
position: fixed; position: fixed;
bottom: 0; bottom: 0;
left: 0; left: 0;
...@@ -1912,7 +1914,8 @@ ...@@ -1912,7 +1914,8 @@
justify-content: space-between; justify-content: space-between;
background-color: #fff; background-color: #fff;
box-sizing: border-box; box-sizing: border-box;
.leftBuy{
.leftBuy {
color: #fff; color: #fff;
background-color: #20269B; background-color: #20269B;
padding: 20rpx 100rpx; padding: 20rpx 100rpx;
...@@ -1923,7 +1926,8 @@ ...@@ -1923,7 +1926,8 @@
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
.rightShare{
.rightShare {
margin-right: 30rpx; margin-right: 30rpx;
width: 30%; width: 30%;
color: #20269B; color: #20269B;
...@@ -1938,6 +1942,7 @@ ...@@ -1938,6 +1942,7 @@
} }
} }
} }
.markBox { .markBox {
position: fixed; position: fixed;
left: 0; left: 0;
...@@ -1951,8 +1956,10 @@ ...@@ -1951,8 +1956,10 @@
justify-content: flex-end; justify-content: flex-end;
z-index: 100000; z-index: 100000;
background: rgba(0, 0, 0, 0.8); background: rgba(0, 0, 0, 0.8);
.guideImgBox { .guideImgBox {
margin: 20px auto; margin: 20px auto;
uni-image { uni-image {
width: 25% !important; width: 25% !important;
position: absolute; position: absolute;
...@@ -1960,68 +1967,78 @@ ...@@ -1960,68 +1967,78 @@
top: 0; top: 0;
} }
} }
.tips { .tips {
margin-top: 30%; margin-top: 30%;
padding: 0 30px; padding: 0 30px;
} }
/* iPad横屏特定适配 */ /* iPad横屏特定适配 */
@media only screen @media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (orientation: landscape) {
and (min-device-width: 768px) .container {
and (max-device-width: 1024px) .generateImageBox {
and (orientation: landscape) { max-width: 950rpx !important;
.container {
.generateImageBox{ .descriptionTxt {
max-width: 950rpx !important; font-size: 33rpx !important;
.descriptionTxt{ }
font-size: 33rpx !important;
} .txtBox {
.txtBox{ .generateImageBottom {
.generateImageBottom{ .left {
.left{ width: 60% !important;
width: 60% !important;
.top{ .top {
width: 100%; width: 100%;
.companyName{
.companyName {
min-width: 200rpx !important; min-width: 200rpx !important;
font-size: 30rpx !important; font-size: 30rpx !important;
}
}
.bottom {
font-size: 28rpx !important;
} }
}
.bottom{
font-size: 28rpx !important;
} }
} }
} }
} }
} }
}
} }
/* 所有iPad竖屏 */ /* 所有iPad竖屏 */
@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (orientation: portrait) { @media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (orientation: portrait) {
/* 竖屏样式 */
.generateImageBox{ /* 竖屏样式 */
max-width: 950rpx !important; .generateImageBox {
.descriptionTxt{ max-width: 950rpx !important;
font-size: 33rpx !important;
} .descriptionTxt {
.txtBox{ font-size: 33rpx !important;
.generateImageBottom{ }
.left{
width: 60% !important; .txtBox {
.top{ .generateImageBottom {
.left {
width: 60% !important;
.top {
width: 100%; width: 100%;
.companyName{
.companyName {
min-width: 200rpx !important; min-width: 200rpx !important;
font-size: 30rpx !important; font-size: 30rpx !important;
}
}
.bottom {
font-size: 28rpx !important;
} }
}
.bottom{
font-size: 28rpx !important;
} }
} }
} }
} }
} }
}
} }
</style> </style>
\ No newline at end of file
...@@ -231,6 +231,7 @@ ...@@ -231,6 +231,7 @@
} }
}, },
onShow() { onShow() {
this.isLoading = false this.isLoading = false
this.generatedImage = '' this.generatedImage = ''
...@@ -308,8 +309,6 @@ ...@@ -308,8 +309,6 @@
'产品中心', '产品中心',
'pages/courselist/courselist' 'pages/courselist/courselist'
) )
console.log('env', dataHandling.h5RuntimeEnv() == 'wechat-miniprogram');
if (dataHandling.h5RuntimeEnv() == 'wechat-miniprogram') { if (dataHandling.h5RuntimeEnv() == 'wechat-miniprogram') {
this.jumpMplogin() this.jumpMplogin()
return return
...@@ -403,10 +402,12 @@ ...@@ -403,10 +402,12 @@
wx.miniProgram.postMessage({ wx.miniProgram.postMessage({
data: { data: {
type: 'share', type: 'share',
shareData: JSON.stringify(shareInfo) shareData: JSON.stringify(shareInfo),
messageId: nanoid() // 唯一消息ID
} }
}) })
return return
} }
this.getshareData2(shareCode, jumptime, this.shareItem) this.getshareData2(shareCode, jumptime, this.shareItem)
......
...@@ -341,6 +341,7 @@ ...@@ -341,6 +341,7 @@
this.dataToken = '' this.dataToken = ''
// 清除事件监听 // 清除事件监听
uni.$off('loginUpdate', this.queryAreaCenterInfo); uni.$off('loginUpdate', this.queryAreaCenterInfo);
}, },
methods: { methods: {
// 初始化首页分享 注意sdk时序问题。传递的url一定要是当前页面的url window.location.href.split('#')[0] // 初始化首页分享 注意sdk时序问题。传递的url一定要是当前页面的url window.location.href.split('#')[0]
......
...@@ -123,7 +123,7 @@ ...@@ -123,7 +123,7 @@
}) })
}else if(landingPage == 'orderStatus'){ }else if(landingPage == 'orderStatus'){
uni.reLaunch({ uni.reLaunch({
url:`/pages/orderStatus/orderStatus?orderId=${jumpInfo.value.orderId}&fileId=${jumpInfo.value.fileId}&orderStatus=2&userId=${res.data.userId}` url:`/pages/orderStatus/orderStatus?orderId=${jumpInfo.value.orderId}&fileId=${jumpInfo.value.fileId}&orderStatus=2&userId=${res.data.userId}&backMySelf=1`
}) })
} }
} else { } else {
......
...@@ -57,6 +57,8 @@ ...@@ -57,6 +57,8 @@
import courseItem from "@/components/courseItem/courseItem.vue"; import courseItem from "@/components/courseItem/courseItem.vue";
import tabBar from '../../components/tabBar/tabBar.vue'; import tabBar from '../../components/tabBar/tabBar.vue';
import { initJssdkShare, setWechatShare } from '@/util/fiveshare'; import { initJssdkShare, setWechatShare } from '@/util/fiveshare';
import dataHandling from "@/util/dataHandling";
import wx from 'weixin-js-sdk'
export default { export default {
components:{tabBar,courseItem}, components:{tabBar,courseItem},
data() { data() {
...@@ -155,6 +157,7 @@ ...@@ -155,6 +157,7 @@
this.orderId = options.orderId; this.orderId = options.orderId;
this.orderStatus = options.orderStatus; this.orderStatus = options.orderStatus;
this.fileId = options.fileId; this.fileId = options.fileId;
// 没有oldToken代表支付订单人和提供订单人不是同一个人 // 没有oldToken代表支付订单人和提供订单人不是同一个人
if(options.userId && options.userId != "undefined"&&!uni.getStorageSync('oldToken')){ if(options.userId && options.userId != "undefined"&&!uni.getStorageSync('oldToken')){
this.userId = options.userId; this.userId = options.userId;
......
import api from "@/api/api"; import api from "@/api/api";
import dataHandling from './dataHandling' import dataHandling from './dataHandling'
import { initJssdkShare, setWechatShare } from '@/util/fiveshare'; import { initJssdkShare, setWechatShare } from '@/util/fiveshare';
...@@ -30,52 +25,53 @@ let shareCustomPageList = [ ...@@ -30,52 +25,53 @@ let shareCustomPageList = [
'/pages/courselist/courselist', '/pages/courselist/courselist',
'/myPackageA/businessCard/businessCard', '/myPackageA/businessCard/businessCard',
] ]
export default function initApp(){ export default function initApp() {
let date = Date.now() let date = Date.now()
uni.addInterceptor('navigateTo', { uni.addInterceptor('navigateTo', {
// 页面跳转前进行拦截, invoke根据返回值进行判断是否继续执行跳转 // 页面跳转前进行拦截, invoke根据返回值进行判断是否继续执行跳转
invoke (e) { invoke(e) {
let userInfo = {} let userInfo = {}
if(uni.getStorageSync('cffp_userInfo')){ if (uni.getStorageSync('cffp_userInfo')) {
userInfo = JSON.parse(uni.getStorageSync('cffp_userInfo')) userInfo = JSON.parse(uni.getStorageSync('cffp_userInfo'))
} }
let pages = getCurrentPages() let pages = getCurrentPages()
let pagesLength = pages.length let pagesLength = pages.length
if(shareCustomPageList.indexOf(e.url)==-1){ if (shareCustomPageList.indexOf(e.url) == -1) {
if (dataHandling.h5RuntimeEnv() == 'wechat-miniprogram') { if (dataHandling.h5RuntimeEnv() == 'wechat-miniprogram') {
let shareInfo = { let shareInfo = {
title: '成为银盾合伙人,分享商品赚不停', title: '成为银盾合伙人,分享商品赚不停',
desc: `资源+伙伴,共赢未来!`, desc: `资源+伙伴,共赢未来!`,
link: `${shareURL}/pages/index/index?miniShare=1`, //分享链接 link: `${shareURL}/pages/index/index?miniShare=1`, //分享链接
imgUrl: `${shareURL}/myPackageA/static/images/logo3.png`, //图片 imgUrl: `${shareURL}/myPackageA/static/images/logo3.png`, //图片
commonId:uni.getStorageSync('cffp_userId'), commonId: uni.getStorageSync('cffp_userId'),
sharePage:'index'//分享出去得页面 sharePage: 'index' //分享出去得页面
} }
wx.miniProgram.postMessage({ wx.miniProgram.postMessage({
data: { data: {
type: 'share', type: 'share',
shareData: JSON.stringify(shareInfo) shareData: JSON.stringify(shareInfo)
} }
}) })
return return
} }
} }
if(whiteList.indexOf(e.url)==-1&&!uni.getStorageSync('loginType')){
if (whiteList.indexOf(e.url) == -1 && !uni.getStorageSync('loginType')) {
uni.setStorageSync('loginType','visitor')
uni.navigateTo({ uni.setStorageSync('loginType', 'visitor')
url: '/myPackageA/login/login' uni.navigateTo({
}) url: '/myPackageA/login/login'
})
} }
if(uni.getStorageSync('cffp_userId')){ if (uni.getStorageSync('cffp_userId')) {
api.queryInfo({userId:uni.getStorageSync('cffp_userId')}).then(res=>{ api.queryInfo({ userId: uni.getStorageSync('cffp_userId') }).then(res => {
if(!res['success']){ if (!res['success']) {
uni.setStorageSync('loginType','visitor') uni.setStorageSync('loginType', 'visitor')
uni.navigateTo({ uni.navigateTo({
url: '/myPackageA/login/login' url: '/myPackageA/login/login'
}) })
return true return true
} }
...@@ -87,166 +83,168 @@ export default function initApp(){ ...@@ -87,166 +83,168 @@ export default function initApp(){
} }
uni.setStorageSync('cffp_userInfo', JSON.stringify(cffp_userInfo)) uni.setStorageSync('cffp_userInfo', JSON.stringify(cffp_userInfo))
} }
}) })
} }
if (userInfo.userIsActive == 2 &&uni.getStorageSync('loginType')=='codelogin') { if (userInfo.userIsActive == 2 && uni.getStorageSync('loginType') == 'codelogin') {
// 显示禁用用户弹窗 // 显示禁用用户弹窗
const currentPage = getCurrentPages()[getCurrentPages().length - 1]; const currentPage = getCurrentPages()[getCurrentPages().length - 1];
currentPage.$refs.restrictedTip.open() currentPage.$refs.restrictedTip.open()
return false; // 返回对象而不是布尔值 return false; // 返回对象而不是布尔值
} }
let whiteArr = ['index','personalCenter','courselist','product'] let whiteArr = ['index', 'personalCenter', 'courselist', 'product']
// 1. 解析 URL 中的 from 参数 // 1. 解析 URL 中的 from 参数
const getQueryParam = (url, key) => { const getQueryParam = (url, key) => {
const queryString = url.split('?')[1]; const queryString = url.split('?')[1];
if (!queryString) return null; if (!queryString) return null;
const params = new URLSearchParams(queryString); const params = new URLSearchParams(queryString);
return params.get(key); return params.get(key);
}; };
const fromParam = getQueryParam(e.url, 'from'); const fromParam = getQueryParam(e.url, 'from');
if(!hasPermission(e.url)){ if (!hasPermission(e.url)) {
// 如果 from 参数在 whiteArr 中,说明是tabbar页带着tabbar的标志参数跳转到登录页,以便未登录状态下回到对应的tabbar页 // 如果 from 参数在 whiteArr 中,说明是tabbar页带着tabbar的标志参数跳转到登录页,以便未登录状态下回到对应的tabbar页
if (fromParam && whiteArr.includes(fromParam)) { if (fromParam && whiteArr.includes(fromParam)) {
uni.redirectTo({ uni.redirectTo({
url: `/myPackageA/login/login?from=${fromParam}` url: `/myPackageA/login/login?from=${fromParam}`
}) })
}else { } else {
uni.redirectTo({ uni.redirectTo({
url: '/myPackageA/login/login' url: '/myPackageA/login/login'
}) })
} }
return false return false
} }
//当页面栈的个数大于10个时,不入页面栈 //当页面栈的个数大于10个时,不入页面栈
if (pagesLength >= 10) { if (pagesLength >= 10) {
//临时处理,跟换调整方式 //临时处理,跟换调整方式
uni.redirectTo({ uni.redirectTo({
url: e.url url: e.url
}) })
} else { } else {
if (date) { if (date) {
//如果时间戳存在 那么记录此页面的停留时间 //如果时间戳存在 那么记录此页面的停留时间
dataHandling.pocessTracking( dataHandling.pocessTracking(
'停留', '停留',
`用户在此页面停留${(Date.now() - date) / 1000}秒`, `用户在此页面停留${(Date.now() - date) / 1000}秒`,
'进入页面后离开页面', '进入页面后离开页面',
2 2
) )
} }
date = Date.now() date = Date.now()
} }
return true return true
}, },
success (e) {} success(e) {}
}) })
uni.addInterceptor('switchTab', { uni.addInterceptor('switchTab', {
// tabbar页面跳转前进行拦截 // tabbar页面跳转前进行拦截
invoke(e) { invoke(e) {
if(shareCustomPageList.indexOf(e.url)==-1){ if (shareCustomPageList.indexOf(e.url) == -1) {
if (dataHandling.h5RuntimeEnv() == 'wechat-miniprogram') { if (dataHandling.h5RuntimeEnv() == 'wechat-miniprogram') {
let shareInfo = { let shareInfo = {
title: '成为银盾合伙人,分享商品赚不停', title: '成为银盾合伙人,分享商品赚不停',
desc: `资源+伙伴,共赢未来!`, desc: `资源+伙伴,共赢未来!`,
link: `${shareURL}/pages/index/index?miniShare=1`, //分享链接 link: `${shareURL}/pages/index/index?miniShare=1`, //分享链接
imgUrl: `${shareURL}/myPackageA/static/images/logo3.png`, //图片 imgUrl: `${shareURL}/myPackageA/static/images/logo3.png`, //图片
commonId:uni.getStorageSync('cffp_userId'), commonId: uni.getStorageSync('cffp_userId'),
sharePage:'index'//分享出去得页面 sharePage: 'index' //分享出去得页面
}
wx.miniProgram.postMessage({
data: {
type: 'share',
shareData: JSON.stringify(shareInfo)
}
})
return
}
}
if(uni.getStorageSync('cffp_userId')){
api.queryInfo({userId:uni.getStorageSync('cffp_userId')}).then(res=>{
// if(!res['success']){
// uni.setStorageSync('loginType','visitor')
// uni.navigateTo({
// url: '/myPackageA/login/login'
// })
// return true
// }
// 保存用户得个人信息
if (res['success']) {
delete res.data.commonResult
const cffp_userInfo = {
...res.data
}
uni.setStorageSync('cffp_userInfo', JSON.stringify(cffp_userInfo))
}
})
}
if (date) {
//如果时间戳存在 那么记录此页面的停留时间
dataHandling.pocessTracking(
'停留',
`用户在此页面停留${(Date.now() - date) / 1000}秒`,
'进入页面后离开页面',
2
)
}
date = Date.now()
return true
},
success(e) {}
})
uni.addInterceptor('reLaunch', {
//页面跳转前拦截
invoke(e) {
if(shareCustomPageList.indexOf(e.url)==-1){
if (dataHandling.h5RuntimeEnv() == 'wechat-miniprogram') {
let shareInfo = {
title: '成为银盾合伙人,分享商品赚不停',
desc: `资源+伙伴,共赢未来!`,
link: `${shareURL}/pages/index/index?miniShare=1`, //分享链接
imgUrl: `${shareURL}/myPackageA/static/images/logo3.png`, //图片
commonId:uni.getStorageSync('cffp_userId'),
sharePage:'index'//分享出去得页面
}
wx.miniProgram.postMessage({
data: {
type: 'share',
shareData: JSON.stringify(shareInfo)
} }
wx.miniProgram.postMessage({
data: {
type: 'share',
shareData: JSON.stringify(shareInfo)
}
})
return
}
}
if (uni.getStorageSync('cffp_userId')) {
api.queryInfo({ userId: uni.getStorageSync('cffp_userId') }).then(res => {
// if(!res['success']){
// uni.setStorageSync('loginType','visitor')
// uni.navigateTo({
// url: '/myPackageA/login/login'
// })
// return true
// }
// 保存用户得个人信息
if (res['success']) {
delete res.data.commonResult
const cffp_userInfo = {
...res.data
}
uni.setStorageSync('cffp_userInfo', JSON.stringify(cffp_userInfo))
}
}) })
return
} }
} if (date) {
if (date) { //如果时间戳存在 那么记录此页面的停留时间
//如果时间戳存在 那么记录此页面的停留时间 dataHandling.pocessTracking(
dataHandling.pocessTracking( '停留',
'停留', `用户在此页面停留${(Date.now() - date) / 1000}秒`,
`用户在此页面停留${(Date.now() - date) / 1000}秒`, '进入页面后离开页面',
'进入页面后离开页面', 2
2 )
) }
} date = Date.now()
date = Date.now() return true
return true },
}, success(e) {}
//页面跳转后缓存当前页路由 })
success(e) {} uni.addInterceptor('reLaunch', {
//页面跳转前拦截
invoke(e) {
if (shareCustomPageList.indexOf(e.url) == -1) {
if (dataHandling.h5RuntimeEnv() == 'wechat-miniprogram') {
let shareInfo = {
title: '成为银盾合伙人,分享商品赚不停',
desc: `资源+伙伴,共赢未来!`,
link: `${shareURL}/pages/index/index?miniShare=1`, //分享链接
imgUrl: `${shareURL}/myPackageA/static/images/logo3.png`, //图片
commonId: uni.getStorageSync('cffp_userId'),
sharePage: 'index' //分享出去得页面
}
wx.miniProgram.postMessage({
data: {
type: 'share',
shareData: JSON.stringify(shareInfo)
}
})
return
}
}
if (date) {
//如果时间戳存在 那么记录此页面的停留时间
dataHandling.pocessTracking(
'停留',
`用户在此页面停留${(Date.now() - date) / 1000}秒`,
'进入页面后离开页面',
2
)
}
date = Date.now()
return true
},
//页面跳转后缓存当前页路由
success(e) {}
}) })
} }
function hasPermission (url) {
let islogin = uni.getStorageSync("isLogin");//在这可以使用token、vuex function hasPermission(url) {
let islogin = uni.getStorageSync("isLogin"); //在这可以使用token、vuex
// islogin = Boolean(Number(islogin));//返回布尔值 // islogin = Boolean(Number(islogin));//返回布尔值
// 在白名单中或有登录判断条件可以直接跳转 // 在白名单中或有登录判断条件可以直接跳转
if(whiteList.indexOf(url.slice(0,url.indexOf('?'))) !== -1 || islogin) { if (whiteList.indexOf(url.slice(0, url.indexOf('?'))) !== -1 || islogin) {
return true return true
} }
return false return false
} }
\ No newline at end of file
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