login.vue 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <view class="page align-center flex-col">
  3. <view class="header-sec align-center flex-col justify-center">
  4. <image src="/static/log_logo.png" mode="widthFix" class="logo"></image>
  5. <text class="txt">盲go小程序</text>
  6. </view>
  7. <button open-type="getPhoneNumber" class="btn-auth" @getphonenumber="getphonenumber">微信用户一键登录</button>
  8. <view class="btn-mobile" @tap="goMobileLogin">手机号码登录</view>
  9. </view>
  10. </template>
  11. <script>
  12. export default {
  13. data() {
  14. return {
  15. };
  16. },
  17. async onLoad(e) {
  18. this.toPath = e.toPath;
  19. },
  20. methods:{
  21. async getphonenumber(e){
  22. if(!e.detail.code){
  23. return;
  24. }
  25. // this.code = e.detail.code
  26. let res = await this.$request('login.getPhoneNumber',{code:e.detail.code});
  27. uni.setStorageSync("token",res.data.userinfo.token);
  28. this.$store.dispatch('userInfo/getinfo');
  29. this.$tools.msg(res.msg);
  30. setTimeout(()=>{
  31. if(this.toPath){
  32. uni.redirectTo({
  33. url:this.toPath
  34. })
  35. return;
  36. }
  37. this.goBack();
  38. },800)
  39. },
  40. goMobileLogin(){
  41. this.navTo('/pages/login/mobileLogin',{toPath:this.toPath},{type:'replace'})
  42. },
  43. }
  44. }
  45. </script>
  46. <style lang="scss">
  47. page{
  48. background-color: #fff;
  49. }
  50. .header-sec{
  51. width: 100%;
  52. height: 832rpx;
  53. padding-top: 160rpx;
  54. .logo{
  55. width: 180rpx;
  56. height: 180rpx;
  57. // border-radius: 180rpx;
  58. // background-color: $base-color;
  59. }
  60. .txt{
  61. margin-top: 33rpx;
  62. font-size: 28rpx;
  63. font-family: PingFang SC;
  64. font-weight: 500;
  65. color: #92B99C;
  66. }
  67. }
  68. .btn-auth{
  69. width: 630rpx;
  70. height: 84rpx;
  71. background: $base-color;
  72. border-radius: 8rpx;
  73. line-height: 84rpx;
  74. text-align: center;
  75. font-size: 34rpx;
  76. font-family: PingFang SC;
  77. font-weight: 500;
  78. color: #FFFFFF;
  79. }
  80. .btn-mobile{
  81. margin-top: 30rpx;
  82. width: 630rpx;
  83. height: 84rpx;
  84. border-radius: 8rpx;
  85. line-height: 84rpx;
  86. text-align: center;
  87. font-size: 34rpx;
  88. font-family: PingFang SC;
  89. font-weight: 500;
  90. color: $base-color;
  91. }
  92. </style>