import {request} from "../../request/index";
Page({
data: {
user: {
account: "",
password: ""
}
},
changeValue(e) {
let property = "user." + e.target.dataset.label
let value = e.detail.value
this.setData({
[property]: value
})
},
userLogin() {
wx.showLoading({
title: "正在努力加载中",
mask: false
})
request("/user/login", this.data.user).then(res => {
console.log(res)
wx.hideLoading()
let icon = "error"
if (res.data.code === 200) {
icon = "success"
}
wx.showToast({
title: res.data.message,
icon
})
}).catch(res => {
console.error(res)
wx.hideLoading()
})
}
})
评论5