|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- // pages/scout/scout.js
- const app = getApp()
- Page({
-
- /**
- * 页面的初始数据
- */
- data: {
- imgUrl: app.globalData.urlStatic,//图片路径
- maskShow: true,
- tipShow:true,
- iconShow:true,//是否有头像
- titleContent:'尊敬的启辰车主您好',
- userData:{
- avatarUrl: null,
- nickName: null,
- userLevel: 0
- },
- isbtn:true,//防重复点击
- maskid:0,//现实的弹窗
- },
- /**
- * 关闭提示弹窗
- */
- hiddenTip(){
- this.setData({
- maskShow: false,
- tipShow: false
- })
- },
- getUserWxMsg:function(e){//通过微信获取用户信息
- if (e.detail.errMsg == "getUserInfo:ok") {
- if(this.data.isbtn){
- this.setData({isbtn: false})
- }else{
- return;
- }
- this.data.userData.avatarUrl = e.detail.userInfo.avatarUrl;
- this.data.userData.nickName = e.detail.userInfo.nickName;
- this.data.userData.userLevel = 0;
- this.setData({
- userData: this.data.userData,
- isLogin: true
- })
- app.globalData.userInfoData = {};
- app.globalData.userInfoData.avatarUrl = e.detail.userInfo.avatarUrl;
- app.globalData.userInfoData.nickName = e.detail.userInfo.nickName;
- app.submitUserMsg(e.detail.userInfo.avatarUrl, e.detail.userInfo.nickName);
- wx.navigateTo({
- url:'../poster/poster'
- })
- }
- },
- getUserInfo:function(e){//获取个人信息
- if(this.data.isbtn){
- this.setData({isbtn: false})
- }else{
- return;
- }
- app.wxRequest(app.globalData.urlRoot + 'userInfo/getUserInfo', {}, res => {
- if(res.code==200){
- // res.data.userLevel = 3;
- if (res.data) {
- this.data.userData.avatarUrl = res.data.avatarUrl;
- this.data.userData.nickName = res.data.nickName;
- this.data.userData.userLevel = res.data.userLevel;
- this.setData({
- userData: this.data.userData
- })
- app.globalData.userInfoData = {};
- app.globalData.userInfoData.avatarUrl = res.data.avatarUrl;
- app.globalData.userInfoData.nickName = res.data.nickName;
- wx.navigateTo({
- url:'../poster/poster'
- })
- }
- }else{
- this.setData({isbtn: true})
- }
- },this)
- },
- /**
- * 海报页
- */
- getPoster:function(){
- wx.navigateTo({
- url:'../poster/poster'
- })
- },
-
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
-
- },
-
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
-
- },
-
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- app.globalData.certificationState=4;
- this.setData({maskid: app.globalData.certificationState})
- if(app.globalData.certificationState==1){
- this.setData({titleContent:'尊敬的启辰车主您好'})
- }else if(app.globalData.certificationState==2){
- this.setData({titleContent:'尊敬的合伙人您好'})
- }else if(app.globalData.certificationState==3){
- this.setData({titleContent:'尊敬的同事您好'})
- }else if(app.globalData.certificationState==4){
- this.setData({titleContent:'尊敬的星探顾问'})
- }
- if(app.globalData.userInfoData==null){
- this.setData({iconShow:true})
- }else{
- this.setData({iconShow:false})
- }
- this.setData({isbtn: true})
- // wx.navigateTo({
- // url: './share/share'
- // })
- },
-
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
-
- },
-
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
-
- },
-
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
-
- },
-
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
-
- },
-
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- return app.sharePack();
- }
- })
|