refactor: 确立独立子工程架构 (backend, admin, mpuniapp) 并同步更新 AGENTS.md 规范
这个提交包含在:
@@ -0,0 +1,65 @@
|
||||
const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
|
||||
const isMP = platformInfo.startsWith('mp')
|
||||
const isWeb = platformInfo.startsWith('web')
|
||||
const isIOS = platformInfo.startsWith('ios')
|
||||
const isHarmony = platformInfo.startsWith('harmony')
|
||||
const isAppWebView = process.env.UNI_AUTOMATOR_APP_WEBVIEW == 'true'
|
||||
|
||||
describe('get-native-view', () => {
|
||||
if (isMP || isHarmony || isWeb || isAppWebView) {
|
||||
it('skip mp', () => {
|
||||
expect(1).toBe(1)
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if (
|
||||
isIOS &&
|
||||
(
|
||||
platformInfo.indexOf('14.5') != -1 ||
|
||||
platformInfo.indexOf('13.7') != -1 ||
|
||||
platformInfo.indexOf('12.4') != -1
|
||||
)
|
||||
) {
|
||||
// TODO: 排查 ios 不兼容版本 测试异常原因
|
||||
it('14.5 13.7 12.4 测试异常', () => {
|
||||
expect(1).toBe(1)
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
let page
|
||||
beforeAll(async () => {
|
||||
page = await program.reLaunch('/pages/API/get-native-view/element-getnativeview')
|
||||
await page.waitFor('web-view')
|
||||
})
|
||||
|
||||
//检测view标签原生View是否匹配
|
||||
it('check_view_native_view', async () => {
|
||||
page.waitFor(100)
|
||||
const value = await page.callMethod('checkViewNativeView')
|
||||
expect(value).toBe(true)
|
||||
})
|
||||
|
||||
//检测input标签原生View是否匹配
|
||||
it('check_input_native_view', async () => {
|
||||
page.waitFor(100)
|
||||
const value = await page.callMethod('checkInputNativeView')
|
||||
expect(value).toBe(true)
|
||||
})
|
||||
|
||||
//检测textarea标签原生View是否匹配
|
||||
it('check_textarea_native_view', async () => {
|
||||
page.waitFor(100)
|
||||
const value = await page.callMethod('checkTextareaNativeView')
|
||||
expect(value).toBe(true)
|
||||
})
|
||||
|
||||
//检测webview标签原生View是否匹配
|
||||
it('check_web_view_native_view', async () => {
|
||||
page.waitFor(100)
|
||||
const value = await page.callMethod('checkWebViewNativeView')
|
||||
expect(value).toBe(true)
|
||||
})
|
||||
|
||||
})
|
||||
@@ -0,0 +1,135 @@
|
||||
<template>
|
||||
<view id="view">
|
||||
<input id="input" value="input" class="input" />
|
||||
<textarea id="textarea" value="textarea" class="textarea" />
|
||||
<web-view id="webview" src="/hybrid/html/local.html" class="web-view"></web-view>
|
||||
// 注意:iOS平台真机运行时需要安装 Xcode 开发工具具备 UTS 开发环境,或提交自定基座打包后 checkNativeView 相关方法才会生效
|
||||
<button class="button" type="primary" @click="checkViewNativeView">检测view标签原生View</button>
|
||||
<button class="button" type="primary" @click="checkInputNativeView">检测input标签原生View</button>
|
||||
<button class="button" type="primary" @click="checkTextareaNativeView">检测textarea标签原生View</button>
|
||||
<button class="button" type="primary" @click="checkWebViewNativeView">检测webview标签原生View</button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="uts">
|
||||
import { checkWebViewNativeView as checkWebView, checkInputNativeView as checkInput, checkTextareaNativeView as checkTextarea, checkViewNativeView as checkView } from '@/uni_modules/uts-get-native-view';
|
||||
|
||||
function showTip(title : string) {
|
||||
console.log("title===" + title)
|
||||
uni.showToast({
|
||||
title: title,
|
||||
icon: "none"
|
||||
})
|
||||
}
|
||||
|
||||
function checkViewNativeView() : boolean {
|
||||
var msg = "检测view组件对应原生"
|
||||
// #ifdef APP-ANDROID
|
||||
msg += "ViewGroup"
|
||||
// #endif
|
||||
// #ifdef APP-IOS
|
||||
msg += "UIView"
|
||||
// #endif
|
||||
|
||||
if (checkView("view")) {
|
||||
showTip(msg + "成功")
|
||||
return true
|
||||
}
|
||||
showTip(msg + "失败")
|
||||
return false
|
||||
}
|
||||
|
||||
function checkInputNativeView() : boolean {
|
||||
var msg = "检测input组件对应原生"
|
||||
// #ifdef APP-ANDROID
|
||||
msg += "EditText"
|
||||
// #endif
|
||||
// #ifdef APP-IOS
|
||||
msg += "UITextField"
|
||||
// #endif
|
||||
|
||||
if (checkInput("input")) {
|
||||
showTip(msg + "成功")
|
||||
return true
|
||||
}
|
||||
showTip(msg + "失败")
|
||||
return false
|
||||
}
|
||||
|
||||
function checkTextareaNativeView() : boolean {
|
||||
var msg = "检测textarea组件对应原生"
|
||||
// #ifdef APP-ANDROID
|
||||
msg += "EditText"
|
||||
// #endif
|
||||
// #ifdef APP-IOS
|
||||
msg += "UITextView"
|
||||
// #endif
|
||||
|
||||
if (checkTextarea("textarea")) {
|
||||
showTip(msg + "成功")
|
||||
return true
|
||||
}
|
||||
showTip(msg + "失败")
|
||||
return false
|
||||
}
|
||||
|
||||
function checkWebViewNativeView() : boolean {
|
||||
var msg = "检测web-view组件对应原生"
|
||||
// #ifdef APP-ANDROID
|
||||
msg += "WebView"
|
||||
// #endif
|
||||
// #ifdef APP-IOS
|
||||
msg += "WKWebView"
|
||||
// #endif
|
||||
|
||||
if (checkWebView("webview")) {
|
||||
showTip(msg + "成功")
|
||||
return true
|
||||
}
|
||||
showTip(msg + "失败")
|
||||
return false
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
checkViewNativeView,
|
||||
checkInputNativeView,
|
||||
checkTextareaNativeView,
|
||||
checkWebViewNativeView
|
||||
})
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.input {
|
||||
width: 300px;
|
||||
height: 40px;
|
||||
border-radius: 4px;
|
||||
border-width: 1px;
|
||||
border-color: black;
|
||||
border-style: solid;
|
||||
margin: 20px auto;
|
||||
}
|
||||
|
||||
.textarea {
|
||||
width: 300px;
|
||||
height: 80px;
|
||||
border-radius: 4px;
|
||||
border-width: 1px;
|
||||
border-color: black;
|
||||
border-style: solid;
|
||||
margin: 20px auto;
|
||||
}
|
||||
|
||||
.web-view {
|
||||
width: 300px;
|
||||
height: 120px;
|
||||
margin: 20px auto;
|
||||
border-radius: 4px;
|
||||
border-width: 1px;
|
||||
border-color: black;
|
||||
border-style: solid;
|
||||
}
|
||||
|
||||
.button {
|
||||
margin: 10px 20px;
|
||||
}
|
||||
</style>
|
||||
在新工单中引用
屏蔽一个用户