Quellcode durchsuchen

联调好友邀请活动接口

t_finder vor 1 Monat
Ursprung
Commit
2a9704ae59

+ 2 - 2
api/message/phone.js

@@ -1,2 +1,2 @@
-export const sendSmsCode = ({ $axios }, data) =>
-  $axios.$post('/message/v5/phone/send', data);
+export const sendSmsCode = ({ $axios }, data, config) =>
+  $axios.$post('/message/v5/phone/send', data, config);

+ 2 - 2
api/user/client.js

@@ -1,2 +1,2 @@
-export const registerForInvite = ({ $axios }, data) =>
-  $axios.$post('/user/v5/client/register/forLachineH5', data);
+export const registerForInvite = ({ $axios }, data, config) =>
+  $axios.$post('/user/v5/client/register/forLachineH5', data, config);

+ 7 - 5
pages/activity/invite-user/components/layout.vue

@@ -115,17 +115,19 @@ export default {
         this.$emit('goBack');
         return;
       }
+
       // 如果为true是最前一页
       if (this.isGoBack) {
         if(this.isApp && this.isAndroid) {
-          window.native.backClick();
+          return window.native.backClick();
         }else if(this.isApp && this.isIos) {
-          window.webkit.messageHandlers.appGoBack.postMessage({})
-        }else {
-          this.$router.go(-1)
+          return window.webkit.messageHandlers.appGoBack.postMessage({});
         }
       }
-    },// 退出相关逻辑
+
+      // 浏览器返回上一页
+      this.$router.go(-1);
+    },
   },
 };
   </script>

+ 5 - 1
pages/activity/invite-user/invite-new-user.vue

@@ -150,7 +150,7 @@ export default {
     await this.getInviteRecordList();
     await this.getInviteBuyRecordList();
     await this.getInviteWithdrawalRecordList();
-    await this.getActivityRule(this.queryData.activityId);
+    // await this.getActivityRule(this.queryData.activityId);
   },
   computed: {
     // 是否为微信浏览器环境
@@ -192,6 +192,7 @@ export default {
         inviteBuyAmount, // 累计邀请金额
         activityId, // 活动ID
         accumulatedWithdrawal, // 累计提现金额
+        jumpAddress, // 分享的链接
       } = res.data;
 
       // 页面展示数据
@@ -202,6 +203,9 @@ export default {
       this.accumulatedWithdrawal = accumulatedWithdrawal;
       // 查询参数
       this.queryData.activityId = activityId;
+      jumpAddress;
+      // 生成二维码的文本
+      this.qrText = jumpAddress;
     },
     // 获取活动页好友注册记录列表
     async getInviteRecordList() {

+ 17 - 19
pages/activity/invite-user/invite-passive-user.vue

@@ -3,7 +3,7 @@
     <!-- 微信环境提示浏览器打开 -->
     <WxPopTpis v-if="isWeChatBrowser" />
     
-    <div class="padssive">
+    <div class="padssive" v-else>
       <div class="bg-top-img-wrap" align="right">
         <img class="bg-top-img" src="~assets/image/activity/invite-user/invite-passive-user/bg.png" />
       </div>
@@ -131,7 +131,7 @@
         </div>
 
         <div class="tips">
-          通过登录即可完成注册,成为我们的新用户,登录后表示同意双子星云手机服务协议
+          通过登录即可完成注册,成为我们的新用户,登录后表示同意云手机客户端服务协议
         </div>
       </div>
     </div>
@@ -139,7 +139,6 @@
 </template>
 
 <script>
-import CallApp from 'callapp-lib';
 import { registerForInvite } from '~/api/user/client.js';
 import { sendSmsCode } from '~/api/message/phone.js';
 import WxPopTpis from './components/WxPopTpis';
@@ -154,9 +153,11 @@ export default {
   fetch() {
     this.form.invitationUserName = this.$route.query.invitationUserName;
     this.form.activityId = this.$route.query.activityId;
+    this.merchantSign = this.$route.query.merchantSign;
   },
   data() {
     return {
+      merchantSign: '', // 商户标识
       form: {
         phone: '', // 手机号
         code: '', // 验证码
@@ -191,9 +192,9 @@ export default {
         // 校验通过
         let {msg} = await sendSmsCode(this, {
           type: 'common',
-          authorizationType: 5,
+          // authorizationType: 7, // 登录类型
           phone: this.form.phone,
-        });
+        },{ headers: { merchantSign: this.merchantSign }});
 
         this.codeObj.isFinish = false;
         this.$refs.countDown.reset();
@@ -211,26 +212,23 @@ export default {
         const valid = await this.$refs.observer.validate();
         if(!valid) return; // 校验不通过
         // 校验通过
-        await registerForInvite(this, this.form);
+        const res = await registerForInvite(this, this.form, { headers: { merchantSign: this.merchantSign }});
+        console.log(res)
         this.$toast.success(res.msg);
 
         // 注册成功后,下载
-        this.registerDownload();
-      }finally {
+        this.registerDownload(res.data);
+      }catch({message}){
+        message && this.$toast.fail(message);
+      }  finally {
         this.submitting = false;
       }
     },
-    // 注册并下载 TODO
-    async registerDownload() {
-      let url = 'https://www.androidscloud.com/admin/attachment/download/2117e9b7f3734b16b81b9d7bb1c5a601';
-
-      const callapp = new CallApp({
-        scheme: { protocol: 'opengeminiapp://', host: 'open' },
-        fallback: url, // 超时后跳转的地址
-        timeout: 2000, // 拉起app超时时间
-      })
-
-      callapp.open({ param: {}, path: '' })
+    // 跳转到下载应用
+    async registerDownload({ downloadUrl }) {
+      setTimeout(()=>{
+        window.location.href = downloadUrl;
+      }, 600)
     }
   }
 }