/** * @description: 获取设备设置 * @param {string} key * @return {*} */ export const getSystemSetting = (key: string) => { const systemSetting = wx.getSystemSetting() if (key && key in systemSetting) { return systemSetting[key]; } else { return systemSetting; } }; /** * @description: 获取微信APP授权设置 * @param {string} key * @return {*} * 'authorized'/'denied'/'not determined' * */ export const getAppAuthorizeSetting = (key: string) => { const appAuthorizeSetting = wx.getAppAuthorizeSetting() if (key && key in appAuthorizeSetting) { return appAuthorizeSetting[key]; } else { return appAuthorizeSetting; } }; /** * @description: 获取设备基础信息 * @param {string} key * @return {*} * * */ export const getDeviceInfo = (key?: string) => { const deviceInfo = wx.getDeviceInfo() if (key && key in deviceInfo) { return deviceInfo[key]; } else { return deviceInfo; } }; /** * @description: 获取窗口信息 * @param {string} key * @return {*} * * */ export const getWindowInfo = (key: string) => { const windowInfo = wx.getWindowInfo() if (key && key in windowInfo) { return windowInfo[key]; } else { return windowInfo; } }; /** * @description: 获取微信APP基础信息 * @param {string} key * @return {*} * * */ export const getAppBaseInfo = (key?: string) => { const appBaseInfo = wx.getAppBaseInfo() if (key && key in appBaseInfo) { return appBaseInfo[key]; } else { return appBaseInfo; } };