Ver código fonte

feat:添加排名页面和编辑木牌弹窗

wangsisi 1 dia atrás
pai
commit
a500d2ee06

+ 154 - 0
components/editNamePopup/editNamePopup.vue

@@ -0,0 +1,154 @@
+<template>
+    <up-popup :show="showBoardPopup" closeable mode="center" round="8" @close="closePopup">
+        <view class="board-popup">
+            <view class="name">编辑木牌</view>
+            <view class="board-content">
+                <view class="board-img">
+                    <view class="tag-img">
+                        <view class="tag-content">
+                            <view class="tag-name">【{{ editForm?.treeName || '茜茜荔' }}】</view>
+                        </view>
+                    </view>
+                </view>
+                <view class="edit-form">
+                    <view class="form-item">
+                        <view class="item-name">树名</view>
+						<up-input
+						    placeholder="请输入树名"
+						    border="none"
+						    v-model="editForm.treeName"
+							maxlength="4"
+						  ></up-input>
+                    </view>
+                    <view class="form-item">
+                        <view class="item-name">守护时间</view>
+						<up-input
+						    border="none"
+						    v-model="editForm.createDate"
+							readonly
+						  ></up-input>
+                    </view>
+                </view>
+				<up-button shape="circle" type="primary" text="确认修改" @click="onSubmit"></up-button>
+            </view>
+        </view>
+    </up-popup>
+</template>
+
+<script setup>
+import { ref, reactive } from "vue";
+
+const showBoardPopup = ref(false);
+
+function showPopup({id, treeName, nickname, showName, createDate}) {
+    editForm.id = id
+    editForm.showName = showName
+    editForm.treeName = treeName
+    editForm.nickname = nickname
+    editForm.createDate = createDate
+    showBoardPopup.value = true
+}
+
+const editForm = reactive({
+    id: null,
+    treeName: "",
+    nickname: "",
+    showName: 1,
+    createDate: "2025.06.18"
+})
+
+function onSubmit() {
+    VE_API.guard_tree.updateTreeName(editForm).then(({ code }) => {
+        // code === 0 && ElMessage.success("编辑成功");
+        showBoardPopup.value = false
+        emit("editEnd")
+    });
+}
+const emit = defineEmits(["editEnd"])
+defineExpose({ showPopup });
+
+const closePopup = () =>{
+	showBoardPopup.value = false
+}
+</script>
+
+<style lang="scss" scoped>
+@import "@/static/style/mixin.scss";
+.board-popup {
+    width: 85vw;
+	padding: 40rpx;
+	box-sizing: border-box;
+	@include ossBg("treePage/popup-mask.png");
+    .name {
+        font-size: 48rpx;
+        margin-bottom: 24rpx;
+        text-align: center;
+        font-family: "PangMenZhengDao";
+    }
+    .button {
+        margin-top: 48rpx;
+        color: #fff;
+        padding: 16rpx;
+        text-align: center;
+        background: #2199f8;
+        border-radius: 4rpx;
+    }
+
+    .board-content {
+        .board-img {
+            width: 100%;
+            height: 320rpx;
+			@include ossBg("treePage/tree-bg.png");
+            border-radius: 16rpx;
+            position: relative;
+            .tag-img {
+                position: absolute;
+                left: 50%;
+                transform: translateX(-50%);
+                bottom: 0;
+                .tag-content {
+					@include ossBg("treePage/tag-bg.png");
+                    width: 276rpx;
+                    height: 274rpx;
+                    display: flex;
+                    flex-direction: column;
+                    align-items: center;
+                    color: #fff;
+                    .tag-name {
+                        font-family: "jiangxizhuokai";
+                        font-size: 44rpx;
+                        padding-top: 66rpx;
+                        ::v-deep {
+                            .el-input__wrapper {
+                                background: transparent;
+                                box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.6) inset;
+                            }
+                            .el-input__inner {
+                                color: #fff;
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        .edit-form {
+            padding: 12px 0;
+            .form-item {
+                display: flex;
+                align-items: center;
+                height: 46px;
+                .item-name {
+                    width: 72px;
+                    flex: none;
+                    font-size: 16px;
+                    color: #8F8F8F;
+                    line-height: 30px;
+                }
+            }
+            .form-item + .form-item {
+                border-top: 0.5px solid rgba(0, 0, 0, 0.1);
+            }
+        }
+    }
+}
+</style>

+ 139 - 11
pages/tabBar/tree/subPages/rank.vue

@@ -1,13 +1,141 @@
-<template>
-	<view class="sub-base-container">
-		123
-	</view>
-</template>
-
+<template>
+	<view class="sub-base-container">
+		<view class="gradient-reflection" data-text="好友排行榜">好友排行榜</view>
+		<view class="rank-card">
+			<view class="tabs">
+				<view :class="['tab-item',{active:active === index}]" v-for="(item,index) in tabsList" :key="index" @click="handleTab(index)">{{item}}</view>
+			</view>
+			<view class="rank-list">
+				<view :class="['rank-item',{bg:(index + 1) <=3}]" v-for="(item,index) in 7" :key="index">
+					<view class="rank-info">
+						<text class="num">{{item}}</text>
+						<up-image class="avatar" :fade="false"
+							src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png" width="92rpx"
+							height="92rpx" shape="circle"></up-image>
+						<view class="info">
+							<view class="name">
+								<text>茜茜荔</text>
+								<view :class="['level',{levelBlue:(index + 1) <=3}]">V4.星勋</view>
+							</view>
+							<text class="nickname">昵称:听妈妈的话</text>
+						</view>
+					</view>
+					<view class="button">去看看</view>
+				</view>
+			</view>
+		</view>
+	</view>
+</template>
+
 <script setup>
-
-</script>
-
+	import {ref} from "vue"
+	
+	const active = ref(0)
+	const tabsList = ["总榜","桃子","葡萄","香蕉","荔枝"]
+	const handleTab = (index) =>{
+		active.value = index
+	}
+</script>
+
 <style lang="scss" scoped>
-
-</style>
+	@import "@/static/style/mixin.scss";
+	.sub-base-container {
+		@include ossBg("subTreePage/rank-bg.png");
+		.gradient-reflection {
+			width: 100%;
+			position: relative;
+			font-size: 86rpx;
+			color: #fff;
+			font-family: "PangMenZhengDao";
+			text-align: center;
+		}
+
+		.gradient-reflection::after {
+			content: attr(data-text);
+			position: absolute;
+			top: 75%;
+			left: calc(50% - 430rpx / 2);
+			transform: scaleY(-1);
+			background: rgba(255, 255, 255, 0.5);
+			-webkit-background-clip: text;
+			background-clip: text;
+			color: transparent;
+			opacity: 0.5;
+		}
+		
+		.rank-card{
+			margin-top: 90rpx;
+			background: rgba(255, 255, 255, 0.74);
+			border-radius: 20rpx 20rpx 0 0;
+			padding: 20rpx;
+			.tabs{
+				display: flex;
+				.tab-item{
+					flex: 1;
+					text-align: center;
+					color: rgba(0, 0, 0, 0.5);
+					font-size: 28rpx;
+					padding: 10rpx 0;
+					&.active{
+						border-radius: 50rpx;
+						color: #000;
+						background: #fff;
+					}
+				}
+			}
+			.rank-list{
+				.rank-item{
+					display: flex;
+					align-items: center;
+					justify-content: space-between;
+					padding: 14rpx 20rpx;
+					border-radius: 10rpx;
+					margin-top: 20rpx;
+					&.bg{
+						background-image: linear-gradient(90deg,rgba(255,255,255,0.6),transparent);
+					}
+					.rank-info{
+						display: flex;
+						align-items: center;
+						font-size: 24rpx;
+						.num{
+							margin-right: 28rpx;
+						}
+						.info{
+							margin-left: 10rpx;
+							.name{
+								font-size: 28rpx;
+								font-weight: 500;
+								display: flex;
+								align-items: center;
+								margin-bottom: 4rpx;
+							}
+							.level{
+								background: rgba(81, 81, 81, 0.1);
+								color: #444444;
+								border-radius: 4rpx;
+								font-size: 24rpx;
+								padding: 4rpx 10rpx;
+								margin-left: 20rpx;
+								&.levelBlue{
+									background: #fff;
+									color: #2199F8;
+								}
+							}
+							.nickname{
+								color: rgba(0, 0, 0, 0.5);
+							}
+						}
+					}
+					.button{
+						font-size: 24rpx;
+						padding: 10rpx 20rpx;
+						border-radius: 50rpx;
+						border: 2rpx solid rgba(0, 0, 0, 0.3);
+						background: #fff;
+					}
+				}
+			}
+		}
+	}
+</style>

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

@@ -62,6 +62,8 @@
 	</view>
 	<!-- 切换 -->
 	<up-picker :show="showPicker" :columns="columns" :defaultIndex="[0]" @cancel="handleCancel" @confirm="handleConfirm"></up-picker>
+	<!-- 编辑树名称 -->
+	<editNamePopup></editNamePopup>
 </template>
 
 <script setup>

+ 5 - 0
static/style/common.scss

@@ -24,6 +24,11 @@
   src: url("https://birdseye-img.sysuimars.com/youwei-uniapp/font/PangMenZhengDao.TTF");
 }
 
+@font-face {
+  font-family: "jiangxizhuokai";
+  src: url("https://birdseye-img.sysuimars.com/youwei-uniapp/font/jiangxizhuokai.ttf");
+}
+
 .ellipsis-l2 {
 	white-space: pre-line;
 	overflow: hidden;