Commit 04baba843bc5f4f2cb4efcae3a4eceb90e6d9516

Authored by wangfan
1 parent 7082aed9

manager-invitation

@@ -9,6 +9,7 @@ Page({ @@ -9,6 +9,7 @@ Page({
9 */ 9 */
10 data: { 10 data: {
11 dots: [], 11 dots: [],
  12 + hasGo:false,
12 }, 13 },
13 14
14 /** 15 /**
@@ -28,25 +29,7 @@ Page({ @@ -28,25 +29,7 @@ Page({
28 this.setData({ 29 this.setData({
29 dots:dots, 30 dots:dots,
30 }) 31 })
31 - App.Invitation.UserIdentity({  
32 - openid:getApp().openid  
33 - }).then(res=>{  
34 - if(res.ret==200){  
35 - if(res.data.identity==1){  
36 - wx.reLaunch({  
37 - url:'/pages/customer/index'  
38 - })  
39 - return;  
40 - }  
41 - if(res.data.identity==2){  
42 - wx.redirectTo({  
43 - url:'/pages/manager-invitation/review'  
44 - })  
45 - }  
46 - }else{  
47 - util.toast(res.msg)  
48 - }  
49 - }) 32 + this.UserIdentity();
50 }, 33 },
51 34
52 /** 35 /**
@@ -98,6 +81,9 @@ Page({ @@ -98,6 +81,9 @@ Page({
98 81
99 }, 82 },
100 userinfo(){ 83 userinfo(){
  84 + if(!this.data.hasGo){
  85 + return util.toast('数据初始化,请等候','none');
  86 + }
101 let us=util.cache('userInfo'); 87 let us=util.cache('userInfo');
102 App.Invitation.AddInvitationUser({ 88 App.Invitation.AddInvitationUser({
103 openid:getApp().openid, 89 openid:getApp().openid,
@@ -110,4 +96,34 @@ Page({ @@ -110,4 +96,34 @@ Page({
110 }); 96 });
111 }) 97 })
112 }, 98 },
  99 + UserIdentity(){
  100 + let openid=getApp().openid;
  101 + if(!openid){
  102 + return setTimeout(()=>{
  103 + this.UserIdentity();
  104 + },300)
  105 + }
  106 + App.Invitation.UserIdentity({
  107 + openid:openid,
  108 + }).then(res=>{
  109 + this.setData({
  110 + hasGo:true,
  111 + })
  112 + if(res.ret==200){
  113 + if(res.data.identity==1){
  114 + wx.reLaunch({
  115 + url:'/pages/customer/index'
  116 + })
  117 + return;
  118 + }
  119 + if(res.data.identity==2){
  120 + wx.redirectTo({
  121 + url:'/pages/manager-invitation/review'
  122 + })
  123 + }
  124 + }else{
  125 + util.toast(res.msg)
  126 + }
  127 + })
  128 + },
113 }) 129 })