Commit 64f3e2ff by yuzhenWang

拉起小程序分享发生产

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