feat(P4): precompute移植+app.js sources双向回填+回归1003/1003+验收体积/文件/data.json
Deploy to GitHub Pages / deploy (push) Failing after 16s
Regression / regression (push) Failing after 15m2s

This commit is contained in:
aurora-admin
2026-09-12 14:18:41 +08:00
parent 16f365a045
commit c65a69c34e
401 changed files with 22932 additions and 140 deletions
+55
View File
@@ -0,0 +1,55 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Aurora Admin · Carousel(普通 H5)</title>
<link rel="stylesheet" href="../.design_library/aurora-admin/colors_and_type.css" />
<link rel="stylesheet" href="Carousel.css" />
<style>body{margin:0;padding:24px;background: var(--au-color-page-bg);}</style>
</head>
<body>
<div class="aa-carousel" id="app"></div>
<script>
var DATA = [
{ text: '促销活动一', color: '#2F54EB' },
{ text: '新品上市', color: '#13C2C2' },
{ text: '会员专享', color: '#722ED1' },
{ text: '限时秒杀', color: '#8C5A00' }
];
var index = 0, timer = null;
function render() {
var root = document.getElementById('app');
var slides = DATA.map(function (d) {
return '<div class="aa-carousel-slide" style="background:' + d.color + '">' + d.text + '</div>';
}).join('');
var dots = DATA.map(function (_, i) {
return '<span class="aa-carousel-dot ' + (i === index ? 'is-active' : '') + '" role="tab" tabindex="0" data-i="' + i + '"></span>';
}).join('');
root.innerHTML = '<div class="aa-carousel-track" style="transform:translateX(-' + (index * 100) + '%)">' + slides + '</div>' +
'<button class="aa-carousel-arrow prev">‹</button>' +
'<button class="aa-carousel-arrow next">›</button>' +
'<div class="aa-carousel-dots">' + dots + '</div>';
root.querySelector('.prev').onclick = function () { go(index - 1); };
root.querySelector('.next').onclick = function () { go(index + 1); };
root.querySelectorAll('.aa-carousel-dot').forEach(function (d) {
d.onclick = function () { go(parseInt(d.dataset.i, 10)); };
});
}
function go(i) {
index = (i + DATA.length) % DATA.length;
render();
restart();
}
function restart() {
if (timer) clearInterval(timer);
timer = setInterval(function () { go(index + 1); }, 3000);
}
render();
restart();
</script>
</body>
</html>
+36
View File
@@ -0,0 +1,36 @@
import React, { useState, useEffect } from 'react';
import './Carousel.css';
export default function Carousel({ items = [], autoplay = true, interval = 3000, onChange }) {
const [index, setIndex] = useState(0);
const len = items.length || 1;
function go(i) {
const next = (i + len) % len;
setIndex(next);
onChange && onChange(next);
}
useEffect(() => {
if (!autoplay || items.length < 2) return;
const t = setInterval(() => go(index + 1), interval);
return () => clearInterval(t);
// eslint-disable-next-line
}, [index, autoplay, interval, items.length]);
return (
<div className="aa-carousel">
<div className="aa-carousel-track" style={{ transform: `translateX(-${index * 100}%)` }}>
{items.map((s, i) => (
<div className="aa-carousel-slide" key={i} style={{ background: s.color }}>{s.text}</div>
))}
</div>
<button className="aa-carousel-arrow prev" onClick={() => go(index - 1)}>‹</button>
<button className="aa-carousel-arrow next" onClick={() => go(index + 1)}>›</button>
<div className="aa-carousel-dots">
{items.map((_, i) => (
<span key={i} className={'aa-carousel-dot' + (i === index ? ' is-active' : '')} onClick={() => go(i)} />
))}
</div>
</div>
);
}
+43
View File
@@ -0,0 +1,43 @@
<template>
<div class="aa-carousel">
<div class="aa-carousel-track" :style="{ transform: 'translateX(-' + index * 100 + '%)' }">
<div class="aa-carousel-slide" v-for="(s, i) in items" :key="i" :style="{ background: s.color }">{{ s.text }}</div>
</div>
<button class="aa-carousel-arrow prev" @click="go(index - 1)">‹</button>
<button class="aa-carousel-arrow next" @click="go(index + 1)">›</button>
<div class="aa-carousel-dots">
<span class="aa-carousel-dot" v-for="(s, i) in items" :key="i"
:class="{ 'is-active': i === index }" @click="go(i)"></span>
</div>
</div>
</template>
<script>
export default {
name: 'AaCarousel',
props: {
items: { type: Array, default: function () { return []; } },
autoplay: { type: Boolean, default: true },
interval: { type: Number, default: 3000 }
},
data: function () { return { index: 0, timer: null }; },
methods: {
go: function (i) {
var len = this.items.length || 1;
this.index = (i + len) % len;
this.restart();
},
restart: function () {
if (this.timer) clearInterval(this.timer);
var self = this;
if (this.autoplay && this.items.length > 1) {
this.timer = setInterval(function () { self.go(self.index + 1); }, this.interval);
}
}
},
mounted: function () { this.restart(); },
beforeDestroy: function () { if (this.timer) clearInterval(this.timer); }
};
</script>
<style src="./Carousel.css"></style>
+39
View File
@@ -0,0 +1,39 @@
<template>
<div class="aa-carousel">
<div class="aa-carousel-track" :style="{ transform: `translateX(-${index * 100}%)` }">
<div class="aa-carousel-slide" v-for="(s, i) in items" :key="i" :style="{ background: s.color }">{{ s.text }}</div>
</div>
<button class="aa-carousel-arrow prev" @click="go(index - 1)">‹</button>
<button class="aa-carousel-arrow next" @click="go(index + 1)">›</button>
<div class="aa-carousel-dots">
<span class="aa-carousel-dot" v-for="(s, i) in items" :key="i"
:class="{ 'is-active': i === index }" @click="go(i)"></span>
</div>
</div>
</template>
<script setup>
import { ref, onMounted, onBeforeUnmount } from 'vue';
const props = defineProps({
items: { type: Array, default: () => [] },
autoplay: { type: Boolean, default: true },
interval: { type: Number, default: 3000 }
});
const index = ref(0);
let timer = null;
function go(i) {
const len = props.items.length || 1;
index.value = (i + len) % len;
restart();
}
function restart() {
if (timer) clearInterval(timer);
if (props.autoplay && props.items.length > 1) {
timer = setInterval(() => go(index.value + 1), props.interval);
}
}
onMounted(restart);
onBeforeUnmount(() => { if (timer) clearInterval(timer); });
</script>
<style src="./Carousel.css"></style>