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

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

查看文件

@@ -0,0 +1,42 @@
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-title/set-navigation-bar-title";
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("setNavigationBarNewTitle", async () => {
await page.callMethod("setNavigationBarNewTitle");
await page.waitFor(1000);
const image = await program.screenshot();
expect(image).toSaveImageSnapshot();
const lifeCycleNum = await page.callMethod("getLifeCycleNum");
expect(lifeCycleNum - originLifeCycleNum).toBe(2);
});
it("setNavigationBarLongTitle", async () => {
await page.callMethod("setNavigationBarLongTitle");
await page.waitFor(1000);
const image = await program.screenshot();
expect(image).toSaveImageSnapshot();
});
});

查看文件

@@ -0,0 +1,108 @@
<template>
<page-head title="setNavigationBarTitle"></page-head>
<view class="uni-padding-wrap uni-common-mt">
<button @tap="setNavigationBarNewTitle" class="uni-btn">
设置当前页面标题为: {{ newTitle }}
</button>
<button @tap="setNavigationBarLongTitle" class="uni-btn">
设置超长标题
</button>
<!-- #ifndef VUE3-VAPOR -->
<!-- #ifdef APP-HARMONY -->
<button @tap="showNavigationBarLoading" class="uni-btn">
设置标题 loading
</button>
<button @tap="hideNavigationBarLoading" class="uni-btn">
隐藏标题 loading
</button>
<!-- #endif -->
<!-- #endif -->
</view>
</template>
<script setup lang="uts">
import { state, setLifeCycleNum } from '@/store/index.uts'
const newTitle = ref('new title')
const longTitle = ref('long title long title long title long title long title long title long title long title long title long title')
// 自动化测试
const getLifeCycleNum = () : number => {
return state.lifeCycleNum
}
// 自动化测试
const setLifeCycleNumFunc = (num : number) => {
setLifeCycleNum(num)
}
// #ifdef APP-HARMONY
const showNavigationBarLoading = () => {
uni.showNavigationBarLoading({
success: () => {
console.log('showNavigationBarLoading success')
},
fail: () => {
console.log('showNavigationBarLoading fail')
},
complete: () => {
console.log('showNavigationBarLoading complete')
}
})
}
const hideNavigationBarLoading = () => {
uni.hideNavigationBarLoading({
success: () => {
console.log('hideNavigationBarLoading success')
},
fail: () => {
console.log('hideNavigationBarLoading fail')
},
complete: () => {
console.log('hideNavigationBarLoading complete')
}
})
}
// #endif
const setNavigationBarNewTitle = () => {
uni.setNavigationBarTitle({
title: newTitle.value,
success: () => {
console.log('setNavigationBarTitle success')
setLifeCycleNumFunc(state.lifeCycleNum + 1)
},
fail: () => {
console.log('setNavigationBarTitle fail')
setLifeCycleNumFunc(state.lifeCycleNum - 1)
},
complete: () => {
console.log('setNavigationBarTitle complete')
setLifeCycleNumFunc(state.lifeCycleNum + 1)
}
})
}
const setNavigationBarLongTitle = () => {
uni.setNavigationBarTitle({
title: longTitle.value,
success() {
console.log('setNavigationBarTitle success')
},
fail() {
console.log('setNavigationBarTitle fail')
},
complete() {
console.log('setNavigationBarTitle complete')
}
})
}
defineExpose({
getLifeCycleNum,
setLifeCycleNum: setLifeCycleNumFunc,
setNavigationBarNewTitle,
setNavigationBarLongTitle
})
</script>