login.vue 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <template>
  2. <view class="container" style="background-image: url('../../static/login.gif');height:100vh;">
  3. <view :style="{ height: height }" />
  4. <view class="logo">
  5. <u--image src="/static/img/logo.png" width="294rpx" height="94rpx" mode="scaleToFill">
  6. <template v-slot:loading>
  7. <u-loading-icon color="red"></u-loading-icon>
  8. </template>
  9. <view slot="error" style="font-size: 24rpx;">加载失败</view>
  10. </u--image>
  11. </view>
  12. <account v-show="loginMethod == 'account'" />
  13. <phone v-show="loginMethod == 'phone'" />
  14. <view style="height: 50rpx;" />
  15. <other-login :loginMethod="loginMethod" @onChange="changeLoginMethod" />
  16. </view>
  17. </template>
  18. <script>
  19. import account from "./modules/account.vue";
  20. import phone from "./modules/phone.vue";
  21. import otherLogin from "./modules/otherLogin.vue";
  22. export default {
  23. components: {
  24. account,
  25. phone,
  26. otherLogin
  27. },
  28. data() {
  29. return {
  30. loginMethod: "",
  31. height: ""
  32. };
  33. },
  34. onLoad() {
  35. this.loginMethod = uni.getStorageSync('loginMethod') || 'account';//登录方式
  36. // #ifdef H5
  37. this.height = "200rpx";
  38. // #endif
  39. // #ifndef H5
  40. this.height = "300rpx";
  41. // #endif
  42. },
  43. methods: {
  44. /* 修改登录方式 */
  45. changeLoginMethod(Method) {
  46. this.loginMethod = Method;
  47. }
  48. }
  49. }
  50. </script>
  51. <style lang="scss">
  52. .container {
  53. width: 100vw;
  54. box-sizing: border-box;
  55. background-color: #282C35;
  56. .logo {
  57. width: 294rpx;
  58. height: 84rpx;
  59. margin: 0 auto 100rpx;
  60. }
  61. }
  62. </style>