jhzh
2024-03-23 0d29d9a2bf0d893a67f1263bb9525131a50a2128
src/page/login/login.vue
@@ -8,7 +8,7 @@
    </div> -->
    <div class="logins_content">
      <div class="login_title animated slideInDown">
        <span>{{ $t('hj8') }}</span>
        <span>{{ $t("hj8") }}</span>
      </div>
      <div class="login_forms">
        <div class="top_forms">
@@ -18,25 +18,51 @@
          <div class="password">
            <input type="password"  placeholder="登录密码" v-model="userPassword" @input="handleInput()" />
          </div> -->
          <el-input :placeholder="$t('hj9')" :size="medium" maxlength="11" v-model="userName" clearable>
          <el-input
            :placeholder="$t('hj9')"
            :size="medium"
            maxlength="11"
            v-model="userName"
            clearable
          >
          </el-input>
          <el-input style="margin-top: 0.46rem;" show-password :placeholder="$t('hj10')" :size="medium"
            v-model="userPassword" @input="handleInput()">
          <el-input
            style="margin-top: 0.46rem;"
            show-password
            :placeholder="$t('hj10')"
            :size="medium"
            v-model="userPassword"
            @input="handleInput()"
          >
          </el-input>
        </div>
        <div class="bottom_btns" :class="btnClass ? 'on' : 'off'">
          <div class="top_btn " @click="loginIN" :class="dengl ? 'animated pulse' : ''">
            <span>{{ $t('hj11') }}</span>
          </div>
          <div class="mes" @click="getApp()">
            <span>{{ $t('hj12') }}</span>
          <button
            class="top_btn "
            v-on:touchstart="loginIN"
            :class="dengl ? 'animated pulse' : ''"
          >
            <span>{{ $t("hj11") }}</span>
          </button>
          <div style="display:flex;align-items:center;justify-content: space-between;">
            <div class="myzh">
              <span class="mes" style="margin: right 0.2rem;">{{ $t("hj14") }}?</span
              ><span
                @click="$router.push('/register')"
                class="mes"
                style="color: rgb(54,124,248);"
                >{{ $t("hj15") }}</span
              >
            </div>
            <div class="mes" @click="getApp()">
              <span>{{ $t("hj12") }}</span>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="login_bom">
      <div class="line">
    <div class="login_bom" v-if="hideshow">
      <!-- <div class="line">
        <div class="left_line"></div>
        <div class="center_line">
          <span>{{ $t('hj13') }}</span>
@@ -47,26 +73,30 @@
        <div class="appImg" @click="getApp()"><img src="@/assets/img/apple.png" /></div>
        <div class="appImg" @click="getApp()"><img src="@/assets/img/google.png" /></div>
        <div class="appImg" @click="getApp()"><img src="@/assets/img/facebook.png" /></div>
      </div>
      <div class="myzh"><span class="mes">{{ $t('hj14') }}?</span><span @click="$router.push('/register')" class="mes"
          style="color: rgb(54,124,248);">{{ $t('hj15') }}</span> </div>
      </div> -->
    </div>
    <el-alert v-show="alertShow" :closable="closable" :title="texts" :type="eltype" center></el-alert>
    <el-alert
      v-show="alertShow"
      :closable="closable"
      :title="texts"
      :type="eltype"
      center
    ></el-alert>
  </div>
</template>
<script>
import { Toast } from 'mint-ui'
import { Toast } from "mint-ui";
import headers from "./components/header.vue";
import Logo from "@/assets/img/LOGO2.png";
import * as api from '@/axios/api';
import * as api from "@/axios/api";
export default {
  name: "newLogin",
  data() {
    return {
      loginWay: this.$t('hj8'),
      loginWay: this.$t("hj8"),
      currentLoginMode: "email",
      placeholder: this.$t('hj16'),
      placeholder: this.$t("hj16"),
      Logo,
      userPassword: "",
      userName: "",
@@ -74,39 +104,57 @@
      medium: "medium",
      alertShow: false,
      closable: false,
      eltype: 'warning',
      eltype: "warning",
      texts: "",
      dengl: false,
      loginBtn: false,
      docmHeight: document.documentElement.clientHeight, //默认屏幕高度
      showHeight: document.documentElement.clientHeight, //实时屏幕高度
      hideshow: true //显示或者隐藏footer
    };
  },
  components: {
    headers
  },
  mounted() {
    window.onresize = () => {
      return (() => {
        this.showHeight = document.body.clientHeight;
      })();
    };
  },
  watch: {
    showHeight: function() {
      if (this.docmHeight > this.showHeight) {
        this.hideshow = false;
      } else {
        this.hideshow = true;
      }
    }
  },
  methods: {
    getApp() {
      // Toast('您所在的地区暂未开通此服务')
      //Toast 弹窗大小
      this.texts = this.$t('hj17')
      this.alertShow = true
      this.texts = this.$t("hj17");
      this.alertShow = true;
      setTimeout(() => {
        this.alertShow = false
      }, 2000)
        this.alertShow = false;
      }, 2000);
    },
    handleInput() {
      console.log(this.userPassword !== "" && this.userName !== '');
      if (this.userPassword !== "" && this.userName !== '') {
      console.log(this.userPassword !== "" && this.userName !== "");
      if (this.userPassword !== "" && this.userName !== "") {
        this.btnClass = true;
      } else {
        this.btnClass = false;
      }
    },
    async loginIN() {
      this.dengl = true
      this.dengl = true;
      setTimeout(() => {
        this.dengl = false
      }, 1000)
        this.dengl = false;
      }, 1000);
      if (this.loginBtn) {
        return;
      }
@@ -114,41 +162,43 @@
      let opts = {
        phone: this.userName,
        userPwd: this.userPassword
      }
      let data = await api.login(opts)
      };
      let data = await api.login(opts);
      console.log("data.status",data.status);
      if (data.status === 0) {
        this.$store.state.userInfo.phone = this.userName
        this.$store.state.userInfo.token = data.data.token
        this.texts = this.$t('hj36')
        this.eltype = 'success'
        this.alertShow = true
        this.$store.state.userInfo.phone = this.userName;
        this.$store.state.userInfo.token = data.data.token;
        this.texts = this.$t("hj36");
        this.eltype = "success";
        this.alertShow = true;
        setTimeout(() => {
          this.alertShow = false
          this.eltype = 'warning'
          this.$router.push('/home')
        }, 1000)
          this.alertShow = false;
          this.eltype = "warning";
          this.$router.push("/home");
        }, 1000);
        this.loginBtn = false;
        window.localStorage.clear()
        // window.localStorage.clear()
        window.localStorage.setItem("USERTOKEN", data.data.token);
      } else {
        this.texts = data.msg
        this.alertShow = true
        this.texts = data.msg;
        this.alertShow = true;
        this.loginBtn = false;
        setTimeout(() => {
          this.alertShow = false
        }, 2000)
          this.alertShow = false;
        }, 2000);
        //Toast(data.msg)
      }
      if (navigator.vibrate) {
        // 支持
        navigator.vibrate([55]);
      }
    },
    }
  },
  beforeDestroy() { },
  created() { }
  beforeDestroy() {},
  created() {}
};
</script>
@@ -163,7 +213,6 @@
}
.logins_content {
  width: 100%;
  height: 9.7436rem;
  margin-top: 0.4359rem;
@@ -179,7 +228,7 @@
    color: #000;
    font-weight: 600 !important;
    >span {
    > span {
      font-weight: 600 !important;
    }
  }
@@ -204,7 +253,7 @@
        // background: #1e1e1e;
        border-radius: 0.3564rem;
        >input {
        > input {
          width: 100%;
          height: 100%;
          padding-left: 0.3564rem;
@@ -228,6 +277,7 @@
      margin-top: 0.8528rem;
      .top_btn {
      border: none;
        width: 100%;
        height: 1.25rem;
        border-radius: 0.3564rem;
@@ -239,15 +289,13 @@
        font-size: 0.5128rem;
        margin-top: 0.75rem;
        >span {
        > span {
          font-weight: 530 !important;
        }
      }
      .mes {
        width: 100%;
        // width: 100%;
        height: 20%;
        margin-top: 0.4rem;
        display: flex;
@@ -290,11 +338,10 @@
    align-items: center;
    justify-content: center;
    >span {
    > span {
      font-size: 0.3046rem;
      color: #000;
      background-color: #fff;
    }
  }
@@ -303,17 +350,18 @@
    height: 0.01rem;
    background: #e5e5e5;
  }
}
.myzh {
  width: calc(100% - 4rem);
  position: absolute;
  // width: calc(100% - 4rem);
  // position: absolute;
  bottom: 0.01rem;
  text-align: center;
  display: flex;
  align-items: center;
  .mes {
    width: 100%;
    // width: 100%;
    height: 40%;
    font-size: 0.3846rem;
@@ -353,7 +401,7 @@
    width: 3rem;
    height: 3.5769rem;
    >img {
    > img {
      width: 100%;
      height: 100%;
    }
@@ -368,11 +416,9 @@
}
/deep/.el-input__suffix-inner {
  display: flex;
  justify-content: center;
  align-items: center;
}
/deep/.el-input__icon {
@@ -388,7 +434,6 @@
/deep/.el-icon-circle-close::before {
  font-size: 0.5rem !important;
}
/deep/.el-input__clear {