You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
// logs.ts
|
|
|
|
|
// const util = require('../../utils/util.js')
|
|
|
|
|
// import { formatTime } from '../../utils/util'
|
|
|
|
|
|
|
|
|
|
Page({
|
|
|
|
|
data: {
|
|
|
|
|
userInfo: {},
|
|
|
|
|
key:{},
|
|
|
|
|
},
|
|
|
|
|
atLogin() {
|
|
|
|
|
wx.getUserProfile({
|
|
|
|
|
desc: '展示用户信息',
|
|
|
|
|
success: (res) => {
|
|
|
|
|
this.setData({
|
|
|
|
|
userInfo: res.userInfo,
|
|
|
|
|
})
|
|
|
|
|
// wx.setStorageSync("userInfo", res.userInfo);
|
|
|
|
|
wx.setStorage({
|
|
|
|
|
key:"userInfo",
|
|
|
|
|
data:this.data.userInfo,
|
|
|
|
|
// userInfo:res.userInfo,
|
|
|
|
|
encrypt: true, // 若开启加密存储,setStorage 和 getStorage 需要同时声明 encrypt 的值为 true
|
|
|
|
|
success() {
|
|
|
|
|
wx.getStorage({
|
|
|
|
|
key: "key",
|
|
|
|
|
encrypt: true, // 若开启加密存储,setStorage 和 getStorage 需要同时声明 encrypt 的值为 true
|
|
|
|
|
success(res) {
|
|
|
|
|
console.log(res.data)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
wx.login({
|
|
|
|
|
success: function(login_res){
|
|
|
|
|
if(login_res.code){
|
|
|
|
|
wx.request({
|
|
|
|
|
url:'http://192.168.58.210:81/atlogin',
|
|
|
|
|
method:'GET',
|
|
|
|
|
data:{
|
|
|
|
|
code:login_res.code,
|
|
|
|
|
},
|
|
|
|
|
success:function(res :any){
|
|
|
|
|
console.log(res)
|
|
|
|
|
let skey=res.data.skey
|
|
|
|
|
console.log(skey)
|
|
|
|
|
wx.setStorageSync('skey',skey)
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
}else{
|
|
|
|
|
console.log('登录失败!'+login_res.errMsg)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
onShow() {
|
|
|
|
|
const userInfo = wx.getStorageSync("userInfo");
|
|
|
|
|
if (userInfo!=null) return;
|
|
|
|
|
this.setData({
|
|
|
|
|
userInfo: userInfo,
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
onLoad() {
|
|
|
|
|
const userInfo = wx.getStorageSync("userInfo");
|
|
|
|
|
if (userInfo!=null) return;
|
|
|
|
|
this.setData({
|
|
|
|
|
userInfo: userInfo,
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
|