| | |
| | | v-model="password" |
| | | typeText="password" |
| | | /> |
| | | <div class="forget colorMain" @click="$router.push('/forget')"> |
| | | {{ $t("忘记密码?") }} |
| | | </div> |
| | | <div class="remember" data-v-8cc76a7b=""> |
| | | <van-checkbox @change="checkboxChange" v-model="checked">{{ |
| | | $t("記住帳戶密碼") |
| | | }}</van-checkbox> |
| | | <div |
| | | style=" |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | margin-top: 10px; |
| | | " |
| | | > |
| | | <div class="forget colorMain" @click="$router.push('/forget')"> |
| | | {{ $t("忘记密码?") }} |
| | | </div> |
| | | <div class="remember" data-v-8cc76a7b=""> |
| | | <van-checkbox @change="checkboxChange" v-model="checked">{{ |
| | | $t("记住帐户密码") |
| | | }}</van-checkbox> |
| | | </div> |
| | | </div> |
| | | <div class="btn btnMain" @click="verifyLogin">{{ $t("登录") }}</div> |
| | | <div class="noTips textColor"> |
| | |
| | | icon: "", |
| | | }; |
| | | }, |
| | | mounted() { |
| | | const ret = window.localStorage.getItem("login_admin"); |
| | | this.checked = window.localStorage.getItem("login_checked") === "true"; |
| | | console.log(ret, this.checked); |
| | | if (ret && this.checked) { |
| | | this.password = JSON.parse(ret).password; |
| | | this.username = JSON.parse(ret).username; |
| | | } |
| | | }, |
| | | activated() { |
| | | const ret = window.localStorage.getItem("login_admin"); |
| | | this.checked = window.localStorage.getItem("login_checked") === "true"; |
| | | console.log(ret, this.checked); |
| | | if (ret && this.checked) { |
| | | this.password = JSON.parse(ret).password; |
| | | this.username = JSON.parse(ret).username; |
| | | } else { |
| | | this.password = ""; |
| | | this.username = ""; |
| | | } |
| | | }, |
| | | computed: { |
| | | ...mapGetters({ |
| | | theme: "home/theme", |
| | |
| | | }, |
| | | methods: { |
| | | ...mapActions("user", [GET_USERINFO, SET_CONFIG]), |
| | | checkboxChange(e) {}, |
| | | checkboxChange(e) { |
| | | window.localStorage.setItem("login_checked", e); |
| | | }, |
| | | getRegType(activeIndex, bFlag) { |
| | | switch (activeIndex) { |
| | | case 0: |
| | |
| | | password: this.password, |
| | | }) |
| | | .then((res) => { |
| | | if (this.checked) { |
| | | window.localStorage.setItem( |
| | | "login_admin", |
| | | JSON.stringify({ |
| | | username: this.username, |
| | | password: this.password, |
| | | }) |
| | | ); |
| | | } else { |
| | | window.localStorage.setItem("login_admin", ""); |
| | | } |
| | | |
| | | this.GET_USERINFO(res.data); |
| | | this.SET_CONFIG(); //获取判断是否乘以杠杆字段 |
| | | this.$router.push("/home"); |
| | |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | ::v-deep .van-icon { |
| | | width: 1.3rem; |
| | | height: 1.3rem; |
| | | } |
| | | ::v-deep .van-checkbox__icon { |
| | | height: auto; |
| | | } |
| | | .login { |
| | | width: 100%; |
| | | padding: 30px; |