uni.showLoading()不显示,咋回事呀
而且,前面一开始用uni.showToast()的时候,只有提示创建成功的showToast执行了,提示正在创建的showToast就没有执行,这好嘛,我换成showLoading执行啥都不执行了
methods: {
async login (){
try {
let form = this.form
let newForm = Object.assign({},form)
let get = await request({url:`/login/get/accnum/${newForm.username}/${newForm.userpwd}`,method:'get'})
let token;
if(get.msg == 0) {
// 未注册,完成账号注册
uni.showLoading({
title:'正在创建新账号...',
mask:true
})
// uni.showToast({
// title:'正在创建新账号...',
// mask:true,
// image:'/static/favicon.png'
// })
let post = await request({url:'/login/post/accnum',method:'post',data:newForm})
token = post.token
uni.setStorageSync('token',token)
uni.hideLoading()
} else {
// 已有账号,且用户输入的账号密码已正确存在,实现登录
// uni.showToast({
// title:'创建成功登录中...',
// mask:true,
// image:'/static/favicon.png'
// })
uni.showLoading({
title:'创建成功登录中...',
mask:true
})
token = get.token
uni.setStorageSync('token',token)
uni.hideLoading()
}
} catch(err) {
console.log(err);
}
}
},