refactor: 确立独立子工程架构 (backend, admin, mpuniapp) 并同步更新 AGENTS.md 规范

这个提交包含在:
wikiboss
2026-09-20 17:05:22 +08:00
父节点 de3cf8b870
当前提交 9fa1d1fbd0
共有 1679 个文件被更改,包括 204798 次插入 和 16817 次删除

查看文件

@@ -0,0 +1,133 @@
describe('/pages/CSS/overflow/overflow-visible-event.uvue', () => {
const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
const isAndroid = platformInfo.startsWith('android')
const isIos = platformInfo.startsWith('ios')
if(isIos && platformInfo.indexOf('12.4') != -1){
// TODO: 排查 ios 不兼容版本 测试异常原因
it('ios 12.4 测试异常', () => {
expect(1).toBe(1)
})
return
}
if (!(isIos || isAndroid)) {
it('dummyTest', async () => {
expect(1).toBe(1)
})
return
}
let page;
let res;
beforeAll(async () => {
page = await program.reLaunch('/pages/CSS/overflow/overflow-visible-event')
await page.waitFor(600);
})
beforeEach(async () => {
await page.setData({
data:{
jest_result: false,
jest_click_x: -1,
jest_click_y: -1
}
})
});
it('Check Overflow Visible Part Click', async () => {
res = await page.callMethod('jest_getRect')
const point_x = await page.data('data.jest_click_x');
const point_y = await page.data('data.jest_click_y');
if (isAndroid){
await program.adbCommand("input tap" + " " + point_x + " " + point_y)
} else {
await program.tap({x: point_x, y: point_y})
}
await page.waitFor(500);
res = await page.data('data.jest_result');
expect(res).toBe(true)
});
// 此测试针对开发者使用 translate 移动view
it('Check Overflow Visible Part Use translate Drag', async ()=> {
await page.callMethod('jest_getRect')
const point_x = await page.data('data.jest_click_x');
const point_y = await page.data('data.jest_click_y');
const distance = 100;
const destY = point_y + 100
const duration = 1000
if (isAndroid) {
await program.adbCommand("input swipe" + " " + point_x + " " + point_y + " " + point_x + " " + destY + " " + duration)
} else {
await program.swipe({
startPoint: {
x: point_x,
y: point_y
},
endPoint: {
x: point_x,
y: destY
},
duration: duration
})
}
await page.waitFor(1500);
await page.callMethod('jest_getParentRect')
const currentParentTop = await page.data('data.jest_parent_top');
const offset = 4
const diff = Math.abs(currentParentTop - distance) < offset
console.log("current ", currentParentTop);
console.log("diff", diff);
expect(diff).toBe(true)
})
it('Check Overflow Visible Block View Click', async () => {
await page.callMethod('jest_getAbsoluteViewRect')
const point_x = await page.data('data.jest_click_x');
const point_y = await page.data('data.jest_click_y');
console.log("input tap" + " " + point_x + " " + point_y);
if (isAndroid) {
await program.adbCommand("input tap" + " " + point_x + " " + point_y)
} else {
await program.tap({x: point_x, y: point_y})
}
await page.waitFor(500);
res = await page.data('data.jest_result');
expect(res).toBe(true)
})
it('Check Overflow Visible Deep Level Click', async () => {
await page.callMethod('jest_scrollToDeepOverflow')
await page.waitFor(500);
const point_x = await page.data('data.jest_click_x');
const point_y = await page.data('data.jest_click_y');
console.log("input tap" + " " + point_x + " " + point_y);
if (isAndroid) {
await program.adbCommand("input tap" + " " + point_x + " " + point_y)
} else {
await program.tap({x: point_x, y: point_y})
}
await page.waitFor(500);
res = await page.data('data.jest_result');
expect(res).toBe(true)
await page.callMethod('jest_restScorllView')
await page.waitFor(500);
})
it('Check Overflow Visible Z-Index Click', async () => {
await page.callMethod('jest_scrollToZIndexOverflow')
await page.waitFor(500);
const point_x = await page.data('data.jest_click_x');
const point_y = await page.data('data.jest_click_y');
console.log("input tap" + " " + point_x + " " + point_y);
if (isAndroid) {
await program.adbCommand("input tap" + " " + point_x + " " + point_y)
} else {
await program.tap({x: point_x, y: point_y})
}
await page.waitFor(500);
res = await page.data('data.jest_result');
expect(res).toBe(true)
await page.callMethod('jest_restScorllView')
await page.waitFor(500);
})
});

查看文件

@@ -0,0 +1,246 @@
<template>
<!-- #ifdef APP && !VUE3-VAPOR -->
<scroll-view style="flex: 1;">
<!-- #endif -->
<view>
<page-intro content="本页演示 overflow: visible 下的事件行为:子元素超出父区域时点击仍可触发 click/touch 事件;与 position:absolute 遮挡时的点击顺序、hover-class、多层级 overflow:visible、以及 overflow:visible 与 z-index 组合时的事件触发。"></page-intro>
<text style="font-size: 15px;">overflow=visible 父view(绿色),子view(红色),点击超出父view区域的部分也可触发事件。</text>
<view class="backgroundview">
<view id="parent" class="box-visible-border-radius">
<view id="child" style="width: 50px; height: 150px; background-color: red;" @click="handleClickOverflowPart"
@touchmove="handleTouchMoveOverflowPart" @touchstart="handleTouchStartOverflowPart"
@touchend="handleTouchEndOverflowPart">
</view>
</view>
</view>
<text style="font-size: 15px;">overflow=visible组件的子view (绿色)被position:
absolute的view(红色)遮挡时,点击事件测试。</text>
<view style="width: 300px;height: 300px;background-color: white;">
<view style="overflow:visible;height: 100px;width: 100%;">
<view style="background-color: green;height: 100px;width: 100%;" @click="handleClick('green')">
</view>
</view>
<view id="absolute-view" style="position: absolute;background-color: red;width: 100px;height: 200px;right: 0px;"
@click="handleClick('red')">
</view>
</view>
<text style="font-size: 15px;">overflow=visible组件设置hover-class的测试</text>
<view class="backgroundview">
<view class="box-visible-border-radius" hover-class="hover-class">
<view style="background-color: red;height: 100px;width: 100px;margin-left: 20px;margin-top: 20px;">
</view>
</view>
</view>
<text style="font-size: 15px;">overflow=visible组件多层级设置测试</text>
<view class="backgroundview">
<view id="deep-overflow" style="overflow: visible;">
<view style="overflow: visible;background-color: red;width: 100px;height: 100px;" @click="handleClick('red')">
</view>
</view>
<view style="overflow: visible;">
<view style="overflow: visible;background-color: green;width: 100px;height: 100px;">
</view>
</view>
</view>
<text style="font-size: 15px;">同时设置overflow=visible、z-index的事件触发示例</text>
<view class="backgroundview">
<view id="zindex-overflow" style="width: 1px;height: 1px;overflow: visible;z-index: 100;" @click="handleClick('red')">
<view style="width: 100px;height: 100px;background-color: red;"></view>
</view>
<view style="width: 1px;height: 1px;overflow: visible;">
<view style="width: 100px;height: 100px;background-color: green;"></view>
</view>
</view>
</view>
<!-- #ifdef APP && !VUE3-VAPOR -->
</scroll-view>
<!-- #endif -->
</template>
<script setup lang="uts">
type DataType = {
jest_result: boolean;
jest_click_x: number;
jest_click_y: number;
jest_parent_top: number;
startX: number;
startY: number;
moveX: number;
moveY: number;
oldX: number;
oldY: number;
moveEl: UniElement | null;
}
const data = reactive({
jest_result: false,
jest_click_x: -1,
jest_click_y: -1,
jest_parent_top: -1.0,
startX: 0,
startY: 0,
moveX: 0,
moveY: 0,
oldX: 0,
oldY: 0,
moveEl: null as UniElement | null
} as DataType)
onReady(() => {
data.moveEl = uni.getElementById('parent')
})
const handleClickOverflowPart = () => {
console.log("click")
data.jest_result = true
uni.showToast({ "title": "点击红色区域" })
}
const handleTouchStartOverflowPart = (e : UniTouchEvent) => {
data.startX = e.changedTouches[0].clientX
data.startY = e.changedTouches[0].clientY
}
const handleTouchMoveOverflowPart = (e : UniTouchEvent) => {
console.log("touchmove:" + e.touches[0].clientX + "," + e.touches[0].clientY)
e.preventDefault()
e.stopPropagation()
const difX = e.changedTouches[0].clientX
const difY = e.changedTouches[0].clientY
data.moveX = difX - data.startX + data.oldX
data.moveY = difY - data.startY + data.oldY
data.moveEl?.style?.setProperty('transform', `translate(${data.moveX}px,${data.moveY}px)`)
}
const handleTouchEndOverflowPart = (_ : UniTouchEvent) => {
data.oldX = data.moveX
data.oldY = data.moveY
}
const handleClick = (str : string) => {
console.log(`点击了 ${str} view`)
if (str == 'red') {
data.jest_result = true
}
}
const jest_getRect = async () => {
const rect = await uni.getElementById('child')!.getBoundingClientRectAsync()!
let ratio = 1
if (uni.getSystemInfoSync().platform == 'android'){
ratio = uni.getSystemInfoSync().devicePixelRatio
}
data.jest_click_x = rect.x * ratio + 30
data.jest_click_y = rect.bottom * ratio - 30
}
const jest_getParentRect = () => {
const transform = uni.getElementById('parent')?.style.getPropertyValue("transform")
if (transform != null) {
let value = transform as string
value = value.split(",")[1].slice(0, -3)
let ratio = 1
if (uni.getSystemInfoSync().platform == 'android'){
ratio = uni.getSystemInfoSync().devicePixelRatio
}
data.jest_parent_top = Math.round((parseFloat(value) * ratio))
}
}
const jest_getAbsoluteViewRect = async () => {
const rect = await uni.getElementById('absolute-view')!.getBoundingClientRectAsync()!
const systemInfo = uni.getSystemInfoSync()
const titleBarHeight = systemInfo.screenHeight - systemInfo.windowHeight
let ratio = 1
if (uni.getSystemInfoSync().platform == 'android'){
ratio = uni.getSystemInfoSync().devicePixelRatio
}
data.jest_click_x = rect.x * ratio + 30
data.jest_click_y = (rect.top + titleBarHeight) * ratio + 30
}
const jest_restScorllView = async () => {
uni.pageScrollTo({
scrollTop: 0
})
}
const jest_scrollToDeepOverflow = async () => {
const rect = await uni.getElementById('deep-overflow')!.getBoundingClientRectAsync()!
uni.pageScrollTo({
scrollTop: rect.top
})
setTimeout(() => {
const systemInfo = uni.getSystemInfoSync()
let ratio = 1
if (uni.getSystemInfoSync().platform == 'android'){
ratio = uni.getSystemInfoSync().devicePixelRatio
}
const titleBarHeight = systemInfo.screenHeight - systemInfo.windowHeight
uni.getElementById('deep-overflow')!.getBoundingClientRectAsync()!.then((afterRect: DOMRect) => {
data.jest_click_x = afterRect.x * ratio + 30
data.jest_click_y = (afterRect.top + titleBarHeight) * ratio + 30
})
}, 200)
}
const jest_scrollToZIndexOverflow = async () => {
const rect = await uni.getElementById('zindex-overflow')!.getBoundingClientRectAsync()!
uni.pageScrollTo({
scrollTop: rect.top
})
setTimeout(() => {
const systemInfo = uni.getSystemInfoSync()
let ratio = 1
if (uni.getSystemInfoSync().platform == 'android'){
ratio = uni.getSystemInfoSync().devicePixelRatio
}
const titleBarHeight = systemInfo.screenHeight - systemInfo.windowHeight
uni.getElementById('zindex-overflow')!.getBoundingClientRectAsync()!.then((afterRect: DOMRect) => {
data.jest_click_x = afterRect.x * ratio + 30
data.jest_click_y = (afterRect.top + titleBarHeight) * ratio + 30
})
}, 200)
}
defineExpose({
data,
jest_getRect,
jest_getParentRect,
jest_getAbsoluteViewRect,
jest_scrollToDeepOverflow,
jest_scrollToZIndexOverflow,
jest_restScorllView
})
</script>
<style>
.backgroundview {
width: 300px;
height: 300px;
margin-bottom: 20px;
background-color: white;
justify-content: center;
align-items: center;
}
.box-visible-border-radius {
width: 100px;
height: 100px;
border-radius: 20px;
overflow: visible;
background-color: green;
}
.hover-class {
background-color: aqua;
}
.box {
width: 1px;
height: 1px;
overflow: visible;
}
</style>

查看文件

@@ -0,0 +1,29 @@
const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
const isAndroid = platformInfo.startsWith('android')
const isAppWebView = process.env.UNI_AUTOMATOR_APP_WEBVIEW == 'true'
describe('component-native-overflow', () => {
let page
beforeAll(async () => {
//打开list-view测试页
page = await program.reLaunch('/pages/CSS/overflow/overflow')
await page.waitFor("image")
})
//检测overflow设置hidden,visible
it('check_view_overflow', async () => {
if (isAndroid && !isAppWebView) {
let version = process.env.uniTestPlatformInfo
version = parseInt(version.split(" ")[1])
//安卓7模拟器不截图 导致闪退
if(version == 7) {
return
}
}
await page.waitFor(600)
const image = await program.screenshot({
fullPage: true,
});
expect(image).toSaveImageSnapshot();
})
})

查看文件

@@ -0,0 +1,270 @@
<template>
<!-- #ifdef APP && !VUE3-VAPOR -->
<scroll-view style="flex:1;">
<!-- #endif -->
<page-intro content="本页演示 overflow 样式:overflow:hidden 与 overflow:visible 下子元素超出时的裁剪与显示;子元素为 view(border 圆角/边框)、text、image 等,每组均提供拍平(flatten)版本对比。"></page-intro>
<text style="font-size: 15px;">overflow=hidden效果子元素是view border圆角</text>
<view class="backgroundview">
<view class="box-hidden-border-radius">
<view style="width: 50px; height: 150px; background-color: greenyellow;"></view>
</view>
</view>
<text>拍平</text>
<view class="backgroundview">
<view class="box-hidden-border-radius" flatten>
<view style="width: 50px; height: 150px; background-color: greenyellow;" flatten></view>
</view>
</view>
<text style="font-size: 15px;">overflow=hidden效果 子元素是view border边框</text>
<view class="backgroundview">
<view class="box-hidden-border-width">
<view style="width: 50px; height: 150px; background-color: greenyellow;"></view>
</view>
</view>
<text>拍平</text>
<view class="backgroundview">
<view class="box-hidden-border-width" flatten>
<view style="width: 50px; height: 150px; background-color: greenyellow;" flatten></view>
</view>
</view>
<text style="font-size: 15px;">overflow=visible效果 子元素是view border圆角</text>
<view class="backgroundview">
<view class="box-visible-border-radius">
<view style="width: 50px; height: 150px; background-color: greenyellow;"></view>
</view>
</view>
<text>拍平</text>
<view class="backgroundview">
<view class="box-visible-border-radius" flatten>
<view style="width: 50px; height: 150px; background-color: greenyellow;" flatten></view>
</view>
</view>
<text style="font-size: 15px;">overflow=visible效果 子元素是view border边框</text>
<view class="backgroundview">
<view class="box-visible-border-width">
<view style="width: 50px; height: 150px; background-color: greenyellow;"></view>
</view>
</view>
<text>拍平</text>
<view class="backgroundview">
<view class="box-visible-border-width" flatten>
<view style="width: 50px; height: 150px; background-color: greenyellow;" flatten></view>
</view>
</view>
<view style="flex-grow: 1">
<text style="font-size: 15px;">overflow=hidden效果 子元素是text</text>
<view class="backgroundview">
<view class="box-hidden-border-radius">
<!-- 微信小程序 webview 模式使用 line-clamp 会截断文本显示省略号,skyline 模式正常 -->
<text
<!-- #ifdef VUE3-VAPOR && !MP -->
max-lines=1
<!-- #endif-->
class="text1">ABCDEFG</text>
</view>
</view>
<text>拍平</text>
<view class="backgroundview">
<view class="box-hidden-border-radius" flatten>
<text
<!-- #ifdef VUE3-VAPOR && !MP -->
max-lines=1
<!-- #endif-->
class="text1" flatten>ABCDEFG</text>
</view>
</view>
<text style="font-size: 15px;">overflow=visible效果 子元素是text</text>
<view class="backgroundview">
<view class="box-visible-border-radius">
<text
<!-- #ifdef VUE3-VAPOR && !MP -->
max-lines=1
<!-- #endif-->
class="text1">ABCDEFG</text>
</view>
</view>
<text>拍平</text>
<view class="backgroundview">
<view class="box-visible-border-radius" flatten>
<text
<!-- #ifdef VUE3-VAPOR && !MP -->
max-lines=1
<!-- #endif-->
class="text1" flatten >ABCDEFG</text>
</view>
</view>
<text style="font-size: 15px;">overflow=hidden效果 子元素是image</text>
<view class="backgroundview">
<view class="box-hidden-border-radius">
<image style="width: 150px; height: 150px;" src="/static/test-image/logo.png"></image>
</view>
</view>
<text>拍平</text>
<view class="backgroundview">
<view class="box-hidden-border-radius" flatten>
<image style="width: 150px; height: 150px;" src="/static/test-image/logo.png" flatten></image>
</view>
</view>
<text style="font-size: 15px;">overflow=visible效果 子元素是image</text>
<view class="backgroundview">
<view class="box-visible-border-radius">
<image style="width: 150px; height: 150px;" src="/static/test-image/logo.png"></image>
</view>
</view>
<text>拍平</text>
<view class="backgroundview">
<view class="box-visible-border-radius" flatten>
<image style="width: 150px; height: 150px;" src="/static/test-image/logo.png" flatten></image>
</view>
</view>
<text style="font-size: 15px;">overflow=visible效果 子元素是view 父是scroll-view</text>
<scroll-view class="backgroundview">
<view class="box-visible-border-radius">
<view style="width: 50px; height: 150px; background-color: greenyellow;"></view>
</view>
</scroll-view>
<text>拍平</text>
<scroll-view class="backgroundview">
<view class="box-visible-border-radius" flatten>
<view style="width: 50px; height: 150px; background-color: greenyellow;" flatten></view>
</view>
</scroll-view>
<text style="font-size: 15px;">overflow=visible 设置阴影显示文字</text>
<view class="backgroundview">
<view class="" style="overflow: visible;width: 100px;height: 100px;background-color: green;box-shadow: 10px 10px #000;margin-top: 10px;">
<text style="width:170px; background-color: greenyellow;">文字文字文字文字文字</text>
</view>
</view>
<text>拍平</text>
<view class="backgroundview">
<view class="" style="overflow: visible;width: 100px;height: 100px;background-color: green;box-shadow: 10px 10px #000;margin-top: 10px;"
<!-- #ifndef APP-ANDROID -->
flatten
<!-- #endif -->
>
<text style="width:170px; background-color: greenyellow;" flatten>文字文字文字文字文字</text>
</view>
</view>
<text style="font-size: 15px;">overflow=visible 子view完全超出范围</text>
<view class="backgroundview">
<view class="box-visible-border-width">
<view style="width: 50px; height: 50px; background-color: greenyellow;right: -70px;position: absolute;"></view>
</view>
</view>
<text>拍平</text>
<view class="backgroundview">
<view class="box-visible-border-width" flatten>
<view style="width: 50px; height: 50px; background-color: greenyellow;right: -70px;position: absolute;" flatten></view>
</view>
</view>
<text style="font-size: 15px;">overflow=hidden 多层view嵌套裁剪</text>
<view class="backgroundview">
<view class="box-visible-border-width">
<view style="overflow: hidden; width: 100px; height: 100px;">
<view style="width: 50px; height: 130px; background-color: greenyellow;position: absolute;"></view>
</view>
</view>
</view>
<text>拍平</text>
<view class="backgroundview">
<view class="box-visible-border-width">
<view style="overflow: hidden; width: 100px; height: 100px;">
<view style="width: 50px; height: 130px; background-color: greenyellow;position: absolute;" flatten></view>
</view>
</view>
</view>
<text style="font-size: 15px;">overflow=visible 多层view嵌套visible</text>
<view class="backgroundview">
<view style="overflow: visible; flex-direction: row; background-color: green;">
<view style="overflow: visible; width: 50px; height: 100px;">
<view style="width: 50px; height: 130px; background-color: greenyellow;position: absolute;"></view>
</view>
<view style="overflow: hidden; width: 50px; height: 100px;"></view>
</view>
</view>
<text>拍平</text>
<view class="backgroundview">
<view class="backgroundview">
<view style="overflow: visible; flex-direction: row; background-color: green;">
<view style="overflow: visible; width: 50px; height: 100px;">
<view style="width: 50px; height: 130px; background-color: greenyellow;position: absolute;" flatten></view>
</view>
<view style="overflow: hidden; width: 50px; height: 100px;"
<!-- #ifndef APP-ANDROID -->
flatten
<!-- #endif -->
></view>
</view>
</view>
</view>
</view>
<!-- #ifdef APP && !VUE3-VAPOR -->
</scroll-view>
<!-- #endif -->
</template>
<script setup lang="uts">
</script>
<style>
.backgroundview {
width: 300px;
height: 200px;
background-color: white;
justify-content: center;
align-items: center;
}
.box-hidden-border-radius {
width: 100px;
height: 100px;
border-radius: 20px;
overflow: hidden;
background-color: green;
}
.box-hidden-border-width {
width: 100px;
height: 100px;
border-width: 2px;
border-style: solid;
background-color: green;
}
.box-visible-border-radius {
width: 100px;
height: 100px;
border-radius: 20px;
overflow: visible;
background-color: green;
}
.box-visible-border-width {
width: 100px;
height: 100px;
border-width: 2px;
border-style: solid;
overflow: visible;
background-color: green;
}
.text1 {
font-size: 50px;
/* #ifndef VUE3-VAPOR */
lines: 1;
/* #endif */
}
</style>