Commit d3cf6ab6 authored by chenqikuai's avatar chenqikuai

fix

parent e689d495
......@@ -49,7 +49,6 @@ export default defineComponent({
}
fmp
.authorize({
appId: "dtalk",
......
<script lang="tsx">
import { goToChatWithOutletRoboot } from "@/router/navigate";
import AddressService from "@/service/AddressService";
import { defineComponent, ref } from "vue";
export default defineComponent({
props: ["setRef", "min_amount", "max_amount", "rate_lower", "rate_upper"],
setup(props) {
const handleClick = async () => {
console.log(1);
const ret = await AddressService.getInstance().getNearby({
bank_code: Number(process.env.VUE_APP_BANK_CODE),
number: 1,
})
if (ret.code === 200) {
goToChatWithOutletRoboot({
outletId: ret.data[0].outlet_id
})
}
}
return () => (
<div class="group2 flex-col">
<button
class="bd12 flex-col"
onClick={() => {}}
ref={(el) => {
props.setRef(el);
}}
>
<span class="txt9">立即申请</span>
</button>
<div class="bd13 flex-col w-full">
<div class="bd13 w-full">
<div class="layer12 flex-col w-full">
<span class="word18">借款额度(万元)</span>
<span class="txt10">
......@@ -26,6 +32,18 @@ export default defineComponent({
</span>
</div>
</div>
<button
class="bd12 flex-col"
onClick={() => {
console.log(1123123)
handleClick();
}}
ref={(el) => {
props.setRef(el);
}}
>
<span class="txt9" >立即申请</span>
</button>
</div>
);
},
......@@ -46,7 +64,7 @@ export default defineComponent({
left: 20px;
top: 222px;
.bd12 {
z-index: 12;
z-index: 15;
height: 40px;
border-radius: 20px;
background-color: rgba(62, 79, 175, 1);
......
......@@ -11,4 +11,9 @@ export const CONST_END_CHAT = {
staff: { id: '4', value: '会话已结束' },
}
export const CHAT_CONST_LIST = [CONST_START_CHAT, CONST_END_CHAT]
export const CONST_WARNING = {
user: { id: '5', value: '您好,非常抱歉,该网点暂无营业人员。' },
staff: { id: '6', value: '' },
}
export const CHAT_CONST_LIST = [CONST_START_CHAT, CONST_END_CHAT, CONST_WARNING]
......@@ -6,6 +6,13 @@ import {
import ChatListCardDB from './ChatListCardDB'
import ChatMessageDB from './ChatMessageDB'
interface iRecevedMsg {
msg: DisplayMessage
masterId: string
isChattingWithTargetId: boolean
isRoboot?: boolean
}
export default class ChatDBService {
static instance: ChatDBService
static getInstance() {
......@@ -19,35 +26,57 @@ export default class ChatDBService {
isChattingWithTargetId: boolean
isRoboot?: boolean
}) {
let firstInsert = false
if (this.dataList.length === 0) {
firstInsert = true
}
this.pushToList(data)
if (firstInsert === true) {
this.startExecList()
}
}
private async startExecList(): Promise<any> {
if (this.dataList[0] !== undefined) {
const msg = this.dataList[0]
await this.exec(msg)
this.dataList.shift()
return this.startExecList()
}
}
private async exec(data: {
msg: DisplayMessage
masterId: string
isChattingWithTargetId: boolean
isRoboot?: boolean
}) {
/* 检查和对象之间的聊天记录,如果数量为0,则表示之前没有和他聊过,需要新增一个chatcard */
/* 如果数量为1,表示之前和他聊过 */
const { msg, masterId, isChattingWithTargetId } = data
console.log(data, 'show in handleEveryRecive')
const thePersonAlreadyInChatList = await ChatListCardDB.getInstance().thePersonAlreadyInChatList(
const thePersonAlreadyInChatList = await ChatMessageDB.getInstance().thePersonAlreadyInChatList(
getMasterIdFromDisplayMsg(msg),
getTargetIdFromDisplayMsg(msg),
)
// const thePersonAlreadyInChatList = await ChatMessageDB.getInstance().thePersonAlreadyInChatList(
// getMasterIdFromDisplayMsg(msg),
// getTargetIdFromDisplayMsg(msg),
// )
await ChatMessageDB.getInstance().saveMsg(msg, masterId)
// console.log(
// thePersonAlreadyInChatList,
// 'show thePersonAlreadyInChatList',
// new Date().getTime(),
// )
if (thePersonAlreadyInChatList) {
await ChatListCardDB.getInstance().updateNewestCard({
return await ChatListCardDB.getInstance().updateNewestCard({
msg,
isChattingWithTargetId,
})
} else {
await ChatListCardDB.getInstance().addNewCard({
return await ChatListCardDB.getInstance().addNewCard({
msg,
isChattingWithTargetId,
isRobootCard: data.isRoboot,
})
}
}
private dataList = [] as iRecevedMsg[]
private pushToList(msg: iRecevedMsg) {
this.dataList.push(msg)
}
}
......@@ -52,8 +52,7 @@ export default class ChatListCardDB extends MyAppDatabase {
return this.chatListCard
.filter((item) => {
return item.masterId === masterId
})
.toArray()
}).reverse().sortBy('datetime')
}
async thePersonAlreadyInChatList(masterId: string, personId: string) {
......
......@@ -98,9 +98,7 @@ export default class ChatMessageDB extends MyAppDatabase {
.filter(
(i) =>
(i.masterId === masterId &&
i.state === null &&
i.from === personId) ||
(i.state !== null && i.target === personId),
((i.state === null && i.from === personId) || (i.state !== null && i.target === personId)))
)
.count()) !== 0
)
......
......@@ -16,6 +16,8 @@ baseAxios.interceptors.response.use(
router.push({
name: 'Login',
})
} else if (ret.code === 1000) {
Toast('您好,非常抱歉,该网点暂无营业人员。')
} else if (ret.code !== 200) {
Toast.fail(ret.msg)
}
......
......@@ -54,7 +54,7 @@ import { useRoute } from "vue-router";
import { queryFaqAnswer, queryFaqList } from "@/service/FaqService";
import { getDisplayNames, getDisplayNamesFromAddress, getMsgFromAddress } from "@/utils/displayName";
import { MessageContent } from "@/types/chat-message";
import { CONST_END_CHAT, CONST_START_CHAT } from "@/config/chat";
import { CONST_END_CHAT, CONST_START_CHAT, CONST_WARNING } from "@/config/chat";
import ChatOptionItemVue from "@/components/ChatOptions/ChatOptionItem.vue";
import ShowCall from "@/components/showCall/index.vue"
import { getUserMsg } from "@/utils/userMsg";
......@@ -62,6 +62,7 @@ import { eRole } from "@/types/roleType";
import ChatDBService from "@/db/ChatDBService";
import UserService from "@/service/UserService";
import { gotoChatWithStaff } from "@/router/navigate";
import { Toast } from "vant";
export default defineComponent({
......@@ -118,6 +119,15 @@ export default defineComponent({
beginChat: true
});
} else {
// await sendChatMessage({
// type: ChatMessageTypes.Card,
// content: {
// bank: CONST_WARNING.user.id,
// name: CONST_WARNING.staff.id,
// account: '',
// } as MessageContent,
// target: route.query.targetId as string
// })
return;
}
......@@ -288,7 +298,9 @@ export default defineComponent({
await initTitle();
if (!isChatWithRoboot.value && route.query.beginChat !== undefined) {
setTimeout(() => {
if (!isChatWithRoboot.value) {
notifyUserAndStaffTheChatBegin()
}
}, 1000)
}
})
......
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 to comment