优化登录提示

This commit is contained in:
weipengfei 2023-07-25 15:53:06 +08:00
parent 6732dc1a90
commit 1dd8d2bba2
2 changed files with 13 additions and 19 deletions

View File

@ -13,18 +13,18 @@
itemStyle="padding-left: 15px; padding-right: 15px; height: 34px;font-size: 32rpx;"></u-tabs> itemStyle="padding-left: 15px; padding-right: 15px; height: 34px;font-size: 32rpx;"></u-tabs>
</view> </view>
<input v-if="current==0" class="mobile item" v-model="formData.account" placeholder="输入账号" /> <input v-if="current==0" class="mobile item" v-model="formData.account" placeholder="输入账号" />
<input v-if="current==0" class="mobile item" v-model="formData.password" placeholder="输入密码" password <input v-if="current==0" class="mobile item" v-model="formData.password" maxlength="26" placeholder="输入密码" password
type="safe-password" /> type="safe-password" />
<input v-if="current==1" class="mobile item" v-model="formData.account" placeholder="输入手机号" /> <input v-if="current==1" class="mobile item" v-model="formData.account" placeholder="输入手机号" />
<view v-if="current==1" class="code item"> <view v-if="current==1" class="code item">
<input placeholder="输入验证码" v-model="formData.code" /> <input placeholder="输入验证码" v-model="formData.code" maxlength="6" />
<u-code :seconds="seconds" @end="end" @start="start" ref="uCode" <u-code :seconds="seconds" @end="end" @start="start" ref="uCode"
@change="codeChange"></u-code> @change="codeChange"></u-code>
<view class="get-code" @click="getCode">{{tips}}</view> <view class="get-code" @click="getCode">{{tips}}</view>
</view> </view>
<view class="btn"> <view class="btn">
<!-- <view>新用户注册</view> --> <!-- <view>新用户注册</view> -->
<view>忘记密码?</view> <view @click="forgetPWD">忘记密码?</view>
</view> </view>
</view> </view>
<button class="submit_btn" @click="login">登录</button> <button class="submit_btn" @click="login">登录</button>
@ -34,7 +34,7 @@
</template> </template>
<script> <script>
import { loginAccount, userInfo, test } from "@/api/oaUser.js" import { loginAccount, userInfo, test } from "@/api/oaUser.js"
import { Toast } from "../../libs/uniApi"; import { Toast } from "../../libs/uniApi";
export default { export default {
data() { data() {
@ -64,6 +64,9 @@ import { Toast } from "../../libs/uniApi";
let that = this; let that = this;
// let res = await test(); // let res = await test();
// console.log(res); // console.log(res);
uni.showLoading({
title:'正在登录中'
})
let res = await loginAccount(that.formData); let res = await loginAccount(that.formData);
this.$store.commit('SET_USERINFO', { this.$store.commit('SET_USERINFO', {
user: data, user: data,
@ -71,24 +74,10 @@ import { Toast } from "../../libs/uniApi";
}) })
let { data } = await userInfo(); let { data } = await userInfo();
this.$store.commit('setUserInfo', data); this.$store.commit('setUserInfo', data);
uni.hideLoading()
uni.switchTab({ uni.switchTab({
url: '/pages/oaHome/oaHome' url: '/pages/oaHome/oaHome'
}) })
// uni.request({
// url: 'https://worker-task.lihaink.cn/api/login/account',
// method: 'POST',
// data: {
// account: 'admin123',
// terminal: '3',
// scene: '1',
// password: 'qq123456'
// },
// success: (res) => {
// console.log(res);
// this.res = res.data.m
// }
// })
}, },
initTerminal() { initTerminal() {
// #ifndef APP-PLUS // #ifndef APP-PLUS
@ -138,6 +127,10 @@ import { Toast } from "../../libs/uniApi";
}, },
start() { start() {
// uni.$u.toast(''); // uni.$u.toast('');
},
//
forgetPWD(){
Toast('暂未开放')
} }
}, },
mounted() { mounted() {

View File

@ -68,6 +68,7 @@ function baseRequestTwo(url, method, data, {
}) })
reject(res.data); reject(res.data);
} else { } else {
uni.hideLoading();
uni.showToast({ uni.showToast({
title: res.data.msg || '请检查网络', title: res.data.msg || '请检查网络',
icon: 'none' icon: 'none'