|
|
@ -1,19 +1,9 @@ |
|
|
|
<template> |
|
|
|
<template> |
|
|
|
<view class="register absolute"> |
|
|
|
<view class="register absolute"> |
|
|
|
<view class="shading"> |
|
|
|
|
|
|
|
<view class="pictrue acea-row row-center-wrapper"> |
|
|
|
|
|
|
|
<image src="@/static/images/logo.png" /> |
|
|
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="whiteBg" v-if="formItem === 1"> |
|
|
|
<view class="whiteBg" v-if="formItem === 1"> |
|
|
|
<view class="title acea-row row-center-wrapper"> |
|
|
|
<view class="title acea-row row-between-wrapper"> |
|
|
|
<view |
|
|
|
<view class="item" :class="current === index ? 'on' : ''" v-for="(item, index) in navList" |
|
|
|
class="item" |
|
|
|
@click="navTap(index)" :key="index">{{ item }}</view> |
|
|
|
:class="current === index ? 'on' : ''" |
|
|
|
|
|
|
|
v-for="(item, index) in navList" |
|
|
|
|
|
|
|
@click="navTap(index)" |
|
|
|
|
|
|
|
:key="index" |
|
|
|
|
|
|
|
>{{ item }}</view> |
|
|
|
|
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="list" :hidden="current !== 0"> |
|
|
|
<view class="list" :hidden="current !== 0"> |
|
|
|
<form @submit.prevent="submit"> |
|
|
|
<form @submit.prevent="submit"> |
|
|
@ -50,12 +40,8 @@ |
|
|
|
<use xlink:href="#icon-code_1" /> |
|
|
|
<use xlink:href="#icon-code_1" /> |
|
|
|
</svg>--> |
|
|
|
</svg>--> |
|
|
|
<input type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" /> |
|
|
|
<input type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" /> |
|
|
|
<button |
|
|
|
<button class="code" :disabled="disabled" :class="disabled === true ? 'on' : ''" |
|
|
|
class="code" |
|
|
|
@click="code">{{ text }}</button> |
|
|
|
:disabled="disabled" |
|
|
|
|
|
|
|
:class="disabled === true ? 'on' : ''" |
|
|
|
|
|
|
|
@click="code" |
|
|
|
|
|
|
|
>{{ text }}</button> |
|
|
|
|
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
@ -67,7 +53,9 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="whiteBg" v-else> |
|
|
|
<view class="whiteBg" v-else> |
|
|
|
<view class="title">注册账号</view> |
|
|
|
<view class="title acea-row row-between-wrapper"> |
|
|
|
|
|
|
|
<view class="item on">注册账号</view> |
|
|
|
|
|
|
|
</view> |
|
|
|
<view class="list"> |
|
|
|
<view class="list"> |
|
|
|
<view class="item"> |
|
|
|
<view class="item"> |
|
|
|
<view> |
|
|
|
<view> |
|
|
@ -83,12 +71,8 @@ |
|
|
|
<use xlink:href="#icon-code_1" /> |
|
|
|
<use xlink:href="#icon-code_1" /> |
|
|
|
</svg>--> |
|
|
|
</svg>--> |
|
|
|
<input type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" /> |
|
|
|
<input type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" /> |
|
|
|
<button |
|
|
|
<button class="code" :disabled="disabled" :class="disabled === true ? 'on' : ''" |
|
|
|
class="code" |
|
|
|
@click="code">{{ text }}</button> |
|
|
|
:disabled="disabled" |
|
|
|
|
|
|
|
:class="disabled === true ? 'on' : ''" |
|
|
|
|
|
|
|
@click="code" |
|
|
|
|
|
|
|
>{{ text }}</button> |
|
|
|
|
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="item"> |
|
|
|
<view class="item"> |
|
|
@ -99,6 +83,7 @@ |
|
|
|
<input type="password" placeholder="填写您的登录密码" v-model="password" /> |
|
|
|
<input type="password" placeholder="填写您的登录密码" v-model="password" /> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<!-- #ifndef H5 --> |
|
|
|
<view class="item"> |
|
|
|
<view class="item"> |
|
|
|
<view> |
|
|
|
<view> |
|
|
|
<!-- <svg class="icon" aria-hidden="true"> |
|
|
|
<!-- <svg class="icon" aria-hidden="true"> |
|
|
@ -107,6 +92,8 @@ |
|
|
|
<input type="text" placeholder="输入邀请码" v-model="inviteCode" /> |
|
|
|
<input type="text" placeholder="输入邀请码" v-model="inviteCode" /> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<!-- #endif --> |
|
|
|
|
|
|
|
|
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="logon" @click="register">注册</view> |
|
|
|
<view class="logon" @click="register">注册</view> |
|
|
|
<view class="tip"> |
|
|
|
<view class="tip"> |
|
|
@ -114,25 +101,37 @@ |
|
|
|
<text @click="formItem = 1" class="font-color-red">立即登录</text> |
|
|
|
<text @click="formItem = 1" class="font-color-red">立即登录</text> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="bottom"></view> |
|
|
|
|
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
<script> |
|
|
|
<script> |
|
|
|
import sendVerifyCode from "@/mixins/SendVerifyCode"; |
|
|
|
import sendVerifyCode from "@/mixins/SendVerifyCode"; |
|
|
|
import { login, loginMobile, registerVerify, register } from "@/api/user"; |
|
|
|
import { |
|
|
|
import attrs, { required, alpha_num, chs_phone } from "@/utils/validate"; |
|
|
|
login, |
|
|
|
import { validatorDefaultCatch } from "@/utils/dialog"; |
|
|
|
loginMobile, |
|
|
|
import dayjs from "dayjs"; |
|
|
|
registerVerify, |
|
|
|
import cookie from "@/utils/store/cookie"; |
|
|
|
register |
|
|
|
|
|
|
|
} from "@/api/user"; |
|
|
|
|
|
|
|
import attrs, { |
|
|
|
|
|
|
|
required, |
|
|
|
|
|
|
|
alpha_num, |
|
|
|
|
|
|
|
chs_phone |
|
|
|
|
|
|
|
} from "@/utils/validate"; |
|
|
|
|
|
|
|
import { |
|
|
|
|
|
|
|
validatorDefaultCatch |
|
|
|
|
|
|
|
} from "@/utils/dialog"; |
|
|
|
|
|
|
|
import dayjs from "dayjs"; |
|
|
|
|
|
|
|
import cookie from "@/utils/store/cookie"; |
|
|
|
|
|
|
|
|
|
|
|
import { handleGetUserInfo } from "@/utils"; |
|
|
|
import { |
|
|
|
|
|
|
|
handleGetUserInfo |
|
|
|
|
|
|
|
} from "@/utils"; |
|
|
|
|
|
|
|
|
|
|
|
const BACK_URL = "login_back_url"; |
|
|
|
const BACK_URL = "login_back_url"; |
|
|
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
export default { |
|
|
|
name: "Login", |
|
|
|
name: "Login", |
|
|
|
mixins: [sendVerifyCode], |
|
|
|
mixins: [sendVerifyCode], |
|
|
|
data: function() { |
|
|
|
data: function () { |
|
|
|
return { |
|
|
|
return { |
|
|
|
navList: ["账号登录"], |
|
|
|
navList: ["账号登录"], |
|
|
|
current: 0, |
|
|
|
current: 0, |
|
|
@ -147,7 +146,10 @@ export default { |
|
|
|
methods: { |
|
|
|
methods: { |
|
|
|
async loginMobile() { |
|
|
|
async loginMobile() { |
|
|
|
var that = this; |
|
|
|
var that = this; |
|
|
|
const { account, captcha } = that; |
|
|
|
const { |
|
|
|
|
|
|
|
account, |
|
|
|
|
|
|
|
captcha |
|
|
|
|
|
|
|
} = that; |
|
|
|
try { |
|
|
|
try { |
|
|
|
await that |
|
|
|
await that |
|
|
|
.$validator({ |
|
|
|
.$validator({ |
|
|
@ -179,7 +181,7 @@ export default { |
|
|
|
}) |
|
|
|
}) |
|
|
|
.catch(err => { |
|
|
|
.catch(err => { |
|
|
|
uni.showToast({ |
|
|
|
uni.showToast({ |
|
|
|
title: err.msg || err.response.data.msg|| err.response.data.message, |
|
|
|
title: err.msg || err.response.data.msg || err.response.data.message, |
|
|
|
icon: "none", |
|
|
|
icon: "none", |
|
|
|
duration: 2000 |
|
|
|
duration: 2000 |
|
|
|
}); |
|
|
|
}); |
|
|
@ -187,7 +189,11 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
async register() { |
|
|
|
async register() { |
|
|
|
var that = this; |
|
|
|
var that = this; |
|
|
|
const { account, captcha, password } = that; |
|
|
|
const { |
|
|
|
|
|
|
|
account, |
|
|
|
|
|
|
|
captcha, |
|
|
|
|
|
|
|
password |
|
|
|
|
|
|
|
} = that; |
|
|
|
try { |
|
|
|
try { |
|
|
|
await that |
|
|
|
await that |
|
|
|
.$validator({ |
|
|
|
.$validator({ |
|
|
@ -230,7 +236,7 @@ export default { |
|
|
|
}) |
|
|
|
}) |
|
|
|
.catch(err => { |
|
|
|
.catch(err => { |
|
|
|
uni.showToast({ |
|
|
|
uni.showToast({ |
|
|
|
title: err.msg || err.response.data.msg|| err.response.data.message, |
|
|
|
title: err.msg || err.response.data.msg || err.response.data.message, |
|
|
|
icon: "none", |
|
|
|
icon: "none", |
|
|
|
duration: 2000 |
|
|
|
duration: 2000 |
|
|
|
}); |
|
|
|
}); |
|
|
@ -238,7 +244,9 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
async code() { |
|
|
|
async code() { |
|
|
|
var that = this; |
|
|
|
var that = this; |
|
|
|
const { account } = that; |
|
|
|
const { |
|
|
|
|
|
|
|
account |
|
|
|
|
|
|
|
} = that; |
|
|
|
try { |
|
|
|
try { |
|
|
|
await that |
|
|
|
await that |
|
|
|
.$validator({ |
|
|
|
.$validator({ |
|
|
@ -268,17 +276,20 @@ export default { |
|
|
|
}) |
|
|
|
}) |
|
|
|
.catch(err => { |
|
|
|
.catch(err => { |
|
|
|
uni.showToast({ |
|
|
|
uni.showToast({ |
|
|
|
title: err.msg || err.response.data.msg|| err.response.data.message, |
|
|
|
title: err.msg || err.response.data.msg || err.response.data.message, |
|
|
|
icon: "none", |
|
|
|
icon: "none", |
|
|
|
duration: 2000 |
|
|
|
duration: 2000 |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
navTap: function(index) { |
|
|
|
navTap: function (index) { |
|
|
|
this.current = index; |
|
|
|
this.current = index; |
|
|
|
}, |
|
|
|
}, |
|
|
|
async submit() { |
|
|
|
async submit() { |
|
|
|
const { account, password } = this; |
|
|
|
const { |
|
|
|
|
|
|
|
account, |
|
|
|
|
|
|
|
password |
|
|
|
|
|
|
|
} = this; |
|
|
|
try { |
|
|
|
try { |
|
|
|
await this.$validator({ |
|
|
|
await this.$validator({ |
|
|
|
account: [ |
|
|
|
account: [ |
|
|
@ -304,7 +315,9 @@ export default { |
|
|
|
password, |
|
|
|
password, |
|
|
|
spread: cookie.get("spread") |
|
|
|
spread: cookie.get("spread") |
|
|
|
}) |
|
|
|
}) |
|
|
|
.then(({ data }) => { |
|
|
|
.then(({ |
|
|
|
|
|
|
|
data |
|
|
|
|
|
|
|
}) => { |
|
|
|
this.$store.commit("login", data.token, dayjs(data.expires_time)); |
|
|
|
this.$store.commit("login", data.token, dayjs(data.expires_time)); |
|
|
|
handleGetUserInfo(); |
|
|
|
handleGetUserInfo(); |
|
|
|
// let replace=this.$yroute.query.replace |
|
|
|
// let replace=this.$yroute.query.replace |
|
|
@ -318,12 +331,12 @@ export default { |
|
|
|
.catch(err => { |
|
|
|
.catch(err => { |
|
|
|
console.log(err); |
|
|
|
console.log(err); |
|
|
|
uni.showToast({ |
|
|
|
uni.showToast({ |
|
|
|
title: err.msg || err.response.data.msg|| err.response.data.message, |
|
|
|
title: err.msg || err.response.data.msg || err.response.data.message, |
|
|
|
icon: "none", |
|
|
|
icon: "none", |
|
|
|
duration: 2000 |
|
|
|
duration: 2000 |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
</script> |
|
|
|
</script> |
|
|
|