优化刷新token
parent
5fb3964ed4
commit
ac04a11951
|
@ -411,17 +411,18 @@ const tools = {
|
|||
success: (res)=> {
|
||||
var params = {code:res.code}
|
||||
uni.request({
|
||||
url: `${uni.getStorageSync('hostapi')}/api/user/login`,
|
||||
url: `${getApp().globalData.hostapi}/api/user/login`,
|
||||
method: 'post',
|
||||
data: params,
|
||||
success: res => {
|
||||
if(res.data.data.token!=''){
|
||||
uni.setStorageSync('token',res.data.data.token); // 缓存token
|
||||
uni.setStorageSync('openid',res.data.data.openid)//缓存openid
|
||||
uni.setStorageSync('expire',res.data.data.expire); // 缓存失效时间(时间戳格式)
|
||||
uni.setStorageSync('phone_active',res.data.data.phone_active); // 是否绑定手机号
|
||||
uni.setStorageSync('is_active',res.data.data.is_active)//是否第一次授权
|
||||
uni.setStorageSync('invite_code',res.data.data.invite_code)//缓存用户邀请码
|
||||
success: result => {
|
||||
if(result.data.data.token!=''){
|
||||
console.log('刷新了token');
|
||||
uni.setStorageSync('token',result.data.data.token); // 缓存token
|
||||
uni.setStorageSync('openid',result.data.data.openid)//缓存openid
|
||||
uni.setStorageSync('expire',result.data.data.expire); // 缓存失效时间(时间戳格式)
|
||||
uni.setStorageSync('phone_active',result.data.data.phone_active); // 是否绑定手机号
|
||||
uni.setStorageSync('is_active',result.data.data.is_active)//是否第一次授权
|
||||
uni.setStorageSync('invite_code',result.data.data.invite_code)//缓存用户邀请码
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
@ -35,12 +35,7 @@
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
dataList:[
|
||||
{imgsrc:'https://s6.jpg.cm/2022/02/14/L4oDhy.jpg',title:'思通造化随通而行为术基础动作教学思通造化随通而行为术基础动作教学',time:'2022.07.20 12:12:12',price:'199.00'},
|
||||
{imgsrc:'https://s6.jpg.cm/2022/02/14/L4oDhy.jpg',title:'思通造化随通而行为术基础动作教学思通造化随通而行为术基础动作教学',time:'2022.07.20 12:12:12',price:'199.00'},
|
||||
{imgsrc:'https://s6.jpg.cm/2022/02/14/L4oDhy.jpg',title:'思通造化随通而行为术基础动作教学思通造化随通而行为术基础动作教学',time:'2022.07.20 12:12:12',price:'199.00'},
|
||||
{imgsrc:'https://s6.jpg.cm/2022/02/14/L4oDhy.jpg',title:'思通造化随通而行为术基础动作教学思通造化随通而行为术基础动作教学',time:'2022.07.20 12:12:12',price:'199.00'},
|
||||
],
|
||||
dataList:[],
|
||||
page:1,
|
||||
size:20,
|
||||
total:0,
|
||||
|
@ -62,7 +57,11 @@
|
|||
// 获取课程列表
|
||||
getCouresList(){
|
||||
this.loading = false;
|
||||
this.$requst.get('/api/user/course').then(res=>{
|
||||
let params = {
|
||||
page:this.page,
|
||||
size:this.size
|
||||
}
|
||||
this.$requst.get('/api/user/course',params).then(res=>{
|
||||
this.total = res.data.total;
|
||||
if(this.page==1){this.dataList=[];}
|
||||
this.dataList = [...this.dataList,...res.data.list];
|
||||
|
|
|
@ -61,7 +61,6 @@
|
|||
},
|
||||
onLoad(op) {
|
||||
this.levelIndex = op.level*1;
|
||||
console.log(this.levelIndex);
|
||||
this.getExtend();
|
||||
},
|
||||
onReachBottom() {
|
||||
|
|
Loading…
Reference in New Issue