Commit fccce63e authored by spc's avatar spc

api

parent 2ab5912f
...@@ -79,14 +79,16 @@ ...@@ -79,14 +79,16 @@
<div class="act915pageinviteconstatus"> <div class="act915pageinviteconstatus">
<span class="act915pageinviteconstatusno2" <!-- 根据邀请人数动态显示状态 -->
:style="{ backgroundImage: `url(${$baseUrl}${getImageUrl('inviteConStatusNo2')})` }"></span> <span v-if="invitedCount >= 1" class="act915pageinviteconstatusyes1"
<span class="act915pageinviteconstatusno1" :style="{ backgroundImage: `url(${$baseUrl}${getImageUrl('inviteConStatusYes1')})` }"></span>
<span v-else class="act915pageinviteconstatusno1"
:style="{ backgroundImage: `url(${$baseUrl}${getImageUrl('inviteConStatusNo1')})` }"></span> :style="{ backgroundImage: `url(${$baseUrl}${getImageUrl('inviteConStatusNo1')})` }"></span>
<span class="act915pageinviteconstatusyes2"
<span v-if="invitedCount >= 2" class="act915pageinviteconstatusyes2"
:style="{ backgroundImage: `url(${$baseUrl}${getImageUrl('inviteConStatusYes2')})` }"></span> :style="{ backgroundImage: `url(${$baseUrl}${getImageUrl('inviteConStatusYes2')})` }"></span>
<span class="act915pageinviteconstatusyes1" <span v-else class="act915pageinviteconstatusno2"
:style="{ backgroundImage: `url(${$baseUrl}${getImageUrl('inviteConStatusYes1')})` }"></span> :style="{ backgroundImage: `url(${$baseUrl}${getImageUrl('inviteConStatusNo2')})` }"></span>
</div> </div>
</div> </div>
...@@ -145,27 +147,27 @@ defineOptions({ ...@@ -145,27 +147,27 @@ defineOptions({
}) })
// 分享功能配置 // 分享功能配置
const shareConfig = { const shareConfig = computed(() => ({
title: '飞鹤915活动', title: invitationText.value || '飞鹤915活动',
path: '/activity0915/act0915/act0915', path: `/activity0915/act0915/act0915?invitationCode=${invitationCode.value}`,
imageUrl: '' // 可以设置分享图片 imageUrl: invitationImageUrl.value || '' // 使用接口返回的分享图片
}; }));
// 分享配置 - uni-app方式 // 分享配置 - uni-app方式
const onShareAppMessage = () => { const onShareAppMessage = () => {
return { return {
title: shareConfig.title, title: shareConfig.value.title,
path: shareConfig.path, path: shareConfig.value.path,
imageUrl: shareConfig.imageUrl imageUrl: shareConfig.value.imageUrl
} }
} }
// 分享到朋友圈 // 分享到朋友圈
const onShareTimeline = () => { const onShareTimeline = () => {
return { return {
title: shareConfig.title, title: shareConfig.value.title,
path: shareConfig.path, path: shareConfig.value.path,
imageUrl: shareConfig.imageUrl imageUrl: shareConfig.value.imageUrl
} }
} }
...@@ -175,11 +177,18 @@ const config = ref({}) // 配置对象 ...@@ -175,11 +177,18 @@ const config = ref({}) // 配置对象
const bannerList = ref([]) // Banner列表 const bannerList = ref([]) // Banner列表
const loading = ref(true) // 加载状态 const loading = ref(true) // 加载状态
// New refs for sharing and phone authorization // 邀请相关数据
const showMask = ref(false); const showMask = ref(false);
const showDrawSucModal = ref(false); const showDrawSucModal = ref(false);
const currentAwardName = ref(''); const currentAwardName = ref('');
const invitationCode = ref(''); const invitationCode = ref('');
const invitationText = ref('');
const invitationImageUrl = ref('');
const invitedCount = ref(0);
const nextRewardNeedCount = ref(2);
const unclaimedPrizes = ref([]);
const receivedPrizes = ref([]);
const isLogin = ref(false);
// 获取homeStore实例 // 获取homeStore实例
const homeStore = useHomeStore(); const homeStore = useHomeStore();
...@@ -299,26 +308,60 @@ const fetchAct915HomeData = async () => { ...@@ -299,26 +308,60 @@ const fetchAct915HomeData = async () => {
console.log('开始请求 getAct915Home 接口...') console.log('开始请求 getAct915Home 接口...')
const response = await getAct915Home() const response = await getAct915Home()
console.log('getAct915Home 接口返回结果:', response) console.log('getAct915Home 接口返回结果:', response)
console.log('getAct915Home 接口返回数据:', response.data)
// 输出详细的返回信息 if (response && response.ok && response.data) {
if (response && response.data) { const data = response.data
console.log('=== getAct915Home 接口返回详情 ===')
console.log('状态码:', response.status) // 更新邀请相关数据
console.log('消息:', response.message) invitationCode.value = data.invitationCode || ''
console.log('数据:', JSON.stringify(response.data, null, 2)) invitationText.value = data.invitationText || '飞鹤915活动'
console.log('================================') invitationImageUrl.value = data.invitationImageUrl || ''
invitedCount.value = data.invitedCount || 0
nextRewardNeedCount.value = data.nextRewardNeedCount || 2
unclaimedPrizes.value = data.unclaimedPrizes || []
receivedPrizes.value = data.receivedPrizes || []
// 判断是否登录(根据notLogin字段或邀请码)
isLogin.value = !data.notLogin && !!data.invitationCode
console.log('邀请数据更新:', {
invitationCode: invitationCode.value,
invitedCount: invitedCount.value,
nextRewardNeedCount: nextRewardNeedCount.value,
unclaimedPrizesCount: unclaimedPrizes.value.length,
isLogin: isLogin.value,
notLogin: data.notLogin
})
// 检查是否有未领取的奖品需要弹窗
if (unclaimedPrizes.value.length > 0) {
showPrizeModal()
}
// 检查是否需要显示授权弹窗(未登录用户)
if (data.notLogin || !isLogin.value) {
showMask.value = true
}
} }
return response return response
} catch (error) { } catch (error) {
console.error('getAct915Home 接口请求失败:', error) console.error('getAct915Home 接口请求失败:', error)
console.error('错误详情:', error.message)
console.error('错误状态:', error.status)
return null return null
} }
} }
// 显示奖品弹窗
const showPrizeModal = () => {
if (unclaimedPrizes.value.length > 0) {
// 计算总奖品数量
const totalQuantity = unclaimedPrizes.value.reduce((sum, prize) => sum + (prize.quantity || 1), 0)
const firstPrize = unclaimedPrizes.value[0]
currentAwardName.value = `${firstPrize.prizeName} × ${totalQuantity}`
showDrawSucModal.value = true
}
}
const handleLotteryClick = () => { const handleLotteryClick = () => {
// 从配置中获取抽奖banner链接 // 从配置中获取抽奖banner链接
const lotteryLink = config.value?.lottery?.link const lotteryLink = config.value?.lottery?.link
...@@ -493,7 +536,14 @@ const handleBannerClick = (index) => { ...@@ -493,7 +536,14 @@ const handleBannerClick = (index) => {
const handleInviteClick = () => { const handleInviteClick = () => {
console.log('点击邀请按钮') console.log('点击邀请按钮')
// 使用uni-app的分享功能 // 检查是否登录
if (!isLogin.value) {
// 未登录用户需要先授权
showMask.value = true
return
}
// 已登录用户直接分享
uni.showShareMenu({ uni.showShareMenu({
withShareTicket: true, withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline'] menus: ['shareAppMessage', 'shareTimeline']
...@@ -508,55 +558,79 @@ onMounted(async () => { ...@@ -508,55 +558,79 @@ onMounted(async () => {
console.log('配置数据:', config.value) console.log('配置数据:', config.value)
// 请求 getAct915Home 接口 // 请求 getAct915Home 接口
const homeData = await fetchAct915HomeData(); await fetchAct915HomeData();
if (homeData && homeData.data) {
invitationCode.value = homeData.data.invitationCode;
// Check if new user (assuming !homeStore.isLogin means new user)
if (!homeStore.isLogin) {
showMask.value = true;
} else {
// Old user
const unclaimed = homeData.data.unclaimedPrizes[0];
if (unclaimed) {
currentAwardName.value = `${unclaimed.prizeName} * ${unclaimed.quantity}`;
showDrawSucModal.value = true;
}
}
}
// Get query params for invitationCode // 检查URL参数中的邀请码
const pages = getCurrentPages(); const pages = getCurrentPages();
const currentPage = pages[pages.length - 1]; const currentPage = pages[pages.length - 1];
const options = currentPage.options; const options = currentPage.options;
const incomingCode = options.invitationCode; const incomingCode = options.invitationCode;
console.log('页面参数:', {
incomingCode,
isLogin: isLogin.value,
invitationCode: invitationCode.value,
invitedCount: invitedCount.value,
nextRewardNeedCount: nextRewardNeedCount.value
});
if (incomingCode) {
console.log('检测到邀请码:', incomingCode)
// 如果是新用户且有邀请码,需要先授权
if (!isLogin.value) {
showMask.value = true
}
}
}); });
// Phone authorization // Phone authorization
const onGetPhoneNumber = async (e) => { const onGetPhoneNumber = async (e) => {
if (e.detail.errMsg === 'getPhoneNumber:ok') { if (e.detail.errMsg === 'getPhoneNumber:ok') {
// Handle phone authorization success (call API to login/register) try {
// Assuming success, hide mask // 隐藏授权弹窗
showMask.value = false; showMask.value = false;
homeStore.isLogin = true; // Update store
// 重新获取用户信息(登录后)
// Check for incoming invitationCode await fetchAct915HomeData();
const pages = getCurrentPages();
const currentPage = pages[pages.length - 1]; // 检查是否有邀请码需要处理助力
const options = currentPage.options; const pages = getCurrentPages();
const incomingCode = options.invitationCode; const currentPage = pages[pages.length - 1];
const options = currentPage.options;
if (incomingCode) { const incomingCode = options.invitationCode;
try {
const res = await invitationAssist({ code: incomingCode }); if (incomingCode) {
uni.showToast({ title: res.success ? '助力成功' : '助力失败' }); console.log('处理助力邀请码:', incomingCode)
} catch (error) { try {
uni.showToast({ title: '助力失败' }); const res = await invitationAssist(incomingCode);
if (res && res.success) {
uni.showToast({
title: '助力成功',
icon: 'success',
duration: 2000
});
} else {
uni.showToast({
title: '助力失败',
icon: 'none',
duration: 2000
});
}
} catch (error) {
console.error('助力请求失败:', error)
uni.showToast({
title: '助力失败',
icon: 'none',
duration: 2000
});
}
} }
} catch (error) {
console.error('授权后处理失败:', error)
uni.showToast({ title: '授权失败', icon: 'none' });
} }
} else { } else {
uni.showToast({ title: '授权失败' }); uni.showToast({ title: '授权失败', icon: 'none' });
} }
}; };
......
...@@ -317,6 +317,7 @@ ...@@ -317,6 +317,7 @@
height: 67rpx; height: 67rpx;
left: 28rpx; left: 28rpx;
top: 104rpx; top: 104rpx;
pointer-events: none;
position: absolute; position: absolute;
.act915pageinviteconstatusno2 { .act915pageinviteconstatusno2 {
......
...@@ -25,7 +25,7 @@ export const lotteryConfig = { ...@@ -25,7 +25,7 @@ export const lotteryConfig = {
noticeConBg: `LotteryPage/${version}/LotteryPageNoticeConBg.png`, noticeConBg: `LotteryPage/${version}/LotteryPageNoticeConBg.png`,
noticeConSoundIcon: `LotteryPage/${version}/LotteryPageNoticeConSoundIcon.png`, noticeConSoundIcon: `LotteryPage/${version}/LotteryPageNoticeConSoundIcon.png`,
drawBtn: `LotteryPage/${version}/LotteryPageDrawBtn.png`, drawBtn: `LotteryPage/${version}/LotteryPageDrawBtn.png`,
lotterypageturntableawardsSelBg: `LotteryPage/${version}/LotteryPageTurnTableAwardsSelBg.png`, lotterypageturntableawardsSelBg: `LotteryPage/${version}/lotterypageturntableawardsSelBg.png`,
}, },
// 奖品配置 // 奖品配置
......
...@@ -68,7 +68,8 @@ ...@@ -68,7 +68,8 @@
<span class="lotterypagenoticeconbg" <span class="lotterypagenoticeconbg"
:style="{ backgroundImage: `url(${$baseUrl}${getImageUrl(config.images.noticeConBg)})` }"></span> :style="{ backgroundImage: `url(${$baseUrl}${getImageUrl(config.images.noticeConBg)})` }"></span>
<div class="lotterypagenoticecontext-wrapper"> <div class="lotterypagenoticecontext-wrapper">
<div class="lotterypagenoticecontext-container" <div class="lotterypagenoticecontext-container"
:class="{ 'no-transition': isResetting }"
:style="{ transform: `translateY(-${currentNoticeIndex * 40}rpx)` }"> :style="{ transform: `translateY(-${currentNoticeIndex * 40}rpx)` }">
<span class="lotterypagenoticecontext" v-for="(notice, index) in displayNotices" <span class="lotterypagenoticecontext" v-for="(notice, index) in displayNotices"
:key="`${notice.userNickname}-${index}`">{{ formatNotice(notice.userNickname, notice.prizeName) :key="`${notice.userNickname}-${index}`">{{ formatNotice(notice.userNickname, notice.prizeName)
...@@ -122,6 +123,7 @@ const activityRules = ref('') // 活动规则内容 ...@@ -122,6 +123,7 @@ const activityRules = ref('') // 活动规则内容
const isDrawing = ref(false) // 是否正在抽奖 const isDrawing = ref(false) // 是否正在抽奖
const selectedPrizeIndex = ref(-1) // 当前选中的奖品索引 const selectedPrizeIndex = ref(-1) // 当前选中的奖品索引
const currentHighlightIndex = ref(-1) // 当前高亮的奖品索引(用于轮流亮起效果) const currentHighlightIndex = ref(-1) // 当前高亮的奖品索引(用于轮流亮起效果)
const isResetting = ref(false) // 是否正在重置轮播位置
// 弹窗状态 // 弹窗状态
const showRuleModal = ref(false) // 规则弹窗 const showRuleModal = ref(false) // 规则弹窗
...@@ -253,10 +255,18 @@ const startNoticeCarousel = () => { ...@@ -253,10 +255,18 @@ const startNoticeCarousel = () => {
currentNoticeIndex.value = currentNoticeIndex.value + 1 currentNoticeIndex.value = currentNoticeIndex.value + 1
console.log('当前公告索引:', currentNoticeIndex.value) console.log('当前公告索引:', currentNoticeIndex.value)
// 当滚动到重复数据的开始位置时,重置到原始位置 // 当滚动到重复数据的开始位置时,立即重置到原始位置(无动效)
if (currentNoticeIndex.value >= recentNotices.value.length) { if (currentNoticeIndex.value >= recentNotices.value.length) {
// 立即重置,不使用延迟 // 禁用过渡动效
isResetting.value = true
// 立即重置到原始位置
currentNoticeIndex.value = 0 currentNoticeIndex.value = 0
// 下一帧恢复过渡动效
setTimeout(() => {
isResetting.value = false
}, 0)
} }
}, 3000) // 每3秒切换一次 }, 3000) // 每3秒切换一次
} }
...@@ -340,18 +350,22 @@ const handleDrawClick = async () => { ...@@ -340,18 +350,22 @@ const handleDrawClick = async () => {
const startHighlightAnimation = (targetIndex, isWin) => { const startHighlightAnimation = (targetIndex, isWin) => {
console.log(`开始轮流亮起动画,目标奖品索引: ${targetIndex}, 是否中奖: ${isWin}`) console.log(`开始轮流亮起动画,目标奖品索引: ${targetIndex}, 是否中奖: ${isWin}`)
const totalPrizes = turntablePrizes.value.length // 按照指定顺序:1 -> 5 -> 3 -> 2 -> 4 -> 6
let currentIndex = 0 // 对应索引:0 -> 4 -> 2 -> 1 -> 3 -> 5
const turntableOrder = [0, 4, 2, 1, 3, 5] // 按照指定顺序
const totalPrizes = turntableOrder.length
let currentOrderIndex = 0
let roundCount = 0 let roundCount = 0
const maxRounds = 2 // 最多转2圈 const maxRounds = 2 // 最多转2圈
const highlightSpeed = 150 // 每个奖品高亮150ms const highlightSpeed = 200 // 每个奖品高亮200ms
const highlightTimer = setInterval(() => { const highlightTimer = setInterval(() => {
// 高亮当前奖品 // 获取当前转盘顺序中的奖品索引
currentHighlightIndex.value = currentIndex const currentPrizeIndex = turntableOrder[currentOrderIndex]
currentHighlightIndex.value = currentPrizeIndex
// 检查是否到达目标位置 // 检查是否到达目标位置
if (roundCount >= maxRounds && currentIndex === targetIndex) { if (roundCount >= maxRounds && currentPrizeIndex === targetIndex) {
clearInterval(highlightTimer) clearInterval(highlightTimer)
// 停止高亮,显示最终选中状态 // 停止高亮,显示最终选中状态
...@@ -378,11 +392,11 @@ const startHighlightAnimation = (targetIndex, isWin) => { ...@@ -378,11 +392,11 @@ const startHighlightAnimation = (targetIndex, isWin) => {
}, 1000) }, 1000)
}, highlightSpeed) }, highlightSpeed)
} else { } else {
// 移动到下一个奖品 // 移动到下一个奖品(按转盘顺序)
currentIndex = (currentIndex + 1) % totalPrizes currentOrderIndex = (currentOrderIndex + 1) % totalPrizes
// 如果回到起点,增加圈数 // 如果回到起点,增加圈数
if (currentIndex === 0) { if (currentOrderIndex === 0) {
roundCount++ roundCount++
} }
} }
......
...@@ -60,6 +60,19 @@ ...@@ -60,6 +60,19 @@
top: 95rpx; top: 95rpx;
position: absolute; position: absolute;
.lotterypageturntableawards6selbg {
width: 272rpx;
height: 214rpx;
left: -71rpx;
top: -18rpx;
position: absolute;
background-size: cover;
background-repeat: no-repeat;
background-position: center;
transform: rotate(300deg);
transform-origin: center;
}
.lotterypageturntableawards6bg { .lotterypageturntableawards6bg {
width: 39rpx; width: 39rpx;
height: 106rpx; height: 106rpx;
...@@ -90,6 +103,19 @@ ...@@ -90,6 +103,19 @@
top: 138rpx; top: 138rpx;
position: absolute; position: absolute;
.lotterypageturntableawards5selbg {
width: 272rpx;
height: 214rpx;
left: -104rpx;
top: -59rpx;
position: absolute;
background-size: cover;
background-repeat: no-repeat;
background-position: center;
transform: rotate(60deg);
transform-origin: center;
}
.lotterypageturntableawards5bg { .lotterypageturntableawards5bg {
width: 78rpx; width: 78rpx;
height: 64rpx; height: 64rpx;
...@@ -121,6 +147,19 @@ ...@@ -121,6 +147,19 @@
top: 296rpx; top: 296rpx;
position: absolute; position: absolute;
.lotterypageturntableawards4selbg {
width: 272rpx;
height: 214rpx;
left: -94rpx;
top: -30rpx;
position: absolute;
background-size: cover;
background-repeat: no-repeat;
background-position: center;
transform: rotate(240deg);
transform-origin: center;
}
.lotterypageturntableawards4bg { .lotterypageturntableawards4bg {
width: 39rpx; width: 39rpx;
height: 106rpx; height: 106rpx;
...@@ -151,6 +190,19 @@ ...@@ -151,6 +190,19 @@
top: 296rpx; top: 296rpx;
position: absolute; position: absolute;
.lotterypageturntableawards3selbg {
width: 272rpx;
height: 214rpx;
left: -105rpx;
top: -29rpx;
position: absolute;
background-size: cover;
background-repeat: no-repeat;
background-position: center;
transform: rotate(120deg);
transform-origin: center;
}
.lotterypageturntableawards3bg { .lotterypageturntableawards3bg {
width: 39rpx; width: 39rpx;
height: 106rpx; height: 106rpx;
...@@ -181,6 +233,19 @@ ...@@ -181,6 +233,19 @@
top: 389rpx; top: 389rpx;
position: absolute; position: absolute;
.lotterypageturntableawards2selbg {
width: 272rpx;
height: 214rpx;
left: -90rpx;
top: -29rpx;
position: absolute;
background-size: cover;
background-repeat: no-repeat;
background-position: center;
transform: rotate(180deg);
transform-origin: center;
}
.lotterypageturntableawards2img { .lotterypageturntableawards2img {
width: 39rpx; width: 39rpx;
height: 106rpx; height: 106rpx;
...@@ -211,6 +276,19 @@ ...@@ -211,6 +276,19 @@
top: 0rpx; top: 0rpx;
position: absolute; position: absolute;
.lotterypageturntableawards1selbg {
width: 272rpx;
height: 214rpx;
left: -90rpx;
top: -18rpx;
position: absolute;
background-size: cover;
background-repeat: no-repeat;
background-position: center;
transform: rotate(0deg);
transform-origin: center;
}
.lotterypageturntableawards1img { .lotterypageturntableawards1img {
width: 39rpx; width: 39rpx;
height: 106rpx; height: 106rpx;
...@@ -300,7 +378,7 @@ ...@@ -300,7 +378,7 @@
} }
.lotterypagenoticecontext-wrapper { .lotterypagenoticecontext-wrapper {
width: 382rpx; width: 482rpx;
height: 40rpx; height: 40rpx;
left: 135rpx; left: 135rpx;
top: 5rpx; top: 5rpx;
...@@ -310,10 +388,14 @@ ...@@ -310,10 +388,14 @@
.lotterypagenoticecontext-container { .lotterypagenoticecontext-container {
transition: transform 0.5s ease-in-out; transition: transform 0.5s ease-in-out;
&.no-transition {
transition: none;
}
} }
.lotterypagenoticecontext { .lotterypagenoticecontext {
width: 382rpx; width: 482rpx;
height: 40rpx; height: 40rpx;
position: relative; position: relative;
font-size: 24rpx; font-size: 24rpx;
......
...@@ -11,152 +11,18 @@ export const getAct915Home = () => api.post('/c/activity/use_invite_915/invitati ...@@ -11,152 +11,18 @@ export const getAct915Home = () => api.post('/c/activity/use_invite_915/invitati
* 邀请助力 * 邀请助力
* @returns * @returns
*/ */
export const invitationAssist = (inviterUserId) => api.post('/c/activity/act915/invitation/assist', { inviterUserId}) export const invitationAssist = (inviterUserId) => api.post('/c/activity/use_invite_915/invitation/assist', { inviterUserId})
/** /**
* 获取抽奖信息 * 获取抽奖信息
* @returns * @returns
*/ */
export const getAct915LotteryInfo = () => { export const getAct915LotteryInfo = () => api.get('/c/activity/turntable_lottery_915/home')
// Mock数据 - 抽奖信息
return Promise.resolve({
ok: true,
success: true,
msg: "获取成功",
code: "success",
data: {
activityRules: "1. 活动时间:2024年9月15日-9月30日\n2. 每日可抽奖3次\n3. 奖品将在中奖后7个工作日内发放\n4. 本活动最终解释权归飞鹤所有",
remainingChances: 3,
turntablePrizes: [
{
prizeId: 1,
prizeName: "N47度 水果玉米汁",
prizeImageUrl: "prize1.jpg",
prizeType: "product",
prizeDescription: "天然水果玉米汁,营养美味",
displayProbability: "10%",
remainingStock: 100
},
{
prizeId: 2,
prizeName: "飞鹤星飞帆奶粉",
prizeImageUrl: "prize2.jpg",
prizeType: "product",
prizeDescription: "高端婴幼儿配方奶粉",
displayProbability: "5%",
remainingStock: 50
},
{
prizeId: 3,
prizeName: "谢谢参与",
prizeImageUrl: "prize3.jpg",
prizeType: "none",
prizeDescription: "很遗憾,没有中奖",
displayProbability: "60%",
remainingStock: 999
},
{
prizeId: 4,
prizeName: "飞鹤有机奶粉",
prizeImageUrl: "prize4.jpg",
prizeType: "product",
prizeDescription: "有机认证婴幼儿奶粉",
displayProbability: "8%",
remainingStock: 30
},
{
prizeId: 5,
prizeName: "飞鹤营养米粉",
prizeImageUrl: "prize5.jpg",
prizeType: "product",
prizeDescription: "营养均衡的婴幼儿米粉",
displayProbability: "12%",
remainingStock: 80
},
{
prizeId: 6,
prizeName: "飞鹤益生菌",
prizeImageUrl: "prize6.jpg",
prizeType: "product",
prizeDescription: "婴幼儿专用益生菌",
displayProbability: "5%",
remainingStock: 40
}
],
winningCarousel: [
{ userNickname: "用户152****8839", prizeName: "N47度 水果玉米汁", winningTime: "2024-09-15 10:30:00" },
{ userNickname: "用户138****5678", prizeName: "飞鹤星飞帆奶粉", winningTime: "2024-09-15 10:25:00" },
{ userNickname: "用户159****1234", prizeName: "飞鹤有机奶粉", winningTime: "2024-09-15 10:20:00" },
{ userNickname: "用户186****9876", prizeName: "飞鹤营养米粉", winningTime: "2024-09-15 10:15:00" },
{ userNickname: "用户177****5432", prizeName: "飞鹤益生菌", winningTime: "2024-09-15 10:10:00" },
{ userNickname: "用户139****8765", prizeName: "N47度 水果玉米汁", winningTime: "2024-09-15 10:05:00" },
{ userNickname: "用户158****4321", prizeName: "飞鹤星飞帆奶粉", winningTime: "2024-09-15 10:00:00" },
{ userNickname: "用户187****6543", prizeName: "飞鹤有机奶粉", winningTime: "2024-09-15 09:55:00" },
{ userNickname: "用户136****7890", prizeName: "飞鹤营养米粉", winningTime: "2024-09-15 09:50:00" },
{ userNickname: "用户159****2468", prizeName: "飞鹤益生菌", winningTime: "2024-09-15 09:45:00" }
],
userWinningPrizes: [
{
winningRecordId: 1001,
prizeId: 1,
prizeName: "N47度 水果玉米汁",
prizeImageUrl: "prize1.jpg",
prizeType: "product",
prizeDescription: "天然水果玉米汁,营养美味",
isIssued: true,
winningTime: "2024-09-14 15:30:00",
issueTime: "2024-09-14 16:00:00"
},
{
winningRecordId: 1002,
prizeId: 2,
prizeName: "飞鹤星飞帆奶粉",
prizeImageUrl: "prize2.jpg",
prizeType: "product",
prizeDescription: "高端婴幼儿配方奶粉",
isIssued: false,
winningTime: "2024-09-13 14:20:00",
issueTime: null
}
]
}
})
}
/** /**
* 抽奖 * 抽奖
* @returns * @returns
*/ */
export const getAct915LotteryDraw = () => { export const getAct915LotteryDraw = () => api.post('/c/activity/turntable_lottery_915/lottery/draw')
// Mock数据 - 抽奖结果
const prizes = [
{ prizeId: 1, prizeName: "N47度 水果玉米汁", isWin: true },
{ prizeId: 2, prizeName: "飞鹤星飞帆奶粉", isWin: true },
{ prizeId: 3, prizeName: "谢谢参与", isWin: false },
{ prizeId: 4, prizeName: "飞鹤有机奶粉", isWin: true },
{ prizeId: 5, prizeName: "飞鹤营养米粉", isWin: true },
{ prizeId: 6, prizeName: "飞鹤益生菌", isWin: true }
]
// 随机选择一个奖品(模拟真实抽奖概率)
const randomPrize = prizes[Math.floor(Math.random() * prizes.length)]
return Promise.resolve({
ok: true,
success: true,
msg: "抽奖成功",
code: "success",
data: {
isWin: randomPrize.isWin,
prizeId: randomPrize.prizeId,
prizeName: randomPrize.prizeName,
prizeImageUrl: `prize${randomPrize.prizeId}.jpg`,
prizeType: randomPrize.isWin ? "product" : "none",
prizeDescription: randomPrize.isWin ? "恭喜中奖!" : "很遗憾,没有中奖",
remainingChances: Math.max(0, Math.floor(Math.random() * 3)), // 随机剩余次数
winningRecordId: randomPrize.isWin ? Math.floor(Math.random() * 10000) + 1000 : null
}
})
}
export const fetchAct915JSON = () => api.get('/c/front/content', {type: 'act915'}) export const fetchAct915JSON = () => api.get('/c/front/content', {type: 'act915',version: '1'})
...@@ -16,10 +16,10 @@ const { ...@@ -16,10 +16,10 @@ const {
// request.js // request.js
// 通常可以吧 baseUrl 单独放在一个 js 文件了 // 通常可以吧 baseUrl 单独放在一个 js 文件了
// const baseUrl = "http://172.16.230.108:7777/pmall"; // const baseUrl = "http://172.16.230.108:7777/pmall";
// const baseUrl = "https://momclub-uat.feihe.com/pmall";//测试环境 const baseUrl = "https://momclub-uat.feihe.com/pmall";//测试环境
// let baseUrl = "https://momclub.feihe.com/pmall";//生产环境 // let baseUrl = "https://momclub.feihe.com/pmall";//生产环境
// const baseUrl = "https://docs.dui88.com/mock/1956/api";//mock // const baseUrl = "https://docs.dui88.com/mock/1956/api";//mock
const baseUrl = "https://feihe.m.duibatest.com.cn/pmall" // const baseUrl = "https://feihe.m.duibatest.com.cn/pmall"
const request = (options = {}) => { const request = (options = {}) => {
// 在这里可以对请求头进行一些设置 // 在这里可以对请求头进行一些设置
......
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