diff --git a/App.vue b/App.vue index 0555679..8cac992 100644 --- a/App.vue +++ b/App.vue @@ -7,7 +7,10 @@ this.updateManager(); }, - onShow: function() { + onShow: function(options) { + if(options?.referrerInfo?.extraData){ + this.getDyqc(options.referrerInfo.extraData); + } console.log('App Show') }, onHide: function() { @@ -51,6 +54,54 @@ }) } }, + //获取多样青春的跳转参数 + getDyqc(extraData){ + uni.$u.http.post('/api/user/activityMiniLogin', extraData).then(res => { + if (res.code == 1) { + uni.setStorageSync('token', res.data.userinfo.token) + this.getUserInfo(); + } else { + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }) + uni.clearStorageSync(); + + } + }).catch(error => { + console.log('error', error); + }); + }, + // 获取个人信息 + getUserInfo() { + uni.$u.http.get('/api/user/index', {}).then(res => { + if (res.code == 1) { + uni.setStorageSync('userInfo', res.data.user_info); + uni.showToast({ + title: '登陆成功', + icon: 'none', + duration: 2000 + }) + uni.setStorageSync("niName", res.data.user_info.nickname); + } else { + uni.showToast({ + title: '登陆失败', + icon: 'error', + duration: 2000 + }) + } + + }).catch(error => { + console.log('error', error); + + uni.showToast({ + title: '登陆失败', + icon: 'error', + duration: 2000 + }) + }) + }, } } diff --git a/manifest.json b/manifest.json index 56ee5e1..b578a5e 100644 --- a/manifest.json +++ b/manifest.json @@ -1,6 +1,6 @@ { "name" : "多样青春", - "appid" : "__UNI__ABEB145", + "appid" : "__UNI__1F083BC", "description" : "", "versionName" : "1.0.0", "versionCode" : "100", diff --git a/pages/index/index.vue b/pages/index/index.vue index e51476b..93426df 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -14,7 +14,7 @@ - + @@ -227,11 +227,10 @@ this.getinit() this.getHotList() this.getTeacherList() - this.getWqList() + this.getWqList(); }, beforeDestroy() { this.autoplay = false - }, methods: { // 获取胶囊高度