login.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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="39.200vw" height="12.533vw" 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: 12px;">加载失败</view>
  10. </u--image>
  11. </view>
  12. <account v-show="loginMethod == 'account'" />
  13. <phone v-show="loginMethod == 'phone'" />
  14. <view style="height: 25px;" />
  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. import { getCity } from "../../utils/tool";
  23. export default {
  24. components: {
  25. account,
  26. phone,
  27. otherLogin
  28. },
  29. data() {
  30. return {
  31. loginMethod: "",
  32. height: this.usePort == 'h5' ? "100px" : "150px"
  33. };
  34. },
  35. onLoad() {
  36. this.loginMethod = uni.getStorageSync('loginMethod') || 'account';//登录方式
  37. getCity.bind(this)().then(res => res && uni.setStorageSync("city", res))
  38. },
  39. methods: {
  40. /* 修改登录方式 */
  41. changeLoginMethod(Method) {
  42. this.loginMethod = Method;
  43. }
  44. }
  45. }
  46. </script>
  47. <style lang="scss" scoped>
  48. .container {
  49. width: 100vw;
  50. box-sizing: border-box;
  51. background: #282C35 !important;
  52. .logo {
  53. width: 147px;
  54. height: 42px;
  55. margin: 0 auto 50px;
  56. }
  57. }
  58. </style>