From ac723f3c059690898e3283dc5ca6c4a1277ef03b Mon Sep 17 00:00:00 2001 From: educoder_weapp Date: Sat, 19 Oct 2019 20:58:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E4=BA=86=E4=B8=80=E4=B8=AA=E5=B0=8F?= =?UTF-8?q?=E6=BC=8F=E6=B4=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model/user.js | 4 +++- pages/classes/classes.js | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/model/user.js b/model/user.js index 5421420..47db961 100644 --- a/model/user.js +++ b/model/user.js @@ -1,3 +1,5 @@ +const AV = require("../lib/av-live-query-weapp-min") + function login() { return AV.Promise.resolve(AV.User.current()).then(user => user ? (user.isAuthenticated().then(authed => authed ? user : null)) : null @@ -6,4 +8,4 @@ function login() { })).catch(error => console.error(error.message)); } -module.exports=login; \ No newline at end of file +module.exports = login; \ No newline at end of file diff --git a/pages/classes/classes.js b/pages/classes/classes.js index 85c06ee..aa29363 100644 --- a/pages/classes/classes.js +++ b/pages/classes/classes.js @@ -1,5 +1,5 @@ const { Class } = require("../../model/class"); -const { login } = require("../../model/user"); +const login = require("../../model/user"); const AV = require("../../lib/av-live-query-weapp-min.js"); const { jsonify } = require('../../utils/leancloudutils'); // pages/class/class.js @@ -37,7 +37,7 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { - + login(); }, /**