Browse Source

推广素材

zhaoxiaohai 2 years ago
parent
commit
68c4f8e3d0
1 changed files with 13 additions and 6 deletions
  1. 13 6
      pages/promotional/details.js

+ 13 - 6
pages/promotional/details.js

@@ -29,19 +29,23 @@ Page({
             }
         };
         const res = isToken ? await _Http.basic(params) : await _Http.base(params);
-        if (res.msg != '成功') await _Http.base(params);
+        if (res.msg != '成功') res = await _Http.base(params);
         if (res.msg == '成功') {
             if (res.data.attinfos.length) res.data.attinfos = MFT.fileList(res.data.attinfos);
             this.setData({
                 detailsData: res.data
             });
-            //无状态弹窗
-            if (!isToken) Dialog.confirm({
+
+            //分享进入
+            if (wx.getLaunchOptionsSync().scene == 1154) {
+                this.addNew(false)
+            } else if ([1007, 1008].includes(wx.getLaunchOptionsSync().scene)) Dialog.confirm({
                     title: '提示',
-                    message: '帮助完善信息',
+                    message: '帮助完善信息',
                 })
                 .then(this.addNew)
                 .catch(this.addNew)
+
         } else {
             wx.showToast({
                 title: res.msg,
@@ -50,8 +54,9 @@ Page({
         }
     },
     /* 新增拉新用户 */
-    async addNew(id) {
-        let name = await new Promise((res, rej) => {
+    async addNew(gain = true) {
+        let name = '微信用户';
+        if (gain) name = await new Promise((res, rej) => {
             wx.getUserProfile({
                 desc: '用于完善用户资料',
                 success: ({
@@ -64,6 +69,7 @@ Page({
                 }
             })
         })
+
         let channel = null,
             that = this;
         switch (wx.getLaunchOptionsSync().scene) {
@@ -80,6 +86,7 @@ Page({
                 channel = '其他方式'
                 break;
         }
+
         wx.login({
             success(res) {
                 _Http.base({