// pages/loading/loading.js const $api = require('../../utils/api').API; import Dialog from '@vant/weapp/dialog/dialog'; const $app = getApp(); Page({ /** * 页面的初始数据 */ data: { }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { //测试版本更新 const updateManager = wx.getUpdateManager() updateManager.onCheckForUpdate(function (res) { // 请求完新版本信息的回调 console.log(res,'是否打印?'); }) updateManager.onUpdateReady(function () { wx.showModal({ title: '更新提示', content: '新版本已经准备好,是否重启应用?', success: function (res) { if (res.confirm) { // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启 updateManager.applyUpdate() } } }) }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { //登录 const _this = this; wx.login({ success: res => { $api.getUserInfo({ "loginName": "erds", "password": "123456", }).then(obj => { if (obj.code === 0){ wx.reLaunch({ url: '/pages/evaluation/evaluation' }); } }).catch(err => { Dialog.alert({ message:'服务器错误:404,请联系管理员!' }) }) }, }) }, /** * 生命周期函数--监听页面显示 */ onShow() { }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, /** * 用户点击右上角分享 */ onShareAppMessage() { } })