|
|
@@ -4,13 +4,14 @@
|
|
|
<div class="login-tab" :class="{'is-active': !type || type === 'codeLogin'}" @click="toOtherLogin('')">{{$t('login.userLogin')}}</div><div class="login-tab" :class="{'is-active': type==='camera'}" @click="toOtherLogin('camera')">{{$t('login.cameraLogin')}}</div>
|
|
|
</div>
|
|
|
<div class="account-login" v-if="!type">
|
|
|
- <input type="text" v-if="!isInternational" oninput="value=value.replace(/[^\d]/g,'')" maxlength="11" class="input" :placeholder="isInternational? $t('login.emailPlaceholder') : $t('login.phonePlaceholder')" v-model="form.phone">
|
|
|
- <input type="text" v-else class="input" :placeholder="isInternational? $t('login.emailPlaceholder') : $t('login.phonePlaceholder')" v-model="form.phone">
|
|
|
+ <!-- <input type="text" v-if="!isInternational" oninput="value=value.replace(/[^\d]/g,'')" maxlength="11" class="input" :placeholder="isInternational? $t('login.emailPlaceholder') : $t('login.phonePlaceholder')" v-model="form.phone"> -->
|
|
|
+ <!-- <input type="text" v-else class="input" :placeholder="isInternational? $t('login.emailPlaceholder') : $t('login.phonePlaceholder')" v-model="form.phone"> -->
|
|
|
+ <input type="text" class="input" :placeholder="$t('login.emailPlaceholder')" v-model="form.phone">
|
|
|
<div class="password-w">
|
|
|
<input maxLength="16" :type="showPassword ? 'test' : 'password'" class="input password" :placeholder="$t('login.passwordPlaceholder')" v-model="form.password" @keyup.enter="login">
|
|
|
<h-icon :type="showPassword ? 'mimakejian' : 'mimabukejian'" class="password-visible" @click="showPassword=!showPassword" />
|
|
|
</div>
|
|
|
-
|
|
|
+
|
|
|
<div class="toCodeLogin tips-tap" >
|
|
|
<!-- <a @click="$router.push({name: 'login', query: {type: 'codeLogin'}})">{{$t('login.codeLogin')}}</a> -->
|
|
|
</div>
|
|
|
@@ -74,62 +75,61 @@ export default {
|
|
|
},
|
|
|
async login () {
|
|
|
let check = value => {
|
|
|
- for (let i = 0, len = value.length; i < len; i++) {
|
|
|
- if (!value[i].val) {
|
|
|
- this.$toast.show('warn', (this.language === 'en' ? value[i].En : value[i].name) + this.langToast['7'])
|
|
|
- return
|
|
|
- }
|
|
|
- }
|
|
|
- return true
|
|
|
- }
|
|
|
- let checkStr = [
|
|
|
- {
|
|
|
- name: this.isInternational ? '邮箱' : '手机',
|
|
|
- En: this.isInternational ? 'E-mail' :'Phone number',
|
|
|
- val: this.form.phone
|
|
|
- },
|
|
|
- {
|
|
|
- name: '密码',
|
|
|
- En: 'Password',
|
|
|
- val: this.form.password
|
|
|
+ for (let i = 0, len = value.length; i < len; i++) {
|
|
|
+ if (!value[i].val) {
|
|
|
+ this.$toast.show('warn', (this.language === 'en' ? value[i].En : value[i].name) + this.langToast['7'])
|
|
|
+ return
|
|
|
}
|
|
|
- ]
|
|
|
- if (!check(checkStr)) {
|
|
|
- return
|
|
|
}
|
|
|
- localStorage.setItem('remember', this.rememberMe)
|
|
|
- if (this.rememberMe) {
|
|
|
- localStorage.setItem('username', this.form.phone)
|
|
|
- localStorage.setItem('password', this.form.password)
|
|
|
- } else {
|
|
|
- localStorage.setItem('username', '')
|
|
|
- localStorage.setItem('password', '')
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ let checkStr = [
|
|
|
+ {
|
|
|
+ name: this.isInternational ? '邮箱' : '手机',
|
|
|
+ En: this.isInternational ? 'E-mail' : 'Phone number',
|
|
|
+ val: this.form.phone
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '密码',
|
|
|
+ En: 'Password',
|
|
|
+ val: this.form.password
|
|
|
}
|
|
|
+ ]
|
|
|
+ if (!check(checkStr)) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ localStorage.setItem('remember', this.rememberMe)
|
|
|
+ if (this.rememberMe) {
|
|
|
+ localStorage.setItem('username', this.form.phone)
|
|
|
+ localStorage.setItem('password', this.form.password)
|
|
|
+ } else {
|
|
|
+ localStorage.setItem('username', '')
|
|
|
+ localStorage.setItem('password', '')
|
|
|
+ }
|
|
|
|
|
|
- let params = {
|
|
|
- phoneNum: this.form.phone,
|
|
|
- password: encodeStr(Base64.encode(this.form.password)),
|
|
|
- randomcode: '1234',
|
|
|
- rememberMe: Boolean(this.rememberMe)
|
|
|
+ let params = {
|
|
|
+ phoneNum: this.form.phone,
|
|
|
+ password: encodeStr(Base64.encode(this.form.password)),
|
|
|
+ randomcode: '1234',
|
|
|
+ rememberMe: Boolean(this.rememberMe)
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ let res = await this.$store.dispatch('login', params)
|
|
|
+ if (!res) {
|
|
|
+ return
|
|
|
}
|
|
|
- try {
|
|
|
- let res = await this.$store.dispatch('login', params)
|
|
|
- if (!res) {
|
|
|
- return
|
|
|
- }
|
|
|
- const from = this.$route.query.from
|
|
|
- // if (from) {
|
|
|
- // this.$router.push(from)
|
|
|
- // } else {
|
|
|
- // this.$router.push('/information')
|
|
|
- // }
|
|
|
- this.$router.push('/information')
|
|
|
- } catch (err) {
|
|
|
+ const from = this.$route.query.from
|
|
|
+ // if (from) {
|
|
|
+ // this.$router.push(from)
|
|
|
+ // } else {
|
|
|
+ // this.$router.push('/information')
|
|
|
+ // }
|
|
|
+ this.$router.push('/information')
|
|
|
+ } catch (err) {
|
|
|
|
|
|
- }
|
|
|
-
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
@@ -178,7 +178,7 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
.password {
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
.toCodeLogin {
|
|
|
text-align: right;
|
|
|
@@ -191,7 +191,7 @@ export default {
|
|
|
position: relative;
|
|
|
font-size: 16px;
|
|
|
color: #202020;
|
|
|
-
|
|
|
+
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
line-height: 18px;
|
|
|
@@ -233,4 +233,4 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|