16cb822bf0e6c6dac2a9d0663efe93107ada9093..829a82272bedd358d5902df42327282cf8dcd2c5
2026-08-27 lefengyang
增加"下移"
829a82 diff | tree
2026-08-27 lefengyang
颜色选择器
3701d6 diff | tree
2026-08-27 lefengyang
复制帧功能
6ff51a diff | tree
2026-08-27 lefengyang
预制动画显示共多少帧
4ff2cd diff | tree
1 files modified
113 ■■■■ changed files
ledApp/pages/addTemplate/addTemplate.vue 113 ●●●● patch | view | raw | blame | history
ledApp/pages/addTemplate/addTemplate.vue
@@ -37,7 +37,11 @@
                </view>
                <view class="item">
                    <uv-radio-group v-model="selectedPreset" placement="column" @change="changePreset" labelSize="26rpx">
                        <uv-radio class="spec_radio" v-for="(item, index) in presetList" :key="index" :label="'预制动画:'+item.name"
                        <uv-radio
                            class="spec_radio"
                            v-for="(item, index) in presetList"
                            :key="index"
                            :label="'预制动画:'+item.name+'('+item.fpsTotal+'帧)'"
                            :name="item.name">
                        </uv-radio>
                    </uv-radio-group>
@@ -103,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>
@@ -146,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>
@@ -187,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>
        
        <!-- 添加文字弹窗 -->
@@ -299,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:{},
@@ -599,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() {
@@ -719,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;
            },
@@ -761,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('*');
@@ -1200,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 {
@@ -1399,7 +1444,11 @@
            }
            .item {}
            .item {
                flex-direction:row;
                gap:20rpx;
                display:flex;
            }
        }
        .temp_item {