connectUs.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. <template>
  2. <div :class="{connectUs: !mobile, connectUsMobile: mobile}">
  3. <div class="toastBox" v-if="isShowToast">
  4. <div class="toastArea">
  5. <div class="title">行业解决方案专属客服</div>
  6. <div class="tips">填写联系方式 立即与专属客服进行沟通</div>
  7. <div class="nameCell">
  8. <p class="label">联系人</p>
  9. <input type="text" v-model="name" maxlength="10">
  10. </div>
  11. <div class="phoneCell">
  12. <p class="label">电话</p>
  13. <input type="number" v-model="phone" oninput="if(value.length>5)value=value.slice(0,11)">
  14. </div>
  15. <div class="submitBtn" @click="handleSubmit">
  16. <p>提 交</p>
  17. </div>
  18. <div class="closeIcon" @click="close"/>
  19. </div>
  20. </div>
  21. </div>
  22. </template>
  23. <script>
  24. export default {
  25. props: ["source", "isShowToast", "sourceId"],
  26. components: {},
  27. data() {
  28. return {
  29. name: "",
  30. phone: "",
  31. mobile: this.$deviceType.isMobile()
  32. };
  33. },
  34. computed: {},
  35. mounted() {
  36. const {realname = '', login_mobile = '', mobile=''} = this.$store.state.userinfo || {}
  37. this.name = realname
  38. this.phone = login_mobile || mobile
  39. },
  40. methods: {
  41. close() {
  42. this.$emit('close')
  43. },
  44. handleSubmit() {
  45. if (!this.name || !this.phone || this.phone.length < 6) {
  46. return this.$message.error('请填写完整的信息')
  47. }
  48. const UA = ['Mobile 浏览器', 'PC 浏览器', 'Android', 'IOS']
  49. let agent = 'PC 浏览器'
  50. if (this.$deviceType.android) {
  51. agent = 'Android'
  52. } else if (this.$deviceType.ios) {
  53. agent = 'IOS'
  54. } else if (this.$deviceType.isMobile()) {
  55. agent = 'Mobile 浏览器'
  56. }
  57. const { name, phone, source, sourceId } = this
  58. let p = {
  59. name, phone, from: source, agent
  60. }
  61. if (sourceId) {
  62. p.id = sourceId
  63. }
  64. this.$axios.$post('/api/user/create_not_login_user', p).then(res => {
  65. this.$message.success(res.info || '提交成功')
  66. this.$emit('close')
  67. if (res.status === 1) {
  68. this.name = ''
  69. this.phone = ''
  70. }
  71. }).catch(e => {
  72. this.$message.error('提交失败,请重试!')
  73. })
  74. }
  75. }
  76. };
  77. </script>
  78. <style lang="scss">
  79. @import "~@/assets/css/scssCommon.scss";
  80. .connectUs {
  81. .toastBox {
  82. position: fixed;
  83. width: 100vw;
  84. height: 100vh;
  85. background-color: rgba(0, 0, 0, 0.8);
  86. z-index: 888;
  87. left: 0;
  88. top: 0;
  89. display: flex;
  90. justify-content: center;
  91. align-items: center;
  92. .toastArea {
  93. position: relative;
  94. width: 446px;
  95. height: 403px;
  96. background: rgba(255, 255, 255, 1);
  97. border-radius: 3px;
  98. padding: 30px 47px;
  99. .title {
  100. font-size: 19px;
  101. font-weight: 500;
  102. color: rgba(34, 34, 34, 1);
  103. line-height: 26px;
  104. text-align: center;
  105. }
  106. .tips {
  107. margin-top: 8px;
  108. margin-bottom: 14px;
  109. font-size: 12px;
  110. font-weight: 400;
  111. color: rgba(153, 153, 153, 1);
  112. line-height: 17px;
  113. text-align: center;
  114. }
  115. .nameCell, .phoneCell {
  116. margin-top: 25px;
  117. .label {
  118. font-size: 14px;
  119. font-weight: 500;
  120. color: rgba(25, 34, 46, 1);
  121. line-height: 20px;
  122. }
  123. input {
  124. margin-top: 5px;
  125. padding: 10px;
  126. width: 352px;
  127. height: 48px;
  128. background: rgba(255, 255, 255, 1);
  129. border-radius: 3px;
  130. border: 1px solid rgba(221, 225, 230, 1);
  131. }
  132. }
  133. .nameCell {
  134. margin-top: 39px;
  135. }
  136. .submitBtn {
  137. margin-top: 18px;
  138. width: 352px;
  139. height: 48px;
  140. background: rgba(48, 142, 255, 1);
  141. box-shadow: 0 2px 6px 0 rgba(48, 142, 255, 0.3);
  142. border-radius: 2px;
  143. display: flex;
  144. justify-content: center;
  145. align-items: center;
  146. cursor: pointer;
  147. p {
  148. font-size: 14px;
  149. font-weight: 500;
  150. color: rgba(255, 255, 255, 1);
  151. line-height: 20px;
  152. }
  153. }
  154. .closeIcon {
  155. position: absolute;
  156. right: 20px;
  157. top: 34px;
  158. width: 16px;
  159. height: 16px;
  160. background: url('~@/assets/img/credit/closeIcon.png') no-repeat;
  161. background-size: cover;
  162. cursor: pointer;
  163. }
  164. }
  165. }
  166. }
  167. .connectUsMobile {
  168. .toastBox {
  169. position: fixed;
  170. width: 100vw;
  171. height: 100vh;
  172. background-color: rgba(0, 0, 0, 0.8);
  173. z-index: 888;
  174. left: 0;
  175. top: 0;
  176. display: flex;
  177. justify-content: center;
  178. align-items: center;
  179. .toastArea {
  180. position: relative;
  181. width: pxtovw(355);
  182. height: pxtovw(403);
  183. background: rgba(255, 255, 255, 1);
  184. border-radius: pxtovw(3);
  185. padding: pxtovw(30) pxtovw(30);
  186. .title {
  187. font-size: pxtovw(19);
  188. font-weight: 500;
  189. color: rgba(34, 34, 34, 1);
  190. line-height: pxtovw(26);
  191. text-align: center;
  192. }
  193. .tips {
  194. margin-top: pxtovw(8);
  195. margin-bottom: pxtovw(14);
  196. font-size: pxtovw(12);
  197. font-weight: 400;
  198. color: rgba(153, 153, 153, 1);
  199. line-height: pxtovw(17);
  200. text-align: center;
  201. }
  202. .nameCell, .phoneCell {
  203. margin-top: pxtovw(25);
  204. .label {
  205. font-size: pxtovw(14);
  206. font-weight: 500;
  207. color: rgba(25, 34, 46, 1);
  208. line-height: pxtovw(20);
  209. }
  210. input {
  211. margin-top: pxtovw(5);
  212. padding: pxtovw(10);
  213. width: pxtovw(295);
  214. height: pxtovw(48);
  215. background: rgba(255, 255, 255, 1);
  216. border-radius: pxtovw(3);
  217. border: pxtovw(1) solid rgba(221, 225, 230, 1);
  218. }
  219. }
  220. .nameCell {
  221. margin-top: pxtovw(39);
  222. }
  223. .submitBtn {
  224. margin-top: pxtovw(18);
  225. width: pxtovw(295);
  226. height: pxtovw(48);
  227. background: rgba(48, 142, 255, 1);
  228. box-shadow: 0 pxtovw(2) pxtovw(6) 0 rgba(48, 142, 255, 0.3);
  229. border-radius: pxtovw(2);
  230. display: flex;
  231. justify-content: center;
  232. align-items: center;
  233. cursor: pointer;
  234. p {
  235. font-size: pxtovw(14);
  236. font-weight: 500;
  237. color: rgba(255, 255, 255, 1);
  238. line-height: pxtovw(20);
  239. }
  240. }
  241. .closeIcon {
  242. position: absolute;
  243. right: pxtovw(20);
  244. top: pxtovw(34);
  245. width: pxtovw(16);
  246. height: pxtovw(16);
  247. background: url('~@/assets/img/credit/closeIcon.png') no-repeat;
  248. background-size: cover;
  249. cursor: pointer;
  250. }
  251. }
  252. }
  253. }
  254. </style>