index.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <template>
  2. <ToolbarItemContainer
  3. ref="container"
  4. :iconFile="evaluateIcon"
  5. title="面试邀请"
  6. :needBottomPopup="true"
  7. :iconWidth="isUniFrameWork ? '26px' : '20px'"
  8. :iconHeight="isUniFrameWork ? '26px' : '20px'"
  9. @onDialogShow="onDialogShow"
  10. @onDialogClose="onDialogClose"
  11. >
  12. <div :class="['evaluate', !isPC && 'evaluate-h5']">
  13. <div :class="['evaluate-header', !isPC && 'evaluate-h5-header']">
  14. <div
  15. :class="[
  16. 'evaluate-header-content',
  17. !isPC && 'evaluate-h5-header-content',
  18. ]"
  19. >
  20. {{ TUITranslateService.t("发送面试邀请") }}
  21. </div>
  22. <div
  23. v-if="!isPC"
  24. :class="[
  25. 'evaluate-header-close',
  26. !isPC && 'evaluate-h5-header-close',
  27. ]"
  28. @click.stop="closeDialog"
  29. >
  30. {{ TUITranslateService.t("关闭") }}
  31. </div>
  32. </div>
  33. <div :class="['evaluate-content', !isPC && 'evaluate-h5-content']">
  34. <picker
  35. class="picker"
  36. style="
  37. height: 40px;
  38. width: 94%;
  39. background: #f8f8f8;
  40. text-align: left;
  41. line-height: 39px;
  42. padding: 0px 11px;
  43. "
  44. mode="date"
  45. :value="date"
  46. @change="bindDateChange"
  47. >
  48. <view class="uni-input">{{ date ? date : "请选择面试时间" }}</view>
  49. </picker>
  50. <textarea
  51. v-model="comment"
  52. placeholder="请输入面试地址"
  53. :class="[
  54. 'evaluate-content-text',
  55. !isPC && 'evaluate-h5-content-text',
  56. ]"
  57. />
  58. <input
  59. style="
  60. height: 40px;
  61. width: 94%;
  62. background: #f8f8f8;
  63. text-align: left;
  64. line-height: 39px;
  65. padding: 0px 11px;
  66. margin-bottom: 20px;
  67. "
  68. @input="replaceInput"
  69. :value="inpvalue"
  70. focus
  71. placeholder="联系电话"
  72. />
  73. <div
  74. :class="[
  75. 'evaluate-content-button',
  76. !isPC && 'evaluate-h5-content-button',
  77. ]"
  78. >
  79. <button
  80. :class="['btn', isEvaluateValid ? 'btn-valid' : 'btn-invalid']"
  81. @click="submitEvaluate"
  82. >
  83. {{ TUITranslateService.t("发送邀请") }}
  84. </button>
  85. </div>
  86. </div>
  87. </div>
  88. </ToolbarItemContainer>
  89. </template>
  90. <script setup lang="ts">
  91. import {
  92. TUITranslateService,
  93. TUIStore,
  94. StoreName,
  95. IConversationModel,
  96. TUIChatService,
  97. SendMessageParams,
  98. } from "@tencentcloud/chat-uikit-engine";
  99. import { ref, computed } from "../../../../adapter-vue";
  100. import ToolbarItemContainer from "../toolbar-item-container/index.vue";
  101. import evaluateIcon from "../../../../assets/icon/evaluate.svg";
  102. import Link from "../../../../utils/documentLink";
  103. import { isPC, isH5, isUniFrameWork } from "../../../../utils/env";
  104. const date = ref("");
  105. const inpvalue = ref("");
  106. const props = defineProps({
  107. starTotal: {
  108. type: Number,
  109. default: 5,
  110. },
  111. });
  112. const emits = defineEmits(["onDialogPopupShowOrHide"]);
  113. const container = ref();
  114. const starList = ref<number>(props.starTotal);
  115. const currentStarIndex = ref<number>(-1);
  116. const comment = ref("");
  117. const currentConversation = ref<IConversationModel>();
  118. TUIStore.watch(StoreName.CONV, {
  119. currentConversation: (conversation: IConversationModel) => {
  120. currentConversation.value = conversation;
  121. },
  122. });
  123. const isEvaluateValid = computed(
  124. () => comment.value.length || currentStarIndex.value >= 0
  125. );
  126. const bindDateChange = (e) => {
  127. date.value = e.detail.value;
  128. };
  129. const replaceInput = (e) => {
  130. inpvalue.value = e.detail.value;
  131. };
  132. const onDialogShow = () => {
  133. emits("onDialogPopupShowOrHide", true);
  134. };
  135. const onDialogClose = () => {
  136. resetEvaluate();
  137. emits("onDialogPopupShowOrHide", false);
  138. };
  139. const openLink = () => {
  140. if (isPC || isH5) {
  141. window.open(Link?.customMessage?.url);
  142. }
  143. };
  144. const closeDialog = () => {
  145. container?.value?.toggleDialogDisplay(false);
  146. };
  147. const resetEvaluate = () => {
  148. currentStarIndex.value = -1;
  149. comment.value = "";
  150. };
  151. const selectStar = (starIndex?: any) => {
  152. if (currentStarIndex.value === starIndex) {
  153. currentStarIndex.value = currentStarIndex.value - 1;
  154. } else {
  155. currentStarIndex.value = starIndex;
  156. }
  157. };
  158. const submitEvaluate = () => {
  159. // 评价消息,星星数和文本必须有一个才可以提交
  160. if (currentStarIndex.value < 0 && !comment.value.length) {
  161. return;
  162. }
  163. console.log("1231231", date.value);
  164. let promise = TUIChatService.sendCustomMessage({
  165. payload: {
  166. data: JSON.stringify({
  167. // 订单类消息标识字段
  168. businessID: "order",
  169. // 订单标题
  170. companyname: "云赋能网络信息有限公司",
  171. interviewtime: date.value, //面试时间
  172. Interviewlocation: comment.value, //面试地点
  173. iphone: inpvalue.value, //联系方式
  174. name: "王希望", //联系人
  175. imageUrl:
  176. "https://qcloudimg.tencent-cloud.cn/trisys/assets/product/images/SOOZNXCHkHcm50wX2ndp4.png",
  177. }),
  178. description: "",
  179. extension: "",
  180. },
  181. });
  182. // const options = {
  183. // to:
  184. // currentConversation?.value?.groupProfile?.groupID
  185. // || currentConversation?.value?.userProfile?.userID,
  186. // conversationType: currentConversation?.value?.type,
  187. // payload: {
  188. // data: JSON.stringify({
  189. // businessID: CHAT_MSG_CUSTOM_TYPE.EVALUATE,
  190. // version: 1,
  191. // score: currentStarIndex.value + 1,
  192. // comment: comment.value,
  193. // }),
  194. // description: '对本次的服务评价',
  195. // extension: '对本次的服务评价',
  196. // },
  197. // needReadReceipt: isEnabledMessageReadReceiptGlobal(),
  198. // };
  199. // const sendMessageOptions: any = {
  200. // offlinePushInfo: createOfflinePushInfo(currentConversation),
  201. // };
  202. // TUIChatService.sendCustomMessage(options as SendMessageParams, sendMessageOptions);
  203. // 提交后关闭 dialog
  204. // close dialog after submit evaluate
  205. container?.value?.toggleDialogDisplay(false);
  206. };
  207. </script>
  208. <style scoped lang="scss" src="./style/index.scss"></style>