Commit 7d4a30ba by yuzhenWang

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

拉起小程序分享发生产

See merge request !99
parents e65a4457 64f3e2ff
......@@ -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() == '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/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 @@
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'
......
......@@ -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: {
......@@ -229,7 +231,7 @@
}
}
},
methods: {
goBack() {
......@@ -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>
......
......@@ -27,10 +27,10 @@
</text>
<text
v-else-if="!customerBasicInfo.parentRealName&&customerBasicInfo.parentNickName">我的上级:{{customerBasicInfo.parentNickName}}</text>
</view>
<view class="desBox">{{customerBasicInfo.mobile}}</view>
<view class="desBox">{{customerBasicInfo.mobile}}</view>
</view>
</view>
......@@ -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') {
......@@ -457,13 +457,13 @@
applyItem.isShow = !dealerId && levelCode != 'P3'; // 没有 dealerId 才显示
}
}
// #ifdef H5
initJssdkShare(() => {
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'
})
......@@ -598,7 +603,7 @@
},
// 菜单跳转页面
goDetail(item) {
if (uni.getStorageSync('cffp_userInfo')) {
this.userInfo = JSON.parse(uni.getStorageSync('cffp_userInfo'))
}
......@@ -642,7 +647,6 @@
});
// #endif
// #ifdef H5
console.log('H5====')
dataHandling.pocessTracking(
'咨询客服',
`用户咨询客服`,
......@@ -703,21 +707,23 @@
});
return
}
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}`
});
return
}
if (item.isShow && item.isOpen) {
if (item.title === '我的邀请码') {
this.$refs.popup1.open('bottom');
......@@ -745,9 +751,9 @@
url: `${item.link}?levelCode=` + this.customerBasicInfo.levelCode
});
} 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,11 +846,11 @@
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'])
}
// id=03的权限设置
// 执行处理
const result = this.setSpecificMenuIsShow(this.mainMenuLists, this.customerBasicInfo
......@@ -903,7 +909,7 @@
// url: '/myPackageA/noBusinessCard/noBusinessCard'
// });
// }
if (cardStatus == '2') {
if (cardStatus == '2') {
// 名片审核中
uni.showModal({
title: '提示',
......@@ -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