Commit 64f3e2ff by yuzhenWang

拉起小程序分享发生产

parent a99d0b80
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
import {baseURL,apiURL,cffpURL,companyInfo} from "@/environments/environment"; import {baseURL,apiURL,cffpURL,companyInfo} from "@/environments/environment";
import api from './api/api'; import api from './api/api';
import {hshare} from '@/util/fiveshare'; import {hshare} from '@/util/fiveshare';
import dataHandling from "@/util/dataHandling";
export default { export default {
data() { data() {
return { return {
...@@ -21,6 +21,9 @@ ...@@ -21,6 +21,9 @@
if(!uni.getStorageSync('loginType')){ if(!uni.getStorageSync('loginType')){
uni.setStorageSync('loginType','visitor'); uni.setStorageSync('loginType','visitor');
} }
if(!uni.getStorageSync('visitorUuid')){
uni.setStorageSync('visitorUuid',dataHandling.uuid());
}
// 处理外部链接参数 // 处理外部链接参数
this.handleExternalUrlParams(); this.handleExternalUrlParams();
......
...@@ -454,7 +454,7 @@ export default { ...@@ -454,7 +454,7 @@ export default {
}, },
//获取分享状态名片信息 //获取分享状态名片信息
getShareBusinessCard(cardId) { getShareBusinessCard(cardId) {
return request(`${apiURL}/business-card/view/${cardId}`, 'GET') return request(`${apiURL}/business-card/cards/${cardId}`, 'GET')
}, },
//查询名片状态 //查询名片状态
checkBusinessCradStatus(businessCardId) { checkBusinessCradStatus(businessCardId) {
...@@ -467,4 +467,8 @@ export default { ...@@ -467,4 +467,8 @@ export default {
dealerCouponCardList(params) { dealerCouponCardList(params) {
return request(`${sfpUrl}/dealerCoupon/inventory/list/page`, 'POST', params) return request(`${sfpUrl}/dealerCoupon/inventory/list/page`, 'POST', params)
}, },
//统计名片查看次数
statusBusinessCard(params) {
return request(`${apiURL}/business-card/cards/views`, 'POST', params)
},
} }
<!-- /components/ShareGuideTips/ShareGuideTips.vue -->
<template>
<view class="markBox" @click="close" v-if="show">
<view class="guideImgBox">
<image :src="imgSrc" mode="widthFix" ></image>
<view class="tips">
<view style="margin-bottom:30rpx">请点击右上角菜单</view>
<view>分享给朋友</view>
</view>
</view>
</view>
</template>
<script>
export default {
name: 'ShareGuideTips',
props: {
// 控制是否显示
show: {
type: Boolean,
default: false
},
// 自定义图片路径(可选)
imgSrc: {
type: String,
default: '/static/Group132.png'
}
},
methods: {
close() {
this.$emit('update:show', false); // 支持 .sync 或 v-model
this.$emit('close'); // 兼容事件监听
}
}
};
</script>
<style scoped>
.markBox {
position: fixed;
left: 0;
top: 0;
bottom: 0;
right: 0;
width: 100%;
height: 100%;
color: #fff;
display: flex;
justify-content: flex-end;
align-items: flex-start; /* 确保内容靠上 */
z-index: 100000;
background: rgba(0, 0, 0, 0.8);
}
.guideImgBox {
position: relative;
margin: 20px auto;
width: 100%;
}
.guideImgBox image {
width: 25% !important;
height: auto;
display: block;
position: absolute;
top: 0;
right: 10%;
}
.tips {
margin-top: 30%; /* 可根据设计调整 */
padding: 0 30px;
text-align: center;
font-size: 28rpx;
}
</style>
\ No newline at end of file
...@@ -136,7 +136,8 @@ ...@@ -136,7 +136,8 @@
const params = { const params = {
loginType:'3', loginType:'3',
mobile: this.mobile, mobile: this.mobile,
code: this.code code: this.code,
visitorUuid:uni.getStorageSync('visitorUuid')?uni.getStorageSync('visitorUuid'):dataHandling.uuid()
} }
api.loginVerification(params).then((res)=>{ api.loginVerification(params).then((res)=>{
if(res['success']){ if(res['success']){
...@@ -151,6 +152,7 @@ ...@@ -151,6 +152,7 @@
uni.setStorageSync('cffp_userId', this.userId); uni.setStorageSync('cffp_userId', this.userId);
console.log('============',uni.getStorageSync('cffp_userId')) console.log('============',uni.getStorageSync('cffp_userId'))
uni.setStorageSync('uni-token', res.data['token']); uni.setStorageSync('uni-token', res.data['token']);
uni.setStorageSync('visitorUuid', res.data['visitorUuid']);
this.loginTypeSync = "codelogin"; this.loginTypeSync = "codelogin";
this.queryInfo() this.queryInfo()
uni.$emit('loginUpdate'); uni.$emit('loginUpdate');
......
...@@ -6,14 +6,6 @@ ...@@ -6,14 +6,6 @@
<image class="imgbox" src="../assets/images/bg1.jpg" mode="widthFix"></image> <image class="imgbox" src="../assets/images/bg1.jpg" mode="widthFix"></image>
<view class="wapper"> <view class="wapper">
<view style="flex: 1;"> <view style="flex: 1;">
<!-- <view class="header">
<view class="one">
合伙人加盟
</view>
<view class="two">
优质资源,专业服务
</view>
</view> -->
<view class="header"> <view class="header">
<view class="headerLeft"> <view class="headerLeft">
<view class="one"> <view class="one">
...@@ -95,6 +87,7 @@ ...@@ -95,6 +87,7 @@
import dataHandling from "@/util/dataHandling"; import dataHandling from "@/util/dataHandling";
import { initJssdkShare, setWechatShare } from '@/util/fiveshare'; import { initJssdkShare, setWechatShare } from '@/util/fiveshare';
import restrictedTip from '@/components/commonPopup/restrictedTip.vue'; import restrictedTip from '@/components/commonPopup/restrictedTip.vue';
export default { export default {
components: { components: {
everyJoinPopup, everyJoinPopup,
...@@ -153,7 +146,6 @@ ...@@ -153,7 +146,6 @@
}, },
onShow() { onShow() {
console.log('onShowloginType', uni.getStorageSync('loginType'));
if (uni.getStorageSync('loginType')) { if (uni.getStorageSync('loginType')) {
this.loginType = uni.getStorageSync('loginType') this.loginType = uni.getStorageSync('loginType')
} }
...@@ -345,7 +337,8 @@ ...@@ -345,7 +337,8 @@
} }
const params = { const params = {
loginType: '3', loginType: '3',
...this.form ...this.form,
visitorUuid:uni.getStorageSync('visitorUuid')?uni.getStorageSync('visitorUuid'):dataHandling.uuid()
} }
if (this.loginType == 'codelogin') { if (this.loginType == 'codelogin') {
this.getApply() this.getApply()
...@@ -368,6 +361,7 @@ ...@@ -368,6 +361,7 @@
uni.setStorageSync('loginType', 'codelogin'); uni.setStorageSync('loginType', 'codelogin');
uni.setStorageSync('cffp_userId', this.userId); uni.setStorageSync('cffp_userId', this.userId);
uni.setStorageSync('uni-token', res.data['token']); uni.setStorageSync('uni-token', res.data['token']);
uni.setStorageSync('visitorUuid', res.data['visitorUuid']);
this.queryInfo() this.queryInfo()
// 禁用和注销状态并存,以禁用为准 // 禁用和注销状态并存,以禁用为准
// 已经进行过注销操作的, 弹窗提示90天内不可再次申请加盟为合伙人 // 已经进行过注销操作的, 弹窗提示90天内不可再次申请加盟为合伙人
...@@ -401,106 +395,7 @@ ...@@ -401,106 +395,7 @@
} }
}, 500), }, 500),
// gotoApply() {
// // this.loginType = uni.getStorageSync('loginType')
// if (uni.getStorageSync('sharePosterObj')) {
// this.sharePosterObj = uni.getStorageSync('sharePosterObj')
// }
// console.log('this.sharePosterObj', this.sharePosterObj)
// // 登录并且是禁用状态
// if (this.loginType == 'codelogin' && this.userInfo.userIsActive == 2) {
// this.showCode = true
// this.restrictedOrCanelContent = '您的账号处在不可用状态,请扫码添加客服咨询情况'
// this.$refs.restrictedOrCanelTip.open()
// return
// }
// // 登录并且是注销状态 前端不判断,通过申请加盟的接口判断
// if (!this.form.nickName) {
// common.errorDialog(1, '请输入昵称');
// return false;
// }
// if (this.form.nickName && this.form.nickName.length < 2) {
// common.errorDialog(1, '昵称长度为2~10个字符');
// return
// }
// if (!this.form.mobile) {
// common.errorDialog(1, '请输入手机号');
// return false;
// }
// if (!common.mobileNoValid(this.form.mobile)) {
// common.errorDialog(2, '手机号格式填写错误');
// return false;
// }
// if (!this.loginType || this.loginType === 'visitor') {
// if (!this.form.code) {
// common.errorDialog(1, '请输入验证码');
// return false;
// }
// }
// if (!this.agreeFlag) {
// uni.showToast({
// title: '请阅读并勾选' + `${this.companyInfo.companyFullName}` + '服务协议和隐私条款',
// duration: 3000,
// icon: 'none'
// })
// return false;
// }
// const params = {
// loginType: '3',
// ...this.form
// }
// if (this.loginType == 'codelogin') {
// this.getApply()
// return
// }
// if (!this.loginType || this.loginType == 'visitor') {
// api.loginVerification(params).then((res) => {
// if (res['success']) {
// // 不能登录并且是禁用状态
// if (res.data.userIsActive == 2) {
// this.showCode = true
// this.restrictedOrCanelContent = '您的账号处在不可用状态,请扫码添加客服咨询情况'
// this.$refs.restrictedOrCanelTip.open()
// return
// }
// this.userId = String(res['data']['userId']);
// uni.setStorageSync('isLogin', '1');
// uni.setStorageSync('loginType', 'codelogin');
// uni.setStorageSync('cffp_userId', this.userId);
// uni.setStorageSync('uni-token', res.data['token']);
// this.queryInfo()
// // 禁用和注销状态并存,以禁用为准
// // 已经进行过注销操作的, 弹窗提示90天内不可再次申请加盟为合伙人
// // partnerIsActive 合伙人状态:1签约,2解约,3为加盟 ;解约过的合伙人状态一直为解约,直到下次签约成功才会改变
// // 登录并且是注销状态 前端不判断,通过申请加盟的接口判断
// // if(res.data.partnerIsActive==2){
// // this.showCode = false
// // this.restrictedOrCanelContent = '90天内不可再次申请加盟为合伙人'
// // this.$refs.restrictedOrCanelTip.open()
// // return
// // }
// // 是合伙人就不让在加盟
// if (res.data.isPartner && res.data.partnerIsActive == 1) {
// this.$refs.everyJoinPopup.open()
// return
// }
// // 不是合伙人就加盟
// if (!res.data.isPartner && res.data.partnerIsActive != 1) {
// this.getApply()
// }
// } else {
// uni.showToast({
// title: res['message'],
// duration: 2000,
// icon: 'none'
// })
// }
// })
// }
// },
queryInfo() { queryInfo() {
api.queryInfo({ userId: uni.getStorageSync('cffp_userId') }).then(res => { api.queryInfo({ userId: uni.getStorageSync('cffp_userId') }).then(res => {
......
...@@ -255,6 +255,7 @@ ...@@ -255,6 +255,7 @@
}, },
data() { data() {
return { return {
visitorUuid:'',
sharelogin: false, //是否需要登录 sharelogin: false, //是否需要登录
isLogin: true, //登录状态 isLogin: true, //登录状态
shareTipsFlag: false, shareTipsFlag: false,
...@@ -355,19 +356,24 @@ ...@@ -355,19 +356,24 @@
this.isShare = true this.isShare = true
this.userId = options.userId this.userId = options.userId
this.cardId = options.cardId this.cardId = options.cardId
} }
this.systemInfo = uni.getSystemInfoSync(); this.systemInfo = uni.getSystemInfoSync();
const { platform, deviceType, screenWidth, screenHeight } = this.systemInfo; const { platform, deviceType, screenWidth, screenHeight } = this.systemInfo;
}, },
onShow() { onShow() {
if(uni.getStorageSync('visitorUuid')){
this.visitorUuid = uni.getStorageSync('visitorUuid')
}
if (this.companyType == '1') { if (this.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 (this.isShare) { if (this.isShare) {
this.businessCradStatic()
this.getShareCard() this.getShareCard()
} else { } else {
this.getCard() this.getCard()
...@@ -449,25 +455,13 @@ ...@@ -449,25 +455,13 @@
this.isLogin = true this.isLogin = true
this.getCard() this.getCard()
}, },
// H5 自定义分享
getshareData() {
let data = {
title: ` ${this.cardInfo.userName}| ${this.cardInfo.companyInfoList[0].position} - ${this.cardInfo.companyInfoList[0].companyName}`,
desc: '​AI普惠型新家办领创家庭财事治理蓝海生态',
link: `${shareURL}/myPackageA/businessCard/businessCard?userId=${this.userId}&cardId=${this.cardId}&isShareCard=1`, //分享链接
imgUrl: `${shareURL}/static/suplogo.png`, //图片
}
var url = window.location.href.split('#')[0]
hshare(data, url)
},
// 分享状态下获取名片信息 // 分享状态下获取名片信息
getShareCard() { getShareCard() {
console.log('获取分享名片');
api.getShareBusinessCard( api.getShareBusinessCard(
this.cardId this.cardId
).then(res => { ).then(res => {
if (res['success']) { if (res['success']) {
this.cardInfo = res.data.data this.cardInfo = res.data.data
this.cardId = res.data.data.id this.cardId = res.data.data.id
// this.infoList[0].value = this.cardInfo.phone || '暂无' // this.infoList[0].value = this.cardInfo.phone || '暂无'
...@@ -480,9 +474,27 @@ ...@@ -480,9 +474,27 @@
this.infoList[1].value = this.cardInfo.email || null this.infoList[1].value = this.cardInfo.email || null
this.infoList[2].value = this.cardInfo.address || '暂无' this.infoList[2].value = this.cardInfo.address || '暂无'
if (dataHandling.h5RuntimeEnv() !== 'miniprogram') { if (dataHandling.h5RuntimeEnv() !== 'miniprogram') {
// this.getshareData()
this.setRealPageMetaAndShare() this.setRealPageMetaAndShare()
} }
if(dataHandling.h5RuntimeEnv() == 'wechat-miniprogram'){
let shareInfo = {
title: ` ${this.cardInfo.userName}| ${this.cardInfo.companyInfoList[0].position} - ${this.cardInfo.companyInfoList[0].companyName}`,
desc: '​AI普惠型新家办领创家庭财事治理蓝海生态',
link: `${shareURL}/pages/lanch/index?userId=${this.userId}&cardId=${this.cardId}&isShareCard=1&landingPage=businessCard&miniShare=1`,
imgUrl: `${shareURL}/myPackageA/static/images/logo3.webp`, //图片
sharePage:'businessCard',//分享的哪个页面
userId:this.userId,
cardId:this.cardId,
commonId:this.cardId
}
wx.miniProgram.postMessage({
data:{
type:'share',
shareData:JSON.stringify(shareInfo)
}
})
}
console.log('cardInfo', this.cardInfo); console.log('cardInfo', this.cardInfo);
} else { } else {
uni.showToast({ uni.showToast({
...@@ -512,15 +524,30 @@ ...@@ -512,15 +524,30 @@
this.btnList[1].phoneNumber = this.cardInfo.phone || null this.btnList[1].phoneNumber = this.cardInfo.phone || null
this.infoList[1].value = this.cardInfo.email || null this.infoList[1].value = this.cardInfo.email || null
this.infoList[2].value = this.cardInfo.address || '暂无' this.infoList[2].value = this.cardInfo.address || '暂无'
// this.cardInfo.companyInfoList = [
// {companyName:'上海律宝科技有限公司',position:'副总经理'},
// {companyName:'上海律宝科技有限公司',position:'CEO'},
// ]
if (dataHandling.h5RuntimeEnv() !== 'miniprogram') { if (dataHandling.h5RuntimeEnv() !== 'miniprogram') {
this.setRealPageMetaAndShare() this.setRealPageMetaAndShare()
// this.getshareData()
}
if(dataHandling.h5RuntimeEnv() == 'wechat-miniprogram'){
let shareInfo = {
title: ` ${this.cardInfo.userName}| ${this.cardInfo.companyInfoList[0].position} - ${this.cardInfo.companyInfoList[0].companyName}`,
desc: '​AI普惠型新家办领创家庭财事治理蓝海生态',
link: `${shareURL}/pages/lanch/index?userId=${this.userId}&cardId=${this.cardId}&isShareCard=1&landingPage=businessCard&miniShare=1`,
imgUrl: `${shareURL}/myPackageA/static/images/logo3.webp`, //图片
sharePage:'businessCard',//分享的哪个页面
userId:this.userId,
cardId:this.cardId,
commonId:this.cardId
}
wx.miniProgram.postMessage({
data:{
type:'share',
shareData:JSON.stringify(shareInfo)
}
})
} }
this.getCardStatic() this.getCardStatic()
} else { } else {
uni.showToast({ uni.showToast({
...@@ -549,6 +576,21 @@ ...@@ -549,6 +576,21 @@
} }
}) })
}, },
// 统计名片查看次数
businessCradStatic() {
api.statusBusinessCard({ visitorUuid:this.visitorUuid,cardId:this.cardId }).then(res => {
if (res['success']) {
} else {
uni.showToast({
title: res['message'],
duration: 2000,
icon: 'none'
})
}
})
},
onClickItem(index) { onClickItem(index) {
if (this.current !== index) { if (this.current !== index) {
this.current = index; this.current = index;
...@@ -590,24 +632,31 @@ ...@@ -590,24 +632,31 @@
this.$refs.popup.open() this.$refs.popup.open()
return return
} }
if (dataHandling.h5RuntimeEnv() !== 'wechat-miniprogram') {
this.setRealPageMetaAndShare()
}
// 如果是移动端 // 如果是移动端
this.shareTipsFlag = true; //提示用户点击小程序的右上角胶囊进行分享 this.shareTipsFlag = true; //提示用户点击小程序的右上角胶囊进行分享
if (dataHandling.h5RuntimeEnv() !== 'miniprogram') { if(dataHandling.h5RuntimeEnv() == 'wechat-miniprogram'){
this.getshareData() let shareInfo = {
title: ` ${this.cardInfo.userName}| ${this.cardInfo.companyInfoList[0].position} - ${this.cardInfo.companyInfoList[0].companyName}`,
desc: '​AI普惠型新家办领创家庭财事治理蓝海生态',
link: `${shareURL}/pages/lanch/index?userId=${this.userId}&cardId=${this.cardId}&isShareCard=1&landingPage=businessCard&miniShare=1`,
// link: `${shareURL}/myPackageA/businessCard/businessCard?userId=${this.userId}&cardId=${this.cardId}&isShareCard=1`, //分享链接
imgUrl: `${shareURL}/myPackageA/static/images/logo3.webp`, //图片
sharePage:'businessCard',//分享的哪个页面
userId:this.userId,
cardId:this.cardId,
commonId:this.userId
}
wx.miniProgram.postMessage({
data:{
type:'share',
shareData:JSON.stringify(shareInfo)
}
})
} }
// if(dataHandling.h5RuntimeEnv() == 'miniprogram'){
// let data = {
// title: ` ${this.cardInfo.userName}| ${this.cardInfo.companyInfoList[0].position} - ${this.cardInfo.companyInfoList[0].companyName}`,
// desc: '​AI普惠型新家办领创家庭财事治理蓝海生态',
// link: `${shareURL}/myPackageA/businessCard/businessCard?userId=${this.userId}&cardId=${this.cardId}&isShareCard=1`, //分享链接
// imgUrl: `${shareURL}/myPackageA/static/images/suplogo.png`, //图片
// }
// // 这里应该给小程序的webview发消息,不知道该怎样发送?此时
// wx.miniProgram.navigateTo({
// url: `/myPackageA/h5Pay/appYdhomeofficePay?param=${encodeURIComponent(JSON.stringify(param))}`
// })
// }
} }
}, },
//关闭登录 //关闭登录
......
...@@ -63,6 +63,7 @@ ...@@ -63,6 +63,7 @@
import {companyInfo} from "@/environments/environment"; import {companyInfo} from "@/environments/environment";
import { initJssdkShare, setWechatShare } from '@/util/fiveshare'; import { initJssdkShare, setWechatShare } from '@/util/fiveshare';
import restrictedTip from '@/components/commonPopup/restrictedTip.vue'; import restrictedTip from '@/components/commonPopup/restrictedTip.vue';
import dataHandling from "@/util/dataHandling";
export default { export default {
data() { data() {
return { return {
...@@ -180,7 +181,8 @@ ...@@ -180,7 +181,8 @@
}); });
const params = { const params = {
loginType:loginType, loginType:loginType,
...this.form ...this.form,
visitorUuid:uni.getStorageSync('visitorUuid')?uni.getStorageSync('visitorUuid'):dataHandling.uuid()
} }
api.loginVerification(params).then((res)=>{ api.loginVerification(params).then((res)=>{
if(res['success']){ if(res['success']){
...@@ -195,7 +197,7 @@ ...@@ -195,7 +197,7 @@
uni.setStorageSync('cffp_userId',this.userId); uni.setStorageSync('cffp_userId',this.userId);
uni.setStorageSync('loginType',this.loginType); uni.setStorageSync('loginType',this.loginType);
uni.setStorageSync('uni-token', res.data['token']); uni.setStorageSync('uni-token', res.data['token']);
uni.setStorageSync('visitorUuid', res.data['visitorUuid']);
if(urlType == 'personalCenter'){ if(urlType == 'personalCenter'){
uni.switchTab({ uni.switchTab({
url:'/pages/personalCenter/personalCenter' url:'/pages/personalCenter/personalCenter'
......
...@@ -170,7 +170,7 @@ ...@@ -170,7 +170,7 @@
@close="close" @close="close"
></boot-page> ></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">
<image src="../../static/Group132.png" mode="widthFix"></image> <image src="../../static/Group132.png" mode="widthFix"></image>
<view class="tips"> <view class="tips">
...@@ -178,8 +178,9 @@ ...@@ -178,8 +178,9 @@
<view>分享给朋友</view> <view>分享给朋友</view>
</view> </view>
</view> </view>
</view> </view> -->
<!-- 分享得向导图 -->
<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" >
...@@ -286,6 +287,8 @@ ...@@ -286,6 +287,8 @@
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 wx from 'weixin-js-sdk'
export default { export default {
components: { components: {
UniShareWx, UniShareWx,
...@@ -295,10 +298,13 @@ ...@@ -295,10 +298,13 @@
PartnerTipPopup, PartnerTipPopup,
restrictedTip, restrictedTip,
sharePosterPop, sharePosterPop,
loadingIcon loadingIcon,
ShareGuide
}, },
data() { data() {
return { return {
pollingTimer :null ,// 轮询定时器
miniShareInfo :{},//通过小程序分享出去的信息
sharePosterObj:{}, sharePosterObj:{},
userInfo: {}, userInfo: {},
wayType:'1', //登陆的类型 wayType:'1', //登陆的类型
...@@ -395,6 +401,11 @@ ...@@ -395,6 +401,11 @@
}, },
// 打开微信分享啊 // 打开微信分享啊
reinvite() { reinvite() {
//小程序没登录进入到系统,要回到小程序去登录
if(uni.getStorageSync('mpCffp')&&!uni.getStorageSync('dataToken')){
this.jumpMplogin()
return
}
// 未登录去登录 // 未登录去登录
if(!uni.getStorageSync('loginType') ||uni.getStorageSync('loginType') == 'visitor'){ if(!uni.getStorageSync('loginType') ||uni.getStorageSync('loginType') == 'visitor'){
dataHandling.pocessTracking( dataHandling.pocessTracking(
...@@ -429,23 +440,23 @@ ...@@ -429,23 +440,23 @@
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')))
} // }
this.posterShareTxt = '长按图片分享给朋友' // this.posterShareTxt = '长按图片分享给朋友'
this.posterDesTxt = '识别二维码查看商品' // this.posterDesTxt = '识别二维码查看商品'
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
this.submitsuessc(shareCode,jumptime), // this.submitsuessc(shareCode,jumptime),
this.posterImgType = 'sharePoster' // this.posterImgType = 'sharePoster'
return // return
} // }
//app分享 //app分享
// #ifdef APP-PLUS // #ifdef APP-PLUS
let dataWXform = { let dataWXform = {
...@@ -472,6 +483,25 @@ ...@@ -472,6 +483,25 @@
//#ifdef H5 //#ifdef H5
this.shareTipsFlag = true; this.shareTipsFlag = true;
if(dataHandling.h5RuntimeEnv() == 'wechat-miniprogram'){
let shareInfo = {
title: this.courseInfo.fileTitle,
// desc: '加入我们开启学习之旅',
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`,
imgUrl: this.courseInfo.displayImage, //图片
sharePage:'courseDetail',//分享的哪个页面
commonId: shareCode
}
wx.miniProgram.postMessage({
data:{
type:'share',
shareData:JSON.stringify(shareInfo)
}
})
return
}
this.getshareData2(shareCode,jumptime) this.getshareData2(shareCode,jumptime)
// #endif // #endif
...@@ -609,6 +639,11 @@ ...@@ -609,6 +639,11 @@
}, },
// 订单保存 // 订单保存
saveOrder() { saveOrder() {
//小程序没登录进入到系统,要回到小程序去登录
if(uni.getStorageSync('mpCffp')&&!uni.getStorageSync('dataToken')){
this.jumpMplogin()
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'
...@@ -690,7 +725,7 @@ ...@@ -690,7 +725,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
...@@ -711,10 +746,12 @@ ...@@ -711,10 +746,12 @@
) )
// 如果是商城跳转到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);
...@@ -772,7 +809,7 @@ ...@@ -772,7 +809,7 @@
packFileId: this.courseInfo.packFileId packFileId: this.courseInfo.packFileId
}).then(res => { }).then(res => {
if (res['success']) { if (res['success']) {
this.courseInfo = 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));
...@@ -793,6 +830,26 @@ ...@@ -793,6 +830,26 @@
// #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'){
let shareInfo = {
title: this.courseInfo.fileTitle,
// desc: '加入我们开启学习之旅',
desc:this.courseInfo.fileSynopsis,
link: `${shareURL}/pages/lanch/index?fileId=${this.fileId}&landingPage=courseDetail&miniShare=1`,
// link: shareURL + "/pages/courseDetail/courseDetail?fileId=" + this.fileId, //分享链接
imgUrl: this.courseInfo.displayImage, //图片
sharePage:'courseDetail',//分享的哪个页面
commonId: shareCode
}
wx.miniProgram.postMessage({
data:{
type:'share',
shareData:JSON.stringify(shareInfo)
}
})
return
}
this.getshareData2(shareCode, jumptime,0) this.getshareData2(shareCode, jumptime,0)
// #endif // #endif
} }
...@@ -1127,7 +1184,8 @@ ...@@ -1127,7 +1184,8 @@
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']);
...@@ -1135,6 +1193,7 @@ ...@@ -1135,6 +1193,7 @@
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']);
} }
}) })
} }
...@@ -1149,8 +1208,9 @@ ...@@ -1149,8 +1208,9 @@
// 背景图片加载失败 // 背景图片加载失败
handleBgImageError() { handleBgImageError() {
console.log('产品图片加载完成'); console.log('产品图片加载完成');
// 即使失败也继续流程,可能会有默认背景 // uni.showToast({
// this.generateQrcodeAndCapture(); // title:'海报生成失败,图片'
// })
}, },
// 顺序执行:生成二维码 -> 截图 // 顺序执行:生成二维码 -> 截图
...@@ -1294,10 +1354,10 @@ ...@@ -1294,10 +1354,10 @@
// 关闭海报弹窗 // 关闭海报弹窗
closePoster(){ closePoster(){
this.showImg = false this.showImg = false
this.generatedImage = '', this.generatedImage = ''
this.shareItem = { // this.shareItem = {
fileFirstImage:'' // fileFirstImage:''
} // }
}, },
sendMessageToMiniProgram() { sendMessageToMiniProgram() {
// 确保wx对象已存在 // 确保wx对象已存在
...@@ -1341,10 +1401,67 @@ ...@@ -1341,10 +1401,67 @@
return false; return false;
} }
}, },
startPolling() {
// 先清除可能存在的旧定时器
if (this.pollingTimer) {
clearInterval(this.pollingTimer)
this.pollingTimer = null
}
// 每3秒轮询一次,最多轮询100次(5分钟)
let count = 0
const maxCount = 100
this.pollingTimer = setInterval(() => {
count++
uni.showModal({
content:count
})
}, 1000) // 3秒轮询一次
},
// 新增:停止轮询
stopPolling () {
if (this.pollingTimer) {
clearInterval(this.pollingTimer)
this.pollingTimer = null
}
},
// 跳转到小程序登录
jumpMplogin(){
let currentUrl = ``;
if(this.miniShareInfo.miniShare){
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`
}else {
currentUrl = `${shareURL}/pages/lanch/index?fileId=${this.fileId}&landingPage=courseDetail&noShare=1`
}
let data = {
type:'login',
h5SystemType:'cffp',
link: encodeURIComponent(currentUrl),
miniShare:this.miniShareInfo.miniShare?this.miniShareInfo.miniShare:''//是否从小程序的分享卡片进入的
}
wx.miniProgram.postMessage({
data:{
type:'login',
shareData:JSON.stringify(data)
}
})
wx.miniProgram.navigateBack({
delta:1
})
}
}, },
onLoad(option) { onLoad(option) {
// 通过小程序的分享卡片进来的,保存分享参数
if(option.miniShare){
this.miniShareInfo = option
}
this.sharePosterObj = uni.getStorageSync('sharePosterObj') || {}; this.sharePosterObj = uni.getStorageSync('sharePosterObj') || {};
// console.log('sharePosterObj======',this.sharePosterObj); // console.log('sharePosterObj======',this.sharePosterObj);
// 如果通过海报分享进入系统,海报分享人为合伙人且普通客户完成购买了,那么海报分享人可以获得销售佣金 // 如果通过海报分享进入系统,海报分享人为合伙人且普通客户完成购买了,那么海报分享人可以获得销售佣金
...@@ -1362,6 +1479,7 @@ ...@@ -1362,6 +1479,7 @@
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) {
...@@ -1388,7 +1506,6 @@ ...@@ -1388,7 +1506,6 @@
// 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')
...@@ -1407,6 +1524,7 @@ ...@@ -1407,6 +1524,7 @@
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();
......
...@@ -2,20 +2,20 @@ ...@@ -2,20 +2,20 @@
<!-- :style="{paddingTop: showFlag ? '0' : '60rpx'}" --> <!-- :style="{paddingTop: showFlag ? '0' : '60rpx'}" -->
<view class="container" :style="{paddingTop: showFlag ? '0' : '60rpx'}"> <view class="container" :style="{paddingTop: showFlag ? '0' : '60rpx'}">
<!-- 禁用弹窗 --> <!-- 禁用弹窗 -->
<restrictedTip ref="restrictedTip"/> <restrictedTip ref="restrictedTip" />
<view class="homeHeader" v-if="showFlag"> <view class="homeHeader" v-if="showFlag">
<view class="one"> <view class="one">
<text style="font-size: 80rpx;">01</text> <text style="font-size: 80rpx;">01</text>
<view class="titleTxt"> <view class="titleTxt">
<text >分享商品</text> <text>分享商品</text>
<text class="iconfont icon-shuangyoujiantou iconOne" ></text> <text class="iconfont icon-shuangyoujiantou iconOne"></text>
</view> </view>
</view> </view>
<view class="two"> <view class="two">
<text>02</text> <text>02</text>
<view class="titleTxt"> <view class="titleTxt">
<text >好友购买</text> <text>好友购买</text>
<text class="iconfont icon-shuangyoujiantou iconOne" ></text> <text class="iconfont icon-shuangyoujiantou iconOne"></text>
</view> </view>
</view> </view>
<view class="three"> <view class="three">
...@@ -31,15 +31,8 @@ ...@@ -31,15 +31,8 @@
<!-- v-if="!generatedImage" --> <!-- v-if="!generatedImage" -->
<view class="generateImageBox" ref="captureElement" v-if="!generatedImage"> <view class="generateImageBox" ref="captureElement" v-if="!generatedImage">
<view class="imgBox"> <view class="imgBox">
<img <img class="posterImg" @load="handleBgImageLoad" @error="handleBgImageError" style="display: block;"
class="posterImg" :src="sharePosterItem.fileFirstImage+'?t='+Math.random()" crossorigin="anonymous" alt="防缓存图片" />
@load="handleBgImageLoad"
@error="handleBgImageError"
style="display: block;"
:src="sharePosterItem.fileFirstImage+'?t='+Math.random()"
crossorigin="anonymous"
alt="防缓存图片"
/>
</view> </view>
<view class="txtBox"> <view class="txtBox">
<view class="descriptionTxt"> <view class="descriptionTxt">
...@@ -52,10 +45,7 @@ ...@@ -52,10 +45,7 @@
<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>
<text class="companyName">银盾家办</text> <text class="companyName">银盾家办</text>
</view> </view>
...@@ -65,25 +55,22 @@ ...@@ -65,25 +55,22 @@
</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 class="productBox"> <view class="productBox">
<view class="productList" :style="{marginTop}"> <view class="productList" :style="{marginTop}">
<view class="tabBox"> <view class="tabBox">
<view :class="{'actived': courseClassify==4}" @click="transform('consult')"><text>咨询产品</text></view> <view :class="{'actived': courseClassify==4}" @click="transform('consult')"><text>咨询产品</text></view>
<view :class="{'actived': courseClassify==3}" @click="transform('plan')"><text>规划产品</text></view> <view :class="{'actived': courseClassify==3}" @click="transform('plan')"><text>规划产品</text></view>
</view> </view>
<view class="productItem" v-for="item in localCourseInfos" :key="item.fileId" > <view class="productItem" v-for="item in localCourseInfos" :key="item.fileId">
<view class="top" @click="goDetail(item)"> <view class="top" @click="goDetail(item)">
<view class="left"> <view class="left">
<image class="productImg" :src="item.displayImage" alt="" mode="widthFix"></image> <image class="productImg" :src="item.displayImage" alt="" mode="widthFix"></image>
...@@ -96,20 +83,19 @@ ...@@ -96,20 +83,19 @@
{{item.fileSynopsis}} {{item.fileSynopsis}}
</view> </view>
<view class="three"> <view class="three">
<text style="font-size: 28rpx;color: rgba(32, 39, 155, 1);">{{Number(item.coursePrice).toFixed(2)}}</text> <text
style="font-size: 28rpx;color: rgba(32, 39, 155, 1);">{{Number(item.coursePrice).toFixed(2)}}</text>
</view> </view>
</view> </view>
</view> </view>
<view class="bottom"> <view class="bottom">
<view class="bottomCon"> <view class="bottomCon">
<view class="left" > <view class="left">
最高可赚¥{{item.income || '0.00'}} 最高可赚¥{{item.income || '0.00'}}
</view> </view>
<view class="right" @click="gotoShare(item)"> <view class="right" @click="gotoShare(item)">
<loadingIcon <loadingIcon :loading="isLoading"
:loading="isLoading" v-if="isLoading&&(sharePosterItem.fileId==item.fileId)" />
v-if="isLoading&&(sharePosterItem.fileId==item.fileId)"
/>
<text style="margin-left: 5rpx;">去分享</text> <text style="margin-left: 5rpx;">去分享</text>
</view> </view>
</view> </view>
...@@ -117,21 +103,11 @@ ...@@ -117,21 +103,11 @@
</view> </view>
</view> </view>
</view> </view>
<BootPage <BootPage loginSource="产品中心" ref="sharelogin" v-if="sharelogin" @close="closeLogin">
loginSource="产品中心"
ref="sharelogin"
v-if="sharelogin"
@close="closeLogin"
>
</BootPage> </BootPage>
<!-- 海报弹窗 --> <!-- 海报弹窗 -->
<sharePosterPop <sharePosterPop ref="sharePosterPop" :generatedImage="generatedImage" @closePoster="closePoster"
ref="sharePosterPop" :sharePosterUrl="qrCodeUrl" :sharePosterObj="sharePosterObj"></sharePosterPop>
:generatedImage="generatedImage"
@closePoster="closePoster"
:sharePosterUrl="qrCodeUrl"
:sharePosterObj="sharePosterObj"
></sharePosterPop>
<uni-popup ref="popup" type="center" background-color="#fff"> <uni-popup ref="popup" type="center" background-color="#fff">
<view class="descriptionBox"> <view class="descriptionBox">
<view class="imageBox"> <view class="imageBox">
...@@ -139,33 +115,24 @@ ...@@ -139,33 +115,24 @@
<text class="subTit">通知实时提醒,及时接收下单和提现通知</text> <text class="subTit">通知实时提醒,及时接收下单和提现通知</text>
</view> </view>
<view class="codeBox"> <view class="codeBox">
<image v-if="sourceType == '1'" src="@/static/cffpCode.jpg" mode="widthFix" style="width:250rpx !important;"></image> <image v-if="sourceType == '1'" src="@/static/cffpCode.jpg" mode="widthFix"
<image v-if="sourceType == '4'" src="@/static/ydCode.jpg" mode="widthFix" style="width:250rpx !important;"></image> style="width:250rpx !important;"></image>
<image v-if="sourceType == '3'" src="@/static/ydHomeOfficeCode.jpg" mode="widthFix" style="width:250rpx !important;"></image> <image v-if="sourceType == '4'" src="@/static/ydCode.jpg" mode="widthFix"
style="width:250rpx !important;"></image>
<image v-if="sourceType == '3'" src="@/static/ydHomeOfficeCode.jpg" mode="widthFix"
style="width:250rpx !important;"></image>
</view> </view>
<view class="description"> <view class="description">
扫一扫,关注公众号 扫一扫,关注公众号
</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"
/>
<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="guideImgBox"> <ShareGuide :show.sync="shareTipsFlag" @close="shareTipsFlag=false"></ShareGuide>
<image src="../../static/Group132.png" mode="widthFix"></image>
<view class="tips">
<view style="margin-bottom:30rpx">请点击右上角菜单</view>
<view>分享给朋友</view>
</view>
</view>
</view>
</view> </view>
<!-- <tabBar :currentPage="currentPage" v-if="onlyShowList!=0"></tabBar> --> <!-- <tabBar :currentPage="currentPage" v-if="onlyShowList!=0"></tabBar> -->
</template> </template>
...@@ -178,29 +145,35 @@ ...@@ -178,29 +145,35 @@
import tabBar from '../../components/tabBar/tabBar.vue'; import tabBar from '../../components/tabBar/tabBar.vue';
import carousel from '@/components/carousel/carousel.vue'; import carousel from '@/components/carousel/carousel.vue';
import search from '@/components/search/search.vue'; import search from '@/components/search/search.vue';
import {baseURL,apiURL,cffpURL,companyInfo,shareURL} from "@/environments/environment"; import { baseURL, apiURL, cffpURL, companyInfo, shareURL } from "@/environments/environment";
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 UniShareWx from "@/uni_modules/uni-share-wx/index.vue"; import UniShareWx from "@/uni_modules/uni-share-wx/index.vue";
import {nanoid} from 'nanoid'; import { nanoid } from 'nanoid';
import restrictedTip from '@/components/commonPopup/restrictedTip.vue'; import restrictedTip from '@/components/commonPopup/restrictedTip.vue';
import sharePosterPop from '@/components/commonPopup/sharePosterPop.vue'; import sharePosterPop from '@/components/commonPopup/sharePosterPop.vue';
import loadingIcon from '@/components/loading/loading.vue'; import loadingIcon from '@/components/loading/loading.vue';
import ShareGuide from '@/components/ShareGuide/ShareGuide.vue';
import UQRCode from 'uqrcodejs'; import UQRCode from 'uqrcodejs';
import { elementToImage } from '@/util/htmlToImage'; import wx from 'weixin-js-sdk'
export default{ import { elementToImage } from '@/util/htmlToImage';
name:'courselist', export default {
props:{ name: 'courselist',
showFlag:{ props: {
type:Boolean, showFlag: {
default:true type: Boolean,
default: true
}, },
cffpCourseInfos: { cffpCourseInfos: {
type: Array, type: Array,
default: () => [] default: () => []
} },
pageSource: {
type: String,
default: 'courselist'
}
}, },
components:{ components: {
courseItem, courseItem,
tabBar, tabBar,
carousel, carousel,
...@@ -210,255 +183,285 @@ ...@@ -210,255 +183,285 @@
PartnerTipPopup, PartnerTipPopup,
restrictedTip, restrictedTip,
sharePosterPop, sharePosterPop,
loadingIcon loadingIcon,
ShareGuide
}, },
watch: { watch: {
// 监听 prop 变化,更新本地副本 // 监听 prop 变化,更新本地副本
cffpCourseInfos: { cffpCourseInfos: {
immediate: true, // 立即执行一次 immediate: true, // 立即执行一次
handler(newVal) { handler(newVal) {
this.localCourseInfos = [...newVal]; // 深拷贝(如果是简单数组,浅拷贝也行) this.localCourseInfos = [...newVal]; // 深拷贝(如果是简单数组,浅拷贝也行)
}, },
}, },
}, },
data(){ data() {
return{ return {
localCourseInfos: [], // 本地副本 localCourseInfos: [], // 本地副本
currentPage:'courselist', currentPage: 'courselist',
fileUploadItemCFFPList:[], fileUploadItemCFFPList: [],
queryName:null, queryName: null,
userId: uni.getStorageSync('cffp_userId'), userId: uni.getStorageSync('cffp_userId'),
userInfo:{}, userInfo: {},
runEnv:dataHandling.getRuntimeEnv(), //运行的环境 browser、app、h5 runEnv: dataHandling.getRuntimeEnv(), //运行的环境 browser、app、h5
shareTipsFlag:false, shareTipsFlag: false,
sourceType:'1',//根据来源展示二维码 默认是cffp, sourceType: '1', //根据来源展示二维码 默认是cffp,
env:dataHandling.getRuntimeEnv2(), env: dataHandling.getRuntimeEnv2(),
shareItem:{},//分享的产品 shareItem: {}, //分享的产品
sharelogin: false, sharelogin: false,
courseClassify:4, courseClassify: 4,
posterImg:'https://yindun-images.oss-cn-shanghai-finance-1-pub.aliyuncs.com/ydMall/product/serviceContent-zx_jqsw1-1.png', posterImg: 'https://yindun-images.oss-cn-shanghai-finance-1-pub.aliyuncs.com/ydMall/product/serviceContent-zx_jqsw1-1.png',
qrCodeUrl: 'https://example.com',//二维码的链接地址 qrCodeUrl: 'https://example.com', //二维码的链接地址
qrCodeSize: 100,//二维码的尺寸 qrCodeSize: 100, //二维码的尺寸
companyLogo : '../../static/suplogo.png', companyLogo: '../../static/suplogo.png',
generatedImage:'',//生成的海报图片 generatedImage: '', //生成的海报图片
sharePosterObj:{},//海报分享数据 sharePosterObj: {}, //海报分享数据
sharePosterItem:{fileFirstImage:''}, sharePosterItem: { fileFirstImage: '' },
isLoading: false isLoading: false
} }
}, },
onLoad() { onLoad() {
this.queryName = uni.getStorageSync('queryName') || ''; this.queryName = uni.getStorageSync('queryName') || '';
this.sourceType = uni.getStorageSync('addSystemType') || '1'; this.sourceType = uni.getStorageSync('addSystemType') || '1';
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';
} }
}, },
onShow() { onShow() {
this.isLoading = false this.isLoading = false
this.generatedImage = '' this.generatedImage = ''
this.sharePosterItem = {fileFirstImage:''} this.sharePosterItem = { fileFirstImage: '' }
this.queryName = uni.getStorageSync('queryName') || ''; this.queryName = uni.getStorageSync('queryName') || '';
this.courseList(); this.courseList();
this.sourceType = uni.getStorageSync('addSystemType') || '1'; this.sourceType = uni.getStorageSync('addSystemType') || '1';
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
}, },
created(){ created() {
this.queryName = uni.getStorageSync('queryName') || ''; this.queryName = uni.getStorageSync('queryName') || '';
this.courseList(); this.courseList();
// 初始化本地副本 // 初始化本地副本
this.localCourseInfos = [...this.cffpCourseInfos]; this.localCourseInfos = [...this.cffpCourseInfos];
this.sourceType = uni.getStorageSync('addSystemType') || '1'; this.sourceType = uni.getStorageSync('addSystemType') || '1';
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'))
} }
}, },
computed:{ computed: {
marginTop(){ marginTop() {
if(this.env.device.isMobile){ if (this.env.device.isMobile) {
return '-5%' return '-5%'
}else { } else {
return '-1.5%' return '-1.5%'
} }
} }
}, },
methods:{ methods: {
transform(value){ transform(value) {
if(value == 'consult'){ if (value == 'consult') {
this.courseClassify = 4 this.courseClassify = 4
}else if(value == 'plan'){ } else if (value == 'plan') {
this.courseClassify = 3 this.courseClassify = 3
} }
this.$emit('changeCourseClassify',this.courseClassify) this.$emit('changeCourseClassify', this.courseClassify)
this.courseList() this.courseList()
}, },
gotoJoinPartner(){ gotoJoinPartner() {
dataHandling.pocessTracking( dataHandling.pocessTracking(
'点击', '点击',
`用户在产品中心未加盟时点击了加盟按钮`, `用户在产品中心未加盟时点击了加盟按钮`,
'点击', '点击',
2, 2,
'产品中心', '产品中心',
'pages/courselist/courselist' 'pages/courselist/courselist'
) )
uni.navigateTo({ uni.navigateTo({
url: '/myPackageA/applyFranchise/applyFranchise' url: '/myPackageA/applyFranchise/applyFranchise'
}) })
this.$refs.partnerTipPopup.close() this.$refs.partnerTipPopup.close()
}, },
gotoShare(item){ gotoShare(item) {
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'))
} }
// return // return
// 未登录去登录 // 未登录去登录
if(uni.getStorageSync('loginType')!=='codelogin'){ if (uni.getStorageSync('loginType') !== 'codelogin') {
dataHandling.pocessTracking( dataHandling.pocessTracking(
'点击', '点击',
`用户在产品中心未登录时点击产品分享按钮`, `用户在产品中心未登录时点击产品分享按钮`,
'点击', '点击',
2, 2,
'产品中心', '产品中心',
'pages/courselist/courselist' 'pages/courselist/courselist'
) )
console.log('env', dataHandling.h5RuntimeEnv() == 'wechat-miniprogram');
if (dataHandling.h5RuntimeEnv() == 'wechat-miniprogram') {
this.jumpMplogin()
return
}
this.sharelogin = true this.sharelogin = true
return return
} }
this.shareItem = JSON.parse(JSON.stringify(item)) this.shareItem = JSON.parse(JSON.stringify(item))
// 已登录,未成为合伙人 // 已登录,未成为合伙人
if(this.userInfo&&!this.userInfo['partnerType']) { if (this.userInfo && !this.userInfo['partnerType']) {
dataHandling.pocessTracking( dataHandling.pocessTracking(
'点击', '点击',
`用户在产品中心未加盟时点击产品分享按钮`, `用户在产品中心未加盟时点击产品分享按钮`,
'点击', '点击',
2, 2,
'产品中心', '产品中心',
'pages/courselist/courselist' 'pages/courselist/courselist'
) )
this.$refs.partnerTipPopup.open() this.$refs.partnerTipPopup.open()
return return
} }
if(this.runEnv == 'browser'){ if (this.runEnv == 'browser') {
dataHandling.pocessTracking( dataHandling.pocessTracking(
'点击', '点击',
`用户在产品中心浏览器端点击产品分享按钮`, `用户在产品中心浏览器端点击产品分享按钮`,
'点击', '点击',
2, 2,
'产品中心', '产品中心',
'pages/courselist/courselist' 'pages/courselist/courselist'
) )
this.$refs.popup.open() this.$refs.popup.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(uni.getStorageSync('mpCffp')){ // if (uni.getStorageSync('mpCffp')) {
this.isLoading = true // this.isLoading = true
this.sharePosterItem = JSON.parse(JSON.stringify(this.shareItem)) // this.sharePosterItem = JSON.parse(JSON.stringify(this.shareItem))
let newLink = shareURL + "/pages/courseDetail/courseDetail?fileId=" + this.shareItem.fileId + // let newLink = shareURL + "/pages/courseDetail/courseDetail?fileId=" + this.shareItem.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.submitsuessc(shareCode,jumptime,this.shareItem) // this.submitsuessc(shareCode, jumptime, this.shareItem)
return // return
} // }
//app分享 //app分享
// #ifdef APP-PLUS // #ifdef APP-PLUS
let dataWXform = { let dataWXform = {
href: shareURL + "/pages/courseDetail/courseDetail?fileId=" + this.shareItem.fileId + href: shareURL + "/pages/courseDetail/courseDetail?fileId=" + this.shareItem.fileId +
'&coursesharing=1' + '&serialsNo=' + nanoid() + '&shareCode=' + shareCode + '&shareUserId=' + '&coursesharing=1' + '&serialsNo=' + nanoid() + '&shareCode=' + shareCode + '&shareUserId=' +
this.userId + '&jumpUrl=' + jumptime + "&", this.userId + '&jumpUrl=' + jumptime + "&",
title: this.shareItem.fileTitle, title: this.shareItem.fileTitle,
summary: this.shareItem.fileSynopsis, summary: this.shareItem.fileSynopsis,
imageUrl: this.shareItem.displayImage, imageUrl: this.shareItem.displayImage,
fileId: this.shareItem.fileId, fileId: this.shareItem.fileId,
shareCode: shareCode shareCode: shareCode
} }
this.$refs.sharewx.open(dataWXform) this.$refs.sharewx.open(dataWXform)
dataHandling.pocessTracking( dataHandling.pocessTracking(
'点击', '点击',
`用户在产品中心点击分享按钮,分享${this.shareItem.fileTitle}`, `用户在产品中心点击分享按钮,分享${this.shareItem.fileTitle}`,
'点击', '点击',
2, 2,
'产品中心', '产品中心',
'pages/courselist/courselist' 'pages/courselist/courselist'
) )
// #endif // #endif
//#ifdef H5 //#ifdef H5
this.shareTipsFlag = true; this.shareTipsFlag = true;
this.getshareData2(shareCode,jumptime, this.shareItem) if (dataHandling.h5RuntimeEnv() == 'wechat-miniprogram') {
let shareInfo = {
title: this.shareItem.fileTitle,
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/courseDetail/courseDetail?fileId=" + this.shareItem.fileId +
// '&coursesharing=1' + '&serialsNo=' + nanoid() + '&shareCode=' + shareCode +
// '&shareUserId=' +
// this.userId + '&jumpUrl=' + jumptime + "&", //分享链接
imgUrl: this.shareItem.displayImage, //图片
commonId: this.shareItem.fileId,
sharePage: 'courseDetail' //分享出去得页面
}
wx.miniProgram.postMessage({
data: {
type: 'share',
shareData: JSON.stringify(shareInfo)
}
})
return
}
this.getshareData2(shareCode, jumptime, this.shareItem)
// #endif // #endif
this.$refs.partnerTipPopup.close() this.$refs.partnerTipPopup.close()
}, },
getshareData2(shareCode,jumptime,item) { getshareData2(shareCode, jumptime, item) {
let data = { let data = {
title: item.fileTitle, title: item.fileTitle,
// desc: '加入我们开启学习之旅', // desc: '加入我们开启学习之旅',
desc:item.fileSynopsis, desc: item.fileSynopsis,
link: shareURL + "/pages/courseDetail/courseDetail?fileId=" + item.fileId + link: shareURL + "/pages/courseDetail/courseDetail?fileId=" + item.fileId +
'&coursesharing=1' + '&serialsNo=' + nanoid() + '&shareCode=' + shareCode + '&shareUserId=' + '&coursesharing=1' + '&serialsNo=' + nanoid() + '&shareCode=' + shareCode + '&shareUserId=' +
this.userId + '&jumpUrl=' + jumptime+ "&", //分享链接 this.userId + '&jumpUrl=' + jumptime + "&", //分享链接
imgUrl: item.displayImage, //图片 imgUrl: item.displayImage, //图片
} }
//安卓机型获取当前页面路径 //安卓机型获取当前页面路径
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];
} }
} }
setTimeout(()=>{ setTimeout(() => {
initJssdkShare(() => { initJssdkShare(() => {
setWechatShare(data); setWechatShare(data);
}, url); }, url);
},500) }, 500)
// hshare(data, url) // hshare(data, url)
this.submitsuessc(shareCode,jumptime,item) this.submitsuessc(shareCode, jumptime, item)
dataHandling.pocessTracking( dataHandling.pocessTracking(
'点击', '点击',
`用户在产品中心点击分享按钮,分享${item.fileTitle}`, `用户在产品中心点击分享按钮,分享${item.fileTitle}`,
'点击', '点击',
2, 2,
'产品中心', '产品中心',
'pages/courselist/courselist' 'pages/courselist/courselist'
) )
}, },
submitsuessc(shareCode,jumptime,item){ submitsuessc(shareCode, jumptime, item) {
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:item.fileId, // 课程Id businessId: item.fileId, // 课程Id
shareUrl: shareURL + "/pages/courseDetail/courseDetail?fileId=" + item.fileId + shareUrl: shareURL + "/pages/courseDetail/courseDetail?fileId=" + item.fileId +
'&coursesharing=1' + '&serialsNo=' + nanoid() + '&shareCode=' + shareCode + '&shareUserId=' + '&coursesharing=1' + '&serialsNo=' + nanoid() + '&shareCode=' + shareCode + '&shareUserId=' +
this.userId + '&jumpUrl=' + jumptime + "&", // 分享链接 this.userId + '&jumpUrl=' + jumptime + "&", // 分享链接
...@@ -469,9 +472,9 @@ ...@@ -469,9 +472,9 @@
api.userShare(UserShareRequestVO).then(res => { api.userShare(UserShareRequestVO).then(res => {
if (res['success']) { if (res['success']) {
// #ifdef H5 // #ifdef H5
initJssdkShare(() => { initJssdkShare(() => {
setWechatShare(); setWechatShare();
}, window.location.href); }, window.location.href);
// #endif // #endif
// uni.showToast({ // uni.showToast({
// title: '分享成功', // title: '分享成功',
...@@ -480,72 +483,72 @@ ...@@ -480,72 +483,72 @@
} }
}) })
}, },
closeLogin(val1,val2,val3){ closeLogin(val1, val2, val3) {
if(val3){ if (val3) {
this.sharelogin=false this.sharelogin = false
return return
} }
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.sharelogin=false this.sharelogin = false
if(this.runEnv == 'browser'){ if (this.runEnv == 'browser') {
dataHandling.pocessTracking( dataHandling.pocessTracking(
'点击', '点击',
`用户在产品中心浏览器端点击产品分享按钮`, `用户在产品中心浏览器端点击产品分享按钮`,
'点击', '点击',
2, 2,
'产品中心', '产品中心',
'pages/courselist/courselist' 'pages/courselist/courselist'
) )
this.$refs.popup.open() this.$refs.popup.open()
return return
}else{ } else {
// 已登录,未成为合伙人 // 已登录,未成为合伙人
if(!this.userInfo['partnerType']) { if (!this.userInfo['partnerType']) {
dataHandling.pocessTracking( dataHandling.pocessTracking(
'点击', '点击',
`用户在产品中心未加盟时点击产品分享按钮`, `用户在产品中心未加盟时点击产品分享按钮`,
'点击', '点击',
2, 2,
'产品中心', '产品中心',
'pages/courselist/courselist') 'pages/courselist/courselist')
this.$refs.partnerTipPopup.open() this.$refs.partnerTipPopup.open()
return return
} }
this.continueShare() this.continueShare()
} }
}, },
goDetail(item){ goDetail(item) {
dataHandling.pocessTracking( dataHandling.pocessTracking(
'点击', '点击',
`用户在产品中心点击${item.fileTitle},查看产品详情`, `用户在产品中心点击${item.fileTitle},查看产品详情`,
'点击', '点击',
2, 2,
'产品中心', '产品中心',
'pages/courselist/courselist' 'pages/courselist/courselist'
) )
uni.setStorageSync('posterItem',item) uni.setStorageSync('posterItem', item)
uni.navigateTo({ uni.navigateTo({
url: `/pages/courseDetail/courseDetail?fileId=${item.fileId}` url: `/pages/courseDetail/courseDetail?fileId=${item.fileId}`
}); });
}, },
courseList(){ courseList() {
console.log('执行了'); console.log('执行了');
const param = { const param = {
queryName:this.queryName, queryName: this.queryName,
courseClassify:this.courseClassify courseClassify: this.courseClassify
} }
api.courseList(param).then(res=>{ api.courseList(param).then(res => {
if(res['success']){ if (res['success']) {
this.localCourseInfos = res['data']['data']; // 修改本地副本 this.localCourseInfos = res['data']['data']; // 修改本地副本
} }
}) })
}, },
queryAreaCenterInfo() { queryAreaCenterInfo() {
api.queryAreaCenterInfo({ api.queryAreaCenterInfo({
userId: uni.getStorageSync('cffp_userId'), userId: uni.getStorageSync('cffp_userId'),
...@@ -553,213 +556,221 @@ ...@@ -553,213 +556,221 @@
}).then((res) => { }).then((res) => {
if (res['success']) { if (res['success']) {
uni.setStorageSync('fileUploadItemCFFPList', res['data']['fileUploadItemCFFPList']) uni.setStorageSync('fileUploadItemCFFPList', res['data']['fileUploadItemCFFPList'])
this.fileUploadItemCFFPList = uni.getStorageSync('fileUploadItemCFFPList'); this.fileUploadItemCFFPList = uni.getStorageSync('fileUploadItemCFFPList');
} }
}) })
}, },
// 背景图片加载成功 // 背景图片加载成功
handleBgImageLoad() { handleBgImageLoad() {
this.generateQrcodeAndCapture(); this.generateQrcodeAndCapture();
}, },
// 背景图片加载失败 // 背景图片加载失败
handleBgImageError() { handleBgImageError() {
console.log('产品图片加载完成'); console.log('产品图片加载完成');
// 即使失败也继续流程,可能会有默认背景 // 即使失败也继续流程,可能会有默认背景
// this.generateQrcodeAndCapture(); // this.generateQrcodeAndCapture();
}, },
// 顺序执行:生成二维码 -> 截图 // 顺序执行:生成二维码 -> 截图
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, 2000)); await new Promise(resolve => setTimeout(resolve, 2000));
// 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();
} }
}, },
// 重试机制
// retryGenerate() {
// if (this.retryCount < this.maxRetryCount) {
// this.retryCount++;
// const delay = 1000 * this.retryCount;
// console.log(`第${this.retryCount}次重试,${delay}ms后重试...`);
// setTimeout(() => {
// this.generateQrcodeAndCapture();
// }, delay);
// } else {
// // uni.showToast({
// // title: '生成分享图失败,请稍后再试',
// // icon: 'none'
// // });
// }
// },
// 生成二维码 // 生成二维码
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.$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.sharePosterItem = { this.sharePosterItem = {
fileFirstImage:"" fileFirstImage: ""
} }
this.generatedImage = '' this.generatedImage = ''
},
jumpMplogin() {
let currentUrl =
`${shareURL}/pages/lanch/index?landingPage=${this.pageSource}&noShare=1`;
console.log('获取页面路径');
// if(this.miniShareInfo.miniShare){
// currentUrl = `${shareURL}/pages/lanch/index?fileId=${this.miniShareInfo.fileId}&coursesharing=1&serialsNo=${this.miniShareInfo.serialsNo}&shareCode=${this.miniShareInfo.shareCode}&shareUserId=${this.miniShareInfo.userId}&jumpUrl=${this.miniShareInfo.jumpUrl}&landingPage=courseDetail&miniShare=1`
// }else {
// currentUrl = `${shareURL}/pages/lanch/index?fileId=${this.fileId}&landingPage=courseDetail&noShare=1`
// }
let data = {
type: 'login',
h5SystemType: 'cffp',
link: encodeURIComponent(currentUrl),
}
wx.miniProgram.postMessage({
data: {
type: 'login',
shareData: JSON.stringify(data)
}
})
wx.miniProgram.navigateBack({
delta: 1
})
} }
}, },
mounted() { mounted() {
this.fileUploadItemCFFPList = uni.getStorageSync('fileUploadItemCFFPList'); this.fileUploadItemCFFPList = uni.getStorageSync('fileUploadItemCFFPList');
if(!this.fileUploadItemCFFPList){ if (!this.fileUploadItemCFFPList) {
this.queryAreaCenterInfo(); this.queryAreaCenterInfo();
} }
// this.courseList(); // this.courseList();
}, },
onTabItemTap() { onTabItemTap() {
// 通过tabbar切换时清空storage // 通过tabbar切换时清空storage
uni.removeStorageSync('queryName'); uni.removeStorageSync('queryName');
}, },
onHide() { onHide() {
this.queryName = '' this.queryName = ''
uni.removeStorageSync('queryName') uni.removeStorageSync('queryName')
this.$nextTick(()=>{ this.$nextTick(() => {
this.$refs.sharePosterPop.closeDropdown() this.$refs.sharePosterPop.closeDropdown()
}) })
}, },
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.container{ .container {
position: relative; position: relative;
background-color: rgba(235, 239, 247, 1); background-color: rgba(235, 239, 247, 1);
display: flex; display: flex;
...@@ -767,128 +778,148 @@ ...@@ -767,128 +778,148 @@
width: 100%; width: 100%;
height: auto; height: auto;
box-sizing: border-box; box-sizing: border-box;
.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;
} }
} }
} }
} }
} }
.preview-container{
.preview-container {
width: 100%; width: 100%;
box-sizing: border-box; box-sizing: border-box;
padding: 20rpx; padding: 20rpx;
margin-bottom: 100rpx; margin-bottom: 100rpx;
.preview-image{
.preview-image {
width: 100%; width: 100%;
} }
} }
.tabBox{
display: flex; .tabBox {
align-items: center; display: flex;
height: 88rpx; align-items: center;
margin-bottom: 20rpx; height: 88rpx;
background: #fafafa; margin-bottom: 20rpx;
border-bottom: 1px solid #262088; background: #fafafa;
view{ border-bottom: 1px solid #262088;
color: #000;
width: 160rpx; view {
height: 100%; color: #000;
text-align: center; width: 160rpx;
margin-right:30rpx ; height: 100%;
line-height: 88rpx; text-align: center;
&.actived{ margin-right: 30rpx;
background-color: #262088; line-height: 88rpx;
color: #fff;
} &.actived {
background-color: #262088;
color: #fff;
} }
}
} }
.homeHeader{
.homeHeader {
box-sizing: border-box; box-sizing: border-box;
width: 100%; width: 100%;
background: linear-gradient(225deg, rgba(65, 69, 188, 1) 0%, rgba(29, 30, 125, 1) 100%); background: linear-gradient(225deg, rgba(65, 69, 188, 1) 0%, rgba(29, 30, 125, 1) 100%);
padding: 30rpx 0 100rpx 0; padding: 30rpx 0 100rpx 0;
color: rgba(255,255,255,.3); color: rgba(255, 255, 255, .3);
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
font-size: 80rpx; font-size: 80rpx;
height: 300rpx; height: 300rpx;
view{
view {
width: 33%; width: 33%;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
position: relative; position: relative;
.titleTxt{
.titleTxt {
box-sizing: border-box; box-sizing: border-box;
position: absolute; position: absolute;
width: 100%; width: 100%;
...@@ -897,14 +928,16 @@ ...@@ -897,14 +928,16 @@
bottom: -20%; bottom: -20%;
font-size: 28rpx; font-size: 28rpx;
color: #fff; color: #fff;
.icon-shuangyoujiantou{
.icon-shuangyoujiantou {
font-size: 26rpx; font-size: 26rpx;
position: absolute; position: absolute;
right:0; right: 0;
} }
} }
.lastTxt{
.lastTxt {
display: flex; display: flex;
align-items: center; align-items: center;
flex-direction: column; flex-direction: column;
...@@ -912,70 +945,88 @@ ...@@ -912,70 +945,88 @@
line-height: 1.3; line-height: 1.3;
} }
} }
} }
.productBox{
.productBox {
flex: 1; flex: 1;
width: 100%; width: 100%;
padding: 0rpx 15rpx; padding: 0rpx 15rpx;
box-sizing: border-box; box-sizing: border-box;
.productList{
.productList {
width: 100%; width: 100%;
box-sizing: border-box; box-sizing: border-box;
background-color: #fff; background-color: #fff;
padding: 20rpx; padding: 20rpx;
border-radius: 10rpx; border-radius: 10rpx;
margin-bottom: 150rpx; margin-bottom: 150rpx;
.productItem{
.productItem {
padding-bottom: 15rpx; padding-bottom: 15rpx;
border-bottom: 1rpx solid rgba(238, 238, 240, 1); border-bottom: 1rpx solid rgba(238, 238, 240, 1);
margin-bottom: 20rpx; margin-bottom: 20rpx;
.top{
.top {
display: flex; display: flex;
justify-content: flex-start; justify-content: flex-start;
.left { .left {
width: 220rpx; width: 220rpx;
flex-shrink: 0; /* 防止左侧被压缩 */ flex-shrink: 0;
margin-right: 20rpx; /* 防止左侧被压缩 */
.productImg { margin-right: 20rpx;
border-radius: 20rpx;
width: 100%; .productImg {
height: 180rpx; /* 固定图片高度 */ border-radius: 20rpx;
display: block; width: 100%;
} height: 180rpx;
} /* 固定图片高度 */
.right{ display: block;
flex: 1; /* 右侧占据剩余空间 */ }
min-width: 0; /* 允许文本截断 */ }
.right {
flex: 1;
/* 右侧占据剩余空间 */
min-width: 0;
/* 允许文本截断 */
display: flex; display: flex;
flex-direction: column; flex-direction: column;
.one{
.one {
font-size: 30rpx; font-size: 30rpx;
font-weight: 500; font-weight: 500;
display: -webkit-box; display: -webkit-box;
-webkit-line-clamp: 1; -webkit-line-clamp: 1;
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; /* 确保不会换行 */ white-space: nowrap;
/* 确保不会换行 */
} }
.two{
.two {
font-size: 24rpx; font-size: 24rpx;
margin: 10rpx 0; margin: 10rpx 0;
} }
.three{
.three {
font-size: 28rpx; font-size: 28rpx;
color: rgba(32, 39, 155, 1); color: rgba(32, 39, 155, 1);
margin-top: auto; /* 关键代码:自动顶部边距,推到底部 */ margin-top: auto;
/* 关键代码:自动顶部边距,推到底部 */
} }
} }
} }
.bottom{
.bottom {
box-sizing: border-box; box-sizing: border-box;
margin: 10rpx 0; margin: 10rpx 0;
width: 100%; width: 100%;
padding-left: 240rpx; padding-left: 240rpx;
.bottomCon{
.bottomCon {
box-sizing: border-box; box-sizing: border-box;
width: 100%; width: 100%;
background: rgba(54, 57, 169, 0.05); background: rgba(54, 57, 169, 0.05);
...@@ -983,69 +1034,81 @@ ...@@ -983,69 +1034,81 @@
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
.left{
padding: 15rpx 0rpx 15rpx 20rpx; .left {
padding: 15rpx 0rpx 15rpx 20rpx;
font-size: 26rpx; font-size: 26rpx;
color: rgba(34, 35, 133, 1); color: rgba(34, 35, 133, 1);
} }
.right{
.right {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
padding: 15rpx 10rpx 15rpx 15rpx; padding: 15rpx 10rpx 15rpx 15rpx;
background: rgba(36, 37, 137, 1); background: rgba(36, 37, 137, 1);
font-size: 27rpx; font-size: 27rpx;
color: #fff; color: #fff;
border-radius: 0 10rpx 10rpx 0rpx; /* 左上 右上 右下 左下 */ border-radius: 0 10rpx 10rpx 0rpx;
/* 左上 右上 右下 左下 */
} }
} }
} }
} }
.productItem:last-child{
.productItem:last-child {
border: none; border: none;
} }
} }
/* 电脑端 */ /* 电脑端 */
@media (min-width: 768px) { @media (min-width: 768px) {
.productList{ .productList {
// padding-top: 60rpx; // padding-top: 60rpx;
} }
} }
} }
.descriptionBox { .descriptionBox {
width: 510rpx; width: 510rpx;
padding: 40rpx; padding: 40rpx;
.popupClose{
.popupClose {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: flex-end; justify-content: flex-end;
.icon-guanbi{
.icon-guanbi {
font-size: 28rpx; font-size: 28rpx;
} }
} }
.imageBox{
.imageBox {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
flex-direction: column; flex-direction: column;
font-size: 32rpx; font-size: 32rpx;
font-weight: 600; font-weight: 600;
.subTit{
.subTit {
font-size: 28rpx; font-size: 28rpx;
color: #919094; color: #919094;
margin: 15rpx 0; margin: 15rpx 0;
font-weight: 400; font-weight: 400;
} }
} }
.codeBox{
.codeBox {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
height: 250rpx; height: 250rpx;
} }
.description{
.description {
color: rgba(56, 56, 56, 1); color: rgba(56, 56, 56, 1);
font-size: 28rpx; font-size: 28rpx;
display: flex; display: flex;
...@@ -1053,6 +1116,7 @@ ...@@ -1053,6 +1116,7 @@
justify-content: center; justify-content: center;
} }
} }
.markBox { .markBox {
position: fixed; position: fixed;
left: 0; left: 0;
...@@ -1066,8 +1130,10 @@ ...@@ -1066,8 +1130,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;
...@@ -1075,13 +1141,14 @@ ...@@ -1075,13 +1141,14 @@
top: 0; top: 0;
} }
} }
.tips { .tips {
margin-top: 30%; margin-top: 30%;
padding: 0 30px; padding: 0 30px;
} }
} }
.joinContent{
.joinContent {
width: 600rpx; width: 600rpx;
border-radius: 30rpx; border-radius: 30rpx;
background-color: #ffff; background-color: #ffff;
...@@ -1090,7 +1157,8 @@ ...@@ -1090,7 +1157,8 @@
display: flex; display: flex;
align-items: center; align-items: center;
flex-direction: column; flex-direction: column;
.joinHeader{
.joinHeader {
width: 60rpx; width: 60rpx;
height: 60rpx; height: 60rpx;
border-radius: 50%; border-radius: 50%;
...@@ -1100,15 +1168,18 @@ ...@@ -1100,15 +1168,18 @@
justify-content: center; justify-content: center;
margin-bottom: 20rpx; margin-bottom: 20rpx;
} }
.joinCon{
.joinCon {
margin-bottom: 20rpx; margin-bottom: 20rpx;
.one{
.one {
font-size: 28rpx; font-size: 28rpx;
color: rgba(38, 41, 44, 1); color: rgba(38, 41, 44, 1);
text-align: center; text-align: center;
} }
.two{
.two {
color: rgba(145, 144, 148, 1); color: rgba(145, 144, 148, 1);
font-size: 26rpx; font-size: 26rpx;
text-align: center; text-align: center;
...@@ -1116,7 +1187,8 @@ ...@@ -1116,7 +1187,8 @@
margin-bottom: 20rpx; margin-bottom: 20rpx;
} }
} }
.joinFotter{
.joinFotter {
width: 100%; width: 100%;
color: #fff; color: #fff;
display: flex; display: flex;
...@@ -1125,7 +1197,8 @@ ...@@ -1125,7 +1197,8 @@
box-sizing: border-box; box-sizing: border-box;
padding: 10rpx 0; padding: 10rpx 0;
font-size: 24rpx; font-size: 24rpx;
view{
view {
background: rgba(54, 57, 169, 1); background: rgba(54, 57, 169, 1);
border-radius: 10rpx; border-radius: 10rpx;
padding: 10rpx; padding: 10rpx;
...@@ -1133,96 +1206,108 @@ ...@@ -1133,96 +1206,108 @@
} }
} }
} }
.container { .container {
padding-top: 60rpx; padding-top: 60rpx;
.homeHeader { .homeHeader {
padding-bottom: 100rpx; padding-bottom: 100rpx;
position: relative; position: relative;
z-index: 1; z-index: 1;
} }
.productBox { .productBox {
position: relative; position: relative;
z-index: 2; z-index: 2;
.productList { .productList {
padding-top: 30rpx; // 改用padding-top padding-top: 30rpx; // 改用padding-top
margin-top: 0; margin-top: 0;
.productItem { .productItem {
&:first-child { &:first-child {
margin-top: 0; margin-top: 0;
} }
} }
} }
} }
} }
/* 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) .homeHeader {
and (orientation: landscape) { padding-bottom: 120rpx;
.container {
.homeHeader {
padding-bottom: 120rpx;
}
.productBox {
.productList {
padding-top: 50rpx;
}
}
.generateImageBox{
max-width: 950rpx !important;
.descriptionTxt{
font-size: 33rpx !important;
} }
.txtBox{
.generateImageBottom{ .productBox {
.left{ .productList {
width: 60% !important; padding-top: 50rpx;
.top{ }
}
.generateImageBox {
max-width: 950rpx !important;
.descriptionTxt {
font-size: 33rpx !important;
}
.txtBox {
.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;
} }
} }
} }
} }
} }
}
} }
/* 所有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 {
width: 100%; .left {
.companyName{ width: 60% !important;
min-width: 200rpx !important;
font-size: 30rpx !important; .top {
} width: 100%;
}
.bottom{ .companyName {
font-size: 28rpx !important; min-width: 200rpx !important;
} font-size: 30rpx !important;
} }
} }
}
} .bottom {
font-size: 28rpx !important;
}
}
}
}
}
} }
</style> </style>
\ No newline at end of file
...@@ -66,6 +66,7 @@ ...@@ -66,6 +66,7 @@
:cffpCourseInfos="cffpCourseInfos" :cffpCourseInfos="cffpCourseInfos"
@changeCourseClassify="changeCourseClassify" @changeCourseClassify="changeCourseClassify"
ref="courselist" ref="courselist"
pageSource="index"
></courselist> ></courselist>
</view> </view>
...@@ -204,6 +205,7 @@ ...@@ -204,6 +205,7 @@
import PartnerTipPopup from "@/components/commonPopup/PartnerTipPopup.vue"; import PartnerTipPopup from "@/components/commonPopup/PartnerTipPopup.vue";
import {hshare} from '@/util/fiveshare'; import {hshare} from '@/util/fiveshare';
import restrictedTip from '@/components/commonPopup/restrictedTip.vue'; import restrictedTip from '@/components/commonPopup/restrictedTip.vue';
import wx from 'weixin-js-sdk'
export default { export default {
data() { data() {
return { return {
...@@ -270,13 +272,13 @@ ...@@ -270,13 +272,13 @@
JoinPopup, JoinPopup,
PartnerTipPopup, PartnerTipPopup,
restrictedTip, restrictedTip,
}, },
onShow() { onShow() {
if(uni.getStorageSync('dataToken')){ if(uni.getStorageSync('dataToken')){
this.dataToken = uni.getStorageSync('dataToken') this.dataToken = uni.getStorageSync('dataToken')
} }
console.log('webview',typeof wx !== 'undefined' && wx.miniProgram);
this.loginType = uni.getStorageSync('loginType') this.loginType = uni.getStorageSync('loginType')
this.init(); this.init();
...@@ -291,7 +293,24 @@ ...@@ -291,7 +293,24 @@
if(uni.getStorageSync('cffp_userId')){ if(uni.getStorageSync('cffp_userId')){
this.userId = uni.getStorageSync('cffp_userId') this.userId = uni.getStorageSync('cffp_userId')
} }
if (dataHandling.h5RuntimeEnv() == 'wechat-miniprogram') {
let shareInfo = {
title: '成为银盾合伙人,分享商品赚不停',
desc: `资源+伙伴,共赢未来!`,
link: `${shareURL}/pages/index/index?miniShare=1`, //分享链接
imgUrl: `${shareURL}/myPackageA/static/images/logo3.webp`, //图片
commonId:uni.getStorageSync('cffp_userId') || Date.now(),
sharePage:'index'//分享出去得页面
}
wx.miniProgram.postMessage({
data: {
type: 'share',
shareData: JSON.stringify(shareInfo)
}
})
return
}
}, },
onHide() { onHide() {
this.$nextTick(()=>{ this.$nextTick(()=>{
...@@ -494,7 +513,7 @@ ...@@ -494,7 +513,7 @@
] ]
uni.removeTabBarBadge({ index: 3 }); uni.removeTabBarBadge({ index: 3 });
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']);
...@@ -752,6 +771,7 @@ ...@@ -752,6 +771,7 @@
}) })
}, },
reLogin(){ reLogin(){
console.log('index调用');
uni.showLoading({ uni.showLoading({
title: '加载中...' title: '加载中...'
}); });
...@@ -759,7 +779,9 @@ ...@@ -759,7 +779,9 @@
const isIOS = navigator.platform.match(/(iPhone|iPod|iPad)/i); const isIOS = navigator.platform.match(/(iPhone|iPod|iPad)/i);
const params = { const params = {
loginType:'5', loginType:'5',
authToken: this.dataToken authToken: this.dataToken,
loginType: '5',
visitorUuid:uni.getStorageSync('visitorUuid')?uni.getStorageSync('visitorUuid'):dataHandling.uuid()
} }
api.loginVerification(params).then((res)=>{ api.loginVerification(params).then((res)=>{
if(res['success']){ if(res['success']){
......
...@@ -94,7 +94,7 @@ ...@@ -94,7 +94,7 @@
</view> </view>
</uni-popup> </uni-popup>
</view> </view>
<view class="markBox" @click="shareTipsFlag=false" v-if="shareTipsFlag"> <!-- <view class="markBox" @click="shareTipsFlag=false" v-if="shareTipsFlag">
<view class="guideImgBox"> <view class="guideImgBox">
<image src="../../static/Group132.png" mode="widthFix"></image> <image src="../../static/Group132.png" mode="widthFix"></image>
<view class="tips"> <view class="tips">
...@@ -102,7 +102,9 @@ ...@@ -102,7 +102,9 @@
<view>分享给朋友</view> <view>分享给朋友</view>
</view> </view>
</view> </view>
</view> </view> -->
<!-- 分享得向导图 -->
<ShareGuide :show.sync="shareTipsFlag" @close="shareTipsFlag=false"></ShareGuide>
<!-- 海报弹窗 --> <!-- 海报弹窗 -->
<sharePosterPop ref="sharePosterPop" :generatedImage="generatedImage" @closePoster="closePoster" <sharePosterPop ref="sharePosterPop" :generatedImage="generatedImage" @closePoster="closePoster"
btnBottom="-15%"></sharePosterPop> btnBottom="-15%"></sharePosterPop>
...@@ -119,10 +121,13 @@ ...@@ -119,10 +121,13 @@
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 wx from 'weixin-js-sdk'
export default { export default {
components: { components: {
sharePosterPop, sharePosterPop,
loadingIcon loadingIcon,
ShareGuide
}, },
data() { data() {
return { return {
...@@ -172,7 +177,7 @@ ...@@ -172,7 +177,7 @@
if (this.companyType == '1') { if (this.companyType == '1') {
this.ydLogoShare = `${shareURL}/static/cffp_logo.jpg`; this.ydLogoShare = `${shareURL}/static/cffp_logo.jpg`;
} else { } else {
this.ydLogoShare = `${shareURL}/static/suplogo.png`; this.ydLogoShare = `${shareURL}/myPackageA/static/images/logo3.webp`;
} }
if (companyInfo.companyType == '1') { if (companyInfo.companyType == '1') {
this.companyLogo = '../../static/myteam/Group1633.png'; this.companyLogo = '../../static/myteam/Group1633.png';
...@@ -272,6 +277,7 @@ ...@@ -272,6 +277,7 @@
// this.dataForm.areaName = this.isCross == false ? this.queryList[this.index].areaName : this.dataForm.areaName // this.dataForm.areaName = this.isCross == false ? this.queryList[this.index].areaName : this.dataForm.areaName
this.dataForm.areaId = 1; this.dataForm.areaId = 1;
this.dataForm.areaName = '默认'; this.dataForm.areaName = '默认';
if (this.dataForm.name == "" || this.dataForm.mobileNumber == "" || this.dataForm.areaName == '') { if (this.dataForm.name == "" || this.dataForm.mobileNumber == "" || this.dataForm.areaName == '') {
uni.showToast({ uni.showToast({
title: '请将信息补充完整', title: '请将信息补充完整',
...@@ -311,15 +317,15 @@ ...@@ -311,15 +317,15 @@
// } // }
//#ifdef H5 //#ifdef H5
// 小程序跳cffp得分享 // 小程序跳cffp得分享
if (uni.getStorageSync('mpCffp')) { // if (uni.getStorageSync('mpCffp')) {
this.qrCodeUrl = shareURL + // this.qrCodeUrl = shareURL +
"/myPackageA/applyFranchise/applyFranchise?shareId=" + // "/myPackageA/applyFranchise/applyFranchise?shareId=" +
this.shareId + '&invitationCode=' + this.invitationCode + '&inviteUserId=' + // this.shareId + '&invitationCode=' + this.invitationCode + '&inviteUserId=' +
this.userId, //分享链接 // this.userId, //分享链接
this.posterImg = '@/static/images/sharePoster.png' // this.posterImg = '@/static/images/sharePoster.png'
this.isLoading = true // this.isLoading = true
return // return
} // }
this.shareTipsFlag = true; this.shareTipsFlag = true;
this.getshareData() this.getshareData()
// #endif // #endif
...@@ -340,6 +346,28 @@ ...@@ -340,6 +346,28 @@
if (!this.realName) { if (!this.realName) {
this.realName = "" this.realName = ""
} }
if (dataHandling.h5RuntimeEnv() == 'wechat-miniprogram') {
let shareInfo = {
title: '银盾家办家庭财务策划师联盟邀您加入',
desc: `${this.realName}邀您加入【家庭财策师联盟】,资源+伙伴,共赢未来!`,
link: `${shareURL}/pages/lanch/index?shareId=${this.shareId}&invitationCode=${this.invitationCode}&inviteUserId=${this.userId}&landingPage=applyFranchise&miniShare=1`,
// link: shareURL +
// "/myPackageA/applyFranchise/applyFranchise?shareId=" +
// this.shareId + '&invitationCode=' + this.invitationCode + '&inviteUserId=' + this
// .userId, //分享链接
imgUrl: this.ydLogoShare, //图片
commonId:this.invitationCode,
sharePage:'applyFranchise'//分享出去得页面
}
wx.miniProgram.postMessage({
data: {
type: 'share',
shareData: JSON.stringify(shareInfo)
}
})
return
}
let data = { let data = {
title: '银盾家办家庭财务策划师联盟邀您加入', title: '银盾家办家庭财务策划师联盟邀您加入',
//desc: `我是家庭财务策划师${this.realName}正在使用银盾家办,点击即刻加入!`, //desc: `我是家庭财务策划师${this.realName}正在使用银盾家办,点击即刻加入!`,
...@@ -391,15 +419,15 @@ ...@@ -391,15 +419,15 @@
this.$refs.share.open() this.$refs.share.open()
// #endif // #endif
//#ifdef H5 //#ifdef H5
if (uni.getStorageSync('mpCffp')) { // if (uni.getStorageSync('mpCffp')) {
this.qrCodeUrl = shareURL + // this.qrCodeUrl = shareURL +
"/myPackageA/applyFranchise/applyFranchise?shareId=" + // "/myPackageA/applyFranchise/applyFranchise?shareId=" +
this.shareId + '&invitationCode=' + this.invitationCode + '&inviteUserId=' + // this.shareId + '&invitationCode=' + this.invitationCode + '&inviteUserId=' +
this.userId, //分享链接 // this.userId, //分享链接
this.posterImg = '@/static/images/sharePoster.png' // this.posterImg = '@/static/images/sharePoster.png'
this.isLoading = true // this.isLoading = true
return // return
} // }
this.shareTipsFlag = true; this.shareTipsFlag = true;
this.getshareData() this.getshareData()
// #endif // #endif
......
...@@ -2,26 +2,62 @@ ...@@ -2,26 +2,62 @@
<view class="loadTxt">Loading...</view> <view class="loadTxt">Loading...</view>
</template> </template>
<script setup > <script setup>
import { ref } from "vue"; import { ref } from "vue";
import api from '@/api/api'; import api from '@/api/api';
import { onLaunch, onLoad } from '@dcloudio/uni-app' import { onLaunch, onLoad } from '@dcloudio/uni-app'
import * as environment from '@/environments/environment' import * as environment from '@/environments/environment'
import dataHandling from "@/util/dataHandling";
import wx from 'weixin-js-sdk'
let jumpInfo = ref({}) let jumpInfo = ref({})
let dataToken = ref() let dataToken = ref()
onLoad((options) => { onLoad((options) => {
jumpInfo.value = JSON.parse(JSON.stringify(options))
// 参数带token了重新登录 // 参数带token了重新登录
if (options.dataToken) { if (options.dataToken) {
jumpInfo.value = JSON.parse(JSON.stringify(options)) console.log('jumpInfo.value', jumpInfo.value);
// uni.clearStorageSync(); // uni.clearStorageSync();
dataToken.value = decodeURIComponent(options.dataToken) dataToken.value = decodeURIComponent(options.dataToken)
reLogin(options.landingPage) reLogin(options.landingPage)
return
} else if (options.miniShare) {
// 通过小程序分享进来的但没登录
if (options.landingPage == 'courseDetail') {
uni.reLaunch({ url: `/pages/courseDetail/courseDetail?fileId=${jumpInfo.value.fileId}&coursesharing=1&serialsNo=${jumpInfo.value.serialsNo}&shareCode=${jumpInfo.value.shareCode}&shareUserId=${jumpInfo.value.shareUserId}&jumpUrl=${jumpInfo.value.jumpUrl}&miniShare=1` })
} else if (options.landingPage == 'businessCard') {
uni.reLaunch({ url: `/myPackageA/businessCard/businessCard?userId=${jumpInfo.value.userId}&isShareCard=1&cardId=${jumpInfo.value.cardId}&miniShare=1` })
} else if (options.landingPage == 'applyFranchise') {
uni.reLaunch({ url: `/myPackageA/applyFranchise/applyFranchise?shareId=${jumpInfo.value.shareId}&invitationCode=${jumpInfo.value.invitationCode}&inviteUserId=${jumpInfo.value.inviteUserId}&miniShare=1` })
}else if(options.landingPage == 'index'){
uni.reLaunch({
url:'/pages/index/index?miniShare=1'
})
}else if(options.landingPage == 'courselist'){
uni.reLaunch({
url:'/pages/courselist/courselist'
})
}
return
}else if(options.noLogin){
// 去到小程序登录页了,没登录
if (options.landingPage == 'courseDetail') {
uni.reLaunch({ url: `/pages/courseDetail/courseDetail?fileId=${jumpInfo.value.fileId}` })
}else if(options.landingPage == 'index'){
uni.reLaunch({
url:'/pages/index/index'
})
}else if(options.landingPage == 'courselist'){
uni.reLaunch({
url:'/pages/courselist/courselist'
})
}
} }
}) })
const reLogin = (landingPage) => { const reLogin = (landingPage) => {
console.log('lanuch调用了');
uni.showLoading({ uni.showLoading({
title: '加载中...' title: '加载中...'
}); });
...@@ -29,7 +65,8 @@ ...@@ -29,7 +65,8 @@
const isIOS = navigator.platform.match(/(iPhone|iPod|iPad)/i); const isIOS = navigator.platform.match(/(iPhone|iPod|iPad)/i);
const params = { const params = {
loginType: '5', loginType: '5',
authToken: dataToken.value authToken: dataToken.value,
visitorUuid:uni.getStorageSync('visitorUuid')?uni.getStorageSync('visitorUuid'):dataHandling.uuid()
} }
api.loginVerification(params).then((res) => { api.loginVerification(params).then((res) => {
if (res['success']) { if (res['success']) {
...@@ -37,13 +74,33 @@ ...@@ -37,13 +74,33 @@
uni.setStorageSync('loginType', 'codelogin'); uni.setStorageSync('loginType', 'codelogin');
uni.setStorageSync('cffp_userId', res.data.userId); uni.setStorageSync('cffp_userId', res.data.userId);
uni.setStorageSync('uni-token', res.data['token']); uni.setStorageSync('uni-token', res.data['token']);
uni.setStorageSync('visitorUuid', res.data['visitorUuid']);
if (landingPage == 'sfpHousePurchase') { if (landingPage == 'sfpHousePurchase') {
uni.reLaunch({ url: `/sfp/housePurchase/housePurchase` }) uni.reLaunch({ url: `/sfp/housePurchase/housePurchase` })
}else if(landingPage == 'sfpIndex'){ } else if (landingPage == 'sfpIndex') {
uni.reLaunch({ url: `/sfp/index/index` }) uni.reLaunch({ url: `/sfp/index/index` })
}else if(landingPage == 'orderStatus'){ } else if (landingPage == 'orderStatus') {
uni.reLaunch({ url: `/pages/orderStatus/orderStatus?orderStatus=2` }) uni.reLaunch({ url: `/pages/orderStatus/orderStatus?orderStatus=2` })
} else if (landingPage == 'courseDetail') {
if(jumpInfo.value.noShare){
uni.reLaunch({ url: `/pages/courseDetail/courseDetail?fileId=${jumpInfo.value.fileId}&noShare=1`})
} else {
uni.reLaunch({ url: `/pages/courseDetail/courseDetail?fileId=${jumpInfo.value.fileId}&coursesharing=1&serialsNo=${jumpInfo.value.serialsNo}&shareCode=${jumpInfo.value.shareCode}&shareUserId=${jumpInfo.value.shareUserId}&jumpUrl=${jumpInfo.value.jumpUrl}&miniShare=1` })
}
return
} else if (landingPage == 'businessCard') {
uni.reLaunch({ url: `/myPackageA/businessCard/businessCard?userId=${jumpInfo.value.userId}&isShareCard=1&cardId=${jumpInfo.value.cardId}&miniShare=1` })
} else if (landingPage == 'applyFranchise') {
uni.reLaunch({ url: `/myPackageA/applyFranchise/applyFranchise?shareId=${jumpInfo.value.shareId}&invitationCode=${jumpInfo.value.invitationCode}&inviteUserId=${jumpInfo.value.inviteUserId}&miniShare=1` })
}else if(landingPage == 'index'){
uni.reLaunch({
url:'/pages/index/index?miniShare=1'
})
}else if(landingPage == 'courselist'){
uni.reLaunch({
url:'/pages/courselist/courselist'
})
} }
} else { } else {
uni.showToast({ uni.showToast({
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
</template> </template>
<!-- 价格明细 --> <!-- 价格明细 -->
<view class="priceInfoContent"> <view class="priceInfoContent">
<h4>价格明细</h4> <h4>价格明细</h4>
<view ><text class="txtFont">现价</text><text>¥{{Number(courseInfoItem.coursePrice).toFixed(2)}}</text></view> <view ><text class="txtFont">现价</text><text>¥{{Number(courseInfoItem.coursePrice).toFixed(2)}}</text></view>
<view> <view>
...@@ -209,6 +210,7 @@ ...@@ -209,6 +210,7 @@
calculatedPrice: 0, calculatedPrice: 0,
dataToken:'', dataToken:'',
oldToken:'',//原始用户token oldToken:'',//原始用户token
pollTimer:''
} }
}, },
computed: { computed: {
...@@ -229,7 +231,7 @@ ...@@ -229,7 +231,7 @@
} }
} }
}, },
methods: { methods: {
goBack() { goBack() {
...@@ -314,22 +316,15 @@ ...@@ -314,22 +316,15 @@
// 向小程序通信 // 向小程序通信
// if(dataHandling.h5RuntimeEnv()=='wechat-miniprogram'){ // if(dataHandling.h5RuntimeEnv()=='wechat-miniprogram'){
// wx.miniProgram.navigateBack({
// delta:1 // uni.setStorageSync('pendingPayOrder',JSON.stringify(param))
// })
// // 向小程序发送消息,只有触发后退,分享,复制的时候小程序才能接收消息
// wx.miniProgram.postMessage({
// data:{
// type:'pay',
// payInfo:param
// }
// })
// console.log('向小程序通信'); // console.log('向小程序通信');
// // 跳转到小程序消息接收中转页面,拉起小程序的支付 // // 跳转到小程序消息接收中转页面,拉起小程序的支付
// // wx.miniProgram.navigateTo({ // wx.miniProgram.navigateTo({
// // url: `/myPackageA/h5Pay/appYdhomeofficePay?param=${encodeURIComponent(JSON.stringify(param))}` // url: `/myPackageA/h5Pay/appYdhomeofficePay?param=${encodeURIComponent(JSON.stringify(param))}`
// // }) // })
// return // return
// } // }
...@@ -546,7 +541,8 @@ ...@@ -546,7 +541,8 @@
}); });
const params = { const params = {
loginType:'5', loginType:'5',
authToken: uni.getStorageSync('dataToken') authToken: uni.getStorageSync('dataToken'),
visitorUuid:uni.getStorageSync('visitorUuid')?uni.getStorageSync('visitorUuid'):dataHandling.uuid()
} }
api.loginVerification(params).then((res)=>{ api.loginVerification(params).then((res)=>{
if(res['success']){ if(res['success']){
...@@ -557,6 +553,7 @@ ...@@ -557,6 +553,7 @@
uni.setStorageSync('loginType','codelogin'); uni.setStorageSync('loginType','codelogin');
uni.setStorageSync('cffp_userId', res.data.userId); uni.setStorageSync('cffp_userId', res.data.userId);
uni.setStorageSync('uni-token', res.data['token']); uni.setStorageSync('uni-token', res.data['token']);
uni.setStorageSync('visitorUuid', res.data['visitorUuid']);
}else if(flag=='2'){ }else if(flag=='2'){
// 有userid,直接可以购买但付款人只是帮订单账号付钱,购买成功还是进入到付款人的账号 // 有userid,直接可以购买但付款人只是帮订单账号付钱,购买成功还是进入到付款人的账号
this.oldToken = uni.getStorageSync('uni-token') this.oldToken = uni.getStorageSync('uni-token')
...@@ -575,9 +572,12 @@ ...@@ -575,9 +572,12 @@
}) })
uni.hideLoading() uni.hideLoading()
} },
}, },
onLoad(option) { onLoad(option) {
if(uni.getStorageSync('dataToken')){ if(uni.getStorageSync('dataToken')){
this.dataToken = uni.getStorageSync('dataToken') this.dataToken = uni.getStorageSync('dataToken')
} }
...@@ -627,6 +627,11 @@ ...@@ -627,6 +627,11 @@
}, window.location.href); }, window.location.href);
// #endif // #endif
}, },
beforeUnmount() {
// window.removeEventListener('pageshow', this.handlePageShow);
},
} }
</script> </script>
......
...@@ -27,10 +27,10 @@ ...@@ -27,10 +27,10 @@
</text> </text>
<text <text
v-else-if="!customerBasicInfo.parentRealName&&customerBasicInfo.parentNickName">我的上级:{{customerBasicInfo.parentNickName}}</text> v-else-if="!customerBasicInfo.parentRealName&&customerBasicInfo.parentNickName">我的上级:{{customerBasicInfo.parentNickName}}</text>
</view> </view>
<view class="desBox">{{customerBasicInfo.mobile}}</view> <view class="desBox">{{customerBasicInfo.mobile}}</view>
</view> </view>
</view> </view>
...@@ -58,8 +58,7 @@ ...@@ -58,8 +58,7 @@
</view> </view>
</view> </view>
<!-- 有名片数据并且是启用状态可以看名片 --> <!-- 有名片数据并且是启用状态可以看名片 -->
<view class="infoBody" v-if="showbusinessCard" <view class="infoBody" v-if="showbusinessCard" style="margin-top: 10rpx;" @click="businessCard()">
style="margin-top: 10rpx;" @click="businessCard()">
<view class=""> <view class="">
我的名片 我的名片
</view> </view>
...@@ -181,11 +180,12 @@ ...@@ -181,11 +180,12 @@
import PartnerTipPopup from "@/components/commonPopup/PartnerTipPopup.vue"; import PartnerTipPopup from "@/components/commonPopup/PartnerTipPopup.vue";
import { initJssdkShare, setWechatShare } from '@/util/fiveshare'; import { initJssdkShare, setWechatShare } from '@/util/fiveshare';
import restrictedTip from '@/components/commonPopup/restrictedTip.vue'; import restrictedTip from '@/components/commonPopup/restrictedTip.vue';
import wx from 'weixin-js-sdk'
export default { export default {
data() { data() {
return { return {
showbusinessCard:false,//是否显示名片 showbusinessCard: false, //是否显示名片
mpCffp:'', mpCffp: '',
showMyName: '', showMyName: '',
msgTotal: 0, msgTotal: 0,
messageInfo: [], messageInfo: [],
...@@ -196,7 +196,7 @@ ...@@ -196,7 +196,7 @@
inviteEqrode: '', inviteEqrode: '',
currentPage: 'personalCenter', currentPage: 'personalCenter',
customerBasicInfo: {}, customerBasicInfo: {},
loginornot: true,//登录状态 loginornot: true, //登录状态
tabBarPadding: 100, tabBarPadding: 100,
settingItem: { settingItem: {
title: '系统设置', title: '系统设置',
...@@ -253,7 +253,7 @@ ...@@ -253,7 +253,7 @@
id: '01', id: '01',
categoryName: '团队', categoryName: '团队',
children: [{ children: [{
key:'applyFranchises', key: 'applyFranchises',
title: '申请加盟', title: '申请加盟',
icon: 'icon-hezuo', icon: 'icon-hezuo',
link: '/myPackageA/applyFranchise/applyFranchise?', link: '/myPackageA/applyFranchise/applyFranchise?',
...@@ -404,7 +404,7 @@ ...@@ -404,7 +404,7 @@
onShow() { onShow() {
this.showbusinessCard = false this.showbusinessCard = false
this.loginType = uni.getStorageSync('loginType') this.loginType = uni.getStorageSync('loginType')
if(uni.getStorageSync('mpCffp')){ if (uni.getStorageSync('mpCffp')) {
this.mpCffp = uni.getStorageSync('mpCffp') this.mpCffp = uni.getStorageSync('mpCffp')
} }
if (this.companyType == '1') { if (this.companyType == '1') {
...@@ -457,13 +457,13 @@ ...@@ -457,13 +457,13 @@
applyItem.isShow = !dealerId && levelCode != 'P3'; // 没有 dealerId 才显示 applyItem.isShow = !dealerId && levelCode != 'P3'; // 没有 dealerId 才显示
} }
} }
// #ifdef H5 // #ifdef H5
initJssdkShare(() => { initJssdkShare(() => {
setWechatShare(); setWechatShare();
}, window.location.href); }, window.location.href);
// #endif // #endif
console.log('mpcffp',this.mpCffp); console.log('mpcffp', this.mpCffp);
}, },
methods: { methods: {
...@@ -517,7 +517,8 @@ ...@@ -517,7 +517,8 @@
for (let key in this.partnerStatistic) { for (let key in this.partnerStatistic) {
if (key != 'peopleNum' && key != 'reachPeopleNum' && key != 'totalPeopleNum') { if (key != 'peopleNum' && key != 'reachPeopleNum' && key != 'totalPeopleNum') {
if (key) { if (key) {
this.partnerStatistic[key] = this.partnerStatistic[key] ? Number(this.partnerStatistic[key].toFixed(2)) : 0 this.partnerStatistic[key] = this.partnerStatistic[key] ? Number(this
.partnerStatistic[key].toFixed(2)) : 0
} }
} }
} }
...@@ -586,6 +587,10 @@ ...@@ -586,6 +587,10 @@
this.bootpage = false this.bootpage = false
}, },
isLogin() { isLogin() {
// if (dataHandling.h5RuntimeEnv() == 'wechat-miniprogram') {
// this.jumpMplogin()
// return
// }
uni.navigateTo({ uni.navigateTo({
url: '/myPackageA/login/login?from=personalCenter' url: '/myPackageA/login/login?from=personalCenter'
}) })
...@@ -598,7 +603,7 @@ ...@@ -598,7 +603,7 @@
}, },
// 菜单跳转页面 // 菜单跳转页面
goDetail(item) { goDetail(item) {
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'))
} }
...@@ -642,7 +647,6 @@ ...@@ -642,7 +647,6 @@
}); });
// #endif // #endif
// #ifdef H5 // #ifdef H5
console.log('H5====')
dataHandling.pocessTracking( dataHandling.pocessTracking(
'咨询客服', '咨询客服',
`用户咨询客服`, `用户咨询客服`,
...@@ -703,21 +707,23 @@ ...@@ -703,21 +707,23 @@
}); });
return return
} }
console.log('判断',(!uni.getStorageSync('loginType') || uni.getStorageSync('loginType') == 'visitor') && !item.islogin);
if ((!uni.getStorageSync('loginType') || uni.getStorageSync('loginType') == 'visitor') && !item.islogin) { if ((!uni.getStorageSync('loginType') || uni.getStorageSync('loginType') == 'visitor') && !item.islogin) {
// 小程序进入到系统,走小程序的登录
this.isLogin() this.isLogin()
return return
} }
// 登录状态下直接去我的卡券 // 登录状态下直接去我的卡券
if(item.key=='ticket'){ if (item.key == 'ticket') {
uni.navigateTo({ uni.navigateTo({
url: `${item.link}` url: `${item.link}`
}); });
return return
} }
if (item.isShow && item.isOpen) { if (item.isShow && item.isOpen) {
if (item.title === '我的邀请码') { if (item.title === '我的邀请码') {
this.$refs.popup1.open('bottom'); this.$refs.popup1.open('bottom');
...@@ -745,9 +751,9 @@ ...@@ -745,9 +751,9 @@
url: `${item.link}?levelCode=` + this.customerBasicInfo.levelCode url: `${item.link}?levelCode=` + this.customerBasicInfo.levelCode
}); });
} else { } else {
const urlObj = JSON.parse(JSON.stringify(item)) const urlObj = JSON.parse(JSON.stringify(item))
console.log('222222222',urlObj.link); console.log('222222222', urlObj.link);
if (urlObj.type) { if (urlObj.type) {
urlObj.link = urlObj.link =
`${urlObj.link}?type=${urlObj.type}&from=personalCenter&partnerType=${this.customerBasicInfo.partnerType}` `${urlObj.link}?type=${urlObj.type}&from=personalCenter&partnerType=${this.customerBasicInfo.partnerType}`
...@@ -840,11 +846,11 @@ ...@@ -840,11 +846,11 @@
api.queryInfo({ userId: uni.getStorageSync('cffp_userId') }).then(res => { api.queryInfo({ userId: uni.getStorageSync('cffp_userId') }).then(res => {
if (res['success']) { if (res['success']) {
this.customerBasicInfo = res['data']; this.customerBasicInfo = res['data'];
if(res['data']['businessCardId']){ if (res['data']['businessCardId']) {
// 检查名片状态 // 检查名片状态
this.getBusissedCardStatus(res['data']['businessCardId']) this.getBusissedCardStatus(res['data']['businessCardId'])
} }
// id=03的权限设置 // id=03的权限设置
// 执行处理 // 执行处理
const result = this.setSpecificMenuIsShow(this.mainMenuLists, this.customerBasicInfo const result = this.setSpecificMenuIsShow(this.mainMenuLists, this.customerBasicInfo
...@@ -903,7 +909,7 @@ ...@@ -903,7 +909,7 @@
// url: '/myPackageA/noBusinessCard/noBusinessCard' // url: '/myPackageA/noBusinessCard/noBusinessCard'
// }); // });
// } // }
if (cardStatus == '2') { if (cardStatus == '2') {
// 名片审核中 // 名片审核中
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
...@@ -936,7 +942,7 @@ ...@@ -936,7 +942,7 @@
getBusissedCardStatus(businessCardId) { getBusissedCardStatus(businessCardId) {
api.checkBusinessCradStatus(businessCardId).then(res => { api.checkBusinessCradStatus(businessCardId).then(res => {
if (res['success']) { if (res['success']) {
if(businessCardId&&res.data.data.status=='1'){ if (businessCardId && res.data.data.status == '1') {
this.showbusinessCard = true this.showbusinessCard = true
} }
} else { } else {
...@@ -948,6 +954,31 @@ ...@@ -948,6 +954,31 @@
} }
}) })
}, },
jumpMplogin(){
let currentUrl = window.location.href;
console.log('获取页面路径');
// if(this.miniShareInfo.miniShare){
// currentUrl = `${shareURL}/pages/lanch/index?fileId=${this.miniShareInfo.fileId}&coursesharing=1&serialsNo=${this.miniShareInfo.serialsNo}&shareCode=${this.miniShareInfo.shareCode}&shareUserId=${this.miniShareInfo.userId}&jumpUrl=${this.miniShareInfo.jumpUrl}&landingPage=courseDetail&miniShare=1`
// }else {
// currentUrl = `${shareURL}/pages/lanch/index?fileId=${this.fileId}&landingPage=courseDetail&noShare=1`
// }
let data = {
type:'login',
h5SystemType:'cffp',
link: encodeURIComponent(currentUrl),
}
wx.miniProgram.postMessage({
data:{
type:'login',
shareData:JSON.stringify(data)
}
})
wx.miniProgram.navigateBack({
delta:1
})
}
}, },
......
...@@ -441,6 +441,14 @@ export default{ ...@@ -441,6 +441,14 @@ export default{
// 如果不是合法 11 位手机号,原样返回或提示错误 // 如果不是合法 11 位手机号,原样返回或提示错误
return phone; return phone;
} },
// 生成uuid
uuid() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
const r = Math.random() * 16 | 0;
const v = c === 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
}
} }
\ No newline at end of file
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
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';
import { shareURL } from "@/environments/environment";
import wx from 'weixin-js-sdk'
//只要是未登录状态,想要跳转到名单内的路径时,直接跳到登录页 //只要是未登录状态,想要跳转到名单内的路径时,直接跳到登录页
// 页面白名单,不受拦截 // 页面白名单,不受拦截
const whiteList = [ const whiteList = [
...@@ -23,6 +25,11 @@ const whiteList = [ ...@@ -23,6 +25,11 @@ const whiteList = [
'pages/lanch/index', 'pages/lanch/index',
'/myPackageA/poster/poster', '/myPackageA/poster/poster',
] ]
// 作为h5内嵌到小小程序时,自定义页面分享内容得页面
let shareCustomPageList = [
'/pages/courselist/courselist',
'/myPackageA/businessCard/businessCard',
]
export default function initApp(){ export default function initApp(){
let date = Date.now() let date = Date.now()
...@@ -36,6 +43,26 @@ export default function initApp(){ ...@@ -36,6 +43,26 @@ export default function initApp(){
let pages = getCurrentPages() let pages = getCurrentPages()
let pagesLength = pages.length let pagesLength = pages.length
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.webp`, //图片
commonId:uni.getStorageSync('cffp_userId'),
sharePage:'index'//分享出去得页面
}
wx.miniProgram.postMessage({
data: {
type: 'share',
shareData: JSON.stringify(shareInfo)
}
})
return
}
}
if(whiteList.indexOf(e.url)==-1&&!uni.getStorageSync('loginType')){ if(whiteList.indexOf(e.url)==-1&&!uni.getStorageSync('loginType')){
uni.setStorageSync('loginType','visitor') uni.setStorageSync('loginType','visitor')
...@@ -120,6 +147,26 @@ export default function initApp(){ ...@@ -120,6 +147,26 @@ export default function initApp(){
// tabbar页面跳转前进行拦截 // tabbar页面跳转前进行拦截
invoke(e) { 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.webp`, //图片
commonId:uni.getStorageSync('cffp_userId'),
sharePage:'index'//分享出去得页面
}
wx.miniProgram.postMessage({
data: {
type: 'share',
shareData: JSON.stringify(shareInfo)
}
})
return
}
}
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']){
...@@ -157,7 +204,26 @@ export default function initApp(){ ...@@ -157,7 +204,26 @@ export default function initApp(){
uni.addInterceptor('reLaunch', { uni.addInterceptor('reLaunch', {
//页面跳转前拦截 //页面跳转前拦截
invoke(e) { 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.webp`, //图片
commonId:uni.getStorageSync('cffp_userId'),
sharePage:'index'//分享出去得页面
}
wx.miniProgram.postMessage({
data: {
type: 'share',
shareData: JSON.stringify(shareInfo)
}
})
return
}
}
if (date) { if (date) {
//如果时间戳存在 那么记录此页面的停留时间 //如果时间戳存在 那么记录此页面的停留时间
dataHandling.pocessTracking( dataHandling.pocessTracking(
......
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