加入以下代码
async keepScreenOn(status:boolean) {
let windowClass = await window.getLastWindow(this.context) //获取窗口实例
await windowClass.setWindowKeepScreenOn(status) //设置窗口常亮或取消
await windowClass.getWindowProperties().isKeepScreenOn//查看屏幕常亮状态
}