Commit 54f9c162 authored by 王炽's avatar 王炽

邀请助力提交

parent dabb76e6
......@@ -47,3 +47,12 @@ export const getPointsBenefitCouponJSON = () => api.get('/c/resource/pointsBenef
//查询任务结果接口
export const queryTodoResultJSON = (activityId) => api.get('/c/activity/todo/queryTodoResult');
//获取邀请活动首页信息接口
export const getOriginInviteHomeJSON = () => api.get('/c/activity/origin_invite/home');
//邀请助力接口
export const assistInviteJSON = (invitationCode, wxUnionId) => api.post('/c/activity/origin_invite/assist', {
invitationCode,
wxUnionId
});
......@@ -46,7 +46,8 @@
background: linear-gradient(90deg, #A07B4D 0%, #C09A60 100%);
border-radius: 30rpx;
display: flex;
margin-top: 20rpx;
margin-top: 30rpx;
margin-left: 30rpx;
align-items: center;
justify-content: center;
box-shadow: 0 2rpx 8rpx rgba(160, 123, 77, 0.3);
......
......@@ -14,9 +14,9 @@
<text class="card_description">成功邀请一位好友注册即可获得XXX</text>
<!-- 去邀请按钮 -->
<view class="invite_button" @tap="handleInviteClick" open-type="share">
<button class="invite_button" @tap="handleInviteClick" open-type="share">
<text class="invite_button_text">去邀请</text>
</view>
</button>
</view>
<!-- 3D星星角色 -->
<view class="star_character">
......@@ -47,31 +47,20 @@
<script setup>
import { defineEmits } from 'vue';
import { onShareAppMessage } from '@dcloudio/uni-app';
import { jump, JumpType } from '../../utils';
// Emits 定义
const emit = defineEmits(['invite', 'record']);
// 去邀请按钮点击事件
const handleInviteClick = () => {
console.log('去邀请按钮点击');
jump({
url: '/pages/invate/sharepage',
type: JumpType.INNER
});
// jump({
// url: '/pages/invate/sharepage',
// type: JumpType.INNER
// });
emit('invite');
};
// 分享配置
onShareAppMessage(() => {
return {
title: '积分分享',
path: '/pages/invate/sharepage',
imageUrl: ''
};
});
// 邀请记录按钮点击事件
......@@ -81,6 +70,20 @@ const handleRecordClick = () => {
};
</script>
<!-- <script>
// 微信小程序分享配置 - 使用 Options API
export default {
// 分享配置
onShareAppMessage() {
return {
title: '积分分享',
path: '/pages/invate/sharepage',
imageUrl: 'https://course.feihe.com/momclub-picture/integral/1023/invate_star_character1023.png'
};
}
}
</script> -->
<style lang="less" scoped>
@import '@/components/integralArea/InviteGift.less';
</style>
......@@ -47,7 +47,7 @@ const emit = defineEmits(['close', 'viewBenefits']);
// 关闭弹窗
const handleClose = () => {
emit('close');
gotoIntegral();
// gotoIntegral();
};
// 查看权益按钮点击
......
......@@ -47,7 +47,7 @@ const emit = defineEmits(['close', 'viewBenefits']);
// 关闭弹窗
const handleClose = () => {
emit('close');
gotoIntegral();
// gotoIntegral();
};
// 查看权益按钮点击
......
{
"ok": false,
"success": true,
"msg": "meQ6fki",
"code": "44"
}
{
"ok": true,
"success": true,
"msg": "success",
"code": "000000",
"data": {
"invitationCode": "INVITE202501",
"notLogin": false,
"invitationText": "邀请好友注册飞鹤星妈会,共同分享育儿知识,还能获得丰厚奖励!",
"invitationImageUrl": "https://example.com/invite_banner.jpg",
"activityRules": "1. 每个用户只能邀请5位好友\n2. 被邀请人完成注册即可获得奖励\n3. 邀请奖励将在活动结束后统一发放\n4. 活动时间:即日起至2025年12月31日",
"invitedCount": 3,
"nextRewardNeedCount": 2,
"unclaimedPrizes": [
{
"prizeId": 1,
"prizeName": "50元现金红包",
"prizeImageUrl": "https://example.com/reward1.jpg",
"prizeType": "cash",
"prizeDescription": "50元现金红包,可直接提现到微信零钱",
"quantity": 2,
"isIssued": false,
"createTime": "2025-01-15 10:30:00"
},
{
"prizeId": 2,
"prizeName": "100积分",
"prizeImageUrl": "https://example.com/reward2.jpg",
"prizeType": "points",
"prizeDescription": "100积分可用于兑换商城商品",
"quantity": 5,
"isIssued": false,
"createTime": "2025-01-15 10:30:00"
}
]
}
}
......@@ -179,6 +179,18 @@ const checkAndUpdateTaskResult = async () => {
onMounted(async () => {
await checkAndUpdateTaskResult();
// 调用邀请活动首页接口
const integralStore = useIntegralStore();
const res = await integralStore.getOriginInviteHome(true); // 使用 mock 数据
if(res.success) {
globalStore.isShowInvitePrizePanel = true;
globalStore.inviteCount = res.data.invitedCount;
globalStore.prizeName = '邀请好友奖励';//+res.data.prizeName;
globalStore.prizeImage = 'https://course.feihe.com/momclub-picture/integral/1023/invate_star_character1023.png';
}
console.log('邀请活动首页数据:', res);
});
// 关闭了任务奖励弹窗
......@@ -268,10 +280,10 @@ onPageScroll((e) => {
// 邀请奖品弹窗相关方法
const handleInviteClick = () => {
console.log('邀请按钮点击,显示奖品弹窗');
globalStore.isShowInvitePrizePanel = true;
};
// const handleInviteClick = () => {
// console.log('邀请按钮点击,显示奖品弹窗');
// globalStore.isShowInvitePrizePanel = true;
// };
const handleCloseInvitePrizePanel = () => {
globalStore.isShowInvitePrizePanel = false;
......
......@@ -22,7 +22,7 @@
// 一键领取按钮
.claim_button {
position: absolute;
bottom: 100rpx;
bottom: 60rpx;
left: 50%;
transform: translateX(-50%);
width: 484rpx;
......
<template>
<view class="sharepage_container">
<view class="sharepage_container" @click="handlePageClick">
<view class="background_image_container">
<!-- 背景图片 -->
<image class="background_image" :src="$baseUrl + 'homepage/shareImg_jf1.jpg'" mode="aspectFit" />
......@@ -11,26 +11,30 @@
</view>
<!-- 分享登录弹窗 -->
<sharepoplogin
<!-- <sharepoplogin
:visible="showSharePopLogin"
@close="handleCloseSharePopLogin"
@viewBenefits="handleViewBenefits"
/>
/> -->
<!-- 分享未登录弹窗 -->
<sharenpopnologin
<!-- <sharenpopnologin
:visible="showShareNPopNoLogin"
@close="handleCloseShareNPopNoLogin"
@viewBenefits="handleViewBenefits"
/>
/> -->
</view>
</template>
<script setup>
import { onMounted, ref } from 'vue';
import { onShareAppMessage } from '@dcloudio/uni-app';
import { onMounted, ref, computed } from 'vue';
import { onShareAppMessage, onShow } from '@dcloudio/uni-app';
import sharepoplogin from '@/components/integralArea/sharepoplogin.vue';
import sharenpopnologin from '@/components/integralArea/sharenpopnologin.vue';
import { jump, JumpType } from '../../utils';
import { useGlobalStore } from '@/stores/global';
import { useUserStore } from '@/stores/user';
import { useIntegralStore } from '@/stores/integral';
// 分享登录弹窗状态
const showSharePopLogin = ref(false);
......@@ -38,49 +42,137 @@ const showSharePopLogin = ref(false);
// 分享未登录弹窗状态
const showShareNPopNoLogin = ref(true);
const handlePageClick = () => {
console.log('handlePageClick');
if(!isLogin.value) {
needReinit.value = true;
jump({
type: JumpType.INNER,
url: "/pages/activity/register",
})
}
};
// 获取store实例
const userStore = useUserStore();
const globalStore = useGlobalStore();
const integralStore = useIntegralStore();
const isLogin = computed(()=>{
//return false
return userStore.isLogin;
})
const isnew = ref(false);
const inviteCode = ref('');
const unionId = ref('oQ9KswkD0qMVwPHQGslkHaJ0QxnE' || '');
onMounted(() => {
// 页面加载时显示分享未登录弹窗
showShareNPopNoLogin.value = true;
// showShareNPopNoLogin.value = true;
// 获取邀请码参数
const pages = getCurrentPages();
const currentPage = pages[pages.length - 1];
const options = currentPage.options || {};
const inviteCode1 = options.inviteCode || '';
inviteCode.value = inviteCode1;
// 如果有邀请码,调用助力接口
if (inviteCode.value && isLogin.value) {
callAssistInvite(inviteCode1,unionId.value);
}
});
// 关闭分享登录弹窗
const handleCloseSharePopLogin = () => {
showSharePopLogin.value = false;
};
// 调用助力接口
const callAssistInvite = async (ivtCode,unionId) => {
try {
// 获取用户unionId
const wxUnionId = userStore.unionId || '';
// 关闭分享未登录弹窗
const handleCloseShareNPopNoLogin = () => {
showShareNPopNoLogin.value = false;
const res = await integralStore.assistInvite(ivtCode, unionId, true);
console.log('助力接口返回:', res);
} catch (error) {
console.error('调用助力接口失败:', error);
}
};
// 查看权益按钮点击
const handleViewBenefits = () => {
console.log('查看我的权益');
// 这里可以添加跳转到权益页面的逻辑
uni.showToast({
title: '跳转到权益页面',
icon: 'none'
});
};
onShow(() => {
if(isLogin.value) {
if(isnew.value) {
globalStore.invateUseType = 'new';
//新用户注册登录后调用助力接口
gotoIntegral();
// 如果有邀请码,调用助力接口
if (inviteCode.value) {
callAssistInvite(ivtCode,unionId.value);
}
isnew.value = false;
}
}
});
// // 关闭分享登录弹窗
// const handleCloseSharePopLogin = () => {
// showSharePopLogin.value = false;
// };
// // 关闭分享未登录弹窗
// const handleCloseShareNPopNoLogin = () => {
// showShareNPopNoLogin.value = false;
// };
// // 查看权益按钮点击
// const handleViewBenefits = () => {
// console.log('查看我的权益');
// // 这里可以添加跳转到权益页面的逻辑
// uni.showToast({
// title: '跳转到权益页面',
// icon: 'none'
// });
// };
// 一键领取按钮点击事件
const handleClaim = () => {
console.log('一键领取按钮点击');
// 这里可以添加领取逻辑
uni.showToast({
title: '领取成功',
icon: 'success'
if(!isLogin.value) {
needReinit.value = true;
jump({
type: JumpType.INNER,
url: "/pages/activity/register",
})
isnew.value = true;
}else{
// 设置邀请用户类型
if(isnew.value) {
globalStore.invateUseType = 'new';
} else {
globalStore.invateUseType = 'old';
}
gotoIntegral();
}
};
const gotoIntegral = () => {
jump({
url: '/pages/index/index?pageType=integral',
type: JumpType.INNER
});
};
// 分享配置
onShareAppMessage(() => {
return {
title: '积分分享',
path: '/pages/invate/sharepage',
imageUrl: ''
};
});
// // 分享配置
// onShareAppMessage(() => {
// return {
// title: '积分分享',
// path: '/pages/invate/sharepage',
// imageUrl: ''
// };
// });
</script>
<style lang="less" scoped>
......
......@@ -55,6 +55,8 @@ export default {
this.shareImg = shareImg;
}
console.log('shareImg==', this.shareImg);
// this.shareImg = "https://yun.duiba.com//fh/"+shareImg;
......
......@@ -23,6 +23,7 @@ export const useGlobalStore = defineStore('global', {
isShowTaskPop: false, // 是否显示任务弹窗
isShowTaskPerson: false, // 是否显示任务信息弹窗
taskTodo: [], // 任务数据
invateUseType: '', // 邀请用户类型
};
},
actions: {
......
import { defineStore } from "pinia";
import { getSigninAndTaskInfoJSON, checkInJSON, getSeckillList, getPointsBenefitCouponJSON, queryTodoResultJSON } from "../api/integral";
import { getSigninAndTaskInfoJSON, checkInJSON, getSeckillList, getPointsBenefitCouponJSON, queryTodoResultJSON, getOriginInviteHomeJSON, assistInviteJSON } from "../api/integral";
import signinAndTaskInfoMock from '../mock/getSigninAndTaskInMock.json';
import checkInMock from '../mock/checkIndata.json';
import pointsBenefitCouponMock from '../mock/pointsBenefitCoupon.json';
import queryTodoResultMock from '../mock/queryTodoResult.json';
import originInviteHomeMock from '../mock/originInviteHome.json';
import assistInviteMock from '../mock/assistInvite.json';
export const useIntegralStore = defineStore("integral", {
state: () => {
return {
......@@ -12,6 +14,8 @@ export const useIntegralStore = defineStore("integral", {
_seckillData: null, // 新增:存储秒杀数据
_pointsBenefitCoupon: null, // 新增:存储积分权益券数据
_queryTodoResult: null, // 新增:存储查询任务结果数据
_originInviteHome: null, // 新增:存储邀请活动首页数据
_assistInviteData: null, // 新增:存储邀请助力数据
};
},
actions: {
......@@ -87,6 +91,26 @@ export const useIntegralStore = defineStore("integral", {
return res;
}
},
async getOriginInviteHome(isdebug = false) {
if(isdebug) {
this._originInviteHome = originInviteHomeMock;
return originInviteHomeMock;
}else{
const res = await getOriginInviteHomeJSON();
this._originInviteHome = res;
return res;
}
},
async assistInvite(invitationCode, wxUnionId, isdebug = false) {
if(isdebug) {
this._assistInviteData = assistInviteMock;
return assistInviteMock;
}else{
const res = await assistInviteJSON(invitationCode, wxUnionId);
this._assistInviteData = res;
return res;
}
},
},
getters: {
signinAndTaskInfo : (state) => {return state._signinAndTaskInfo; },
......@@ -94,5 +118,7 @@ export const useIntegralStore = defineStore("integral", {
seckillData : (state) => {return state._seckillData; },
pointsBenefitCoupon : (state) => {return state._pointsBenefitCoupon; },
queryTodoResult : (state) => {return state._queryTodoResult; },
originInviteHome : (state) => {return state._originInviteHome; },
assistInviteData : (state) => {return state._assistInviteData; },
},
});
\ No newline at end of file
......@@ -486,12 +486,25 @@
<!-- 签到规则说明弹窗 -->
<SignRuleDes :visible="showSignRuleDes" @close="handleCloseSignRuleDes" />
<!-- 分享登录弹窗 -->
<sharepoplogin
:visible="showSharePopLogin"
@close="handleCloseSharePopLogin"
@viewBenefits="handleViewBenefits"
/>
<!-- 分享未登录弹窗 -->
<sharenpopnologin
:visible="showShareNPopNoLogin"
@close="handleCloseShareNPopNoLogin"
@viewBenefits="handleViewBenefits"
/>
<!-- 公众号弹窗 -->
<!-- <GongzhonghaoPop :visible="showGongzhonghaoPop" :title="gongzhonghaoTitle"
:description="gongzhonghaoDescription" :qrCodeUrl="gongzhonghaoQrCodeUrl"
@close="handleCloseGongzhonghaoPop" @download="handleDownloadQrCode" /> -->
</view>
</view>
</template>
<!-- showShengriliTipPanel -->
......@@ -527,6 +540,8 @@ import ShengriliTipPanel from '../components/quanyi/shengriliTipPanel.vue';
import SignedTips from '../components/qiandao/SignedTips.vue';
import SignRuleDes from '../components/qiandao/SignRuleDes.vue';
import GongzhonghaoPop from '../components/renwu/GongzhonghaoPop.vue';
import sharepoplogin from '../components/integralArea/sharepoplogin.vue';
import sharenpopnologin from '../components/integralArea/sharenpopnologin.vue';
import bannerDataIntegral from '../mock/bannerDataIntegral.json';
import jifenGoodsData from '../mock/jifenGoodsData.json';
import { onShow } from "@dcloudio/uni-app";
......@@ -1538,6 +1553,10 @@ const gongzhonghaoTitle = ref('公众号');
const gongzhonghaoDescription = ref('长按关注星妈会公众号,了解更多专业育儿资讯');
const gongzhonghaoQrCodeUrl = ref('https://course.feihe.com/momclub-picture/homepage/qrcode_gzh.png');
// 分享弹窗相关
const showSharePopLogin = ref(false); // 分享登录弹窗状态
const showShareNPopNoLogin = ref(false); // 分享未登录弹窗状态
// 异业券权益相关数据
const availableBenefits = ref(0); // 可兑换权益数量
const benefitList = ref([]);
......@@ -1887,6 +1906,13 @@ onMounted(async () => {
itemIndex.value = 0;
}
// 根据邀请用户类型显示对应的分享弹窗
if (globalStore.invateUseType === 'new') {
showShareNPopNoLogin.value = true;
} else if (globalStore.invateUseType === 'old') {
showSharePopLogin.value = true;
}
hideLoading();
initExposure();
......@@ -2739,6 +2765,23 @@ const handleCloseSignRuleDes = () => {
showSignRuleDes.value = false;
}
// 关闭分享登录弹窗
const handleCloseSharePopLogin = () => {
showSharePopLogin.value = false;
globalStore.invateUseType = ''; // 清除用户类型
};
// 关闭分享未登录弹窗
const handleCloseShareNPopNoLogin = () => {
showShareNPopNoLogin.value = false;
globalStore.invateUseType = ''; // 清除用户类型
};
// 查看权益按钮点击
const handleViewBenefits = () => {
console.log('查看我的权益');
};
// 任务按钮点击事件
const handleTaskButtonClick = () => {
// jump({
......@@ -2896,13 +2939,14 @@ const handleRecordClick = () => {
onShareAppMessage(() => {
return {
title: '积分分享',
path: '/pages/invate/sharepage',
imageUrl: ''
path: '/pages/invate/sharepage' + '?inviteCode=' + integralStore.originInviteHome?.data?.invitationCode,
imageUrl: 'https://course.feihe.com/momclub-picture/integral/1023/invate_star_character1023.png'
};
});
</script>
<style lang="less" scoped>
@import '@/common.less';
@import './Integral.less';
......
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