refactor: 确立独立子工程架构 (backend, admin, mpuniapp) 并同步更新 AGENTS.md 规范
这个提交包含在:
@@ -0,0 +1,28 @@
|
||||
const isDom2 = process.env.UNI_APP_X_DOM2 === "true"
|
||||
const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
|
||||
const isMP = platformInfo.startsWith('mp')
|
||||
|
||||
describe('getLaunchOptionsSync', () => {
|
||||
if ( isMP) {
|
||||
it('skip', async () => {
|
||||
expect(1).toBe(1);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const PAGE_PATH = '/pages/API/get-launch-options-sync/get-launch-options-sync'
|
||||
|
||||
it('getLaunchOptionsSync', async () => {
|
||||
page = await program.navigateTo(PAGE_PATH)
|
||||
await page.waitFor('view')
|
||||
await page.callMethod('getLaunchOptionsSync')
|
||||
const data = await page.data('data')
|
||||
expect(data.checked).toBe(true)
|
||||
})
|
||||
it('app onLaunch 和 getLaunchOptionsSync 结果一致', async () => {
|
||||
const page = await program.navigateTo(PAGE_PATH)
|
||||
await page.waitFor('view')
|
||||
const pageData = await page.data('data')
|
||||
expect(pageData.testResult).toBe(true)
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,63 @@
|
||||
<template>
|
||||
<page-head title="getLaunchOptionsSync"></page-head>
|
||||
<view class="uni-padding-wrap">
|
||||
<button @click="getLaunchOptionsSync">getLaunchOptionsSync</button>
|
||||
<view class="uni-common-mt">
|
||||
<text>应用本次启动路径:</text>
|
||||
<text style="margin-top: 5px">{{ data.launchOptionsPath }}</text>
|
||||
</view>
|
||||
<view class="uni-common-mt">
|
||||
<text>应用本次启动:</text>
|
||||
<text style="margin-top: 5px">{{ data.launchOptionsString }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="uts">
|
||||
import { state } from '@/store/index.uts'
|
||||
|
||||
type DataType = {
|
||||
checked: boolean;
|
||||
homePagePath: string;
|
||||
launchOptionsPath: string;
|
||||
launchOptionsString: string;
|
||||
testResult: boolean;
|
||||
}
|
||||
|
||||
const data = reactive<DataType>({
|
||||
checked: false,
|
||||
homePagePath: 'pages/tabBar/component',
|
||||
launchOptionsPath: '',
|
||||
launchOptionsString: '',
|
||||
testResult: false
|
||||
})
|
||||
|
||||
const compareOnLaunchRes = () => {
|
||||
const launchOptions = uni.getLaunchOptionsSync();
|
||||
data.launchOptionsString = JSON.stringify(launchOptions, null, 2)
|
||||
|
||||
const appLaunchOptions = state.globalData.launchOptions
|
||||
|
||||
const isPathSame = launchOptions.path == appLaunchOptions.path
|
||||
const isAppSchemeSame = launchOptions.appScheme == appLaunchOptions.appScheme
|
||||
const isAppLinkSame = launchOptions.appLink == appLaunchOptions.appLink
|
||||
data.testResult = isPathSame && isAppSchemeSame && isAppLinkSame
|
||||
}
|
||||
|
||||
const getLaunchOptionsSync = () => {
|
||||
const launchOptions = uni.getLaunchOptionsSync()
|
||||
data.launchOptionsPath = launchOptions.path
|
||||
if (launchOptions.path == data.homePagePath) {
|
||||
data.checked = true
|
||||
}
|
||||
}
|
||||
|
||||
onReady(() => {
|
||||
compareOnLaunchRes()
|
||||
})
|
||||
|
||||
defineExpose({
|
||||
data,
|
||||
getLaunchOptionsSync
|
||||
})
|
||||
</script>
|
||||
在新工单中引用
屏蔽一个用户