houwei 3 gadi atpakaļ
vecāks
revīzija
8fd36afbcf
2 mainītis faili ar 168 papildinājumiem un 159 dzēšanām
  1. 166 157
      pages/activeDetail/activeDetail.js
  2. 2 2
      pages/personInfo/personInfo.js

+ 166 - 157
pages/activeDetail/activeDetail.js

@@ -2,99 +2,122 @@ const app = require('../../utils/util.js');
 const tool = require('../../utils/tool.js');
 Page({
   data: {
-    isInit: false
+    isInit: false,
+    loginStatus: false,
+    infoStatus: false,
+    targetInfoStatus: false
   },
-  // isOk() {
-    // tool.isLogin().then(result => {
+  isOk() {
+    tool.isLogin().then(result => {
+      this.setData({
+        loginStatus: true
+      })
+    })
+    // .catch(err => {
+    //   this.setData({
+    //     loginStatus: false
+    //   })
+    // });
+    tool.isFinishInfo().then(result2 => {
+      this.setData({
+        infoStatus: true
+      })
+    })
+    // .catch(err => {
+    //   this.setData({
+    //     infoStatus: false
+    //   })
+    // })
+    tool.isFinishTargetInfo().then(redult3 => {
+      this.setData({
+        targetInfoStatus: true
+      })
+    })
+    // .catch(err => {
     //   this.setData({
-    //     loginStatus: true
+    //     targetInfoStatus: false
     //   })
+    // })
+   
+  },
+  baoming() {
+    console.log(this.data.loginStatus,'111111')
+    console.log(this.data.infoStatus,'22222222222')
+    console.log(this.data.targetInfoStatus,'333333333333')
+    // tool.isLogin().then(result => {
     //   tool.isFinishInfo().then(result2 => {
-    //     this.setData({
-    //       infoStatus: true
-    //     })
     //     tool.isFinishTargetInfo().then(redult3 => {
-    //       this.setData({
-    //         targetInfoStatus: true
+    //       wx.requestSubscribeMessage({
+    //         tmplIds: ['YNGZW3voCNtjvTkhi2xbbVinJkjFKcILEG7uFC_xz2Y'],
+    //         success: (res) => {
+    //           console.log(res,'订阅成功了')
+    //           wx.request({
+    //             url: app.globalData.publicUrl + '/wx/actives/' + this.data.openid + '/' + this.data.id + '/enter',
+    //             method: "get",
+    //             success: (res) => {
+    //               if (res.data.code == 0) {
+    //                 wx.redirectTo({
+    //                   url: '/pages/registrationSuccess/registrationSuccess',
+    //                 })
+    //               }
+    //             }
+    //           })
+    //         },
+    //         fail: (res1) => {
+    //           console.log(res1, '订阅失败了')
+    //           wx.request({
+    //             url: app.globalData.publicUrl + '/wx/actives/' + this.data.openid + '/' + this.data.id + '/enter',
+    //             method: "get",
+    //             success: (res) => {
+    //               if (res.data.code == 0) {
+    //                 wx.redirectTo({
+    //                   url: '/pages/registrationSuccess/registrationSuccess',
+    //                 })
+    //               }
+    //             }
+    //           })
+    //         }
     //       })
     //     }).catch(err => {
-    //       this.setData({
-    //         targetInfoStatus: false
-    //       })
+    //       wx.showModal({
+    //         title: '您还未完善择偶信息',
+    //         showCancel: false,
+    //         success(res) {
+    //           if (res.confirm) {
+    //             wx.redirectTo({
+    //               url: '/pages/targetInfo/targetInfo',
+    //             })
+    //           }
+    //         }
+    //       });
     //     })
     //   }).catch(err => {
-    //     this.setData({
-    //       infoStatus: false
-    //     })
+    //     wx.showModal({
+    //       title: '您还未完善个人信息',
+    //       showCancel: false,
+    //       success(res) {
+    //         if (res.confirm) {
+    //           wx.redirectTo({
+    //             url: '/pages/personInfo/personInfo',
+    //           })
+    //         }
+    //       }
+    //     });
     //   })
     // }).catch(err => {
-    //   this.setData({
-    //     loginStatus: false
-    //   })
+    //   wx.showModal({
+    //     title: '您还未登录',
+    //     showCancel: false,
+    //     success(res) {
+    //       if (res.confirm) {
+    //         wx.redirectTo({
+    //           url: '/pages/personal/personal',
+    //         })
+    //       }
+    //     }
+    //   });
     // })
-  // },
-  baoming() {
-    tool.isLogin().then(result => {
-      tool.isFinishInfo().then(result2 => {
-        tool.isFinishTargetInfo().then(redult3 => {
-          wx.requestSubscribeMessage({
-            tmplIds: ['YNGZW3voCNtjvTkhi2xbbVinJkjFKcILEG7uFC_xz2Y'],
-            success: (res) => {
-              console.log(res,'订阅成功了')
-              wx.request({
-                url: app.globalData.publicUrl + '/wx/actives/' + this.data.openid + '/' + this.data.id + '/enter',
-                method: "get",
-                success: (res) => {
-                  if (res.data.code == 0) {
-                    wx.redirectTo({
-                      url: '/pages/registrationSuccess/registrationSuccess',
-                    })
-                  }
-                }
-              })
-            },
-            fail: (res1) => {
-              console.log(res1, '订阅失败了')
-              wx.request({
-                url: app.globalData.publicUrl + '/wx/actives/' + this.data.openid + '/' + this.data.id + '/enter',
-                method: "get",
-                success: (res) => {
-                  if (res.data.code == 0) {
-                    wx.redirectTo({
-                      url: '/pages/registrationSuccess/registrationSuccess',
-                    })
-                  }
-                }
-              })
-            }
-          })
-        }).catch(err => {
-          wx.showModal({
-            title: '您还未完善择偶信息',
-            showCancel: false,
-            success(res) {
-              if (res.confirm) {
-                wx.redirectTo({
-                  url: '/pages/targetInfo/targetInfo',
-                })
-              }
-            }
-          });
-        })
-      }).catch(err => {
-        wx.showModal({
-          title: '您还未完善个人信息',
-          showCancel: false,
-          success(res) {
-            if (res.confirm) {
-              wx.redirectTo({
-                url: '/pages/personInfo/personInfo',
-              })
-            }
-          }
-        });
-      })
-    }).catch(err => {
+    if (!this.data.loginStatus) {
       wx.showModal({
         title: '您还未登录',
         showCancel: false,
@@ -106,86 +129,73 @@ Page({
           }
         }
       });
-    })
-    // if (!this.data.loginStatus) {
-    //   wx.showModal({
-    //     title: '您还未登录',
-    //     showCancel: false,
-    //     success(res) {
-    //       if (res.confirm) {
-    //         wx.redirectTo({
-    //           url: '/pages/personal/personal',
-    //         })
-    //       }
-    //     }
-    //   });
-    //   return false;
-    // }
-    // if (!this.data.infoStatus) {
-    //   wx.showModal({
-    //     title: '您还未完善个人信息',
-    //     showCancel: false,
-    //     success(res) {
-    //       if (res.confirm) {
-    //         wx.redirectTo({
-    //           url: '/pages/personInfo/personInfo',
-    //         })
-    //       }
-    //     }
-    //   });
-    //   return false;
-    // }
-    // if (!this.data.targetInfoStatus) {
-    //   wx.showModal({
-    //     title: '您还未完善择偶信息',
-    //     showCancel: false,
-    //     success(res) {
-    //       if (res.confirm) {
-    //         wx.redirectTo({
-    //           url: '/pages/targetInfo/targetInfo',
-    //         })
-    //       }
-    //     }
-    //   });
-    //   return false;
-    // }
-    // wx.requestSubscribeMessage({
-    //   tmplIds: ['YNGZW3voCNtjvTkhi2xbbVinJkjFKcILEG7uFC_xz2Y'],
-    //   success: (res) => {
-    //     wx.request({
-    //       url: app.globalData.publicUrl + '/wx/actives/' + this.data.openid + '/' + this.data.id + '/enter',
-    //       method: "get",
-    //       success: (res) => {
-    //         if (res.data.code == 0) {
-    //           wx.redirectTo({
-    //             url: '/pages/registrationSuccess/registrationSuccess',
-    //           })
-    //         }
-    //       }
-    //     })
-    //   },
-    //   fail: (res1) => {
-    //     console.log(res1, '失败了')
-    //     wx.request({
-    //       url: app.globalData.publicUrl + '/wx/actives/' + this.data.openid + '/' + this.data.id + '/enter',
-    //       method: "get",
-    //       success: (res) => {
-    //         if (res.data.code == 0) {
-    //           wx.redirectTo({
-    //             url: '/pages/registrationSuccess/registrationSuccess',
-    //           })
-    //         }
-    //       }
-    //     })
-    //   }
-    // }) 
+      return false;
+    }
+    if (!this.data.infoStatus) {
+      wx.showModal({
+        title: '您还未完善个人信息',
+        showCancel: false,
+        success(res) {
+          if (res.confirm) {
+            wx.redirectTo({
+              url: '/pages/personInfo/personInfo',
+            })
+          }
+        }
+      });
+      return false;
+    }
+    if (!this.data.targetInfoStatus) {
+      wx.showModal({
+        title: '您还未完善择偶信息',
+        showCancel: false,
+        success(res) {
+          if (res.confirm) {
+            wx.redirectTo({
+              url: '/pages/targetInfo/targetInfo',
+            })
+          }
+        }
+      });
+      return false;
+    }
+    wx.requestSubscribeMessage({
+      tmplIds: ['YNGZW3voCNtjvTkhi2xbbVinJkjFKcILEG7uFC_xz2Y'],
+      success: (res) => {
+        wx.request({
+          url: app.globalData.publicUrl + '/wx/actives/' + this.data.openid + '/' + this.data.id + '/enter',
+          method: "get",
+          success: (res) => {
+            if (res.data.code == 0) {
+              wx.redirectTo({
+                url: '/pages/registrationSuccess/registrationSuccess',
+              })
+            }
+          }
+        })
+      },
+      fail: (res1) => {
+        console.log(res1, '失败了')
+        wx.request({
+          url: app.globalData.publicUrl + '/wx/actives/' + this.data.openid + '/' + this.data.id + '/enter',
+          method: "get",
+          success: (res) => {
+            if (res.data.code == 0) {
+              wx.redirectTo({
+                url: '/pages/registrationSuccess/registrationSuccess',
+              })
+            }
+          }
+        })
+      }
+    }) 
   },
   async onLoad(options) {
     wx.showLoading({
       title:'加载中',
       mask:true
     });
-    console.log(options)
+    this.isOk();
     tool.openidStatus().then(result => {
       this.setData({
         openid: result[0],
@@ -193,10 +203,9 @@ Page({
         activeOpenid: options.openId,
         isInit: true
       })
-      // this.isOk();
       this.getActivies(options.id);
-      wx.hideLoading();
     })
+    wx.hideLoading();
   },
   getActivies(id2) {
     wx.request({

+ 2 - 2
pages/personInfo/personInfo.js

@@ -618,7 +618,7 @@ Page({
         openid: result[0],
         sessionkey: result[1]
       })
-      // this.getInfos();
+      this.getInfos();
     })
   },
   onShow() {
@@ -627,7 +627,7 @@ Page({
       this.setData({
         userInfo: JSON.parse(res.rawData)
       })
-      this.getInfos()
+      // this.getInfos()
     }).catch(err => {
       wx.showModal({
         title: '您还未登录',