// pages/setuplevel/index.js const api = require('../../api/index.js'); Page({ /** * 页面的初始数据 */ data: { currentSize:'' }, signout(){ wx.showModal({ title: '提示', content: '确定退出吗?', success (res) { if (res.confirm) { wx.clearStorage({ success: function() { wx.showToast({ title: '退出成功', icon: 'success' }); } }); wx.navigateTo({ url: '/pages/login/index', // 登录页面的路径,注意路径前面加上 '/' 表示从根目录开始 }); } else if (res.cancel) { console.log('用户点击取消') } } }) }, clearCache: function() { wx.showModal({ title: '提示', content: '确定清理缓存?', success (res) { if (res.confirm) { wx.clearStorage({ success: function() { wx.showToast({ title: '缓存清除成功', icon: 'success' }); wx.navigateTo({ url: '/pages/login/index', // 登录页面的路径,注意路径前面加上 '/' 表示从根目录开始 }); } }); } else if (res.cancel) { console.log('用户点击取消') } } }) }, onuser(){ wx.showToast({ title: '暂未开放', icon: 'none' }); return wx.navigateTo({ url: '/pages/user/index', // 登录页面的路径,注意路径前面加上 '/' 表示从根目录开始 }); }, onIconTap(){ }, onprivacy(e){ console.log(e); wx.navigateTo({ url: `/pages/privacy/index?name=${e.currentTarget.dataset.name}`, }) }, onaccountnumber(){ wx.showToast({ title: '暂未开放', icon: 'none' }); return wx.navigateTo({ url: '/pages/account/index', // 登录页面的路径,注意路径前面加上 '/' 表示从根目录开始 }); }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { let _this =this wx.getStorageInfo({ success: function(res) { _this.setData({ currentSize:res.currentSize }) // console.log(res.currentSize); // 当前占用的空间大小,单位:字节 // console.log(res.limitSize); // 空间限制的大小,单位:字节 } }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ onShow() { }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, /** * 用户点击右上角分享 */ onShareAppMessage() { } })