提交 0151efca 编写于 作者: DCloud-yyl's avatar DCloud-yyl

Merge branch 'alpha'

# Conflicts:
#	App.vue
<!-- HBuilder X 版本要求: 3.6.11+ -->
<script>
export default {
onLaunch: function() {
console.log('App Launch')
},
onShow: function() {
console.log('App Show')
},
onHide: function() {
console.log('App Hide')
}
}
<script lang="ts">
let firstBackTime = 0
export default {
onLaunch: function () {
console.log('App Launch')
},
onShow: function () {
console.log('App Show')
},
onHide: function () {
console.log('App Hide')
},
onLastPageBackPress: function () {
console.log('App LastPageBackPress')
if (firstBackTime == 0) {
uni.showToast({
title: '再按一次退出应用',
position: 'bottom',
})
firstBackTime = Date.now()
setTimeout(() => {
firstBackTime = 0
}, 2000)
} else if (Date.now() - firstBackTime < 2000) {
firstBackTime = Date.now()
uni.exit()
}
},
onExit() {
console.log('App Exit')
},
}
</script>
<style>
/*每个页面公共css */
/* uni.css - 通用组件、模板样式库,可以当作一套ui库应用 */
/* #ifdef APP-VUE */
@import './common/uni.css';
/* #endif */
/*每个页面公共css */
/* uni.css - 通用组件、模板样式库,可以当作一套ui库应用 */
/* #ifdef APP-VUE */
@import './common/uni.css';
/* #endif */
</style>
/* #ifndef APP-PLUS-NVUE */
/* page {
min-height: 100%;
height: auto;
} */
/* #endif */
/* 解决头条小程序字体图标不显示问题,因为头条运行时自动插入了span标签,且有全局字体 */
/* #ifdef MP-TOUTIAO */
/* text :not(view) {
font-family: uniicons;
} */
/* #endif */
.uni-icon {
/* font-family: uniicons;
font-weight: normal; */
width: 14px;
height: 14px;
}
.uni-container {
padding: 0 15px 15px;
background-color: #f8f8f8;
}
.uni-header-logo {
/* #ifdef H5 */
display: flex;
/* #endif */
padding: 15px 15px;
flex-direction: column;
justify-content: center;
align-items: center;
margin-top: 10rpx;
}
.uni-header-image {
width: 80px;
height: 80px;
}
.uni-hello-text {
margin-bottom: 20px;
color: #7A7E83;
}
.hello-text {
color: #7A7E83;
font-size: 14px;
line-height: 20px;
}
.hello-link {
color: #7A7E83;
font-size: 14px;
line-height: 20px;
}
.uni-panel {
margin-bottom: 12px;
}
.text-disabled {
color: #a0a0a0;
}
.uni-panel-h {
display: flex;
background-color: #ffffff;
flex-direction: row !important;
justify-content: space-between !important;
align-items: center !important;
padding: 12px;
}
/*
.uni-panel-h:active {
background-color: #f8f8f8;
}
*/
.uni-panel-h-on {
background-color: #f0f0f0;
}
.uni-panel-text {
color: #000000;
font-size: 14px;
font-weight: normal;
}
.uni-panel-icon {
margin-left: 15px;
color: #999999;
font-size: 14px;
font-weight: normal;
transform: rotate(0deg);
transition-duration: 0s;
transition-property: transform;
}
.uni-panel-icon-on {
transform: rotate(180deg);
}
.uni-navigate-item {
display: flex;
flex-direction: row;
align-items: center;
background-color: #FFFFFF;
border-top-style: solid;
border-top-color: #f0f0f0;
border-top-width: 1px;
padding: 12px;
justify-content: space-between;
/* #ifdef H5 */
/* cursor: pointer; */
/* #endif */
}
.uni-navigate-item-active {
background-color: #f8f8f8;
}
.uni-navigate-text {
color: #000000;
font-size: 14px;
font-weight: normal;
}
.uni-navigate-icon {
margin-left: 15px;
color: #999999;
font-size: 14px;
font-weight: normal;
}
\ No newline at end of file
此差异已折叠。
<template name="page-head">
<view class="common-page-head">
<view class="common-page-head-title">{{title}}</view>
</view>
</template>
<script>
export default {
name: "page-head",
props: {
title: {
type: String,
default: ""
}
}
}
</script>
<template name="page-head">
<view class="common-page-head">
<view class="common-page-head-title-box">
<text class="common-page-head-title">{{title}}</text>
</view>
</view>
</template>
<script>
export default {
name: "page-head",
props: {
title: {
type: String,
default: ""
}
}
}
</script>
<style>
.common-page-head {
display: flex;
padding: 35rpx;
flex-direction: row;
justify-content: center;
}
.common-page-head-title-box {
padding: 0 40rpx;
height: 88rpx;
border-bottom: 2rpx solid #D8D8D8;
}
.common-page-head-title {
line-height: 88rpx;
font-size: 30rpx;
color: #BEBEBE;
}
</style>
\ No newline at end of file
module.exports = {
"is-custom-runtime": false,
"compile": true,
"h5": {
"options": {
"headless": true
},
"executablePath": ""
},
"mp-weixin": {
"port": 9420,
"account": "",
"args": "",
"cwd": "",
"launch": true,
"teardown": "disconnect",
"remote": false,
"executablePath": ""
},
"app-plus": {
"android": {
"id": "emulator-5554",
"executablePath": "/Users/yuanrenjie/Desktop/HBuilderX-Alpha.app/Contents/HBuilderX/plugins/launcher/base/android_base.apk"
},
"version": "/Users/yuanrenjie/Desktop/HBuilderX-Alpha.app/Contents/HBuilderX/plugins/launcher/base/version.txt",
"ios": {
"id": "",
"executablePath": ""
}
}
}
\ No newline at end of file
const {
readFileSync,
readdirSync
} = require('fs')
const {
extname,
resolve
} = require('path')
const describeRE = /describe\(["|'](.*)["|']/
const testsRE = /test\(["|'](.*)["|']/g
function parse(content) {
const describes = content.match(describeRE)
if (!describes) {
return
}
const describe = describes[1]
const tests = []
let test
while (test = testsRE.exec(content)) {
tests.push(test[1])
}
return {
describe,
tests
}
}
function parseDescribes() {
const dir = resolve(__dirname, 'uni_modules/uts-tests/utssdk')
const describes = []
readdirSync(dir).forEach(file => {
if (extname(file) === '.uts') {
describes.push(parse(readFileSync(resolve(dir, file), 'utf8')))
}
})
return describes
};
module.exports = {
testTimeout: 10000,
reporters: [
'default'
],
globals: {
describes: parseDescribes()
},
watchPathIgnorePatterns: ['/node_modules/', '/dist/', '/.git/'],
moduleFileExtensions: ['js', 'json'],
rootDir: __dirname,
testMatch: ["<rootDir>/pages/**/*test.[jt]s?(x)"],
testPathIgnorePatterns: ['/node_modules/']
}
import App from './App'
// #ifndef VUE3
import Vue from 'vue'
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
...App
})
app.$mount()
// #endif
// #ifdef VUE3
import { createSSRApp } from 'vue'
export function createApp() {
const app = createSSRApp(App)
return {
app
}
}
// #endif
\ No newline at end of file
}
\ No newline at end of file
import App from './App'
import { createSSRApp } from 'vue'
export function createApp() {
const app = createSSRApp(App)
return {
app
}
}
\ No newline at end of file
{
"name" : "HelloUTS",
"appid" : "__UNI__70BE9D0",
"description" : "",
"versionName" : "1.0.9",
"versionCode" : "109",
"transformPx" : false,
/* 5+App特有相关 */
"app-plus" : {
"usingComponents" : true,
"nvueStyleCompiler" : "uni-app",
"compilerVersion" : 3,
"splashscreen" : {
"alwaysShowBeforeRender" : true,
"waiting" : true,
"autoclose" : true,
"delay" : 0
},
/* 模块配置 */
"modules" : {},
/* 应用发布信息 */
"distribute" : {
/* android打包配置 */
"android" : {
"permissions" : [
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
"<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
],
"minSdkVersion" : 21,
"abiFilters" : [ "armeabi-v7a" ]
},
/* ios打包配置 */
"ios" : {
"dSYMs" : false
},
/* SDK配置 */
"sdkConfigs" : {
"ad" : {}
}
}
},
/* 快应用特有相关 */
"quickapp" : {},
/* 小程序特有相关 */
"mp-weixin" : {
"appid" : "",
"setting" : {
"urlCheck" : false
},
"usingComponents" : true
},
"mp-alipay" : {
"usingComponents" : true
},
"mp-baidu" : {
"usingComponents" : true
},
"mp-toutiao" : {
"usingComponents" : true
},
"uniStatistics" : {
"enable" : false
},
"vueVersion" : "3"
}
"name": "HelloUTS",
"appid": "__UNI__70BE9D0",
"description": "",
"versionName": "1.0.9",
"versionCode": "109",
"transformPx": false,
/* 5+App特有相关 */
"app-plus": {
"usingComponents": true,
"nvueStyleCompiler": "uni-app",
"compilerVersion": 3,
"splashscreen": {
"alwaysShowBeforeRender": true,
"waiting": true,
"autoclose": true,
"delay": 0
},
/* 模块配置 */
"modules": {},
/* 应用发布信息 */
"distribute": {
/* android打包配置 */
"android": {
"permissions": [
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
"<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
],
"minSdkVersion": 21,
"abiFilters": ["armeabi-v7a"]
},
/* ios打包配置 */
"ios": {
"dSYMs": false
},
/* SDK配置 */
"sdkConfigs": {
"ad": {}
}
}
},
/* 快应用特有相关 */
"quickapp": {},
/* 小程序特有相关 */
"mp-weixin": {
"appid": "",
"setting": {
"urlCheck": false
},
"usingComponents": true
},
"mp-alipay": {
"usingComponents": true
},
"mp-baidu": {
"usingComponents": true
},
"mp-toutiao": {
"usingComponents": true
},
"uniStatistics": {
"enable": false
},
"vueVersion": "3"
}
\ No newline at end of file
{
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{
"path" : "pages/index/index",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path" : "pages/advance/advance",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path" : "pages/SystemAPI/SystemAPI",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path" : "pages/SystemAPI/Alert/alert",
"style" :
{
"navigationBarTitleText": ""
}
},
{
"path" : "pages/component/helloView",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path" : "pages/SDKIntegration/SDKIntegration",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path" : "pages/SDKIntegration/TencentLocation/TencentLocation",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path" : "pages/SDKIntegration/Lottie/index",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path" : "pages/SDKIntegration/Toast/Toast",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path" : "pages/lifecycle/lifecycle",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path" : "pages/resource/resource",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path" : "pages/advance/android/decorview",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path" : "pages/advance/iOS/getResourcePath",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path" : "pages/advance/android/assetaudio",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path" : "pages/SystemAPI/ScreenListen/screenlisten",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path": "pages/index/basicTest",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path": "pages/advance/advance",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path": "pages/SystemAPI/SystemAPI",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path": "pages/SystemAPI/Alert/alert",
"style": {
"navigationBarTitleText": ""
}
},
{
"path": "pages/component/helloView",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path": "pages/SDKIntegration/SDKIntegration",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path": "pages/SDKIntegration/TencentLocation/TencentLocation",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path": "pages/SDKIntegration/Lottie/index",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path": "pages/SDKIntegration/Toast/Toast",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path": "pages/lifecycle/lifecycle",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path": "pages/resource/resource",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path": "pages/resource/fileRead",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path": "pages/advance/android/decorview",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path": "pages/advance/iOS/getResourcePath",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path": "pages/advance/android/assetaudio",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path": "pages/SystemAPI/ScreenListen/screenlisten",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path": "pages/SyntaxCase/index",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path": "pages/SyntaxCase/paramTest",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path": "pages/SyntaxCase/consoleTest",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path" : "pages/SyntaxCase/index",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
"path": "pages/SyntaxCase/instanceTest",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path": "pages/SyntaxCase/utsAndroid",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path": "pages/SyntaxCase/utsiOS",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}
],
],
"tabBar": {
"color": "#7A7E83",
"selectedColor": "#007AFF",
......@@ -158,7 +193,7 @@
"pagePath": "pages/advance/advance",
"text": "进阶"
}, {
"pagePath":"pages/SystemAPI/SystemAPI",
"pagePath": "pages/SystemAPI/SystemAPI",
"text": "系统API"
}, {
"pagePath": "pages/SDKIntegration/SDKIntegration",
......@@ -173,4 +208,4 @@
"backgroundColor": "#F8F8F8"
},
"uniIdRouter": {}
}
}
\ No newline at end of file
......@@ -8,7 +8,7 @@
<button @tap="changeAction(1)">测试action play</button>
<button @tap="changeAction(2)">测试action pause</button>
<button @tap="changeAction(3)">测试action stop</button>
<uts-animation-view ref="animView" :path="animUrl" :autoplay="autoplay" :loop="loop" :action="action"
<uts-animation-view ref="animView" :path="animUrl" :autoplay="autoplay" :loop="loop" :action="action"
:hidden="hidden" @bindended="testAnimEnd" @click="lottieClickTest" @longpress="lottieLongpressTest"
:style="{width:widthNum+'rpx',height:heightNum+'px',background:yanse}">
</uts-animation-view>
......
<template>
<div>
<button @tap="changeUrl">播放本地动画资源</button>
<button @tap="changeServerUrl">播放远程动画资源</button>
<button @tap="changeAutoPlay">测试AutoPlay</button>
<button @tap="changeLoop">测试Loop</button>
<button @tap="changeAction(1)">测试action play</button>
<button @tap="changeAction(2)">测试action pause</button>
<button @tap="changeAction(3)">测试action stop</button>
<!-- <uts-animation-view ref="animView" :path="animUrl" :autoplay="autoplay" :loop="loop" :action="action"
:hidden="hidden" @bindended="testAnimEnd" @click="lottieClickTest" @longpress="lottieLongpressTest"
:style="{width:widthNum+'rpx',height:heightNum+'px',background:yanse}">
</uts-animation-view> -->
</div>
</template>
<script lang="ts">
export default {
data() {
return {
hidden: false,
autoplay: false,
action: "play",
loop: false,
yanse: "red",
widthNum: 750,
heightNum: 200,
comShow: true,
animUrl: "/static/anim_a.json"
}
},
methods: {
changeAutoPlay: function() {
this.autoplay = !this.autoplay
},
changeUrl: function() {
if (this.animUrl == "/static/anim_a.json") {
this.animUrl = "/static/anim_b.json"
} else {
this.animUrl = "/static/anim_a.json"
}
},
changeServerUrl: function() {
this.animUrl = "https://b.bdstatic.com/miniapp/images/lottie_example_one.json"
},
changeAction: function(type: number) {
if (type == 1) {
this.action = "play"
} else if (type == 2) {
this.action = "pause"
} else if (type == 3) {
this.action = "stop"
}
},
changeLoop: function() {
this.loop = !this.loop
},
testAnimEnd: function() {
console.log("testAnimEnd");
},
changeRepeat: function() {
// this.$refs["animView"].updateRepeatConfig("RESTART");
},
lottieClickTest: function() {
console.log("lottieClickTest");
},
lottieLongpressTest: function() {
console.log("lottieClickTest");
},
}
}
</script>
<template>
<view class="uni-container">
<page-head :title="title"></page-head>
<view class="uni-panel" v-for="(item, index) in list" :key="index">
<view class="uni-panel-h" :class="item.open ? 'uni-panel-h-on' : ''" @click="goDetailPage(item)"
hover-class="uni-navigate-item-active">
<text class="uni-panel-text">{{item.name}}</text>
<image :src="arrowRightIcon" class="uni-icon"></image>
</view>
</view>
</view>
</template>
<script lang="ts">
// import {
// checkHasIntegration
// } from "@/uni_modules/uts-tencentgeolocation";
// import {
// checkHasLottieIntegration
// } from "@/uni_modules/uts-animation-view";
type ListItem = {
name : string,
open : boolean,
function ?: string,
url ?: string
}
export default {
data() {
return {
title: 'SDK集成示例',
list: [{
name: "腾讯定位sdk集成示例",
function: "gotoTencentLocation"
},
{
name: "Toast示例",
url: "SDKIntegration/Toast/Toast"
},
{
name: "Lottie动画示例",
function: "gotoLottie"
}
] as ListItem[],
arrowRightIcon: '/static/icons/arrow-right.png',
}
},
methods: {
goDetailPage(e : ListItem) {
if (e.function != null) {
const funName = e.function
switch (funName) {
case 'gotoTencentLocation':
this.gotoTencentLocation()
break
case 'gotoLottie':
this.gotoLottie()
break
}
return
}
uni.navigateTo({
url: `/pages/${e.url!}`
})
},
gotoLottie: function () {
uni.showToast({
title:'暂时不支持uni-appx'
})
},
gotoTencentLocation: function () {
uni.showToast({
title:'暂时不支持uni-appx'
})
},
gotoTencentMap: function () {
uni.navigateTo({
url: '/pages/SDKIntegration/TencentMap/TencentMap'
})
}
}
}
</script>
<style>
@import '@/common/uni-uvue.css';
</style>
\ No newline at end of file
<template>
<view>
<page-head :title="title"></page-head>
<uni-list>
<uni-list-item @tap="gotoTencentLocation" title="腾讯定位sdk集成示例" class="itemButton" :clickable="true" link/>
<uni-list-item @tap="gotoToast" title="Toast示例" class="itemButton" :clickable="true" link/>
<uni-list-item @tap="gotoLottie" title="Lottie动画示例" class="itemButton" :clickable="true" link/>
</uni-list>
</view>
</template>
<script>
import {
checkHasIntegration
} from "@/uni_modules/uts-tencentgeolocation";
import {
checkHasLottieIntegration
} from "@/uni_modules/uts-animation-view";
export default {
data() {
return {
title: 'SDK集成示例',
}
},
methods: {
gotoToast:function(e){
uni.navigateTo({
url:'/pages/SDKIntegration/Toast/Toast'
})
},
gotoLottie:function(e){
if(checkHasLottieIntegration()){
uni.navigateTo({
url:'/pages/SDKIntegration/Lottie/index'
})
}else{
uni.showToast({
icon:'none',
title:'需要在自定义基座中运行'
})
}
},
gotoTencentLocation:function(e){
let ret = checkHasIntegration();
if(!ret){
uni.showToast({
icon:'none',
title:'需要在自定义基座中运行'
})
}else{
uni.navigateTo({
url:'/pages/SDKIntegration/TencentLocation/TencentLocation'
})
}
},
gotoTencentMap:function(e){
uni.navigateTo({
url:'/pages/SDKIntegration/TencentMap/TencentMap'
})
}
}
}
</script>
<style>
</style>
<template>
<view class="uni-container">
<page-head :title="title"></page-head>
<view class="uni-panel" v-for="(item, index) in list" :key="index">
<view class="uni-panel-h" :class="item.open ? 'uni-panel-h-on' : ''" @click="goDetailPage(item)" hover-class="uni-navigate-item-active">
<text class="uni-panel-text">{{item.name}}</text>
<image :src="arrowRightIcon" class="uni-icon"></image>
</view>
</view>
</view>
</template>
<script>
import {
checkHasIntegration
} from "@/uni_modules/uts-tencentgeolocation";
import {
checkHasLottieIntegration
} from "@/uni_modules/uts-animation-view";
export default {
data() {
return {
title: 'SDK集成示例',
list: [{
name: "腾讯定位sdk集成示例",
function: "gotoTencentLocation"
},
{
name: "Toast示例",
url: "SDKIntegration/Toast/Toast"
},
{
name: "Lottie动画示例",
function: "gotoLottie"
}
],
arrowRightIcon: '/static/icons/arrow-right.png',
}
},
methods: {
goDetailPage(e) {
if (e.function) {
this[e.function]()
return
}
uni.navigateTo({
url: `/pages/${e.url}`
})
},
gotoLottie: function(e) {
if (checkHasLottieIntegration()) {
uni.navigateTo({
url: '/pages/SDKIntegration/Lottie/index'
})
} else {
uni.showToast({
icon: 'none',
title: '需要在自定义基座中运行'
})
}
},
gotoTencentLocation: function(e) {
let ret = checkHasIntegration();
if (!ret) {
uni.showToast({
icon: 'none',
title: '需要在自定义基座中运行'
})
} else {
uni.navigateTo({
url: '/pages/SDKIntegration/TencentLocation/TencentLocation'
})
}
},
gotoTencentMap: function(e) {
uni.navigateTo({
url: '/pages/SDKIntegration/TencentMap/TencentMap'
})
}
}
}
</script>
<style>
@import '@/common/uni-uvue.css';
.uni-container {
min-height: 100%;
}
</style>
\ No newline at end of file
<template>
<view>
<page-head :title="title"></page-head>
<view class="uni-padding-wrap uni-common-mt">
<view class="uni-hello-text">
1. 腾讯定位sdk需在腾讯地图官网申请key。 https://lbs.qq.com/
</view>
<view class="uni-hello-text">
2. 按照readme文档配置apikey
</view>
<view class="uni-hello-text">
3. 需要制作自定义基座运行
</view>
</view>
<view class="uni-btn-v uni-common-mt">
<button type="primary" @tap="checkLocationPermission">请求定位权限</button>
<button type="primary" @tap="testGetlocation">获取设备位置信息</button>
<button type="primary" @tap="testWatchPosition">监听设备位置信息</button>
<button type="primary" @tap="testClearWatch">停止监听</button>
</view>
</view>
</template>
<script>
// import {
// checkHasIntegration,
// requestPremission,
// getLocation,
// watchPosition,
// clearWatch
// } from "../../../uni_modules/uts-tencentgeolocation";
export default {
data() {
return {
title: '腾讯定位SDK集成示例',
}
},
methods: {
checkLocationPermission: function() {
// requestPremission();
},
testGetlocation: function() {
// let startRet = getLocation({
// geocode: true,
// success: function(response) {
// console.log(response);
// var addressDesc = response.name + '-' + response.address
// uni.showToast({
// title: '执行结果:' + addressDesc,
// icon: 'none'
// });
// },
// fail: function(msg) {
// uni.showToast({
// title: msg,
// icon: "none"
// })
// }
// })
// if (!startRet) {
// uni.showToast({
// title: '定位启动失败,请检查配置',
// icon: 'none'
// });
// }
},
testWatchPosition() {
// watchPosition({
// geocode: true,
// success: function(response) {
// console.log(response);
// var addressDesc = response.name + '-' + response.address
// uni.showToast({
// title: '执行结果:' + addressDesc,
// icon: 'none'
// });
// },
// fail: function(msg) {
// uni.showToast({
// title: msg,
// icon: "none"
// })
// }
// })
},
testClearWatch() {
// clearWatch()
}
}
}
</script>
<style>
</style>
<template>
<view>
<page-head :title="title"></page-head>
<view class="uni-padding-wrap uni-common-mt">
<view class="uni-hello-text">
1.Android 平台需要自定义基座运行
</view>
</view>
<view class="uni-padding-wrap uni-common-mt">
<button @tap="testToastShow">调用 Toast 弹窗</button>
</view>
</view>
</template>
<script>
import { showToast } from '@/uni_modules/uts-toast'
export default {
data() {
return {
title:"Toast 示例"
}
},
methods:{
testToastShow(){
let ret = showToast();
if(!ret){
uni.showToast({
icon:'none',
title:'需要在自定义基座中运行'
})
}
}
}
}
</script>
<style>
</style>
\ No newline at end of file
<template>
<button @click="logStr">打印字符串</button>
<button @click="logFloat">打印浮点数</button>
<button @click="logInt">打印整数</button>
<button @click="logObject">打印对象</button>
<button @click="logFunction">打印函数</button>
</template>
<script>
import {
logStrTest,
logIntTest,
logFloatTest,
logObjectTest,
logFunctionTest
} from '@/uni_modules/uts-advance'
export default {
data() {
return {}
},
methods: {
logStr() {
logStrTest()
},
logFloat() {
logFloatTest()
},
logInt() {
logIntTest()
},
logObject() {
logObjectTest()
},
logFunction() {
logFunctionTest()
},
}
}
</script>
<style>
</style>
\ No newline at end of file
<template>
<button @click="logStr">打印字符串</button>
<button @click="logFloat">打印浮点数</button>
<button @click="logInt">打印整数</button>
<button @click="logObject">打印对象</button>
<button @click="logFunction">打印函数</button>
<button @click="logFile">打印文件</button>
<button @click="logDate">打印日期</button>
<button @click="logDateCombine">组合打印日期</button>
</template>
<script>
import {
logStrTest,
logIntTest,
logFloatTest,
logObjectTest,
logFunctionTest,
logDateTest,
logFileTest,
logDateCombineTest
} from '@/uni_modules/uts-advance'
export default {
data() {
return {}
},
methods: {
logStr() {
logStrTest()
},
logFloat() {
logFloatTest()
},
logInt() {
logIntTest()
},
logObject() {
logObjectTest()
},
logFunction() {
logFunctionTest()
},
logFile() {
logFileTest()
},
logDate() {
logDateTest()
},
logDateCombine() {
logDateCombineTest()
},
}
}
</script>
<style>
</style>
\ No newline at end of file
<template>
<view>
<view>暂时不支持2.0 语法调用测试</view>
</view>
</template>
<script>
</script>
\ No newline at end of file
此差异已折叠。
<template>
{{ret}}
<button @click="instanceCreate">多实例创建测试</button>
</template>
<script>
import {
User
} from '@/uni_modules/uts-advance'
export default {
data() {
return {
ret:''
}
},
methods: {
instanceCreate() {
const user1 = new User("张三", 20);
let userText1 = user1.describeSelf()
const user2 = new User("李四", 30);
let userText2 = user2.describeSelf()
const user3 = new User("王五", 40);
let userText3 = user3.describeSelf()
if(userText1 == userText2 || userText1 == userText3 || userText2 == userText3){
this.ret = '测试未通过'
}else{
this.ret = '测试通过'
}
}
}
}
</script>
<style>
</style>
\ No newline at end of file
<template>
{{ret}}
<button @click="instanceCreate">多实例创建测试</button>
</template>
<script>
import {
User
} from '@/uni_modules/uts-advance'
export default {
data() {
return {
ret:''
}
},
methods: {
instanceCreate() {
const user1 = new User("张三", 20);
let userText1 = user1.describeSelf()
const user2 = new User("李四", 30);
let userText2 = user2.describeSelf()
const user3 = new User("王五", 40);
let userText3 = user3.describeSelf()
if(userText1 == userText2 || userText1 == userText3 || userText2 == userText3){
this.ret = '测试未通过'
}else{
this.ret = '测试通过'
}
}
}
}
</script>
<style>
</style>
\ No newline at end of file
<template>
<button @click="inputArrayTest">传入数组参数</button>
<button @click="inputParamTest">传入复杂对象参数</button>
<button @click="returnArrayTest">返回数组参数</button>
<button @click="returnParamTest">返回复杂对象参数</button>
<button @click="callbackArrayTest">异步返回数组</button>
<button @click="callbackParamTest">异步返回复杂对象</button>
</template>
<script>
import {
inputArray,
inputParam,
returnArray,
returnParam,
callbackArray,
callbackParam,
ParamOptions
} from '@/uni_modules/uts-advance'
export default {
data() {
return {}
},
methods: {
inputArrayTest() {
let ret = inputArray(['a', 'b', 'c'])
if (ret) {
uni.showToast({
title: '测试通过'
})
}
},
inputParamTest() {
let ret = inputParam({
title: "hello",
array: ["1", "2", "3"]
} as ParamOptions)
if (ret) {
uni.showToast({
title: '测试通过'
})
}
},
returnArrayTest() {
let ret = returnArray()
if ('["1","2","3"]' == JSON.stringify(ret)) {
uni.showToast({
title: '测试通过'
})
}
},
returnParamTest() {
let ret = returnParam()
if ('{"title":"returnParam","array":["1","2","3"]}' == JSON.stringify(ret)) {
uni.showToast({
title: '测试通过'
})
}
},
callbackArrayTest() {
callbackArray(function(res) {
if ('["8","8","8"]' == JSON.stringify(res)) {
uni.showToast({
title: '测试通过'
})
}
});
},
callbackParamTest() {
callbackParam(function(res) {
if ('{"title":"callbackParam","array":["4","5","6"]}' == JSON.stringify(res)) {
uni.showToast({
title: '测试通过'
})
}
});
}
}
}
</script>
<style>
</style>
\ No newline at end of file
<template>
<button @click="inputArrayTest">传入数组参数</button>
<button @click="inputParamTest">传入复杂对象参数</button>
<button @click="returnArrayTest">返回数组参数</button>
<button @click="returnParamTest">返回复杂对象参数</button>
<button @click="callbackArrayTest">异步返回数组</button>
<button @click="callbackParamTest">异步返回复杂对象</button>
</template>
<script>
import {
inputArray,
inputParam,
returnArray,
returnParam,
callbackArray,
callbackParam,
} from '@/uni_modules/uts-advance'
export default {
data() {
return {}
},
methods: {
inputArrayTest() {
let ret = inputArray(['a', 'b', 'c'])
if (ret) {
uni.showToast({
title: '测试通过'
})
}
},
inputParamTest() {
let ret = inputParam({
title: "hello",
array: ["1", "2", "3"]
})
if (ret) {
uni.showToast({
title: '测试通过'
})
}
},
returnArrayTest() {
let ret = returnArray()
console.log( JSON.stringify(ret))
if ('["1","2","3"]' == JSON.stringify(ret)) {
uni.showToast({
title: '测试通过'
})
}
},
returnParamTest() {
let ret = returnParam()
if ('{"title":"returnParam","array":["1","2","3"]}' == JSON.stringify(ret)) {
uni.showToast({
title: '测试通过'
})
}
},
callbackArrayTest() {
callbackArray(function(res) {
if ('["8","8","8"]' == JSON.stringify(res)) {
uni.showToast({
title: '测试通过'
})
}
});
},
callbackParamTest() {
callbackParam(function(res) {
if ('{"title":"callbackParam","array":["4","5","6"]}' == JSON.stringify(res)) {
uni.showToast({
title: '测试通过'
})
}
});
}
}
}
</script>
<style>
</style>
\ No newline at end of file
<template>
<!-- #ifdef APP -->
<scroll-view style="flex: 1">
<!-- #endif -->
<view>
<view class="uni-padding-wrap uni-common-mt">
<view class="uni-hello-text"> 逐一点击执行,观察测试反馈 </view>
</view>
<button @click="getAppContextClick">getAppContext</button>
<button @click="getUniActivityClick">getUniActivity</button>
<button @click="getAppTempPathClick">getAppTempPath</button>
<button @click="typeofClick">typeof</button>
<button @click="arrayPermissionFlowClick">组权限申请流程测试</button>
<button @click="singlePermissionFlowClick">单权限申请流程测试</button>
<button @click="dispatchAsyncClick">任务分发测试</button>
<button @click="pathTestClick">路径转换测试</button>
<button @click="privacyStateClick">隐私协议状态测试</button>
<view class="uni-padding-wrap uni-common-mt">
<view class="uni-hello-text">
1. 当前页面已通过initAppLifecycle函数注册了生命周期监听。
</view>
<view class="uni-hello-text">
2. 手动切换其他APP再返回,可在控制台和界面观察事件日志
</view>
</view>
<view class="uni-padding-wrap uni-common-mt">
<view class="text-box" scroll-y="true">
<text>{{ text }}</text>
</view>
</view>
<button @click="gotoSystemPermissionActivityClick">
手动申请权限测试
</button>
<button @tap="testGoOtherActivity">跳转拍照界面</button>
<button @tap="testUnRegLifecycle">取消注册周期函数</button>
<image :src="selectImage" v-if="selectImage"></image>
<view class="uni-padding-wrap uni-common-mt">
<view class="uni-hello-text"> 获取设备信息,观察是否符合预期 </view>
</view>
<button @tap="getDeviceInfoClick">获取设备基础信息</button>
</view>
<!-- #ifdef APP -->
</scroll-view>
<!-- #endif -->
</template>
<script>
import {
getAppContextTest,
getUniActivityTest,
getAppTempPathTest,
typeofClickTest,
gotoSystemPermissionActivityTest,
arrayPermissionFlowTest,
singlePermissionFlowTest,
dispatchAsyncTest,
convert2AbsFullPathTest,
unRegLifecycle,
initAppLifecycle,
gotoCameraTake,
getDeviceInfoTest,
privacyStateTest,
} 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() {
if (getUniActivityTest()) {
uni.showToast({
title: '测试通过',
})
} else {
uni.showToast({
icon: 'error',
title: '测试失败',
})
}
},
pathTestClick() {
if (convert2AbsFullPathTest()) {
uni.showToast({
title: '测试通过',
})
} else {
uni.showToast({
icon: 'error',
title: '测试失败',
})
}
},
getAppTempPathClick() {
if (getAppTempPathTest()) {
uni.showToast({
title: '测试通过',
})
} 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>
<style>
.testButton {
width: 100%;
}
</style>
<template>
<view>
<view class="uni-padding-wrap uni-common-mt">
<view class="uni-hello-text">
逐一点击执行,观察测试反馈
</view>
</view>
<button @click="getAppContextClick">getAppContext</button>
<button @click="getUniActivityClick">getUniActivity</button>
<button @click="getAppTempPathClick">getAppTempPath</button>
<button @click="typeofClick">typeof</button>
<button @click="arrayPermissionFlowClick">组权限申请流程测试</button>
<button @click="singlePermissionFlowClick">单权限申请流程测试</button>
<button @click="dispatchAsyncClick">任务分发测试</button>
<button @click="pathTestClick">路径转换测试</button>
<button @click="privacyStateClick">隐私协议状态测试</button>
<view class="uni-padding-wrap uni-common-mt">
<view class="uni-hello-text">
1. 当前页面已通过initAppLifecycle函数注册了生命周期监听。
</view>
<view class="uni-hello-text">
2. 手动切换其他APP再返回,可在控制台和界面观察事件日志
</view>
</view>
<view class="uni-padding-wrap uni-common-mt">
<view class="text-box" scroll-y="true">
<text>{{text}}</text>
</view>
</view>
<button @click="gotoSystemPermissionActivityClick">手动申请权限测试</button>
<button @tap="testGoOtherActivity">跳转拍照界面</button>
<button @tap="testUnRegLifecycle">取消注册周期函数</button>
<image :src="selectImage" v-if="selectImage"></image>
<view class="uni-padding-wrap uni-common-mt">
<view class="uni-hello-text">
获取设备信息,观察是否符合预期
</view>
</view>
<button @tap="getDeviceInfoClick">获取设备基础信息</button>
</view>
</template>
<script>
import {
getAppContextTest,
getUniActivityTest,
getAppTempPathTest,
typeofClickTest,
gotoSystemPermissionActivityTest,
arrayPermissionFlowTest,
singlePermissionFlowTest,
dispatchAsyncTest,
convert2AbsFullPathTest,
unRegLifecycle,
initAppLifecycle,
gotoCameraTake,
getDeviceInfoTest,
privacyStateTest
} from '@/uni_modules/uts-platform-api'
/**
* 测试在页面生命周期之外,使用api
*/
export default {
data() {
return {
text: '',
selectImage:''
}
},
onLoad:function(){
let that = this;
initAppLifecycle(function(eventLog){
// 展示捕捉到的声明周期日志
that.text = that.text += eventLog;
that.text = that.text += '\n';
});
},
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() {
if (getUniActivityTest()) {
uni.showToast({
title: '测试通过'
})
} else {
uni.showToast({
icon: 'error',
title: '测试失败'
})
}
},
pathTestClick() {
if (convert2AbsFullPathTest()) {
uni.showToast({
title: '测试通过'
})
} else {
uni.showToast({
icon: 'error',
title: '测试失败'
})
}
},
getAppTempPathClick() {
if (getAppTempPathTest()) {
uni.showToast({
title: '测试通过'
})
} 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>
<style>
.testButton{
width:100%
}
</style>
\ No newline at end of file
<template>
</template>
<script>
</script>
<style>
</style>
\ No newline at end of file
<template>
<view>
<button @click="testCurrentVC">获取当前UIViewController</button>
<view class="result" :style="resultStyle(currentVCResult.passed)"> 测试结果 -- {{formatResult(currentVCResult.passed)}}</view>
<button @click="testKeyWindow">获取当前app的keyWindow</button>
<view class="result" :style="resultStyle(keyWindowResult.passed)"> 测试结果 -- {{formatResult(keyWindowResult.passed)}}</view>
<button @click="testColorConvert">将字符串色值转换为UIColor</button>
<view class="result">
<p v-for="item in colorConvertResult" :style="resultStyle(item.passed)"> {{item.key}}: {{item.value}} -- {{formatResult(item.passed)}}</p>
</view>
<button @click="testResourcePath">资源路径转换</button>
<view class="result" :style="resultStyle(resourcePathResult.passed)"> {{resourcePathResult.key}}: {{resourcePathResult.value}} -- {{formatResult(resourcePathResult.passed)}}</view>
<button @click="testDeviceInfo">获取设备信息</button>
<view class="result">
<p v-for="item in deviceInfoResult" :style="resultStyle(item.passed)"> {{item.key}}: {{item.value}} -- {{formatResult(item.passed)}}</p>
</view>
<button @click="testAppInfo">获取App信息相关api</button>
<view class="result">
<p v-for="item in appInfoResult" :style="resultStyle(item.passed)"> {{item.key}}: {{item.value}} -- {{formatResult(item.passed)}}</p>
</view>
<button @click="testSystemSetting">获取系统设置</button>
<view class="result" :style="resultStyle(systemSettingResult.passed)"> {{systemSettingResult.key}}: {{systemSettingResult.value}} -- {{formatResult(systemSettingResult.passed)}}</view>
<button @click="testTypeof">typeof</button>
<view class="result">
<p v-for="item in typeofResult" :style="resultStyle(item.passed)"> {{item.key}}: {{item.value}} -- {{formatResult(item.passed)}}</p>
</view>
<button @click="testDataConvert">数据转换</button>
<view class="result">
<p v-for="item in dataConvertResult" :style="resultStyle(item.passed)"> {{item.key}}: {{item.value}} -- {{formatResult(item.passed)}}</p>
</view>
<button @click="testAll">test all</button>
</view>
</template>
<script>
import {
getCurrentVCTest,
getKeyWindowTest,
colorWithStringTest,
getResourcePathTest,
getDeviceInfoTest,
getAppInfoTest,
getSystemSettingTest,
tepeofTest,
dataConvertTest,
} from "@/uni_modules/uts-platform-api"
export default {
data() {
return {
title: "UTSiOS test",
currentVCResult: {},
keyWindowResult: {},
colorConvertResult: [],
resourcePathResult: {},
deviceInfoResult: [],
appInfoResult: [],
systemSettingResult: {},
typeofResult: [],
dataConvertResult: []
}
},
methods: {
formatResult(res) {
if (res == null) {
return "";
}
return res ? "测试通过": "测试失败"
},
resultStyle(res) {
if (res == null) {
return {
color: "#333333"
}
}
let color = res ? "#00ff00" : "#ff0000";
return {
color: color
}
},
testCurrentVC() {
this.currentVCResult = getCurrentVCTest();
},
testKeyWindow() {
this.keyWindowResult = getKeyWindowTest();
},
testColorConvert() {
let array = colorWithStringTest();
this.colorConvertResult = array.map((value) => {
return JSON.parse(value)
})
},
testResourcePath() {
this.resourcePathResult = getResourcePathTest("/static/logo.png");
},
testDeviceInfo() {
let array = getDeviceInfoTest();
this.deviceInfoResult = array.map((value) => {
return JSON.parse(value)
})
},
testAppInfo() {
let array = getAppInfoTest();
this.appInfoResult = array.map((value) => {
return JSON.parse(value)
})
},
testSystemSetting() {
this.systemSettingResult = getSystemSettingTest();
},
testTypeof() {
let array = tepeofTest();
this.typeofResult = array.map((value) => {
return JSON.parse(value)
})
},
testDataConvert() {
let array = dataConvertTest();
this.dataConvertResult = array.map((value) => {
return JSON.parse(value)
})
},
testAll() {
this.testCurrentVC();
this.testKeyWindow();
this.testColorConvert();
this.testResourcePath();
this.testDeviceInfo();
this.testAppInfo();
this.testSystemSetting();
this.testTypeof();
this.testDataConvert();
}
}
}
</script>
<style scoped>
.result {
text-align: left;
padding-left: 20px;
padding-right: 20px;
max-width: 100%;
overflow: auto;
overflow-wrap: normal;
}
</style>
\ No newline at end of file
<template>
<view>
<page-head :title="title"></page-head>
<view class="uni-padding-wrap uni-common-mt">
<button @tap="testShowAlert">确认框</button>
<button @tap="testShowPrompt">输入框</button>
</view>
</view>
</template>
<script>
import { showAlert,showPrompt } from '@/uni_modules/uts-alert'
export default {
data() {
return {
title:"Alert 示例"
}
},
methods:{
testShowAlert(){
showAlert("提示框","这是一个提示框", (index)=> {
let title:string
if (index == 0) {
title = "点击了确认"
} else{
title = "点击了取消"
}
uni.showToast({
title: title,
icon:'none'
})
})
},
testShowPrompt() {
showPrompt("输入框","这是一个输入框","请输入内容", (content)=>{
let title = content.length > 0 ? content : "没有输入内容"
uni.showToast({
title: title,
icon:'none'
})
})
}
}
}
</script>
<style>
</style>
\ No newline at end of file
<template>
<view>
<page-head title="监听系统截屏" accordion></page-head>
<button @click="testScreenShotListen">监听截屏事件</button>
<button @click="testScreenShotOff">关闭截屏监听</button>
<image :src="screenImage" mode="aspectFit" style="margin-top:10px"></image>
</view>
</template>
<script>
import {
onUserCaptureScreen,
offUserCaptureScreen
} from "@/uni_modules/uts-screenshot-listener";
export default {
data() {
return {
screenImage:""
}
},
methods: {
testScreenShotListen() {
var that = this;
onUserCaptureScreen(function(res) {
console.log(res);
if (uni.getSystemInfoSync().platform == "android") {
// 除android 之外的平台,不需要判断返回状态码
if(res.errCode == -1){
// 启动失败
return ;
}else if(res.errCode == 0){
uni.showToast({
icon:"none",
title:'截屏监听已开启'
})
}else {
uni.showToast({
icon:"none",
title:'捕获截屏事件'
})
if (res.image != null) {
that.screenImage = res.image!
}
}
}else{
// 除android 之外的平台,不需要判断返回状态码
uni.showToast({
icon:"none",
title:'捕获截屏事件'
})
}
});
if (uni.getSystemInfoSync().platform != "android") {
// 除android 之外的平台,直接提示监听已开启
uni.showToast({
icon:"none",
title:'截屏监听已开启'
})
}
},
testScreenShotOff() {
var that = this;
offUserCaptureScreen(function(res) {
console.log(res);
});
// 提示已经开始监听,注意观察
uni.showToast({
icon:"none",
title:'截屏监听已关闭'
})
},
}
}
</script>
<style>
</style>
\ No newline at end of file
......@@ -2,10 +2,8 @@
<view>
<page-head title="监听系统截屏" accordion></page-head>
<uni-list>
<uni-list-item @tap="testScreenShotListen" title="监听截屏事件" class="itemButton" :clickable="true"/>
<uni-list-item @tap="testScreenShotOff" title="关闭截屏监听" class="itemButton" :clickable="true"/>
</uni-list>
<button @click="testScreenShotListen">监听截屏事件</button>
<button @click="testScreenShotOff">关闭截屏监听</button>
<image :src="screenImage" mode="aspectFit" style="margin-top:10px"></image>
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
<template>
<view>
<page-head title="asset 音频播放示例" accordion></page-head>
<button @click="testStart">播放asset音频</button>
<button @click="testStop">停止播放asset音频</button>
</view>
</template>
<script>
import {
playAssetAudio,
stopAssetAudio
} from "../../../uni_modules/uts-advance";
export default {
data() {
return {
}
},
methods: {
/**
* 测试添加View实例至顶层容器
*/
testStart: function() {
playAssetAudio();
},
/**
* 测试移除顶层容器的View实例
*/
testStop: function() {
stopAssetAudio();
}
}
}
</script>
<style>
</style>
\ No newline at end of file
......@@ -2,10 +2,8 @@
<view>
<page-head title="asset 音频播放示例" accordion></page-head>
<uni-list>
<uni-list-item title="播放asset音频" :clickable="true" @tap="testStart"></uni-list-item>
<uni-list-item title="停止播放asset音频" :clickable="true" @tap="testStop"></uni-list-item>
</uni-list>
<button @click="testStart">播放asset音频</button>
<button @click="testStop">停止播放asset音频</button>
</view>
</template>
......
<template>
<view>
<page-head title="DecorView示例" accordion></page-head>
<button @click="testAddToDecorView">添加TextView至视图顶层</button>
<button @click="testRemoveToDecorView">移除视图顶层的TextView</button>
</view>
</template>
<script>
import {
addViewToDecorView,
removeViewToDecorView
} from "../../../uni_modules/uts-advance";
export default {
data() {
return {
title: 'UTS进阶示例',
}
},
methods: {
/**
* 测试添加View实例至顶层容器
*/
testAddToDecorView: function() {
addViewToDecorView();
},
/**
* 测试移除顶层容器的View实例
*/
testRemoveToDecorView: function() {
removeViewToDecorView();
}
}
}
</script>
<style>
</style>
\ No newline at end of file
......@@ -2,10 +2,8 @@
<view>
<page-head title="DecorView示例" accordion></page-head>
<uni-list>
<uni-list-item title="添加TextView至视图顶层" :clickable="true" @tap="testAddToDecorView"></uni-list-item>
<uni-list-item title="移除视图顶层的TextView" :clickable="true" @tap="testRemoveToDecorView"></uni-list-item>
</uni-list>
<button @click="testAddToDecorView">添加TextView至视图顶层</button>
<button @click="testRemoveToDecorView">移除视图顶层的TextView</button>
</view>
</template>
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册