Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
Hello UTS
提交
1f760b50
H
Hello UTS
项目概览
DCloud
/
Hello UTS
通知
1595
Star
27
Fork
9
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
2
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
Hello UTS
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
2
Issue
2
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
1f760b50
编写于
8月 12, 2023
作者:
DCloud-WZF
💬
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(App): add scroll-view
上级
3561ff13
变更
3
展开全部
隐藏空白更改
内联
并排
Showing
3 changed file
with
705 addition
and
653 deletion
+705
-653
pages/SyntaxCase/index.uvue
pages/SyntaxCase/index.uvue
+418
-369
pages/SyntaxCase/utsAndroid.uvue
pages/SyntaxCase/utsAndroid.uvue
+231
-229
pages/index/basicTest.uvue
pages/index/basicTest.uvue
+56
-55
未找到文件。
pages/SyntaxCase/index.uvue
浏览文件 @
1f760b50
此差异已折叠。
点击以展开。
pages/SyntaxCase/utsAndroid.uvue
浏览文件 @
1f760b50
<template>
<template>
<view>
<!-- #ifdef APP -->
<view class="uni-padding-wrap uni-common-mt">
<scroll-view style="flex: 1">
<view class="uni-hello-text">
<!-- #endif -->
逐一点击执行,观察测试反馈
<view>
</view>
<view class="uni-padding-wrap uni-common-mt">
</view>
<view class="uni-hello-text"> 逐一点击执行,观察测试反馈 </view>
</view>
<button @click="getAppContextClick">getAppContext</button>
<button @click="getUniActivityClick">getUniActivity</button>
<button @click="getAppContextClick">getAppContext</button>
<button @click="getAppTempPathClick">getAppTempPath</button>
<button @click="getUniActivityClick">getUniActivity</button>
<button @click="typeofClick">typeof</button>
<button @click="getAppTempPathClick">getAppTempPath</button>
<button @click="arrayPermissionFlowClick">组权限申请流程测试</button>
<button @click="typeofClick">typeof</button>
<button @click="singlePermissionFlowClick">单权限申请流程测试</button>
<button @click="arrayPermissionFlowClick">组权限申请流程测试</button>
<button @click="dispatchAsyncClick">任务分发测试</button>
<button @click="singlePermissionFlowClick">单权限申请流程测试</button>
<button @click="pathTestClick">路径转换测试</button>
<button @click="dispatchAsyncClick">任务分发测试</button>
<button @click="privacyStateClick">隐私协议状态测试</button>
<button @click="pathTestClick">路径转换测试</button>
<view class="uni-padding-wrap uni-common-mt">
<button @click="privacyStateClick">隐私协议状态测试</button>
<view class="uni-hello-text">
<view class="uni-padding-wrap uni-common-mt">
1. 当前页面已通过initAppLifecycle函数注册了生命周期监听。
<view class="uni-hello-text">
</view>
1. 当前页面已通过initAppLifecycle函数注册了生命周期监听。
<view class="uni-hello-text">
</view>
2. 手动切换其他APP再返回,可在控制台和界面观察事件日志
<view class="uni-hello-text">
</view>
2. 手动切换其他APP再返回,可在控制台和界面观察事件日志
</view>
</view>
<view class="uni-padding-wrap uni-common-mt">
</view>
<view class="text-box" scroll-y="true">
<view class="uni-padding-wrap uni-common-mt">
<text>{{text}}</text>
<view class="text-box" scroll-y="true">
</view>
<text>{{ text }}</text>
</view>
</view>
<button @click="gotoSystemPermissionActivityClick">手动申请权限测试</button>
</view>
<button @tap="testGoOtherActivity">跳转拍照界面</button>
<button @click="gotoSystemPermissionActivityClick">
<button @tap="testUnRegLifecycle">取消注册周期函数</button>
手动申请权限测试
<image :src="selectImage" v-if="selectImage"></image>
</button>
<view class="uni-padding-wrap uni-common-mt">
<button @tap="testGoOtherActivity">跳转拍照界面</button>
<view class="uni-hello-text">
<button @tap="testUnRegLifecycle">取消注册周期函数</button>
获取设备信息,观察是否符合预期
<image :src="selectImage" v-if="selectImage"></image>
</view>
<view class="uni-padding-wrap uni-common-mt">
</view>
<view class="uni-hello-text"> 获取设备信息,观察是否符合预期 </view>
<button @tap="getDeviceInfoClick">获取设备基础信息</button>
</view>
</view>
<button @tap="getDeviceInfoClick">获取设备基础信息</button>
</view>
<!-- #ifdef APP -->
</scroll-view>
<!-- #endif -->
</template>
</template>
<script>
<script>
import {
import {
getAppContextTest,
getAppContextTest,
getUniActivityTest,
getUniActivityTest,
getAppTempPathTest,
getAppTempPathTest,
typeofClickTest,
typeofClickTest,
gotoSystemPermissionActivityTest,
gotoSystemPermissionActivityTest,
arrayPermissionFlowTest,
arrayPermissionFlowTest,
singlePermissionFlowTest,
singlePermissionFlowTest,
dispatchAsyncTest,
dispatchAsyncTest,
convert2AbsFullPathTest,
convert2AbsFullPathTest,
unRegLifecycle,
unRegLifecycle,
initAppLifecycle,
initAppLifecycle,
gotoCameraTake,
gotoCameraTake,
getDeviceInfoTest,
getDeviceInfoTest,
privacyStateTest
privacyStateTest,
} from '@/uni_modules/uts-platform-api'
} from '@/uni_modules/uts-platform-api'
/**
* 测试在页面生命周期之外,使用api
*/
export default {
data() {
return {
text: '',
selectImage: '',
}
},
onLoad: function () {
let that = this
initAppLifecycle(function (eventLog) {
// 展示捕捉到的声明周期日志
let nextLine = that.text + eventLog
that.text = nextLine
let nextLineFlag = that.text + '\n'
that.text = nextLineFlag
})
},
methods: {
privacyStateClick() {
privacyStateTest(function (ret, desc) {
if (ret) {
uni.showToast({
title: '测试通过',
})
} else {
uni.showToast({
icon: 'none',
title: '失败:' + desc,
})
}
})
},
getDeviceInfoClick() {
this.text = getDeviceInfoTest()
},
testGoOtherActivity() {
var that = this
let ret = gotoCameraTake(function (file) {
// 展示捕捉到的声明周期日志
console.log(file)
that.selectImage = 'file://' + file
})
if (!ret) {
uni.showToast({
icon: 'none',
title: '测试失败',
})
}
},
testUnRegLifecycle() {
// 取消注册生命周期
unRegLifecycle()
},
getAppContextClick() {
if (getAppContextTest()) {
uni.showToast({
title: '测试通过',
})
} else {
uni.showToast({
icon: 'error',
title: '测试失败',
})
}
},
/**
getUniActivityClick() {
* 测试在页面生命周期之外,使用api
if (getUniActivityTest()) {
*/
uni.showToast({
export default {
title: '测试通过',
data() {
})
return {
} else {
text: '',
uni.showToast({
selectImage:''
icon: 'error',
}
title: '测试失败',
},
})
onLoad:function(){
}
let that = this;
},
initAppLifecycle(function(eventLog){
pathTestClick() {
// 展示捕捉到的声明周期日志
if (convert2AbsFullPathTest()) {
let nextLine = that.text + eventLog;
uni.showToast({
that.text = nextLine;
title: '测试通过',
let nextLineFlag = that.text + '\n';
})
that.text = nextLineFlag
} else {
});
uni.showToast({
},
icon: 'error',
methods: {
title: '测试失败',
privacyStateClick(){
})
privacyStateTest(function(ret,desc){
}
if (ret) {
},
uni.showToast({
getAppTempPathClick() {
title: '测试通过'
if (getAppTempPathTest()) {
})
uni.showToast({
} else {
title: '测试通过',
uni.showToast({
})
icon: 'none',
} else {
title: '失败:' + desc
uni.showToast({
})
icon: 'error',
}
title: '测试失败',
})
})
},
}
getDeviceInfoClick(){
},
this.text = getDeviceInfoTest()
dispatchAsyncClick() {
},
dispatchAsyncTest(function (ret, desc) {
testGoOtherActivity(){
if (ret) {
var that = this;
uni.showToast({
let ret = gotoCameraTake(function(file){
title: '测试通过',
// 展示捕捉到的声明周期日志
})
console.log(file);
} else {
that.selectImage = "file://" + file;
uni.showToast({
});
icon: 'none',
title: '失败:' + desc,
if(!ret){
})
uni.showToast({
}
icon:'none',
})
title:'测试失败'
},
})
typeofClick() {
}
if (typeofClickTest()) {
},
uni.showToast({
testUnRegLifecycle(){
title: '测试通过',
// 取消注册生命周期
})
unRegLifecycle();
} else {
},
uni.showToast({
getAppContextClick() {
icon: 'error',
if (getAppContextTest()) {
title: '测试失败',
uni.showToast({
})
title: '测试通过'
}
})
},
} else {
uni.showToast({
icon: 'error',
title: '测试失败'
})
}
},
getUniActivityClick() {
gotoSystemPermissionActivityClick() {
if (getUniActivityTest()) {
gotoSystemPermissionActivityTest()
uni.showToast({
},
title: '测试通过'
arrayPermissionFlowClick() {
})
arrayPermissionFlowTest(function (ret, desc) {
} else {
if (ret) {
uni.showToast({
uni.showToast({
icon: 'error',
icon: 'none',
title: '测试失败'
title: '测试通过',
})
})
}
} else {
},
uni.showToast({
pathTestClick() {
icon: 'none',
if (convert2AbsFullPathTest()) {
title: '失败:' + desc,
uni.showToast({
})
title: '测试通过'
}
})
})
} else {
},
uni.showToast({
singlePermissionFlowClick() {
icon: 'error',
singlePermissionFlowTest(function (ret, desc) {
title: '测试失败'
if (ret) {
})
uni.showToast({
}
icon: 'none',
},
title: '测试通过',
getAppTempPathClick() {
})
if (getAppTempPathTest()) {
} else {
uni.showToast({
uni.showToast({
title: '测试通过'
icon: 'none',
})
title: '失败:' + desc,
} else {
})
uni.showToast({
}
icon: 'error',
})
title: '测试失败'
},
})
},
}
}
},
dispatchAsyncClick() {
dispatchAsyncTest(function(ret,desc){
if (ret) {
uni.showToast({
title: '测试通过'
})
} else {
uni.showToast({
icon: 'none',
title: '失败:' + desc
})
}
})
},
typeofClick() {
if (typeofClickTest()) {
uni.showToast({
title: '测试通过'
})
} else {
uni.showToast({
icon: 'error',
title: '测试失败'
})
}
},
gotoSystemPermissionActivityClick() {
gotoSystemPermissionActivityTest()
},
arrayPermissionFlowClick() {
arrayPermissionFlowTest(function(ret,desc){
if (ret) {
uni.showToast({
icon: 'none',
title: '测试通过'
})
} else {
uni.showToast({
icon: 'none',
title: '失败:' + desc
})
}
})
},
singlePermissionFlowClick() {
singlePermissionFlowTest(function(ret,desc){
if (ret) {
uni.showToast({
icon: 'none',
title: '测试通过'
})
} else {
uni.showToast({
icon: 'none',
title: '失败:' + desc
})
}
})
}
}
}
</script>
</script>
<style>
<style>
.testButton{
.testButton {
width:100%
width: 100%;
}
}
</style>
</style>
\ No newline at end of file
pages/index/basicTest.uvue
浏览文件 @
1f760b50
<template>
<template>
<view class="content">
<!-- #ifdef APP -->
<page-head :title="title"></page-head
>
<scroll-view style="flex: 1"
>
<view v-for="(item,index) in resultArray" :key="index" class="result"
>
<!-- #endif --
>
<view>{{names[index]}}测试结果:</view
>
<view class="content"
>
<view
>
<page-head :title="title"></page-head
>
测试api:{{item.passed.join(', ')}}
<view v-for="(item, index) in resultArray" :key="index" class="result">
</view>
<view>{{ names[index] }}测试结果:
</view>
<view>总共:{{item.total}}
</view>
<view> 测试api:{{ item.passed.join(', ') }}
</view>
<view>通过:{{item.passed.length
}}</view>
<view>总共:{{ item.total
}}</view>
<view>失败:{{item.failed.length
}}</view>
<view>通过:{{ item.passed.length
}}</view>
<view v-for="(fail,i) in item.failed" :key="i"
>
<view>失败:{{ item.failed.length }}</view
>
<text class="failed">{{fail}}</text
>
<view v-for="(fail, i) in item.failed" :key="i"
>
</view
>
<text class="failed">{{ fail }}</text
>
</view>
</view>
</view>
</view>
</view>
<!-- #ifdef APP -->
</scroll-view>
<!-- #endif -->
</template>
</template>
<script lang="ts">
<script lang="ts">
import {
import { runTests, Result } from '../../uni_modules/uts-tests'
runTests,
Result
} from '../../uni_modules/uts-tests'
export default {
export default {
data() {
data() {
return {
return {
title: 'UTS基础语法',
title: 'UTS基础语法',
resultArray: [] as Result[],
resultArray: [] as Result[],
result: {} as UTSJSONObject,
result: {} as UTSJSONObject,
names: [] as string[]
names: [] as string[],
}
},
onReady() {
this.test()
},
methods: {
test() {
this.result = runTests()
const resultMap = this.result.toMap()
resultMap.forEach((res, name) => {
this.names.push(name)
this.resultArray.push(res as Result)
})
}
}
}
}
},
onReady() {
this.test()
},
methods: {
test() {
this.result = runTests()
const resultMap = this.result.toMap()
resultMap.forEach((res, name) => {
this.names.push(name)
this.resultArray.push(res as Result)
})
},
},
}
</script>
</script>
<style>
<style>
@import '@/common/uni-uvue.css';
@import '@/common/uni-uvue.css';
.content {
.content {
min-height: 100%;
min-height: 100%;
padding: 32rpx;
padding: 32rpx;
}
}
.passed {
.passed {
color: green;
color: green;
}
}
.failed {
.failed {
color: red;
color: red;
}
}
.result {
.result {
margin-bottom: 20rpx;
margin-bottom: 20rpx;
}
}
</style>
</style>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录