首次上传
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
<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>
|
||||
|
||||
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) {
|
||||
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(res) {
|
||||
console.log("testAnimEnd");
|
||||
console.log(res);
|
||||
},
|
||||
|
||||
changeRepeat: function(res) {
|
||||
this.$refs["animView"].updateRepeatConfig("RESTART");
|
||||
},
|
||||
lottieClickTest: function(res) {
|
||||
console.log("lottieClickTest");
|
||||
console.log(res);
|
||||
},
|
||||
lottieLongpressTest: function(res) {
|
||||
console.log("lottieClickTest");
|
||||
console.log(res);
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,79 @@
|
||||
<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"] as UtsAnimationViewElement).setRepeatMode("RESTART");
|
||||
},
|
||||
lottieClickTest: function() {
|
||||
console.log("lottieClickTest");
|
||||
},
|
||||
lottieLongpressTest: function() {
|
||||
console.log("lottieClickTest");
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,104 @@
|
||||
<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 == true ? '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 () {
|
||||
if (checkHasLottieIntegration()) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/SDKIntegration/Lottie/index'
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '需要在自定义基座中运行'
|
||||
})
|
||||
}
|
||||
},
|
||||
gotoTencentLocation: function () {
|
||||
let ret = checkHasIntegration();
|
||||
if (!ret) {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '需要在自定义基座中运行'
|
||||
})
|
||||
} else {
|
||||
uni.navigateTo({
|
||||
url: '/pages/SDKIntegration/TencentLocation/TencentLocation'
|
||||
})
|
||||
}
|
||||
},
|
||||
gotoTencentMap: function () {
|
||||
uni.navigateTo({
|
||||
url: '/pages/SDKIntegration/TencentMap/TencentMap'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
@import '@/common/uni-uvue.css';
|
||||
</style>
|
||||
@@ -0,0 +1,95 @@
|
||||
<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>
|
||||
@@ -0,0 +1,100 @@
|
||||
<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>
|
||||
@@ -0,0 +1,100 @@
|
||||
<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(e) {
|
||||
requestPremission();
|
||||
},
|
||||
testGetlocation: function(e) {
|
||||
|
||||
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>
|
||||
@@ -0,0 +1,47 @@
|
||||
<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>
|
||||
@@ -0,0 +1,47 @@
|
||||
<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>
|
||||
Reference in New Issue
Block a user