refactor: 确立独立子工程架构 (backend, admin, mpuniapp) 并同步更新 AGENTS.md 规范
这个提交包含在:
@@ -0,0 +1,44 @@
|
||||
const isAppWebView = process.env.UNI_AUTOMATOR_APP_WEBVIEW == 'true'
|
||||
const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
|
||||
const isMP = platformInfo.startsWith('mp')
|
||||
|
||||
describe('setNavigationBarColor', () => {
|
||||
if (isAppWebView || isMP) {
|
||||
it('skip', () => {
|
||||
expect(1).toBe(1)
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
const CURRENT_PAGE_PATH = '/pages/API/set-navigation-bar-color/set-navigation-bar-color'
|
||||
let page
|
||||
let originLifeCycleNum
|
||||
beforeAll(async () => {
|
||||
page = await program.navigateTo(CURRENT_PAGE_PATH)
|
||||
await page.waitFor('view')
|
||||
originLifeCycleNum = await page.callMethod('getLifeCycleNum')
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
await page.callMethod('setLifeCycleNum', originLifeCycleNum)
|
||||
const lifeCycleNum = await page.callMethod('getLifeCycleNum')
|
||||
expect(lifeCycleNum).toBe(originLifeCycleNum)
|
||||
})
|
||||
|
||||
it("setNavigationBarColor1", async () => {
|
||||
await page.callMethod("setNavigationBarColor1");
|
||||
await page.waitFor(1000);
|
||||
const image = await program.screenshot();
|
||||
expect(image).toSaveImageSnapshot();
|
||||
const lifeCycleNum = await page.callMethod("getLifeCycleNum");
|
||||
expect(lifeCycleNum - originLifeCycleNum).toBe(2);
|
||||
});
|
||||
it("setNavigationBarColor2", async () => {
|
||||
await page.callMethod("setNavigationBarColor2");
|
||||
await page.waitFor(1000);
|
||||
const image = await program.screenshot();
|
||||
expect(image).toSaveImageSnapshot();
|
||||
const lifeCycleNum = await page.callMethod("getLifeCycleNum");
|
||||
expect(lifeCycleNum - originLifeCycleNum).toBe(4);
|
||||
});
|
||||
})
|
||||
@@ -0,0 +1,79 @@
|
||||
<template>
|
||||
<page-head title="setNavigationBarColor"></page-head>
|
||||
<view class="uni-padding-wrap uni-common-mt">
|
||||
<button @tap="setNavigationBarColor1" class="uni-btn">
|
||||
设置导航条背景绿色,标题白色
|
||||
</button>
|
||||
<button @tap="setNavigationBarColor2" class="uni-btn">
|
||||
设置导航条背景红色,标题黑色
|
||||
</button>
|
||||
<button @tap="goNavbarLite" class="uni-btn">
|
||||
跳转自定义导航栏页面
|
||||
</button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="uts">
|
||||
import { state, setLifeCycleNum } from '@/store/index.uts'
|
||||
|
||||
// 自动化测试
|
||||
const getLifeCycleNum = () : number => {
|
||||
return state.lifeCycleNum
|
||||
}
|
||||
|
||||
// 自动化测试
|
||||
const setLifeCycleNumFunc = (num : number) => {
|
||||
setLifeCycleNum(num)
|
||||
}
|
||||
|
||||
const setNavigationBarColor1 = () => {
|
||||
uni.setNavigationBarColor({
|
||||
frontColor: '#ffffff',
|
||||
backgroundColor: '#00ff00',
|
||||
success: () => {
|
||||
console.log('setNavigationBarColor success')
|
||||
setLifeCycleNumFunc(state.lifeCycleNum + 1)
|
||||
},
|
||||
fail: () => {
|
||||
console.log('setNavigationBarColor fail')
|
||||
setLifeCycleNumFunc(state.lifeCycleNum - 1)
|
||||
},
|
||||
complete: () => {
|
||||
console.log('setNavigationBarColor complete')
|
||||
setLifeCycleNumFunc(state.lifeCycleNum + 1)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const setNavigationBarColor2 = () => {
|
||||
uni.setNavigationBarColor({
|
||||
frontColor: '#000000',
|
||||
backgroundColor: '#ff0000',
|
||||
success: () => {
|
||||
console.log('setNavigationBarColor success')
|
||||
setLifeCycleNumFunc(state.lifeCycleNum + 1)
|
||||
},
|
||||
fail: () => {
|
||||
console.log('setNavigationBarColor fail')
|
||||
setLifeCycleNumFunc(state.lifeCycleNum - 1)
|
||||
},
|
||||
complete: () => {
|
||||
console.log('setNavigationBarColor complete')
|
||||
setLifeCycleNumFunc(state.lifeCycleNum + 1)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const goNavbarLite = () => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/template/keyboard-adjust/keyboard-adjust'
|
||||
})
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
getLifeCycleNum,
|
||||
setLifeCycleNum: setLifeCycleNumFunc,
|
||||
setNavigationBarColor1,
|
||||
setNavigationBarColor2
|
||||
})
|
||||
</script>
|
||||
在新工单中引用
屏蔽一个用户