Commit 9e69ee3f by Sixong.Zhu

Merge branch 'master' into pre

parents 7184aeda ea095725
...@@ -156,7 +156,6 @@ ...@@ -156,7 +156,6 @@
o && n && this.messages.length o && n && this.messages.length
? this.fetchNewMsg() ? this.fetchNewMsg()
: setTimeout(() => this.fetchNewMsg(), 300); : setTimeout(() => this.fetchNewMsg(), 300);
this.scroll2End(this.messages.length ? 0 : 100);
} }
private raiseFileOpen(value: boolean) { private raiseFileOpen(value: boolean) {
...@@ -341,6 +340,9 @@ ...@@ -341,6 +340,9 @@
if (data.length === 0) { if (data.length === 0) {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.log("没有更多新消息了"); console.log("没有更多新消息了");
this.scroll2End();
} else {
setTimeout(() => this.fetchNewMsg(), 200);
} }
const removingIds: number[] = []; const removingIds: number[] = [];
......
import Axios, { AxiosResponse } from "axios";
import { UniplatSdk } from "uniplat-sdk";
import { ImEnvironment } from "../model";
export const enum Product {
Default = 'default',
QqxbWeixin = 'qqxb-weixin',
QqxbApp = 'qqxb-app',
Fulibao = 'fulibao',
HrManager = 'hr-manager',
Hrs100 = 'hrs100',
HrsApp = 'hrs-app',
BiJie = 'bi-jie',
Cashier = 'cashier',
Uniplat = "uniplat",
}
const enum ProductTable {
Default = "",
Login = "login",
Error = "error",
}
export interface SdkMonitorOption {
userAgent?: boolean;
envir: ImEnvironment;
product: Product;
}
class WebMonitor {
private key = "";
private envir = ImEnvironment.Dev;
private product = Product.Default;
private cachedUa = '';
private readonly url = "https://pre-hrs-monitor.hrs100.com";
public updateKey(key: string) {
this.key = key;
return this;
}
private buildHeaders() {
return {
headers: { authorization: "cdd0a34e-f537-4e5b-808e-2ba06af21845" },
};
}
private enable() {
return this.envir !== ImEnvironment.Dev;
}
private envirString() {
if (this.envir === ImEnvironment.Dev) {
return "[Dev]";
}
if (this.envir === ImEnvironment.Stage) {
return "[Stage]";
}
return "";
}
public log(msg: any) {
return Axios.post(
this.url,
{
type: ProductTable.Login,
product: this.product,
msg: `${this.envirString()} ${msg} `,
key: this.key,
},
this.buildHeaders()
);
}
public error(msg: any) {
return Axios.post(
this.url,
{
type: ProductTable.Error,
product: this.product,
msg: `${this.envirString()} ${msg} `,
key: this.key,
},
this.buildHeaders()
);
}
private getUa() {
if (!this.cachedUa) {
const build = (t: string, c: string) => `<span class="${c}">${t}</span>`
this.cachedUa = window.navigator.userAgent
.replace(/Android/ig, build('Android', 'primary'))
.replace(/iPhone/ig, build('iPhone', 'primary'))
.replace(/Mac OS X/ig, build('Mac OS X', 'primary'))
.replace(/QQXBUA/ig, build('QQXBUA', 'secondary'))
.replace(/isFlutter/ig, build('isFlutter', 'secondary'))
.replace(/\"version\"/ig, build('"version"', 'secondary'));
}
return this.cachedUa;
}
public useSdk(sdk: UniplatSdk, options: SdkMonitorOption) {
this.envir = options.envir;
this.product = options.product;
sdk.events.addUniversalErrorResponseCallback((r: AxiosResponse<any>) => {
if (this.enable()) {
const msg: string[] = [];
msg.push(`URL: ${decodeURIComponent(r.config.url as string)}`);
msg.push(`Token: ${sdk.global.jwtToken}`);
const header = r.config.headers;
if (header) {
msg.push(`CurrentOrg: ${header.CurrentOrg}`);
msg.push(`Scenes: ${header.Scenes}`);
}
options &&
options.userAgent &&
msg.push(`UserAgent: ${this.getUa()}`);
r.config && r.config.data && msg.push(`Payload: ${JSON.stringify(r.config.data)}`);
msg.push(
`Exception: ${((r.data.error as string) || "").substring(
0,
500
)}`
);
r && r.config && this.error(msg.join("\n"));
}
});
}
}
export const monitor = new WebMonitor();
...@@ -10,14 +10,14 @@ import { ...@@ -10,14 +10,14 @@ import {
UploadImageItem, UploadImageItem,
orderPayItemPredict, orderPayItemPredict,
OrderComment, OrderComment,
PayStatus PayStatus,
} from "../model"; } from "../model";
import { GeneralOrderDirection } from "../model/order-product"; import { GeneralOrderDirection } from "../model/order-product";
class OrderService { class OrderService {
public readonly generalOrder = "general_order_info"; public readonly generalOrder = "general_order_info";
public readonly generalOrderPaymentModel = "general_order_payment_info"; public readonly generalOrderPaymentModel = "general_order_payment_info";
public readonly generalOrderDefaultDetailName = 'userOrderDetail'; public readonly generalOrderDefaultDetailName = "userOrderDetail";
private readonly commentModel = "uniplat_model_remark@general_order"; private readonly commentModel = "uniplat_model_remark@general_order";
private readonly fileModel = "general_order_payment_file_info"; private readonly fileModel = "general_order_payment_file_info";
...@@ -138,11 +138,17 @@ class OrderService { ...@@ -138,11 +138,17 @@ class OrderService {
r.pageData.rows, r.pageData.rows,
orderPayItemPredict orderPayItemPredict
); );
items = items.filter(i => i.status !== PayStatus.Deleted && items = items.filter(
i.status !== PayStatus.Cancel) (i) =>
i.status !== PayStatus.Deleted &&
i.status !== PayStatus.Cancel
);
if (withActions) { if (withActions) {
for (let i = 0; i < r.pageData.rows.length; i++) { for (let i = 0; i < r.pageData.rows.length; i++) {
items[i].actions = r.pageData.rows[i].actions; r.pageData &&
r.pageData.rows &&
r.pageData.rows[i] &&
(items[i].actions = r.pageData.rows[i].actions);
} }
} }
...@@ -227,7 +233,7 @@ class OrderService { ...@@ -227,7 +233,7 @@ class OrderService {
.query(); .query();
} }
public sendPayAccountInfo(params: { send: string, type?: number }) { public sendPayAccountInfo(params: { send: string; type?: number }) {
return this.getSdk() return this.getSdk()
.domainService("hro_spview", "OrderSetting", "sendPayAccountInfo") .domainService("hro_spview", "OrderSetting", "sendPayAccountInfo")
.request("get", { params }); .request("get", { params });
......
...@@ -780,10 +780,7 @@ export default { ...@@ -780,10 +780,7 @@ export default {
}; };
if (e.type === MessageType.Withdraw) { if (e.type === MessageType.Withdraw) {
dbController dbController
.removeMessage( .removeMessage(e.chat_id, xim.withDrawMsgHandle(e))
e.chat_id,
xim.withDrawMsgHandle(e)
)
.finally(() => thenAction()); .finally(() => thenAction());
} else { } else {
thenAction(); thenAction();
...@@ -903,19 +900,24 @@ export default { ...@@ -903,19 +900,24 @@ export default {
commit(ChatStore.MUTATION_INITING_CHAT); commit(ChatStore.MUTATION_INITING_CHAT);
removeRegisterChatEvents.forEach((k) => k()); removeRegisterChatEvents.forEach((k) => k());
removeRegisterChatEvents = []; removeRegisterChatEvents = [];
await dispatch(ChatStore.ACTION_GET_CHAT_MEMBERS); try {
await Promise.all([ await dispatch(ChatStore.ACTION_GET_CHAT_MEMBERS);
dispatch(ChatStore.ACTION_REGISTER_EVENT), await Promise.all([
dispatch(ChatStore.ACTION_GET_CHAT_MESSAGES), dispatch(ChatStore.ACTION_REGISTER_EVENT),
]); dispatch(ChatStore.ACTION_GET_CHAT_MESSAGES),
commit( ]);
ChatStore.MUTATION_SAVE_CHAT_TITLE, } catch (e) {
wantedChatRoom.title || `会话${chatId}` Chat.error(e);
); } finally {
commit(ChatStore.MUTATION_INITING_CHAT_DONE); commit(
commit(ChatStore.MUTATION_SCROLL_TO_BOTTOM); ChatStore.MUTATION_SAVE_CHAT_TITLE,
(<any>state)[ChatStore.STATE_CHAT_CURRENT_IS_CHAT_ERROR] = null; wantedChatRoom.title || `在线咨询-${chatId}`
Chat.setRead(wantedChatRoom.model_name, wantedChatRoom.obj_id); );
commit(ChatStore.MUTATION_INITING_CHAT_DONE);
commit(ChatStore.MUTATION_SCROLL_TO_BOTTOM);
(<any>state)[ChatStore.STATE_CHAT_CURRENT_IS_CHAT_ERROR] = null;
Chat.setRead(wantedChatRoom.model_name, wantedChatRoom.obj_id);
}
}, },
async [ChatStore.ACTION_CLEAR_CURRENT_CHAT_DATA]({ commit, state }) { async [ChatStore.ACTION_CLEAR_CURRENT_CHAT_DATA]({ commit, state }) {
commit(ChatStore.MUTATION_CLEAR_CURRENT_CHAT_ID); commit(ChatStore.MUTATION_CLEAR_CURRENT_CHAT_ID);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment