refactor: 确立独立子工程架构 (backend, admin, mpuniapp) 并同步更新 AGENTS.md 规范
这个提交包含在:
@@ -0,0 +1,25 @@
|
||||
const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
|
||||
const isMP = platformInfo.startsWith('mp')
|
||||
|
||||
const PAGE_PATH = '/pages/API/rpx2px/rpx2px'
|
||||
|
||||
describe('API-rpx2px', () => {
|
||||
if(isMP) {
|
||||
it('not support', () => {
|
||||
expect(1).toBe(1)
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
it('rpx2px', async () => {
|
||||
page = await program.reLaunch(PAGE_PATH)
|
||||
await page.waitFor('view');
|
||||
|
||||
const btnConvert = await page.$('#convert')
|
||||
await btnConvert.tap()
|
||||
await page.waitFor(100)
|
||||
|
||||
const data = await page.data('data')
|
||||
expect(data.result).toBe(true)
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,73 @@
|
||||
<template>
|
||||
<!-- #ifdef APP -->
|
||||
<scroll-view class="page-scroll-view">
|
||||
<!-- #endif -->
|
||||
<view class="page">
|
||||
<page-head :title="data.title"></page-head>
|
||||
<view>
|
||||
<view class="item">
|
||||
<text class="item-k">输入:</text>
|
||||
<text class="item-v">{{data.rpxValue}}rpx</text>
|
||||
</view>
|
||||
<view class="item">
|
||||
<text class="item-k">返回:</text>
|
||||
<text class="item-v">{{data.pxValue}}px</text>
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<button id="convert" @click="rpx2px">转换</button>
|
||||
</view>
|
||||
</view>
|
||||
<!-- #ifdef APP -->
|
||||
</scroll-view>
|
||||
<!-- #endif -->
|
||||
</template>
|
||||
<script setup lang="uts">
|
||||
type DataType = {
|
||||
title: string;
|
||||
rpxValue: number;
|
||||
pxValue: number;
|
||||
result: boolean;
|
||||
}
|
||||
|
||||
const data = reactive({
|
||||
title: 'rpx2px',
|
||||
rpxValue: 750,
|
||||
pxValue: 0,
|
||||
result: false
|
||||
} as DataType)
|
||||
|
||||
const rpx2px = () => {
|
||||
data.pxValue = uni.rpx2px(data.rpxValue);
|
||||
|
||||
// 仅限自动化测试
|
||||
const windowInfo = uni.getWindowInfo();
|
||||
if (windowInfo.windowWidth == data.pxValue) {
|
||||
data.result = true
|
||||
}
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
data
|
||||
})
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.page {
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
.item {
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.item-k {
|
||||
width: 72px;
|
||||
line-height: 2;
|
||||
}
|
||||
|
||||
.item-v {
|
||||
font-weight: bold;
|
||||
line-height: 2;
|
||||
}
|
||||
</style>
|
||||
在新工单中引用
屏蔽一个用户