|
@@ -13,7 +13,7 @@ import {
|
|
|
APP_REGISTER,
|
|
APP_REGISTER,
|
|
|
} from '../../api';
|
|
} from '../../api';
|
|
|
import { Http } from '../../request';
|
|
import { Http } from '../../request';
|
|
|
-import { success } from '@scripts/api/ApiHelper';
|
|
|
|
|
|
|
+import { handleResMsg, success } from '@scripts/api/ApiHelper';
|
|
|
import { IMailActionData, IMailCheckData, IMailItem, IMailPageData } from './data';
|
|
import { IMailActionData, IMailCheckData, IMailItem, IMailPageData } from './data';
|
|
|
import { APP_LOGIN_TYPE } from '@scripts/define/Define';
|
|
import { APP_LOGIN_TYPE } from '@scripts/define/Define';
|
|
|
import { mainStore } from '../mainStore/MainStore';
|
|
import { mainStore } from '../mainStore/MainStore';
|
|
@@ -119,27 +119,23 @@ class MailStore {
|
|
|
|
|
|
|
|
async reqMailDelete(mailID: number) {
|
|
async reqMailDelete(mailID: number) {
|
|
|
const res = await Http.call(APP_MAIL_DELETE, { MailID: mailID });
|
|
const res = await Http.call(APP_MAIL_DELETE, { MailID: mailID });
|
|
|
- if (success(res)) {
|
|
|
|
|
|
|
+ return handleResMsg(res, () => {
|
|
|
if (mailID === 0) {
|
|
if (mailID === 0) {
|
|
|
this._mailList = [];
|
|
this._mailList = [];
|
|
|
} else {
|
|
} else {
|
|
|
this._mailList = this._mailList.filter(item => Number(item.MailID) !== Number(mailID));
|
|
this._mailList = this._mailList.filter(item => Number(item.MailID) !== Number(mailID));
|
|
|
}
|
|
}
|
|
|
if (this._readMailID === mailID) this._readMailID = 0;
|
|
if (this._readMailID === mailID) this._readMailID = 0;
|
|
|
- return true;
|
|
|
|
|
- }
|
|
|
|
|
- return false;
|
|
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
async reqMailTake(mailID: number) {
|
|
async reqMailTake(mailID: number) {
|
|
|
const res = await Http.call<IMailActionData>(APP_MAIL_TAKE, { MailID: mailID });
|
|
const res = await Http.call<IMailActionData>(APP_MAIL_TAKE, { MailID: mailID });
|
|
|
- if (success(res)) {
|
|
|
|
|
|
|
+ return handleResMsg(res, () => {
|
|
|
const responseMailID = Number(res.data?.MailID ?? mailID);
|
|
const responseMailID = Number(res.data?.MailID ?? mailID);
|
|
|
const item = this.getMail(responseMailID);
|
|
const item = this.getMail(responseMailID);
|
|
|
if (item) item.MailStatus = '3';
|
|
if (item) item.MailStatus = '3';
|
|
|
- return true;
|
|
|
|
|
- }
|
|
|
|
|
- return false;
|
|
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
clear() {
|
|
clear() {
|
|
@@ -164,11 +160,9 @@ class MailStore {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const res = await Http.call(APP_EMAIL_SEND_CODE, params);
|
|
const res = await Http.call(APP_EMAIL_SEND_CODE, params);
|
|
|
- if (success(res)) {
|
|
|
|
|
|
|
+ return handleResMsg(res, () => {
|
|
|
this.setOtpTs(send_type);
|
|
this.setOtpTs(send_type);
|
|
|
- return true;
|
|
|
|
|
- }
|
|
|
|
|
- return false;
|
|
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
async reqRegister({ account, code, password, act }) {
|
|
async reqRegister({ account, code, password, act }) {
|
|
@@ -183,10 +177,7 @@ class MailStore {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const res = await Http.call(APP_REGISTER, params);
|
|
const res = await Http.call(APP_REGISTER, params);
|
|
|
- if (success(res)) {
|
|
|
|
|
- return true;
|
|
|
|
|
- }
|
|
|
|
|
- return false;
|
|
|
|
|
|
|
+ return handleResMsg(res);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
async reqResetPsd({ account, code, newpassword }) {
|
|
async reqResetPsd({ account, code, newpassword }) {
|
|
@@ -199,10 +190,7 @@ class MailStore {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const res = await Http.call(APP_EMAIL_RESET_PSD, params);
|
|
const res = await Http.call(APP_EMAIL_RESET_PSD, params);
|
|
|
- if (success(res)) {
|
|
|
|
|
- return true;
|
|
|
|
|
- }
|
|
|
|
|
- return false;
|
|
|
|
|
|
|
+ return handleResMsg(res);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
async reqBindEmailCode({ account }) {
|
|
async reqBindEmailCode({ account }) {
|
|
@@ -212,11 +200,10 @@ class MailStore {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const res = await Http.call(APP_EMAIL_BIND_CODE, params);
|
|
const res = await Http.call(APP_EMAIL_BIND_CODE, params);
|
|
|
- if (success(res)) {
|
|
|
|
|
|
|
+ return handleResMsg(res, () => {
|
|
|
this.setOtpTs(MailOtpType.Bind);
|
|
this.setOtpTs(MailOtpType.Bind);
|
|
|
- return true;
|
|
|
|
|
- }
|
|
|
|
|
- return false;
|
|
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
async reqBindEmailConfirm({ account, code, password }) {
|
|
async reqBindEmailConfirm({ account, code, password }) {
|
|
@@ -227,13 +214,10 @@ class MailStore {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const res = await Http.call<IUserData>(APP_EMAIL_BIND_CONFIRM, params);
|
|
const res = await Http.call<IUserData>(APP_EMAIL_BIND_CONFIRM, params);
|
|
|
- if (success(res)) {
|
|
|
|
|
|
|
+ return handleResMsg(res, () => {
|
|
|
mainStore.updateUserInfo(res.data);
|
|
mainStore.updateUserInfo(res.data);
|
|
|
AppKernel.events.emit('user:update');
|
|
AppKernel.events.emit('user:update');
|
|
|
-
|
|
|
|
|
- return true;
|
|
|
|
|
- }
|
|
|
|
|
- return false;
|
|
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
async reqChangeEmailCode({ account, target }) {
|
|
async reqChangeEmailCode({ account, target }) {
|
|
@@ -248,11 +232,9 @@ class MailStore {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const res = await Http.call(APP_EMAIL_CHANGE_CODE, params);
|
|
const res = await Http.call(APP_EMAIL_CHANGE_CODE, params);
|
|
|
- if (success(res)) {
|
|
|
|
|
|
|
+ return handleResMsg(res, () => {
|
|
|
this.setOtpTs(send_type);
|
|
this.setOtpTs(send_type);
|
|
|
- return true;
|
|
|
|
|
- }
|
|
|
|
|
- return false;
|
|
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
async reqChangeEmailConfirm({ account, old_code, new_code, password }) {
|
|
async reqChangeEmailConfirm({ account, old_code, new_code, password }) {
|
|
@@ -264,13 +246,11 @@ class MailStore {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const res = await Http.call(APP_EMAIL_CHANGE_CONFIRM, params);
|
|
const res = await Http.call(APP_EMAIL_CHANGE_CONFIRM, params);
|
|
|
- if (success(res)) {
|
|
|
|
|
|
|
+
|
|
|
|
|
+ return handleResMsg(res, async () => {
|
|
|
await mainStore.reqUserInfo();
|
|
await mainStore.reqUserInfo();
|
|
|
AppKernel.events.emit('user:update');
|
|
AppKernel.events.emit('user:update');
|
|
|
-
|
|
|
|
|
- return true;
|
|
|
|
|
- }
|
|
|
|
|
- return false;
|
|
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|