1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
| let app = getApp() Page({
data: { show: true, list: [] }, qin(){ wx.clearStorage() wx.reLaunch({ url: '/pages/wd/wd', }) }, getUserInfo(e) { if(!e.detail.userInfo){ wx.showToast({ title: '已取消', icon:'nane' }) return false } let _that=this wx.login({ success(req) { app.http.logines(req.code).then(res => { wx.setStorageSync('token', res.data.data.token) _that.login() }) } }) }, login(){ app.http.delet(wx.getStorageSync('token')).then(res => { if(res.data.code==2000){ this.setData({ show:true }) }else{ this.setData({ list:res.data.data.base, show:false }) } }) }, onLoad: function () { if(wx.getStorageSync('token')){ this.login() this.setData({ show:false }) }else{ this.setData({ show:true }) } }, tuei(){ app.http.onlogin(wx.getStorageSync('token')).then(res=>{ if(res.code==0){ thiswx.removeStorageSync('token') this.setData({ show:true }) } }) wx.reLaunch({ url: '/pages/wd/wd', }) } })
|