message-custom.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. <template>
  2. <div class="custom" style="font-size: 14px">
  3. <!-- 发送联系方式 -->
  4. <template v-if="isCustom.businessID === CHAT_MSG_CUSTOM_TYPE.PHONE">
  5. <div class="phone">
  6. <img
  7. src="https://qcloudimg.tencent-cloud.cn/trisys/assets/product/images/SOOZNXCHkHcm50wX2ndp4.png"
  8. style="width: 50px; height: 50px; border-radius: 10px"
  9. />
  10. <div style="margin-left: 10px; line-height: 30px">
  11. <p>{{ isCustom.title }}</p>
  12. <p id="copyPhone">{{ isCustom.iphone }}</p>
  13. </div>
  14. </div>
  15. <div class="xian"></div>
  16. <div class="phone_footer">
  17. <span> <a :href="`tel:` + isCustom.iphone" ref="telPhone">拨号</a></span>
  18. <span>复制</span>
  19. <!-- <span @tap="PhoneChange('2', isCustom)"> 发短信</span> -->
  20. </div>
  21. </template>
  22. <!-- 面试邀请 -->
  23. <template v-else-if="isCustom.businessID === CHAT_MSG_CUSTOM_TYPE.ORDER">
  24. <div class="order">
  25. <div class="header">
  26. <img :src="isCustom.imageUrl" />
  27. <div class="main">
  28. <h1>您已发起面试邀请</h1>
  29. <span>云赋能网络信息有限公司</span>
  30. </div>
  31. </div>
  32. <div class="xian"></div>
  33. <div class="contont">
  34. <div>
  35. <p class="title">面试时间</p>
  36. <p class="value">{{ isCustom.interviewtime }}</p>
  37. </div>
  38. <div>
  39. <p class="title">面试地点</p>
  40. <p class="value">{{ isCustom.Interviewlocation }}</p>
  41. </div>
  42. <div>
  43. <p class="title">联系方式</p>
  44. <p class="value">{{ isCustom.name }}{{ isCustom.iphone }}</p>
  45. </div>
  46. </div>
  47. <div class="xian"></div>
  48. <div class="phone_footer">
  49. <span style="color: #04c4ab">信息费:4HC</span>
  50. <span>等待接受</span>
  51. <!-- <span v-else style="color: #0776eb" @click="AcceptInvitation">接受邀请</span> -->
  52. <!-- <span @tap="PhoneChange('2', isCustom)"> 发短信</span> -->
  53. </div>
  54. </div>
  55. </template>
  56. <template v-else>
  57. <span v-html="content.custom" />
  58. </template>
  59. </div>
  60. </template>
  61. <script lang="ts" setup>
  62. import { watchEffect, ref } from "../../../../adapter-vue";
  63. import { TUITranslateService, IMessageModel } from "@tencentcloud/chat-uikit-engine";
  64. import { isUrl, JSONToObject } from "../../../../utils/index";
  65. import { CHAT_MSG_CUSTOM_TYPE } from "../../../../constant";
  66. import { ICustomMessagePayload } from "../../../../interface";
  67. import Icon from "../../../common/Icon.vue";
  68. import star from "../../../../assets/icon/star-light.png";
  69. interface Props {
  70. messageItem: IMessageModel;
  71. content: any;
  72. }
  73. const props = withDefaults(defineProps<Props>(), {
  74. messageItem: undefined,
  75. content: undefined,
  76. });
  77. const userType = ref(uni.getStorageSync("userId").includes("A"));
  78. console.log("1123123", userType);
  79. const custom = ref();
  80. const message = ref<IMessageModel>();
  81. const extension = ref();
  82. const isCustom = ref<ICustomMessagePayload>({
  83. businessID: "",
  84. });
  85. const copyPhone = ref();
  86. const PhoneChange = (index, record) => {
  87. if (index == "1") {
  88. //拨号
  89. } else if (index == "2") {
  90. //发短信
  91. } else if (index == "3") {
  92. var text = isCustom.value.iphone;
  93. copyTo(text); //把要复制的内容传入到copyTo方法
  94. }
  95. };
  96. function copyTo(content) {
  97. var oInput = document.createElement("input"); //创建一个input
  98. oInput.value = content; //给要复制的内容赋值input的value
  99. document.body.appendChild(oInput); //body中添加input
  100. oInput.select(); // 选择对象 .select()获取文本域中的内容
  101. document.execCommand("Copy"); // 执行浏览器复制命令
  102. oInput.style.display = "none"; // 把input隐藏
  103. uni.showToast({
  104. title: "复制成功",
  105. });
  106. }
  107. const AcceptInvitation = () => {
  108. //普通用户接受邀请
  109. };
  110. watchEffect(() => {
  111. custom.value = props.content;
  112. message.value = props.messageItem;
  113. const { payload } = props.messageItem;
  114. isCustom.value = payload.data || "";
  115. isCustom.value = JSONToObject(payload.data);
  116. if (payload.data === CHAT_MSG_CUSTOM_TYPE.SERVICE) {
  117. extension.value = JSONToObject(payload.extension);
  118. }
  119. });
  120. const openLink = (url: any) => {
  121. window.open(url);
  122. };
  123. </script>
  124. <style lang="scss" scoped>
  125. @import "../../../../assets/styles/common";
  126. .phone {
  127. min-width: 180px;
  128. height: 65px;
  129. border-radius: 10px;
  130. display: flex;
  131. flex-direction: row;
  132. align-items: center;
  133. justify-content: center;
  134. padding: 2px;
  135. }
  136. .xian {
  137. width: 408rpx;
  138. height: 1rpx;
  139. background: #000000;
  140. opacity: 0.1;
  141. }
  142. .phone_footer {
  143. display: flex;
  144. flex-direction: row;
  145. justify-content: space-around;
  146. position: relative;
  147. top: 8px;
  148. height: 25px;
  149. align-items: center;
  150. }
  151. a {
  152. color: #00b693;
  153. }
  154. .custom {
  155. font-size: 14px;
  156. h1 {
  157. font-size: 14px;
  158. color: #000;
  159. }
  160. h1,
  161. a,
  162. p {
  163. font-size: 14px;
  164. }
  165. .evaluate {
  166. ul {
  167. display: flex;
  168. padding: 10px 0;
  169. }
  170. &-list {
  171. display: flex;
  172. flex-direction: row;
  173. &-item {
  174. padding: 0 2px;
  175. }
  176. }
  177. }
  178. .order {
  179. display: flex;
  180. min-height: 250px;
  181. min-width: 215px;
  182. flex-direction: column;
  183. padding: 5px;
  184. .header {
  185. width: 100%;
  186. height: 55px;
  187. display: flex;
  188. flex-direction: row;
  189. justify-content: space-between;
  190. }
  191. .contont {
  192. display: flex;
  193. flex-direction: column;
  194. justify-content: space-around;
  195. align-items: flex-start;
  196. height: 190px;
  197. .title {
  198. font-family: PingFang SC;
  199. font-weight: 500;
  200. font-size: 26rpx;
  201. color: #a1a1a1;
  202. line-height: 44rpx;
  203. }
  204. .value {
  205. font-family: PingFang SC;
  206. font-weight: 500;
  207. font-size: 30rpx;
  208. color: #666666;
  209. line-height: 44rpx;
  210. }
  211. }
  212. .main {
  213. padding-left: 5px;
  214. width: 90%;
  215. line-height: 25px;
  216. }
  217. img {
  218. width: 45px;
  219. height: 45px;
  220. }
  221. }
  222. }
  223. </style>