开始做登录

This commit is contained in:
2024-03-15 17:20:54 +08:00
parent b9335b4ff8
commit 633cff358d
1423 changed files with 35817 additions and 19 deletions

View File

@@ -1,3 +1,6 @@
import { login } from "../../service/user"
import { alertError, loadingFunc, wxLogin } from "../../utils/index"
import { OK } from "../../utils/request"
// pages/login/index.js
Page({
@@ -21,7 +24,23 @@ Page({
onReady() {
},
onClose() {
wx.exitMiniProgram()
},
onConfirm() {
this.handleLogin()
},
async handleLogin() {
loadingFunc(async () => {
const wxLoginCode = await wxLogin()
const { code, message, data } = await login({ code: wxLoginCode })
if (code !== OK) {
alertError(message)
return
}
console.log('data', data)
})
},
/**
* 生命周期函数--监听页面显示
*/