123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- Page({
- data: {
- userInfo: null,
- },
- // 登录
- goLogin() {
- my.navigateTo({
- url: '/pages/login/index',
- })
- },
- // 用户信息
- handeleGetInfo() {
- let userInfo = my.getStorageSync({ key: "userInfo" });
- this.setData({
- userInfo: userInfo.data
- })
- },
- // 退出登录
- async loginOut() {
- let that = this;
- my.showToast({
- type: 'none',
- content: "操作成功",
- duration: 800,
- mask: true,
- success: function () {
- setTimeout(function () {
- that.setData({
- userInfo: null
- });
- my.removeStorageSync({ key: 'userInfo' });
- // 清除所有缓存数据
- my.clearStorageSync();
- my.navigateTo({
- url: '/pages/login/index',
- })
- }, 800);
- }
- });
- },
- // 头像预览
- preview(event) {
- let currentUrl = event.currentTarget.dataset.src
- wx.previewImage({
- current: currentUrl, // 当前显示图片的http链接
- urls: [currentUrl] // 需要预览的图片http链接列表
- })
- },
- onLoad() { },
- onShow() {
- this.handeleGetInfo()
- },
- });
|