浏览代码

feat:添加礼物页面和祝福弹窗

wangsisi 16 小时之前
父节点
当前提交
49a4e9092d

+ 7 - 0
pages.json

@@ -49,6 +49,13 @@
 			{
 				"navigationBarTitleText" : "有味地图"
 			}
+		},
+		{
+			"path" : "pages/tabBar/tree/subPages/gift",
+			"style" : 
+			{
+				"navigationBarTitleText" : "守护礼物"
+			}
 		}
 	],
 	"globalStyle": {

+ 309 - 0
pages/tabBar/tree/components/blessingsPopup.vue

@@ -0,0 +1,309 @@
+<template>
+	<up-popup :show="showPopup" round="8" mode="center" closeable @close="handleCancel">
+		<view class="blessings-popup">
+			<view class="blessings-title">每日祝福</view>
+			<view class="blessings-cont">
+				<view class="head">
+					<view class="common-title">
+						<view class="line"></view>
+						<text>随机祝福</text>
+					</view>
+					<view class="button" @click="getRandomPick">
+						<icon name="exchange" />
+						<text>换一换</text>
+					</view>
+				</view>
+				<view class="blessings-list">
+					<view v-for="(item, index) in list" :key="index" class="blessings-item"
+						:class="{ active: activeIndex === index }" @click="handleMsg(index, item)">
+						{{ item.clockinText }}
+					</view>
+				</view>
+				<up-textarea class="message-field" v-model="message" placeholder="给 TA 一份暖心的祝福吧~"
+					autoHeight></up-textarea>
+			</view>
+			<view class="blessings-footer">
+				<view @click="handleCancel">取消</view>
+				<view class="send" @click="handleSend">发送</view>
+			</view>
+		</view>
+	</up-popup>
+	<!-- 祝福成功弹窗 -->
+	<up-popup :show="sucessPopup" mode="center" @close="handleCancelSucess" bgColor="transparent">
+		<view class="sucess-popup" @click="handleCancelSucess">
+			<view class="sucess-bg">
+				<image class="img" :src="`${config.BASIC_IMG}img/subTreePage/blessing-sucess.png`"></image>
+			</view>
+			<view class="button-group" @click="handlePage">
+				<view class="btn">开心收下</view>
+				<up-icon class="close" name="close-circle-fill" size="30" color="rgba(255, 255, 255, 0.7)"></up-icon>
+			</view>
+		</view>
+	</up-popup>
+</template>
+
+<script setup>
+	import config from "@/api/config.js"
+	import {
+		onActivated,
+		onMounted,
+		ref,
+		watch
+	} from "vue";
+
+	const props = defineProps({
+		show: {
+			type: Boolean,
+			defalut: false,
+		},
+		farmBuyId: {
+			type: [Number, String],
+			defalut: "",
+		},
+	});
+
+	const handlePage = () => {
+		// if (userInfo.value.tel) {
+		// 	router.push('/guard_tree')
+		// } else {
+		// 	router.push('/lj_home')
+		// }
+	}
+
+
+	const showPopup = ref(false);
+	const message = ref("");
+	const activeIndex = ref(null);
+	const list = ref([]);
+
+	const handleCancel = () => {
+		activeIndex.value = null;
+		message.value = "";
+		showPopup.value = false;
+	};
+
+	const handleCancelSucess = () => {
+		sucessPopup.value = false;
+	};
+
+	const getRandomPick = () => {
+		list.value = [{
+				id: 1,
+				clockinText: '晨曦微露,阳光洒满大地'
+			},
+			{
+				id: 2,
+				clockinText: '新的一天,新的挑战,新的机会'
+			},
+			{
+				id: 3,
+				clockinText: '记住,每一次挫折都是成功的垫脚石'
+			},
+			{
+				id: 4,
+				clockinText: '道阻且长,行则将至,行而不辍,未来可期。'
+			},
+			{
+				id: 5,
+				clockinText: '每日数据的更替,是日积月累的结果'
+			},
+			{
+				id: 6,
+				clockinText: '不必在意他人目光与期待'
+			}
+		]
+		// VE_API.guard_tree.randomPick({
+		// 	count: 6
+		// }).then(({
+		// 	data
+		// }) => {
+		// 	list.value = data || [];
+		// 	if (activeIndex.value != null) {
+		// 		message.value = data[activeIndex.value].clockinText;
+		// 	}
+		// });
+	};
+
+	const handleMsg = (index, item) => {
+		activeIndex.value = index;
+		message.value = item.clockinText;
+	};
+
+	const sucessPopup = ref(false);
+
+	const handleSend = () => {
+		const params = {
+			farmBuyId: props.farmBuyId,
+			clockinType: 3,
+			msg: message.value,
+		};
+		handleCancel();
+		sucessPopup.value = true;
+		// VE_API.guard_tree.clockin(params).then((res) => {
+		// 	if (res.code === 0) {
+		// 		handleCancel();
+		// 		sucessPopup.value = true;
+		// 	}
+		// });
+	};
+
+	onMounted(() => {
+		getRandomPick();
+	});
+
+	watch(
+		() => props.show,
+		() => {
+			showPopup.value = true;
+		}
+	);
+</script>
+
+<style scoped lang="scss">
+	@import "@/static/style/mixin.scss";
+
+	.blessings-popup {
+		width: 90vw;
+		padding: 40rpx 30rpx;
+		box-sizing: border-box;
+		position: relative;
+
+		&::before {
+			content: '';
+			position: absolute;
+			bottom: 190rpx;
+			right: 0;
+			z-index: 2;
+			@include ossBg("subTreePage/blessing-bg.png");
+			width: 336rpx;
+			height: 336rpx;
+		}
+
+		.blessings-title {
+			font-size: 48rpx;
+			text-align: center;
+			font-family: "PangMenZhengDao";
+		}
+
+		.blessings-cont {
+			margin: 40rpx 0 48rpx;
+
+			.head {
+				display: flex;
+				align-items: center;
+				justify-content: space-between;
+
+				.common-title {
+					display: flex;
+					align-items: center;
+					font-weight: 500;
+
+					.line {
+						width: 8rpx;
+						height: 32rpx;
+						border-radius: 10rpx;
+						background: #F3C11D;
+						margin-right: 14rpx;
+					}
+				}
+
+				.button {
+					font-size: 24rpx;
+					color: #f3c11d;
+					padding: 8rpx 24rpx;
+					border-radius: 40rpx;
+					background: rgba(243, 193, 29, 0.1);
+					border: 1px solid #f3c11d;
+					display: flex;
+					align-items: center;
+					justify-content: center;
+
+					text {
+						margin-left: 10rpx;
+					}
+				}
+			}
+
+			.blessings-list {
+				display: flex;
+				align-items: flex-start;
+				flex-direction: column;
+				padding-bottom: 24rpx;
+				margin-bottom: 24rpx;
+				border-bottom: 1px solid rgba(0, 0, 0, 0.1);
+
+				.blessings-item {
+					font-size: 24rpx;
+					padding: 8rpx 20rpx;
+					border-radius: 40rpx;
+					background: #f4f6f8;
+					margin-top: 20rpx;
+
+					&.active {
+						background: #fff2c4;
+					}
+				}
+			}
+		}
+
+		.blessings-footer {
+			display: flex;
+
+			view {
+				text-align: center;
+				flex: 1;
+				color: #666666;
+				font-size: 32rpx;
+				padding: 16rpx;
+				border: 1px solid #999999;
+				border-radius: 50rpx;
+			}
+
+			.send {
+				margin-left: 26rpx;
+				color: #fff;
+				background-image: linear-gradient(120deg, #ffd887, #ed9e1e);
+				border: none;
+			}
+		}
+	}
+
+	.sucess-popup {
+		width: 100vw;
+		height: 100vh;
+		background: rgba(0, 0, 0, 0.6);
+
+		.sucess-bg {
+			width: 100%;
+			height: 920rpx;
+			@include ossBg("subTreePage/light-effect-bg.png");
+			display: flex;
+			align-items: flex-end;
+			justify-content: center;
+
+			.img {
+				width: 82%;
+				height: 410rpx;
+			}
+		}
+
+		.button-group {
+			margin: 46rpx auto;
+			width: 312rpx;
+			.btn {
+				font-size: 44rpx;
+				padding: 20rpx 0;
+				border-radius: 50rpx;
+				font-family: "PangMenZhengDao";
+				color: #954600;
+				background: linear-gradient(120deg, #FFE6B2, #FFC339);
+				text-align: center;
+			}
+			.close{
+				margin-top: 80rpx;
+				justify-content: center;
+			}
+		}
+	}
+	
+</style>

+ 12 - 4
pages/tabBar/tree/subPages/friendTree.vue

@@ -13,7 +13,7 @@
 			</view>
 		</view>
 		<view class="tree-footer">
-			<view class="blessing">
+			<view class="blessing" @click="handleBlessing">
 				<image class="icon" :src="`${config.BASIC_IMG}img/treePage/b-tree-icon-2.png`"></image>
 				<text>送ta祝福</text>
 			</view>
@@ -21,17 +21,25 @@
 		</view>
 	</view>
 	<!-- 编辑树名称 -->
-	<editNamePopup></editNamePopup>
+	<editNamePopup></editNamePopup>
+	<!-- 祝福弹窗 -->
+	<blessingsPopup :show="showBlessingsPopup"></blessingsPopup>
 </template>
 
 <script setup>
 	import config from "@/api/config.js"
-	import memberLevel from "../components/memberLevel.vue"
+	import memberLevel from "../components/memberLevel.vue"
+	import blessingsPopup from "../components/blessingsPopup.vue"
 	import {
 		ref,
 		reactive,
 		onMounted
-	} from 'vue';
+	} from 'vue';
+	
+	const showBlessingsPopup = ref(false)
+	const handleBlessing = () => {
+		showBlessingsPopup.value = !showBlessingsPopup.value
+	}
 
 	const toolList = [{
 			name: "相册",

+ 246 - 0
pages/tabBar/tree/subPages/gift.vue

@@ -0,0 +1,246 @@
+<template>
+	<view class="sub-base-container">
+		<view class="gift-title">
+			<view class="name">
+				<view class="txt">守护等级规则</view>
+				<text>积累能量升等级 获大礼</text>
+			</view>
+			<image class="icon" :src="`${config.BASIC_IMG}img/subTreePage/energy-icon.png`"></image>
+		</view>
+		<view class="gift-card energy-card">
+			<view class="gift-name">已打卡 <text>2</text>/7 天</view>
+			<div class="tips">
+				<text>再连续签到5天,获得</text>
+				<!-- <img src="@/assets/img/guard_tree/leaf-icon.png" alt="" /> -->
+				<text class="score">+30</text>
+			</div>
+			<div class="check-wrap">
+				<div :class="['check-day',{active:item.check}]" v-for="(item, index) in checkDay" :key="index">
+					<view class="leaf">
+						<image class="icon"
+							:src="`${config.BASIC_IMG}img/subTreePage/${item.check?'white-leaf':'leaf-icon'}.png`" alt="">
+						</image>
+						<text>x20</text>
+					</view>
+					<div>第{{item.day}}天</div>
+				</div>
+			</div>
+		</view>
+		<view class="gift-card">
+			<view class="card-title">守护等级划分</view>
+			<view class="card-desc">守护等级共有5个等级,您的守护等级会根据您累计的能量值决定的,当您的能量值达到相应的要求即可升级并获得相对应礼物,不同等级的用户获得礼物不同。</view>
+			<view class="card-table">
+				<view class="table-item" v-for="(item,index) in tableList" :key="index">
+					<view class="levle">{{item.level}}等级</view>
+					<view>{{item.text}}</view>
+					<view class="gift">{{item.gift}}</view>
+				</view>
+			</view>
+		</view>
+		<view class="gift-card">
+			<view class="card-title">积累能量规则</view>
+			<view class="card-desc">每日登录会积累相应的能量,连续登录天数越高能量值越高,每天可以通过做任务增加能量值,每日阳光可以获得 10 能量,分享转发可以获得 10 能量,送ta祝福可以获得 10
+				能量,水果订购一次,可以获得 100 能量,但是需要扫描箱内溯源卡的二维码领取。</view>
+		</view>
+	</view>
+</template>
+
+<script setup>
+	import config from "@/api/config.js"
+
+	const checkDay = [{
+			day: 1,
+			check: true
+		},
+		{
+			day: 2,
+			check: false
+		},
+		{
+			day: 3,
+			check: false
+		},
+		{
+			day: 4,
+			check: false
+		},
+		{
+			day: 5,
+			check: false
+		},
+		{
+			day: 6,
+			check: false
+		},
+		{
+			day: 7,
+			check: false
+		}
+	]
+
+	const tableList = [{
+			level: '平民',
+			text: '无要求',
+			gift: '无礼品'
+		},
+		{
+			level: '青铜',
+			text: '达到300能量',
+			gift: '一份曲奇'
+		},
+		{
+			level: '白银',
+			text: '达到600能量',
+			gift: '一份精美水果'
+		},
+		{
+			level: '赤金',
+			text: '达到900能量',
+			gift: '一份荔枝'
+		},
+		{
+			level: '星勋',
+			text: '达到1200能量',
+			gift: '一份荔枝'
+		}
+	]
+</script>
+
+<style lang="scss" scoped>
+	@import "@/static/style/mixin.scss";
+
+	.sub-base-container {
+		@include ossBg("subTreePage/gift-bg.png");
+		padding: 12rpx 20rpx;
+
+		.gift-title {
+			display: flex;
+			align-items: center;
+			justify-content: space-between;
+			padding: 0 14rpx;
+
+			.name {
+				color: rgba(0, 0, 0, 0.5);
+				font-size: 28rpx;
+
+				.txt {
+					font-size: 60rpx;
+					font-family: 'PangMenZhengDao';
+					color: #000;
+				}
+			}
+
+			.icon {
+				width: 212rpx;
+				height: 222rpx;
+			}
+		}
+
+		.energy-card {
+			margin-top: -10rpx;
+			position: relative;
+			z-index: 2;
+
+			.gift-name {
+				font-weight: 500;
+
+				text {
+					color: #F3B242;
+				}
+			}
+
+			.tips {
+				font-size: 24rpx;
+				color: rgba(0, 0, 0, 0.4);
+
+				.score {
+					color: #D9AB14;
+				}
+			}
+
+			.check-wrap {
+				margin: 28rpx 0 20rpx 0;
+				display: flex;
+
+				.check-day {
+					flex: 1;
+					padding: 8px 0;
+					font-size: 12px;
+					color: #F3B242;
+					background: rgba(185, 185, 185, 0.1);
+					border-radius: 5px;
+					text-align: center;
+
+					&.active {
+						background-image: linear-gradient(120deg, #FFD887, #ED9E1E);
+						color: #fff;
+					}
+
+					.leaf {
+						font-size: 20rpx;
+						display: flex;
+						justify-content: center;
+						align-items: center;
+						.icon{
+							width: 32rpx;
+							height: 28rpx;
+							margin-bottom: 10rpx;
+						}
+					}
+				}
+
+				.check-day+.check-day {
+					margin-left: 5px;
+				}
+			}
+		}
+
+		.gift-card {
+			border-radius: 16rpx;
+			background: #fff;
+			padding: 20rpx;
+
+			.card-title {
+				font-weight: 500;
+			}
+
+			.card-desc {
+				margin-top: 10rpx;
+				line-height: 36rpx;
+				font-size: 24rpx;
+			}
+
+			.card-table {
+				margin-top: 20rpx;
+
+				.table-item {
+					display: flex;
+					background: rgba(243, 193, 29, 0.07);
+
+					.levle {
+						background: rgba(243, 193, 29, 0.12);
+					}
+
+					.gift {
+						color: #CC9D00;
+					}
+
+					view {
+						flex: 1;
+						padding: 30rpx 0;
+						text-align: center;
+						font-size: 28rpx;
+					}
+				}
+
+				.table-item+.table-item {
+					border-top: 2rpx solid rgba(0, 0, 0, 0.06);
+				}
+			}
+		}
+
+		.gift-card+.gift-card {
+			margin-top: 20rpx;
+		}
+	}
+</style>

+ 4 - 2
pages/tabBar/tree/tree.vue

@@ -8,7 +8,8 @@
 			<image class="drone-icon" :src="`${config.BASIC_IMG}img/treePage/drone-icon.png`"></image>
 			<view class="tool-wrap">
 				<view class="tool-left">
-					<view :class="['tool-item',item.className]" v-for="(item,index) in toolLeftList" :key="index">
+					<view :class="['tool-item',item.className]" v-for="(item,index) in toolLeftList" :key="index"
+						@click="handleToolItem(item)">
 						<image class="icon" :src="`${config.BASIC_IMG}img/treePage/l-tree-icon-${index+1}.png`"></image>
 						<view class="name">{{item.name}}</view>
 					</view>
@@ -73,7 +74,8 @@
 		},
 		{
 			name: "礼物",
-			className: 'gift'
+			className: 'gift',
+			path: 'gift'
 		}
 	]
 	const toolRightList = [{