<template>
    <div>
        <!-- applets
        <button style="width: 80px; background: #07c160; border-radius: 5px">
            <a style="color: #fff" :href="src">跳转</a>
        </button> -->
    </div>
</template>

<script>
import axios from 'axios'

export default {
    data() {},
    methods: {
        init() {
            axios({
                url: 'https://appointment.smart-zj.cn/applet/applet/wx/getScheme',
                method: 'get',
                headers: {
                    'Content-Type': "application/json",
                },
            }).then((res) => {
                console.log('res', res);
                if (res.data.status == 100) {
                    location.href = res.data.data    // 'weixin://dl/business/?t=N8K8YFAvn4k'
                    this.back()
                } else {
                    this.$dialog.confirm({
                        message: "系统繁忙，请稍后重试！",
                        showCancelButton: false,
                    }).then(() => {
                        this.back()
                    })
                }
            })
        },
        // 返回首页
        back() {
            if (window.android !== undefined) {
                window.android.backHome();
            } else {
                window.webkit && window.webkit.messageHandlers.backHome.postMessage("");
            }
        },
    },
    created() {
        this.init()
    },
}
</script>

<style>

</style>