[Human] chore(project): 初始化导入 91dj H5 客户端项目代码
从本地工程首次入库;.npmrc(含私有 npm 源 token)与 tsbuildinfo 已加入 .gitignore,不随仓库提交。
This commit is contained in:
@@ -0,0 +1,113 @@
|
||||
<template>
|
||||
<!-- 限时优惠 -->
|
||||
<div class="limitedTime">
|
||||
<div
|
||||
v-if="
|
||||
configStore.appConfig.recommendVipIds?.length &&
|
||||
countdown > 0 &&
|
||||
!userStore.isVip &&
|
||||
isNoWatchVideoFirst &&
|
||||
state.showLimitTimeType == 'newbie'
|
||||
"
|
||||
@click.stop="limitedTimeShow = true"
|
||||
>
|
||||
<img class="limitedTime-img" src="@/assets/images/png/limitedTime.png" />
|
||||
<div class="limitedTime-time">
|
||||
<van-count-down :time="countdown" @finish="handleFinish" />
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
v-if="
|
||||
configStore.appConfig?.returnSaleVipIds?.length &&
|
||||
countdown > 0 &&
|
||||
!userStore.isVip &&
|
||||
isNoWatchVideoOld &&
|
||||
state.showLimitTimeType == 'old'
|
||||
"
|
||||
@click.stop="limitedTimeShow = true"
|
||||
>
|
||||
<img class="limitedTime-img" src="@/assets/images/png/limitedTime.png" />
|
||||
<div class="limitedTime-time limitedTime-time1">
|
||||
<van-count-down :time="countdown" @finish="handleFinish" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<LimitedTimeOfferPopup :show="limitedTimeShow" @close="limitedTimeShow = false" />
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { computed, reactive, ref } from 'vue';
|
||||
import { useConfigStore } from '@/stores/config';
|
||||
import { useUserStore } from '@/stores/user';
|
||||
|
||||
const emit = defineEmits(['exShowEl']); // 通知父组件
|
||||
const userStore = useUserStore();
|
||||
const configStore = useConfigStore();
|
||||
const state = reactive({
|
||||
showLimitTimeType: 'newbie', // 限时优惠类型: newbie: 新人, old: 返场
|
||||
});
|
||||
|
||||
const countdown = ref(0);
|
||||
const limitedTimeShow = ref(false);
|
||||
|
||||
const isNoWatchVideoFirst = computed(() => !!localStorage.getItem(`secondViewing${userStore.userInfo.uid}`));
|
||||
const isNoWatchVideoOld = computed(() => !!localStorage.getItem(`secondOldViewing${userStore.userInfo.uid}`));
|
||||
|
||||
// 限时优惠
|
||||
const newcomerActivities = () => {
|
||||
let createAt = new Date(userStore.userInfo.createdAt).getTime();
|
||||
let now = Date.now();
|
||||
if (now - createAt < configStore.appConfig?.newbieSaleTime * 60 * 60 * 1000) {
|
||||
let newbieSaleTime = configStore.appConfig?.newbieSaleTime
|
||||
? configStore.appConfig?.newbieSaleTime * 60 * 60 * 1000
|
||||
: 0;
|
||||
countdown.value = newbieSaleTime + createAt - now;
|
||||
state.showLimitTimeType = 'newbie';
|
||||
} else if (now - createAt > 3600000 * 24) {
|
||||
let oldReturnSaleTime = configStore.appConfig?.oldReturnSaleTime
|
||||
? configStore.appConfig?.oldReturnSaleTime * 60 * 60 * 1000
|
||||
: 0;
|
||||
// countdown.value = oldReturnSaleTime + createAt - now;
|
||||
let firstLoginTime = localStorage.getItem(`first_login_time_${userStore.userInfo.uid}`);
|
||||
if (firstLoginTime) {
|
||||
countdown.value = oldReturnSaleTime + Number(firstLoginTime) - now;
|
||||
}
|
||||
state.showLimitTimeType = 'old';
|
||||
}
|
||||
};
|
||||
const handleFinish = () => {
|
||||
countdown.value = 0;
|
||||
emit('exShowEl'); // 倒计时结束,通知父组件
|
||||
};
|
||||
newcomerActivities();
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.limitedTime {
|
||||
padding-bottom: 10px;
|
||||
.limitedTime-img {
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
}
|
||||
.limitedTime-time {
|
||||
position: absolute;
|
||||
bottom: -2px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
width: 50px;
|
||||
height: 16px;
|
||||
border-radius: 3px;
|
||||
background: #f68804;
|
||||
font-family: 'Alimama FangYuanTi VF';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
--van-count-down-text-color: #fff;
|
||||
--van-count-down-font-size: 10px;
|
||||
--van-count-down-line-height: normal;
|
||||
}
|
||||
// .limitedTime-time1 {
|
||||
// background: linear-gradient(96.27deg, #f3c801 1.92%, #d71a1d 100.34%) !important;
|
||||
// }
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user