@taole/dev-helper 0.0.23 → 0.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/open-diandian.umd.js +15 -2
- package/open-diandian/index.js +15 -2
- package/package.json +1 -1
|
@@ -55,6 +55,12 @@
|
|
|
55
55
|
this.attachShadow({ mode: 'open' });
|
|
56
56
|
this.shadowRoot.appendChild(this._template.content);
|
|
57
57
|
console.log('open-diandian: wx-open-launch-app appended');
|
|
58
|
+
// 监听打开app失败的情况,跳转fallback链接
|
|
59
|
+
this._openAppTag.addEventListener('error', function(){
|
|
60
|
+
var tmplnk = document.createElement("a");
|
|
61
|
+
tmplnk.href = this._alink_fallback;
|
|
62
|
+
tmplnk.click();
|
|
63
|
+
});
|
|
58
64
|
} else {
|
|
59
65
|
this._updateTagAttr();
|
|
60
66
|
}
|
|
@@ -120,7 +126,16 @@
|
|
|
120
126
|
this._template.innerHTML = '<style>:host {display: block;width: 100%;height: 100%;overflow: hidden;opacity: 0;background:transparent;}</style>';
|
|
121
127
|
}
|
|
122
128
|
}
|
|
129
|
+
_genFallbackLink() {
|
|
130
|
+
if (this._isIOS) {
|
|
131
|
+
this._alink_fallback = "https://apps.apple.com/cn/app/%E7%82%B9%E7%82%B9-%E8%AF%AD%E9%9F%B3%E5%BC%80%E9%BB%91/id1449564746";
|
|
132
|
+
} else {
|
|
133
|
+
var packageName = "com.tuwan.yw";
|
|
134
|
+
this._alink_fallback = "https://sj.qq.com/myapp/detail.htm?apkName=" + packageName;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
123
137
|
_updateTagAttr() {
|
|
138
|
+
this._genFallbackLink();
|
|
124
139
|
if (this._openAppTag) {
|
|
125
140
|
this._openAppTag.setAttribute('appid', this.getAttribute('appid') || this._defaultAppid);
|
|
126
141
|
this._openAppTag.setAttribute('extinfo', this.getAttribute('extinfo') || "");
|
|
@@ -128,10 +143,8 @@
|
|
|
128
143
|
// TODO: 如果设置了点点以外的appid,这里其实是有问题的,待后续更新优化
|
|
129
144
|
if (this._isIOS) {
|
|
130
145
|
this._alink.href = "com.tuwan.diandian://openPage";
|
|
131
|
-
this._alink_fallback = "https://apps.apple.com/cn/app/%E7%82%B9%E7%82%B9-%E8%AF%AD%E9%9F%B3%E5%BC%80%E9%BB%91/id1449564746";
|
|
132
146
|
} else {
|
|
133
147
|
var packageName = "com.tuwan.yw";
|
|
134
|
-
this._alink_fallback = "https://sj.qq.com/myapp/detail.htm?apkName=" + packageName;
|
|
135
148
|
this._alink.href = "intent://diandain:8888/splash#Intent;scheme=taole;package=" + packageName + ";S.browser_fallback_url=" + this._alink_fallback + ";end";
|
|
136
149
|
}
|
|
137
150
|
}
|
package/open-diandian/index.js
CHANGED
|
@@ -49,6 +49,12 @@ function defineTag() {
|
|
|
49
49
|
this.attachShadow({ mode: 'open' });
|
|
50
50
|
this.shadowRoot.appendChild(this._template.content);
|
|
51
51
|
console.log('open-diandian: wx-open-launch-app appended');
|
|
52
|
+
// 监听打开app失败的情况,跳转fallback链接
|
|
53
|
+
this._openAppTag.addEventListener('error', function(){
|
|
54
|
+
var tmplnk = document.createElement("a");
|
|
55
|
+
tmplnk.href = this._alink_fallback;
|
|
56
|
+
tmplnk.click();
|
|
57
|
+
});
|
|
52
58
|
} else {
|
|
53
59
|
this._updateTagAttr();
|
|
54
60
|
}
|
|
@@ -114,7 +120,16 @@ function defineTag() {
|
|
|
114
120
|
this._template.innerHTML = '<style>:host {display: block;width: 100%;height: 100%;overflow: hidden;opacity: 0;background:transparent;}</style>';
|
|
115
121
|
}
|
|
116
122
|
}
|
|
123
|
+
_genFallbackLink() {
|
|
124
|
+
if (this._isIOS) {
|
|
125
|
+
this._alink_fallback = "https://apps.apple.com/cn/app/%E7%82%B9%E7%82%B9-%E8%AF%AD%E9%9F%B3%E5%BC%80%E9%BB%91/id1449564746";
|
|
126
|
+
} else {
|
|
127
|
+
var packageName = "com.tuwan.yw";
|
|
128
|
+
this._alink_fallback = "https://sj.qq.com/myapp/detail.htm?apkName=" + packageName;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
117
131
|
_updateTagAttr() {
|
|
132
|
+
this._genFallbackLink();
|
|
118
133
|
if (this._openAppTag) {
|
|
119
134
|
this._openAppTag.setAttribute('appid', this.getAttribute('appid') || this._defaultAppid);
|
|
120
135
|
this._openAppTag.setAttribute('extinfo', this.getAttribute('extinfo') || "");
|
|
@@ -122,10 +137,8 @@ function defineTag() {
|
|
|
122
137
|
// TODO: 如果设置了点点以外的appid,这里其实是有问题的,待后续更新优化
|
|
123
138
|
if (this._isIOS) {
|
|
124
139
|
this._alink.href = "com.tuwan.diandian://openPage";
|
|
125
|
-
this._alink_fallback = "https://apps.apple.com/cn/app/%E7%82%B9%E7%82%B9-%E8%AF%AD%E9%9F%B3%E5%BC%80%E9%BB%91/id1449564746";
|
|
126
140
|
} else {
|
|
127
141
|
var packageName = "com.tuwan.yw";
|
|
128
|
-
this._alink_fallback = "https://sj.qq.com/myapp/detail.htm?apkName=" + packageName;
|
|
129
142
|
this._alink.href = "intent://diandain:8888/splash#Intent;scheme=taole;package=" + packageName + ";S.browser_fallback_url=" + this._alink_fallback + ";end";
|
|
130
143
|
}
|
|
131
144
|
}
|