|
- // 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: 1
- },
- isbtn:true,//防重复点击
- maskid:0,//现实的弹窗
- authenticationStatus:false,
- authenticationShow:false
- },
- /**
- * 关闭提示弹窗
- */
- 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 = 1;
- this.setData({
- userData: this.data.userData,
- iconShow:false
- })
- 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
- })
- wx.navigateTo({
- url:'../poster/poster'
- })
- }
- }else{
- this.setData({isbtn: true})
- }
- },this)
- },
- /**
- * 海报页
- */
- getPoster:function(){
- console.log(this.data.authenticationStatus);
- // return;
- if (this.data.authenticationStatus) {
- wx.navigateTo({
- url: '../poster/poster'
- })
- }else{
- this.setData({
- authenticationShow:true
- })
- }
- },
- // getCertificationInfo: function () {//查询认证状态
- // app.wxRequest(app.globalData.urlRoot + 'userInfo/getCertificationInfo', {}, res => {
- // if (res.code == 200 && res.data && res.data.agentDetail) {
- // this.data.authenticationStatus = true;
- // }
- // }, this)
- // },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- app.globalData.nowPage = 2;
- },
-
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
-
- },
-
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- // if (app.globalData.openid) {
- // this.getCertificationInfo();
- // } else {
- // app.globalData.openidSuccessFuc = this.getCertificationInfo;
- // }
- if (app.globalData.authenticationStatus && app.globalData.authenticationStatus.agentDetail){
- this.data.authenticationStatus = true;
- this.setData({
- authenticationShow:false
- })
- }
- // 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:'尊敬的星探顾问'})
- }
- console.log(app.globalData.userInfoData);
-
- if(app.globalData.userInfoData && app.globalData.userInfoData.avatarUrl){
- this.setData({iconShow:false})
- }else{
- this.setData({iconShow:true})
- }
- this.setData({isbtn: true})
- // wx.navigateTo({
- // url: './share/share'
- // })
- },
-
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
-
- },
-
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
-
- },
-
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
-
- },
-
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
-
- },
-
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- return app.sharePack();
- },
- changeAuthenticationShow:function(){
- this.setData({
- authenticationShow: !this.data.authenticationShow
- })
- },
- enterMsg: function () {//去补充资料
- wx.navigateTo({
- url: '/pages/supplement/supplement',
- })
- }
- })
|