| 
						
						
						
					 | 
					@ -1,6 +1,7 @@ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					// pages/register/register.js
 | 
					 | 
					 | 
					// pages/register/register.js
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					// 到入一个
 | 
					 | 
					 | 
					// 到入一个
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					import {userLoginlog} from "../../utils/api" | 
					 | 
					 | 
					import api from "../../utils/api" | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import {encryptedData} from "../../utils/index" | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					Page({ | 
					 | 
					 | 
					Page({ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    /** | 
					 | 
					 | 
					    /** | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -8,17 +9,18 @@ Page({ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     */ | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    data: { | 
					 | 
					 | 
					    data: { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        formData:{ | 
					 | 
					 | 
					        formData:{ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            mobile:'', | 
					 | 
					 | 
					            mobile:'18500000001', | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            password:'', | 
					 | 
					 | 
					            password:'Elink8888', | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            appId:'wxaf87b420b87e2d79' | 
					 | 
					 | 
					            appId:'wxaf87b420b87e2d79' | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        } | 
					 | 
					 | 
					        }, | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        show:false | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    }, | 
					 | 
					 | 
					    }, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    /** | 
					 | 
					 | 
					    /** | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     * 生命周期函数--监听页面加载 | 
					 | 
					 | 
					     * 生命周期函数--监听页面加载 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					     */ | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    onLoad(options) { | 
					 | 
					 | 
					    onLoad(options) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					
 | 
					 | 
					 | 
					      this.getPubKey() | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					    }, | 
					 | 
					 | 
					    }, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    /** | 
					 | 
					 | 
					    /** | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					@ -62,6 +64,77 @@ Page({ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    onReachBottom() { | 
					 | 
					 | 
					    onReachBottom() { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    }, | 
					 | 
					 | 
					    }, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    onClickHide() { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					      this.setData({ show: false }); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    }, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    getPubKey(){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					      api.getPubKey().then(res=>{ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					          this.setData({ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					              pubKey:res.data | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					          }) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					      }).catch(err=>{ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					      }) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					  }, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					  submitLogin(){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    const parm = { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        wxCode :'', | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        ...this.data.formData, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        customerId:this.data.customerId | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    wx.login({ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					      success: (res) => { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        parm.wxCode = res.code; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    console.log(parm,'seee'); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        api.userLoginlog(parm).then((res)=>{ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					          console.log(res); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					          if(res.code == 0){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    wx.switchTab({ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                      url: '/pages/index/index', | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    }) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                    wx.setStorageSync('token', res.data.token) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                     | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					          } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        }).catch(err=>{ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					          wx.showToast({ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            title: res.msg, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            icon:'none', | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            duration:3000 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					          }) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					          console.log(err); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        }) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					      }, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    }) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					  }, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					  getCustomerlist(){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    let parm = { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					      phone:encryptedData(this.data.pubKey, this.data.formData.mobile) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    api.customerlist(parm).then(res=>{ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					      if(res.code === 0 ){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        if(res.data.length>1){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					          this.setData({ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            show:true, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            customerlist:res.data | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					          }) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        }else{ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					          this.setData({ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            customerId:res.data[0].customerId | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					          }) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					         this.submitLogin() | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					      } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    }).catch(err=>{ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    }) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					  }, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					  handelClickCustomer(e){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    this.setData({ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					      customerId:e.currentTarget.dataset.id, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					      show:false | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    }) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    this.submitLogin() | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					  }, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    handelBlurMobile(e){ | 
					 | 
					 | 
					    handelBlurMobile(e){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        this.setData({ | 
					 | 
					 | 
					        this.setData({ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					          // 获取绑定过的值,付给fromData.mobile
 | 
					 | 
					 | 
					          // 获取绑定过的值,付给fromData.mobile
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -77,6 +150,7 @@ Page({ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					          console.log(this.data.formData) | 
					 | 
					 | 
					          console.log(this.data.formData) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    }, | 
					 | 
					 | 
					    }, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    handelClickSubmit(){ | 
					 | 
					 | 
					    handelClickSubmit(){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					      let that = this | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        if(!this.data.formData.mobile){ | 
					 | 
					 | 
					        if(!this.data.formData.mobile){ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					          // 微信的轻量级api
 | 
					 | 
					 | 
					          // 微信的轻量级api
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            wx.showToast({ | 
					 | 
					 | 
					            wx.showToast({ | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -96,16 +170,11 @@ Page({ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            }) | 
					 | 
					 | 
					            }) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            return | 
					 | 
					 | 
					            return | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        const parm = { | 
					 | 
					 | 
					        | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					          // wxCode对象的初始化
 | 
					 | 
					 | 
					        // // 轻量级api,在加载时进行显示
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            wxCode :'', | 
					 | 
					 | 
					        // wx.showLoading({
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            // ...将this.data.formData所有属性,赋值到表单中
 | 
					 | 
					 | 
					        //   title: '登录中',
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            ...this.data.formData | 
					 | 
					 | 
					        // })
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        // 轻量级api,在加载时进行显示
 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        wx.showLoading({ | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					          title: '登录中', | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        }) | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        //微信的api,获取登录凭证,用户获取凭证
 | 
					 | 
					 | 
					        //微信的api,获取登录凭证,用户获取凭证
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        wx.getUserProfile({ | 
					 | 
					 | 
					        wx.getUserProfile({ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					          desc: '用于获取用户个人信息', | 
					 | 
					 | 
					          desc: '用于获取用户个人信息', | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -114,34 +183,8 @@ Page({ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            var avatarUrl = userInfo.avatarUrl; | 
					 | 
					 | 
					            var avatarUrl = userInfo.avatarUrl; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            wx.setStorageSync('avatarUrl', avatarUrl) | 
					 | 
					 | 
					            wx.setStorageSync('avatarUrl', avatarUrl) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            console.log("User's Avatar URL:", avatarUrl); | 
					 | 
					 | 
					            console.log("User's Avatar URL:", avatarUrl); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        wx.login({ | 
					 | 
					 | 
					            that.getCustomerlist() | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					          success: (res) => { | 
					 | 
					 | 
					       | 
				
			
			
				
				
			
		
	
		
		
			
				
					 | 
					 | 
					            parm.wxCode = res.code | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            console.log(parm.wxCode); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            // 调用登录的接口
 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            userLoginlog(parm).then((res)=>{ | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					              console.log(res); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					              // 判断登录是否成功
 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					              if(res.code == 0){ | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                  //  用于跳转的api,跳转到某某某
 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                        wx.switchTab({ | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                          url: '/pages/index/index', | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                        }) | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                        //加入本地内存的api
 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                        wx.setStorageSync('token', res.data.token) | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                         | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					              } | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            }).catch(err=>{ | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					              wx.showToast({ | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                title: res.msg, | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                icon:'none', | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                duration:3000 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					              }) | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					              console.log(err); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            }) | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            wx.hideLoading() | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					          }, | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        }) | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					      } | 
					 | 
					 | 
					      } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    }) | 
					 | 
					 | 
					    }) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					         | 
					 | 
					 | 
					         | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  |