73 lines
1.9 KiB
TypeScript
73 lines
1.9 KiB
TypeScript
|
|
import { BaseLogic } from "@logic/Base.logic";
|
|
import { Autowired } from "@ann/Ioc.annotation";
|
|
import { Methods, VueCustomize } from "@logic/Base.type";
|
|
import { ToolServiceImpl } from "@impl/Tool.service.impl";
|
|
|
|
import { UpdateListParams, UpdateListResponseModel } from "@service/type/res/Tool.res";
|
|
|
|
export class AppVsersionLogic<T extends VueCustomize> extends BaseLogic implements Methods {
|
|
|
|
@Autowired
|
|
public toolServiceImpl!: ToolServiceImpl;
|
|
|
|
public params: UpdateListParams = {
|
|
count: this.count,
|
|
page: this.page,
|
|
update_version: '',
|
|
update_force: ''
|
|
}
|
|
|
|
public updateList: Array<UpdateListResponseModel> = [];
|
|
|
|
public isShowAddNewUpdate: boolean = false;
|
|
public updateForce: boolean = false;
|
|
|
|
public addNewsuUpdate: UpdateListResponseModel = {
|
|
update_version: "",
|
|
update_version_code: null,
|
|
update_down_url: "",
|
|
update_content: "",
|
|
update_force: 0
|
|
}
|
|
|
|
constructor(_: T) {
|
|
super();
|
|
this._ = _;
|
|
}
|
|
|
|
|
|
public async StartUp(): Promise<void> {
|
|
await this.GetUpdateList();
|
|
}
|
|
|
|
// apk上传接口
|
|
public async UploadFile(file: File): Promise<void> {
|
|
var formdata = new FormData();
|
|
formdata.append("file", file);
|
|
let res = await this.toolServiceImpl.UploadFile(formdata);
|
|
console.log("====== res: ", res)
|
|
this.addNewsuUpdate.update_down_url = res.img_url;
|
|
}
|
|
|
|
// 发布新的app版本
|
|
public async SetaddNewsuUpdate(): Promise<void> {
|
|
let res = await this.toolServiceImpl.addNewUpdate(this.addNewsuUpdate);
|
|
await this.GetUpdateList()
|
|
this.isShowAddNewUpdate = false;
|
|
}
|
|
|
|
// 获取app版本列表
|
|
public async GetUpdateList(): Promise<void> {
|
|
let res = await this.toolServiceImpl.UpdateList(this.params);
|
|
this.updateList = res.result;
|
|
console.log(res)
|
|
}
|
|
|
|
public async deleteUpdate(item: UpdateListResponseModel): Promise<void> {
|
|
console.log(item)
|
|
await this.toolServiceImpl.deleteUpdate(item);
|
|
await this.GetUpdateList()
|
|
}
|
|
}
|