From c42ae18cd4f05c7e56da237495f97e9e9b69013e Mon Sep 17 00:00:00 2001 From: zhangkai <847704969@qq.com> Date: Fri, 16 May 2025 18:41:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=A4=9C=E6=A0=A1=E6=8E=A5?= =?UTF-8?q?=E6=B4=BB=E5=8A=A8=E8=B7=B3=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 53 ++++++++++++++++++++++++++++++++++++++++++- manifest.json | 2 +- pages/index/index.vue | 5 ++-- 3 files changed, 55 insertions(+), 5 deletions(-) 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: { // 获取胶囊高度