diff --git a/pages/login/index.js b/pages/login/index.js index 040b13a..68f128d 100644 --- a/pages/login/index.js +++ b/pages/login/index.js @@ -1,4 +1,7 @@ // pages/login/index.js +import { + api +} from '../../utils/api.js' Page({ /** @@ -29,6 +32,21 @@ Page({ return } console.log(e); + const data = {code:e.detail.code} + + api("/auth/getPhone", 'GET', data).then(res => { + wx.hideLoading() + if (res.code === 200) { + wx.setStorageSync('user', res.data) + wx.setStorageSync('token', res.data.token) + wx.navigateBack() + } else { + wx.showToast({ + icon: 'error', + title: res.msg + }) + } + }) }, change(e){ const tmp = this.data.checked === false