function VerifyLogin() {
    return new Promise((resolve, reject) => {
     
        uni.getStorage({
            key: "userinfo",
            success: (res) => {
                if (res.data) {
                    if (res.data.nickName) {
                        resolve(true);
                    } else {
                        uni.setStorageSync("lastPage", getCurrentPages()[getCurrentPages().length - 1].route);
                        uni.reLaunch({ url: "/pages/UserInformation/UserInformation" });
                        resolve(false);
                    }
                } else {
                    uni.setStorageSync("lastPage", getCurrentPages()[getCurrentPages().length - 1].route);
                    uni.navigateTo({ url: '/pages/login/login' });
                    resolve(false);
                }
            },
            fail: (err) => {
                console.error("获取用户信息失败", err);
                uni.setStorageSync("lastPage", getCurrentPages()[getCurrentPages().length - 1].route);
                uni.navigateTo({ url: '/pages/login/login' });
                reject(err);
            }
        });
    });
}

export default VerifyLogin;
