authorization.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <template>
  2. <view class="content">
  3. <view class="logo">
  4. <img class="img" src="../../static/ceshi.jpg">
  5. </view>
  6. <button class="button" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
  7. <img class="img" src="../../static/weixin.svg">
  8. <span>微信一键登录</span>
  9. </button>
  10. </view>
  11. </template>
  12. <script setup>
  13. import {
  14. ref
  15. } from 'vue'
  16. import {
  17. myRequest
  18. } from '../../util/api.js'
  19. const code = ref('')
  20. const getPhoneNumber = async (e) => {
  21. console.log(e);
  22. code.value = e.detail.code
  23. if (code.value) {
  24. const res = await myRequest({
  25. url: "/wx/getPhone",
  26. data: {
  27. code: code.value
  28. }
  29. })
  30. console.log(res);
  31. }
  32. }
  33. </script>
  34. <style lang="scss" scoped>
  35. .content {
  36. width: 100vw;
  37. height: 100vh;
  38. overflow: hidden;
  39. .logo {
  40. margin: 300rpx auto 0;
  41. width: 150rpx;
  42. height: 150rpx;
  43. border-radius: 20rpx;
  44. .img {
  45. width: 100%;
  46. height: 100%;
  47. border-radius: 20rpx;
  48. }
  49. }
  50. .button {
  51. display: flex;
  52. justify-content: center;
  53. align-items: center;
  54. margin: 150rpx auto 0;
  55. width: 600rpx;
  56. height: 100rpx;
  57. font-size: 32rpx;
  58. color: #fff;
  59. border-radius: 50rpx;
  60. background-color: #1E7DFB;
  61. .img {
  62. margin-right: 20rpx;
  63. width: 50rpx;
  64. height: 50rpx;
  65. color: #fff;
  66. }
  67. }
  68. }
  69. </style>