download.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <template>
  2. <div :class="{connectUs: !mobile, connectUsMobile: mobile}">
  3. <div class="toastBox" v-if="isShowToast" @click="close">
  4. <div class="toastArea">
  5. <div class="title">打开APP扫描</div>
  6. <div class="qrcode">
  7. <img :src="qrCodeBase64" alt="" class="code">
  8. <img class="logo" src="~@/assets/img/job/logo_icon_reverse2.jpg" alt="">
  9. </div>
  10. <div class="tips">使用 <span>程序员客栈APP</span> 扫一扫 </div>
  11. <div class="tips">立即与企业方沟通</div>
  12. <div class="notHave">没有安装APP?</div>
  13. <div class="submitBtn" @click.stop="judgeToDownloadApp">
  14. <p>立即下载</p>
  15. </div>
  16. <div class="closeIcon" @click.stop="close"/>
  17. </div>
  18. </div>
  19. </div>
  20. </template>
  21. <script>
  22. let qrcode = null
  23. if (process.browser) {
  24. qrcode = require("qrcode");
  25. }
  26. export default {
  27. props: [ "source", "isShowToast", "sourceId" ],
  28. components: {},
  29. data() {
  30. return {
  31. qrCodeBase64: "",
  32. mobile: this.$deviceType.isMobile()
  33. };
  34. },
  35. computed: {},
  36. mounted() {
  37. if (!this.mobile) {
  38. let baseUrl = this.$store.state.domainConfig.jobUrl;
  39. let jumpUrl = `${baseUrl}${location.pathname}`;
  40. this.createCode(jumpUrl);
  41. }
  42. },
  43. methods: {
  44. close() {
  45. this.$emit('close')
  46. },
  47. judgeToDownloadApp() {
  48. // 应用宝:https://sj.qq.com/myapp/detail.htm?apkName=com.proginn
  49. // iOS:https://apps.apple.com/cn/app/id979914687
  50. if (!this.$deviceType.app) {
  51. // let url = this.$deviceType.ios ?
  52. // "https://apps.apple.com/cn/app/id979914687" :
  53. // "https://sj.qq.com/myapp/detail.htm?apkName=com.proginn"
  54. location.href = "https://www.proginn.com/index/app"
  55. return true
  56. }
  57. return false
  58. },
  59. //创建二维码
  60. createCode(url) {
  61. console.log('warn', url)
  62. qrcode.toDataURL(url, {
  63. width: 250,
  64. margin: 0,
  65. errorCorrectionLevel: "H"
  66. }).then(res => {
  67. this.qrCodeBase64 = res
  68. }).catch(err => {
  69. this.$toast.clear()
  70. this.$toast('生成二维码出错')
  71. console.warn(JSON.stringfy(err))
  72. })
  73. },
  74. }
  75. };
  76. </script>
  77. <style lang="scss">
  78. @import "~@/assets/css/scssCommon.scss";
  79. .connectUs {
  80. .toastBox {
  81. position: fixed;
  82. width: 100vw;
  83. height: 100vh;
  84. background-color: rgba(0, 0, 0, 0.8);
  85. z-index: 888;
  86. left: 0;
  87. top: 0;
  88. display: flex;
  89. justify-content: center;
  90. align-items: center;
  91. .toastArea {
  92. position: relative;
  93. width: 446px;
  94. height: 436px !important;
  95. background: rgba(255, 255, 255, 1);
  96. border-radius: 10px;
  97. padding: 25px 47px;
  98. .title {
  99. font-size: 19px;
  100. font-weight: 500;
  101. color: rgba(34, 34, 34, 1);
  102. line-height: 26px;
  103. text-align: center;
  104. }
  105. .qrcode {
  106. margin: 15px auto 0 auto;
  107. width: 185px;
  108. height: 185px;
  109. position: relative;
  110. padding: 10px;
  111. .code {
  112. width: 165px;
  113. height: 165px;
  114. }
  115. .logo {
  116. position: absolute;
  117. left: 50%;
  118. top: 50%;
  119. width: 40px;
  120. height: 40px;
  121. transform-origin: center;
  122. transform: translate(-50%, -50%);
  123. }
  124. }
  125. .tips {
  126. width:190px;
  127. height:21px;
  128. font-size:15px;
  129. font-weight:400;
  130. color:rgba(51,51,51,1);
  131. line-height:21px;
  132. text-align: center;
  133. margin: 0 auto !important;
  134. white-space: nowrap;
  135. word-break: keep-all;
  136. span {
  137. font-size:15px;
  138. font-weight: 500;
  139. color:rgba(51,51,51,1);
  140. line-height:21px;
  141. }
  142. }
  143. .notHave {
  144. margin: 35px auto 0 auto;
  145. height:27px;
  146. font-size:15px;
  147. font-weight:600;
  148. color:rgba(51,51,51,1);
  149. line-height:27px;
  150. padding-right: 15px;
  151. width: fit-content;
  152. position: relative;
  153. }
  154. .submitBtn {
  155. margin: 9px auto 0 auto;
  156. width:212px;
  157. height:44px;
  158. background: rgba(48, 142, 255, 1);
  159. box-shadow: 0 2px 6px 0 rgba(48, 142, 255, 0.3);
  160. border-radius: 2px;
  161. display: flex;
  162. justify-content: center;
  163. align-items: center;
  164. cursor: pointer;
  165. p {
  166. font-size: 14px;
  167. font-weight: 500;
  168. color: rgba(255, 255, 255, 1);
  169. line-height: 20px;
  170. }
  171. }
  172. .closeIcon {
  173. position: absolute;
  174. right: 20px;
  175. top: 30px;
  176. width: 16px;
  177. height: 16px;
  178. background: url('~@/assets/img/credit/closeIcon.png') no-repeat;
  179. background-size: cover;
  180. cursor: pointer;
  181. }
  182. }
  183. }
  184. }
  185. .connectUsMobile {
  186. .toastBox {
  187. position: fixed;
  188. width: 100vw;
  189. height: 100vh;
  190. background-color: rgba(0, 0, 0, 0.8);
  191. z-index: 888;
  192. left: 0;
  193. top: 0;
  194. display: flex;
  195. justify-content: center;
  196. align-items: center;
  197. .toastArea {
  198. position: relative;
  199. width: pxtovw(355);
  200. height: pxtovw(403);
  201. background: rgba(255, 255, 255, 1);
  202. border-radius: pxtovw(3);
  203. padding: pxtovw(30) pxtovw(30);
  204. .title {
  205. font-size: pxtovw(19);
  206. font-weight: 500;
  207. color: rgba(34, 34, 34, 1);
  208. line-height: pxtovw(26);
  209. text-align: center;
  210. }
  211. .tips {
  212. margin-top: pxtovw(8);
  213. margin-bottom: pxtovw(14);
  214. font-size: pxtovw(12);
  215. font-weight: 400;
  216. color: rgba(153, 153, 153, 1);
  217. line-height: pxtovw(17);
  218. text-align: center;
  219. }
  220. .nameCell, .phoneCell {
  221. margin-top: pxtovw(25);
  222. .label {
  223. font-size: pxtovw(14);
  224. font-weight: 500;
  225. color: rgba(25, 34, 46, 1);
  226. line-height: pxtovw(20);
  227. }
  228. input {
  229. margin-top: pxtovw(5);
  230. padding: pxtovw(10);
  231. width: pxtovw(295);
  232. height: pxtovw(48);
  233. background: rgba(255, 255, 255, 1);
  234. border-radius: pxtovw(3);
  235. border: pxtovw(1) solid rgba(221, 225, 230, 1);
  236. }
  237. }
  238. .nameCell {
  239. margin-top: pxtovw(39);
  240. }
  241. .submitBtn {
  242. margin-top: pxtovw(18);
  243. width: pxtovw(295);
  244. height: pxtovw(48);
  245. background: rgba(48, 142, 255, 1);
  246. box-shadow: 0 pxtovw(2) pxtovw(6) 0 rgba(48, 142, 255, 0.3);
  247. border-radius: pxtovw(2);
  248. display: flex;
  249. justify-content: center;
  250. align-items: center;
  251. cursor: pointer;
  252. p {
  253. font-size: pxtovw(14);
  254. font-weight: 500;
  255. color: rgba(255, 255, 255, 1);
  256. line-height: pxtovw(20);
  257. }
  258. }
  259. .closeIcon {
  260. position: absolute;
  261. right: pxtovw(20);
  262. top: pxtovw(34);
  263. width: pxtovw(16);
  264. height: pxtovw(16);
  265. background: url('~@/assets/img/credit/closeIcon.png') no-repeat;
  266. background-size: cover;
  267. cursor: pointer;
  268. }
  269. }
  270. }
  271. }
  272. </style>