bayi 1 year ago
parent
commit
42832c80cc
3 changed files with 7 additions and 5 deletions
  1. 5 2
      app.js
  2. 1 1
      pages/invite/index.js
  3. 1 2
      pages/rankIntro/index.js

+ 5 - 2
app.js

@@ -36,7 +36,7 @@ App({
             let params = decodeURIComponent(query.scene).split('&')
             if (params.length == 1) {
                 this.login(params[0])
-            }else{
+            } else {
                 this.login()
             }
         } else {
@@ -55,13 +55,16 @@ App({
                 getApp().callBack();
             }
         } else {
+            console.log(shareUid, 'shareUid');
             wx.login({
                 success: async (res) => {
                     if (res.code) {
                         // 获取openid
                         let data = {
                             code: res.code,
-                            shareUid
+                        }
+                        if (shareUid != 'undefined' && shareUid) {
+                            data.shareUid = shareUid
                         }
                         let userRes = await userLogin(data)
                         this.setUser(userRes.data)

+ 1 - 1
pages/invite/index.js

@@ -375,7 +375,7 @@ Page({
         const user = wx.getStorageSync('user');
         return {
             title: '自从用了它,家里朗朗书声,美妙极了!你家孩子也快来试试!',
-            path: `/pages/index/index?uid=${user.uid}`,
+            path: `/pages/index/index?uid=${wx.getStorageSync('uid')}`,
             imageUrl: 'http://reader-wx.ai160.com/images/reader/v3/375-300-1.jpg'
         }
     }

+ 1 - 2
pages/rankIntro/index.js

@@ -66,10 +66,9 @@ Page({
    * 用户点击右上角分享
    */
   onShareAppMessage() {
-    const user = wx.getStorageSync('user');
     return {
       title: '自从用了它,家里朗朗书声,美妙极了!你家孩子也快来试试!',
-      path: `/pages/index/index?uid=${user.uid}`,
+      path: `/pages/index/index?uid=${wx.getStorageSync('uid')}`,
       imageUrl: 'http://reader-wx.ai160.com/images/reader/v3/375-300-1.jpg'
     }
   }