refactor: 确立独立子工程架构 (backend, admin, mpuniapp) 并同步更新 AGENTS.md 规范
这个提交包含在:
@@ -0,0 +1,30 @@
|
||||
const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
|
||||
const isAndroid = platformInfo.startsWith('android')
|
||||
|
||||
describe('/pages/API/element-request-fullscreen/element-request-fullscreen-bugs', () => {
|
||||
|
||||
if (!isAndroid || (isAndroid && platformInfo.includes('14.0.0'))) {
|
||||
it('pass', async () => {
|
||||
expect(1).toBe(1);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
let page;
|
||||
beforeAll(async () => {
|
||||
page = await program.reLaunch('/pages/API/element-request-fullscreen/element-request-fullscreen-bugs')
|
||||
await page.waitFor(2000);
|
||||
});
|
||||
|
||||
it("test-fullscreen-bugs", async () => {
|
||||
// 进入全屏
|
||||
await page.callMethod('requestfullscreen')
|
||||
await page.waitFor(1000)
|
||||
|
||||
const image2 = await program.screenshot({
|
||||
fullPage: true
|
||||
})
|
||||
expect(image2).toSaveImageSnapshot()
|
||||
})
|
||||
});
|
||||
@@ -0,0 +1,62 @@
|
||||
<template>
|
||||
<view>
|
||||
<view style="padding: 8px;">
|
||||
<view class="position-error" id="fullscreen" @click="requestfullscreen">
|
||||
<text style="color: white;">测试position:fixed在安卓上的bug</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="uts">
|
||||
|
||||
const fullscreenElement = ref(null as UniElement | null)
|
||||
const isFullscreen = ref(false)
|
||||
|
||||
function getCurrentPage() : UniPage {
|
||||
const pages = getCurrentPages()
|
||||
return pages[pages.length - 1]
|
||||
}
|
||||
|
||||
function requestfullscreen() {
|
||||
if (isFullscreen.value) {
|
||||
const page = getCurrentPage()
|
||||
page.exitFullscreen({
|
||||
success: () => {
|
||||
},
|
||||
fail: () => {
|
||||
},
|
||||
complete: () => {
|
||||
}
|
||||
})
|
||||
} else {
|
||||
fullscreenElement.value?.requestFullscreen({
|
||||
success: () => { },
|
||||
fail: () => { },
|
||||
complete: () => { }
|
||||
})
|
||||
}
|
||||
isFullscreen.value = !isFullscreen.value
|
||||
}
|
||||
|
||||
function exitfullscreen() {
|
||||
|
||||
}
|
||||
|
||||
onReady(() => {
|
||||
fullscreenElement.value = uni.getElementById('fullscreen') as UniElement
|
||||
})
|
||||
|
||||
defineExpose({
|
||||
requestfullscreen
|
||||
})
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.position-error {
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
position: fixed;
|
||||
background-color: brown;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,48 @@
|
||||
const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
|
||||
const isMP = platformInfo.startsWith('mp')
|
||||
const isWeb = platformInfo.startsWith('web')
|
||||
const isIOS = platformInfo.startsWith('ios')
|
||||
|
||||
describe('/pages/API/element-request-fullscreen/element-request-fullscreen', () => {
|
||||
|
||||
if (isWeb || isMP || (isIOS && platformInfo.includes('15.5'))) {
|
||||
it('pass', async () => {
|
||||
expect(1).toBe(1);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
let page;
|
||||
beforeAll(async () => {
|
||||
page = await program.reLaunch('/pages/API/element-request-fullscreen/element-request-fullscreen')
|
||||
await page.waitFor(2000);
|
||||
});
|
||||
|
||||
it("test-fullscreen", async () => {
|
||||
// 进入全屏
|
||||
await page.callMethod('fullscreen')
|
||||
await page.waitFor(1000)
|
||||
|
||||
var fullscreenchange = await page.data('data.fullscreenchangeCount')
|
||||
expect(fullscreenchange).toBe(1)
|
||||
|
||||
// 验证进入全屏的回调状态
|
||||
var requestCallbackStatus = await page.data('data.requestFullscreenCallbackStatus')
|
||||
expect(requestCallbackStatus).toBe(true) // success 回调已执行
|
||||
|
||||
// 退出全屏
|
||||
await page.callMethod('fullscreen')
|
||||
await page.waitFor(1000)
|
||||
|
||||
fullscreenchange = await page.data('data.fullscreenchangeCount')
|
||||
expect(fullscreenchange).toBe(2)
|
||||
|
||||
// 验证退出全屏的回调状态
|
||||
var exitCallbackStatus = await page.data('data.exitFullscreenCallbackStatus')
|
||||
expect(exitCallbackStatus).toBe(true) // success/fail 回调已执行
|
||||
|
||||
const image2 = await program.screenshot()
|
||||
expect(image2).toSaveImageSnapshot()
|
||||
})
|
||||
});
|
||||
@@ -0,0 +1,126 @@
|
||||
<template>
|
||||
<scroll-view class="content" direction="vertical">
|
||||
<view id="fullscreen" class="view1" @click="fullscreen" @fullscreenchange="fullscreenchange" @fullscreenerror="fullscreenerror">
|
||||
<text style="color: white;">{{ text }}</text>
|
||||
</view>
|
||||
<enum-data :items="orientation_enum" title="orientation" @change="radio_change_orientation"></enum-data>
|
||||
<enum-data :items="navigationUI_enum" title="navigationUI" @change="radio_change_ui"></enum-data>
|
||||
</scroll-view>
|
||||
</template>
|
||||
|
||||
<script setup lang="uts">
|
||||
|
||||
import { ItemType } from '@/components/enum-data/enum-data-types';
|
||||
|
||||
const orientation_enum = ref([{ "value": 0, "name": "auto" }, { "value": 1, "name": "landscape" }, { "value": 2, "name": "landscape-primary" }, { "value": 3, "name": "landscape-secondary" }, { "value": 4, "name": "portrait" }] as ItemType[])
|
||||
const navigationUI_enum = ref([{ "value": 0, "name": "auto" }, { "value": 1, "name": "hide" }, { "value": 2, "name": "show" }] as ItemType[])
|
||||
const text = ref("点击进入全屏")
|
||||
let fullscreenElement: UniElement | null = null
|
||||
let isFullscreen = false
|
||||
const orientation = ref("landscape")
|
||||
const navigationUI = ref("hide")
|
||||
|
||||
type DataType = {
|
||||
fullscreenchangeCount: number,
|
||||
requestFullscreenCallbackStatus: boolean,
|
||||
exitFullscreenCallbackStatus: boolean,
|
||||
}
|
||||
|
||||
const data = reactive({
|
||||
fullscreenchangeCount: 0,
|
||||
requestFullscreenCallbackStatus: false,
|
||||
exitFullscreenCallbackStatus: false,
|
||||
} as DataType)
|
||||
|
||||
function getCurrentPage() : UniPage {
|
||||
const pages = getCurrentPages()
|
||||
return pages[pages.length - 1]
|
||||
}
|
||||
|
||||
function fullscreen() {
|
||||
if (isFullscreen) {
|
||||
// 重置退出全屏回调状态
|
||||
let status1 = false
|
||||
const page = getCurrentPage()
|
||||
page.exitFullscreen({
|
||||
success: () => {
|
||||
text.value = "点击进入全屏"
|
||||
status1 = true
|
||||
},
|
||||
fail: (err) => {
|
||||
console.log('fail', err)
|
||||
status1 = false
|
||||
},
|
||||
complete: () => {
|
||||
console.log('complete')
|
||||
data.exitFullscreenCallbackStatus = status1
|
||||
}
|
||||
})
|
||||
} else {
|
||||
// 重置进入全屏回调状态
|
||||
let status1 = false
|
||||
fullscreenElement?.requestFullscreen({
|
||||
navigationUI: navigationUI.value,
|
||||
orientation: orientation.value,
|
||||
success: () => {
|
||||
text.value = "点击退出全屏"
|
||||
status1 = true
|
||||
},
|
||||
fail: (err) => {
|
||||
console.log('fail', err)
|
||||
status1 = false
|
||||
},
|
||||
complete: () => {
|
||||
console.log('complete')
|
||||
data.requestFullscreenCallbackStatus = status1
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
isFullscreen = !isFullscreen
|
||||
}
|
||||
|
||||
function fullscreenchange(e : UniEvent) {
|
||||
console.log(e.type)
|
||||
data.fullscreenchangeCount++
|
||||
console.log(data.fullscreenchangeCount)
|
||||
}
|
||||
|
||||
function fullscreenerror(e : UniEvent) {
|
||||
console.log(e.type)
|
||||
}
|
||||
|
||||
function radio_change_orientation(checked : number) {
|
||||
console.log(checked)
|
||||
orientation.value = orientation_enum.value[checked]['name'] as string
|
||||
}
|
||||
|
||||
function radio_change_ui(checked : number) {
|
||||
console.log(checked)
|
||||
navigationUI.value = navigationUI_enum.value[checked]['name'] as string
|
||||
}
|
||||
|
||||
onReady(() => {
|
||||
fullscreenElement = uni.getElementById('fullscreen') as UniElement
|
||||
})
|
||||
|
||||
defineExpose({
|
||||
data,
|
||||
fullscreen
|
||||
})
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.content {
|
||||
flex: 1;
|
||||
background-color: #f0f0f0;
|
||||
}
|
||||
|
||||
.view1 {
|
||||
width: 100%;
|
||||
height: 150px;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-color: black;
|
||||
}
|
||||
</style>
|
||||
在新工单中引用
屏蔽一个用户