message-custom.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  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. >咨询奖励</span
  15. >
  16. <span style="font-weight: 400; font-size: 36rpx; color: #cd2121">
  17. ¥5</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 style="color: #04c4ab">信息费:4HC</span>
  72. <span>等待接受</span>
  73. </div>
  74. </div>
  75. </template>
  76. <template v-else>
  77. <span v-html="content.custom" ></span>
  78. </template>
  79. </div>
  80. </template>
  81. <script lang="ts" setup>
  82. import { watchEffect, ref } from "../../../../adapter-vue";
  83. import {
  84. TUITranslateService,
  85. IMessageModel,
  86. } from "@tencentcloud/chat-uikit-engine";
  87. import { isUrl, JSONToObject } from "../../../../utils/index";
  88. import { CHAT_MSG_CUSTOM_TYPE } from "../../../../constant";
  89. import { ICustomMessagePayload } from "../../../../interface";
  90. import Icon from "../../../common/Icon.vue";
  91. import star from "../../../../assets/icon/star-light.png";
  92. interface Props {
  93. messageItem: IMessageModel;
  94. content: any;
  95. }
  96. const props = withDefaults(defineProps<Props>(), {
  97. messageItem: undefined,
  98. content: undefined,
  99. });
  100. const userType = ref(uni.getStorageSync("userId").includes("A"));
  101. console.log("1123123", userType);
  102. const custom = ref();
  103. const message = ref<IMessageModel>();
  104. const extension = ref();
  105. const isCustom = ref<ICustomMessagePayload>({
  106. businessID: "",
  107. });
  108. const copyPhone = ref();
  109. const PhoneChange = (index, record) => {
  110. if (index == "1") {
  111. //拨号
  112. } else if (index == "2") {
  113. //发短信
  114. } else if (index == "3") {
  115. var text = isCustom.value.iphone;
  116. copyTo(text); //把要复制的内容传入到copyTo方法
  117. }
  118. };
  119. function copyTo(content) {
  120. var oInput = document.createElement("input"); //创建一个input
  121. oInput.value = content; //给要复制的内容赋值input的value
  122. document.body.appendChild(oInput); //body中添加input
  123. oInput.select(); // 选择对象 .select()获取文本域中的内容
  124. document.execCommand("Copy"); // 执行浏览器复制命令
  125. oInput.style.display = "none"; // 把input隐藏
  126. uni.showToast({
  127. title: "复制成功",
  128. });
  129. }
  130. const AcceptInvitation = () => {
  131. //普通用户接受邀请
  132. };
  133. watchEffect(() => {
  134. custom.value = props.content;
  135. message.value = props.messageItem;
  136. const { payload } = props.messageItem;
  137. isCustom.value = payload.data || "";
  138. isCustom.value = JSONToObject(payload.data);
  139. if (payload.data === CHAT_MSG_CUSTOM_TYPE.SERVICE) {
  140. extension.value = JSONToObject(payload.extension);
  141. }
  142. });
  143. const openLink = (url: any) => {
  144. window.open(url);
  145. };
  146. </script>
  147. <style lang="scss" scoped>
  148. @import "../../../../assets/styles/common";
  149. .Consultation {
  150. padding: 15px 10px 15px 10px;
  151. width: 200px;
  152. height: 74px;
  153. background: linear-gradient(180deg, #ffdeb2 0%, #ffecc7 100%);
  154. border-radius: 16rpx;
  155. .contont {
  156. display: flex;
  157. flex-direction: row;
  158. align-items: center;
  159. }
  160. .tips {
  161. font-size: 12px;
  162. margin-top: 10px;
  163. color: #666666;
  164. }
  165. }
  166. ::v-deep .message-body-content {
  167. background: transparent !important;
  168. }
  169. .phone {
  170. min-width: 180px;
  171. height: 65px;
  172. border-radius: 10px;
  173. display: flex;
  174. flex-direction: row;
  175. align-items: center;
  176. justify-content: center;
  177. padding: 2px;
  178. }
  179. .xian {
  180. width: 408rpx;
  181. height: 1rpx;
  182. background: #000000;
  183. opacity: 0.1;
  184. }
  185. .phone_footer {
  186. display: flex;
  187. flex-direction: row;
  188. justify-content: space-around;
  189. position: relative;
  190. top: 8px;
  191. height: 25px;
  192. align-items: center;
  193. }
  194. a {
  195. color: #00b693;
  196. }
  197. .custom {
  198. font-size: 14px;
  199. h1 {
  200. font-size: 14px;
  201. color: #000;
  202. }
  203. h1,
  204. a,
  205. p {
  206. font-size: 14px;
  207. }
  208. .evaluate {
  209. ul {
  210. display: flex;
  211. padding: 10px 0;
  212. }
  213. &-list {
  214. display: flex;
  215. flex-direction: row;
  216. &-item {
  217. padding: 0 2px;
  218. }
  219. }
  220. }
  221. .order {
  222. display: flex;
  223. min-height: 250px;
  224. min-width: 215px;
  225. flex-direction: column;
  226. padding: 5px;
  227. .header {
  228. width: 100%;
  229. height: 55px;
  230. display: flex;
  231. flex-direction: row;
  232. justify-content: space-between;
  233. }
  234. .contont {
  235. display: flex;
  236. flex-direction: column;
  237. justify-content: space-around;
  238. align-items: flex-start;
  239. height: 190px;
  240. .title {
  241. font-family: PingFang SC;
  242. font-weight: 500;
  243. font-size: 26rpx;
  244. color: #a1a1a1;
  245. line-height: 44rpx;
  246. }
  247. .value {
  248. font-family: PingFang SC;
  249. font-weight: 500;
  250. font-size: 30rpx;
  251. color: #666666;
  252. line-height: 44rpx;
  253. }
  254. }
  255. .main {
  256. padding-left: 5px;
  257. width: 90%;
  258. line-height: 25px;
  259. }
  260. img {
  261. width: 45px;
  262. height: 45px;
  263. }
  264. }
  265. }
  266. </style>