index.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <template>
  2. <view class="page-container">
  3. <nav-bar title="扫码登录"></nav-bar>
  4. <view class="content">
  5. <view class="wrapper">
  6. <image src="/static/invite.png" class="slogan-img"></image>
  7. <view class="tip">是否确认登录网页端</view>
  8. <view class="button" @click="handleConfirmLogin">确认登录</view>
  9. </view>
  10. </view>
  11. </view>
  12. </template>
  13. <script>
  14. import navBar from '@/components/nav-bar/index.vue'
  15. export default {
  16. components: {
  17. navBar
  18. },
  19. data() {
  20. return {
  21. scanToken: '',
  22. loading: false,
  23. }
  24. },
  25. onLoad(options) {
  26. if (options.token) {
  27. this.scanToken = options.token
  28. }
  29. },
  30. methods: {
  31. // 确认登录
  32. handleConfirmLogin() {
  33. if (this.loading) return
  34. this.loading = true
  35. uni.showLoading({ title: '登录中' })
  36. this.$Request
  37. .post('/app/Login/confirm', {
  38. token: this.scanToken
  39. })
  40. .then(res => {
  41. if (res.code === 0) {
  42. this.$queue.showToast('登录成功')
  43. setTimeout(() => {
  44. uni.switchTab({
  45. url: '/pages/my/index'
  46. })
  47. }, 1500)
  48. }
  49. })
  50. .finally(() => {
  51. this.loading = false
  52. uni.hideLoading()
  53. })
  54. }
  55. }
  56. }
  57. </script>
  58. <style lang="scss" scoped>
  59. .page-container {
  60. .content {
  61. display: flex;
  62. align-items: center;
  63. justify-content: center;
  64. .wrapper {
  65. padding-top: 120rpx;
  66. }
  67. .slogan-img {
  68. display: block;
  69. width: 400rpx;
  70. height: 400rpx;
  71. margin: 0 auto 20rpx;
  72. }
  73. .tip {
  74. text-align: center;
  75. margin-bottom: 40rpx;
  76. }
  77. .button {
  78. width: 400rpx;
  79. height: 80rpx;
  80. border: 80rpx;
  81. text-align: center;
  82. color: #fff;
  83. font-size: 32rpx;
  84. line-height: 80rpx;
  85. border-radius: 100px;
  86. background: linear-gradient(90.00deg, rgba(13, 39, 247, 1),rgba(19, 193, 234, 1));
  87. }
  88. }
  89. }
  90. </style>