From d6c0ba17ad25e3ce88795796639d490ef06f2ab7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=8A=8A=E9=87=8C?= <1227971437@qq.com>
Date: Wed, 21 Apr 2021 20:03:59 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0H5=E7=9A=84=E6=89=93=E5=BC=80?=
=?UTF-8?q?=E6=8C=89=E9=92=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
baseapp.config.js | 7 ++++++-
common/openApp.js | 32 ++++++++++++++++++++++++++++++++
main.js | 4 ++--
template.h5.html | 26 ++++++++++++--------------
4 files changed, 52 insertions(+), 17 deletions(-)
create mode 100644 common/openApp.js
diff --git a/baseapp.config.js b/baseapp.config.js
index d04ae80..77a6f6b 100644
--- a/baseapp.config.js
+++ b/baseapp.config.js
@@ -1,6 +1,11 @@
module.exports = {
"h5":{
- "url":"https://static-76ce2c5e-31c7-4d81-8fcf-ed1541ecbc6e.bspapp.com" // 前端网页托管的域名
+ "url":"https://static-76ce2c5e-31c7-4d81-8fcf-ed1541ecbc6e.bspapp.com" ,// 前端网页托管的域名
+ "openApp":{
+ "openUrl":'https://sj.qq.com/myapp/detail.htm?apkName=com.tencent.android.qqdownloader&info=6646FD239A6EBA9E2DEE5DFC7E18D867',
+ "appname": 'base-app',
+ "logo": './static/logo.png',
+ }
},
"mp":{
"weixin":{
diff --git a/common/openApp.js b/common/openApp.js
new file mode 100644
index 0000000..4b96728
--- /dev/null
+++ b/common/openApp.js
@@ -0,0 +1,32 @@
+import CONFIG from '../baseapp.config.js';
+
+const CONFIG_OPEN = CONFIG?.h5?.openApp?.openUrl ? CONFIG.h5.openApp : {};
+// 仅H5端添加"打开APP"
+export default function() {
+ // #ifdef H5
+ if (!CONFIG_OPEN.openUrl) return console.warn('请配置app地址');
+
+ let openLogo = CONFIG_OPEN.logo ?
+ `` : '';
+ let openApp = document.createElement("div");
+ openApp.id = 'openApp';
+ openApp.style =
+ 'width: 100%;height: 45px;display: flex;flex-direction: row;justify-content: space-between;align-items: center;box-sizing: border-box;padding: 0 0.5rem;background-color: #FFFFFF;'
+ openApp.innerHTML = `
+