Parcourir la source

feat: 推广链进入小程序;

qiansailong il y a 1 an
Parent
commit
e6d748393a
3 fichiers modifiés avec 7 ajouts et 6 suppressions
  1. 2 2
      app.js
  2. 1 1
      config/config.js
  3. 4 3
      pages/index/index.js

+ 2 - 2
app.js

@@ -34,7 +34,7 @@ App({
   },
 
   // 登录方法
-  login() {
+  login(promotionid) {
     return new Promise((resolve, reject) => {
 
       // 检查登录状态
@@ -54,7 +54,7 @@ App({
             "cusId": "",
             "inviter": "",
             "promotionId": "",
-            "inviterPromotionId": "",
+            "inviterPromotionId": promotionid,
             "system": "pc",
             "type": "inner",
             "inner": 1,

+ 1 - 1
config/config.js

@@ -61,7 +61,7 @@ const appInfoObj = {
 };
 
 // @config 确定使用的小程序appid
-const appid = 'wxdabfa5e02785fe9b';
+const appid = 'wxa7a33088566e1292';
 export const apple = {
     ...appInfoObj[appid],
     appKey: '49TBR8Z1rA7PyqD30FV0v48AU',

+ 4 - 3
pages/index/index.js

@@ -62,8 +62,9 @@ Page({
 
   onLoad(options) {
     console.log('入参options:', options)
+    const promotionid = parseInt(options.promotionid);
     this.interstitalLoad()
-    this.autoLogin();
+    this.autoLogin(promotionid);
     // 创建动画实例
     this.recentBookAnimator = wx.createAnimation({
       duration: 300,
@@ -194,7 +195,7 @@ Page({
   },
 
   // 自动登录
-  async autoLogin() {
+  async autoLogin(promotionid) {
     try {
       // 检查是否已经登录
       const token = wx.getStorageSync('accessToken');
@@ -210,7 +211,7 @@ Page({
       }
 
       // 未登录,执行登录
-      const res = await getApp().login();
+      const res = await getApp().login(promotionid);
       this.setData({
         isLoggedIn: true
       });