|
@@ -42,7 +42,7 @@ export function getQueryParam() {
|
|
return query;
|
|
return query;
|
|
}
|
|
}
|
|
|
|
|
|
-//
|
|
|
|
|
|
+//
|
|
export function isInWeixinH5() {
|
|
export function isInWeixinH5() {
|
|
// TODO: 发布前取消注释
|
|
// TODO: 发布前取消注释
|
|
return navigator.userAgent.toLowerCase().indexOf("micromessenger") !== -1;
|
|
return navigator.userAgent.toLowerCase().indexOf("micromessenger") !== -1;
|
|
@@ -64,9 +64,33 @@ export function getPlatform() {
|
|
// TODO: 发布前取消注释
|
|
// TODO: 发布前取消注释
|
|
return 'browser'
|
|
return 'browser'
|
|
}
|
|
}
|
|
|
|
+// 是否在微信小程序中运行
|
|
|
|
+export function getIsMin() {
|
|
|
|
+ const platform = getPlatform();
|
|
|
|
+ return platform === 'miniprogram'
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// 是否在微信公众号中运行
|
|
|
|
+export function getIsWxh5() {
|
|
|
|
+ const platform = getPlatform();
|
|
|
|
+ return platform === 'micromessenger'
|
|
|
|
+}
|
|
|
|
+// 获取appid
|
|
|
|
+export function getAppid() {
|
|
|
|
+ const platform = getPlatform();
|
|
|
|
+ if ( platform === 'miniprogram' ) {
|
|
|
|
+ // TODO: 后期在其他公众号上线H5应用,appid需要根据地址栏的 project 动态处理
|
|
|
|
+ return 'wx92c3e55fbef6b2af'
|
|
|
|
+ }
|
|
|
|
+ if ( platform === 'micromessenger' ) {
|
|
|
|
+ return 'wx907c27f16841a919'
|
|
|
|
+ }
|
|
|
|
+ return ''
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
|
|
export function getUrlParams(url = window.location.href) {
|
|
export function getUrlParams(url = window.location.href) {
|
|
const str = `${url}`.split('?')[1]
|
|
const str = `${url}`.split('?')[1]
|
|
if(!str) return {}
|
|
if(!str) return {}
|
|
return qs.parse(str);
|
|
return qs.parse(str);
|
|
-}
|
|
|
|
|
|
+}
|