用户接口对接

This commit is contained in:
仲么了
2023-03-20 08:51:21 +08:00
parent c5ed54924b
commit c308a7131b
10 changed files with 284 additions and 110 deletions

View File

@@ -3,7 +3,7 @@
<view slot="body">
<view class="login">
<view class="login-title">登录</view>
<view class="login-des">{{ companyName }}</view>
<view class="login-des">灿能物联</view>
<view class="login-box">
<!-- <image class="login-box-logo" mode="widthFix" src="/static/logo.png"></image> -->
<image class="login-box-logo" mode="widthFix" src="/static/logo.png"></image>
@@ -24,7 +24,7 @@
</template>
<template v-else>
<view class="login-box-input mt100">
<input class="login-box-input-main" v-model="pwdForm.account" placeholder="请输入账号" />
<input class="login-box-input-main" v-model="pwdForm.phone" placeholder="请输入账号" />
</view>
<view class="login-box-input mt40">
<input type="password" class="login-box-input-main" v-model="pwdForm.pwd" placeholder="请输入密码" />
@@ -62,7 +62,7 @@ export default {
loading: false,
loginType: 'pwd',
pwdForm: {
account: '',
phone: '',
pwd: '',
imgCode: '',
},
@@ -79,23 +79,31 @@ export default {
},
components: {},
methods: {
async getCode () {
getCode () {
if (!this.yzmForm.phone) {
return this.$util.toast('请输入手机号!')
}
const res = await apiGetYms({
uni.showLoading({
title: '请稍等'
})
apiGetYms({
phone: this.yzmForm.phone,
type: 0,
}).then(res => {
uni.hideLoading()
console.log(res);
this.waitTime = 60
this.inter = setInterval(() => {
if (this.waitTime == 0) {
clearInterval(this.inter)
} else {
this.waitTime--
}
}, 1000)
}).catch(err => {
uni.hideLoading()
console.log(err);
})
console.log(res);
this.waitTime = 60
this.inter = setInterval(() => {
if (this.waitTime == 0) {
clearInterval(this.inter)
} else {
this.waitTime--
}
}, 1000)
},
login () {
console.log(this.loginType);
@@ -106,17 +114,12 @@ export default {
}
},
pwdLogin () {
console.log({
phone: this.yzmForm.phone,
key: this.yzmForm.pwd,
type: 1,
})
if (!this.pwdForm.account && !this.pwdForm.pwd) {
if (!this.pwdForm.phone && !this.pwdForm.pwd) {
return this.$util.toast('请填写登录信息!')
}
apiLogin({
phone: this.yzmForm.phone,
key: this.yzmForm.pwd,
phone: this.pwdForm.phone,
key: this.pwdForm.pwd,
type: 1,
}).then(res => {
console.log(res);