From 829a82272bedd358d5902df42327282cf8dcd2c5 Mon Sep 17 00:00:00 2001
From: lefengyang <lefengyang@tencent.com>
Date: Thu, 27 Aug 2026 20:42:10 +0800
Subject: [PATCH] 增加"下移"

---
 ledApp/pages/addTemplate/addTemplate.vue |  107 ++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 76 insertions(+), 31 deletions(-)

diff --git a/ledApp/pages/addTemplate/addTemplate.vue b/ledApp/pages/addTemplate/addTemplate.vue
index 73e246c..e28e928 100644
--- a/ledApp/pages/addTemplate/addTemplate.vue
+++ b/ledApp/pages/addTemplate/addTemplate.vue
@@ -107,6 +107,7 @@
 				</view>
 				<view class="item">
 					<uv-button text="编辑" @click="popupAnimationOpen(index)" shape="circle" size="small" color="linear-gradient( 142deg, #6FD2FF 0%, #268DFF 100%)"></uv-button>
+					<uv-button text="复制" @click="copyFrame(index)" shape="circle" size="small" color="linear-gradient( 142deg, #FFB347 0%, #FF8C00 100%)"></uv-button>
 				</view>
 			</view>
 		</view>
@@ -150,9 +151,10 @@
 
 				<!-- 动画按钮 -->
 				<view class="controls" v-if="showControls">
-					<uv-button type="primary" :plain="true" text="分辨率" @click="changeRatio()"></uv-button>
+					<!-- <uv-button type="primary" :plain="true" text="分辨率" @click="changeRatio()"></uv-button> -->
 					<uv-button type="primary" :plain="true" text="颜色" @click="changeColor()"></uv-button>
 					<uv-button type="primary" :plain="true" text="左移" @click="shiftLeft()"></uv-button>
+					<uv-button type="primary" :plain="true" text="下移" @click="shiftDown()"></uv-button>
 					<uv-button type="primary" :plain="true" text="右移" @click="shiftRight()"></uv-button>
 					<uv-button type="primary" :plain="true" text="文字" @click="addText()"></uv-button>
 					<uv-button type="primary" :plain="true" text="清除" @click="clear()"></uv-button>
@@ -191,11 +193,21 @@
 		<!-- 分辨率 -->
 		<uv-picker ref="pickerRatio" :columns="columnsRatio" @confirm="confirmRatio"></uv-picker>
 		
-		<!-- 颜色 -->
+		<!-- 颜色选择器 -->
 		<uv-popup ref="pickerColor" mode="bottom" round="10" :closeable="true">
-			<view class="color_list">
-				<view class="color_item" v-for="(item, index) in colorList" :class="{ hover: color === item }" :key="index" :style="{ backgroundColor: item }" @click="clickColor(item)"></view>
-			</view>
+			<scroll-view scroll-y :show-scrollbar="false" class="color-picker-scroll">
+				<view class="color-picker-wrapper">
+					<view class="color-picker-inner">
+						<x-color-picker
+							v-model="color"
+							:show-alpha="false"
+							:save-history="true"
+							:options="pickerOptions"
+							@confirm="onColorConfirm"
+							@cancel="onColorCancel" />
+					</view>
+				</view>
+			</scroll-view>
 		</uv-popup>
 		
 		<!-- 添加文字弹窗 -->
@@ -303,17 +315,11 @@
 				// columnsRatio: [
 				// 	['12*24']
 				// ],
-				colorList: [
-					'#FF0000',
-					'#00FF00',
-					'#0000FF',
-					'#FFFF00',
-					'#FFA500',
-					'#800080',
-					'#00FFFF',
-					'#FFC0CB'
-				],
-				fpsIndex: 0,
+				color: '#FF0000',
+				gridRect: null,
+				pickerOptions: {
+					width: '50%',
+				},
 				fpsList: [],
 				tId: '',
 				tempInfo:{},
@@ -603,9 +609,11 @@
 			changeColor() {
 				this.$refs.pickerColor.open();
 			},
-			clickColor(item) {
-				console.log('confirmColor---', item);
-				this.color = item;
+			onColorConfirm(colorObj) {
+				this.color = colorObj.hex;
+				this.$refs.pickerColor.close();
+			},
+			onColorCancel() {
 				this.$refs.pickerColor.close();
 			},
 			changeRatio() {
@@ -723,6 +731,21 @@
 					}
 				}
 			},
+			shiftDown() {
+				const colCount = this.width * (this.modeVal == 2 ? 10 : 1)
+				const lastRowStart = (this.height - 1) * colCount
+				const lastRow = this.pixelData.slice(lastRowStart, lastRowStart + colCount)
+				for (let r = this.height - 1; r > 0; r--) {
+					const currentStart = r * colCount
+					const prevStart = (r - 1) * colCount
+					for (let c = 0; c < colCount; c++) {
+						this.$set(this.pixelData, currentStart + c, this.pixelData[prevStart + c])
+					}
+				}
+				for (let c = 0; c < colCount; c++) {
+					this.$set(this.pixelData, c, lastRow[c])
+				}
+			},
 			toggleControls() {
 				this.showControls = !this.showControls;
 			},
@@ -765,6 +788,26 @@
 				const colCount = this.width * (this.modeVal == 2 ? 10 : 1)
 				this.pixelData = new Array(this.height * colCount).fill('')
 			},
+			// 复制当前帧
+			copyFrame(index) {
+				uni.showModal({
+					title: '提示',
+					content: '确定要复制当前帧吗?',
+					success: (res) => {
+						if (res.confirm) {
+							const source = this.fpsList[index];
+							const copy = source ? [...source] : null;
+							this.fpsList.splice(index + 1, 0, copy);
+							this.total = this.fpsList.length;
+							uni.showToast({
+								title: '复制成功',
+								icon: 'success',
+								duration: 1500
+							});
+						}
+					}
+				});
+			},
 			// 屏幕规格
 			changeSpec(e) {
 				const ratio = e.split('*');
@@ -1204,20 +1247,18 @@
 		justify-content: center;
 		margin-bottom: 15rpx;
 	}
-	.color_list {
-		width: 100%;
+	.color_picker_wrapper {
+		padding: 30rpx 0;
 		display: flex;
 		justify-content: center;
-		flex-wrap: wrap;
-		gap: 30rpx;
+	}
+	.color-picker-scroll {
+		max-height: 90vh;
 		box-sizing: border-box;
-		padding: 50rpx;
-	
-		.color_item {
-			width: 30rpx;
-			height: 30rpx;
-			border-radius: 5rpx;
-		}
+	}
+	.color-picker-wrapper {
+		zoom: 0.5;
+		padding: 0 25%;
 	}
 	
 	.action_btn {
@@ -1403,7 +1444,11 @@
 
 			}
 
-			.item {}
+			.item {
+				flex-direction:row;
+				gap:20rpx;
+				display:flex;
+			}
 		}
 
 		.temp_item {

--
Gitblit v1.10.0