index.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <template>
  2. <view class="flex container">
  3. <u-navbar :placeholder="true" bgColor="#fff" :autoBack="true" title="微信授权"></u-navbar>
  4. <view class="login">
  5. <view class="flex login-image">
  6. <view class="image"></view>
  7. </view>
  8. <view class="login-txt">呱呱刮</view>
  9. <view class="login-txt">呱呱刮将为您提供</view>
  10. <view class="login-title">商品兑换、盲票购买等服务 请先完成授权登录</view>
  11. <view class="login-btn">
  12. <button open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">微信授权登录</button>
  13. </view>
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. import $http from '@/utils/request.js'
  19. export default {
  20. data() {
  21. return {
  22. };
  23. },
  24. methods: {
  25. getPhoneNumber(e) {
  26. $http.post('/api/v1/mp/user/wxauth/mobile', {
  27. code: e.detail.code,
  28. identity: 2
  29. }).then(res => {
  30. }).catch(() => {
  31. })
  32. },
  33. getInfo() {
  34. uni.getUserProfile({
  35. desc: '用于填充用户默认信息',
  36. success(info) {
  37. uni.login({
  38. success(res) {
  39. $http.post('/api/v1/mp/user/wxauth', {
  40. ...{
  41. code: res.code
  42. },
  43. ...info.userInfo
  44. }).then(res => {
  45. }).catch(() => {
  46. })
  47. }
  48. })
  49. },
  50. fail() {
  51. }
  52. })
  53. },
  54. }
  55. }
  56. </script>
  57. <style lang="scss" scoped>
  58. .container {
  59. height: 100vh;
  60. width: 100%;
  61. flex-direction: column;
  62. }
  63. .login {
  64. &-image {
  65. .image {
  66. width: 164rpx;
  67. height: 164rpx;
  68. border-radius: 10rpx;
  69. margin-bottom: 14rpx;
  70. background-color: $uni-bg-color;
  71. }
  72. }
  73. &-txt {
  74. text-align: center;
  75. line-height: 40rpx;
  76. font-weight: bold;
  77. margin-bottom: 20rpx;
  78. }
  79. &-title {
  80. text-align: center;
  81. font-size: 24rpx;
  82. font-weight: normal;
  83. margin-bottom: 50rpx;
  84. }
  85. &-btn {
  86. button {
  87. width: 570rpx;
  88. height: 60rpx;
  89. line-height: 60rpx;
  90. border-radius: 30rpx;
  91. background-color: rgba(235, 112, 9, 100);
  92. color: rgba(255, 255, 255, 100);
  93. text-align: center;
  94. font-size: 28rpx;
  95. }
  96. }
  97. }
  98. </style>