From ac04a119519dd7cd8ec6b54f7d702bcbd15ea52b Mon Sep 17 00:00:00 2001 From: chen <2659004835@qq.com> Date: Wed, 17 Aug 2022 09:32:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=88=B7=E6=96=B0token?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jsFile/tools.js | 19 ++++++++++--------- pagesA/my-course/my-course.vue | 13 ++++++------- pagesB/second-level/second-level.vue | 1 - 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/jsFile/tools.js b/jsFile/tools.js index af50144..4bfab03 100644 --- a/jsFile/tools.js +++ b/jsFile/tools.js @@ -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)//缓存用户邀请码 } } }) diff --git a/pagesA/my-course/my-course.vue b/pagesA/my-course/my-course.vue index 2988ca9..1614d07 100644 --- a/pagesA/my-course/my-course.vue +++ b/pagesA/my-course/my-course.vue @@ -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]; diff --git a/pagesB/second-level/second-level.vue b/pagesB/second-level/second-level.vue index 3dab113..8870645 100644 --- a/pagesB/second-level/second-level.vue +++ b/pagesB/second-level/second-level.vue @@ -61,7 +61,6 @@ }, onLoad(op) { this.levelIndex = op.level*1; - console.log(this.levelIndex); this.getExtend(); }, onReachBottom() {