|
@@ -22,6 +22,9 @@
|
|
|
<script>
|
|
<script>
|
|
|
let countDown = null;
|
|
let countDown = null;
|
|
|
import { hexMD5 } from "./md5";
|
|
import { hexMD5 } from "./md5";
|
|
|
|
|
+import { CheckPhoneNumber } from "../../../utils/basicInspection";
|
|
|
|
|
+import { loginMsg } from "./dispose";
|
|
|
|
|
+
|
|
|
export default {
|
|
export default {
|
|
|
name: "Phone",
|
|
name: "Phone",
|
|
|
data() {
|
|
data() {
|
|
@@ -39,18 +42,31 @@ export default {
|
|
|
/* 获取验证码 */
|
|
/* 获取验证码 */
|
|
|
getAuthcode() {
|
|
getAuthcode() {
|
|
|
if (this.butText == '获取验证码' || this.butText == '重新获取') {
|
|
if (this.butText == '获取验证码' || this.butText == '重新获取') {
|
|
|
- var count = 30;
|
|
|
|
|
- this.butText = count + 's';
|
|
|
|
|
- countDown = setInterval(() => {
|
|
|
|
|
- if (count == 0) {
|
|
|
|
|
- clearInterval(countDown);
|
|
|
|
|
- this.butText = '重新获取';
|
|
|
|
|
- } else {
|
|
|
|
|
- count = count - 1;
|
|
|
|
|
- this.butText = count + 's';
|
|
|
|
|
- }
|
|
|
|
|
- }, 1000)
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (!CheckPhoneNumber(this.phoneNumber, '请输入正确的手机号码')) return;
|
|
|
|
|
+ this.$Http.getpassword({
|
|
|
|
|
+ "phonenumber": this.phoneNumber,
|
|
|
|
|
+ "systemclient": "wechat"
|
|
|
|
|
+ }).then(res => {
|
|
|
|
|
+ console.log("获取验证码", res)
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ title: res.msg,
|
|
|
|
|
+ duration: 3000,
|
|
|
|
|
+ icon: "none",
|
|
|
|
|
+ });
|
|
|
|
|
+ if (res.code == 0) return;
|
|
|
|
|
+ var count = 30;
|
|
|
|
|
+ this.butText = count + 's';
|
|
|
|
|
+ countDown = setInterval(() => {
|
|
|
|
|
+ if (count == 0) {
|
|
|
|
|
+ clearInterval(countDown);
|
|
|
|
|
+ this.butText = '重新获取';
|
|
|
|
|
+ } else {
|
|
|
|
|
+ count = count - 1;
|
|
|
|
|
+ this.butText = count + 's';
|
|
|
|
|
+ }
|
|
|
|
|
+ }, 1000)
|
|
|
|
|
+ });
|
|
|
|
|
+ };
|
|
|
},
|
|
},
|
|
|
/* 输入框输入内容 */
|
|
/* 输入框输入内容 */
|
|
|
onInput(e) {
|
|
onInput(e) {
|
|
@@ -58,12 +74,33 @@ export default {
|
|
|
},
|
|
},
|
|
|
/* 开始登录 */
|
|
/* 开始登录 */
|
|
|
startLogging() {
|
|
startLogging() {
|
|
|
|
|
+ if (this.loading) return;
|
|
|
|
|
+ if (!CheckPhoneNumber(this.phoneNumber, '请输入正确的手机号码')) return;
|
|
|
|
|
+ if (this.password == "") return uni.showToast({
|
|
|
|
|
+ title: '还未填写验证码',
|
|
|
|
|
+ duration: 2000,
|
|
|
|
|
+ icon: "none",
|
|
|
|
|
+ });
|
|
|
this.loading = true;
|
|
this.loading = true;
|
|
|
- uni.setStorageSync("loginMethod", 'phone');
|
|
|
|
|
- uni.setStorageSync("phoneNumber", this.phoneNumber);
|
|
|
|
|
- setTimeout(() => {
|
|
|
|
|
|
|
+ this.$Http.login({
|
|
|
|
|
+ "phonenumber": this.phonenumber,
|
|
|
|
|
+ "password": hexMD5(this.password),
|
|
|
|
|
+ "systemclient": "wechat"
|
|
|
|
|
+ }).then(res => {
|
|
|
|
|
+ console.log("验证码登录", res)
|
|
|
this.loading = false;
|
|
this.loading = false;
|
|
|
- }, 1000)
|
|
|
|
|
|
|
+ if (res.code == 0) {
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ title: res.msg,
|
|
|
|
|
+ duration: 2000,
|
|
|
|
|
+ icon: "none"
|
|
|
|
|
+ });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ uni.setStorageSync("phoneNumber", this.phoneNumber);
|
|
|
|
|
+ uni.setStorageSync("loginMethod", 'phone');
|
|
|
|
|
+ loginMsg(res.account_list)
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|