SDKIntegration.uvue 3.3 KB
Newer Older
lizhongyi_'s avatar
lizhongyi_ 已提交
1 2 3 4
<template>
    <view class="uni-container">
        <page-head :title="title"></page-head>
        <view class="uni-panel" v-for="(item, index) in list" :key="index">
5
            <view class="uni-panel-h" :class="item.open == true ? 'uni-panel-h-on' : ''" @click="goDetailPage(item)"
lizhongyi_'s avatar
lizhongyi_ 已提交
6 7 8 9 10 11 12 13
                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">
14 15 16
    import {
        checkHasIntegration
    } from "@/uni_modules/uts-tencentgeolocation";
lizhongyi_'s avatar
lizhongyi_ 已提交
17

18 19 20
    import {
        checkHasLottieIntegration
    } from "@/uni_modules/uts-animation-view";
lizhongyi_'s avatar
lizhongyi_ 已提交
21 22 23

    type ListItem = {
        name : string,
lizhongyi_'s avatar
lizhongyi_ 已提交
24
        open ?: boolean,
lizhongyi_'s avatar
lizhongyi_ 已提交
25 26 27 28 29 30 31 32 33 34 35
        function ?: string,
        url ?: string
    }

    export default {
        data() {
            return {
                title: 'SDK集成示例',

                list: [{
                    name: "腾讯定位sdk集成示例",
lizhongyi_'s avatar
lizhongyi_ 已提交
36
                    function: "gotoTencentLocation",
lizhongyi_'s avatar
lizhongyi_ 已提交
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
                },
                {
                    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 () {
69 70 71 72 73 74 75 76 77 78
              if (checkHasLottieIntegration()) {
                  uni.navigateTo({
                      url: '/pages/SDKIntegration/Lottie/index'
                  })
              } else {
                  uni.showToast({
                      icon: 'none',
                      title: '需要在自定义基座中运行'
                  })
              }
lizhongyi_'s avatar
lizhongyi_ 已提交
79 80
            },
            gotoTencentLocation: function () {
81 82 83 84 85 86 87 88 89 90 91
              let ret = checkHasIntegration();
              if (!ret) {
                  uni.showToast({
                      icon: 'none',
                      title: '需要在自定义基座中运行'
                  })
              } else {
                  uni.navigateTo({
                      url: '/pages/SDKIntegration/TencentLocation/TencentLocation'
                  })
              }
lizhongyi_'s avatar
lizhongyi_ 已提交
92 93 94 95 96 97 98 99 100 101 102 103 104
            },
            gotoTencentMap: function () {
                uni.navigateTo({
                    url: '/pages/SDKIntegration/TencentMap/TencentMap'
                })
            }
        }
    }
</script>

<style>
    @import '@/common/uni-uvue.css';
</style>