scanLogin.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <template>
  2. <div class="scanLogin">
  3. <div class="content">
  4. <div class="img">
  5. <img src="@/assets/img/other/user/compute@2x.png" alt="">
  6. </div>
  7. <div class="tips1">电脑端登陆确认</div>
  8. <div class="tips2">信息将自动会自动同步到APP</div>
  9. <div class="submitBtn" @click="submit">
  10. <p>登录</p>
  11. </div>
  12. <div class="cancle" @click="close">取消登录</div>
  13. </div>
  14. </div>
  15. </template>
  16. <script>
  17. import bridge from '../../../plugins/bridge';
  18. /**
  19. * 扫码登录web端
  20. */
  21. export default {
  22. name: 'ScanLogin',
  23. asyncData({}) {
  24. return {}
  25. },
  26. data() {
  27. },
  28. created() {
  29. this.code = this.$route.query.code
  30. },
  31. async mounted() {
  32. },
  33. methods: {
  34. submit() {
  35. this.$axios.$post('/api/user/qrcodeLoginSubmit', {
  36. code: this.code
  37. }).then(res => {
  38. if (Number(res.status) === 1) {
  39. this.$toast('登录成功')
  40. setTimeout(() => {
  41. this.appBackHandler()
  42. }, 500)
  43. }
  44. })
  45. },
  46. close() {
  47. this.appBackHandler()
  48. },
  49. appBackHandler() {
  50. if (!bridge.isInApp) {
  51. console.log("唤起APP退出Webview失败,appBridge不存在")
  52. return
  53. }
  54. bridge.close();
  55. }
  56. },
  57. }
  58. </script>
  59. <style lang="scss" scoped>
  60. @import "../../../assets/css/scssCommon";
  61. .scanLogin {
  62. height: 100%;
  63. overflow: hidden;
  64. margin-top: 0;
  65. .content {
  66. width: 100vw;
  67. height: 100%;
  68. min-height: calc(100vh - 50px);
  69. display: flex;
  70. justify-content: center;
  71. align-items: center;
  72. flex-direction: column;
  73. .img {
  74. width: pxtovw(125);
  75. height: pxtovw(125);
  76. font-size: 0;
  77. img {
  78. width: pxtovw(125);
  79. height: pxtovw(125);
  80. }
  81. }
  82. .tips1 {
  83. margin-top: pxtovw(22);
  84. height: pxtovw(22);
  85. font-size: pxtovw(16);
  86. font-weight: 600;
  87. text-align: left;
  88. color: #222222;
  89. line-height: pxtovw(22);
  90. }
  91. .tips2 {
  92. margin-top: pxtovw(3);
  93. height: pxtovw(17);
  94. font-size: pxtovw(12);
  95. font-weight: 400;
  96. text-align: center;
  97. color: #929aa4;
  98. line-height: pxtovw(17);
  99. }
  100. .submitBtn {
  101. margin-top: pxtovw(20);
  102. width: pxtovw(208);
  103. height: pxtovw(44);
  104. background: #308eff;
  105. border-radius: pxtovw(2);
  106. box-shadow: 0px 2px 6px 0px;
  107. display: flex;
  108. justify-content: center;
  109. align-items: center;
  110. p {
  111. font-size: pxtovw(14);
  112. font-weight: 500;
  113. text-align: center;
  114. color: #ffffff;
  115. line-height: pxtovw(20);
  116. }
  117. }
  118. .cancle {
  119. margin-top: pxtovw(17);
  120. height: pxtovw(20);
  121. font-size: pxtovw(14);
  122. font-weight: 400;
  123. text-align: center;
  124. color: #666666;
  125. line-height: pxtovw(20);
  126. }
  127. }
  128. }
  129. </style>