diff --git a/common/js/util.js b/common/js/util.js index 9829e01..56519f4 100644 --- a/common/js/util.js +++ b/common/js/util.js @@ -1162,5 +1162,23 @@ export default { verifyMobile(mobile) { var parse = /^\d{11}$/.test(mobile); return parse; + }, + /** + * 判断是否为快应用环境 + * @returns {boolean} 是否为快应用 + */ + isQuickApp() { + const systemInfo = this.getDeviceInfo(); + return systemInfo.platform === 'quickapp' || process.env.UNI_PLATFORM === 'quickapp'; + }, + /** + * 判断是否为华为快应用环境 + * @returns {boolean} 是否为华为快应用 + */ + isHuaweiQuickApp() { + if (!this.isQuickApp()) return false; + const systemInfo = this.getDeviceInfo(); + return systemInfo.brand === 'HUAWEI' || systemInfo.manufacturer === 'HUAWEI' || + (typeof qh !== 'undefined' && qh.platform === 'huawei'); } } \ No newline at end of file