callAppBox.vue 1.74 KB
<template>
    <div class="call-app-box" v-if="callApps">
		<div class="box">
			<div class="logo-box">
				<img src="static/img/call_app_logo.png" class="img" />
			</div>
			<div class="buttons-box">
				<div class="btn btn-default" @click="callApp">打开APP</div>
			</div>
		</div>
    </div>
</template>

<script>
    export default {
        data: function () {
            return {
                
            }
        },
        props: ["callApps"],
		methods: {
			
			/**
			 * H5唤起App按钮事件
			 */
			callApp() {
				if (typeof this.callApps.funcs === "object" && typeof this.callApps.funcs.callApp === "object" && typeof this.callApps.funcs.callApp.schemeLayer === "function") {

					// 上下文
					let context = this;

					// 跳转连接
					let jumpUrl = (this.mode == "prod" ? "https://managemall.cnlive.com/html/leaflet/appDownload.html" : "https://wjjshop.cnlive.com/html/leaflet/appDownloadTest.html");

					// 系统判断
					if (this.isiPhone.value) {

						// OpenInstall唤起
						// window.location.href = jumpUrl;

						// 唤起App
						this.callApps.funcs.callApp.schemeLayer(this.callApps.funcs.callAppParams, this.callApps.funcs.callAppCallback);
					} else if (this.isAndroid.value) {

						// 唤起App
						this.callApps.funcs.callApp.schemeLayer(this.callApps.funcs.callAppParams, this.callApps.funcs.callAppCallback);

						window.setTimeout(function() {

							// 小米浏览器内,请求PHP页面下载
							if (context.isXiaoMi.value) {
								window.open("http://wjjh5.cnlive.com/apkdownload.php");
							}
						}, 2000);
					}
				}
			}
		}
    }
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style rel="stylesheet/less" lang="less">
    @import './callAppBox';
</style>