This commit is contained in:
Liwanyi 2023-04-24 11:07:54 +08:00
parent 1ef3784e3d
commit 529c789315
8 changed files with 23 additions and 6 deletions

View File

@ -1,9 +1,19 @@
# TODO # TODO
- 翻译baza npc商店、imarket、imarket搜索结果 - 翻译baza npc商店、imarket、imarket搜索结果
- log重构通知重构
# CHANGE # CHANGE
## 0.8.9
2023年04月24日
### 修改
- 战斗相关模块错误修复
- 重复通知错误修复
## 0.8.8 ## 0.8.8
2023年04月17日 2023年04月17日

View File

@ -1,6 +1,6 @@
{ {
"name": "wuhu-torn-helper", "name": "wuhu-torn-helper",
"version": "0.8.8", "version": "0.8.9",
"description": "芜湖助手", "description": "芜湖助手",
"scripts": { "scripts": {
"release": "cross-env NODE_ENV=production rollup -c && node build.mjs", "release": "cross-env NODE_ENV=production rollup -c && node build.mjs",

File diff suppressed because one or more lines are too long

View File

@ -38,10 +38,12 @@ export class Common {
private readonly icon: ZhongIcon, private readonly icon: ZhongIcon,
private readonly fetchUtils: FetchUtils, private readonly fetchUtils: FetchUtils,
private readonly moduleLoader: ModuleLoader, private readonly moduleLoader: ModuleLoader,
// private readonly msgWrapper: MsgWrapper,
) { ) {
} }
public resolve(mainMethod) { public resolve(mainMethod) {
// window.setInterval(()=>this.msgWrapper.create('test',{sysNotify:true},'info'),2000);
// fetch方法处理 // fetch方法处理
globVars.responseHandlers.push( globVars.responseHandlers.push(

View File

@ -46,7 +46,7 @@ export default class AttackHelper {
} }
init(): void { init(): void {
window.setTimeout(() => this.init(), 0); window.setTimeout(() => this._init(), 0);
} }
private _init() { private _init() {

View File

@ -18,6 +18,7 @@ export default class WindowActiveState {
addEventListener('blur', () => this.isFocus = false); addEventListener('blur', () => this.isFocus = false);
} }
// 当前实例是否激活
get(): boolean { get(): boolean {
// 当前窗口获得了焦点 优先级最高 // 当前窗口获得了焦点 优先级最高
if (this.isFocus) return true; if (this.isFocus) return true;

View File

@ -4,18 +4,21 @@ import IWHNotify from "../../interface/IWHNotify";
import { InjectionKey } from "vue"; import { InjectionKey } from "vue";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import NotificationUtils from "./NotificationUtils"; import NotificationUtils from "./NotificationUtils";
import WindowActiveState from "../action/WindowActiveState";
@ClassName('MsgWrapper') @ClassName('MsgWrapper')
@Injectable() @Injectable()
export default class MsgWrapper { export default class MsgWrapper {
constructor( constructor(
private readonly notificationUtils: NotificationUtils, private readonly notificationUtils: NotificationUtils,
private readonly windowActiveState: WindowActiveState,
) { ) {
} }
create(msg: string, options: IWHNotify = {}, type: 'info' | 'warning' | 'error' | 'success' = 'info') { create(msg: string, options: IWHNotify = {}, type: 'info' | 'warning' | 'error' | 'success' = 'info') {
if (!this.windowActiveState.get()) return null;
if (options.sysNotify) { if (options.sysNotify) {
this.notificationUtils.push(msg); this.notificationUtils.push(msg, options);
} }
return ElMessage({ return ElMessage({
message: msg, message: msg,

View File

@ -16,6 +16,7 @@ export default class NotificationUtils {
private permission: boolean = window.Notification && window.Notification.permission === 'granted'; private permission: boolean = window.Notification && window.Notification.permission === 'granted';
public push(msg: string, options: IWHNotify = {}): void { public push(msg: string, options: IWHNotify = {}): void {
// this.logger.info({msg, options})
// let { notifies } = this.global; // let { notifies } = this.global;
if (options.sysNotify && this.permission) { if (options.sysNotify && this.permission) {