Browse Source

每一个页面新增授权弹框

Limengbo 6 years atrás
parent
commit
7f08f53bd8

+ 15 - 27
pages/art/art.js

@@ -34,7 +34,8 @@ Page({
     productionMore: '',
     questionsMore: '',
     wxObjectives: [],
-    canvasHeight: ''
+    canvasHeight: '',
+    flag: true 
   },
 
   /* 区分答疑和分享 */
@@ -50,18 +51,7 @@ Page({
         "pageSize": pageSize
       }).success(success)
     }, function() {
-      wx.showModal({
-        title: '提示',
-        content: '需要获取您的公开信息(昵称、头像等),请从小程序列表删除小学王者班后再次扫码进入,允许授权后可正常使用',
-        showCancel: false,
-        success: function (res) {
-          if (res.confirm) {
-            console.log('用户点击确定')
-          } else if (res.cancel) {
-            console.log('用户点击取消')
-          }
-        }
-      })
+
     });
   },
   /*点击加载更多*/
@@ -197,19 +187,10 @@ Page({
           wxObjectives: util.strategy(res.data.data.weekCourseConfig.wxObjectives)
         })
       })
-    }, function() {
-      wx.showModal({
-        title: '提示',
-        content: '需要获取您的公开信息(昵称、头像等),请从小程序列表删除小学王者班后再次扫码进入,允许授权后可正常使用',
-        showCancel: false,
-        success: function (res) {
-          if (res.confirm) {
-            console.log('用户点击确定')
-          } else if (res.cancel) {
-            console.log('用户点击取消')
-          }
-        }
-      })
+    }, () => {
+      this.setData({
+        flag: !this.data.flag
+      })      
     });
     
   },
@@ -242,5 +223,12 @@ Page({
         console.log("转发失败:" + JSON.stringify(res));
       }
     }
-  }
+  },
+  /*获取个人信息弹框*/
+  jurisdiction: function () {
+    this.setData({
+      flag: !this.data.flag
+    })
+    this.onLoad();
+  },
 })

+ 1 - 0
pages/art/art.json

@@ -4,6 +4,7 @@
     "tarbar": "/compontents/tarbar/tarbar",  
     "target": "/compontents/target/target",
     "preview": "/compontents/preview/preview",
+    "dialog": "/compontents/dialog/dialog",
     "chat": "/compontents/chat/chat",
     "lessonList": "/compontents/lesson_list/lessonList"
   }

+ 3 - 0
pages/art/art.wxml

@@ -54,5 +54,8 @@
   <view class="canvas-box">
     <canvas canvas-id="myCanvas" style="width:100%; height: {{canvasHeight}}px;"></canvas>
   </view>
+  <view hidden="{{flag}}">
+    <dialog bindmyevent="jurisdiction"/>
+  </view>  
 </view>
 

+ 14 - 26
pages/chinese/chinese.js

@@ -16,7 +16,8 @@ Page({
     lessonListHeight: '',
     previewHeight: '',
     questionsMore: '',
-    wxObjectives: []
+    wxObjectives: [],
+    flag: true
   },
 
   /* 区分答疑和分享 */
@@ -32,18 +33,7 @@ Page({
         "pageSize": pageSize
       }).success(success)
     }, function() {
-      wx.showModal({
-        title: '提示',
-        content: '需要获取您的公开信息(昵称、头像等),请从小程序列表删除小学王者班后再次扫码进入,允许授权后可正常使用',
-        showCancel: false,
-        success: function (res) {
-          if (res.confirm) {
-            console.log('用户点击确定')
-          } else if (res.cancel) {
-            console.log('用户点击取消')
-          }
-        }
-      })
+      
     });
   },
   /*加载更多点击*/
@@ -136,19 +126,17 @@ Page({
           wxObjectives: util.strategy(res.data.data.weekCourseConfig.wxObjectives)
         })
       })
-    }, function() {
-      wx.showModal({
-        title: '提示',
-        content: '需要获取您的公开信息(昵称、头像等),请从小程序列表删除小学王者班后再次扫码进入,允许授权后可正常使用',
-        showCancel: false,
-        success: function (res) {
-          if (res.confirm) {
-            console.log('用户点击确定')
-          } else if (res.cancel) {
-            console.log('用户点击取消')
-          }
-        }
-      })
+    }, () => {
+      this.setData({
+        flag: !this.data.flag
+      })       
     });
   },
+  /*获取个人信息弹框*/
+  jurisdiction: function () {
+    this.setData({
+      flag: !this.data.flag
+    })
+    this.onShow();
+  },
 })

+ 1 - 0
pages/chinese/chinese.json

@@ -4,6 +4,7 @@
     "tarbar": "/compontents/tarbar/tarbar",  
     "target": "/compontents/target/target",
     "preview": "/compontents/preview/preview",
+    "dialog": "/compontents/dialog/dialog",
     "chat": "/compontents/chat/chat",
     "lessonList": "/compontents/lesson_list/lessonList"
   }

+ 3 - 0
pages/chinese/chinese.wxml

@@ -35,5 +35,8 @@
           </view>
       </scroll-view>
   </view>
+  <view hidden="{{flag}}">
+    <dialog bindmyevent="jurisdiction"/>
+  </view>   
 </view>
 

+ 14 - 26
pages/english/english.js

@@ -16,7 +16,8 @@ Page({
     lessonListHeight: '',
     previewHeight: '',
     questionsMore: '',
-    wxObjectives: []
+    wxObjectives: [],
+    flag: true    
   },
 
   /* 区分答疑和分享 */
@@ -32,18 +33,7 @@ Page({
         "pageSize": pageSize
       }).success(success)
     }, function() {
-      wx.showModal({
-        title: '提示',
-        content: '需要获取您的公开信息(昵称、头像等),请从小程序列表删除小学王者班后再次扫码进入,允许授权后可正常使用',
-        showCancel: false,
-        success: function (res) {
-          if (res.confirm) {
-            console.log('用户点击确定')
-          } else if (res.cancel) {
-            console.log('用户点击取消')
-          }
-        }
-      })
+
     });
   },
   /*加载更多点击*/
@@ -137,19 +127,17 @@ Page({
           wxObjectives: util.strategy(res.data.data.weekCourseConfig.wxObjectives)
         })
       })
-    }, function() {
-      wx.showModal({
-        title: '提示',
-        content: '需要获取您的公开信息(昵称、头像等),请从小程序列表删除小学王者班后再次扫码进入,允许授权后可正常使用',
-        showCancel: false,
-        success: function (res) {
-          if (res.confirm) {
-            console.log('用户点击确定')
-          } else if (res.cancel) {
-            console.log('用户点击取消')
-          }
-        }
-      })
+    }, () => {
+      this.setData({
+        flag: !this.data.flag
+      })     
     });
   },
+  /*获取个人信息弹框*/
+  jurisdiction: function () {
+    this.setData({
+      flag: !this.data.flag
+    })
+    this.onShow();
+  }  
 })

+ 1 - 0
pages/english/english.json

@@ -4,6 +4,7 @@
     "tarbar": "/compontents/tarbar/tarbar",  
     "target": "/compontents/target/target",
     "preview": "/compontents/preview/preview",
+    "dialog": "/compontents/dialog/dialog",
     "chat": "/compontents/chat/chat",
     "lessonList": "/compontents/lesson_list/lessonList"
   }

+ 3 - 0
pages/english/english.wxml

@@ -35,5 +35,8 @@
           </view>
       </scroll-view>
   </view>
+  <view hidden="{{flag}}">
+    <dialog bindmyevent="jurisdiction"/>
+  </view>   
 </view>
 

+ 22 - 81
pages/index/index.js

@@ -42,71 +42,12 @@ Page({
   },
 
   jurisdiction: function () {
+    //隐藏弹框
+    this.setData({
+      flag: !this.data.flag
+    })
     //登录页信息
-    login.getOpenidSessionKey(res => {
-      //隐藏弹框
-      this.setData({
-        flag: !this.data.flag
-      })
-      APIClient.getMySchedule({
-        uid: res.data.data.uid
-      }).success(res => {
-        console.log(res)
-        this.setData({
-          data: res.data.data,
-          grade: util.gradeUpper(res.data.data.users.grade),
-          test:util.day(),
-          time: util.day(res.data.data.timeSpend),
-          studyLog: util.studyTime(res.data.data.studyLog)
-        })
-        
-        if(res.data.data.studyLog.length > 10) {
-          this.setData({
-            height: '670'
-          })
-        }
-      })
-      //获取排名
-      APIClient.getFriendSchedule('wx/friendsRank/user', {
-        uid: res.data.data.uid
-      }).success(res => {
-        console.log(res)
-        this.setData({
-          rankData: res.data.data,
-        })
-
-      })
-    }, function() { 
-      wx.showModal({
-        title: '提示',
-        content: '需要获取您的公开信息(昵称、头像等),请从小程序列表删除小学王者班后再次扫码进入,允许授权后可正常使用',
-        showCancel: false,
-        success: function (res) {
-          if (res.confirm) {
-            console.log('用户点击确定')
-          } else if (res.cancel) {
-            console.log('用户点击取消')
-          }
-        }
-      })
-    }); 
-    /* 分享 */
-    const columnId = util.column('6').columnId;
-    this.distinction(2, columnId, 1, 2, res => {
-      if(res.data.success) {
-        console.log(res.data.data)
-        this.setData({
-          productionData: res.data.data
-        })
-        if(res.data.data) {
-          if(res.data.data.totalSize > 2) {
-            this.setData({
-              productionMore: true
-            })
-          }
-        }
-      }
-    }); 
+    this.onShow();
   },
 
   /*点击获取canvas高度*/
@@ -140,23 +81,6 @@ Page({
         this.setData({left: 200 });
       }  
     }
-    /* 分享 */
-    const columnId = util.column('6').columnId;
-    this.distinction(2, columnId, 1, 2, res => {
-      if(res.data.success) {
-        console.log(res.data.data)
-        this.setData({
-          productionData: res.data.data
-        })
-        if(res.data.data) {
-          if(res.data.data.totalSize > 2) {
-            this.setData({
-              productionMore: true
-            })
-          }
-        }
-      }
-    });
   },
   onShow: function () {
     //登录页信息
@@ -194,6 +118,23 @@ Page({
         flag: !this.data.flag
       })
     });  
+    /* 分享 */
+    const columnId = util.column('6').columnId;
+    this.distinction(2, columnId, 1, 2, res => {
+      if(res.data.success) {
+        console.log(res.data.data)
+        this.setData({
+          productionData: res.data.data
+        })
+        if(res.data.data) {
+          if(res.data.data.totalSize > 2) {
+            this.setData({
+              productionMore: true
+            })
+          }
+        }
+      }
+    });
   },
   /* 区分答疑和分享 */
   distinction: function(type, columnId, pageNo, pageSize, success) {

+ 14 - 26
pages/language/language.js

@@ -16,7 +16,8 @@ Page({
     lessonListHeight: '',
     previewHeight: '',
     questionsMore: '',
-    wxObjectives: []
+    wxObjectives: [],
+    flag: true        
   },
 
   /* 区分答疑和分享 */
@@ -32,18 +33,7 @@ Page({
         "pageSize": pageSize
       }).success(success)
     }, function() {
-      wx.showModal({
-        title: '提示',
-        content: '需要获取您的公开信息(昵称、头像等),请从小程序列表删除小学王者班后再次扫码进入,允许授权后可正常使用',
-        showCancel: false,
-        success: function (res) {
-          if (res.confirm) {
-            console.log('用户点击确定')
-          } else if (res.cancel) {
-            console.log('用户点击取消')
-          }
-        }
-      })
+      
     });
   },
   /*加载更多点击*/
@@ -134,19 +124,17 @@ Page({
           wxObjectives: util.strategy(res.data.data.weekCourseConfig.wxObjectives)
         })
       })
-    }, function() {
-      wx.showModal({
-        title: '提示',
-        content: '需要获取您的公开信息(昵称、头像等),请从小程序列表删除小学王者班后再次扫码进入,允许授权后可正常使用',
-        showCancel: false,
-        success: function (res) {
-          if (res.confirm) {
-            console.log('用户点击确定')
-          } else if (res.cancel) {
-            console.log('用户点击取消')
-          }
-        }
-      })
+    }, () => {
+      this.setData({
+        flag: !this.data.flag
+      })   
     });
   },
+  /*获取个人信息弹框*/
+  jurisdiction: function () {
+    this.setData({
+      flag: !this.data.flag
+    })
+    this.onShow();
+  }    
 })

+ 1 - 0
pages/language/language.json

@@ -4,6 +4,7 @@
     "tarbar": "/compontents/tarbar/tarbar",  
     "target": "/compontents/target/target",
     "preview": "/compontents/preview/preview",
+    "dialog": "/compontents/dialog/dialog",
     "chat": "/compontents/chat/chat",
     "lessonList": "/compontents/lesson_list/lessonList"
   }

+ 3 - 0
pages/language/language.wxml

@@ -35,5 +35,8 @@
           </view>
       </scroll-view>
   </view>
+  <view hidden="{{flag}}">
+    <dialog bindmyevent="jurisdiction"/>
+  </view>    
 </view>
 

+ 14 - 26
pages/mathematics/mathematics.js

@@ -16,7 +16,8 @@ Page({
     lessonListHeight: '',
     previewHeight: '',
     questionsMore: '',
-    wxObjectives: []
+    wxObjectives: [],
+    flag: true 
   },
 
   /* 区分答疑和分享 */
@@ -32,18 +33,7 @@ Page({
         "pageSize": pageSize
       }).success(success)
     }, function() {
-      wx.showModal({
-        title: '提示',
-        content: '需要获取您的公开信息(昵称、头像等),请从小程序列表删除小学王者班后再次扫码进入,允许授权后可正常使用',
-        showCancel: false,
-        success: function (res) {
-          if (res.confirm) {
-            console.log('用户点击确定')
-          } else if (res.cancel) {
-            console.log('用户点击取消')
-          }
-        }
-      })
+
     });
   },
   /*加载更多点击*/
@@ -137,19 +127,17 @@ Page({
           wxObjectives: util.strategy(res.data.data.weekCourseConfig.wxObjectives)
         })
       })
-    }, function() {
-      wx.showModal({
-        title: '提示',
-        content: '需要获取您的公开信息(昵称、头像等),请从小程序列表删除小学王者班后再次扫码进入,允许授权后可正常使用',
-        showCancel: false,
-        success: function (res) {
-          if (res.confirm) {
-            console.log('用户点击确定')
-          } else if (res.cancel) {
-            console.log('用户点击取消')
-          }
-        }
-      })
+    }, () => {
+      this.setData({
+        flag: !this.data.flag
+      })        
     });
   },
+  /*获取个人信息弹框*/
+  jurisdiction: function () {
+    this.setData({
+      flag: !this.data.flag
+    })
+    this.onShow();
+  }  
 })

+ 1 - 0
pages/mathematics/mathematics.json

@@ -4,6 +4,7 @@
     "tarbar": "/compontents/tarbar/tarbar",  
     "target": "/compontents/target/target",
     "preview": "/compontents/preview/preview",
+    "dialog": "/compontents/dialog/dialog",    
     "chat": "/compontents/chat/chat",
     "lessonList": "/compontents/lesson_list/lessonList"
   }

+ 3 - 0
pages/mathematics/mathematics.wxml

@@ -35,5 +35,8 @@
           </view>
       </scroll-view>
   </view>
+  <view hidden="{{flag}}">
+    <dialog bindmyevent="jurisdiction"/>
+  </view>     
 </view>
 

+ 16 - 17
pages/mistakes/mistakes.js

@@ -13,7 +13,8 @@ Page({
     flag: [],
     exponentData: [],
     course: ['语文', '数学'],
-    courseIndex: 0
+    courseIndex: 0,
+    flag: true
   },
 
   particulars: function (e) {
@@ -92,19 +93,10 @@ Page({
           exponentData: res.data.data
         })
       })
-    }, function() {
-      wx.showModal({
-        title: '提示',
-        content: '需要获取您的公开信息(昵称、头像等),请从小程序列表删除小学王者班后再次扫码进入,允许授权后可正常使用',
-        showCancel: false,
-        success: function (res) {
-          if (res.confirm) {
-            console.log('用户点击确定')
-          } else if (res.cancel) {
-            console.log('用户点击取消')
-          }
-        }
-      })
+    }, () => {
+      this.setData({
+        flag: !this.data.flag
+      })     
     });    
   },
 
@@ -112,7 +104,7 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-    this.getmistakesData(1)
+    
   },
 
   /**
@@ -126,7 +118,7 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow: function () {
-  
+    this.getmistakesData(1)
   },
 
   /**
@@ -162,5 +154,12 @@ Page({
    */
   onShareAppMessage: function () {
   
-  }
+  },
+  /*获取个人信息弹框*/
+  jurisdiction: function () {
+    this.setData({
+      flag: !this.data.flag
+    })
+    this.onShow();
+  } 
 })

+ 2 - 1
pages/mistakes/mistakes.json

@@ -1,6 +1,7 @@
 {
     "component": true,
     "usingComponents": {
-      "tarbar": "/compontents/tarbar/tarbar"
+      "tarbar": "/compontents/tarbar/tarbar",
+      "dialog": "/compontents/dialog/dialog"
     }
   }

+ 3 - 0
pages/mistakes/mistakes.wxml

@@ -49,4 +49,7 @@
         </view> 
       </scroll-view>
   </view>
+  <view hidden="{{flag}}">
+    <dialog bindmyevent="jurisdiction"/>
+  </view>     
 </view>

+ 14 - 26
pages/science/science.js

@@ -20,7 +20,8 @@ Page({
     productionMore: '',
     questionsMore: '',
     wxObjectives: [],
-    canvasHeight: ''
+    canvasHeight: '',
+    flag: true    
   },
   /* 区分答疑和分享 */
   distinction: function(type, columnId, pageNo, pageSize, success) {
@@ -35,18 +36,7 @@ Page({
         "pageSize": pageSize
       }).success(success)
     }, function() {
-      wx.showModal({
-        title: '提示',
-        content: '需要获取您的公开信息(昵称、头像等),请从小程序列表删除小学王者班后再次扫码进入,允许授权后可正常使用',
-        showCancel: false,
-        success: function (res) {
-          if (res.confirm) {
-            console.log('用户点击确定')
-          } else if (res.cancel) {
-            console.log('用户点击取消')
-          }
-        }
-      })
+      
     });
   },
 
@@ -181,19 +171,10 @@ Page({
           wxObjectives: util.strategy(res.data.data.weekCourseConfig.wxObjectives)
         })
       })
-    }, function() {
-      wx.showModal({
-        title: '提示',
-        content: '需要获取您的公开信息(昵称、头像等),请从小程序列表删除小学王者班后再次扫码进入,允许授权后可正常使用',
-        showCancel: false,
-        success: function (res) {
-          if (res.confirm) {
-            console.log('用户点击确定')
-          } else if (res.cancel) {
-            console.log('用户点击取消')
-          }
-        }
-      })
+    }, () => {
+      this.setData({
+        flag: !this.data.flag
+      })     
     });
    
   },
@@ -223,5 +204,12 @@ Page({
       }
     }
   },
+  /*获取个人信息弹框*/
+  jurisdiction: function () {
+    this.setData({
+      flag: !this.data.flag
+    })
+    this.onLoad();
+  }    
 })
 

+ 1 - 0
pages/science/science.json

@@ -4,6 +4,7 @@
     "tarbar": "/compontents/tarbar/tarbar",  
     "target": "/compontents/target/target",
     "preview": "/compontents/preview/preview",
+    "dialog": "/compontents/dialog/dialog",   
     "chat": "/compontents/chat/chat",
     "lessonList": "/compontents/lesson_list/lessonList"
   }

+ 4 - 1
pages/science/science.wxml

@@ -53,6 +53,9 @@
   </view>
   <view class="canvas-box">
     <canvas canvas-id="myCanvas" style="width:100%; height: {{canvasHeight}}px;"></canvas>
-  </view>   
+  </view>
+  <view hidden="{{flag}}">
+    <dialog bindmyevent="jurisdiction"/>
+  </view>       
 </view>
 

+ 13 - 14
pages/transmit/transmit.js

@@ -11,7 +11,8 @@ Page({
   data: {
     productionData: {},
     favors: '',
-    like: false
+    like: false,
+    flag: true 
   },
   //跳转详情页
   particulars: function (e) {
@@ -109,19 +110,10 @@ Page({
             })
           }
         })
-      }, function() {
-        wx.showModal({
-          title: '提示',
-          content: '需要获取您的公开信息(昵称、头像等),请从小程序列表删除小学王者班后再次扫码进入,允许授权后可正常使用',
-          showCancel: false,
-          success: function (res) {
-            if (res.confirm) {
-              console.log('用户点击确定')
-            } else if (res.cancel) {
-              console.log('用户点击取消')
-            }
-          }
-        })
+      }, () => {
+        this.setData({
+          flag: !this.data.flag
+        })     
       });      
     };
     
@@ -132,4 +124,11 @@ Page({
    */
   onReady: function () {
   },
+  /*获取个人信息弹框*/
+  jurisdiction: function () {
+    this.setData({
+      flag: !this.data.flag
+    })
+    this.onLoad();
+  }     
 })

+ 1 - 0
pages/transmit/transmit.json

@@ -3,6 +3,7 @@
     "usingComponents": {
       "discuss": "/compontents/discuss/discuss",
       "share": "/compontents/share/share",
+      "dialog": "/compontents/dialog/dialog",   
       "tarbar": "/compontents/tarbar/tarbar"
     }
   }

+ 3 - 0
pages/transmit/transmit.wxml

@@ -48,5 +48,8 @@
           </view>
       </scroll-view>
   </view>
+  <view hidden="{{flag}}">
+    <dialog bindmyevent="jurisdiction"/>
+  </view>      
 </view>