123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- <template>
- <ToolbarItemContainer
- ref="container"
- :iconFile="evaluateIcon"
- title="打电话"
- :needBottomPopup="true"
- :iconWidth="isUniFrameWork ? '26px' : '20px'"
- :iconHeight="isUniFrameWork ? '26px' : '20px'"
- @onDialogShow="onDialogShow"
- @onDialogClose="onDialogClose"
- >
- <div :class="['evaluate', !isPC && 'evaluate-h5']">
- <div :class="['evaluate-content-button', !isPC && 'evaluate-h5-content-button']">
- <button
- :class="['btn', isEvaluateValid ? 'btn-valid' : 'btn-invalid']"
- @click="submitEvaluate"
- >
- {{ TUITranslateService.t("发送手机号") }}
- </button>
- </div>
- </div>
- </ToolbarItemContainer>
- </template>
- <script setup lang="ts">
- import {
- TUITranslateService,
- TUIStore,
- StoreName,
- IConversationModel,
- TUIChatService,
- SendMessageParams,
- } from "@tencentcloud/chat-uikit-engine";
- import { ref, computed } from "../../../../adapter-vue";
- import ToolbarItemContainer from "../toolbar-item-container/index.vue";
- import evaluateIcon from "../../../../assets/icon/evaluate.svg";
- import Link from "../../../../utils/documentLink";
- import Icon from "../../../common/Icon.vue";
- import starIcon from "../../../../assets/icon/star.png";
- import starLightIcon from "../../../../assets/icon/star-light.png";
- import { CHAT_MSG_CUSTOM_TYPE } from "../../../../constant";
- import { isPC, isH5, isUniFrameWork } from "../../../../utils/env";
- import { isEnabledMessageReadReceiptGlobal } from "../../utils/utils";
- import { createOfflinePushInfo } from "../../utils/sendMessage";
- const props = defineProps({
- starTotal: {
- type: Number,
- default: 5,
- },
- });
- const emits = defineEmits(["onDialogPopupShowOrHide"]);
- const container = ref();
- const starList = ref<number>(props.starTotal);
- const currentStarIndex = ref<number>(-1);
- const comment = ref("");
- const currentConversation = ref<IConversationModel>();
- TUIStore.watch(StoreName.CONV, {
- currentConversation: (conversation: IConversationModel) => {
- currentConversation.value = conversation;
- },
- });
- const isEvaluateValid = computed(
- () => comment.value.length || currentStarIndex.value >= 0
- );
- const onDialogShow = () => {
- emits("onDialogPopupShowOrHide", true);
- };
- const onDialogClose = () => {
- resetEvaluate();
- emits("onDialogPopupShowOrHide", false);
- };
- const openLink = () => {
- if (isPC || isH5) {
- window.open(Link?.customMessage?.url);
- }
- };
- const closeDialog = () => {
- container?.value?.toggleDialogDisplay(false);
- };
- const resetEvaluate = () => {
- currentStarIndex.value = -1;
- comment.value = "";
- };
- const selectStar = (starIndex?: any) => {
- if (currentStarIndex.value === starIndex) {
- currentStarIndex.value = currentStarIndex.value - 1;
- } else {
- currentStarIndex.value = starIndex;
- }
- };
- const submitEvaluate = () => {
- let promise = TUIChatService.sendCustomMessage({
- payload: {
- data: JSON.stringify({
- businessID: "phone",
- title: "用户名称的手机号",
- iphone: "18790411793",
-
- }),
- description: "",
- extension: "",
- },
- });
- container?.value?.toggleDialogDisplay(false);
- };
- </script>
- <style scoped lang="scss" src="../../style/index.scss"></style>
|