动画优化

This commit is contained in:
Andy Leong 2024-01-21 01:32:58 +08:00
parent 770ca4b5c8
commit 57b35eb7e4
5 changed files with 305 additions and 220 deletions

View File

@ -2,10 +2,10 @@
import { Toast } from "vant"; import { Toast } from "vant";
import { debounceTap } from "@/plugins"; import { debounceTap } from "@/plugins";
import gsap from "gsap"; import gsap from "gsap";
import { useMainStore } from '@/store' import { useMainStore } from "@/store";
const emit = defineEmits(["IndexPage"]); const emit = defineEmits(["IndexPage"]);
const userStore = useMainStore() const userStore = useMainStore();
const start = (event) => { const start = (event) => {
debounceTap(event.target, () => { debounceTap(event.target, () => {
@ -13,7 +13,7 @@ const start = (event) => {
gsap.to(".IndexPage", { gsap.to(".IndexPage", {
duration: 0.5, duration: 0.5,
autoAlpha: 0, autoAlpha: 0,
onComplete: () => { }, onComplete: () => {},
}); });
}); });
}; };
@ -32,7 +32,6 @@ const showRule = (event) => {
}); });
}; };
const clockAni = () => { const clockAni = () => {
gsap.to(".index-clock-h", { gsap.to(".index-clock-h", {
duration: 12, duration: 12,
@ -55,6 +54,28 @@ const clockAni = () => {
}; };
onMounted(() => { onMounted(() => {
gsap.from(".index-bg", { duration: 1, scale: 1.2, autoAlpha: 0 });
gsap.from(".index-title", { duration: 1, y: 20, autoAlpha: 0 });
gsap.from(".index-rule-btn", { duration: 1, x: -100, autoAlpha: 0 });
gsap.from(".index-prize-btn", {
duration: 1,
x: -100,
autoAlpha: 0,
delay: 0.3,
});
gsap.from(".index-start-btn", {
duration: 1,
y: 30,
autoAlpha: 0,
delay: 0.5,
});
gsap.from(".index-agreement", {
duration: 1,
scale: 0.4,
autoAlpha: 0,
delay: 0.5,
});
clockAni(); clockAni();
}); });
</script> </script>
@ -72,13 +93,21 @@ onMounted(() => {
<div class="index-container"> <div class="index-container">
<div class="index-title"></div> <div class="index-title"></div>
<div class="index-rule-btn" @click="showRule($event)"></div> <div class="index-rule-btn" @click="showRule($event)"></div>
<div class="index-prize-btn" v-if="userStore.hasPrize" @click="showMyPrize($event)"></div> <div
class="index-prize-btn"
v-if="userStore.hasPrize"
@click="showMyPrize($event)"
></div>
<div class="index-start-btn" @click="start"></div> <div class="index-start-btn" @click="start"></div>
<div class="index-agreement"> <div class="index-agreement">
风险提示:本材料由平安理财有限责任公司(以下简称平安理财)制作并提供<span 风险提示:本材料由平安理财有限责任公司(以下简称平安理财)制作并提供<span
class="b">本资料内容及观点仅供参考不构成对任何人的投资建议</span>以上产品投资管理机构/管理人为平安理财代理销售机构不承担产品的投资兑付和风险管理的责任以上产品通过代理销售机构渠道销售的产品风险评级应当以代理销售机构最终披露的评级结果为准以上产品为非保本浮动收益理财产品具体以产品说明书或产品公告披露为准产品的业绩比较基准指管理人基于过往投资经验以及对产品存续期投资市场波动的预判而对本产品所设定的投资目标业绩比较基准不是预期收益率不代表产品的未来表现和实际收益不构成对产品收益的承诺<span class="b"
class="b">理财产品过往业绩不代表其未来表现不等于理财产品实际收益投资须谨慎过往业绩相关数据已经托管人核对</span><span >本资料内容及观点仅供参考不构成对任何人的投资建议</span
class="orange">理财非存款产品有风险投资须谨慎</span>金融消费者不得利用金融产品和服务从事违法活动 >以上产品投资管理机构/管理人为平安理财代理销售机构不承担产品的投资兑付和风险管理的责任以上产品通过代理销售机构渠道销售的产品风险评级应当以代理销售机构最终披露的评级结果为准以上产品为非保本浮动收益理财产品具体以产品说明书或产品公告披露为准产品的业绩比较基准指管理人基于过往投资经验以及对产品存续期投资市场波动的预判而对本产品所设定的投资目标业绩比较基准不是预期收益率不代表产品的未来表现和实际收益不构成对产品收益的承诺<span
class="b"
>理财产品过往业绩不代表其未来表现不等于理财产品实际收益投资须谨慎过往业绩相关数据已经托管人核对</span
><span class="orange">理财非存款产品有风险投资须谨慎</span
>金融消费者不得利用金融产品和服务从事违法活动
</div> </div>
</div> </div>
</div> </div>

View File

@ -36,7 +36,7 @@ const hide = (event) => {
const entryAni = () => { const entryAni = () => {
gsap.from(".MyPrizePage", { duration: 0.2, autoAlpha: 0 }); gsap.from(".MyPrizePage", { duration: 0.2, autoAlpha: 0 });
gsap.from(".myPrize-container", { duration: 0.5, autoAlpha: 0, scale: 0.7 }); gsap.from(".myPrize-container", { duration: 1, autoAlpha: 0, scale: 0.7 });
}; };
onMounted(() => { onMounted(() => {

View File

@ -56,6 +56,51 @@ onMounted(() => {
.catch((err) => { .catch((err) => {
console.error(err); console.error(err);
}); });
gsap.from(".result-bg", {
duration: 0.7,
scale: 1.2,
autoAlpha: 0,
});
gsap.from(".mbti-title", {
duration: 0.7,
x: 100,
autoAlpha: 0,
delay: 0.3,
});
gsap.from(".des", {
duration: 0.7,
x: 100,
autoAlpha: 0,
stagger: 0.3,
delay: 0.5,
});
gsap.from(".blessings", {
duration: 0.7,
x: 100,
autoAlpha: 0,
stagger: 0.2,
delay: 0.6,
});
gsap.from(".product", {
duration: 0.7,
x: 100,
autoAlpha: 0,
delay: 0.9,
});
gsap.from(".produc-img", {
duration: 0.7,
x: 100,
autoAlpha: 0,
delay: 1.2,
});
gsap.from(".theme-tab", {
duration: 0.7,
x: 100,
autoAlpha: 0,
stagger: 0.3,
delay: 1.4,
});
}); });
const createPoster = (event) => { const createPoster = (event) => {

View File

@ -1,15 +1,19 @@
<script setup> <script setup>
import { debounceTap } from '@/plugins' import { debounceTap } from "@/plugins";
import gsap from "gsap";
// //
const emit = defineEmits(["RulePage"]); const emit = defineEmits(["RulePage"]);
const hide = (event) => { const hide = (event) => {
debounceTap(event.target, () => { debounceTap(event.target, () => {
emit('RulePage', { action: 'hide' }) emit("RulePage", { action: "hide" });
}) });
} };
onMounted(() => {
gsap.from(".RulePage", { duration: 0.2, autoAlpha: 0 });
gsap.from(".rule-container", { duration: 0.5, autoAlpha: 0, scale: 0.7 });
});
</script> </script>
<template> <template>
@ -24,31 +28,50 @@ const hide = (event) => {
</div> </div>
<div class="part"> <div class="part">
<div>活动攻略</div> <div>活动攻略</div>
<div>1进入H5参加测测你的花式性格测试共设计12道题目全部选择完毕后即可获取测试结果即可参与抽奖活动</div> <div>
1进入H5参加测测你的花式性格测试共设计12道题目全部选择完毕后即可获取测试结果即可参与抽奖活动
</div>
<div>2活动期间不限制参与测试次数每人每日有1次抽奖机会</div> <div>2活动期间不限制参与测试次数每人每日有1次抽奖机会</div>
</div> </div>
<div class="part"> <div class="part">
<div>领奖说明</div> <div>领奖说明</div>
<div>1中奖后在中奖页面复制兑换码前往[平安理财服务号] 消息框发送兑换码即可领取奖品如关闭了中奖界面可在首页-[我的奖品] 内查看兑换码</div> <div>
1中奖后在中奖页面复制兑换码前往[平安理财服务号]
消息框发送兑换码即可领取奖品如关闭了中奖界面可在首页-[我的奖品]
内查看兑换码
</div>
<div>2成功领奖后奖品将会在24小时内自动到账请耐心等候</div> <div>2成功领奖后奖品将会在24小时内自动到账请耐心等候</div>
<div>3中奖人请在活动结束前进行兑换逾期视为弃权</div> <div>3中奖人请在活动结束前进行兑换逾期视为弃权</div>
<div>其他</div> <div>其他</div>
<div>活动期间如遇到任何问题请在[平安理财服务号]后台咨询我们会在一个工作日内回复</div> <div>
活动期间如遇到任何问题请在[平安理财服务号]后台咨询我们会在一个工作日内回复
</div>
<div>说明</div> <div>说明</div>
<div> <div>
1本活动由平安理财有限责任公司主办为保证活动的公平公正活动结束后主办方将对中奖用户信息进行核对用户若有下列任何一种行为或情况的主办方有权不经另行通知取消其参与活动以及获奖资格收回奖品权 1本活动由平安理财有限责任公司主办为保证活动的公平公正活动结束后主办方将对中奖用户信息进行核对用户若有下列任何一种行为或情况的主办方有权不经另行通知取消其参与活动以及获奖资格收回奖品权
</div> </div>
<div>(1) 以任何机器人软件蜘蛛软件爬虫软件刷奖软件或其它任何自动方式不正当手段等参与本活动</div> <div>
<div>(2) 同一用户(包含相同手机号相同收货信息相同移动设备号相同IP地址等) 单日内恶意切换微信账号参加活动扰乱正常抽奖秩序影响活动公平性的;</div> (1)
<div>(3) 有任何违反法律法规诚实信用公序良俗公平公正平安理财平台规则等行为;</div> 以任何机器人软件蜘蛛软件爬虫软件刷奖软件或其它任何自动方式不正当手段等参与本活动
<div>2平安理财保留调整暂停和终止本活动的权利并经公告后生效;</div> </div>
<div>
(2)
同一用户(包含相同手机号相同收货信息相同移动设备号相同IP地址等)
单日内恶意切换微信账号参加活动扰乱正常抽奖秩序影响活动公平性的;
</div>
<div>
(3)
有任何违反法律法规诚实信用公序良俗公平公正平安理财平台规则等行为;
</div>
<div>
2平安理财保留调整暂停和终止本活动的权利并经公告后生效;
</div>
</div> </div>
<div class="part"> <div class="part">
<div></div> <div></div>
<div></div> <div></div>
<div></div> <div></div>
</div> </div>
</div> </div>
</div> </div>
<div class="rule-cls-btn" @click="hide($event)"></div> <div class="rule-cls-btn" @click="hide($event)"></div>
@ -70,10 +93,9 @@ const hide = (event) => {
@include box(492px, 712px); @include box(492px, 712px);
.content { .content {
.rule-content { .rule-content {
@include box(490px, 709px); @include box(490px, 709px);
@include bg_pos('rule/rule-box.png'); @include bg_pos("rule/rule-box.png");
position: relative; position: relative;
.rule-text-area { .rule-text-area {
@ -83,7 +105,7 @@ const hide = (event) => {
overflow-y: scroll; overflow-y: scroll;
.part { .part {
font-family: 'fzcy'; font-family: "fzcy";
color: #ac4d31; color: #ac4d31;
font-size: 20px; font-size: 20px;
line-height: 30px; line-height: 30px;
@ -92,26 +114,24 @@ const hide = (event) => {
padding: 0 10px; padding: 0 10px;
} }
} }
} }
.rule-arrow { .rule-arrow {
@include pos(38px, 23px, 224px, 641px); @include pos(38px, 23px, 224px, 641px);
@include bg_pos('rule/arrow.png'); @include bg_pos("rule/arrow.png");
} }
.rule-cls-btn { .rule-cls-btn {
@include pos(48px, 48px, 441px, -76px); @include pos(48px, 48px, 441px, -76px);
@include bg_pos('rule/cls-btn.png'); @include bg_pos("rule/cls-btn.png");
} }
} }
.rule-caidai { .rule-caidai {
@include pos(135px, 185px, 357px, 557px); @include pos(135px, 185px, 357px, 557px);
@include bg_pos('rule/caidai.png'); @include bg_pos("rule/caidai.png");
pointer-events: none; pointer-events: none;
} }
} }
} }
</style> </style>

View File

@ -1,150 +1,136 @@
<script setup> <script setup>
import { Toast, Icon } from 'vant' import { Toast, Icon, Field, CellGroup } from "vant";
import gsap from "gsap"; import gsap from "gsap";
import { authorize, getUserInfo, exchangePrize } from '@/api' import { authorize, getUserInfo, exchangePrize } from "@/api";
import { getQueryString, debounceTap } from "@/plugins"; import { getQueryString, debounceTap } from "@/plugins";
const Authorization = ref('') const Authorization = ref("");
const hasPrize = ref(false) const hasPrize = ref(false);
const received = ref(true) const received = ref(true);
const money = ref('9.99') const money = ref("9.99");
const cashCode = ref("");
onMounted(() => { onMounted(() => {
let code = getQueryString('code') let code = getQueryString("code");
let dev = import.meta.env.VITE_MODE let dev = import.meta.env.VITE_MODE;
if (dev != 'dev') { if (dev != "dev") {
if (code) { if (code) {
getUserInfo({ code: code }).then( getUserInfo({ code: code }).then((res) => {
res => {
if (res.code == 0) { if (res.code == 0) {
console.log('我的信息:', res.data); console.log("我的信息:", res.data);
Authorization.value = res.data.authorization Authorization.value = res.data.authorization;
exchangePrize({}, Authorization.value).then( exchangePrize({}, Authorization.value).then((res) => {
res => { console.log("兑换结果:", res);
console.log('兑换结果:', res); });
}
)
} else { } else {
authorize({ scopeType: 1 }).then( authorize({ scopeType: 1 }).then((res) => {
res => {
if (res.code == 0) { if (res.code == 0) {
console.log('重定向地址:', res.data); console.log("重定向地址:", res.data);
location.replace(res.data) location.replace(res.data);
} }
// //
Toast.fail({ Toast.fail({
message: res.msg, message: res.msg,
duration: 0, duration: 0,
forbidClick: true forbidClick: true,
}) });
});
} }
) });
}
}
)
} else { } else {
authorize({ scopeType: 1 }).then( authorize({ scopeType: 1 }).then((res) => {
res => {
if (res.code == 0) { if (res.code == 0) {
console.log('重定向地址:', res.data); console.log("重定向地址:", res.data);
location.replace(res.data) location.replace(res.data);
} }
// //
Toast.fail({ Toast.fail({
message: res.msg, message: res.msg,
duration: 0, duration: 0,
forbidClick: true forbidClick: true,
}) });
} });
)
} }
} }
gsap.from(".CashPage", { duration: 0.5, autoAlpha: 0 });
});
gsap.from('.CashPage', { duration: 0.5, autoAlpha: 0 })
})
const go = (event) => { const go = (event) => {
let e = event.target let e = event.target;
debounceTap(e, () => { debounceTap(
console.log(1); e,
let url = import.meta.env.VITE_HOST + import.meta.env.VITE_FOLDER + '/index.html' () => {
window.location.replace(url) let url = import.meta.env.VITE_URL;
}, 0.5) window.location.replace(url);
} },
0.5
);
};
const cashFn = (event) => {
debounceTap(event.target, () => {
console.log("兑换码", cashCode.value);
if (cashCode.value != "") {
//
} else {
Toast.fail("请输入兑奖码");
}
});
};
</script> </script>
<template> <template>
<div class="CashPage" @touchmove.prevent> <div class="CashPage" @touchmove.prevent>
<div class="cash-container" v-if="hasPrize"> <div class="no-prize">
<!-- 正常领奖 -->
<div class="cashed-success" v-if="!received">
<div class="money">¥{{ money }}</div>
</div>
<!-- 已经领过奖 -->
<div class="cashed-worng" v-else></div>
</div>
<!-- 暂无中奖记录 -->
<div v-else class="no-prize">
<div class="icon"> <div class="icon">
<Icon size="40" name="info-o" color="#fda085" /> <Icon size="60" name="gift-o" color="#fda085" />
</div>
<div class="code-input-box">
<CellGroup inset>
<Field
v-model="cashCode"
maxlength="10"
label="兑奖码"
placeholder="请输入兑奖码"
/>
</CellGroup>
</div>
<div class="btn-box">
<div class="btn" @click="go($event)">参与活动</div>
<div class="btn" @click="cashFn($event)">兑奖</div>
</div> </div>
<div class="text">暂无中奖记录</div>
<div class="btn" @click="go($event)">前往参与活动</div>
</div> </div>
</div> </div>
</template> </template>
<style lang="scss" scoped> <style lang="scss" >
.van-cell__title {
width: 100px !important;
}
.CashPage { .CashPage {
@include pos(100%, 100%, 0px, 0px); @include pos(100%, 100%, 0px, 0px);
background: linear-gradient(135deg, #f6d365, #fda085); background: linear-gradient(135deg, #f6d365, #fda085);
overflow: hidden; overflow: hidden;
@include flexCen(); @include flexCen();
.cashed-success { // .title {
@include pos(750px, 1624px, 0px, 50%); // pointer-events: none;
transform: translateY(-50%); // @include box(552px, 131px);
@include bg_pos("cash/lucky_bg.jpg"); // @include bg_pos("index/title.png");
// }
.money {
@include pos(750px, 200px, 0px, 650px);
// background-color: rgba($color: #000000, $alpha: .7);
display: flex;
justify-content: center;
align-items: center;
font-size: 100px;
font-weight: 700;
color: #fda085;
letter-spacing: 2px;
}
}
.cashed-worng {
@include pos(750px, 1624px, 0px, 50%);
transform: translateY(-50%);
@include bg_pos("cash/received.jpg");
}
.no-prize { .no-prize {
@include box(600px, 400px); margin-top: 100px;
@include box(600px, 500px);
border-radius: 20px; border-radius: 20px;
background-color: aliceblue; background-color: rgb(255, 255, 255);
@include flexCen(); @include flexCen();
box-shadow: 5px 5px 10px #bebebe, box-shadow: 5px 5px 10px #bebebe, -5px -5px 10px #ffffff;
-5px -5px 10px #ffffff;
.icon { .icon {
height: 100px; height: 150px;
} }
.text { .text {
@ -152,8 +138,14 @@ const go = (event) => {
letter-spacing: 1px; letter-spacing: 1px;
} }
.btn-box {
@include box(600px, 100px);
display: flex;
flex-direction: row;
justify-content: space-around;
.btn { .btn {
@include box(280px, 80px); @include box(230px, 80px);
background: linear-gradient(135deg, #f6d365, #fda085); background: linear-gradient(135deg, #f6d365, #fda085);
display: flex; display: flex;
justify-content: center; justify-content: center;
@ -162,10 +154,9 @@ const go = (event) => {
font-size: 30px; font-size: 30px;
color: #fff; color: #fff;
margin-top: 50px; margin-top: 50px;
box-shadow: 20px 20px 60px #bebebe, box-shadow: 20px 20px 60px #bebebe, -20px -20px 60px #ffffff;
-20px -20px 60px #ffffff; }
} }
} }
} }
</style> </style>