message-custom.vue 6.8 KB

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