Commit d2b53e6d by 杨铁龙

run ok

parent 5e70c8d1
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
private setting = 0; private setting = 0;
private get hasInput() { private get hasInput() {
return this.isChatMember && this.chatError !== this.chatId; return true;
} }
@Provide() showReadSummary = true; @Provide() showReadSummary = true;
...@@ -156,10 +156,10 @@ ...@@ -156,10 +156,10 @@
this.setting = setTimeout( this.setting = setTimeout(
() => () =>
this.currentChat && this.currentChat &&
Chat.setRead( // Chat.setRead(
this.currentChat.model_name, // this.currentChat.model_name,
this.currentChat.obj_id // this.currentChat.obj_id
), // ),
300 300
); );
this.$emit("send"); this.$emit("send");
......
...@@ -3,7 +3,7 @@ import { parserMessage } from "."; ...@@ -3,7 +3,7 @@ import { parserMessage } from ".";
import { chatStore, ChatStore } from "@/customer-service/store/model"; import { chatStore, ChatStore } from "@/customer-service/store/model";
import { formatTime, TimeFormatRule } from "@/customer-service/utils/time"; import { formatTime, TimeFormatRule } from "@/customer-service/utils/time";
import { Chat as ChatItem } from "@/customer-service/xim/models/chat"; import { Chat as ChatItem } from "@/customer-service/xim/models/chat";
import { ChatUserInfoService } from "@/customer-service/utils/user-info"; // import { ChatUserInfoService } from "@/customer-service/utils/user-info";
@Component({ components: {} }) @Component({ components: {} })
export default class ChatList extends Vue { export default class ChatList extends Vue {
...@@ -68,9 +68,9 @@ export default class ChatList extends Vue { ...@@ -68,9 +68,9 @@ export default class ChatList extends Vue {
if (this.userNames[data.last_msg_sender] === undefined) { if (this.userNames[data.last_msg_sender] === undefined) {
const id = data.last_msg_sender; const id = data.last_msg_sender;
this.updateUserName({ id, name: "" }); this.updateUserName({ id, name: "" });
ChatUserInfoService.getUserInfo(id).then((d) => // ChatUserInfoService.getUserInfo(id).then((d) =>
this.updateUserName({ id, name: d.alias_name || d.name }) // this.updateUserName({ id, name: d.alias_name || d.name })
); // );
} }
} }
if (data.last_msg_content === "") { if (data.last_msg_content === "") {
......
...@@ -53,15 +53,15 @@ export function parserMessage(type: MessageType, rawMsg: string) { ...@@ -53,15 +53,15 @@ export function parserMessage(type: MessageType, rawMsg: string) {
export function rebuildImage(url: string, w = 300) { export function rebuildImage(url: string, w = 300) {
if (url) { if (url) {
const sdk = Chat.getSdk(); // const sdk = Chat.getSdk();
const s = sdk.mediaController.buildThumbnail; // const s = sdk.mediaController.buildThumbnail;
if (fsImg.test(url)) { // if (fsImg.test(url)) {
const m = fsImg.exec(url); // const m = fsImg.exec(url);
if (m && m.length) { // if (m && m.length) {
return sdk.global.baseUrl + s(m[0], w); // return sdk.global.baseUrl + s(m[0], w);
} // }
} // }
return url; // return url;
} }
return ""; return "";
} }
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
import { Component, Ref, Vue, Watch } from "vue-property-decorator"; import { Component, Ref, Vue, Watch } from "vue-property-decorator";
import ChatInput, { isFileElement, isImageOrFile } from "./hybrid-input.vue"; import ChatInput, { isFileElement, isImageOrFile } from "./hybrid-input.vue";
import { MessageType } from "../model"; import { MessageType } from "../model";
import { uploadFile } from "../service/upload"; // import { uploadFile } from "../service/upload";
import xim from "../xim/xim"; import xim from "../xim/xim";
import Chat from "../xim"; import Chat from "../xim";
import { ChatStore, chatStore } from "@/customer-service/store/model"; import { ChatStore, chatStore } from "@/customer-service/store/model";
...@@ -128,40 +128,40 @@ ...@@ -128,40 +128,40 @@
}; };
img.remove(); img.remove();
} }
return uploadFile( // return uploadFile(
file, // file,
(p: number) => // (p: number) =>
type === MessageType.File && // type === MessageType.File &&
this.chatInput && // this.chatInput &&
this.chatInput.updateUploadProgress(p) // this.chatInput.updateUploadProgress(p)
) // )
.then((r) => { // .then((r) => {
if (r) { // if (r) {
const msg = { // const msg = {
url: r, // url: r,
name: file.name, // name: file.name,
size: file.size, // size: file.size,
}; // };
if (this.source) { // if (this.source) {
Object.assign(msg, { source: this.source }); // Object.assign(msg, { source: this.source });
} // }
if (w && h) { // if (w && h) {
Object.assign(msg, { w, h }); // Object.assign(msg, { w, h });
} // }
this.sendMsg({ // this.sendMsg({
msgType: type, // msgType: type,
msg: JSON.stringify(msg), // msg: JSON.stringify(msg),
}); // });
URL.revokeObjectURL(src.url); // URL.revokeObjectURL(src.url);
} // }
}) // })
.catch(() => { // .catch(() => {
Chat.error("发送文件失败"); // Chat.error("发送文件失败");
this.chatInput && // this.chatInput &&
this.chatInput.updateUploadProgress(0); // this.chatInput.updateUploadProgress(0);
}); // });
} }
} }
} }
......
<template> // <template>
<div // <div
class="pay-message d-flex flex-column" // class="pay-message d-flex flex-column"
:class="[ // :class="[
messageClass, // messageClass,
{ 'user-side': !backend || !isChatMember, click: isChatMember }, // { 'user-side': !backend || !isChatMember, click: isChatMember },
]" // ]"
@click="view" // @click="view"
> // >
<div class="d-flex align-items-center flex-fill pay-msg-body"> // <div class="d-flex align-items-center flex-fill pay-msg-body">
<span :class="icon" class="icon flex-none"></span> // <span :class="icon" class="icon flex-none"></span>
<div class="texts flex-fill overflow-hidden"> // <div class="texts flex-fill overflow-hidden">
<div class="text-left text-nowrap text-truncate"> // <div class="text-left text-nowrap text-truncate">
{{ title }} // {{ title }}
</div> // </div>
<div class="d-flex justify-content-between"> // <div class="d-flex justify-content-between">
<span>{{ amount | currency }}</span> // <span>{{ amount | currency }}</span>
<span>{{ status }}</span> // <span>{{ status }}</span>
</div> // </div>
</div> // </div>
</div> // </div>
<div class="pay-method text-left">{{ method }}</div> // <div class="pay-method text-left">{{ method }}</div>
</div> // </div>
</template> // </template>
<script lang="ts"> // <script lang="ts">
import { // import {
PayMethod, // PayMethod,
payMethodMapping, // payMethodMapping,
PayStatus, // PayStatus,
payStatusMapping, // payStatusMapping,
cardPayStatusMapping, // cardPayStatusMapping,
} from "@/customer-service/model"; // } from "@/customer-service/model";
import { PayMessageBody } from "@/customer-service/xim/models/chat"; // import { PayMessageBody } from "@/customer-service/xim/models/chat";
import { Component } from "vue-property-decorator"; // import { Component } from "vue-property-decorator";
import BaseMessage from "./index"; // import BaseMessage from "./index";
import Chat from "@/customer-service/xim"; // import Chat from "@/customer-service/xim";
import { ChatStore, chatStore } from "@/customer-service/store/model"; // import { ChatStore, chatStore } from "@/customer-service/store/model";
import { CustomerServiceEvent, MessageEvent } from "@/customer-service/event"; // import { CustomerServiceEvent, MessageEvent } from "@/customer-service/event";
@Component({ components: {} }) // @Component({ components: {} })
export default class Index extends BaseMessage { // export default class Index extends BaseMessage {
@chatStore.State(ChatStore.STATE_CHAT_CURRENT_IS_CHAT_MEMBER) // @chatStore.State(ChatStore.STATE_CHAT_CURRENT_IS_CHAT_MEMBER)
private readonly isChatMember!: ChatStore.STATE_CHAT_CURRENT_IS_CHAT_MEMBER; // private readonly isChatMember!: ChatStore.STATE_CHAT_CURRENT_IS_CHAT_MEMBER;
protected backend = Chat.isBackend(); // protected backend = Chat.isBackend();
private get payData() { // private get payData() {
return this.messageBody.msg as PayMessageBody; // return this.messageBody.msg as PayMessageBody;
} // }
private get title() { // private get title() {
return this.payData.itemName || this.payData.totalName; // return this.payData.itemName || this.payData.totalName;
} // }
private get amount() { // private get amount() {
return +this.payData.amount || this.payData.totalMoney; // return +this.payData.amount || this.payData.totalMoney;
} // }
private get status() { // private get status() {
// 银行卡转账 // // 银行卡转账
if (+this.payData.paymentFunction === PayMethod.CardTransfer) { // if (+this.payData.paymentFunction === PayMethod.CardTransfer) {
return cardPayStatusMapping.get(+this.payData.status); // return cardPayStatusMapping.get(+this.payData.status);
} // }
return payStatusMapping.get(+this.payData.status); // return payStatusMapping.get(+this.payData.status);
} // }
private get method() { // private get method() {
return payMethodMapping.get(+this.payData.paymentFunction); // return payMethodMapping.get(+this.payData.paymentFunction);
} // }
private get icon() { // private get icon() {
const m = +this.payData.paymentFunction; // const m = +this.payData.paymentFunction;
const s = +this.payData.status; // const s = +this.payData.status;
if (m === PayMethod.Balance && s === PayStatus.UnPay) { // if (m === PayMethod.Balance && s === PayStatus.UnPay) {
return "icon-1"; // return "icon-1";
} // }
if (m === PayMethod.CardTransfer && s === PayStatus.UnPay) { // if (m === PayMethod.CardTransfer && s === PayStatus.UnPay) {
return "icon-2"; // return "icon-2";
} // }
if (s === PayStatus.WaitRefund) { // if (s === PayStatus.WaitRefund) {
return "icon-3"; // return "icon-3";
} // }
return "completed"; // return "completed";
} // }
private get messageClass() { // private get messageClass() {
const m = +this.payData.paymentFunction; // const m = +this.payData.paymentFunction;
const s = +this.payData.status; // const s = +this.payData.status;
if (m === PayMethod.Balance) { // if (m === PayMethod.Balance) {
if (s === PayStatus.UnPay) { // if (s === PayStatus.UnPay) {
return "balance-unpay"; // return "balance-unpay";
} // }
if (s === PayStatus.Paied) { // if (s === PayStatus.Paied) {
return "balance-paied"; // return "balance-paied";
} // }
} // }
if (m === PayMethod.CardTransfer) { // if (m === PayMethod.CardTransfer) {
if (s === PayStatus.UnPay) { // if (s === PayStatus.UnPay) {
return "card-unpay"; // return "card-unpay";
} // }
if (s === PayStatus.Paied) { // if (s === PayStatus.Paied) {
return "card-paied"; // return "card-paied";
} // }
} // }
if (s === PayStatus.WaitRefund) { // if (s === PayStatus.WaitRefund) {
return "refund-unpay"; // return "refund-unpay";
} // }
if (s === PayStatus.Refund) { // if (s === PayStatus.Refund) {
return "refund-paied"; // return "refund-paied";
} // }
return "default"; // return "default";
} // }
private view() { // private view() {
this.isChatMember && // this.isChatMember &&
CustomerServiceEvent.open( // CustomerServiceEvent.open(
this, // this,
MessageEvent.PayMessage, // MessageEvent.PayMessage,
+this.payData.paymentId // +this.payData.paymentId
); // );
} // }
} // }
//
</script> </script>
<style lang="less" scoped> // <style lang="less" scoped>
.pay-message { // .pay-message {
border-radius: 10px 0 10px 10px; // border-radius: 10px 0 10px 10px;
width: 248px; // width: 248px;
height: 106px; // height: 106px;
color: #fff; // color: #fff;
&.click { // &.click {
cursor: pointer; // cursor: pointer;
} // }
&.user-side { // &.user-side {
border-radius: 0 10px 10px 10px; // border-radius: 0 10px 10px 10px;
} // }
&.default, // &.default,
&.balance-unpay { // &.balance-unpay {
background: linear-gradient(180deg, #f95b3c 0%, #f94623 100%); // background: linear-gradient(180deg, #f95b3c 0%, #f94623 100%);
} // }
&.balance-paied { // &.balance-paied {
background: linear-gradient(180deg, #f95b3c 0%, #f94623 100%) // background: linear-gradient(180deg, #f95b3c 0%, #f94623 100%)
rgba(255, 255, 255, 0.3); // rgba(255, 255, 255, 0.3);
} // }
&.card-unpay { // &.card-unpay {
background: linear-gradient(180deg, #ff884d 0%, #ff7a38 100%); // background: linear-gradient(180deg, #ff884d 0%, #ff7a38 100%);
} // }
&.card-paied { // &.card-paied {
background: linear-gradient(180deg, #ff884d 0%, #ff7a38 100%) // background: linear-gradient(180deg, #ff884d 0%, #ff7a38 100%)
rgba(255, 255, 255, 0.3); // rgba(255, 255, 255, 0.3);
} // }
&.refund-unpay { // &.refund-unpay {
background: linear-gradient(180deg, #faad14 0%, #faa40f 100%); // background: linear-gradient(180deg, #faad14 0%, #faa40f 100%);
} // }
&.refund-paied { // &.refund-paied {
background: linear-gradient(180deg, #faad14 0%, #faa40f 100%) // background: linear-gradient(180deg, #faad14 0%, #faa40f 100%)
rgba(255, 255, 255, 0.3); // rgba(255, 255, 255, 0.3);
} // }
.pay-msg-body { // .pay-msg-body {
padding: 20px; // padding: 20px;
} // }
.pay-method { // .pay-method {
background-color: #fff; // background-color: #fff;
color: #8e8d99; // color: #8e8d99;
padding: 5px 10px; // padding: 5px 10px;
border-radius: 0 0 10px 10px; // border-radius: 0 0 10px 10px;
box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.06); // box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.06);
} // }
.icon { // .icon {
width: 40px; // width: 40px;
height: 40px; // height: 40px;
display: inline-block; // display: inline-block;
margin-right: 20px; // margin-right: 20px;
background-repeat: no-repeat; // background-repeat: no-repeat;
&.icon-1 { // &.icon-1 {
background-image: url("./pay-status-1.svg"); // background-image: url("./pay-status-1.svg");
} // }
&.icon-2 { // &.icon-2 {
background-image: url("./pay-status-2.svg"); // background-image: url("./pay-status-2.svg");
} // }
&.icon-3 { // &.icon-3 {
background-image: url("./pay-status-3.svg"); // background-image: url("./pay-status-3.svg");
} // }
&.completed { // &.completed {
background-image: url("./pay-completed.svg"); // background-image: url("./pay-completed.svg");
} // }
} // }
.texts { // .texts {
line-height: 1.5; // line-height: 1.5;
div:last-child { // div:last-child {
margin-left: -2px; // margin-left: -2px;
} // }
} // }
} // }
//
</style> </style>
\ No newline at end of file
...@@ -158,13 +158,13 @@ ...@@ -158,13 +158,13 @@
import ActionMessage from "./message-item/action-message.vue"; import ActionMessage from "./message-item/action-message.vue";
import WithdrawMessage from "./message-item/withdraw-message.vue"; import WithdrawMessage from "./message-item/withdraw-message.vue";
import PurchasePlanMessage from "./message-item/purchase-plan-message.vue"; import PurchasePlanMessage from "./message-item/purchase-plan-message.vue";
import MyWelfareMessage from "./message-item/my-welfare-message.vue"; // import MyWelfareMessage from "./message-item/my-welfare-message.vue";
import QuestionAnswerMessage from "./message-item/question-answer-message.vue"; // import QuestionAnswerMessage from "./message-item/question-answer-message.vue";
import PositionMessage from "./message-item/position-message.vue"; // import PositionMessage from "./message-item/position-message.vue";
import PayMessage from "./message-item/pay-message.vue"; // import PayMessage from "./message-item/pay-message.vue";
import NotifyMessage from "./message-item/notify-message.vue"; import NotifyMessage from "./message-item/notify-message.vue";
import { ChatRole } from "@/customer-service/model"; import { ChatRole } from "@/customer-service/model";
import { ChatUserInfoService, getUserMapping } from "../utils/user-info"; // import { ChatUserInfoService, getUserMapping } from "../utils/user-info";
import Xim from "@/customer-service/xim"; import Xim from "@/customer-service/xim";
import { CustomerServiceEvent, MessageEvent } from "../event"; import { CustomerServiceEvent, MessageEvent } from "../event";
import { PayMessageBody } from "../xim/models/chat"; import { PayMessageBody } from "../xim/models/chat";
...@@ -204,12 +204,12 @@ ...@@ -204,12 +204,12 @@
TextMessage, TextMessage,
WithdrawMessage, WithdrawMessage,
PurchasePlanMessage, PurchasePlanMessage,
MyWelfareMessage, // MyWelfareMessage,
QuestionAnswerMessage, // QuestionAnswerMessage,
ActionMessage, ActionMessage,
PayMessage, // PayMessage,
NotifyMessage, NotifyMessage,
PositionMessage, // PositionMessage,
}, },
}) })
export default class Message extends Vue { export default class Message extends Vue {
...@@ -382,7 +382,7 @@ ...@@ -382,7 +382,7 @@
const o = +this.messageBody.eid; const o = +this.messageBody.eid;
const m1 = o === +this.chatMyId; const m1 = o === +this.chatMyId;
if (m1 && Xim.isBackend() && this.messageBody.oid) { if (m1 && Xim.isBackend() && this.messageBody.oid) {
return +this.messageBody.oid === +Xim.getOrgId(); return false;
} }
return m1; return m1;
} }
...@@ -424,14 +424,14 @@ ...@@ -424,14 +424,14 @@
} }
private get avatar() { private get avatar() {
const mapping = getUserMapping(); // const mapping = getUserMapping();
if (this.data) { // if (this.data) {
const value = mapping[this.data.eid]; // const value = mapping[this.data.eid];
if (value && value.icon) { // if (value && value.icon) {
return value.icon; // return value.icon;
} // }
} // }
return this.refetchUserIcon; return this.refetchUserIcon;
} }
...@@ -574,21 +574,21 @@ ...@@ -574,21 +574,21 @@
} }
private refetchUsername4Message() { private refetchUsername4Message() {
if (this.data && this.data.eid) { // if (this.data && this.data.eid) {
ChatUserInfoService.getUserInfo(this.data.eid).then((r) => { // ChatUserInfoService.getUserInfo(this.data.eid).then((r) => {
if (r) { // if (r) {
if (Xim.isBackend() && r.alias_name) { // if (Xim.isBackend() && r.alias_name) {
this.refetchUsername = `${r.alias_name}(${ // this.refetchUsername = `${r.alias_name}(${
r.name || r.phone // r.name || r.phone
})`; // })`;
} else { // } else {
this.refetchUsername = // this.refetchUsername =
r.alias_name || r.name || r.phone; // r.alias_name || r.name || r.phone;
} // }
r.icon && (this.refetchUserIcon = r.icon); // r.icon && (this.refetchUserIcon = r.icon);
} // }
}); // });
} // }
} }
private onHover() { private onHover() {
......
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
import avatar from "@/customer-service/components/avatar.vue"; import avatar from "@/customer-service/components/avatar.vue";
import { ChatStore } from "@/customer-service/store/model"; import { ChatStore } from "@/customer-service/store/model";
import xim from "@/customer-service/xim/xim"; import xim from "@/customer-service/xim/xim";
import { ChatUserInfoService } from "../utils/user-info"; // import { ChatUserInfoService } from "../utils/user-info";
const chatStoreNamespace = namespace("chatStore"); const chatStoreNamespace = namespace("chatStore");
...@@ -113,57 +113,56 @@ ...@@ -113,57 +113,56 @@
} }
private async getUserNameByid(eid: string) { private async getUserNameByid(eid: string) {
const data = await ChatUserInfoService.getUserInfo(eid); // const data = await ChatUserInfoService.getUserInfo(eid);
return data.name; // return data.name;
} }
private async getReader() { private async getReader() {
if (this.chatId == null) return; // if (this.chatId == null) return;
if (this.msgId == null) return; // if (this.msgId == null) return;
const data = await xim.fetchMsgInBox(this.chatId, this.msgId); // const data = await xim.fetchMsgInBox(this.chatId, this.msgId);
if (data == null) return; // if (data == null) return;
const readerlist = this.uniqueReaderList( // const readerlist = this.uniqueReaderList(
data.args[0] as dto.OneWhoReadMessage[] // data.args[0] as dto.OneWhoReadMessage[]
); // );
this.readlist = await Promise.all( // this.readlist = await Promise.all(
readerlist // readerlist
.filter((k) => k.is_read) // .filter((k) => k.is_read)
.filter((k) => k.eid !== this.chatMyId) // .filter((k) => k.eid !== this.chatMyId)
.map(async (k) => { // .map(async (k) => {
const eid = k.eid; // const eid = k.eid;
const name = await this.getUserNameByid(eid); // const name = await this.getUserNameByid(eid);
return { // return {
eid, // eid,
name, // name,
avatar: "", // avatar: "",
}; // };
}) // })
); // );
if (!this.readlist.length) { // if (!this.readlist.length) {
this.tab = 2; // this.tab = 2;
} // }
this.unreadlist = await Promise.all( // this.unreadlist = await Promise.all(
readerlist // readerlist
.filter((k) => !k.is_read) // .filter((k) => !k.is_read)
.filter((k) => k.eid !== this.chatMyId) // .filter((k) => k.eid !== this.chatMyId)
.map(async (k) => { // .map(async (k) => {
const eid = k.eid; // const eid = k.eid;
const name = await this.getUserNameByid(eid); // const name = await this.getUserNameByid(eid);
return { // return {
eid, // eid,
name, // name,
avatar: "", // avatar: "",
}; // };
}) // })
); // );
// if (!this.unreadlist.length) {
if (!this.unreadlist.length) { // this.updateMessage({
this.updateMessage({ // chat: this.chatId,
chat: this.chatId, // start: this.msgId,
start: this.msgId, // all: true,
all: true, // });
}); // }
}
} }
private uniqueReaderList(data: dto.OneWhoReadMessage[]) { private uniqueReaderList(data: dto.OneWhoReadMessage[]) {
......
export enum IMDomainType {
// 亲亲小保
"社保客服" = "con_sbkf",
"pc网站咨询" = "con_pcweb",
"手机官网咨询" = "con_iphoneweb",
"问答动态提醒" = "que_wddttx",
"活动通知c" = "con_campaign",
"节日祝福" = "con_blessing",
"社保资讯" = "con_information",
"系统消息" = "con_xtxxx",
"账户提醒" = "acc_zhtx",
// HRS100
"灵活用工h" = "con_lhyg_h",
"其他企业服务咨询h" = "con_qtqyfwconsult_h",
"人力外包h" = "con_ssfw_h",
"人事代理h" = "con_sbkf_h",
"活动通知h" = "con_campaign_h",
"节日祝福h" = "con_blessing_h",
"社保资讯h" = "con_information_h",
"系统消息h" = "con_xtxxx_h",
// 专项订单
"雇主责任险" = "biz_gzzrx",
"保准牛雇主责任保险" = "biz_bzngzzrbx",
"老年人重大疾病" = "biz_lnrzdjb_h",
"少儿百种疾病意外医疗保险" = "biz_srbzjbywylbx_h",
"补充医疗" = "biz_bcylxx_h",
"团体意外险" = "biz_ttywx",
"重疾险" = "biz_zjxxxx_h",
"高端体检" = "biz_crgdtj",
"入职体检套餐" = "biz_rztjtc",
"体检卡套餐" = "biz_tjktc",
"员工体检套餐" = "biz_ygtjtc",
"补充医疗h" = "biz_bcylll_h",
"雇主责任险h" = "biz_gzzrxxx_h",
"团体意外保险h" = "biz_ttywxxx_h",
"高端体检h" = "biz_crgdtj_h",
"补充保险" = "biz_bcbxsa_h",
"劳务外包h" = "biz_lwwbgl_h",
"薪酬个税" = "biz_xcgsqs_h",
"业务外包h" = "biz_ywwbgl_h",
"代理记账" = "biz_dljzhd",
"工商财税" = "biz_gscs",
"中小微企业财税代理" = "biz_zxwqycsdl",
"中小微企业工商代理" = "biz_zxwqygsdl",
"高新技术企业认定" = "biz_gxjsqyrd",
"劳务派遣经营许可证" = "biz_lwpqjyxkz",
"人力资源服务许可证" = "biz_rlzifwxkzz",
"食品流通许可证" = "biz_spltxkz",
"项目申报" = "biz_xmssb",
"资质认证" = "biz_zzrzq",
"劳务外包" = "biz_lwwbgl",
"全风险岗位外包" = "biz_qfxgwwb",
"自然人代开" = "biz_zrrdk",
"版权服务" = "biz_bqfw",
"商标注册" = "biz_sbzc",
"专利布局" = "biz_zlbj",
"专利服务" = "biz_zlfwhycs",
"中小微企业财税代理h" = "biz_zxwqycsdl_h",
"中小微企业工商代理h" = "biz_zxwqygsdl_h",
"出版物批发零售许可" = "biz_cbwpfls_h",
"高新技术企业认定h" = "biz_gxjsqyrd_h",
"广播电视节目制作许可" = "biz_gbdsjmzz_h",
"进出口备案许可" = "biz_jckbaxk_h",
"劳务派遣经营许可证h" = "biz_lwpqjyxkz_h",
"人力资源服务许可证h" = "biz_rlzyfwxkz_h",
"食品流通许可证h" = "biz_spltxkz_h",
"项目申报h" = "biz_xmsb_h",
"医疗器械经营许可" = "biz_ylqiqxk_h",
"资质认证h" = "biz_zzrz_h",
"劳务派遣h" = "biz_lwpxsq_h",
"自然人代开h" = "biz_zrrdk_h",
"审计报告" = "biz_sjbgs",
"验资报告" = "biz_yzbgs",
"专项审计" = "biz_zxsjs",
"岗位外包管理服务h" = "biz_gwwbglfw_h",
"人力外包" = "biz_rlwb_h",
"人事外包管理服务" = "biz_rswbglfw",
"版权服务h" = "biz_nqfw_h",
"商标注册h" = "biz_sbzc_h",
"专利布局h" = "biz_zlbj_h",
"专利服务h" = "biz_zlfw_h",
"社保业务" = "biz_sbyww_h",
"公积金业务" = "biz_gjjywuj_h",
"公积金跨省转移" = "biz_gjjkszy",
"公积金提取" = "biz_gjjtq",
"其他公积金服务" = "biz_qtgjjfw",
"参保人信息变更" = "biz_cbrxxbg",
"定点医院变更" = "biz_ddyybg",
"补缴咨询" = "biz_sbbj",
"其他社保服务" = "biz_qtsbrw",
"社保卡办理补办" = "biz_sbkbl",
"社保跨省转移" = "biz_sbkszy",
"生育险报销" = "biz_syxbx",
"医疗费用报销" = "biz_zlfybx",
"工资代发" = "biz_gzdfgr",
"劳务费代发" = "biz_lwfdf",
"灵活就业薪酬个税" = "biz_xcgsfu",
"人力外包年服务资格" = "biz_rlwbnffzg_h",
"高级会员申请" = "biz_gjhysqlk_h",
"公积金柜台增减员h" = "biz_gjjgtzjy_qy_h",
"公积金开户h" = "biz_gjjkh_qy_h",
"公积金跨省转移h" = "biz_gjjkszy_qy_h",
"公积金提取h" = "biz_gjjtq_h",
"公积金账户合并h" = "biz_gjjzhhb_qy_h",
"公积金还欠款h" = "biz_gjjhqk_qy_h",
"公积金数字证书办理续费h" = "biz_szzh_gjj_qy_h",
"参保人信息变更h" = "biz_cbrxxbg_h",
"档案管理" = "biz_dagl_qy_h",
"定点医院变更h" = "biz_ddyybg_h",
"定制参保缴费明细h" = "biz_dzcbjfmx_qy_h",
"工伤申报" = "biz_sbgssb_qy_h",
"领取医保存折h" = "biz_lqybcz_qy_h",
"社保柜台增减员" = "biz_sbgtzjy_qy_h",
"社保卡办理/变更" = "biz_sbkbl_h",
"社保开户" = "biz_sbkh_sb_qy_h",
"社保跨省转移h" = "biz_sbkszy_h",
"社保清算h" = "biz_sbqs_sb_qy_h",
"社保最后一个人减员" = "biz_sbzhygrjy_qy_h",
"生育险报销h" = "biz_syxbx_h",
"社保数字证书办理续费" = "biz_szzh_sb_qy_h",
"医疗费用报销h" = "biz_ylfybx_h",
"异地安置h" = "biz_ydaz_sb_qy_h",
"工资代发h" = "biz_xcgsmn_h",
"公积金托管申请" = "biz_gjjtgsh_qy_h",
"社保托管申请" = "biz_sbtgsh_qy_h",
"公积金托管补缴" = "biz_gjjtgbj_h",
"公积金托管调整员工基数" = "biz_gjjtgtzygjs_h",
"公积金托管减员" = "biz_jjtgjy_h",
"公积金托管其他" = "biz_gjjtgqt_h",
"公积金托管增员" = "biz_gjjtgzy_h",
"托管客户信息修改" = "biz_gjjtgyhxxxg_h",
"社保托管补缴" = "biz_sbtgbj_h",
"社保托管调整员工基数" = "biz_sbtgtzygjs_h",
"社保托管减员" = "biz_sbtgjy_h",
"社保托管其他" = "biz_sbtgqt_h",
"社保托管增员" = "biz_sbtgzy_h",
"托管客户信息修改h" = "biz_sbtgkhxxxg_h",
"北京集体户口迁移咨询" = "biz_bjjtlhqyzx",
"北京工作居住证咨询服务" = "biz_bjgzjzzjfsqzxfw",
"北京应届毕业生落户咨询" = "biz_bjyjbysl_h",
"简历优化" = "biz_jlyhs",
"劳动权益保护" = "biz_ldqybh",
"面试指导" = "biz_mszds",
"上海居住证办理咨询" = "biz_shhzzblzx",
"上海居住证积分申请咨询服务" = "biz_shjzzjfsqzxfw",
"上海居转户咨询" = "biz_shjzhzx",
"上海留学生落户咨询" = "biz_shlxslh",
"上海应届毕业生落户咨询" = "biz_shyjbyslhzx",
"天津落户咨询服务" = "biz_tjlhzxfw",
"幼升小政策咨询" = "biz_ysxzczx",
"职业测评" = "biz_zypcs",
"职业规划咨询" = "biz_zyghzx",
"北京积分落户咨询服务h" = "biz_bjjflhzxfw_h",
"北京工作居住证咨询服务h" = "biz_bjgzjzzzxfw_h",
"北京应届毕业生落户咨询h" = "biz_bjyjbysl_h1",
"劳动争议" = "biz_ldzyqy_h",
"上海居住证积分申请咨询服务h" = "biz_shjzzjfsqzxfw_h",
"上海居转户咨询h" = "biz_shjzhzx_h",
"上海留学生落户咨询h" = "biz_shlxslh_h",
"上海应届毕业生落户咨询h" = "biz_shyjbyslhzx_h",
"天津落户咨询服务h" = "biz_tjlhzxfw_h",
"外国人工作许可h" = "biz_wgrgzxk_h",
"成都购房社保合规咨询" = "biz_cdgfsbhgzx",
"成都落户咨询服务" = "biz_cdlhzxfw",
}
export const imItems = [
// 亲亲小保
{
type: IMDomainType.社保客服,
title: "在线咨询",
},
{
type: IMDomainType.pc网站咨询,
title: "在线咨询",
},
{
type: IMDomainType.手机官网咨询,
title: "在线咨询",
},
{
type: IMDomainType.问答动态提醒,
title: "问答动态提醒",
},
{
type: IMDomainType.活动通知c,
title: "活动通知",
},
{
type: IMDomainType.节日祝福,
title: "节日祝福",
},
{
type: IMDomainType.社保资讯,
title: "社保资讯",
},
{
type: IMDomainType.系统消息,
title: "系统消息",
},
{
type: IMDomainType.账户提醒,
title: "账户提醒",
},
// HRS100
{
type: IMDomainType.灵活用工h,
title: "灵活用工",
},
{
type: IMDomainType.其他企业服务咨询h,
title: "在线咨询",
},
{
type: IMDomainType.人力外包h,
title: "人力外包",
},
{
type: IMDomainType.人事代理h,
title: "人事代理",
},
{
type: IMDomainType.活动通知h,
title: "活动通知",
},
{
type: IMDomainType.节日祝福h,
title: "节日祝福",
},
{
type: IMDomainType.社保资讯h,
title: "社保资讯",
},
{
type: IMDomainType.系统消息h,
title: "系统消息",
},
// 专项订单
{
type: IMDomainType.雇主责任险,
title: "雇主责任险",
},
{
type: IMDomainType.保准牛雇主责任保险,
title: "雇主责任险-创业团队必备",
},
{
type: IMDomainType.老年人重大疾病,
title: "老年人重大疾病",
},
{
type: IMDomainType.少儿百种疾病意外医疗保险,
title: "少儿百种疾病意外医疗保险",
},
{
type: IMDomainType.补充医疗,
title: "团队补充医疗",
},
{
type: IMDomainType.团体意外险,
title: "团体意外险",
},
{
type: IMDomainType.重疾险,
title: "重疾险",
},
{
type: IMDomainType.高端体检,
title: "高端体检",
},
{
type: IMDomainType.入职体检套餐,
title: "入职体检套餐",
},
{
type: IMDomainType.体检卡套餐,
title: "体检卡套餐",
},
{
type: IMDomainType.员工体检套餐,
title: "员工体检套餐",
},
{
type: IMDomainType.补充医疗h,
title: "补充医疗",
},
{
type: IMDomainType.雇主责任险h,
title: "雇主责任险",
},
{
type: IMDomainType.团体意外保险h,
title: "团体意外险",
},
{
type: IMDomainType.高端体检h,
title: "高端体检",
},
{
type: IMDomainType.补充保险,
title: "补充保险",
},
{
type: IMDomainType.劳务外包h,
title: "劳务外包管理",
},
{
type: IMDomainType.薪酬个税,
title: "薪酬个税",
},
{
type: IMDomainType.业务外包h,
title: "业务外包管理",
},
{
type: IMDomainType.代理记账,
title: "业务外包管理",
},
{
type: IMDomainType.工商财税,
title: "工商财税",
},
{
type: IMDomainType.中小微企业财税代理,
title: "工商财税",
},
{
type: IMDomainType.中小微企业工商代理,
title: "中小微企业工商代理",
},
{
type: IMDomainType.高新技术企业认定,
title: "高新技术企业认定",
},
{
type: IMDomainType.劳务派遣经营许可证,
title: "劳务派遣经营许可证",
},
{
type: IMDomainType.人力资源服务许可证,
title: "人力资源服务许可证",
},
{
type: IMDomainType.食品流通许可证,
title: "食品流通许可证",
},
{
type: IMDomainType.项目申报,
title: "项目申报",
},
{
type: IMDomainType.资质认证,
title: "资质认证",
},
{
type: IMDomainType.劳务外包,
title: "劳务外包管理",
},
{
type: IMDomainType.全风险岗位外包,
title: "全风险岗位外包",
},
{
type: IMDomainType.自然人代开,
title: "自然人代开",
},
{
type: IMDomainType.版权服务,
title: "版权服务",
},
{
type: IMDomainType.商标注册,
title: "商标注册",
},
{
type: IMDomainType.专利布局,
title: "专利布局",
},
{
type: IMDomainType.专利服务,
title: "专利服务",
},
{
type: IMDomainType.中小微企业财税代理h,
title: "中小微企业财税代理",
},
{
type: IMDomainType.中小微企业工商代理h,
title: "中小微企业工商代理",
},
{
type: IMDomainType.出版物批发零售许可,
title: "出版物批发零售许可",
},
{
type: IMDomainType.高新技术企业认定h,
title: "高新技术企业认定",
},
{
type: IMDomainType.广播电视节目制作许可,
title: "广播电视节目制作许可",
},
{
type: IMDomainType.进出口备案许可,
title: "进出口备案许可",
},
{
type: IMDomainType.劳务派遣经营许可证h,
title: "劳务派遣经营许可证",
},
{
type: IMDomainType.人力资源服务许可证h,
title: "人力资源服务许可证",
},
{
type: IMDomainType.食品流通许可证h,
title: "食品流通许可证",
},
{
type: IMDomainType.项目申报h,
title: "项目申报",
},
{
type: IMDomainType.医疗器械经营许可,
title: "医疗器械经营许可",
},
{
type: IMDomainType.资质认证h,
title: "资质认证",
},
{
type: IMDomainType.劳务派遣h,
title: "劳务派遣服务",
},
{
type: IMDomainType.自然人代开h,
title: "自然人代开",
},
{
type: IMDomainType.审计报告,
title: "审计报告",
},
{
type: IMDomainType.验资报告,
title: "验资报告",
},
{
type: IMDomainType.专项审计,
title: "专项审计",
},
{
type: IMDomainType.岗位外包管理服务h,
title: "岗位外包管理服务",
},
{
type: IMDomainType.人力外包,
title: "人才派驻",
},
{
type: IMDomainType.人事外包管理服务,
title: "人事外包管理服务",
},
{
type: IMDomainType.版权服务h,
title: "版权服务",
},
{
type: IMDomainType.商标注册h,
title: "商标注册",
},
{
type: IMDomainType.专利布局h,
title: "专利布局",
},
{
type: IMDomainType.专利服务h,
title: "专利服务",
},
{
type: IMDomainType.社保业务,
title: "社保业务",
},
{
type: IMDomainType.公积金业务,
title: "公积金业务",
},
{
type: IMDomainType.公积金跨省转移,
title: "公积金跨省转移",
},
{
type: IMDomainType.公积金提取,
title: "公积金提取",
},
{
type: IMDomainType.其他公积金服务,
title: "其他公积金服务",
},
{
type: IMDomainType.参保人信息变更,
title: "参保人信息变更",
},
{
type: IMDomainType.定点医院变更,
title: "定点医院变更",
},
{
type: IMDomainType.补缴咨询,
title: "跨年补缴",
},
{
type: IMDomainType.其他社保服务,
title: "其他社保服务",
},
{
type: IMDomainType.社保卡办理补办,
title: "社保卡办理/补办",
},
{
type: IMDomainType.社保跨省转移,
title: "社保跨省转移",
},
{
type: IMDomainType.生育险报销,
title: "生育险报销",
},
{
type: IMDomainType.医疗费用报销,
title: "医疗费用报销",
},
{
type: IMDomainType.工资代发,
title: "工资代发",
},
{
type: IMDomainType.劳务费代发,
title: "劳务费代发",
},
{
type: IMDomainType.灵活就业薪酬个税,
title: "灵活就业工资发放",
},
{
type: IMDomainType.人力外包年服务资格,
title: "人力外包-年服务资格",
},
{
type: IMDomainType.高级会员申请,
title: "人事代理-年服务资格",
},
{
type: IMDomainType.公积金柜台增减员h,
title: "公积金柜台增减员",
},
{
type: IMDomainType.公积金开户h,
title: "公积金开户",
},
{
type: IMDomainType.公积金跨省转移h,
title: "公积金跨省转移",
},
{
type: IMDomainType.公积金提取h,
title: "公积金提取",
},
{
type: IMDomainType.公积金账户合并h,
title: "公积金账户合并",
},
{
type: IMDomainType.公积金还欠款h,
title: "还欠款",
},
{
type: IMDomainType.公积金数字证书办理续费h,
title: "数字证书办理/续费",
},
{
type: IMDomainType.参保人信息变更h,
title: "参保人信息变更",
},
{
type: IMDomainType.档案管理,
title: "档案管理",
},
{
type: IMDomainType.定点医院变更h,
title: "定点医院变更",
},
{
type: IMDomainType.定制参保缴费明细h,
title: "定制参保缴费明细",
},
{
type: IMDomainType.工伤申报,
title: "工伤申报",
},
{
type: IMDomainType.领取医保存折h,
title: "领取医保存折",
},
{
type: IMDomainType.社保柜台增减员,
title: "社保柜台增减员",
},
{
type: IMDomainType["社保卡办理/变更"],
title: "社保卡办理/补办",
},
{
type: IMDomainType.社保开户,
title: "社保开户",
},
{
type: IMDomainType.社保跨省转移h,
title: "社保跨省转移",
},
{
type: IMDomainType.社保清算h,
title: "社保清算",
},
{
type: IMDomainType.社保最后一个人减员,
title: "社保最后一个人减员",
},
{
type: IMDomainType.生育险报销h,
title: "生育费用报销",
},
{
type: IMDomainType.社保数字证书办理续费,
title: "数字证书办理/续费",
},
{
type: IMDomainType.医疗费用报销h,
title: "医疗费用报销",
},
{
type: IMDomainType.异地安置h,
title: "异地安置",
},
{
type: IMDomainType.工资代发h,
title: "工资代发",
},
{
type: IMDomainType.公积金托管申请,
title: "公积金托管申请",
},
{
type: IMDomainType.社保托管申请,
title: "社保托管申请",
},
{
type: IMDomainType.公积金托管补缴,
title: "公积金托管补缴",
},
{
type: IMDomainType.公积金托管调整员工基数,
title: "公积金托管调整员工基数",
},
{
type: IMDomainType.公积金托管减员,
title: "公积金托管减员",
},
{
type: IMDomainType.公积金托管其他,
title: "公积金托管其他",
},
{
type: IMDomainType.公积金托管增员,
title: "公积金托管增员",
},
{
type: IMDomainType.托管客户信息修改,
title: "托管客户信息修改",
},
{
type: IMDomainType.社保托管补缴,
title: "社保托管补缴",
},
{
type: IMDomainType.社保托管调整员工基数,
title: "社保托管调整员工基数",
},
{
type: IMDomainType.社保托管减员,
title: "社保托管减员",
},
{
type: IMDomainType.社保托管其他,
title: "社保托管其他",
},
{
type: IMDomainType.社保托管增员,
title: "社保托管增员",
},
{
type: IMDomainType.托管客户信息修改h,
title: "托管客户信息修改",
},
{
type: IMDomainType.北京集体户口迁移咨询,
title: "北京集体户口迁移咨询办理",
},
{
type: IMDomainType.北京工作居住证咨询服务,
title: "北京市工作居住证咨询",
},
{
type: IMDomainType.北京应届毕业生落户咨询,
title: "北京应届毕业生落户咨询",
},
{
type: IMDomainType.简历优化,
title: "简历优化",
},
{
type: IMDomainType.劳动权益保护,
title: "劳动权益保护",
},
{
type: IMDomainType.面试指导,
title: "面试指导",
},
{
type: IMDomainType.上海居住证办理咨询,
title: "上海居住证办理咨询",
},
{
type: IMDomainType.上海居住证积分申请咨询服务,
title: "上海居住证积分申请咨询服务",
},
{
type: IMDomainType.上海居转户咨询,
title: "上海居转户咨询",
},
{
type: IMDomainType.上海留学生落户咨询,
title: "上海留学生落户咨询",
},
{
type: IMDomainType.上海应届毕业生落户咨询,
title: "上海应届毕业生落户咨询",
},
{
type: IMDomainType.天津落户咨询服务,
title: "天津落户咨询服务",
},
{
type: IMDomainType.幼升小政策咨询,
title: "幼升小政策咨询",
},
{
type: IMDomainType.职业测评,
title: "职业测评",
},
{
type: IMDomainType.职业规划咨询,
title: "职业咨询",
},
{
type: IMDomainType.北京积分落户咨询服务h,
title: "北京积分落户咨询服务",
},
{
type: IMDomainType.北京工作居住证咨询服务h,
title: "北京企业工作居住证费用",
},
{
type: IMDomainType.北京应届毕业生落户咨询h,
title: "北京应届毕业生落户咨询",
},
{
type: IMDomainType.劳动争议,
title: "劳动纠纷咨询",
},
{
type: IMDomainType.上海居住证积分申请咨询服务h,
title: "上海居住证积分申请咨询服务",
},
{
type: IMDomainType.上海居转户咨询h,
title: "上海居转户咨询",
},
{
type: IMDomainType.上海留学生落户咨询h,
title: "上海留学生落户咨询",
},
{
type: IMDomainType.上海应届毕业生落户咨询h,
title: "上海应届毕业生落户咨询",
},
{
type: IMDomainType.天津落户咨询服务h,
title: "天津落户咨询服务",
},
{
type: IMDomainType.外国人工作许可h,
title: "外国人工作许可",
},
{
type: IMDomainType.成都购房社保合规咨询,
title: "成都购房社保合规咨询",
},
{
type: IMDomainType.成都落户咨询服务,
title: "成都落户咨询服务",
},
];
export function getOrderProductName(code: string) {
const t = imItems.find(i => i.type === code);
if (t) {
return { ...t, icon: `/im/icons1/${t.type}.png` };
}
return null;
}
import type { UniplatSdk } from "uniplat-sdk"; import type { UniplatSdk } from "uniplat-sdk";
export * from "./order"; // export * from "./order";
export * from "./order-product"; // export * from "./order-product";
export const enum ChatRole { export const enum ChatRole {
Default = 25, Default = 25,
...@@ -46,31 +46,15 @@ export const enum ServiceType { ...@@ -46,31 +46,15 @@ export const enum ServiceType {
Backend, Backend,
} }
export const enum ImEnvironment {
Dev = 1,
Stage,
Pro,
}
export const socketMapping = new Map<ImEnvironment, string>([
[ImEnvironment.Dev, "ws://hro.channel.jinsehuaqin.com:8080/ws"],
[ImEnvironment.Stage, "wss://pre-channel.qinqinxiaobao.com/ws"],
[ImEnvironment.Pro, "wss://channel.qinqinxiaobao.com/ws"],
]);
export type TokenStringGetter = () => Promise<string>; export type TokenStringGetter = () => Promise<string>;
export interface ChatOption { export interface ChatOption {
/** /**
* IM 链接,如果使用系统配置,只需要传入环境标识即可,如果默认配置不满足,可以传入指定地址 * IM 链接,如果使用系统配置,只需要传入环境标识即可,如果默认配置不满足,可以传入指定地址
*/ */
connection: ImEnvironment | string; connection: string;
sdk: () => UniplatSdk;
orgId: () => string | number;
product?: CustomerServiceProduct; token: string;
/** /**
* 用于标记会话启动是在客户端(用户)还是服务端(后端) * 用于标记会话启动是在客户端(用户)还是服务端(后端)
......
export const enum GeneralOrderDirection {
"社保卡办理/补办1" = "PRODUCT1",
"参保人信息变更1" = "PRODUCT2",
"中小微企业工商代理1" = "PRODUCT3",
"中小微企业财税代理2" = "PRODUCT4",
"定点医院变更1" = "PRODUCT5",
"医疗费用报销1" = "PRODUCT6",
"生育费用报销2" = "PRODUCT7",
"公积金提取1" = "PRODUCT8",
"雇主责任险-创业团队必备" = "PRODUCT9",
"北京市工作居住证咨询" = "PRODUCT16",
"其他服务1" = "PRODUCT24",
"社保卡办理/补办2" = "PRODUCT28",
"参保人信息变更2" = "PRODUCT29",
"中小微企业工商代理" = "PRODUCT30",
"中小微企业财税代理" = "PRODUCT31",
"定点医院变更2" = "PRODUCT32",
"医疗费用报销" = "PRODUCT33",
"生育费用报销" = "PRODUCT34",
"公积金提取2" = "PRODUCT35",
"北京工作居住证咨询服务" = "PRODUCT39",
"社保业务" = "PRODUCT67",
"公积金业务" = "PRODUCT68",
"薪酬个税" = "PRODUCT69",
"社保跨省转移1" = "PRODUCT76",
"社保跨省转移2" = "PRODUCT77",
"公积金跨省转移1" = "PRODUCT79",
"公积金跨省转移2" = "PRODUCT80",
"专利服务1" = "PRODUCT82",
"专利服务2" = "PRODUCT83",
"商标注册1" = "PRODUCT84",
"商标注册2" = "PRODUCT85",
"版权服务1" = "PRODUCT86",
"版权服务2" = "PRODUCT87",
"高新技术企业认定1" = "PRODUCT96",
"高新技术企业认定2" = "PRODUCT97",
"专利布局" = "PRODUCT99",
"项目申报" = "PRODUCT101",
"资质认证" = "PRODUCT103",
"劳务派遣经营许可证1" = "PRODUCT104",
"劳务派遣经营许可证2" = "PRODUCT105",
"人力资源服务许可证1" = "PRODUCT106",
"人力资源服务许可证2" = "PRODUCT107",
"食品流通许可证1" = "PRODUCT108",
"食品流通许可证2" = "PRODUCT109",
"工资代发1" = "PRODUCT111",
"劳务外包管理1" = "PRODUCT114",
"业务外包管理" = "PRODUCT115",
"岗位外包管理服务" = "PRODUCT116",
"劳务费代发" = "PRODUCT117",
"劳务外包管理2" = "PRODUCT118",
"全风险岗位外包" = "PRODUCT120",
"社保托管增员" = "PRODUCT121",
"社保托管减员" = "PRODUCT122",
"社保托管补缴" = "PRODUCT123",
"社保托管调整员工基数" = "PRODUCT125",
"公积金托管增员" = "PRODUCT126",
"公积金托管减员" = "PRODUCT127",
"公积金托管补缴" = "PRODUCT128",
"公积金托管调整员工基数" = "PRODUCT129",
"社保托管其他" = "PRODUCT130",
"公积金托管其他" = "PRODUCT131",
"社保托管申请" = "PRODUCT132",
"公积金托管申请" = "PRODUCT133",
"上海居住证积分申请咨询服务1" = "PRODUCT136",
"上海居住证积分申请咨询服务2" = "PRODUCT137",
"天津落户咨询服务" = "PRODUCT141",
"社保开户" = "PRODUCT143",
"社保最后一个人减员" = "PRODUCT144",
"社保清算1" = "PRODUCT145",
"异地安置" = "PRODUCT146",
"定制参保缴费明细" = "PRODUCT147",
"领取医保存折" = "PRODUCT149",
"工伤申报" = "PRODUCT150",
"社保柜台增减员" = "PRODUCT151",
"数字证书办理/续费1" = "PRODUCT152",
"公积金账户合并" = "PRODUCT153",
"公积金开户" = "PRODUCT154",
"还欠款" = "PRODUCT155",
"公积金柜台增减员" = "PRODUCT156",
"数字证书办理/续费2" = "PRODUCT157",
"托管客户信息修改1" = "PRODUCT158",
"托管客户信息修改2" = "PRODUCT159",
"档案管理" = "PRODUCT163",
"其他服务2" = "PRODUCT164",
"北京积分落户咨询服务" = "PRODUCT170",
"劳动权益保护" = "PRODUCT172",
"劳动纠纷咨询" = "PRODUCT174",
"幼升小政策咨询" = "PRODUCT177",
"老年人重大疾病" = "PRODUCT179",
"重疾险" = "PRODUCT180",
"少儿百种疾病意外医疗保险" = "PRODUCT181",
"团队补充医疗" = "PRODUCT182",
"补充医疗" = "PRODUCT183",
"雇主责任险1" = "PRODUCT184",
"团体意外险1" = "PRODUCT185",
"工资代发2" = "PRODUCT192",
"劳务派遣服务" = "PRODUCT193",
"北京企业工作居住证费用" = "PRODUCT194",
"雇主责任险2" = "PRODUCT198",
"团体意外险2" = "PRODUCT199",
"高端体检1" = "PRODUCT201",
"高端体检2" = "PRODUCT202",
"上海留学生落户咨询1" = "PRODUCT205",
"上海留学生落户咨询2" = "PRODUCT206",
"外国人工作许可" = "PRODUCT208",
"社保清算2" = "PRODUCT211",
"存档" = "PRODUCT212",
"证明开具" = "PRODUCT213",
"北京市工作居住证费用" = "PRODUCT214",
"人才派驻" = "PRODUCT215",
"医疗器械经营许可" = "PRODUCT217",
"进出口备案许可" = "PRODUCT218",
"出版物批发零售许可" = "PRODUCT219",
"广播电视节目制作许可" = "PRODUCT220",
"上海应届毕业生落户咨询1" = "PRODUCT222",
"上海应届毕业生落户咨询2" = "PRODUCT223",
"上海居转户咨询1" = "PRODUCT224",
"上海居转户咨询2" = "PRODUCT225",
"工商财税" = "PRODUCT226",
"灵活就业工资发放" = "PRODUCT227",
"职业咨询" = "PRODUCT229",
"人事代理-年服务资格" = "PRODUCT232",
"简历优化" = "PRODUCT234",
"面试指导" = "PRODUCT235",
"职业测评" = "PRODUCT236",
"人力外包-年服务资格" = "PRODUCT237",
"自然人代开1" = "PRODUCT238",
"自然人代开2" = "PRODUCT241",
"入职体检套餐" = "PRODUCT242",
"员工体检套餐" = "PRODUCT243",
"体检卡套餐" = "PRODUCT244",
"审计报告" = "PRODUCT245",
"验资报告" = "PRODUCT246",
"专项审计" = "PRODUCT247",
"跨年补缴" = "PRODUCT248",
"上海居住证办理咨询" = "PRODUCT249",
"人事外包管理服务" = "PRODUCT250",
"代理记账" = "PRODUCT251",
"成都购房社保合规咨询" = 'PRODUCT168',
"成都落户" = 'PRODUCT233',
}
export enum GeneralOrderTitle {
PRODUCT1 = "社保卡办理/补办",
PRODUCT2 = "参保人信息变更",
PRODUCT3 = "中小微企业工商代理",
PRODUCT4 = "中小微企业财税代理",
PRODUCT5 = "定点医院变更",
PRODUCT6 = "医疗费用报销",
PRODUCT7 = "生育费用报销",
PRODUCT8 = "公积金提取",
PRODUCT9 = "雇主责任险-创业团队必备",
PRODUCT16 = "北京市工作居住证咨询",
PRODUCT24 = "其他服务",
PRODUCT28 = "社保卡办理/补办",
PRODUCT29 = "参保人信息变更",
PRODUCT30 = "中小微企业工商代理",
PRODUCT31 = "中小微企业财税代理",
PRODUCT32 = "定点医院变更",
PRODUCT33 = "医疗费用报销",
PRODUCT34 = "生育费用报销",
PRODUCT35 = "公积金提取",
PRODUCT39 = "北京工作居住证咨询服务",
PRODUCT67 = "社保业务",
PRODUCT68 = "公积金业务",
PRODUCT69 = "薪酬个税",
PRODUCT76 = "社保跨省转移",
PRODUCT77 = "社保跨省转移",
PRODUCT79 = "公积金跨省转移",
PRODUCT80 = "公积金跨省转移",
PRODUCT82 = "专利服务",
PRODUCT83 = "专利服务",
PRODUCT84 = "商标注册",
PRODUCT85 = "商标注册",
PRODUCT86 = "版权服务",
PRODUCT87 = "版权服务",
PRODUCT96 = "高新技术企业认定",
PRODUCT97 = "高新技术企业认定",
PRODUCT99 = "专利布局",
PRODUCT101 = "项目申报",
PRODUCT103 = "资质认证",
PRODUCT104 = "劳务派遣经营许可证",
PRODUCT105 = "劳务派遣经营许可证",
PRODUCT106 = "人力资源服务许可证",
PRODUCT107 = "人力资源服务许可证",
PRODUCT108 = "食品流通许可证",
PRODUCT109 = "食品流通许可证",
PRODUCT111 = "工资代发",
PRODUCT114 = "劳务外包管理",
PRODUCT115 = "业务外包管理",
PRODUCT116 = "岗位外包管理服务",
PRODUCT117 = "劳务费代发",
PRODUCT118 = "劳务外包管理",
PRODUCT120 = "全风险岗位外包",
PRODUCT121 = "社保托管增员",
PRODUCT122 = "社保托管减员",
PRODUCT123 = "社保托管补缴",
PRODUCT125 = "社保托管调整员工基数",
PRODUCT126 = "公积金托管增员",
PRODUCT127 = "公积金托管减员",
PRODUCT128 = "公积金托管补缴",
PRODUCT129 = "公积金托管调整员工基数",
PRODUCT130 = "社保托管其他",
PRODUCT131 = "公积金托管其他",
PRODUCT132 = "社保托管申请",
PRODUCT133 = "公积金托管申请",
PRODUCT136 = "上海居住证积分申请咨询服务",
PRODUCT137 = "上海居住证积分申请咨询服务",
PRODUCT141 = "天津落户咨询服务",
PRODUCT143 = "社保开户",
PRODUCT144 = "社保最后一个人减员",
PRODUCT145 = "社保清算",
PRODUCT146 = "异地安置",
PRODUCT147 = "定制参保缴费明细",
PRODUCT149 = "领取医保存折",
PRODUCT150 = "工伤申报",
PRODUCT151 = "社保柜台增减员",
PRODUCT152 = "数字证书办理/续费",
PRODUCT153 = "公积金账户合并",
PRODUCT154 = "公积金开户",
PRODUCT155 = "还欠款",
PRODUCT156 = "公积金柜台增减员",
PRODUCT157 = "数字证书办理/续费",
PRODUCT158 = "托管客户信息修改",
PRODUCT159 = "托管客户信息修改",
PRODUCT163 = "档案管理",
PRODUCT164 = "其他服务",
PRODUCT170 = "北京积分落户咨询服务",
PRODUCT172 = "劳动权益保护",
PRODUCT174 = "劳动纠纷咨询",
PRODUCT177 = "幼升小政策咨询",
PRODUCT179 = "老年人重大疾病",
PRODUCT180 = "重疾险",
PRODUCT181 = "少儿百种疾病意外医疗保险",
PRODUCT182 = "团队补充医疗",
PRODUCT183 = "补充医疗",
PRODUCT184 = "雇主责任险",
PRODUCT185 = "团体意外险",
PRODUCT192 = "工资代发",
PRODUCT193 = "劳务派遣服务",
PRODUCT194 = "北京企业工作居住证费用",
PRODUCT198 = "雇主责任险",
PRODUCT199 = "团体意外险",
PRODUCT201 = "高端体检",
PRODUCT202 = "高端体检",
PRODUCT205 = "上海留学生落户咨询",
PRODUCT206 = "上海留学生落户咨询",
PRODUCT208 = "外国人工作许可",
PRODUCT211 = "社保清算",
PRODUCT212 = "存档",
PRODUCT213 = "证明开具",
PRODUCT214 = "北京市工作居住证费用",
PRODUCT215 = "人才派驻",
PRODUCT217 = "医疗器械经营许可",
PRODUCT218 = "进出口备案许可",
PRODUCT219 = "出版物批发零售许可",
PRODUCT220 = "广播电视节目制作许可",
PRODUCT222 = "上海应届毕业生落户咨询",
PRODUCT223 = "上海应届毕业生落户咨询",
PRODUCT224 = "上海居转户咨询",
PRODUCT225 = "上海居转户咨询",
PRODUCT226 = "工商财税",
PRODUCT227 = "灵活就业工资发放",
PRODUCT229 = "职业咨询",
PRODUCT232 = "人事代理-年服务资格",
PRODUCT234 = "简历优化",
PRODUCT235 = "面试指导",
PRODUCT236 = "职业测评",
PRODUCT237 = "人力外包-年服务资格",
PRODUCT238 = "自然人代开",
PRODUCT241 = "自然人代开",
PRODUCT242 = "入职体检套餐",
PRODUCT243 = "员工体检套餐",
PRODUCT244 = "体检卡套餐",
PRODUCT245 = "审计报告",
PRODUCT246 = "验资报告",
PRODUCT247 = "专项审计",
PRODUCT248 = "跨年补缴",
PRODUCT249 = "上海居住证办理咨询",
PRODUCT250 = "人事外包管理服务",
PRODUCT251 = "代理记账",
PRODUCT168 = "成都购房社保合规咨询",
PRODUCT233 = "成都落户",
}
import { Chat } from "../xim/models/chat";
import { GeneralOrderDirection } from './order-product';
import { action } from 'uniplat-sdk';
export interface ChatGroup extends Chat {
children?: ChatGroup[];
}
export const enum OrderStatus {
None,
Waiting,
Progressing,
Finished,
Failed,
UserCancelled,
AdminCancelled,
Deleted,
}
export const statusMapping = new Map<OrderStatus, string>([
[OrderStatus.None, ""],
[OrderStatus.Waiting, "等待处理"],
[OrderStatus.Progressing, "处理中"],
[OrderStatus.Finished, "已完成"],
[OrderStatus.Failed, "处理失败"],
[OrderStatus.UserCancelled, "已取消"],
[OrderStatus.AdminCancelled, "已取消"],
[OrderStatus.Deleted, "已删除"],
]);
export interface OrderTableListItem {
id: string;
v: number;
no: string;
title: string;
time: string;
chat: number;
status: OrderStatus;
status_label: string;
editTitle: string;
remark: string;
/**
* 待支付金额
*/
PayAmount: number;
/**
* 已支付金额
*/
PaidAmount: number;
/**
* 待退款金额
*/
RefundAmount: number;
/**
* 已退款金额
*/
RefundedAmount: number;
chatTypeCode: string;
lastMsgContent: string;
lastMsgTime: string;
unreadCount: number;
logo?: string;
orderId?: string;
/**
* 付款笔数
*/
PayPaymentNum?: string | number;
product: GeneralOrderDirection;
}
export const orderPredict = {
id: "ID",
v: "uniplat_version",
no: "OrderDocNo",
title: "ProductId#product.OuterName",
editTitle: "Title",
status: "Status_label",
remark: "Remark",
time: "CreatedDate",
PayAmount: "PayAmount",
PaidAmount: "PaidAmount",
RefundAmount: "RefundAmount",
RefundedAmount: "RefundedAmount",
chat: "UniplatImChatId",
chatTypeCode: "UniplatChatTypeCode",
lastMsgContent: "UniplatLastMsgContent",
lastMsgTime: "UniplatLastMsgTime",
unreadCount: 0,
PayPaymentNum: "PayPaymentNum",
product: 'ProductId#product.Code'
};
export const enum PayStatus {
UnPay = 1,
Paied,
Cancel,
Deleted,
WaitRefund,
Refund,
}
export const payStatusMapping = new Map<PayStatus, string>([
[PayStatus.UnPay, "待支付"],
[PayStatus.Paied, "已支付"],
[PayStatus.Cancel, "已取消"],
[PayStatus.Deleted, "已删除"],
[PayStatus.WaitRefund, "待退费"],
[PayStatus.Refund, "已退费"],
]);
export const cardPayStatusMapping = new Map<PayStatus, string>([
[PayStatus.UnPay, "待转账"],
[PayStatus.Paied, "已转账"],
]);
export const enum PayMethod {
CardTransfer = 1,
Balance,
Refund2Card,
Refund2Balance,
}
export const payMethodMapping = new Map<PayMethod, string>([
[PayMethod.CardTransfer, "银行卡转账"],
[PayMethod.Balance, "余额扣费"],
[PayMethod.Refund2Card, "退款至银行卡"],
[PayMethod.Refund2Balance, "退款至余额"],
]);
export interface OrderPayItem {
id: number;
v: number;
title: string;
time: string;
dueTime: string;
value: number;
status: PayStatus;
method: PayMethod;
method_label: string;
type: string;
desc: string;
agent: string;
createdTime: string;
actions?: action[];
bankAccountName?: string;
OpenningBankName?: string;
bankAccountNo?: string;
paymentItemId?: number;
paymentDate: string;
}
export interface OrderComment {
id: number;
content: string;
user: string;
attachment: string;
attachment_label: string;
time: string;
}
export const orderPayItemPredict = {
status: "Status",
time: "PaymentDate",
dueTime: "PaymentDueDate",
method: "PaymentFunction_label",
type: "ItemName",
desc: "PaymentDesc",
agent: "ProviderCollectId#provider_all_agent.AgentTrueName",
id: "ID",
v: "uniplat_version",
title: "ItemName",
value: "Amount",
createdTime: "CreatedDate",
bankAccountName: "ProviderHandleId#ServiceProviderBank.AccountName",
OpenningBankName: "ProviderHandleId#ServiceProviderBank.OpenningBankName",
bankAccountNo: "ProviderHandleId#ServiceProviderBank.AccountNo",
paymentItemId: "PaymentItemId",
paymentDate: "PaymentDate",
};
export const enum ChatOpenDirection {
/**
* 通知外壳,打开一个新的Webview容器打开会话
*/
NewWebview,
/**
* 直接会用当前Webview,跳转到聊天页面
*/
Current,
}
export const enum SrcPlatform {
Backend = 1,
Website,
H5,
OtherApp,
QqxbApp,
}
export const enum OperationType {
User = 1,
Backend,
}
export interface UploadImageItem {
id: number;
v: number;
url: string;
fileName: string;
time: string;
fileSize: number;
}
import { UniplatSdk } from "uniplat-sdk"; // import { UniplatSdk } from "uniplat-sdk";
export const enum BenefitServiceName { // export const enum BenefitServiceName {
CompanyApi = 'company_api' // CompanyApi = 'company_api'
} // }
export const enum BenefitApiName { // export const enum BenefitApiName {
Home = 'home_data', // Home = 'home_data',
AccountVerify = 'account_pay_need_verify_setting', // AccountVerify = 'account_pay_need_verify_setting',
AccountData = 'account_data', // AccountData = 'account_data',
GetWaitInvoiceFeeType = 'get_wait_invoice_fee_type', // GetWaitInvoiceFeeType = 'get_wait_invoice_fee_type',
ConfirmVoucherData = 'confirm_voucher_data', // ConfirmVoucherData = 'confirm_voucher_data',
UnitPivot = "unit_pivot", // UnitPivot = "unit_pivot",
UnitEmployeePivot = 'unit_employee_pivot' // UnitEmployeePivot = 'unit_employee_pivot'
} // }
export class BenefitInvoker { // export class BenefitInvoker {
private static readonly subProject = 'welfare_v2'; // private static readonly subProject = 'welfare_v2';
private static readonly unsetupError = '服务尚未初始化'; // private static readonly unsetupError = '服务尚未初始化';
private static sdk: UniplatSdk | null = null; // private static sdk: UniplatSdk | null = null;
public static setup(sdk: UniplatSdk) { // public static setup(sdk: UniplatSdk) {
this.sdk = sdk; // this.sdk = sdk;
return this; // return this;
} // }
public static get<T>(service: BenefitServiceName, api: BenefitApiName) { // public static get<T>(service: BenefitServiceName, api: BenefitApiName) {
if (this.sdk) { // if (this.sdk) {
return this.sdk.domainService(this.subProject, service, api).request<{}, {}, T>('get'); // return this.sdk.domainService(this.subProject, service, api).request<{}, {}, T>('get');
} // }
return Promise.reject(this.unsetupError); // return Promise.reject(this.unsetupError);
} // }
public static post<T>(service: BenefitServiceName, api: BenefitApiName, data?: any) { // public static post<T>(service: BenefitServiceName, api: BenefitApiName, data?: any) {
if (this.sdk) { // if (this.sdk) {
return this.sdk.domainService(this.subProject, service, api).request<{}, {}, T>('post', { data }); // return this.sdk.domainService(this.subProject, service, api).request<{}, {}, T>('post', { data });
} // }
return Promise.reject(this.unsetupError); // return Promise.reject(this.unsetupError);
} // }
} // }
export * from "./upload" // export * from "./upload"
\ No newline at end of file
import Axios, { AxiosResponse, AxiosAdapter } from "axios";
import { UniplatSdk } from "uniplat-sdk";
import { ImEnvironment } from "../model";
import { devAppTools } from '../database/dev-tools';
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",
DeShengJiuYeBao = "de-sheng-jiu-ye-bao",
}
const enum ProductTable {
Default = "",
Login = "login",
Error = "error",
}
export interface SdkMonitorOption {
userAgent?: boolean;
envir: ImEnvironment;
product: Product;
call?: (r: any) => void;
}
class WebMonitor {
private key = "";
private envir = ImEnvironment.Dev;
private product = Product.Default;
private readonly url = "https://pre-hrs-monitor.hrs100.com";
private adapter: AxiosAdapter | undefined;
public updateKey(key: string) {
this.key = key;
return this;
}
private buildHeaders() {
return {
headers: { authorization: "cdd0a34e-f537-4e5b-808e-2ba06af21845" },
adapter: this.adapter,
};
}
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 this.enable() && Axios.post(
this.url,
{
type: ProductTable.Error,
product: this.product,
msg: `${this.envirString()} ${msg} `,
key: this.key,
},
this.buildHeaders()
);
}
public useSdk(
sdk: UniplatSdk,
options: SdkMonitorOption,
adapter?: AxiosAdapter
) {
this.envir = options.envir;
this.product = options.product;
this.adapter = adapter;
sdk.events.addUniversalErrorResponseCallback(
(r: AxiosResponse<any>) => {
options.call && options.call(r);
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: ${window.navigator.userAgent}`);
r.config &&
r.config.params &&
msg.push(`Params: ${JSON.stringify(r.config.params)}`);
if (r.config && r.config.data) {
const form = r.config.data as FormData;
if (form.getAll) {
const p = form.getAll("parameters");
for (const item of p) {
msg.push(`Payload: ${item}`);
}
} else {
msg.push(
`Payload: ${JSON.stringify(r.config.data)}`
);
}
}
msg.push(`Location: ${window.location.href}`);
msg.push(
`Exception: ${(
(r.data.error as string) || ""
).substring(0, 500)}`
);
r && r.config && this.error(msg.join("\n"));
}
}
);
this.enable() && this.auditorLogin(sdk);
}
private auditorLogin(sdk: UniplatSdk) {
const name = this.key || sdk.global.username || sdk.global.uid;
const now = new Date();
const ts = `login-${now.getFullYear()}-${now.getMonth() + 1}-${now.getDate()}`;
devAppTools.getDataByKey(ts).then(r => {
const execute = () => {
devAppTools.addData(now.valueOf(), ts);
this.log(`用户 ${name}${now.valueOf()} 登录过,设备 ${window.navigator.userAgent}`);
};
if (r) {
const v = +r;
if (now.valueOf() - v > 60 * 60 * 1000) {
execute();
}
} else {
execute();
}
})
}
}
export const monitor = new WebMonitor();
import Chat from "@/customer-service/xim";
import { metaRow, UniplatSdkExtender, UniplatSdk } from "uniplat-sdk";
import {
OperationType,
OrderStatus,
OrderTableListItem,
orderPredict,
SrcPlatform,
OrderPayItem,
UploadImageItem,
orderPayItemPredict,
OrderComment,
PayStatus,
} from "../model";
import { GeneralOrderDirection } from "../model/order-product";
class OrderService {
public readonly generalOrder = "general_order_info";
public readonly generalOrderPaymentModel = "general_order_payment_info";
public readonly generalOrderDefaultDetailName = "userOrderDetail";
private readonly commentModel = "uniplat_model_remark@general_order";
private readonly fileModel = "general_order_payment_file_info";
private readonly handler = new UniplatSdkExtender();
private innerSdk: UniplatSdk | null = null;
public injectSdk(sdk: UniplatSdk) {
this.innerSdk = sdk;
return this;
}
private getSdk() {
return this.innerSdk || Chat.getSdk();
}
public openOrder(params: {
productCode: string;
srcPlatform: SrcPlatform;
createdType: OperationType;
/**
* 是否强制开启新订单,默认如果有已存在处理中的订单时会直接返回
*/
forceNewOrder?: boolean;
}) {
return this.getSdk()
.model(this.generalOrder)
.action(params.forceNewOrder ? "addOrder" : "getOrAddOrder")
.addInputs_parameter({
ProductCode: params.productCode,
SrcPlatform: params.srcPlatform,
CreatedType: params.createdType,
})
.execute();
}
public updateOrderStatus(
id: number | string,
v: number,
status: OrderStatus
) {
return this.getSdk()
.model(this.generalOrder)
.action("editStatus")
.addInputs_parameter({
Status: status,
userType: OperationType.User,
})
.updateInitialParams({ selected_list: [{ v, id: +id }] })
.execute();
}
/** 专项工单 */
public getOrders(
params: {
productCode?: GeneralOrderDirection;
index: number;
size?: number;
},
isHrs = false
) {
const list = this.getSdk()
.model(this.generalOrder)
.list(isHrs ? "hroOrgOrderList" : "userOrderList");
if (params.productCode) {
list.addPrefilter({ "ProductId#product.Code": params.productCode });
}
return list
.query({ item_size: params.size || 100, pageIndex: params.index })
.then((r) => {
return {
total: r.pageData.record_count,
list: this.handler.buildRows<OrderTableListItem>(
r.pageData.rows,
orderPredict
),
};
});
}
public getProcessOrders(params: {
productCode?: GeneralOrderDirection;
index: number;
size?: number;
}) {
const list = this.getSdk()
.model(this.generalOrder)
.list("hroOrgDoingOrderList");
if (params.productCode) {
list.addPrefilter({ "ProductId#product.Code": params.productCode });
}
return list
.query({ item_size: params.size || 100, pageIndex: params.index })
.then((r) => {
return {
total: r.pageData.record_count,
list: this.handler.buildRows<OrderTableListItem>(
r.pageData.rows,
orderPredict
),
};
});
}
/**
* 获取订单支付记录
* @param id 订单id
* @param withActions 是否获取行数据中action条目
*/
public getPayments(id: number, withActions = false) {
return this.getSdk()
.model(orderService.generalOrderPaymentModel)
.list(withActions ? "" : "userOrderPaymentList")
.addPrefilter({ OrderId: id })
.query({ pageIndex: 1, item_size: 100 })
.then((r) => {
if (r && r.pageData && r.pageData.rows) {
let items = this.handler.buildRows<OrderPayItem>(
r.pageData.rows,
orderPayItemPredict
);
if (!withActions) {
items = items.filter(
(i) =>
i.status !== PayStatus.Deleted &&
i.status !== PayStatus.Cancel
);
}
if (withActions) {
for (let i = 0; i < r.pageData.rows.length; i++) {
r.pageData &&
r.pageData.rows &&
r.pageData.rows[i] &&
items[i] &&
(items[i].actions = r.pageData.rows[i].actions);
}
}
return items;
}
return [];
});
}
public getPayment(id: string | number) {
return this.getSdk()
.model(orderService.generalOrderPaymentModel)
.detail(id as string, "userOrderPaymentDetail")
.query()
.then((r) =>
this.handler.buildRow<OrderPayItem>(r.row, orderPayItemPredict)
);
}
public addImage4Payment(payment: number | string, v: number, path: string) {
return this.getSdk()
.model(orderService.generalOrderPaymentModel)
.action("addImages")
.updateInitialParams({
selected_list: [{ v, id: payment as number }],
})
.addInputs_parameter({ images: path })
.execute();
}
public getImages4Payment(payment: number) {
return this.getSdk()
.model(this.fileModel)
.list()
.addPrefilter({ PaymentId: payment })
.query({ item_size: 10, pageIndex: 1 })
.then((r) =>
this.handler.buildRows<UploadImageItem>(r.pageData.rows, {
time: "CreatedDate",
fileSize: "FileSize",
fileName: "FileName",
url: "Url",
id: "ID",
v: "uniplat_version",
})
);
}
public deleteImage(payment: number, image: number, v: number) {
return this.getSdk()
.model(this.fileModel)
.action("delete")
.updateInitialParams({
selected_list: [{ v, id: image }],
prefilters: [{ property: "PaymentId", value: payment }],
})
.execute();
}
public buildOrder(o: metaRow) {
return this.handler.buildRow<OrderTableListItem>(o, orderPredict);
}
/** 设置备注 */
public setRemark(
id: string,
v: number,
data: { Title: string; Remark: string }
) {
return this.getSdk()
.model(this.generalOrder)
.action("editTitle")
.updateInitialParams({ selected_list: [{ v, id: +id }] })
.addInputs_parameter(data)
.execute();
}
public getOrderDetail(id: number | string) {
return this.getSdk()
.model(this.generalOrder)
.detail(id as string)
.query();
}
public sendPayAccountInfo(params: { send: string; type?: number }) {
return this.getSdk()
.domainService("hro_spview", "OrderSetting", "sendPayAccountInfo")
.request("get", { params });
}
public sendPayAccountInfoForAgent(params: {
send: string;
userOrderPaymentId: number;
}) {
return this.getSdk()
.domainService(
"hro_spview",
"OrderSetting",
"sendPayAccountInfoForAgent"
)
.request("get", { params });
}
public getComments(order: number | string) {
return this.getSdk()
.model(orderService.commentModel)
.list("system_remark")
.addPrefilter({ associate_id: order })
.query({ pageIndex: 1, item_size: 100 })
.then((r) => {
if (r && r.pageData && r.pageData.rows) {
const items = this.handler.buildRows<OrderComment>(
r.pageData.rows,
{
id: "",
time: "create_time",
attachment: "attachments_label",
user: "dealer_name",
content: "",
}
);
return items;
}
return [];
});
}
}
export const orderService = new OrderService();
...@@ -4,7 +4,7 @@ import chat from "../xim/index"; ...@@ -4,7 +4,7 @@ import chat from "../xim/index";
export function buildConfig(token: string, url: string) { export function buildConfig(token: string, url: string) {
if (url && url.includes("/general")) { if (url && url.includes("/general")) {
return { headers: { Authorization: token, CurrentOrg: chat.getOrgId() } }; return { headers: { Authorization: token } };
} }
return { headers: { Authorization: token } }; return { headers: { Authorization: token } };
} }
......
import Axios from 'axios';
const enum Status {
Default,
Upgrading
}
export class UpgradeController {
public static getUpgradingRange() {
return Axios
.get<{ code: Status; start: string; end: string }>(
`https://serverstatus.qinqinxiaobao.com/v0/servicestatus/apiservice/status/?t=${new Date().valueOf()}`
).then(r => {
if (r && r.data && r.data.code === Status.Upgrading) {
return { start: r.data.start, end: r.data.end };
}
return { start: '', end: '' };
});
}
}
import Chat from "@/customer-service/xim";
export async function uploadFile(file: File, uploading?: (p: number) => void) {
const sdk = Chat.getSdk();
const { url } = await sdk.uploadFileV2(file, {
onUploadProgress: (e) => uploading && uploading(e.percent),
});
return `${sdk.global.baseUrl}${url}`;
}
export const enum UploadType {
Default,
Image,
Camera
}
/**
* x
* @param type UploadType 默认值 UploadType.Default
* @param size 可不传 单位M
* @returns
*/
export function chooseFileAndUpload(type = UploadType.Default, size?: number) {
return chooseFile(type).then(r => {
const sdk = Chat.getSdk();
return sdk.uploadFileV2(r)
})
}
/**
*
* @param type UploadType
* @param size 可不传 单位M
* @returns
*/
export function chooseFile(type = UploadType.Default, size?: number) {
return new Promise<File>((resolve, reject) => {
const target = document.createElement('input');
target.setAttribute('type', 'file');
// 添加这个属性,就可以唤起相机的功能
(type === UploadType.Camera) && target.setAttribute('capture', 'camera');
// 这里如果不加属性 accept 是 "image/*" 或者 "video/*",就默认打开摄像头,既可以拍照也可以录像
(type === UploadType.Image) && target.setAttribute('accept', 'image/*');
target.setAttribute('style', 'display:none');
// 监听改变事件
target.addEventListener('change', (e: Event) => {
// 拿到文件对象
if (e && e.target) {
const t = e.target as HTMLInputElement;
const { files } = t;
if (files) {
// 返回的是一个文件对象
if (size && files[0].size >= size * 1024 * 1024) {
reject(`上传的${type === UploadType.Default ? "文件" : "图片"}太大了~`);
return;
}
resolve(files[0]);
setTimeout(() => target.remove(), 200);
return;
}
}
reject(new Error('系统不支持'));
setTimeout(() => target.remove(), 200);
});
document.body.appendChild(target);
// 这里是模拟点击了input控件
target.click();
});
}
\ No newline at end of file
...@@ -11,8 +11,8 @@ import { ...@@ -11,8 +11,8 @@ import {
} from "../model"; } from "../model";
import { isAccessibleUrl } from "../service/tools"; import { isAccessibleUrl } from "../service/tools";
import { unique } from "../utils"; import { unique } from "../utils";
import { getChatModelInfo } from "../utils/chat-info"; // import { getChatModelInfo } from "../utils/chat-info";
import { ChatUserInfoService } from "../utils/user-info"; // import { ChatUserInfoService } from "../utils/user-info";
import Chat from "../xim"; import Chat from "../xim";
import { Chat as ChatType, Message } from "../xim/models/chat"; import { Chat as ChatType, Message } from "../xim/models/chat";
import xim, { ChatNotifyListener } from "../xim/xim"; import xim, { ChatNotifyListener } from "../xim/xim";
...@@ -26,8 +26,8 @@ import { rebuildImage } from "../components/controller"; ...@@ -26,8 +26,8 @@ import { rebuildImage } from "../components/controller";
export const ns = ChatStore.ns; export const ns = ChatStore.ns;
const UniplatChatModelName = "UniplatChat"; const UniplatChatModelName = "UniplatChat";
const model = () => Chat.getSdk().model(UniplatChatModelName); // const model = () => Chat.getSdk().model(UniplatChatModelName);
const orgId = () => Chat.getOrgId() as string; // const orgId = () => Chat.getOrgId() as string;
function combineMessages( function combineMessages(
items1: ChatStore.STATE_CHAT_MSG_HISTORY, items1: ChatStore.STATE_CHAT_MSG_HISTORY,
...@@ -240,7 +240,7 @@ export default { ...@@ -240,7 +240,7 @@ export default {
: newItems; : newItems;
state[ChatStore.STATE_CHAT_MSG_HISTORY] = Object.freeze( state[ChatStore.STATE_CHAT_MSG_HISTORY] = Object.freeze(
combineMessages(old, filterout, chatid) combineMessages(old, filterout, chatid)
); ).filter((i) => i.type !== MessageType.Notify);
} }
}, },
[ChatStore.MUTATION_SAVE_MYSELF_ID](state) { [ChatStore.MUTATION_SAVE_MYSELF_ID](state) {
...@@ -417,20 +417,21 @@ export default { ...@@ -417,20 +417,21 @@ export default {
Chat.onReady(() => { Chat.onReady(() => {
xim.fetchChatList() xim.fetchChatList()
.then((data) => { .then((data) => {
console.log("fetchChatList", data);
if (!data) { if (!data) {
return resolve([]); return resolve([]);
} }
const chatList = filterActiveChats( const chatList = data.args[0] as RawChatItem[];
data.args[0] as RawChatItem[]
);
const items = chatList.map((chat) => const items = chatList.map((chat) =>
buildChatItem(chat) buildChatItem(chat)
); );
console.log("fetchChatList2", items);
dbController.saveChatList(items); dbController.saveChatList(items);
commit( commit(
ChatStore.MUTATION_SAVE_CHAT_LIST, ChatStore.MUTATION_SAVE_CHAT_LIST,
items items
); );
console.log("fetchChatList3", items);
dispatch( dispatch(
ChatStore.ACTION_REBUILD_UNREAD_MESSAGE_COUNT ChatStore.ACTION_REBUILD_UNREAD_MESSAGE_COUNT
); );
...@@ -571,10 +572,17 @@ export default { ...@@ -571,10 +572,17 @@ export default {
const chat = getters[ const chat = getters[
ChatStore.GETTER_CURRENT_CURRENT_CHAT ChatStore.GETTER_CURRENT_CURRENT_CHAT
] as ChatType; ] as ChatType;
return await Chat.getSdk() // TODO 发消息
.model(chat.model_name) return xim.sendMsg(
.chat(chat.obj_id, orgId()) "users",
.sendMsg(params.msgType, params.msg); chat.chat_id,
params.msgType,
params.msg
);
// return await Chat.getSdk()
// .model(chat.model_name)
// .chat(chat.obj_id, orgId())
// .sendMsg(params.msgType, params.msg);
} catch (error) { } catch (error) {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
commit( commit(
...@@ -604,41 +612,41 @@ export default { ...@@ -604,41 +612,41 @@ export default {
await preCacheImgs(newMsgsArr); await preCacheImgs(newMsgsArr);
commit(ChatStore.MUTATION_SCROLL_TO_BOTTOM); commit(ChatStore.MUTATION_SCROLL_TO_BOTTOM);
}, },
async [ChatStore.ACTION_CREATE_NEW_CHAT_BY_SERVICE_MAN]( // async [ChatStore.ACTION_CREATE_NEW_CHAT_BY_SERVICE_MAN](
{ commit, dispatch }, // { commit, dispatch },
params: Parameters<ChatStore.ACTION_CREATE_NEW_CHAT_BY_SERVICE_MAN>[0] // params: Parameters<ChatStore.ACTION_CREATE_NEW_CHAT_BY_SERVICE_MAN>[0]
) { // ) {
const { imChatId, catalog } = await Chat.getSdk() // const { imChatId, catalog } = await Chat.getSdk()
.model(params.modelName) // .model(params.modelName)
.chat(params.selectedListId, orgId()) // .chat(params.selectedListId, orgId())
.createChat(); // .createChat();
const chatId = +imChatId; // const chatId = +imChatId;
await dispatch(ChatStore.ACTION_GET_MY_CHAT_LIST); // await dispatch(ChatStore.ACTION_GET_MY_CHAT_LIST);
commit(ChatStore.MUTATION_SHOW_CHAT, !params.showByPage); // commit(ChatStore.MUTATION_SHOW_CHAT, !params.showByPage);
await dispatch( // await dispatch(
ChatStore.ACTION_SAVE_CURRENT_CHAT_ID_VERSION, // ChatStore.ACTION_SAVE_CURRENT_CHAT_ID_VERSION,
chatId // chatId
); // );
return { chatId, catalog }; // return { chatId, catalog };
}, // },
async [ChatStore.ACTION_CREATE_NEW_CHAT_BY_CLIENT]( // async [ChatStore.ACTION_CREATE_NEW_CHAT_BY_CLIENT](
{ commit, dispatch }, // { commit, dispatch },
params: Parameters<ChatStore.ACTION_CREATE_NEW_CHAT_BY_CLIENT>[0] // params: Parameters<ChatStore.ACTION_CREATE_NEW_CHAT_BY_CLIENT>[0]
) { // ) {
const { imChatId } = await Chat.getSdk() // const { imChatId } = await Chat.getSdk()
.model(params.modelName) // .model(params.modelName)
.chat(params.selectedListId, orgId()) // .chat(params.selectedListId, orgId())
.createChat(true, params.title); // .createChat(true, params.title);
const chatId = +imChatId; // const chatId = +imChatId;
await commit(ChatStore.MUTATION_SHOW_CHAT, true); // await commit(ChatStore.MUTATION_SHOW_CHAT, true);
await dispatch( // await dispatch(
ChatStore.ACTION_SAVE_CURRENT_CHAT_ID_VERSION, // ChatStore.ACTION_SAVE_CURRENT_CHAT_ID_VERSION,
chatId // chatId
); // );
// 打开会话后获取一下会话列表,刷新未读消息 // // 打开会话后获取一下会话列表,刷新未读消息
dispatch(ChatStore.ACTION_GET_MY_CHAT_LIST); // dispatch(ChatStore.ACTION_GET_MY_CHAT_LIST);
return chatId; // return chatId;
}, // },
async [ChatStore.ACTION_REGISTER_EVENT]({ async [ChatStore.ACTION_REGISTER_EVENT]({
dispatch, dispatch,
commit, commit,
...@@ -763,30 +771,30 @@ export default { ...@@ -763,30 +771,30 @@ export default {
commit(ChatStore.MUTATION_CLEAR_SINGLE_CHAT); commit(ChatStore.MUTATION_CLEAR_SINGLE_CHAT);
} }
if (!state[ChatStore.STATE_CHAT_CURRENT_USER_UID]) { // if (!state[ChatStore.STATE_CHAT_CURRENT_USER_UID]) {
const userInfo = await Chat.getSdk().getUserInfo(); // const userInfo = await Chat.getSdk().getUserInfo();
commit(ChatStore.MUTATION_SET_CURRENT_USER_UID, userInfo.id); // commit(ChatStore.MUTATION_SET_CURRENT_USER_UID, userInfo.id);
} // }
commit(ChatStore.MUTATION_CLEAR_CHAT_MSG_HISTORY); commit(ChatStore.MUTATION_CLEAR_CHAT_MSG_HISTORY);
commit(ChatStore.MUTATION_SAVE_CURRENT_CHAT_ID, chatId); commit(ChatStore.MUTATION_SAVE_CURRENT_CHAT_ID, chatId);
getChatModelInfo( // getChatModelInfo(
wantedChatRoom.model_name, // wantedChatRoom.model_name,
wantedChatRoom.obj_id, // wantedChatRoom.obj_id,
wantedChatRoom.detail_name // wantedChatRoom.detail_name
) // )
.then((info) => { // .then((info) => {
commit( // commit(
ChatStore.MUTATION_SAVE_CURRENT_CHAT_VERSION, // ChatStore.MUTATION_SAVE_CURRENT_CHAT_VERSION,
info.uniplat_version // info.uniplat_version
); // );
commit( // commit(
ChatStore.MUTATION_SAVE_CURRENT_CHAT_UNIPLAT_ID, // ChatStore.MUTATION_SAVE_CURRENT_CHAT_UNIPLAT_ID,
info.uniplatId // info.uniplatId
); // );
}) // })
.catch(console.error); // .catch(console.error);
commit(ChatStore.MUTATION_INITING_CHAT); commit(ChatStore.MUTATION_INITING_CHAT);
removeRegisterChatEvents.forEach((k) => k()); removeRegisterChatEvents.forEach((k) => k());
removeRegisterChatEvents = []; removeRegisterChatEvents = [];
...@@ -806,11 +814,11 @@ export default { ...@@ -806,11 +814,11 @@ export default {
commit(ChatStore.MUTATION_INITING_CHAT_DONE); commit(ChatStore.MUTATION_INITING_CHAT_DONE);
commit(ChatStore.MUTATION_SCROLL_TO_BOTTOM); commit(ChatStore.MUTATION_SCROLL_TO_BOTTOM);
(<any>state)[ChatStore.STATE_CHAT_CURRENT_IS_CHAT_ERROR] = null; (<any>state)[ChatStore.STATE_CHAT_CURRENT_IS_CHAT_ERROR] = null;
state[ChatStore.STATE_CHAT_CURRENT_IS_CHAT_MEMBER] && // state[ChatStore.STATE_CHAT_CURRENT_IS_CHAT_MEMBER] &&
Chat.setRead( // Chat.setRead(
wantedChatRoom.model_name, // wantedChatRoom.model_name,
wantedChatRoom.obj_id // wantedChatRoom.obj_id
); // );
} }
}, },
async [ChatStore.ACTION_CLEAR_CURRENT_CHAT_DATA]({ commit, state }) { async [ChatStore.ACTION_CLEAR_CURRENT_CHAT_DATA]({ commit, state }) {
...@@ -830,21 +838,21 @@ export default { ...@@ -830,21 +838,21 @@ export default {
(getChatMembersResult.args[0] as ChatMember[]) || []; (getChatMembersResult.args[0] as ChatMember[]) || [];
const all = await Promise.all( const all = await Promise.all(
chatMembers.map(async (member) => { chatMembers.map(async (member) => {
let result: NonNullable<ChatStore.STATE_CURRENT_CHAT_MEMBERS>[number]; // let result: NonNullable<ChatStore.STATE_CURRENT_CHAT_MEMBERS>[number];
try { // try {
const data = await ChatUserInfoService.getUserInfo( // const data = await ChatUserInfoService.getUserInfo(
member.eid // member.eid
); // );
result = { // result = {
...member, // ...member,
...data, // ...data,
}; // };
} catch (error) { // } catch (error) {
// eslint-disable-next-line no-console // // eslint-disable-next-line no-console
console.error(error); // console.error(error);
result = member; // result = member;
} // }
return result; return member;
}) })
); );
(<any>state)[ChatStore.STATE_ALL_HISTORY_CHAT_MEMBERS] = all; (<any>state)[ChatStore.STATE_ALL_HISTORY_CHAT_MEMBERS] = all;
...@@ -875,23 +883,23 @@ export default { ...@@ -875,23 +883,23 @@ export default {
const id = Number( const id = Number(
state[ChatStore.STATE_CHAT_CURRENT_CHAT_UNIPLAT_ID] state[ChatStore.STATE_CHAT_CURRENT_CHAT_UNIPLAT_ID]
); );
await model() // await model()
.action("update") // .action("update")
.updateInitialParams({ // .updateInitialParams({
selected_list: [{ v, id }], // selected_list: [{ v, id }],
}) // })
.addInputs_parameter({ // .addInputs_parameter({
Status: ChatStatus.terminated, // Status: ChatStatus.terminated,
}) // })
.execute(); // .execute();
await dispatch(ChatStore.ACTION_GET_MY_CHAT_LIST); await dispatch(ChatStore.ACTION_GET_MY_CHAT_LIST);
const firstChat = state[ChatStore.STATE_MY_CHAT_ROOM_LIST][0]; const firstChat = state[ChatStore.STATE_MY_CHAT_ROOM_LIST][0];
if (firstChat == null) return; if (firstChat == null) return;
await getChatModelInfo( // await getChatModelInfo(
firstChat.model_name, // firstChat.model_name,
firstChat.obj_id, // firstChat.obj_id,
firstChat.detail_name // firstChat.detail_name
); // );
await dispatch( await dispatch(
ChatStore.ACTION_SAVE_CURRENT_CHAT_ID_VERSION, ChatStore.ACTION_SAVE_CURRENT_CHAT_ID_VERSION,
firstChat.chat_id firstChat.chat_id
...@@ -909,16 +917,16 @@ export default { ...@@ -909,16 +917,16 @@ export default {
return Promise.reject(); return Promise.reject();
} }
return new Promise<void>((resolve, reject) => { return new Promise<void>((resolve, reject) => {
Chat.getSdk() // Chat.getSdk()
.model(currentChat.model_name) // .model(currentChat.model_name)
.chat(currentChat.obj_id, orgId()) // .chat(currentChat.obj_id, orgId())
.startChat() // .startChat()
.catch(reject) // .catch(reject)
.finally(() => // .finally(() =>
dispatch(ChatStore.ACTION_GET_CHAT_MEMBERS) // dispatch(ChatStore.ACTION_GET_CHAT_MEMBERS)
.then(resolve) // .then(resolve)
.catch(reject) // .catch(reject)
); // );
}); });
}, },
async [ChatStore.ACTION_CHAT_FINISH_RECEPTION]({ getters, dispatch }) { async [ChatStore.ACTION_CHAT_FINISH_RECEPTION]({ getters, dispatch }) {
...@@ -932,11 +940,11 @@ export default { ...@@ -932,11 +940,11 @@ export default {
) { ) {
return Promise.reject(); return Promise.reject();
} }
return await Chat.getSdk() // return await Chat.getSdk()
.model(currentChat.model_name) // .model(currentChat.model_name)
.chat(currentChat.obj_id, orgId()) // .chat(currentChat.obj_id, orgId())
.finishChat() // .finishChat()
.finally(() => dispatch(ChatStore.ACTION_GET_CHAT_MEMBERS)); // .finally(() => dispatch(ChatStore.ACTION_GET_CHAT_MEMBERS));
}, },
async [ChatStore.ACTION_CHAT_USER_EXIT]({ getters, dispatch }) { async [ChatStore.ACTION_CHAT_USER_EXIT]({ getters, dispatch }) {
const currentChat = getters[ const currentChat = getters[
...@@ -950,11 +958,11 @@ export default { ...@@ -950,11 +958,11 @@ export default {
return Promise.reject(); return Promise.reject();
} }
await dbController.removeChatFromList(currentChat.id); await dbController.removeChatFromList(currentChat.id);
return await Chat.getSdk() // return await Chat.getSdk()
.model(currentChat.model_name) // .model(currentChat.model_name)
.chat(currentChat.obj_id, orgId()) // .chat(currentChat.obj_id, orgId())
.userExitChat() // .userExitChat()
.finally(() => dispatch(ChatStore.ACTION_GET_CHAT_MEMBERS)); // .finally(() => dispatch(ChatStore.ACTION_GET_CHAT_MEMBERS));
}, },
async [ChatStore.ACTION_CHAT_CS_EXIT]({ getters, dispatch }) { async [ChatStore.ACTION_CHAT_CS_EXIT]({ getters, dispatch }) {
const currentChat = getters[ const currentChat = getters[
...@@ -968,11 +976,11 @@ export default { ...@@ -968,11 +976,11 @@ export default {
return Promise.reject(); return Promise.reject();
} }
await dbController.removeChatFromList(currentChat.id); await dbController.removeChatFromList(currentChat.id);
return await Chat.getSdk() // return await Chat.getSdk()
.model(currentChat.model_name) // .model(currentChat.model_name)
.chat(currentChat.obj_id, orgId()) // .chat(currentChat.obj_id, orgId())
.csExitChat() // .csExitChat()
.finally(() => dispatch(ChatStore.ACTION_GET_CHAT_MEMBERS)); // .finally(() => dispatch(ChatStore.ACTION_GET_CHAT_MEMBERS));
}, },
async [ChatStore.ACTION_CHAT_ADD_MEMBERS]( async [ChatStore.ACTION_CHAT_ADD_MEMBERS](
{ getters, dispatch }, { getters, dispatch },
...@@ -988,11 +996,11 @@ export default { ...@@ -988,11 +996,11 @@ export default {
) { ) {
return Promise.reject(); return Promise.reject();
} }
return await Chat.getSdk() // return await Chat.getSdk()
.model(currentChat.model_name) // .model(currentChat.model_name)
.chat(currentChat.obj_id, orgId()) // .chat(currentChat.obj_id, orgId())
.addMember(uids.map((id) => +id)) // .addMember(uids.map((id) => +id))
.finally(() => dispatch(ChatStore.ACTION_GET_CHAT_MEMBERS)); // .finally(() => dispatch(ChatStore.ACTION_GET_CHAT_MEMBERS));
}, },
async [ChatStore.ACTION_CHAT_REMOVE_MEMBER]( async [ChatStore.ACTION_CHAT_REMOVE_MEMBER](
{ getters, dispatch }, { getters, dispatch },
...@@ -1008,11 +1016,11 @@ export default { ...@@ -1008,11 +1016,11 @@ export default {
) { ) {
return Promise.reject(); return Promise.reject();
} }
return await Chat.getSdk() // return await Chat.getSdk()
.model(currentChat.model_name) // .model(currentChat.model_name)
.chat(currentChat.obj_id, currentChat.org_id) // .chat(currentChat.obj_id, currentChat.org_id)
.removeMember(uids.map((id) => +id)) // .removeMember(uids.map((id) => +id))
.finally(() => dispatch(ChatStore.ACTION_GET_CHAT_MEMBERS)); // .finally(() => dispatch(ChatStore.ACTION_GET_CHAT_MEMBERS));
}, },
async [ChatStore.ACTION_CHAT_ADD_CS]( async [ChatStore.ACTION_CHAT_ADD_CS](
{ getters, dispatch }, { getters, dispatch },
...@@ -1028,11 +1036,11 @@ export default { ...@@ -1028,11 +1036,11 @@ export default {
) { ) {
return Promise.reject(); return Promise.reject();
} }
return await Chat.getSdk() // return await Chat.getSdk()
.model(currentChat.model_name) // .model(currentChat.model_name)
.chat(currentChat.obj_id, orgId()) // .chat(currentChat.obj_id, orgId())
.addCs(uids.map((id) => Number(id))) // .addCs(uids.map((id) => Number(id)))
.finally(() => dispatch(ChatStore.ACTION_GET_CHAT_MEMBERS)); // .finally(() => dispatch(ChatStore.ACTION_GET_CHAT_MEMBERS));
}, },
async [ChatStore.ACTION_CHAT_REMOVE_CS]( async [ChatStore.ACTION_CHAT_REMOVE_CS](
{ getters, dispatch }, { getters, dispatch },
...@@ -1048,11 +1056,11 @@ export default { ...@@ -1048,11 +1056,11 @@ export default {
) { ) {
return Promise.reject(); return Promise.reject();
} }
return await Chat.getSdk() // return await Chat.getSdk()
.model(currentChat.model_name) // .model(currentChat.model_name)
.chat(currentChat.obj_id, orgId()) // .chat(currentChat.obj_id, orgId())
.removeCs(uids.map((id) => Number(id))) // .removeCs(uids.map((id) => Number(id)))
.finally(() => dispatch(ChatStore.ACTION_GET_CHAT_MEMBERS)); // .finally(() => dispatch(ChatStore.ACTION_GET_CHAT_MEMBERS));
}, },
[ChatStore.ACTION_SET_HANDLED]( [ChatStore.ACTION_SET_HANDLED](
{ state }, { state },
...@@ -1088,19 +1096,19 @@ export default { ...@@ -1088,19 +1096,19 @@ export default {
if (cache[id]) { if (cache[id]) {
return Promise.resolve({ id, name: cache[id] }); return Promise.resolve({ id, name: cache[id] });
} }
return new Promise<{ id: string; name: string }>( // return new Promise<{ id: string; name: string }>(
(resolve, reject) => // (resolve, reject) =>
ChatUserInfoService.getUserInfo(id) // ChatUserInfoService.getUserInfo(id)
.then((d) => { // .then((d) => {
Vue.set( // Vue.set(
state[ChatStore.STATE_CHAT_USERNAME], // state[ChatStore.STATE_CHAT_USERNAME],
id, // id,
d.name // d.name
); // );
resolve({ id, name: d.name }); // resolve({ id, name: d.name });
}) // })
.catch(reject) // .catch(reject)
); // );
}, },
[ChatStore.ACTION_UPDATE_MESSAGE_READ_STATUS]: ( [ChatStore.ACTION_UPDATE_MESSAGE_READ_STATUS]: (
{ state }, { state },
......
import Chat from "../xim"; import Chat from "../xim";
import { orderService } from "../service/order"; // import { orderService } from "../service/order";
export type ChatInfo = { export type ChatInfo = {
[eid: string]: any; [eid: string]: any;
...@@ -26,79 +26,79 @@ function buildCache() { ...@@ -26,79 +26,79 @@ function buildCache() {
if (!model2DetailNameMapping.size) { if (!model2DetailNameMapping.size) {
// 用户端默认不使用chat内置的detailName(这个专属于服务端),所以这里加一层内置转换 // 用户端默认不使用chat内置的detailName(这个专属于服务端),所以这里加一层内置转换
if (!Chat.isBackend()) { if (!Chat.isBackend()) {
model2DetailNameMapping.set( // model2DetailNameMapping.set(
orderService.generalOrder, // orderService.generalOrder,
orderService.generalOrderDefaultDetailName // orderService.generalOrderDefaultDetailName
); // );
} }
} }
} }
export async function getChatModelInfo( // export async function getChatModelInfo(
modelName: string, // modelName: string,
id: string | number, // id: string | number,
detailname?: string, // detailname?: string,
forceReload = false // forceReload = false
) { // ) {
buildCache(); // buildCache();
const detail = model2DetailNameMapping.get(modelName) || detailname; // const detail = model2DetailNameMapping.get(modelName) || detailname;
const key = `${modelName}-${id}-${detail}`; // const key = `${modelName}-${id}-${detail}`;
if (loadingKeys.has(key)) { // if (loadingKeys.has(key)) {
return new Promise<ChatModelInfoData>((resolve) => // return new Promise<ChatModelInfoData>((resolve) =>
waitingAction.push({ key, resolve }) // waitingAction.push({ key, resolve })
); // );
} // }
if (chatInfo[key] && !forceReload) { // if (chatInfo[key] && !forceReload) {
const d = chatInfo[key]; // const d = chatInfo[key];
if (d.row && d.row.UniplatChatId) { // if (d.row && d.row.UniplatChatId) {
return Promise.resolve({ // return Promise.resolve({
uniplatId: d.row.UniplatChatId.value, // uniplatId: d.row.UniplatChatId.value,
chat_id: +d.row.UniplatImChatId.value, // chat_id: +d.row.UniplatImChatId.value,
uniplat_version: 0, // uniplat_version: 0,
data: d, // data: d,
} as ChatModelInfoData); // } as ChatModelInfoData);
} // }
} // }
loadingKeys.add(key); // loadingKeys.add(key);
const info = await Chat.getSdk() // const info = await Chat.getSdk()
.model(modelName) // .model(modelName)
.detail(id + "", detail) // .detail(id + "", detail)
.query(); // .query();
const data = info; // const data = info;
info && info.row.UniplatChatId && (chatInfo[key] = data); // info && info.row.UniplatChatId && (chatInfo[key] = data);
loadingKeys.delete(key); // loadingKeys.delete(key);
const o = ( // const o = (
info.row && info.row.UniplatChatId // info.row && info.row.UniplatChatId
? { // ? {
uniplatId: info.row.UniplatChatId.value, // uniplatId: info.row.UniplatChatId.value,
chat_id: +(info.row.UniplatImChatId.value as string), // chat_id: +(info.row.UniplatImChatId.value as string),
uniplat_version: 0, // uniplat_version: 0,
data, // data,
} // }
: { // : {
uniplatId: 0, // uniplatId: 0,
chat_id: 0, // chat_id: 0,
uniplat_version: 0, // uniplat_version: 0,
data, // data,
} // }
) as ChatModelInfoData; // ) as ChatModelInfoData;
const removing = []; // const removing = [];
for (const item of waitingAction) { // for (const item of waitingAction) {
if (item.key === key) { // if (item.key === key) {
item.resolve(o); // item.resolve(o);
removing.push(item.key); // removing.push(item.key);
} // }
} // }
for (const item of removing) { // for (const item of removing) {
waitingAction = waitingAction.filter((i) => i.key !== item); // waitingAction = waitingAction.filter((i) => i.key !== item);
} // }
return o; // return o;
} // }
import { UniplatSdk } from "uniplat-sdk";
import Chat from "../xim";
export interface ChatUserSummaryInfo { export interface ChatUserSummaryInfo {
name: string; name: string;
phone: string; phone: string;
...@@ -30,71 +27,3 @@ let waitingAction: { ...@@ -30,71 +27,3 @@ let waitingAction: {
key: string; key: string;
resolve: (d: ChatUserSummaryInfo) => void; resolve: (d: ChatUserSummaryInfo) => void;
}[] = []; }[] = [];
export class ChatUserInfoService {
public static async getUserInfo(eid: string, sdk?: UniplatSdk) {
if (userMapping[eid]) {
return userMapping[eid];
}
if (!+eid || +eid < 0) {
return { name: "", phone: "", icon: "", alias_name: "" };
}
if (loadingKeys.has(eid)) {
return new Promise<ChatUserSummaryInfo>((resolve) =>
waitingAction.push({ key: eid, resolve })
);
}
loadingKeys.add(eid);
const info = await (sdk || Chat.getSdk())
.domainService(
"passport",
"anonymous",
`oidc.account/user_info?id=${eid}`
)
.request<any, any, UserInfo>("get");
const data = {
name: info.realname || info.username || info.mobile || info.mobile,
phone: info.mobile,
icon:
(info.avatar_url && decodeURIComponent(info.avatar_url)) || "",
alias_name: info.alias_name,
};
userMapping[eid] = data;
const removing = [];
for (const item of waitingAction) {
if (item.key === eid) {
item.resolve(data);
removing.push(item.key);
}
}
for (const item of removing) {
waitingAction = waitingAction.filter((i) => i.key !== item);
}
loadingKeys.delete(eid);
return data;
}
public static updateCache(uid: string, alias_name: string) {
const t = userMapping[uid];
t && (t.alias_name = alias_name);
}
public static setAliasName(
uid: string | number,
name: string,
sdk?: UniplatSdk
) {
return (sdk || Chat.getSdk())
.domainService("passport", "anonymous", `oidc.account/set_alias`)
.request<any, any, {}>("post", {
data: { id: uid, alias_name: name },
});
}
}
...@@ -8,8 +8,6 @@ import { ...@@ -8,8 +8,6 @@ import {
ServiceType, ServiceType,
CustomerServiceProduct, CustomerServiceProduct,
ChatMessageController, ChatMessageController,
socketMapping,
ImEnvironment,
} from "./../model"; } from "./../model";
import { ChatLoggerService } from "./logger"; import { ChatLoggerService } from "./logger";
import tokenManager from "./token"; import tokenManager from "./token";
...@@ -17,11 +15,8 @@ import xim from "./xim"; ...@@ -17,11 +15,8 @@ import xim from "./xim";
import { dbController } from "../database"; import { dbController } from "../database";
class Chat { class Chat {
private _sdk?: () => UniplatSdk;
private _orgId: () => string | number = () => "0";
private token!: TokenStringGetter; private token!: TokenStringGetter;
private serviceType = ServiceType.Backend; private serviceType = ServiceType.Frontend;
private product = CustomerServiceProduct.Default;
private eventHub: Vue | null = null; private eventHub: Vue | null = null;
private keywords: string[] = []; private keywords: string[] = [];
private ws = ""; private ws = "";
...@@ -48,40 +43,23 @@ class Chat { ...@@ -48,40 +43,23 @@ class Chat {
`You must specify a web socket address for chat service` `You must specify a web socket address for chat service`
); );
} }
this._sdk = option.sdk;
this._orgId = option.orgId;
option.serviceType !== undefined &&
(this.serviceType = option.serviceType);
option.product && (this.product = option.product);
this.eventHub = option.eventHub || null; this.eventHub = option.eventHub || null;
option.message && (this.messageController = option.message); option.message && (this.messageController = option.message);
option.avatar !== undefined && (this.defaultAvatar = option.avatar); option.avatar !== undefined && (this.defaultAvatar = option.avatar);
if(!option.disabledIndexDb){ // if (!option.disabledIndexDb) {
await this.setupIndexDb(option.orgId()).catch(err => { // await this.setupIndexDb("test").catch((err) => {
// 必须catch error不然小程序不会向后运行 // // 必须catch error不然小程序不会向后运行
console.error("setupIndexDb Error") // console.error("setupIndexDb Error");
}); // });
} // }
this.token = async () => option.sdk().global.jwtToken; this.token = async () => option.token;
tokenManager.save(this.token); tokenManager.save(this.token);
EmojiService.raiseOnReady(this.token); EmojiService.raiseOnReady(this.token);
option return this.initChatSdk((this.ws = option.connection)).finally(() => {
.sdk()
.events.addTokenChanged((token) =>
this.setToken(() => new Promise((resolve) => resolve(token)))
);
// this.keywords = ["社保"];
const path =
(socketMapping.get(option.connection as ImEnvironment) as string) ||
(option.connection as string);
return this.initChatSdk((this.ws = path)).finally(() => {
this.connected = true; this.connected = true;
for (const item of this.connectedActions) { for (const item of this.connectedActions) {
item(); item();
...@@ -89,32 +67,14 @@ class Chat { ...@@ -89,32 +67,14 @@ class Chat {
}); });
} }
private setupIndexDb(orgId: number | string) { private setupIndexDb(key: string) {
if (this._sdk) {
const s = this._sdk();
const key = `${s.global.uid}-${orgId || 0}`;
return dbController.setup(key); return dbController.setup(key);
} }
return Promise.reject();
}
public resetup(org: () => string | number) {
this._orgId = org;
xim.onConnected();
return this.setupIndexDb(org());
}
public unSetup() { public unSetup() {
xim.close(); xim.close();
} }
public getSdk = () => {
if (!this._sdk) {
throw new Error("sdk shouldn't undefined");
}
return this._sdk();
};
public getServiceType() { public getServiceType() {
return this.serviceType; return this.serviceType;
} }
...@@ -123,14 +83,6 @@ class Chat { ...@@ -123,14 +83,6 @@ class Chat {
return this.serviceType === ServiceType.Backend; return this.serviceType === ServiceType.Backend;
} }
public getProduct() {
return this.product;
}
public getOrgId = () => {
return this._orgId();
};
public setToken(token: TokenStringGetter) { public setToken(token: TokenStringGetter) {
return xim.setToken(token); return xim.setToken(token);
} }
...@@ -158,7 +110,9 @@ class Chat { ...@@ -158,7 +110,9 @@ class Chat {
if (xim.isConnected()) { if (xim.isConnected()) {
setTimeout(resolve, 200); setTimeout(resolve, 200);
} else { } else {
reject(new Error(`客服系统连接出现错误,请尝试刷新页面`)); reject(
new Error(`客服系统连接出现错误,请尝试刷新页面`)
);
} }
}); });
}); });
...@@ -210,15 +164,6 @@ class Chat { ...@@ -210,15 +164,6 @@ class Chat {
public getAvatar() { public getAvatar() {
return this.defaultAvatar; return this.defaultAvatar;
} }
public setRead(model: string, obj: string) {
if (this.isBackend()) {
const sdk = this.getSdk();
if (sdk) {
sdk.getAxios().post(`/general/xim/model/${model}/${obj}/read`);
}
}
}
} }
export default new Chat(); export default new Chat();
import { import {
MessageHandled, MessageHandled,
MessageType, MessageType,
PayMethod, // PayMethod,
PayStatus, // PayStatus,
} from "@/customer-service/model"; } from "@/customer-service/model";
export interface Chat { export interface Chat {
...@@ -204,8 +204,8 @@ export type CommentForwardMessageBody = { ...@@ -204,8 +204,8 @@ export type CommentForwardMessageBody = {
}; };
export interface PayMessageBody { export interface PayMessageBody {
status: PayStatus; // status: PayStatus;
paymentFunction: PayMethod; // paymentFunction: PayMethod;
itemName: string; itemName: string;
amount: string; amount: string;
paymentId: string; paymentId: string;
......
...@@ -5,7 +5,6 @@ import { TokenStringGetter } from "./../model"; ...@@ -5,7 +5,6 @@ import { TokenStringGetter } from "./../model";
import { ChatLoggerService } from "./logger"; import { ChatLoggerService } from "./logger";
import { Message, NotifyMessage } from "./models/chat"; import { Message, NotifyMessage } from "./models/chat";
import chat from "./index";
import { STATUS } from "xchat-client/dist/xchat"; import { STATUS } from "xchat-client/dist/xchat";
wampDebug(false); wampDebug(false);
...@@ -67,6 +66,7 @@ export class Xim { ...@@ -67,6 +66,7 @@ export class Xim {
this.close(); this.close();
token().then((t) => { token().then((t) => {
console.log({ token: t });
if (!t) return; if (!t) return;
const client = new XChatClient(url, this.trimToken(t)); const client = new XChatClient(url, this.trimToken(t));
this.client = client; this.client = client;
...@@ -173,9 +173,9 @@ export class Xim { ...@@ -173,9 +173,9 @@ export class Xim {
if (this.client == null) { if (this.client == null) {
throw new Error("client shouldn't undefined"); throw new Error("client shouldn't undefined");
} }
if (p && !p.isMember && p.model && p.obj) { // if (p && !p.isMember && p.model && p.obj) {
return this.queryMessageWhenIsNotMember(p, limit, lid, rid, desc); // return this.queryMessageWhenIsNotMember(p, limit, lid, rid, desc);
} // }
const res = await this.client.fetchChatMsgs(chatType, chatId, { const res = await this.client.fetchChatMsgs(chatType, chatId, {
lid, lid,
rid, rid,
...@@ -185,24 +185,24 @@ export class Xim { ...@@ -185,24 +185,24 @@ export class Xim {
return res.args[0]; return res.args[0];
} }
private queryMessageWhenIsNotMember( // private queryMessageWhenIsNotMember(
p: { isMember: boolean; model: string; obj: string }, // p: { isMember: boolean; model: string; obj: string },
limit: number, // limit: number,
lid: number, // lid: number,
rid: number, // rid: number,
desc: boolean // desc: boolean
) { // ) {
return chat // return chat
.getSdk() // .getSdk()
.getAxios() // .getAxios()
.get<any, Message[]>( // .get<any, Message[]>(
`/general/xim/model/${p.model}/${ // `/general/xim/model/${p.model}/${
p.obj // p.obj
}/msgs?lid=${lid}&rid=${rid}&limit=${limit}&desc=${ // }/msgs?lid=${lid}&rid=${rid}&limit=${limit}&desc=${
desc ? 1 : 0 // desc ? 1 : 0
}` // }`
); // );
} // }
private setMessagesRead(chatId: number, msg: Message[]) { private setMessagesRead(chatId: number, msg: Message[]) {
if (!msg.length) { if (!msg.length) {
...@@ -371,7 +371,8 @@ export class Xim { ...@@ -371,7 +371,8 @@ export class Xim {
public onConnected() { public onConnected() {
if (this.client == null) return; if (this.client == null) return;
// 连接成功后,需要调用pubUserInfo, 否则服务端会认为此连接无效 // 连接成功后,需要调用pubUserInfo, 否则服务端会认为此连接无效
this.client.pubUserInfo(JSON.stringify({ org_id: chat.getOrgId() })); // TODO
this.client.pubUserInfo(JSON.stringify({ org_id: 2 }));
this.debug("xim connected"); this.debug("xim connected");
} }
......
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