76 lines
2.0 KiB
Vue
76 lines
2.0 KiB
Vue
<template>
|
|
<view v-if="viewParam.isWeixin" class="scandownload_main"></view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
data() {
|
|
return {
|
|
viewParam: {},
|
|
scanInfoUrl: "",
|
|
}
|
|
},
|
|
onLoad(ops) {
|
|
console.log(ops);
|
|
this.scanInfoUrl = ops.url;
|
|
this.modelUtilInit();
|
|
},
|
|
methods: {
|
|
//判断浏览器类型
|
|
modelUtilInit() {
|
|
var UA = navigator.userAgent,
|
|
isAndroid = /android|adr/gi.test(UA),
|
|
isIOS = /iphone|ipod|ipad/gi.test(UA) && !isAndroid,
|
|
isBlackBerry = /BlackBerry/i.test(UA),
|
|
isWindowPhone = /IEMobile/i.test(UA),
|
|
isMobile = isAndroid || isIOS || isBlackBerry || isWindowPhone;
|
|
this.viewParam = {
|
|
isAndroid: isAndroid,
|
|
isIOS: isIOS,
|
|
isMobile: isMobile,
|
|
isWeixin: /MicroMessenger/gi.test(UA),
|
|
isQQ: /QQ/gi.test(UA)
|
|
};
|
|
console.log(this.viewParam);
|
|
this.downloadCourseware()
|
|
},
|
|
/** 下载文件 */
|
|
downloadCourseware() {
|
|
// plus.runtime.openURL('https://uniapp.dcloud.io/h5')
|
|
// 判断是否是微信内置浏览器
|
|
if (this.viewParam.isWeixin) {
|
|
// 安卓浏览器
|
|
// if (this.viewParam.isAndroid) {
|
|
// // var iframe = document.createElement("iframe");
|
|
// // iframe.style.display = "none";
|
|
// // iframe.src = 'http://192.168.34.133:20626/123456.xlsx';
|
|
// // document.body.appendChild(iframe);
|
|
// // iframe.click();
|
|
// }
|
|
// // IOS浏览器
|
|
// else if (this.viewParam.isIOS) {
|
|
// var entityDom = document.getElementById('BtnClick');
|
|
// entityDom.href = this.scanInfoUrl;
|
|
// entityDom.click();
|
|
// }
|
|
// window.location.href = this.scanInfoUrl;
|
|
// plus.runtime.openURL('https://uniapp.dcloud.io/h5')
|
|
}
|
|
// 非微信内置浏览器
|
|
else {
|
|
window.location.replace(this.scanInfoUrl);
|
|
}
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.scandownload_main {
|
|
width: 100vw;
|
|
height: 1200rpx;
|
|
background-image: url(@/static/bthgIcon/scandownload_bg.png);
|
|
background-repeat: no-repeat;
|
|
background-size: 100% 100%;
|
|
}
|
|
</style> |