Commit a5adf7e1 authored by chenqikuai's avatar chenqikuai

store

parent 6fd2685f
<template>
<div
class="item flex items-center justify-center ml-4"
:class="{ 'select-item': selected }"
>{{ value }}</div>
</template>
<script setup lang="ts">
import { PropType } from "@vue/runtime-core";
const props = defineProps({
selected: {
required: true,
type: Boolean,
},
value: {
required: true,
type: String as PropType<string>,
}
})
</script>
<style>
.item {
width: 100px;
height: 35px;
background: #f5f6f9;
border-radius: 20px;
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #1b1f37;
}
.select-item {
background: #3e4faf;
color: #ffffff;
}
</style>
\ No newline at end of file
<template> <template>
<div class="ChatOption bg-white flex items-center"> <div class="ChatOption bg-white flex items-center">
<div <slot></slot>
v-for="item in props.list"
:key="item.name"
class="item flex items-center justify-center ml-4"
:class="{ 'select-item': props.selected === item.id }"
@click="props.setSelected && props.setSelected(item.id)"
>{{ item.name }}</div>
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { PropType } from "vue";
const props = defineProps({
list: {
type: Array as PropType<{ name: string, id: number }[]>,
},
selected: {
type: Number,
},
setSelected: {
type: Function,
requied: true
},
});
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.ChatOption { .ChatOption {
......
<template> <template>
<div> <div>
<van-popup v-model:show="show" round teleport="body" :style="{ width: '90%', top: '80%' }" @click-overlay="hide"> <van-popup
<div class="text-center py-4" @click="handleClickCall"> v-model:show="show"
<icon round
name="icon-a-dianhua" teleport="body"
color="#3E4FAF" :style="{ width: '90%', top: '80%' }"
size="17" @click-overlay="hide"
class="inline-block pr-3 align-text-bottom" >
/> <div class="text-center py-4" @click="handleClickCall">
<span class="text-app-blue text-sm align-middle font-semibold">呼叫{{ phone }}</span> <icon
</div> name="icon-a-dianhua"
</van-popup> color="#3E4FAF"
<van-popup size="17"
class="inline-block pr-3 align-text-bottom"
/>
<span class="text-app-blue text-sm align-middle font-semibold">呼叫{{ phone }}</span>
</div>
</van-popup>
<van-popup
v-model:show="show" v-model:show="show"
round round
:style="{ width: '90%', margin: '60px auto 0px auto', top: '80%' }" :style="{ width: '90%', margin: '60px auto 0px auto', top: '80%' }"
...@@ -28,7 +34,7 @@ ...@@ -28,7 +34,7 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import Vue, { ComponentInternalInstance, getCurrentInstance } from 'vue' import Vue, { getCurrentInstance } from 'vue'
import jsBridge from "@/utils/jsBridge2" import jsBridge from "@/utils/jsBridge2"
const { ctx } = getCurrentInstance() as any const { ctx } = getCurrentInstance() as any
......
export const TRANSFER_HUMAN_1 = '客服经理已接入会话,我们预计3分钟内联系您'
export const TRANSFER_HUMAN_2 = '客户已接入会话,请尽快联系客户'
\ No newline at end of file
...@@ -146,7 +146,7 @@ class MessageStore { ...@@ -146,7 +146,7 @@ class MessageStore {
} }
// 多媒体类的消息(语音、图片、视频)上传阿里云 OSS,取得 url,发送 url // 多媒体类的消息(语音、图片、视频)上传阿里云 OSS,取得 url,发送 url
if (type !== ChatMessageTypes.Text && type !== ChatMessageTypes.Card && type !== ChatMessageTypes.FOO) { if (type !== ChatMessageTypes.Text && type !== ChatMessageTypes.Card) {
// 特殊情况处理:当发送微信和支付宝收款方式时,由于是直接从后端拿到的图片外链,所以直接发送 // 特殊情况处理:当发送微信和支付宝收款方式时,由于是直接从后端拿到的图片外链,所以直接发送
if (!content.rawMessage) { if (!content.rawMessage) {
if ( if (
......
export interface iNotifyMsg {
staffMsg: string
userMsg: string
}
...@@ -7,6 +7,6 @@ export enum ChatMessageTypes { ...@@ -7,6 +7,6 @@ export enum ChatMessageTypes {
Video = 4, Video = 4,
File = 5, File = 5,
Card = 6, Card = 6,
Alert = 7,
robot = 100, robot = 100,
FOO = 9,
} }
...@@ -53,3 +53,52 @@ export const getDisplayNamesFromAddress = async ( ...@@ -53,3 +53,52 @@ export const getDisplayNamesFromAddress = async (
return msg?.user_name || msg?.phone return msg?.user_name || msg?.phone
}) })
} }
export const getMsgFromAddress = async (
addressList: string[],
): Promise<any[]> => {
/* 数据库查 有结果拿 没结果网上查且存 */
const user = getUserMsg()
let foundList = [] as any[]
let notFoundList = [] as any[]
if (user?.role === eRole.user) {
const ret = await ContactPersonService.getInstance().findByList(addressList)
foundList = ret.foundList
notFoundList = ret.notFoundList
} else if (user?.role === eRole.staff) {
const ret = await UserInfoDBService.getInstance().findByList(addressList)
foundList = ret.foundList
notFoundList = ret.notFoundList
}
const fullList = (foundList as unknown) as any
if (notFoundList.length !== 0) {
if (user?.role === eRole.user) {
const ret = await UserService.getInstance().staffInfo({
addrs: notFoundList,
})
if (ret.code === 200) {
const theoseNotFoundList = ret.data.item
ContactPersonService.getInstance().save(theoseNotFoundList)
fullList.push(...theoseNotFoundList)
}
} else if (user?.role === eRole.staff) {
const ret = await UserService.getInstance().userInfo({
addrs: notFoundList,
})
if (ret.code === 200) {
const theoseNotFoundList = ret.data
UserInfoDBService.getInstance().save(theoseNotFoundList)
fullList.push(...theoseNotFoundList)
}
}
}
return addressList.map((item) => {
const msg = fullList.find((i: any) => i?.addr === item)
return msg;
})
}
...@@ -37,7 +37,6 @@ enum MsgType { ...@@ -37,7 +37,6 @@ enum MsgType {
Card = 6; Card = 6;
Alert = 7; Alert = 7;
Forward = 8; Forward = 8;
FOO = 9;
} }
message CommonMsg { message CommonMsg {
...@@ -133,6 +132,7 @@ enum AlertType { ...@@ -133,6 +132,7 @@ enum AlertType {
UpdateGroupMutedAlert = 5; UpdateGroupMutedAlert = 5;
UpdateGroupMemberMutedAlert = 6; UpdateGroupMemberMutedAlert = 6;
UpdateGroupOwnerAlert = 7; UpdateGroupOwnerAlert = 7;
CommonMsg = 8;
} }
message AlertUpdateGroupName { message AlertUpdateGroupName {
......
...@@ -44,8 +44,6 @@ export default (data: Uint8Array): DecodedMessage | null => { ...@@ -44,8 +44,6 @@ export default (data: Uint8Array): DecodedMessage | null => {
case 6: case 6:
content = CardMsg.toObject(CardMsg.decode(commonMsg.msg || new Uint8Array())) content = CardMsg.toObject(CardMsg.decode(commonMsg.msg || new Uint8Array()))
break break
case 9:
content = TextMsg.toObject(TextMsg.decode(commonMsg.msg || new Uint8Array()))
default: default:
throw '解码消息时发现未知的消息类型:' + commonMsg.msgType throw '解码消息时发现未知的消息类型:' + commonMsg.msgType
} }
......
...@@ -55,11 +55,6 @@ export default (msg: ChatMessageEncoderArgs): Uint8Array => { ...@@ -55,11 +55,6 @@ export default (msg: ChatMessageEncoderArgs): Uint8Array => {
account: (msg.msg as dtalk.proto.CardMsg).account, account: (msg.msg as dtalk.proto.CardMsg).account,
}).finish() }).finish()
break break
case ChatMessageTypes.FOO:
content = dtalk.proto.TextMsg.encode({
content: (msg.msg as dtalk.proto.ITextMsg).content,
}).finish()
break
default: default:
throw '未知的消息类型:' + msg.msgType throw '未知的消息类型:' + msg.msgType
} }
......
...@@ -220,8 +220,7 @@ export namespace dtalk { ...@@ -220,8 +220,7 @@ export namespace dtalk {
File = 5, File = 5,
Card = 6, Card = 6,
Alert = 7, Alert = 7,
Forward = 8, Forward = 8
FOO = 9
} }
/** Properties of a CommonMsg. */ /** Properties of a CommonMsg. */
...@@ -1661,7 +1660,8 @@ export namespace dtalk { ...@@ -1661,7 +1660,8 @@ export namespace dtalk {
DeleteGroupAlert = 4, DeleteGroupAlert = 4,
UpdateGroupMutedAlert = 5, UpdateGroupMutedAlert = 5,
UpdateGroupMemberMutedAlert = 6, UpdateGroupMemberMutedAlert = 6,
UpdateGroupOwnerAlert = 7 UpdateGroupOwnerAlert = 7,
CommonMsg = 8
} }
/** Properties of an AlertUpdateGroupName. */ /** Properties of an AlertUpdateGroupName. */
...@@ -2462,6 +2462,102 @@ export namespace dtalk { ...@@ -2462,6 +2462,102 @@ export namespace dtalk {
public toJSON(): { [k: string]: any }; public toJSON(): { [k: string]: any };
} }
/** Properties of an AlertCommonMsg. */
interface IAlertCommonMsg {
/** AlertCommonMsg user */
user?: (string|null);
/** AlertCommonMsg staff */
staff?: (string|null);
}
/** Represents an AlertCommonMsg. */
class AlertCommonMsg implements IAlertCommonMsg {
/**
* Constructs a new AlertCommonMsg.
* @param [properties] Properties to set
*/
constructor(properties?: dtalk.proto.IAlertCommonMsg);
/** AlertCommonMsg user. */
public user: string;
/** AlertCommonMsg staff. */
public staff: string;
/**
* Creates a new AlertCommonMsg instance using the specified properties.
* @param [properties] Properties to set
* @returns AlertCommonMsg instance
*/
public static create(properties?: dtalk.proto.IAlertCommonMsg): dtalk.proto.AlertCommonMsg;
/**
* Encodes the specified AlertCommonMsg message. Does not implicitly {@link dtalk.proto.AlertCommonMsg.verify|verify} messages.
* @param message AlertCommonMsg message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
public static encode(message: dtalk.proto.IAlertCommonMsg, writer?: $protobuf.Writer): $protobuf.Writer;
/**
* Encodes the specified AlertCommonMsg message, length delimited. Does not implicitly {@link dtalk.proto.AlertCommonMsg.verify|verify} messages.
* @param message AlertCommonMsg message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
public static encodeDelimited(message: dtalk.proto.IAlertCommonMsg, writer?: $protobuf.Writer): $protobuf.Writer;
/**
* Decodes an AlertCommonMsg message from the specified reader or buffer.
* @param reader Reader or buffer to decode from
* @param [length] Message length if known beforehand
* @returns AlertCommonMsg
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): dtalk.proto.AlertCommonMsg;
/**
* Decodes an AlertCommonMsg message from the specified reader or buffer, length delimited.
* @param reader Reader or buffer to decode from
* @returns AlertCommonMsg
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): dtalk.proto.AlertCommonMsg;
/**
* Verifies an AlertCommonMsg message.
* @param message Plain object to verify
* @returns `null` if valid, otherwise the reason why it is not
*/
public static verify(message: { [k: string]: any }): (string|null);
/**
* Creates an AlertCommonMsg message from a plain object. Also converts values to their respective internal types.
* @param object Plain object
* @returns AlertCommonMsg
*/
public static fromObject(object: { [k: string]: any }): dtalk.proto.AlertCommonMsg;
/**
* Creates a plain object from an AlertCommonMsg message. Also converts values to other types if specified.
* @param message AlertCommonMsg
* @param [options] Conversion options
* @returns Plain object
*/
public static toObject(message: dtalk.proto.AlertCommonMsg, options?: $protobuf.IConversionOptions): { [k: string]: any };
/**
* Converts this AlertCommonMsg to JSON.
* @returns JSON object
*/
public toJSON(): { [k: string]: any };
}
/** Properties of a NotifyMsg. */ /** Properties of a NotifyMsg. */
interface INotifyMsg { interface INotifyMsg {
......
...@@ -528,7 +528,6 @@ export const dtalk = $root.dtalk = (() => { ...@@ -528,7 +528,6 @@ export const dtalk = $root.dtalk = (() => {
* @property {number} Card=6 Card value * @property {number} Card=6 Card value
* @property {number} Alert=7 Alert value * @property {number} Alert=7 Alert value
* @property {number} Forward=8 Forward value * @property {number} Forward=8 Forward value
* @property {number} FOO=9 FOO value
*/ */
proto.MsgType = (function() { proto.MsgType = (function() {
const valuesById = {}, values = Object.create(valuesById); const valuesById = {}, values = Object.create(valuesById);
...@@ -541,7 +540,6 @@ export const dtalk = $root.dtalk = (() => { ...@@ -541,7 +540,6 @@ export const dtalk = $root.dtalk = (() => {
values[valuesById[6] = "Card"] = 6; values[valuesById[6] = "Card"] = 6;
values[valuesById[7] = "Alert"] = 7; values[valuesById[7] = "Alert"] = 7;
values[valuesById[8] = "Forward"] = 8; values[valuesById[8] = "Forward"] = 8;
values[valuesById[9] = "FOO"] = 9;
return values; return values;
})(); })();
...@@ -3367,6 +3365,7 @@ export const dtalk = $root.dtalk = (() => { ...@@ -3367,6 +3365,7 @@ export const dtalk = $root.dtalk = (() => {
case 5: case 5:
case 6: case 6:
case 7: case 7:
case 8:
break; break;
} }
if (message.body != null && message.hasOwnProperty("body")) if (message.body != null && message.hasOwnProperty("body"))
...@@ -3420,6 +3419,10 @@ export const dtalk = $root.dtalk = (() => { ...@@ -3420,6 +3419,10 @@ export const dtalk = $root.dtalk = (() => {
case 7: case 7:
message.type = 7; message.type = 7;
break; break;
case "CommonMsg":
case 8:
message.type = 8;
break;
} }
if (object.body != null) if (object.body != null)
if (typeof object.body === "string") if (typeof object.body === "string")
...@@ -3992,6 +3995,7 @@ export const dtalk = $root.dtalk = (() => { ...@@ -3992,6 +3995,7 @@ export const dtalk = $root.dtalk = (() => {
* @property {number} UpdateGroupMutedAlert=5 UpdateGroupMutedAlert value * @property {number} UpdateGroupMutedAlert=5 UpdateGroupMutedAlert value
* @property {number} UpdateGroupMemberMutedAlert=6 UpdateGroupMemberMutedAlert value * @property {number} UpdateGroupMemberMutedAlert=6 UpdateGroupMemberMutedAlert value
* @property {number} UpdateGroupOwnerAlert=7 UpdateGroupOwnerAlert value * @property {number} UpdateGroupOwnerAlert=7 UpdateGroupOwnerAlert value
* @property {number} CommonMsg=8 CommonMsg value
*/ */
proto.AlertType = (function() { proto.AlertType = (function() {
const valuesById = {}, values = Object.create(valuesById); const valuesById = {}, values = Object.create(valuesById);
...@@ -4003,6 +4007,7 @@ export const dtalk = $root.dtalk = (() => { ...@@ -4003,6 +4007,7 @@ export const dtalk = $root.dtalk = (() => {
values[valuesById[5] = "UpdateGroupMutedAlert"] = 5; values[valuesById[5] = "UpdateGroupMutedAlert"] = 5;
values[valuesById[6] = "UpdateGroupMemberMutedAlert"] = 6; values[valuesById[6] = "UpdateGroupMemberMutedAlert"] = 6;
values[valuesById[7] = "UpdateGroupOwnerAlert"] = 7; values[valuesById[7] = "UpdateGroupOwnerAlert"] = 7;
values[valuesById[8] = "CommonMsg"] = 8;
return values; return values;
})(); })();
...@@ -5972,6 +5977,216 @@ export const dtalk = $root.dtalk = (() => { ...@@ -5972,6 +5977,216 @@ export const dtalk = $root.dtalk = (() => {
return AlertUpdateGroupOwner; return AlertUpdateGroupOwner;
})(); })();
proto.AlertCommonMsg = (function() {
/**
* Properties of an AlertCommonMsg.
* @memberof dtalk.proto
* @interface IAlertCommonMsg
* @property {string|null} [user] AlertCommonMsg user
* @property {string|null} [staff] AlertCommonMsg staff
*/
/**
* Constructs a new AlertCommonMsg.
* @memberof dtalk.proto
* @classdesc Represents an AlertCommonMsg.
* @implements IAlertCommonMsg
* @constructor
* @param {dtalk.proto.IAlertCommonMsg=} [properties] Properties to set
*/
function AlertCommonMsg(properties) {
if (properties)
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
}
/**
* AlertCommonMsg user.
* @member {string} user
* @memberof dtalk.proto.AlertCommonMsg
* @instance
*/
AlertCommonMsg.prototype.user = "";
/**
* AlertCommonMsg staff.
* @member {string} staff
* @memberof dtalk.proto.AlertCommonMsg
* @instance
*/
AlertCommonMsg.prototype.staff = "";
/**
* Creates a new AlertCommonMsg instance using the specified properties.
* @function create
* @memberof dtalk.proto.AlertCommonMsg
* @static
* @param {dtalk.proto.IAlertCommonMsg=} [properties] Properties to set
* @returns {dtalk.proto.AlertCommonMsg} AlertCommonMsg instance
*/
AlertCommonMsg.create = function create(properties) {
return new AlertCommonMsg(properties);
};
/**
* Encodes the specified AlertCommonMsg message. Does not implicitly {@link dtalk.proto.AlertCommonMsg.verify|verify} messages.
* @function encode
* @memberof dtalk.proto.AlertCommonMsg
* @static
* @param {dtalk.proto.IAlertCommonMsg} message AlertCommonMsg message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
AlertCommonMsg.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.user != null && Object.hasOwnProperty.call(message, "user"))
writer.uint32(/* id 1, wireType 2 =*/10).string(message.user);
if (message.staff != null && Object.hasOwnProperty.call(message, "staff"))
writer.uint32(/* id 2, wireType 2 =*/18).string(message.staff);
return writer;
};
/**
* Encodes the specified AlertCommonMsg message, length delimited. Does not implicitly {@link dtalk.proto.AlertCommonMsg.verify|verify} messages.
* @function encodeDelimited
* @memberof dtalk.proto.AlertCommonMsg
* @static
* @param {dtalk.proto.IAlertCommonMsg} message AlertCommonMsg message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
AlertCommonMsg.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes an AlertCommonMsg message from the specified reader or buffer.
* @function decode
* @memberof dtalk.proto.AlertCommonMsg
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {dtalk.proto.AlertCommonMsg} AlertCommonMsg
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
AlertCommonMsg.decode = function decode(reader, length) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
let end = length === undefined ? reader.len : reader.pos + length, message = new $root.dtalk.proto.AlertCommonMsg();
while (reader.pos < end) {
let tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.user = reader.string();
break;
case 2:
message.staff = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes an AlertCommonMsg message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof dtalk.proto.AlertCommonMsg
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {dtalk.proto.AlertCommonMsg} AlertCommonMsg
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
AlertCommonMsg.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies an AlertCommonMsg message.
* @function verify
* @memberof dtalk.proto.AlertCommonMsg
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
AlertCommonMsg.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.user != null && message.hasOwnProperty("user"))
if (!$util.isString(message.user))
return "user: string expected";
if (message.staff != null && message.hasOwnProperty("staff"))
if (!$util.isString(message.staff))
return "staff: string expected";
return null;
};
/**
* Creates an AlertCommonMsg message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof dtalk.proto.AlertCommonMsg
* @static
* @param {Object.<string,*>} object Plain object
* @returns {dtalk.proto.AlertCommonMsg} AlertCommonMsg
*/
AlertCommonMsg.fromObject = function fromObject(object) {
if (object instanceof $root.dtalk.proto.AlertCommonMsg)
return object;
let message = new $root.dtalk.proto.AlertCommonMsg();
if (object.user != null)
message.user = String(object.user);
if (object.staff != null)
message.staff = String(object.staff);
return message;
};
/**
* Creates a plain object from an AlertCommonMsg message. Also converts values to other types if specified.
* @function toObject
* @memberof dtalk.proto.AlertCommonMsg
* @static
* @param {dtalk.proto.AlertCommonMsg} message AlertCommonMsg
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
AlertCommonMsg.toObject = function toObject(message, options) {
if (!options)
options = {};
let object = {};
if (options.defaults) {
object.user = "";
object.staff = "";
}
if (message.user != null && message.hasOwnProperty("user"))
object.user = message.user;
if (message.staff != null && message.hasOwnProperty("staff"))
object.staff = message.staff;
return object;
};
/**
* Converts this AlertCommonMsg to JSON.
* @function toJSON
* @memberof dtalk.proto.AlertCommonMsg
* @instance
* @returns {Object.<string,*>} JSON object
*/
AlertCommonMsg.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
return AlertCommonMsg;
})();
proto.NotifyMsg = (function() { proto.NotifyMsg = (function() {
/** /**
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -10,11 +10,21 @@ ...@@ -10,11 +10,21 @@
<div class="flex flex-col flex-grow overflow-hidden" style="flex-basis: 0px"> <div class="flex flex-col flex-grow overflow-hidden" style="flex-basis: 0px">
<ChatContentVue /> <ChatContentVue />
<ServiceRating :setSelectedRate="handleSelect" :selected="selected" v-if="showServiceRating" /> <ServiceRating :setSelectedRate="handleSelect" :selected="selected" v-if="showServiceRating" />
<ChatOption <ChatOption>
:selected="selectedChatOption" <ChatOptionItemVue
:setSelected="handleSelectChatOption" v-if="isUser"
:list="optionList" :selected="questionSelected"
/> @click="handleClickQuestionOption"
value="常用问题"
/>
<ChatOptionItemVue
v-if="isUser"
:selected="serviceSelected"
:value="serviceShowValue"
@click="handleClickService"
/>
<ChatOptionItemVue :selected="false" value="电话联系" @click="handleClickCall" />
</ChatOption>
<ChatInputVue /> <ChatInputVue />
<CommonUseSentence <CommonUseSentence
class="transition-all h-0" class="transition-all h-0"
...@@ -24,6 +34,7 @@ ...@@ -24,6 +34,7 @@
:list="sentenceList" :list="sentenceList"
/> />
</div> </div>
<ShowCall :show="showCall" :phone="callPhone" @hidden="showCall = false" />
</div> </div>
</template> </template>
...@@ -41,7 +52,13 @@ import { v4 as uuidv4 } from 'uuid' ...@@ -41,7 +52,13 @@ import { v4 as uuidv4 } from 'uuid'
import { ChatMessageTypes } from "@/types/chatMessageTypes"; import { ChatMessageTypes } from "@/types/chatMessageTypes";
import { useRoute } from "vue-router"; import { useRoute } from "vue-router";
import { queryFaqAnswer, queryFaqList } from "@/service/FaqService"; import { queryFaqAnswer, queryFaqList } from "@/service/FaqService";
import { getDisplayNamesFromAddress } from "@/utils/displayName"; import { getDisplayNamesFromAddress, getMsgFromAddress } from "@/utils/displayName";
import { MessageContent } from "@/types/chat-message";
import { TRANSFER_HUMAN_1, TRANSFER_HUMAN_2 } from "@/config/chat";
import ChatOptionItemVue from "@/components/ChatOptions/ChatOptionItem.vue";
import ShowCall from "@/components/showCall/index.vue"
import { getUserMsg } from "@/utils/userMsg";
import { eRole } from "@/types/roleType";
export default defineComponent({ export default defineComponent({
...@@ -51,14 +68,63 @@ export default defineComponent({ ...@@ -51,14 +68,63 @@ export default defineComponent({
NavBar, NavBar,
ServiceRating: defineAsyncComponent(() => import(/* webpackChunkName: 'serviceRating' */ "@/components/ServiceRating/index.vue")), ServiceRating: defineAsyncComponent(() => import(/* webpackChunkName: 'serviceRating' */ "@/components/ServiceRating/index.vue")),
ChatOption: defineAsyncComponent(() => import(/* webpackChunkName: 'ChatOption' */"@/components/ChatOptions/index.vue")), ChatOption: defineAsyncComponent(() => import(/* webpackChunkName: 'ChatOption' */"@/components/ChatOptions/index.vue")),
CommonUseSentence: defineAsyncComponent(() => import(/* webpackChunkName: 'CommonUseSentence' */"@/components/CommonUseSentence/index.vue")) CommonUseSentence: defineAsyncComponent(() => import(/* webpackChunkName: 'CommonUseSentence' */"@/components/CommonUseSentence/index.vue")),
ChatOptionItemVue,
ShowCall
}, },
setup() { setup() {
const questionSelected = ref(false)
const handleClickQuestionOption = () => {
questionSelected.value = !questionSelected.value
}
watch(questionSelected, () => {
setShowSentences(questionSelected.value)
sentensesLoading.value = true;
questionSelected.value && queryFaqList().then(ret => {
if (ret.code === 200) {
sentenceList.value = ret.data.question;
}
sentensesLoading.value = false;
})
})
const serviceSelected = ref(false);
const serviceShowValue = ref('人工服务')
const handleClickService = () => {
const sendChatMessage = (payload: {
type: ChatMessageTypes;
content: MessageContent;
}) => {
messageStore.sendMessage({ type: payload.type, content: payload.content, target: route.query.targetId as string });
};
if (serviceShowValue.value === '人工服务') {
sendChatMessage({
type: ChatMessageTypes.Card,
content: {
bank: TRANSFER_HUMAN_1,
name: TRANSFER_HUMAN_2,
account: '',
} as MessageContent
})
serviceShowValue.value = '结束服务'
} else if (serviceShowValue.value === '结束服务') {
serviceShowValue.value = '人工服务'
sendChatMessage({
type: ChatMessageTypes.Card,
content: {
bank: '本次服务已结束',
name: '本次服务已结束',
account: '',
} as MessageContent
})
// showServiceRating.value = true;
}
}
const initError = ref(false); const initError = ref(false);
const showServiceRating = ref(false); const showServiceRating = ref(false);
const selected = ref(""); const selected = ref("");
const selectedChatOption = ref(NaN);
const showShortSentences = ref(false); const showShortSentences = ref(false);
const route = useRoute() const route = useRoute()
...@@ -67,38 +133,16 @@ export default defineComponent({ ...@@ -67,38 +133,16 @@ export default defineComponent({
const sentenceList = ref<any[]>([]) const sentenceList = ref<any[]>([])
const sentensesLoading = ref(false) const sentensesLoading = ref(false)
const optionList = [
{ name: '常用问题', id: 1 },
{ name: '人工服务', id: 2 },
{ name: '电话咨询', id: 3 },
];
const setShowSentences = (show: boolean) => const setShowSentences = (show: boolean) =>
(showShortSentences.value = show); (showShortSentences.value = show);
const handleSelect = (select: string) => (selected.value = select); const handleSelect = (select: string) => (selected.value = select);
const handleSelectChatOption = (select: number) => {
selectedChatOption.value = select
};
watch(selectedChatOption, () => {
if (selectedChatOption.value === 1) {
setShowSentences(true)
sentensesLoading.value = true;
queryFaqList().then(ret => {
if (ret.code === 200) {
sentenceList.value = ret.data.question;
}
sentensesLoading.value = false;
})
setShowSentences(true)
} else {
setShowSentences(false)
}
if (selectedChatOption.value === 3) {
} const handleClickCall = () => {
}) showCall.value = true;
}
const useSentence = (content: string) => { const useSentence = (content: string) => {
/* 问 */ /* 问 */
...@@ -153,6 +197,15 @@ export default defineComponent({ ...@@ -153,6 +197,15 @@ export default defineComponent({
onMounted(async () => { onMounted(async () => {
const list = await getDisplayNamesFromAddress([target]) const list = await getDisplayNamesFromAddress([target])
title.value = list[0]; title.value = list[0];
const ret = await getMsgFromAddress([target])
callPhone.value = ret[0].phone;
})
const showCall = ref(false)
const callPhone = ref('')
const isUser = computed(() => {
return getUserMsg()?.role === eRole.user
}) })
...@@ -162,13 +215,19 @@ export default defineComponent({ ...@@ -162,13 +215,19 @@ export default defineComponent({
handleSelect, handleSelect,
showServiceRating, showServiceRating,
showShortSentences, showShortSentences,
selectedChatOption,
handleSelectChatOption,
useSentence, useSentence,
sentenceList, sentenceList,
optionList,
sentensesLoading, sentensesLoading,
title title,
questionSelected,
handleClickQuestionOption,
serviceSelected,
serviceShowValue,
handleClickService,
handleClickCall,
showCall,
callPhone,
isUser
}; };
}, },
}); });
......
<template> <template>
<div> <div>
<div v-if="!hideDatetime" class="text-xs text-gray-400 text-center pb-2 pt-4">{{ time }}</div> <div v-if="!hideDatetime" class="text-xs text-gray-400 text-center pb-2 pt-4">{{ time }}</div>
<!-- 卡片消息 -->
<ChatContentMessageCardVue
v-if="type === 6"
:from-myself="fromMyself"
:content="content"
></ChatContentMessageCardVue>
<div <div
class="flex items-start flex-nowrap w-screen py-1.5" class="flex items-start flex-nowrap w-screen py-1.5"
:class="{ 'flex-row-reverse': fromMyself }" :class="{ 'flex-row-reverse': fromMyself }"
> >
<!-- 头像 --> <!-- 头像 -->
<q-avatar class="mx-4 min-w-chat-msg-avatar w-chat-msg-avatar h-chat-msg-avatar !rounded-md"> <q-avatar class="mx-4 min-w-chat-msg-avatar w-chat-msg-avatar h-chat-msg-avatar !rounded-md" v-if="type !== 6">
<img :src="default_avatar_url" /> <img :src="default_avatar_url" />
</q-avatar> </q-avatar>
...@@ -53,13 +59,7 @@ ...@@ -53,13 +59,7 @@
:uploadProgress="uploadProgress" :uploadProgress="uploadProgress"
/>--> />-->
<!-- 卡片消息 -->
<ChatContentMessageCardVue
v-else-if="type === 6"
:from-myself="fromMyself"
:content="content"
/>
<!-- 消息状态 --> <!-- 消息状态 -->
<div class="w-10 self-stretch flex flex-row justify-center items-center"> <div class="w-10 self-stretch flex flex-row justify-center items-center">
<!-- 发送失败 --> <!-- 发送失败 -->
......
<template> <template>
<div :class="fromMyself ? 'bg-secondary' : 'bg-white'" class="w-full h-24 rounded-md font-medium"> <div class="w-full rounded-md font-medium flex items-center">
<div class="py-3 px-3 flex items-center enable-touch"> <div class="flex-grow border-b mr-1 ml-2"></div>
<q-icon :name="'img:' + iconUrl" size="28px" class="mr-1" /> {{ content.bank }} <div class="text-center" v-if="isUser">{{ content?.bank }}</div>
</div> <div class="text-center" v-else>{{ content?.name }}</div>
<div class="pb-3 px-2 flex flex-nowrap justify-between text-base break-all enable-touch"> <div class="flex-grow border-b ml-1 mr-2"></div>
<div>{{ content.name }}</div>
<div>{{ content.account }}</div>
</div>
</div> </div>
</template> </template>
<script lang="ts"> <script lang="ts">
import { defineComponent } from 'vue' import { defineComponent, PropType } from 'vue'
import iconUrl from '@/assets/message_bank_card.png' import iconUrl from '@/assets/message_bank_card.png'
import { getUserMsg } from '@/utils/userMsg'
import { eRole } from '@/types/roleType'
export default defineComponent({ export default defineComponent({
props: { fromMyself: Boolean, content: Object }, props: {
fromMyself: Boolean,
content: Object as PropType<{ bank: string, name: string, account: string }>
},
setup() { setup() {
return { iconUrl } const isUser = getUserMsg()?.role === eRole.user
return { iconUrl, isUser }
}, },
}) })
</script> </script>
...@@ -6,9 +6,7 @@ ...@@ -6,9 +6,7 @@
@click="inputType === 1 ? (inputType = 2) : (inputType = 1)" @click="inputType === 1 ? (inputType = 2) : (inputType = 1)"
class="w-7 h-7 mx-2.5 text-center select-none focus:outline-none" class="w-7 h-7 mx-2.5 text-center select-none focus:outline-none"
> >
<i v-if="inputType === 1" class="iconfont text-primary text-xl" <i v-if="inputType === 1" class="iconfont text-primary text-xl">&#xe604;</i>
>&#xe604;</i
>
<i v-else class="iconfont text-primary text-xl">&#xe60d;</i> <i v-else class="iconfont text-primary text-xl">&#xe60d;</i>
</button> </button>
...@@ -20,7 +18,7 @@ ...@@ -20,7 +18,7 @@
/> />
<!-- 没有输入文字,显示 `加号` 按钮 --> <!-- 没有输入文字,显示 `加号` 按钮 -->
<!-- v-if="!inputText" --> <!-- v-if="!inputText" -->
<button <button
v-if="false" v-if="false"
@click="showMenu ? (showMenu = false) : (showMenu = true)" @click="showMenu ? (showMenu = false) : (showMenu = true)"
...@@ -31,30 +29,14 @@ ...@@ -31,30 +29,14 @@
<!-- 有输入文字,显示 `发送` 按钮 --> <!-- 有输入文字,显示 `发送` 按钮 -->
<button <button
v-else v-else
@click="inputText.trim().length !== 0 &&sendChatMessage({ type: 9, content: { content: inputText } })" @click="inputText.trim().length !== 0 && sendChatMessage({ type: 1, content: { content: inputText } })"
class=" class="mx-2.5 px-4 py-1.5 flex items-center rounded-md text-center select-none focus:outline-none text-app-white"
mx-2.5
px-4
py-1.5
flex
items-center
rounded-md
text-center
select-none
focus:outline-none
text-app-white
"
style="background: rgb(7, 193, 99)" style="background: rgb(7, 193, 99)"
> >发送</button>
发送
</button>
</div> </div>
<!-- input menu --> <!-- input menu -->
<div <div v-show="showMenu" class="min-h-input-menu flex items-center px-8 text-sm text-subtle">
v-show="showMenu"
class="min-h-input-menu flex items-center px-8 text-sm text-subtle"
>
<ChatInputAlbumVue /> <ChatInputAlbumVue />
<!-- <ChatInputCameraVue /> --> <!-- <ChatInputCameraVue /> -->
</div> </div>
...@@ -104,7 +86,7 @@ export default defineComponent({ ...@@ -104,7 +86,7 @@ export default defineComponent({
type: ChatMessageTypes; type: ChatMessageTypes;
content: MessageContent; content: MessageContent;
}) => { }) => {
messageStore.sendMessage({type: payload.type, content: payload.content, target: route.query.targetId as string}); messageStore.sendMessage({ type: payload.type, content: payload.content, target: route.query.targetId as string });
textInputStore.clearTextMessage(); textInputStore.clearTextMessage();
}; };
......
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