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(); }, /**