Przeglądaj źródła

前端小程序 更新

zhongtianhaoyuan 3 lat temu
rodzic
commit
c0e318edaa
5 zmienionych plików z 4094 dodań i 0 usunięć
  1. 276 0
      public/code.vue
  2. 940 0
      public/login.vue
  3. 963 0
      public/login_account_number.vue
  4. 1106 0
      public/register.vue
  5. 809 0
      public/reset.vue

+ 276 - 0
public/code.vue

@@ -0,0 +1,276 @@
+<template>
+	<view class="top">
+		<view class="back-btn cuIcon-back" @click="navBack"></view>
+			<!-- 文字 -->
+			<view class="top_one">请输入验证码</view>
+			<view class="top_two">验证码已发送到<text class="text">{{phone}}</text></view>
+			<!-- 六个显示框 -->
+			<view class="top_three">
+				<view  :class="[ !inputList[0]||inputList.length>0 ? 'inb' : '' ]" class="input">
+					<text>{{inputList[0]}}</text>
+					<view v-if="!inputList[0]"  class="fours"></view>
+				</view>
+				<view :class="[ inputList[0] && !inputList[1]||inputList.length>1 ? 'inb' : '' ]" class="input">
+					<text>{{inputList[1]}}</text>
+					<view v-if="inputList[0] && !inputList[1]"  class="fours"></view>
+				</view>
+				<view :class="[ inputList[1] && !inputList[2]||inputList.length>2 ? 'inb' : '' ]" class="input">
+					<text>{{inputList[2]}}</text>
+					<view v-if="inputList[1] && !inputList[2]"  class="fours"></view>
+				</view>
+				<view :class="[ inputList[2] && !inputList[3]||inputList.length>3 ? 'inb' : '' ]" class="input">
+					<text>{{inputList[3]}}</text>
+					<view v-if="inputList[2] && !inputList[3]"  class="fours"></view>
+				</view>
+				<view :class="[ inputList[3] && !inputList[4]||inputList.length>4 ? 'inb' : '' ]" class="input">
+					<text>{{inputList[4]}}</text>
+					<view v-if="inputList[3] && !inputList[4]"  class="fours"></view>
+				</view>
+				<view :class="[ inputList[4] && !inputList[5]||inputList.length>5 ? 'inb' : '' ]" class="input">
+					<text>{{inputList[5]}}</text>
+					<view v-if="inputList[4] && !inputList[5]"  class="fours"></view>
+				</view>
+			</view>
+			<!-- 隐藏的input -->
+			<view class="top_four">
+				<input type="number" class="input_show" maxlength="6" @input='submit'  v-model="inputList" focus="true"/>
+			</view>
+			<!-- 重新获取 -->
+			<view class="top_five" @click='regain' :class="!status ? 'active' : '' "><text v-if="!status">重新发送</text><text v-if="status">{{count_down}}秒后重新发送</text></view>
+		</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				// 电话
+				phone:'',
+				// 跟隐藏input绑定的数组
+				inputList:[],
+				//计时器
+				count_down:60,
+				status:false
+			}
+		},
+		onLoad(options){
+			console.log("options",options.phone)
+			this.phone=options.phone
+			console.log("phone:",this.phone);
+			if(this.phone){
+				this.regain()
+			}else{
+				uni.showToast({
+					title: '请输入正确的手机号',
+					icon:'none',
+					duration: 2000
+				})
+			}
+		},
+		methods: {
+			navBack() {
+				uni.navigateBack();
+			},
+			
+			liangxinLogin(){
+				const that = this
+				var userInfoTmp = uni.getStorageSync("userInfo")
+				console.log('userInfoTmp',userInfoTmp)
+				that.$socket.login(userInfoTmp.phone, "123456", null, res=>{
+					console.log('粮信登录',res)
+					if (res.success) {
+						that.$socket.showLoginDialog = false
+						// 缓存用户
+						that.userData = res.response.data
+						console.log('userData',that.userData)
+						that.$u.vuex("userData", that.userData);
+						// 	缓存通讯录
+						that.$socket.listGuests(that.userData.user.operId, res => {						
+							// #ifdef APP-PLUS
+							createFSQL(that.userData.user.operId).then();
+							let contact = res.response.data;
+							contact.forEach(c=>{
+								c.members.forEach(m=>{
+									m.name = c.name;
+									addFSQL(m, that.userData.user.operId).then();
+								})
+							})
+							// #endif
+							that.$u.vuex('firendItem', res.response.data)
+						});
+						
+						// 缓存消息列表
+						that.$socket.queryOnlineMessage(that.userData.user.operId,q =>{
+							let data = q.response.data;
+							for(var i in data){
+								initData(data[i].groupMsg.list, data[i].groupInfo.chatId);
+							}
+						})
+						
+						//	缓存链接
+						that.$socket.getLinks(that.userData.user.operId, res=>{
+							that.$u.vuex('linkItem',res.response.data)
+						});
+						
+						
+						// // 跳转到消息列表
+						// that.$u.route({
+						// 	url: 'pages/home/home',
+						// 	type: 'switchTab'
+						// });
+					} else {
+					  uni.showModal({
+						title:res.reason + ",请稍后再试",
+						showCancel:false
+					  })
+					}
+				});
+			},
+			regain(){
+				
+				console.log("regain",this.phone);
+				this.status=true
+				// console.log(e)150500
+				// 设定一个定时器 1000是1秒的意思
+				var interval = setInterval(() =>{
+					--this.count_down
+				},1000) 
+				if(this.count_down == 0){
+					this.status=false
+				}
+				// 设定一个定时器 60000就是六十秒
+				setTimeout(() =>{
+					this.status=false
+					clearInterval(interval)//括号里面的名字要与setInterval定义的相同
+				},60000)
+				this.$api.doRequest('get','/commonUser/sendVerifyCode',{phone:this.phone}).then(res => {
+				                // 获得数据
+								if(res.statusCode!=200){
+									uni.showToast({
+										title: res.data.message,
+										icon:'none',
+										duration: 2000
+									})
+								}
+				                console.log(res);
+				            })
+				            .catch(res => {
+				                uni.showToast({
+				                	title: res.errMsg,
+				                	icon:'none',
+				                	duration: 2000
+				                })
+				            });
+			},
+			submit(e){
+				if(e.detail.value.length==6){
+					var that=this
+					uni.showLoading({
+						title: '登录中',
+						mask:true
+					})
+					this.$api.doRequest('get','/commonUser/loginVerifyCode',{phone:this.phone,verifyCode:this.inputList,cid:this.clientId}).then(res => {
+					    if(res.data.code==200){
+							this.$api.doRequest('post','/commonUser/api/loginQuickly',{mobilePhone: this.phone,
+							veriCode: "123456",}).then(res1 => {
+								if(res1.data.code==200){
+									uni.setStorageSync('pcUserInfo', res1.data.data)
+								}
+								else{
+									that.$api.doRequest('post','/commonUser/api/loginQuickly',{mobilePhone: '13333333333',
+									veriCode: "123456",}).then(res2 => {
+										uni.setStorageSync('pcUserInfo', res2.data.data)
+									})
+								}
+							})
+							uni.setStorageSync('userInfo', res.data.data)
+					        that.$store.commit('login', res.data.data)
+					        // that.liangxinLogin()
+					        uni.switchTab({
+								url: '/pages/sale/information'
+								});
+							uni.hideLoading()
+						}else{
+							uni.hideLoading()
+							uni.showToast({
+								title: res.data.message,
+								icon:'none',
+								duration: 2000
+					        })
+						}
+					})
+					.catch(res => {
+						uni.showToast({
+							title: res.data.message,
+							icon:'none',
+							duration: 2000
+						})
+					});
+				}
+			}
+			
+		}
+	}
+</script>1
+
+<style>
+	.top{
+	padding-top: 85px;
+	position: relative;
+	width: 100vw;
+	height: 100vh;
+	overflow: hidden;
+	background: url('~@/static/img/login/bg.png');
+	background-size:100%;}
+	.back-btn {
+		position: absolute;
+		left: 40upx;
+		z-index: 9999;
+		padding-top: var(--status-bar-height);
+		top: 40upx;
+		font-size: 40upx;
+		color: $font-color-dark;
+	}
+	/* 文字 */
+	.top_one{width: 90%; height: 90rpx; line-height: 90rpx; font-size: 44rpx; margin: auto; font-weight: bold;}
+	.top_two{width: 90%; height: 40rpx; line-height: 40rpx; font-size: 24rpx; margin: auto; color: #545454;}
+	.text{font-weight: bold;}
+	
+	/* 六个显示框容器 */
+	.top_three{width: 80%; height: 200rpx; margin: auto;
+		display: flex; align-items: center; justify-content: center;
+	}
+	/* 六个框显示框 */
+	.input{width: 14%; height: 80rpx; background-color: #F5F5F5; margin-right: 12rpx;
+		text-align: center; line-height: 80rpx; font-size: 50rpx;
+		border-radius:3px;
+		color:#181818;
+	}
+	/* 模拟的焦点 */
+	.inb{
+		background:#FFFFFF;
+		box-shadow: 0px 9px 10px 4px rgba(0, 0, 0, 0.07);
+		}
+	.fours{width: 5rpx; height: 40rpx; margin: auto; background-color: #000000;
+		margin-top: 20rpx;	animation: show .8s linear infinite;
+	}
+	/* 模拟焦点动画  更改animation以更改动画样式*/
+	@keyframes show{
+		from{background-color: #000000;}
+		to{background-color: #ffffff;}
+	}
+	/* 隐藏的inpit容器 */
+	.top_four{width: 80%; height: 100rpx; margin: auto; margin-top: -140rpx;}
+	.input_show{width: 100%; height: 100rpx; border-bottom: 2rpx solid #000000; margin: auto;
+		opacity: 0;background-color: #c6c6c6; 
+	}
+	/* 重新获取 */
+	.top_five{width: 100%; height: 60rpx; margin-top: 180rpx; text-align: center; line-height: 60rpx; 
+		color: #959595;
+	}
+	/* 定时器结束的字体样式 */
+	.active{color: #22C572;}
+	.button{width: 80%; height: 100rpx; line-height: 100rpx; background-color: #5473E8; border-radius: 60rpx;
+		
+	}
+</style>

+ 940 - 0
public/login.vue

@@ -0,0 +1,940 @@
+<template>
+	<view class="container">
+		<view class="back-btn cuIcon-back" @click="navBack"></view>
+		<!-- 设置白色背景防止软键盘把下部绝对定位元素顶上来盖住输入框等 -->
+		<view class="wrapper">
+			<image style='width:38px;height:38px;margin-bottom:10px;' src='../../static/img/login/logo@2x.png'></image>
+			<h2 class="title Semibold">欢迎使用易粮易运</h2>
+			<view style='width:100%;margin-top:50px;border-bottom:1px solid #E8E9ED;padding:10px;' class="flex">
+				<view class="phone-before-num NumberMedium">+86</view>
+				<view style='width:85%;'><input style='padding-left:10px;' class="NumberMedium" v-model='phone' @input='changephone' placeholder="请输入手机号码" type="number" maxlength="11"></view>
+				<image v-if='phone!=""' @click='phone=""' class='close' src='../../static/img/login/guanbi@2x.png'></image>
+			</view>
+			<button @click='gocode' :class='codestatus?"active":""' class='Regular verificationCode'>获取验证码</button>
+			<view @click='gonumber' class="Regular use-password" style='text-align:center;color:#6A6A6A;'>使用账号密码登录</view>
+			
+			<button v-if='tabbar' @click='goregister' class='Regular register active'>手机号一键注册</button>
+		</view>
+		<view v-if="loginType === 'phone'" class="register-section">
+			还没有账号?
+			<text @click="toRegist">马上注册</text>
+		</view>
+	</view>
+</template>
+
+<script>
+	import {
+		mapMutations
+	} from 'vuex';
+	import { openFSqlite, createFSQL, selectFSQL, addFSQL } from '../../util/f.js'
+	import { queryData, upData, initData } from '../../util/dbUtil.js'
+	import {
+		mapState
+	} from 'vuex';
+	export default {
+		data() {
+			return {
+				inputContent: null,
+				loginType: "wechat",
+				phone: '',
+				password: '',
+				logining: false,
+				isPhone: false,
+				isApple: true,
+				accessToken:'',
+				phone:'',
+				params:{
+					encryptedData:'',
+					session_key:'',
+					iv:'',
+				},
+				userInfo:{
+					nickName:'',
+					avatarUrl:'',
+					gender:'',
+					phone:''
+				},
+				inputStatus:'none',
+				verifyCode:null,
+				sendText:'获取验证码',
+				sendDisabled: false,
+				system:'',
+				platform:'',
+				userData:undefined,
+				tabbar: true,
+				windowHeight: '',
+				canIUseProfile:false,
+				codestatus:false
+			}
+		},
+		computed: {
+			...mapState(['clientId'])
+		},
+		onShow() {
+			// this.loginType = "wechat"
+			this.$api.logout()
+		},
+		onLoad(options) {    
+			    uni.onWindowResize((res) => {
+			        if(res.size.windowHeight < this.windowHeight){
+			            this.tabbar = false
+			        }else{
+			            this.tabbar = true
+			       }
+				   })
+			if( wx.getUserProfile ){  
+			    console.log('--check getUserProfile--OK');  
+			    this.canIUseProfile = true;  
+			} 
+			console.log("login on load")
+			var that = this
+			that.$api.request('user', 'sendIsApple', {
+			}).then(res => {
+				that.isApple = res.data
+			})
+			 uni.getSystemInfo({
+				success:(res) => {
+					this.windowHeight = res.windowHeight;
+					// console.log(res)
+					this.system = res.system  // ios
+					this.platform = res.platform  // 14.3
+				}
+			})
+		},
+		methods: {
+			changephone(e){
+				if(e.detail.value.length>11){
+					this.codestatus=true
+				}else if(e.detail.value.length<11){
+					this.codestatus=false
+				}else{
+					this.codestatus=true
+				}
+			},
+			gonumber(){
+				uni.navigateTo({
+					url:'/pages/public/login_account_number'
+				})
+			},
+			forgetpass(){
+				uni.navigateTo({
+					url:'/pages/public/reset'
+				})
+			},
+			gocode(){
+				if(this.phone.length==11){
+					uni.navigateTo({
+						url:'/pages/public/code?phone='+this.phone
+					})
+				}
+				else if(this.phone.length==0){
+					uni.showToast({
+					 title:'手机号不能为空',
+					 icon:'none'
+					})
+				}else{
+					uni.showToast({
+					 title:'请输入正确的手机号',
+					 icon:'none'
+					})
+				}
+				
+			},
+			goregister(){
+				uni.navigateTo({
+					url:'/pages/public/register'
+				})
+			},
+			phonelogin(){
+				var that=this
+				uni.showLoading({
+					title: '登录中',
+					mask:true
+				})
+				console.log("clientid",that.clientId)
+				this.$api.request('user', 'login',{
+					password:that.password,
+					phone:that.phone,
+					cid:that.clientId
+				}, failres => {
+			           that.$api.msg(failres.errmsg)
+			           uni.hideLoading()
+			    }).then(res => {
+					console.log(res)
+					uni.setStorageSync('userInfo', res.data)
+					that.$store.commit('login', res.data)
+					// that.liangxinLogin()
+					uni.switchTab({
+						url: '/pages/sale/information'
+					});
+					uni.hideLoading()
+				})
+			},
+			appleLogin(){
+			    var that=this
+			    uni.getProvider({
+			     service: 'oauth',
+			     success: function (res) {
+			      // console.log(res.provider)
+			      if(~res.provider.indexOf('apple')) {
+			       uni.login({
+			        provider: 'apple',
+			        success: loginRes => {
+			         uni.getUserInfo({
+			          provider: 'apple',
+			          success: userInfoRes => {
+			           
+			          that.$api.request('user', 'thirdPartLogin', {
+			           loginType: 4/*  */,
+			           raw: JSON.stringify(userInfoRes.userInfo)
+			          }, failres => {
+			           that.$api.msg(failres.errmsg)
+			           uni.hideLoading()
+			          }).then(res => {
+			           console.log("thirdPartLogin:"+res.data.phone)
+			           that.accessToken = res.data.accessToken
+			           that.logining = false
+			           uni.getUserInfo({
+			            lang: 'zh_CN',
+			            success: (e) => {
+			             uni.setStorageSync('userInfo', res.data)
+			             that.$store.commit('login', res.data)
+			             e.userInfo.nickname = e.userInfo.nickName
+						 e.userInfo.cid = uni.getStorageSync("clientId")
+			             that.$api.request('user', 'syncUserInfo', e.userInfo).then(syncRes => {
+			              //同步过后
+			              res.data.nickname = e.userInfo.nickName
+			              res.data.avatarUrl = e.userInfo.avatarUrl
+			              res.data.gender = e.userInfo.gender
+			              
+			              if(!res.data.phone){
+			               res.data.phone = e.userInfo.phone
+			              }
+			              
+			              uni.setStorageSync('userInfo', res.data)
+			              that.$store.commit('login', res.data)
+			             })
+			            },
+			            complete: (e) => {
+			             uni.hideLoading()
+			             
+			             if(!res.data.phone||res.data.phone==""||res.data.phone ==undefined){
+			              that.isPhone = true//显示自定义的获取手机权限提示框
+			              that.inputStatus = 'inline'
+			              that.inputContent = ''
+			             }
+			             else{
+			              uni.switchTab({
+			               url: '/pages/sale/sale'
+			              });
+			              console.log("complete")
+			             }
+			            }
+			           })
+			           
+			           })
+			           console.log('获取用户信息成功'+JSON.stringify(userInfoRes))
+			          }
+			         })
+			        },
+			        fail: err => {
+			         console.log('apple登录失败' + JSON.stringify(err))
+			         uni.showToast({
+			          title:'登录失败',
+			          icon:'none'
+			         })
+			        }
+			       })
+			      }
+			     },
+			     fail: err => {
+			      uni.showToast({
+			       title:'登录失败',
+			       icon:'none'
+			      })
+			     }
+			    })
+			   },
+			   doGetVerify() {
+				const that = this
+				var phone = this.inputContent;
+				if (!phone || phone.length != 11) {
+					uni.showToast({
+						title:'请输入正确手机号!',
+						icon:'none'
+					})
+					return
+				}
+				
+				that.$api.request('user', 'sendVerifyCode', {
+					phone: phone,
+				}).then(res => {
+					that.sendDisabled = true
+					let sec = 60
+					let interval = setInterval(() => {
+						sec--;
+						that.sendText = sec + 's后重发'
+						if (sec <= 0) {
+							that.sendDisabled = false
+							that.sendText = "获取验证码"
+							clearInterval(interval)
+						}
+					}, 1000)
+				})	
+			},
+			verifyCodeInput(e){
+				this.verifyCode = e.detail.value
+			},
+			cancel() {
+				this.inputShow = false
+				this.inputStatus = 'none'
+				this.isPhone = false
+			},
+			confirm() {
+				var that = this
+				if (!this.inputContent || this.inputContent.length != 11) {
+					uni.showToast({
+						title:'请输入正确手机号!',
+						icon:'none'
+					})
+					return
+				}
+				if (!this.verifyCode) {
+					uni.showToast({
+						title:'请输入验证码!',
+						icon:'none'
+					})
+					return
+				}
+				this.$api.request('user', 'mergeUser', {
+					phone: that.inputContent,
+					verifyCode:that.verifyCode
+				},failres => {
+					that.$api.msg(failres.errmsg)
+					uni.hideLoading()
+				}).then(res => {
+					that.accessToken = res.data.accessToken
+					that.$api.setUserInfo(res.data)
+					that.logining = false
+					uni.getUserInfo({
+						lang: 'zh_CN',
+						success: (e) => {
+							uni.setStorageSync('userInfo', res.data)
+							that.$store.commit('login', res.data)
+							e.userInfo.nickname = e.userInfo.nickName
+							e.userInfo.cid = uni.getStorageSync("clientId")
+							console.log(e.userInfo)
+							that.$api.request('user', 'syncUserInfo', e.userInfo).then(syncRes => {
+								//同步过后
+								res.data.nickname = e.userInfo.nickName
+								res.data.avatarUrl = e.userInfo.avatarUrl
+								res.data.gender = e.userInfo.gender
+								res.data.phone = e.userInfo.phone
+								uni.setStorageSync('userInfo', res.data)
+								that.$store.commit('login', res.data)
+								// that.liangxinLogin()
+							})
+						},
+						complete: (e) => {
+							uni.switchTab({
+								url: '/pages/sale/information'
+							});
+							uni.hideLoading()
+							that.isPhone=false
+							
+							uni.navigateBack()
+						}
+					})
+				})
+				
+			},
+			...mapMutations(['login']),
+			inputChange(e) {
+				const key = e.currentTarget.dataset.key;
+				this[key] = e.detail.value;
+			},
+			chooseLoginType(type) {
+				this.loginType = type
+			},
+			navBack() {
+				uni.navigateBack();
+			},
+			toRegist() {
+				uni.redirectTo({
+					url: '/pages/public/register'
+				})
+			},
+			///发起消息订阅
+			requestSubscribe(){
+				const that = this
+				wx.requestSubscribeMessage({
+			        tmplIds: ['xL_uZEqJz4QP1FbnlzQWAiO2zVBn3Qeu8JwLVOU3hU0','8cVkckXi_8zfHeScXRHhjN6cgZFYYCWIMPDTiPWagXY','IE7WxBsv-fDvPWSrng-97lGWtvZf9rHuECBlhRLlWxI'],//
+			        success :(res)=>{
+			          console.log("订阅消息 成功 "+res);
+			         },
+			        fail :(errMsg) =>{ 
+			          console.log("订阅消息 失败 "+errMsg.errMsg);
+			        },
+			        complete:(errMsg)=>{
+			          console.log("订阅消息 完成 "+errMsg);
+					  
+			        }
+			    
+			      });
+			},
+			getPhoneNumber(e) {
+				
+			  console.log(e)
+			  if (e.mp.detail.errMsg==="getPhoneNumber:ok") {
+				this.isPhone = false
+				this.params.iv = e.mp.detail.iv
+				this.params.encryptedData = e.mp.detail.encryptedData
+				this.params.session_key = this.accessToken
+				console.log(this.params)
+				this.getTokenAsync(this.params)
+			  }
+			  
+			},
+			 // 请求后获取token
+			async getTokenAsync(params) {
+				let that = this
+				this.$api.request('user', 'getPhoneNumber', params).then(res => {
+					 if(res.data.phoneNumber){
+						 that.userInfo.phone = res.data.phoneNumber
+					 }
+					 if(res.data.unionId){
+						 that.userInfo.unionId = res.data.unionId
+					 }
+					 
+					 that.userInfo.cid = uni.getStorageSync("clientId")
+					 console.log(that.userInfo)
+					 that.$api.request('user', 'syncUserInfo', that.userInfo).then(syncRes => {
+					 	uni.setStorageSync('userInfo', that.userInfo)
+					 	that.$store.commit('login', that.userInfo)
+					 	that.$api.setUserInfo(that.userInfo)
+					 	uni.hideLoading()
+						// that.liangxinLogin()
+					 }) 
+					 if(res.data.phoneNumber){
+						uni.switchTab({
+							url: '/pages/sale/information'
+						});
+					 }
+					 
+				 })
+			},
+			async toLogin() {
+				this.verifyCode = ''
+				const that = this
+				if (that.phone.length !== 11) {
+					that.$api.msg('请输入11位中国手机号')
+				} else if (that.password.length < 8) {
+					that.$api.msg('密码至少8位')
+				} else {
+					that.logining = true;
+					//#ifdef MP-WEIXIN
+					//若是小程序平台,则获取到openId。整个过程是静默完成的
+					uni.login({
+						provider: 'weixin',
+						success: (wxres => {
+							that.$api.request('user', 'login', {
+								phone: that.phone,
+								password: that.password,
+								loginType: 1,
+								raw: JSON.stringify(wxres)
+							}, failres => {
+								that.logining = false
+								uni.showToast({
+									title: failres.errmsg,
+									icon: "none"
+								});
+							}).then(res => {
+								that.logining = false
+								that.$store.commit('login', res.data)
+								uni.setStorageSync('userInfo', res.data)
+								if (that.$api.prePage().lodaData) {
+									that.$api.prePage().loadData()
+								}
+								uni.navigateBack()
+							})
+						})
+					})
+					//#endif
+					//#ifdef APP-PLUS || H5
+					//若是App登录,则不需要保存OpenId。可直接登录
+					that.$api.request('user', 'login', {
+						phone: that.phone,
+						password: that.password,
+					}, failres => {
+						that.logining = false
+						uni.showToast({
+							title: failres.errmsg,
+							icon: "none"
+						});
+					}).then(res => {
+						that.logining = false
+						that.$store.commit('login', res.data)
+						uni.setStorageSync('userInfo', res.data)
+						if (that.$api.prePage().lodaData) {
+							that.$api.prePage().loadData()
+						}
+						uni.navigateBack()
+					})
+					//#endif
+				}
+			},
+			
+			miniWechatLogin(e) {
+				const that = this
+				 //旧版本方式  
+				if( this.canIUseProfile == false ){  
+					console.log("旧版本方式")
+					//获取授权信息  
+					if(e.detail.userInfo){  
+			
+					console.log('用户允许了授权')  
+					console.log( e.detail.userInfo );   //1.拿到基本的微信信息!!  
+			
+					 uni.showLoading({
+					 	title: '加载中',
+						mask:true
+					 })
+					 that.logining = true
+					 let loginType = 1
+					 let userInfo = e.detail.userInfo
+					 uni.login({
+					 	provider: 'weixin',
+					 	success: (wxres => {
+					 		that.logining = false
+					 		that.$api.request('user', 'thirdPartLogin', {
+					 			loginType: loginType,
+					 			raw: JSON.stringify(wxres)
+					 		}, failres => {
+					 			that.$api.msg(failres.errmsg)
+					 			uni.hideLoading()
+					 		}).then(res => {
+					 			that.accessToken = res.data.accessToken
+					 			that.$api.setUserInfo(res.data)
+					 			that.userInfo = res.data
+					 			uni.getUserInfo({
+					 				lang: 'zh_CN',
+					 				provider: 'weixin',
+					 				withCredentials:true,
+					 				success: (e) => {
+					 					that.params.iv = e.iv
+					 					that.params.encryptedData = e.encryptedData
+					 					that.params.session_key = that.accessToken
+					 					console.log(this.params)
+					 					that.getTokenAsync(this.params)
+					 					uni.setStorageSync('userInfo', res.data)
+					 					that.$store.commit('login', res.data)
+					 					e.userInfo.nickname = e.userInfo.nickName
+					 					if(e.userInfo.phone == undefined){
+					 						e.userInfo.phone = ''
+					 					}
+										e.userInfo.cid = uni.getStorageSync("clientId")
+					 					console.log(e.userInfo)
+					 					that.$api.request('user', 'syncUserInfo', e.userInfo).then(syncRes => {
+					 						//同步过后
+					 						res.data.nickname = userInfo.nickName
+					 						res.data.avatarUrl = userInfo.avatarUrl
+					 						res.data.gender = userInfo.gender
+					 						if(userInfo.phone){
+					 							res.data.phone = userInfo.phone
+					 							// that.liangxinLogin()
+					 						}
+					 						uni.setStorageSync('userInfo', res.data)
+					 						that.$store.commit('login', res.data)
+					 						that.$api.setUserInfo(res.data)
+					 														
+					 						uni.hideLoading()
+					 						// uni.navigateBack()
+					 					})
+					 				},
+					 				complete: (e) => {
+					 					uni.hideLoading()
+					 					
+					 					if(!res.data.phone||res.data.phone==""||res.data.phone ==undefined){
+					 						that.isPhone = true//显示自定义的获取手机权限提示框
+					 						that.inputStatus = 'inline'
+					 						that.inputContent = ''
+					 					}
+					 					else{
+					 						uni.setStorageSync('PageCur', "sale");
+					 						// uni.switchTab({
+					 						// 	url: '/pages/sale/sale'
+					 						// });
+					 						uni.switchTab({
+					 							url: '/pages/sale/information'
+					 						});
+					 						console.log("complete")
+					 					}
+					 				}
+					 			})
+					 		})
+					 	}),
+					 	
+					 })
+			
+					}  
+			
+				//新版本方式  
+				}else{  
+					console.log("新版本方式")
+					uni.showLoading({
+					 	title: '加载中',
+						mask:true
+					 })
+					 that.logining = true
+					 let loginType = 1
+					wx.getUserProfile({  
+						desc : '用于完善用户资料',  
+						lang : 'zh_CN',  
+						success : function( proRes ){  
+							console.log('proRes.userInfo',proRes.userInfo)
+							uni.login({
+								provider: 'weixin',
+								success: (wxres => {
+									that.logining = false
+									that.$api.request('user', 'thirdPartLogin', {
+										loginType: loginType,
+										raw: JSON.stringify(wxres)
+									}, failres => {
+										that.$api.msg(failres.errmsg)
+										uni.hideLoading()
+									}).then(res => {
+										console.log('res+++++',res)
+										that.accessToken = res.data.accessToken
+										that.$api.setUserInfo(res.data)
+										that.userInfo = res.data
+										// that.params.iv = proRes.iv
+										// that.params.encryptedData = proRes.encryptedData
+										// that.params.session_key = that.accessToken
+										// console.log(that.params)
+										// that.getTokenAsync(that.params)
+										uni.setStorageSync('userInfo', res.data)
+										that.$store.commit('login', res.data)
+										if(proRes.userInfo.phone == undefined){
+											proRes.userInfo.phone = ''
+										}
+										res.data.cid = uni.getStorageSync("clientId")
+										that.$api.request('user', 'syncUserInfo', res.data).then(syncRes => {
+											//同步过后
+											res.data.nickname = proRes.userInfo.nickName
+											res.data.avatarUrl = proRes.userInfo.avatarUrl
+											res.data.gender = proRes.userInfo.gender
+											if(proRes.userInfo.phone){
+												res.data.phone = proRes.userInfo.phone
+											}
+											uni.setStorageSync('userInfo', res.data)
+											that.$store.commit('login', res.data)
+											that.$api.setUserInfo(res.data)
+											uni.hideLoading()
+											if(!that.userInfo.phone||that.userInfo.phone==""||that.userInfo.phone ==undefined){
+												that.isPhone = true//显示自定义的获取手机权限提示框
+												that.inputStatus = 'inline'
+												that.inputContent = ''
+											}
+											else{
+												uni.setStorageSync('PageCur', "sale");
+												// uni.switchTab({
+												// 	url: '/pages/sale/sale'
+												// });
+												uni.reLaunch({
+													url: '/pages/sale/information'
+												});
+												console.log("complete")
+												// that.liangxinLogin()
+											}
+										})		
+										console.log( 'wx.getUserProfile=>用户允许了授权' );
+									})
+								})
+							})
+			
+						},  
+						fail : function( res ){  
+							console.log('wx.getUserProfile=>用户拒绝了授权');  
+							console.log( res );  
+			
+						}
+					});  
+			
+				}  
+				
+				// 获取用户的当前设置,判断是否点击了“总是保持以上,不在询问”
+				// wx.getSetting({
+				//  	 withSubscriptions: true,//是否获取用户订阅消息的订阅状态,默认false不返回
+				//    success(res){
+				// 	
+				//    if(res.subscriptionsSetting.mainSwitch){
+				    
+				//    }else{
+					  
+				// 	}
+				// 	}
+				// })
+				// uni.showModal({
+				// 	  title: '温馨提示',
+				// 	  content: '为更好的与您沟通,小程序需要向您发送通知消息',
+				// 	  confirmText:"同意",
+				// 	  cancelText:"拒绝",
+				// 	  showCancel: false,
+				// 	  success: function (res) {
+				// 		  if (res.confirm) {
+				// 			 //调用订阅消息
+				// 			  that.requestSubscribe();
+				// 		  } else if (res.cancel) {
+				// 			  ///显示第二个弹说明一下
+				// 			  wx.showModal({
+				// 				title: '温馨提示',
+				// 				content: '拒绝后您将无法获取实时的交易、物流消息',
+				// 				confirmText:"知道了",
+				// 				showCancel:false,
+				// 				success: function (res) {
+				// 					 uni.openSetting({ // 打开设置页
+				// 					   success(res) {
+				// 						console.log(res.authSetting)
+				// 					   }
+				// 					 });
+				// 				}
+				// 			});
+				// 		  }
+				// 	  }
+				// });
+				
+				
+
+
+
+			},
+			wechatLogin() {
+				const that = this
+				that.logining = true
+				let loginType = 2
+				uni.showLoading({
+					title: '正在同步消息',
+					mask:true
+				})
+				uni.login({
+					provider: 'weixin',
+					success: (wxres => {
+						that.$api.request('user', 'thirdPartLogin', {
+							loginType: loginType,
+							raw: JSON.stringify(wxres)
+						}, failres => {
+							that.$api.msg(failres.errmsg)
+							uni.hideLoading()
+						}).then(res => {
+							console.log("thirdPartLogin:"+res.data.phone)
+							that.accessToken = res.data.accessToken
+							that.logining = false
+							uni.getUserInfo({
+								lang: 'zh_CN',
+								success: (e) => {
+									uni.setStorageSync('userInfo', res.data)
+									that.$store.commit('login', res.data)
+									e.userInfo.nickname = e.userInfo.nickName
+									e.userInfo.cid = uni.getStorageSync("clientId")
+									console.log(e.userInfo)
+									that.$api.request('user', 'syncUserInfo', e.userInfo).then(syncRes => {
+										//同步过后
+										res.data.nickname = e.userInfo.nickName
+										res.data.avatarUrl = e.userInfo.avatarUrl
+										res.data.gender = e.userInfo.gender
+										if(res.data.phone){
+											res.data.phone = e.userInfo.phone
+											// that.liangxinLogin()
+										}
+										
+										uni.setStorageSync('userInfo', res.data)
+										that.$store.commit('login', res.data)
+									})
+								},
+								complete: (e) => {
+									uni.hideLoading()
+									
+									if(!res.data.phone||res.data.phone==""||res.data.phone ==undefined){
+										that.isPhone = true//显示自定义的获取手机权限提示框
+										that.inputStatus = 'inline'
+										that.inputContent = ''
+									}
+									else{
+										// uni.switchTab({
+										// 	url: '/pages/sale/sale'
+										// });
+										uni.switchTab({
+											url: '/pages/sale/information'
+										});
+										console.log("complete")
+										
+									}
+									
+								}
+							})
+							
+						})
+					})
+				})
+			},
+			wechatH5Login() {
+				const that = this
+				let href = window.location.origin
+				let page = that.$api.prePage()
+				let prePath = '/pages/index/index'
+				if (page) {
+					prePath = page.__page__.path
+				}
+				window.location = 'https://open.weixin.qq.com/connect/oauth2/authorize?' 
+				+ 'appid=' + that.$api.defConfig().h5Appid + '&redirect_uri=' + escape(href) + '&response_type=code&scope=snsapi_userinfo&state=' + escape(prePath) + '#wechat_redirect'
+			},
+			liangxinLogin(){
+				const that = this
+				var userInfoTmp = uni.getStorageSync("userInfo")
+				console.log('userInfoTmp',userInfoTmp)
+				that.$socket.login(userInfoTmp.phone, "123456", null, res=>{
+					console.log('粮信登录',res)
+					if (res.success) {
+						that.$socket.showLoginDialog = false
+						// 缓存用户
+						that.userData = res.response.data
+						console.log('userData',that.userData)
+						that.$u.vuex("userData", that.userData);
+						// 	缓存通讯录
+						that.$socket.listGuests(that.userData.user.operId, res => {						
+							// #ifdef APP-PLUS
+							createFSQL(that.userData.user.operId).then();
+							let contact = res.response.data;
+							contact.forEach(c=>{
+								c.members.forEach(m=>{
+									m.name = c.name;
+									addFSQL(m, that.userData.user.operId).then();
+								})
+							})
+							// #endif
+							that.$u.vuex('firendItem', res.response.data)
+						});
+						
+						// 缓存消息列表
+						that.$socket.queryOnlineMessage(that.userData.user.operId,q =>{
+							let data = q.response.data;
+							for(var i in data){
+								initData(data[i].groupMsg.list, data[i].groupInfo.chatId);
+							}
+						})
+						
+						//	缓存链接
+						that.$socket.getLinks(that.userData.user.operId, res=>{
+							that.$u.vuex('linkItem',res.response.data)
+						});
+						
+						
+						// // 跳转到消息列表
+						// that.$u.route({
+						// 	url: 'pages/home/home',
+						// 	type: 'switchTab'
+						// });
+					} else {
+					  uni.showModal({
+						title:res.reason + ",请稍后再试",
+						showCancel:false
+					  })
+					}
+				});
+			}
+		},
+
+	}
+</script>
+
+<style lang='scss' scoped>
+	.apple{
+		background: #000;
+		width: 35px;
+		height: 35px;
+		padding: 8px;
+		border-radius: 50%;
+		vertical-align: middle;
+	}
+	page {
+		background: #fff;
+	}
+	.cuIcon-weixin{
+		background: #39b54a;
+		color: #fff;
+		font-size: 18px;
+		padding: 9px;
+		border-radius: 50%;
+		vertical-align: middle;
+		margin-right:5px;
+	}
+	.close{
+		width:20px;height:20px;position:absolute;
+		right:30px;
+	}
+	.container {
+		padding-top: 85px;
+		position: relative;
+		width: 100vw;
+		height: 100vh;
+		overflow: hidden;
+		background: url('~@/static/img/login/bg.png');
+		background-size:100%;
+	}
+
+	.wrapper {
+		position: relative;
+		z-index: 90;
+		padding-bottom: 40upx;
+		height:100%;
+		padding:0 30px;
+	}
+
+	.back-btn {
+		position: absolute;
+		left: 40upx;
+		z-index: 9999;
+		padding-top: var(--status-bar-height);
+		top: 40upx;
+		font-size: 40upx;
+		color: $font-color-dark;
+	}
+	.verificationCode{
+		margin-top:20px;
+		background:#F5F6F9;
+		color:#AFB3BF;
+	}
+	.verificationCode.active{
+		background:#22C572;
+		color:#fff;
+	}
+	.verificationCode:after{
+		border:none;
+	}
+	.register{
+		position:absolute;
+		bottom:136rpx;
+		left:50%;
+		transform: translateX(-50%);
+		color:#333333;
+		border-radius:43rpx;
+		border: 1px solid #444444;
+		font-size: 28rpx;
+		
+	}
+	.register:after{
+		border:none;
+	}
+	.title{
+		font-size: 46rpx;
+	}
+	.phone-before-num{
+		font-size: 34rpx;
+		font-family: DINPro-Medium, DINPro;
+		font-weight: 500;
+		color: #333333;
+	}
+	.use-password{
+		margin-top: 31rpx;
+	}
+</style>

+ 963 - 0
public/login_account_number.vue

@@ -0,0 +1,963 @@
+<template>
+	<view class="container">
+		<view class="back-btn cuIcon-back" @click="navBack"></view>
+		<!-- 设置白色背景防止软键盘把下部绝对定位元素顶上来盖住输入框等 -->
+		<view class="wrapper">
+			<image style='width:38px;height:38px;margin-bottom:10px;' src='../../static/img/login/logo@2x.png'></image>
+			<h2 class="title Semibold">欢迎使用易粮易运</h2>
+			<view style='position:relative;width:100%;margin-top:50px;border-bottom:1px solid #E8E9ED;padding:10px;align-items: center;' class="flex">
+				<view class="phone-before-num NumberMedium">+86</view>
+				<view style='width:85%;'>
+					<u-input class="phone-number" :custom-style='{"fontSize":"16px"}'  maxlength='11' v-model='phone' placeholder="请输入手机号码" type="number"/>
+					<!-- <input style='padding-left:10px;' maxlength='11' v-model='phone' placeholder="请输入手机号码" type="number"> -->
+					</view>
+			<!-- <image v-if='phone!=""' @click='phone=""' class='close' src='../../static/img/login/guanbi@2x.png'></image> -->
+			</view>
+			<view style='margin-top:20px;border-bottom:1px solid #E8E9ED;position:relative;'>
+				<u-input class='password' style='height:40px;' :custom-style='{"fontSize":"16px"}' v-model='password' placeholder="请输入密码,6-16位字符" :type="type" value="" />
+				<!-- <input class='password' style='height:40px;' v-model='password' placeholder="请输入密码,6-16位字符" :type="type" value="" />
+				<view @click='switchover' style='position:absolute;right:0;top:38%;z-index:10;cursor:pointer;' class="iconfont " :class='type=="password"?"icon-yanjing-biyan":"icon-yanjing-zhengyan"'></view>
+				<image v-if='password!=""' @click='password=""' class='close2' src='../../static/img/login/guanbi@2x.png'></image> -->
+			</view>
+			<button :class='phone!=""&&password!=""?"active":""' @click='passlogin' class='Regular verificationCode'>登录</button>
+			<button @click='goregister' class='verificationCode active Regular'>手机号一键注册</button>
+			<view class='flex' style='color:#6A6A6A;margin-top:10px;'>
+				<view style='flex:1;text-align:center;border-right:1px solid #E8E9ED;' class="Regular" @click="forgetpass()">忘记密码</view>
+				<view @click='gocode' style='flex:1;text-align:center;' class="Regular">验证码登录</view>
+			</view>
+		</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	import {
+		mapMutations
+	} from 'vuex';
+	import { openFSqlite, createFSQL, selectFSQL, addFSQL } from '../../util/f.js'
+	import { queryData, upData, initData } from '../../util/dbUtil.js'
+	import {
+		mapState
+	} from 'vuex';
+	export default {
+		data() {
+			return {
+				inputContent: null,
+				loginType: "wechat",
+				phone: '',
+				password: '',
+				logining: false,
+				isPhone: false,
+				isApple: true,
+				accessToken:'',
+				params:{
+					encryptedData:'',
+					session_key:'',
+					iv:'',
+				},
+				userInfo:{
+					nickName:'',
+					avatarUrl:'',
+					gender:'',
+					phone:''
+				},
+				type:'password',
+				inputStatus:'none',
+				verifyCode:null,
+				sendText:'获取验证码',
+				sendDisabled: false,
+				system:'',
+				platform:'',
+				userData:undefined,
+				canIUseProfile:false
+			}
+		},
+		computed: {
+			...mapState(['clientId'])
+		},
+		onShow() {
+			// this.loginType = "wechat"
+			this.$api.logout()
+		},
+		onLoad(options) {
+			
+			if( wx.getUserProfile ){  
+			    console.log('--check getUserProfile--OK');  
+			    this.canIUseProfile = true;  
+			} 
+			console.log("login on load")
+			var that = this
+			that.$api.request('user', 'sendIsApple', {
+			}).then(res => {
+				that.isApple = res.data
+			})
+			 uni.getSystemInfo({
+				success:(res) => {
+					// console.log(res)
+					this.system = res.system  // ios
+					this.platform = res.platform  // 14.3
+				}
+			})
+		},
+		methods: {
+			passlogin(e){
+				var that=this
+				uni.showLoading({
+					title: '登录中',
+					mask:true
+				})
+				console.log("clinetId",this.clientId)
+				this.$api.doRequest('get','/commonUser/login',{phone:this.phone,password:this.password,cid:this.clientId}).then(res => {
+					if(res.data.code==200){
+						console.log("userInfo",res.data.data)
+						uni.setStorageSync('userInfo', res.data.data)
+						this.$api.doRequest('post','/commonUser/api/loginQuickly',{mobilePhone: this.phone,
+						veriCode: "123456",}).then(res1 => {
+							console.log("loginQuickly",res)
+							if(res1.data.code==200){
+								uni.setStorageSync('pcUserInfo', res1.data.data)
+							}
+							else{
+								that.$api.doRequest('post','/commonUser/api/loginQuickly',{mobilePhone: '13333333333',
+								veriCode: "123456",}).then(res2 => {
+									uni.setStorageSync('pcUserInfo', res2.data.data)
+								})
+							}
+							
+						})
+						that.$store.commit('login', res.data.data)
+						var name = 'userInfo';
+						var value = res.data.data;
+						that.$store.commit('$uStore', {
+							name,
+							value
+						});
+						// that.liangxinLogin()
+						
+						uni.switchTab({
+							url: '/pages/sale/information'
+						});
+						uni.hideLoading()
+					}else{
+						uni.hideLoading()
+						uni.showToast({
+							title: res.data.message,
+							icon:'none',
+							duration: 2000
+						})
+					}
+				})
+				.catch(res => {
+				    console.log(res);
+				});
+			},
+			switchover(){
+				if(this.type=='password'){
+					this.type='text'
+				}else{
+					this.type='password'
+				}
+			},
+			gocode(){
+				uni.navigateTo({
+					url:'/pages/public/login'
+				})
+			},
+			forgetpass(){
+				uni.navigateTo({
+					url:'/pages/public/reset'
+				})
+			},
+			goregister(){
+				uni.navigateTo({
+					url:'/pages/public/register'
+				})
+			},
+			appleLogin(){
+			    var that=this
+			    uni.getProvider({
+			     service: 'oauth',
+			     success: function (res) {
+			      // console.log(res.provider)
+			      if(~res.provider.indexOf('apple')) {
+			       uni.login({
+			        provider: 'apple',
+			        success: loginRes => {
+			         uni.getUserInfo({
+			          provider: 'apple',
+			          success: userInfoRes => {
+			           
+			          that.$api.request('user', 'thirdPartLogin', {
+			           loginType: 4/*  */,
+			           raw: JSON.stringify(userInfoRes.userInfo)
+			          }, failres => {
+			           that.$api.msg(failres.errmsg)
+			           uni.hideLoading()
+			          }).then(res => {
+			           console.log("thirdPartLogin:"+res.data.phone)
+			           that.accessToken = res.data.accessToken
+			           that.logining = false
+			           uni.getUserInfo({
+			            lang: 'zh_CN',
+			            success: (e) => {
+			             uni.setStorageSync('userInfo', res.data)
+			             that.$store.commit('login', res.data)
+			             e.userInfo.nickname = e.userInfo.nickName
+						 e.userInfo.cid = uni.getStorageSync("clientId")
+			             that.$api.request('user', 'syncUserInfo', e.userInfo).then(syncRes => {
+			              //同步过后
+			              res.data.nickname = e.userInfo.nickName
+			              res.data.avatarUrl = e.userInfo.avatarUrl
+			              res.data.gender = e.userInfo.gender
+			              
+			              if(!res.data.phone){
+			               res.data.phone = e.userInfo.phone
+			              }
+			              
+			              uni.setStorageSync('userInfo', res.data)
+			              that.$store.commit('login', res.data)
+			             })
+			            },
+			            complete: (e) => {
+			             uni.hideLoading()
+			             
+			             if(!res.data.phone||res.data.phone==""||res.data.phone ==undefined){
+			              that.isPhone = true//显示自定义的获取手机权限提示框
+			              that.inputStatus = 'inline'
+			              that.inputContent = ''
+			             }
+			             else{
+			              uni.switchTab({
+			               url: '/pages/sale/sale'
+			              });
+			              console.log("complete")
+			             }
+			            }
+			           })
+			           
+			           })
+			           console.log('获取用户信息成功'+JSON.stringify(userInfoRes))
+			          }
+			         })
+			        },
+			        fail: err => {
+			         console.log('apple登录失败' + JSON.stringify(err))
+			         uni.showToast({
+			          title:'登录失败',
+			          icon:'none'
+			         })
+			        }
+			       })
+			      }
+			     },
+			     fail: err => {
+			      uni.showToast({
+			       title:'登录失败',
+			       icon:'none'
+			      })
+			     }
+			    })
+			   },
+			   doGetVerify() {
+				const that = this
+				var phone = this.inputContent;
+				if (!phone || phone.length != 11) {
+					uni.showToast({
+						title:'请输入正确手机号!',
+						icon:'none'
+					})
+					return
+				}
+				
+				that.$api.request('user', 'sendVerifyCode', {
+					phone: phone,
+				}).then(res => {
+					that.sendDisabled = true
+					let sec = 60
+					let interval = setInterval(() => {
+						sec--;
+						that.sendText = sec + 's后重发'
+						if (sec <= 0) {
+							that.sendDisabled = false
+							that.sendText = "获取验证码"
+							clearInterval(interval)
+						}
+					}, 1000)
+				})
+				
+			},
+			verifyCodeInput(e){
+				this.verifyCode = e.detail.value
+			},
+			cancel() {
+				this.inputShow = false
+				this.inputStatus = 'none'
+				this.isPhone = false
+			},
+			confirm() {
+				var that = this
+				if (!this.inputContent || this.inputContent.length != 11) {
+					uni.showToast({
+						title:'请输入正确手机号!',
+						icon:'none'
+					})
+					return
+				}
+				if (!this.verifyCode) {
+					uni.showToast({
+						title:'请输入验证码!',
+						icon:'none'
+					})
+					return
+				}
+				this.$api.request('user', 'mergeUser', {
+					phone: that.inputContent,
+					verifyCode:that.verifyCode
+				},failres => {
+					that.$api.msg(failres.errmsg)
+					uni.hideLoading()
+				}).then(res => {
+					that.accessToken = res.data.accessToken
+					that.$api.setUserInfo(res.data)
+					that.logining = false
+					uni.getUserInfo({
+						lang: 'zh_CN',
+						success: (e) => {
+							uni.setStorageSync('userInfo', res.data)
+							that.$store.commit('login', res.data)
+							e.userInfo.nickname = e.userInfo.nickName
+							e.userInfo.cid = uni.getStorageSync("clientId")
+							console.log(e.userInfo)
+							that.$api.request('user', 'syncUserInfo', e.userInfo).then(syncRes => {
+								//同步过后
+								res.data.nickname = e.userInfo.nickName
+								res.data.avatarUrl = e.userInfo.avatarUrl
+								res.data.gender = e.userInfo.gender
+								res.data.phone = e.userInfo.phone
+								uni.setStorageSync('userInfo', res.data)
+								that.$store.commit('login', res.data)
+								// that.liangxinLogin()
+							})
+						},
+						complete: (e) => {
+							uni.switchTab({
+								url: '/pages/sale/information'
+							});
+							uni.hideLoading()
+							that.isPhone=false
+							
+							uni.navigateBack()
+						}
+					})
+				})
+				
+			},
+			...mapMutations(['login']),
+			inputChange(e) {
+				const key = e.currentTarget.dataset.key;
+				this[key] = e.detail.value;
+			},
+			chooseLoginType(type) {
+				this.loginType = type
+			},
+			navBack() {
+				uni.navigateBack();
+			},
+			toRegist() {
+				console.log(11)
+				uni.redirectTo({
+					url: '/pages/public/register'
+				})
+			},
+			///发起消息订阅
+			requestSubscribe(){
+				const that = this
+				wx.requestSubscribeMessage({
+			        tmplIds: ['xL_uZEqJz4QP1FbnlzQWAiO2zVBn3Qeu8JwLVOU3hU0','8cVkckXi_8zfHeScXRHhjN6cgZFYYCWIMPDTiPWagXY','IE7WxBsv-fDvPWSrng-97lGWtvZf9rHuECBlhRLlWxI'],//
+			        success :(res)=>{
+			          console.log("订阅消息 成功 "+res);
+			         },
+			        fail :(errMsg) =>{ 
+			          console.log("订阅消息 失败 "+errMsg.errMsg);
+			        },
+			        complete:(errMsg)=>{
+			          console.log("订阅消息 完成 "+errMsg);
+					  
+			        }
+			    
+			      });
+			},
+			getPhoneNumber(e) {
+				
+			  console.log(e)
+			  if (e.mp.detail.errMsg==="getPhoneNumber:ok") {
+				this.isPhone = false
+				this.params.iv = e.mp.detail.iv
+				this.params.encryptedData = e.mp.detail.encryptedData
+				this.params.session_key = this.accessToken
+				console.log(this.params)
+				this.getTokenAsync(this.params)
+			  }
+			  
+			},
+			 // 请求后获取token
+			async getTokenAsync(params) {
+				let that = this
+				this.$api.request('user', 'getPhoneNumber', params).then(res => {
+					 if(res.data.phoneNumber){
+						 that.userInfo.phone = res.data.phoneNumber
+					 }
+					 if(res.data.unionId){
+						 that.userInfo.unionId = res.data.unionId
+					 }
+					 
+					 that.userInfo.cid = uni.getStorageSync("clientId")
+					 console.log(that.userInfo)
+					 that.$api.request('user', 'syncUserInfo', that.userInfo).then(syncRes => {
+					 	uni.setStorageSync('userInfo', that.userInfo)
+					 	that.$store.commit('login', that.userInfo)
+					 	that.$api.setUserInfo(that.userInfo)
+					 	uni.hideLoading()
+						// that.liangxinLogin()
+					 }) 
+					 if(res.data.phoneNumber){
+						uni.switchTab({
+							url: '/pages/sale/information'
+						});
+					 }
+					 
+				 })
+			},
+			async toLogin() {
+				this.verifyCode = ''
+				const that = this
+				if (that.phone.length !== 11) {
+					that.$api.msg('请输入11位中国手机号')
+				} else if (that.password.length < 8) {
+					that.$api.msg('密码至少8位')
+				} else {
+					that.logining = true;
+					//#ifdef MP-WEIXIN
+					//若是小程序平台,则获取到openId。整个过程是静默完成的
+					uni.login({
+						provider: 'weixin',
+						success: (wxres => {
+							that.$api.request('user', 'login', {
+								phone: that.phone,
+								password: that.password,
+								loginType: 1,
+								raw: JSON.stringify(wxres)
+							}, failres => {
+								that.logining = false
+								uni.showToast({
+									title: failres.errmsg,
+									icon: "none"
+								});
+							}).then(res => {
+								that.logining = false
+								that.$store.commit('login', res.data)
+								uni.setStorageSync('userInfo', res.data)
+								if (that.$api.prePage().lodaData) {
+									that.$api.prePage().loadData()
+								}
+								uni.navigateBack()
+							})
+						})
+					})
+					//#endif
+					//#ifdef APP-PLUS || H5
+					//若是App登录,则不需要保存OpenId。可直接登录
+					that.$api.request('user', 'login', {
+						phone: that.phone,
+						password: that.password,
+					}, failres => {
+						that.logining = false
+						uni.showToast({
+							title: failres.errmsg,
+							icon: "none"
+						});
+					}).then(res => {
+						that.logining = false
+						that.$store.commit('login', res.data)
+						uni.setStorageSync('userInfo', res.data)
+						if (that.$api.prePage().lodaData) {
+							that.$api.prePage().loadData()
+						}
+						uni.navigateBack()
+					})
+					//#endif
+				}
+			},
+			
+			miniWechatLogin(e) {
+				const that = this
+				 //旧版本方式  
+				if( this.canIUseProfile == false ){  
+					console.log("旧版本方式")
+					//获取授权信息  
+					if(e.detail.userInfo){  
+			
+					console.log('用户允许了授权')  
+					console.log( e.detail.userInfo );   //1.拿到基本的微信信息!!  
+			
+					 uni.showLoading({
+					 	title: '加载中',
+						mask:true
+					 })
+					 that.logining = true
+					 let loginType = 1
+					 let userInfo = e.detail.userInfo
+					 uni.login({
+					 	provider: 'weixin',
+					 	success: (wxres => {
+					 		that.logining = false
+					 		that.$api.request('user', 'thirdPartLogin', {
+					 			loginType: loginType,
+					 			raw: JSON.stringify(wxres)
+					 		}, failres => {
+					 			that.$api.msg(failres.errmsg)
+					 			uni.hideLoading()
+					 		}).then(res => {
+					 			that.accessToken = res.data.accessToken
+					 			that.$api.setUserInfo(res.data)
+					 			that.userInfo = res.data
+					 			uni.getUserInfo({
+					 				lang: 'zh_CN',
+					 				provider: 'weixin',
+					 				withCredentials:true,
+					 				success: (e) => {
+					 					that.params.iv = e.iv
+					 					that.params.encryptedData = e.encryptedData
+					 					that.params.session_key = that.accessToken
+					 					console.log(this.params)
+					 					that.getTokenAsync(this.params)
+					 					uni.setStorageSync('userInfo', res.data)
+					 					that.$store.commit('login', res.data)
+					 					e.userInfo.nickname = e.userInfo.nickName
+					 					if(e.userInfo.phone == undefined){
+					 						e.userInfo.phone = ''
+					 					}
+										e.userInfo.cid = uni.getStorageSync("clientId")
+					 					console.log(e.userInfo)
+					 					that.$api.request('user', 'syncUserInfo', e.userInfo).then(syncRes => {
+					 						//同步过后
+					 						res.data.nickname = userInfo.nickName
+					 						res.data.avatarUrl = userInfo.avatarUrl
+					 						res.data.gender = userInfo.gender
+					 						if(userInfo.phone){
+					 							res.data.phone = userInfo.phone
+					 							// that.liangxinLogin()
+					 						}
+					 						uni.setStorageSync('userInfo', res.data)
+					 						that.$store.commit('login', res.data)
+					 						that.$api.setUserInfo(res.data)
+					 														
+					 						uni.hideLoading()
+					 						// uni.navigateBack()
+					 					})
+					 				},
+					 				complete: (e) => {
+					 					uni.hideLoading()
+					 					
+					 					if(!res.data.phone||res.data.phone==""||res.data.phone ==undefined){
+					 						that.isPhone = true//显示自定义的获取手机权限提示框
+					 						that.inputStatus = 'inline'
+					 						that.inputContent = ''
+					 					}
+					 					else{
+					 						uni.setStorageSync('PageCur', "sale");
+					 						// uni.switchTab({
+					 						// 	url: '/pages/sale/sale'
+					 						// });
+					 						uni.switchTab({
+					 							url: '/pages/sale/information'
+					 						});
+					 						console.log("complete")
+					 					}
+					 				}
+					 			})
+					 		})
+					 	}),
+					 	
+					 })
+			
+					}  
+			
+				//新版本方式  
+				}else{  
+					console.log("新版本方式")
+					uni.showLoading({
+					 	title: '加载中',
+						mask:true
+					 })
+					 that.logining = true
+					 let loginType = 1
+					wx.getUserProfile({  
+						desc : '用于完善用户资料',  
+						lang : 'zh_CN',  
+						success : function( proRes ){  
+							console.log('proRes.userInfo',proRes.userInfo)
+							uni.login({
+								provider: 'weixin',
+								success: (wxres => {
+									that.logining = false
+									that.$api.request('user', 'thirdPartLogin', {
+										loginType: loginType,
+										raw: JSON.stringify(wxres)
+									}, failres => {
+										that.$api.msg(failres.errmsg)
+										uni.hideLoading()
+									}).then(res => {
+										console.log('res+++++',res)
+										that.accessToken = res.data.accessToken
+										that.$api.setUserInfo(res.data)
+										that.userInfo = res.data
+										// that.params.iv = proRes.iv
+										// that.params.encryptedData = proRes.encryptedData
+										// that.params.session_key = that.accessToken
+										// console.log(that.params)
+										// that.getTokenAsync(that.params)
+										uni.setStorageSync('userInfo', res.data)
+										that.$store.commit('login', res.data)
+										if(proRes.userInfo.phone == undefined){
+											proRes.userInfo.phone = ''
+										}
+										res.data.cid = uni.getStorageSync("clientId")
+										that.$api.request('user', 'syncUserInfo', res.data).then(syncRes => {
+											//同步过后
+											res.data.nickname = proRes.userInfo.nickName
+											res.data.avatarUrl = proRes.userInfo.avatarUrl
+											res.data.gender = proRes.userInfo.gender
+											if(proRes.userInfo.phone){
+												res.data.phone = proRes.userInfo.phone
+											}
+											uni.setStorageSync('userInfo', res.data)
+											that.$store.commit('login', res.data)
+											that.$api.setUserInfo(res.data)
+											uni.hideLoading()
+											if(!that.userInfo.phone||that.userInfo.phone==""||that.userInfo.phone ==undefined){
+												that.isPhone = true//显示自定义的获取手机权限提示框
+												that.inputStatus = 'inline'
+												that.inputContent = ''
+											}
+											else{
+												uni.setStorageSync('PageCur', "sale");
+												// uni.switchTab({
+												// 	url: '/pages/sale/sale'
+												// });
+												uni.reLaunch({
+													url: '/pages/sale/information'
+												});
+												console.log("complete")
+												// that.liangxinLogin()
+											}
+										})		
+										console.log( 'wx.getUserProfile=>用户允许了授权' );
+									})
+								})
+							})
+			
+						},  
+						fail : function( res ){  
+							console.log('wx.getUserProfile=>用户拒绝了授权');  
+							console.log( res );  
+			
+						}
+					});  
+			
+				}  
+				
+				// 获取用户的当前设置,判断是否点击了“总是保持以上,不在询问”
+				// wx.getSetting({
+				//  	 withSubscriptions: true,//是否获取用户订阅消息的订阅状态,默认false不返回
+				//    success(res){
+				// 	
+				//    if(res.subscriptionsSetting.mainSwitch){
+				    
+				//    }else{
+					  
+				// 	}
+				// 	}
+				// })
+				// uni.showModal({
+				// 	  title: '温馨提示',
+				// 	  content: '为更好的与您沟通,小程序需要向您发送通知消息',
+				// 	  confirmText:"同意",
+				// 	  cancelText:"拒绝",
+				// 	  showCancel: false,
+				// 	  success: function (res) {
+				// 		  if (res.confirm) {
+				// 			 //调用订阅消息
+				// 			  that.requestSubscribe();
+				// 		  } else if (res.cancel) {
+				// 			  ///显示第二个弹说明一下
+				// 			  wx.showModal({
+				// 				title: '温馨提示',
+				// 				content: '拒绝后您将无法获取实时的交易、物流消息',
+				// 				confirmText:"知道了",
+				// 				showCancel:false,
+				// 				success: function (res) {
+				// 					 uni.openSetting({ // 打开设置页
+				// 					   success(res) {
+				// 						console.log(res.authSetting)
+				// 					   }
+				// 					 });
+				// 				}
+				// 			});
+				// 		  }
+				// 	  }
+				// });
+				
+				
+
+
+
+			},
+			wechatLogin() {
+				const that = this
+				that.logining = true
+				let loginType = 2
+				uni.showLoading({
+					title: '正在同步消息',
+					mask:true
+				})
+				uni.login({
+					provider: 'weixin',
+					success: (wxres => {
+						that.$api.request('user', 'thirdPartLogin', {
+							loginType: loginType,
+							raw: JSON.stringify(wxres)
+						}, failres => {
+							that.$api.msg(failres.errmsg)
+							uni.hideLoading()
+						}).then(res => {
+							console.log("thirdPartLogin:"+res.data.phone)
+							that.accessToken = res.data.accessToken
+							that.logining = false
+							uni.getUserInfo({
+								lang: 'zh_CN',
+								success: (e) => {
+									uni.setStorageSync('userInfo', res.data)
+									that.$store.commit('login', res.data)
+									e.userInfo.nickname = e.userInfo.nickName
+									e.userInfo.cid = uni.getStorageSync("clientId")
+									console.log(e.userInfo)
+									that.$api.request('user', 'syncUserInfo', e.userInfo).then(syncRes => {
+										//同步过后
+										res.data.nickname = e.userInfo.nickName
+										res.data.avatarUrl = e.userInfo.avatarUrl
+										res.data.gender = e.userInfo.gender
+										if(res.data.phone){
+											res.data.phone = e.userInfo.phone
+											// that.liangxinLogin()
+										}
+										
+										uni.setStorageSync('userInfo', res.data)
+										that.$store.commit('login', res.data)
+									})
+								},
+								complete: (e) => {
+									uni.hideLoading()
+									
+									if(!res.data.phone||res.data.phone==""||res.data.phone ==undefined){
+										that.isPhone = true//显示自定义的获取手机权限提示框
+										that.inputStatus = 'inline'
+										that.inputContent = ''
+									}
+									else{
+										// uni.switchTab({
+										// 	url: '/pages/sale/sale'
+										// });
+										uni.switchTab({
+											url: '/pages/sale/information'
+										});
+										console.log("complete")
+										
+									}
+									
+								}
+							})
+							
+						})
+					})
+				})
+			},
+			wechatH5Login() {
+				const that = this
+				let href = window.location.origin
+				let page = that.$api.prePage()
+				let prePath = '/pages/index/index'
+				if (page) {
+					prePath = page.__page__.path
+				}
+				window.location = 'https://open.weixin.qq.com/connect/oauth2/authorize?' 
+				+ 'appid=' + that.$api.defConfig().h5Appid + '&redirect_uri=' + escape(href) + '&response_type=code&scope=snsapi_userinfo&state=' + escape(prePath) + '#wechat_redirect'
+			},
+			liangxinLogin(){
+				const that = this
+				var userInfoTmp = uni.getStorageSync("userInfo")
+				console.log('userInfoTmp',userInfoTmp)
+				that.$socket.login(userInfoTmp.phone, "123456", null, res=>{
+					console.log('粮信登录',res)
+					if (res.success) {
+						that.$socket.showLoginDialog = false
+						// 缓存用户
+						that.userData = res.response.data
+						console.log('userData',that.userData)
+						that.$u.vuex("userData", that.userData);
+						// 	缓存通讯录
+						that.$socket.listGuests(that.userData.user.operId, res => {						
+							// #ifdef APP-PLUS
+							createFSQL(that.userData.user.operId).then();
+							let contact = res.response.data;
+							contact.forEach(c=>{
+								c.members.forEach(m=>{
+									m.name = c.name;
+									addFSQL(m, that.userData.user.operId).then();
+								})
+							})
+							// #endif
+							that.$u.vuex('firendItem', res.response.data)
+						});
+						
+						// 缓存消息列表
+						that.$socket.queryOnlineMessage(that.userData.user.operId,q =>{
+							let data = q.response.data;
+							for(var i in data){
+								initData(data[i].groupMsg.list, data[i].groupInfo.chatId);
+							}
+						})
+						
+						//	缓存链接
+						that.$socket.getLinks(that.userData.user.operId, res=>{
+							that.$u.vuex('linkItem',res.response.data)
+						});
+						
+						
+						// // 跳转到消息列表
+						// that.$u.route({
+						// 	url: 'pages/home/home',
+						// 	type: 'switchTab'
+						// });
+					} else {
+					  uni.showModal({
+						title:res.reason + ",请稍后再试",
+						showCancel:false
+					  })
+					}
+				});
+			}
+		},
+
+	}
+</script>
+
+<style lang='scss' scoped>
+	
+	.apple{
+		background: #000;
+		width: 35px;
+		height: 35px;
+		padding: 8px;
+		border-radius: 50%;
+		vertical-align: middle;
+	}
+	page {
+		background: #fff;
+	}
+	.close{
+		width:20px;height:20px;position:absolute;
+		right:0px;
+	}
+	.close1{
+		width:20px;height:20px;position:absolute;
+		right:10px;
+		top:0;
+	}
+	.close2{
+		    width: 15px;
+		    height: 15px;
+		    position: absolute;
+		    right: 19px;
+		    top: 50%;
+		    transform: translateY(-45%);
+	}
+	.password{
+		border:none;
+		outline:none;
+	}
+	.cuIcon-weixin{
+		background: #39b54a;
+		color: #fff;
+		font-size: 18px;
+		padding: 9px;
+		border-radius: 50%;
+		vertical-align: middle;
+		margin-right:5px;
+	}
+	.container {
+		padding-top: 85px;
+		position: relative;
+		width: 100vw;
+		height: 100vh;
+		overflow: hidden;
+		background: url('~@/static/img/login/bg.png');
+		background-size:100%;
+	}
+
+	.wrapper {
+		position: relative;
+		z-index: 90;
+		padding-bottom: 40upx;
+		height:100%;
+		padding:0 30px;
+	}
+
+	.back-btn {
+		position: absolute;
+		left: 40upx;
+		z-index: 9999;
+		padding-top: var(--status-bar-height);
+		top: 40upx;
+		font-size: 40upx;
+		color: $font-color-dark;
+	}
+	.verificationCode{
+		margin-top:20px;
+		background:#F5F6F9;
+		color:#AFB3BF;
+	}
+	.verificationCode:after{
+		border:none;
+	}
+	.verificationCode.active{
+		background:#22C572;
+		color:#fff;
+	}
+	.register{
+		/* position:absolute; */
+		bottom:20px;
+		left:50%;
+		transform: translateX(-50%);
+		color:#333333;
+		height:50px;
+		line-height:50px;
+		border-radius:30px;border: 1px solid #444444;
+	}
+	.register:after{
+		border:none;
+	}
+	.phone-before-num{
+		font-size: 34rpx;
+		color: #333333;
+		border-right: 1px solid #E8E9ED;
+		padding-right: 20rpx;
+	}
+	.phone-number{
+		margin-left: 20rpx;
+		font-size: 34rpx;
+		font-family: DINPro-Medium, DINPro;
+		font-weight: 500;
+		color: #333333;
+	}
+</style>

+ 1106 - 0
public/register.vue

@@ -0,0 +1,1106 @@
+<template>
+	<view class="container">
+		<view class="back-btn cuIcon-back" @click="navBack"></view>
+		
+		<view class="wrapper">
+			<h2 class="Semibold">手机号注册</h2>
+			<view style='width:100%;margin-top:50px;border-bottom:1px solid #E8E9ED;padding:10px;position:relative;' class="flex">
+				<view class="NumberMedium" style='width:15%;border-right:1px solid #E8E9ED;'>+86</view>
+				<view style='width:85%;'><input maxlength="11" v-model='phone' @input='phoneinput' style='padding-left:10px;' placeholder="请输入手机号码" type="number" class="Regular"></view>
+			<image v-if='phone!=""' @click='phone=""' class='close' src='../../static/img/login/guanbi@2x.png'></image>
+			</view>
+			<view style='width:100%;border-bottom:1px solid #E8E9ED;position:relative;padding:10px;' class="flex">
+				<view style='width:70%;position:relative;'>
+					<input  v-model='verifyCode' class="Regular" placeholder="请输入验证码" type="number">
+					<image v-if='verifyCode!=""' @click='verifyCode=""' class='close1' src='../../static/img/login/guanbi@2x.png'></image>
+					</view>
+				<button :class='codestatus&&!sendDisabled?"active":""' @click='getcode' class='getcode Regular'>{{sendText}}</button>
+			</view>
+			<view style='border-bottom:1px solid #E8E9ED;padding:10px;position:relative;'>
+				<u-input maxlength='16' class='Regular input-style' style='height:30px;' v-model='password' placeholder="请输入密码,6-16位字符" :type="type"/>
+<!-- 				<input maxlength='16' class='password Regular input-style' style='height:30px;' v-model='password' placeholder="请输入密码,6-16位字符" :type="type"> -->
+				<!-- <image v-if='password!=""' @click='password=""' class='close2' src='../../static/img/login/guanbi@2x.png'></image> -->
+				<!-- <view @click='switchover' style='position:absolute;right:0;top:38%;z-index:10;cursor:pointer;' class="iconfont " :class='type=="password"?"icon-yanjing-biyan":"icon-yanjing-zhengyan"'></view> -->
+			</view>
+			<button  :class='phone!=""&&verifyCode!=""&&password!=""?"active":""' @click='register' class='verificationCode'>注册</button>
+			<view style='color:#6A6A6A;margin-top:10px;text-align:center;'>
+				<image @click='consent' style='width:14px;height:14px;position:relative;top:2px;margin-right:5px;' :src="consentStatus==true?'../../static/img/login/select@2x.png':'../../static/img/login/selected2.png'" alt=""></image>
+					已阅读并同意
+					<navigator url="/pages/sale/webview?can_share=false&url=https://liangxin.zthymaoyi.com/userAgreement.html" class="path" hover-class="navigator-hover">《服务协议》</navigator>和<navigator url="/pages/sale/webview?can_share=false&url=https://liangxin.zthymaoyi.com/screctAgreement.html"
+					 class="path" hover-class="navigator-hover">《隐私政策》</navigator>
+			</view>
+		</view>
+	</view>
+</template>
+ 
+<script>
+	import {
+		mapMutations
+	} from 'vuex';
+	import { openFSqlite, createFSQL, selectFSQL, addFSQL } from '../../util/f.js'
+	import { queryData, upData, initData } from '../../util/dbUtil.js'
+	export default {
+		data() {
+			return {
+				inputContent: null,
+				loginType: "wechat",
+				phone: '',
+				password: '',
+				logining: false,
+				isPhone: false,
+				isApple: true,
+				accessToken:'',
+				params:{
+					encryptedData:'',
+					session_key:'',
+					iv:'',
+				},
+				userInfo:{
+					nickName:'',
+					avatarUrl:'',
+					gender:'',
+					phone:''
+				},
+				consentStatus:false,
+				codestatus:false,
+				type:'password',
+				inputStatus:'none',
+				verifyCode:null,
+				sendText:'获取验证码',
+				sendDisabled: false,
+				system:'',
+				platform:'',
+				userData:undefined,
+				canIUseProfile:false
+			}
+		},
+		onShow() {
+			// this.loginType = "wechat"
+			
+			// this.$api.logout()
+		},
+		onLoad(options) {
+			if( wx.getUserProfile ){  
+			    console.log('--check getUserProfile--OK');  
+			    this.canIUseProfile = true;  
+			} 
+			console.log("login on load")
+			var that = this
+			that.$api.request('user', 'sendIsApple', {
+			}).then(res => {
+				that.isApple = res.data
+			})
+			 uni.getSystemInfo({
+				success:(res) => {
+					// console.log(res)
+					this.system = res.system  // ios
+					this.platform = res.platform  // 14.3
+				}
+			})
+		},
+		methods: {
+			// 随机数
+			randomAccess(min,max){
+				return Math.floor(Math.random() * (min - max) + max)
+			},
+			// 解码
+			decodeUnicode(str) {
+			   //Unicode显示方式是\u4e00
+			   str = "\\u"+str
+			   str = str.replace(/\\/g, "%");
+			    //转换中文
+			   str = unescape(str);
+			    //将其他受影响的转换回原来
+			   str = str.replace(/%/g, "\\");
+			   return str;
+			},
+			/*
+			*@param Number NameLength 要获取的名字长度
+			*/
+			getRandomName(NameLength){
+				let name = ""
+				for(let i = 0;i<NameLength;i++){
+					let unicodeNum  = ""
+					unicodeNum = this.randomAccess(0x4e00,0x9fa5).toString(16)
+					name += this.decodeUnicode(unicodeNum)
+				}
+				return name
+			},
+			phoneinput(e){
+				if(e.detail.value.length==11){
+					this.codestatus=true
+				}
+			},
+			getcode(){
+				var that = this
+				if(/^0?1[3|4|5|6|7|8][0-9]\d{8}$/.test(this.phone)){
+					this.$api.doRequest('get','/commonUser/sendVerifyCode',{phone:this.phone}).then(res => {
+						if(res.data.code==200){
+							that.sendDisabled = true
+							let sec = 60
+							let interval = setInterval(() => {
+								sec--;
+								that.sendText = sec + 's后重发'
+								if (sec <= 0) {
+									that.sendDisabled = false
+									that.sendText = "获取验证码"
+									clearInterval(interval)
+								}
+							}, 1000)
+						}else{
+							uni.showToast({
+								title: res.data.message,
+								icon:'none',
+								duration: 2000
+							})
+						}
+					})
+					.catch(res => {
+						uni.showToast({
+							title: res.data.message,
+							icon:'none',
+							duration: 2000
+						})
+					});
+				}else{
+					uni.showToast({
+						title: '请输入正确的手机号',
+						icon:'none',
+						duration: 2000
+					})
+				}
+				
+			},
+			register(){
+				var that = this
+				if(!this.consentStatus){
+					uni.showToast({
+						title: '请勾选协议',
+						icon:'none',
+						duration: 2000
+					})
+					return
+				}
+				if(this.verifyCode.length>6){
+					uni.showToast({
+						title: '验证码错误',
+						icon:'none',
+						duration: 2000
+					})
+					return
+				}
+				if(this.password.length<6){
+					uni.showToast({
+						title: '请输入正确的密码格式',
+						icon:'none',
+						duration: 2000
+					})
+					return
+				}
+				var username=this.getRandomName(3)
+				this.$api.doRequest('post','/commonUser/register',{phone:this.phone,password:this.password,verifyCode:this.verifyCode,userName:username}).then(res => {
+					if(res.data.code=='11002'){
+						uni.showToast({
+							title: '验证码错误或过期,请重新获取',
+							icon:'none',
+							duration: 2000
+						})
+						return
+					}else if(res.data.code=='11004'){
+						uni.showToast({
+							title: '该手机号已注册,可直接登录',
+							icon:'none',
+							duration: 2000
+						})
+						return
+					}
+					else{
+						uni.showLoading({
+							title: '登录中',
+							mask:true
+						})
+						this.$api.doRequest('get','/commonUser/login',{phone:this.phone,password:this.password,cid:this.clientId}).then(res => {
+							
+							if(res.data.code==200){
+								// pc登录
+							this.$api.doRequest('post','/commonUser/api/loginQuickly',{mobilePhone: this.phone,
+							veriCode: "123456",}).then(res1 => {
+									if(res1.data.code==200){
+										uni.setStorageSync('pcUserInfo', res1.data.data)
+									}
+									else{
+										that.$api.doRequest('post','/commonUser/api/loginQuickly',{mobilePhone: '13333333333',
+										veriCode: "123456",}).then(res2 => {
+											uni.setStorageSync('pcUserInfo', res2.data.data)
+										})
+									}
+								})
+								uni.setStorageSync('userInfo', res.data)
+								that.$store.commit('login', res.data)
+								// that.liangxinLogin()
+								uni.switchTab({
+									url: '/pages/sale/information'
+								});
+							}else{
+								uni.showToast({
+									title: res.data.message,
+									icon:'none',
+									duration: 2000
+								})
+							}
+							uni.hideLoading()
+						})
+						.catch(res => {
+							console.log(res);
+						});
+					}
+				})
+				.catch(res => {
+				    console.log(res);
+				});
+			},
+			consent(){
+				this.consentStatus=!this.consentStatus
+				uni.setStorage({
+					key: 'policyStorageKey',
+					data: this.consentStatus
+				});
+			},
+			switchover(){
+				if(this.type=='password'){
+					this.type='text'
+				}else{
+					this.type='password'
+				}
+			},
+			gocode(){
+				uni.navigateTo({
+					url:'/pages/public/login'
+				})
+			},
+			forgetpass(){
+				uni.navigateTo({
+					url:'/pages/public/reset'
+				})
+			},
+			phonelogin(){
+				var that=this
+				uni.showLoading({
+					title: '登录中',
+					mask:true
+				})
+				console.log("clientid",that.clientId)
+				this.$api.request('user', 'login',{
+					password:that.password,
+					phone:that.phone,
+					cid:that.clientId
+				}, failres => {
+			           that.$api.msg(failres.errmsg)
+			           uni.hideLoading()
+			    }).then(res => {
+					console.log(res)
+					uni.setStorageSync('userInfo', res.data)
+					that.$store.commit('login', res.data)
+					// that.liangxinLogin()
+					uni.switchTab({
+						url: '/pages/sale/information'
+					});
+					uni.hideLoading()
+				})
+			},
+			appleLogin(){
+			    var that=this
+			    uni.getProvider({
+			     service: 'oauth',
+			     success: function (res) {
+			      // console.log(res.provider)
+			      if(~res.provider.indexOf('apple')) {
+			       uni.login({
+			        provider: 'apple',
+			        success: loginRes => {
+			         uni.getUserInfo({
+			          provider: 'apple',
+			          success: userInfoRes => {
+			           
+			          that.$api.request('user', 'thirdPartLogin', {
+			           loginType: 4/*  */,
+			           raw: JSON.stringify(userInfoRes.userInfo)
+			          }, failres => {
+			           that.$api.msg(failres.errmsg)
+			           uni.hideLoading()
+			          }).then(res => {
+			           console.log("thirdPartLogin:"+res.data.phone)
+			           that.accessToken = res.data.accessToken
+			           that.logining = false
+			           uni.getUserInfo({
+			            lang: 'zh_CN',
+			            success: (e) => {
+			             uni.setStorageSync('userInfo', res.data)
+			             that.$store.commit('login', res.data)
+			             e.userInfo.nickname = e.userInfo.nickName
+						 e.userInfo.cid = uni.getStorageSync("clientId")
+			             that.$api.request('user', 'syncUserInfo', e.userInfo).then(syncRes => {
+			              //同步过后
+			              res.data.nickname = e.userInfo.nickName
+			              res.data.avatarUrl = e.userInfo.avatarUrl
+			              res.data.gender = e.userInfo.gender
+			              
+			              if(!res.data.phone){
+			               res.data.phone = e.userInfo.phone
+			              }
+			              
+			              uni.setStorageSync('userInfo', res.data)
+			              that.$store.commit('login', res.data)
+			             })
+			            },
+			            complete: (e) => {
+			             uni.hideLoading()
+			             
+			             if(!res.data.phone||res.data.phone==""||res.data.phone ==undefined){
+			              that.isPhone = true//显示自定义的获取手机权限提示框
+			              that.inputStatus = 'inline'
+			              that.inputContent = ''
+			             }
+			             else{
+			              uni.switchTab({
+			               url: '/pages/sale/sale'
+			              });
+			              console.log("complete")
+			             }
+			            }
+			           })
+			           
+			           })
+			           console.log('获取用户信息成功'+JSON.stringify(userInfoRes))
+			          }
+			         })
+			        },
+			        fail: err => {
+			         console.log('apple登录失败' + JSON.stringify(err))
+			         uni.showToast({
+			          title:'登录失败',
+			          icon:'none'
+			         })
+			        }
+			       })
+			      }
+			     },
+			     fail: err => {
+			      uni.showToast({
+			       title:'登录失败',
+			       icon:'none'
+			      })
+			     }
+			    })
+			   },
+			   doGetVerify() {
+				const that = this
+				var phone = this.inputContent;
+				if (!phone || phone.length != 11) {
+					uni.showToast({
+						title:'请输入正确手机号!',
+						icon:'none'
+					})
+					return
+				}
+				
+				that.$api.request('user', 'sendVerifyCode', {
+					phone: phone,
+				}).then(res => {
+					that.sendDisabled = true
+					let sec = 60
+					let interval = setInterval(() => {
+						sec--;
+						that.sendText = sec + 's后重发'
+						if (sec <= 0) {
+							that.sendDisabled = false
+							that.sendText = "获取验证码"
+							clearInterval(interval)
+						}
+					}, 1000)
+				})
+				
+			},
+			verifyCodeInput(e){
+				this.verifyCode = e.detail.value
+			},
+			cancel() {
+				this.inputShow = false
+				this.inputStatus = 'none'
+				this.isPhone = false
+			},
+			confirm() {
+				var that = this
+				if (!this.inputContent || this.inputContent.length != 11) {
+					uni.showToast({
+						title:'请输入正确手机号!',
+						icon:'none'
+					})
+					return
+				}
+				if (!this.verifyCode) {
+					uni.showToast({
+						title:'请输入验证码!',
+						icon:'none'
+					})
+					return
+				}
+				this.$api.request('user', 'mergeUser', {
+					phone: that.inputContent,
+					verifyCode:that.verifyCode
+				},failres => {
+					that.$api.msg(failres.errmsg)
+					uni.hideLoading()
+				}).then(res => {
+					that.accessToken = res.data.accessToken
+					that.$api.setUserInfo(res.data)
+					that.logining = false
+					uni.getUserInfo({
+						lang: 'zh_CN',
+						success: (e) => {
+							uni.setStorageSync('userInfo', res.data)
+							that.$store.commit('login', res.data)
+							e.userInfo.nickname = e.userInfo.nickName
+							e.userInfo.cid = uni.getStorageSync("clientId")
+							console.log(e.userInfo)
+							that.$api.request('user', 'syncUserInfo', e.userInfo).then(syncRes => {
+								//同步过后
+								res.data.nickname = e.userInfo.nickName
+								res.data.avatarUrl = e.userInfo.avatarUrl
+								res.data.gender = e.userInfo.gender
+								res.data.phone = e.userInfo.phone
+								uni.setStorageSync('userInfo', res.data)
+								that.$store.commit('login', res.data)
+								// that.liangxinLogin()
+							})
+						},
+						complete: (e) => {
+							uni.switchTab({
+								url: '/pages/sale/information'
+							});
+							uni.hideLoading()
+							that.isPhone=false
+							
+							uni.navigateBack()
+						}
+					})
+				})
+				
+			},
+			...mapMutations(['login']),
+			inputChange(e) {
+				const key = e.currentTarget.dataset.key;
+				this[key] = e.detail.value;
+			},
+			chooseLoginType(type) {
+				this.loginType = type
+			},
+			navBack() {
+				uni.navigateBack();
+			},
+			toRegist() {
+				uni.redirectTo({
+					url: '/pages/public/register'
+				})
+			},
+			///发起消息订阅
+			requestSubscribe(){
+				const that = this
+				wx.requestSubscribeMessage({
+			        tmplIds: ['xL_uZEqJz4QP1FbnlzQWAiO2zVBn3Qeu8JwLVOU3hU0','8cVkckXi_8zfHeScXRHhjN6cgZFYYCWIMPDTiPWagXY','IE7WxBsv-fDvPWSrng-97lGWtvZf9rHuECBlhRLlWxI'],//
+			        success :(res)=>{
+			          console.log("订阅消息 成功 "+res);
+			         },
+			        fail :(errMsg) =>{ 
+			          console.log("订阅消息 失败 "+errMsg.errMsg);
+			        },
+			        complete:(errMsg)=>{
+			          console.log("订阅消息 完成 "+errMsg);
+					  
+			        }
+			    
+			      });
+			},
+			getPhoneNumber(e) {
+				
+			  console.log(e)
+			  if (e.mp.detail.errMsg==="getPhoneNumber:ok") {
+				this.isPhone = false
+				this.params.iv = e.mp.detail.iv
+				this.params.encryptedData = e.mp.detail.encryptedData
+				this.params.session_key = this.accessToken
+				console.log(this.params)
+				this.getTokenAsync(this.params)
+			  }
+			  
+			},
+			 // 请求后获取token
+			async getTokenAsync(params) {
+				let that = this
+				this.$api.request('user', 'getPhoneNumber', params).then(res => {
+					 if(res.data.phoneNumber){
+						 that.userInfo.phone = res.data.phoneNumber
+					 }
+					 if(res.data.unionId){
+						 that.userInfo.unionId = res.data.unionId
+					 }
+					 
+					 that.userInfo.cid = uni.getStorageSync("clientId")
+					 console.log(that.userInfo)
+					 that.$api.request('user', 'syncUserInfo', that.userInfo).then(syncRes => {
+					 	uni.setStorageSync('userInfo', that.userInfo)
+					 	that.$store.commit('login', that.userInfo)
+					 	that.$api.setUserInfo(that.userInfo)
+					 	uni.hideLoading()
+						// that.liangxinLogin()
+					 }) 
+					 if(res.data.phoneNumber){
+						uni.switchTab({
+							url: '/pages/sale/information'
+						});
+					 }
+					 
+				 })
+			},
+			async toLogin() {
+				this.verifyCode = ''
+				const that = this
+				if (that.phone.length !== 11) {
+					that.$api.msg('请输入11位中国手机号')
+				} else if (that.password.length < 8) {
+					that.$api.msg('密码至少8位')
+				} else {
+					that.logining = true;
+					//#ifdef MP-WEIXIN
+					//若是小程序平台,则获取到openId。整个过程是静默完成的
+					uni.login({
+						provider: 'weixin',
+						success: (wxres => {
+							that.$api.request('user', 'login', {
+								phone: that.phone,
+								password: that.password,
+								loginType: 1,
+								raw: JSON.stringify(wxres)
+							}, failres => {
+								that.logining = false
+								uni.showToast({
+									title: failres.errmsg,
+									icon: "none"
+								});
+							}).then(res => {
+								that.logining = false
+								that.$store.commit('login', res.data)
+								uni.setStorageSync('userInfo', res.data)
+								if (that.$api.prePage().lodaData) {
+									that.$api.prePage().loadData()
+								}
+								uni.navigateBack()
+							})
+						})
+					})
+					//#endif
+					//#ifdef APP-PLUS || H5
+					//若是App登录,则不需要保存OpenId。可直接登录
+					that.$api.request('user', 'login', {
+						phone: that.phone,
+						password: that.password,
+					}, failres => {
+						that.logining = false
+						uni.showToast({
+							title: failres.errmsg,
+							icon: "none"
+						});
+					}).then(res => {
+						that.logining = false
+						that.$store.commit('login', res.data)
+						uni.setStorageSync('userInfo', res.data)
+						if (that.$api.prePage().lodaData) {
+							that.$api.prePage().loadData()
+						}
+						uni.navigateBack()
+					})
+					//#endif
+				}
+			},
+			
+			miniWechatLogin(e) {
+				const that = this
+				 //旧版本方式  
+				if( this.canIUseProfile == false ){  
+					console.log("旧版本方式")
+					//获取授权信息  
+					if(e.detail.userInfo){  
+			
+					console.log('用户允许了授权')  
+					console.log( e.detail.userInfo );   //1.拿到基本的微信信息!!  
+			
+					 uni.showLoading({
+					 	title: '加载中',
+						mask:true
+					 })
+					 that.logining = true
+					 let loginType = 1
+					 let userInfo = e.detail.userInfo
+					 uni.login({
+					 	provider: 'weixin',
+					 	success: (wxres => {
+					 		that.logining = false
+					 		that.$api.request('user', 'thirdPartLogin', {
+					 			loginType: loginType,
+					 			raw: JSON.stringify(wxres)
+					 		}, failres => {
+					 			that.$api.msg(failres.errmsg)
+					 			uni.hideLoading()
+					 		}).then(res => {
+					 			that.accessToken = res.data.accessToken
+					 			that.$api.setUserInfo(res.data)
+					 			that.userInfo = res.data
+					 			uni.getUserInfo({
+					 				lang: 'zh_CN',
+					 				provider: 'weixin',
+					 				withCredentials:true,
+					 				success: (e) => {
+					 					that.params.iv = e.iv
+					 					that.params.encryptedData = e.encryptedData
+					 					that.params.session_key = that.accessToken
+					 					console.log(this.params)
+					 					that.getTokenAsync(this.params)
+					 					uni.setStorageSync('userInfo', res.data)
+					 					that.$store.commit('login', res.data)
+					 					e.userInfo.nickname = e.userInfo.nickName
+					 					if(e.userInfo.phone == undefined){
+					 						e.userInfo.phone = ''
+					 					}
+										e.userInfo.cid = uni.getStorageSync("clientId")
+					 					console.log(e.userInfo)
+					 					that.$api.request('user', 'syncUserInfo', e.userInfo).then(syncRes => {
+					 						//同步过后
+					 						res.data.nickname = userInfo.nickName
+					 						res.data.avatarUrl = userInfo.avatarUrl
+					 						res.data.gender = userInfo.gender
+					 						if(userInfo.phone){
+					 							res.data.phone = userInfo.phone
+					 							// that.liangxinLogin()
+					 						}
+					 						uni.setStorageSync('userInfo', res.data)
+					 						that.$store.commit('login', res.data)
+					 						that.$api.setUserInfo(res.data)
+					 														
+					 						uni.hideLoading()
+					 						// uni.navigateBack()
+					 					})
+					 				},
+					 				complete: (e) => {
+					 					uni.hideLoading()
+					 					
+					 					if(!res.data.phone||res.data.phone==""||res.data.phone ==undefined){
+					 						that.isPhone = true//显示自定义的获取手机权限提示框
+					 						that.inputStatus = 'inline'
+					 						that.inputContent = ''
+					 					}
+					 					else{
+					 						uni.setStorageSync('PageCur', "sale");
+					 						// uni.switchTab({
+					 						// 	url: '/pages/sale/sale'
+					 						// });
+					 						uni.switchTab({
+					 							url: '/pages/sale/information'
+					 						});
+					 						console.log("complete")
+					 					}
+					 				}
+					 			})
+					 		})
+					 	}),
+					 	
+					 })
+			
+					}  
+			
+				//新版本方式  
+				}else{  
+					console.log("新版本方式")
+					uni.showLoading({
+					 	title: '加载中',
+						mask:true
+					 })
+					 that.logining = true
+					 let loginType = 1
+					wx.getUserProfile({  
+						desc : '用于完善用户资料',  
+						lang : 'zh_CN',  
+						success : function( proRes ){  
+							console.log('proRes.userInfo',proRes.userInfo)
+							uni.login({
+								provider: 'weixin',
+								success: (wxres => {
+									that.logining = false
+									that.$api.request('user', 'thirdPartLogin', {
+										loginType: loginType,
+										raw: JSON.stringify(wxres)
+									}, failres => {
+										that.$api.msg(failres.errmsg)
+										uni.hideLoading()
+									}).then(res => {
+										console.log('res+++++',res)
+										that.accessToken = res.data.accessToken
+										that.$api.setUserInfo(res.data)
+										that.userInfo = res.data
+										// that.params.iv = proRes.iv
+										// that.params.encryptedData = proRes.encryptedData
+										// that.params.session_key = that.accessToken
+										// console.log(that.params)
+										// that.getTokenAsync(that.params)
+										uni.setStorageSync('userInfo', res.data)
+										that.$store.commit('login', res.data)
+										if(proRes.userInfo.phone == undefined){
+											proRes.userInfo.phone = ''
+										}
+										res.data.cid = uni.getStorageSync("clientId")
+										that.$api.request('user', 'syncUserInfo', res.data).then(syncRes => {
+											//同步过后
+											res.data.nickname = proRes.userInfo.nickName
+											res.data.avatarUrl = proRes.userInfo.avatarUrl
+											res.data.gender = proRes.userInfo.gender
+											if(proRes.userInfo.phone){
+												res.data.phone = proRes.userInfo.phone
+											}
+											uni.setStorageSync('userInfo', res.data)
+											that.$store.commit('login', res.data)
+											that.$api.setUserInfo(res.data)
+											uni.hideLoading()
+											if(!that.userInfo.phone||that.userInfo.phone==""||that.userInfo.phone ==undefined){
+												that.isPhone = true//显示自定义的获取手机权限提示框
+												that.inputStatus = 'inline'
+												that.inputContent = ''
+											}
+											else{
+												uni.setStorageSync('PageCur', "sale");
+												// uni.switchTab({
+												// 	url: '/pages/sale/sale'
+												// });
+												uni.reLaunch({
+													url: '/pages/sale/information'
+												});
+												console.log("complete")
+												// that.liangxinLogin()
+											}
+										})		
+										console.log( 'wx.getUserProfile=>用户允许了授权' );
+									})
+								})
+							})
+			
+						},  
+						fail : function( res ){  
+							console.log('wx.getUserProfile=>用户拒绝了授权');  
+							console.log( res );  
+			
+						}
+					});  
+			
+				}  
+				
+				// 获取用户的当前设置,判断是否点击了“总是保持以上,不在询问”
+				// wx.getSetting({
+				//  	 withSubscriptions: true,//是否获取用户订阅消息的订阅状态,默认false不返回
+				//    success(res){
+				// 	
+				//    if(res.subscriptionsSetting.mainSwitch){
+				    
+				//    }else{
+					  
+				// 	}
+				// 	}
+				// })
+				// uni.showModal({
+				// 	  title: '温馨提示',
+				// 	  content: '为更好的与您沟通,小程序需要向您发送通知消息',
+				// 	  confirmText:"同意",
+				// 	  cancelText:"拒绝",
+				// 	  showCancel: false,
+				// 	  success: function (res) {
+				// 		  if (res.confirm) {
+				// 			 //调用订阅消息
+				// 			  that.requestSubscribe();
+				// 		  } else if (res.cancel) {
+				// 			  ///显示第二个弹说明一下
+				// 			  wx.showModal({
+				// 				title: '温馨提示',
+				// 				content: '拒绝后您将无法获取实时的交易、物流消息',
+				// 				confirmText:"知道了",
+				// 				showCancel:false,
+				// 				success: function (res) {
+				// 					 uni.openSetting({ // 打开设置页
+				// 					   success(res) {
+				// 						console.log(res.authSetting)
+				// 					   }
+				// 					 });
+				// 				}
+				// 			});
+				// 		  }
+				// 	  }
+				// });
+				
+				
+
+
+
+			},
+			wechatLogin() {
+				const that = this
+				that.logining = true
+				let loginType = 2
+				uni.showLoading({
+					title: '正在同步消息',
+					mask:true
+				})
+				uni.login({
+					provider: 'weixin',
+					success: (wxres => {
+						that.$api.request('user', 'thirdPartLogin', {
+							loginType: loginType,
+							raw: JSON.stringify(wxres)
+						}, failres => {
+							that.$api.msg(failres.errmsg)
+							uni.hideLoading()
+						}).then(res => {
+							console.log("thirdPartLogin:"+res.data.phone)
+							that.accessToken = res.data.accessToken
+							that.logining = false
+							uni.getUserInfo({
+								lang: 'zh_CN',
+								success: (e) => {
+									uni.setStorageSync('userInfo', res.data)
+									that.$store.commit('login', res.data)
+									e.userInfo.nickname = e.userInfo.nickName
+									e.userInfo.cid = uni.getStorageSync("clientId")
+									console.log(e.userInfo)
+									that.$api.request('user', 'syncUserInfo', e.userInfo).then(syncRes => {
+										//同步过后
+										res.data.nickname = e.userInfo.nickName
+										res.data.avatarUrl = e.userInfo.avatarUrl
+										res.data.gender = e.userInfo.gender
+										if(res.data.phone){
+											res.data.phone = e.userInfo.phone
+											// that.liangxinLogin()
+										}
+										
+										uni.setStorageSync('userInfo', res.data)
+										that.$store.commit('login', res.data)
+									})
+								},
+								complete: (e) => {
+									uni.hideLoading()
+									
+									if(!res.data.phone||res.data.phone==""||res.data.phone ==undefined){
+										that.isPhone = true//显示自定义的获取手机权限提示框
+										that.inputStatus = 'inline'
+										that.inputContent = ''
+									}
+									else{
+										// uni.switchTab({
+										// 	url: '/pages/sale/sale'
+										// });
+										uni.switchTab({
+											url: '/pages/sale/information'
+										});
+										console.log("complete")
+										
+									}
+									
+								}
+							})
+							
+						})
+					})
+				})
+			},
+			wechatH5Login() {
+				const that = this
+				let href = window.location.origin
+				let page = that.$api.prePage()
+				let prePath = '/pages/index/index'
+				if (page) {
+					prePath = page.__page__.path
+				}
+				window.location = 'https://open.weixin.qq.com/connect/oauth2/authorize?' 
+				+ 'appid=' + that.$api.defConfig().h5Appid + '&redirect_uri=' + escape(href) + '&response_type=code&scope=snsapi_userinfo&state=' + escape(prePath) + '#wechat_redirect'
+			},
+			liangxinLogin(){
+				const that = this
+				var userInfoTmp = uni.getStorageSync("userInfo")
+				console.log('userInfoTmp',userInfoTmp)
+				that.$socket.login(userInfoTmp.phone, "123456", null, res=>{
+					console.log('粮信登录',res)
+					if (res.success) {
+						that.$socket.showLoginDialog = false
+						// 缓存用户
+						that.userData = res.response.data
+						console.log('userData',that.userData)
+						that.$u.vuex("userData", that.userData);
+						// 	缓存通讯录
+						that.$socket.listGuests(that.userData.user.operId, res => {						
+							// #ifdef APP-PLUS
+							createFSQL(that.userData.user.operId).then();
+							let contact = res.response.data;
+							contact.forEach(c=>{
+								c.members.forEach(m=>{
+									m.name = c.name;
+									addFSQL(m, that.userData.user.operId).then();
+								})
+							})
+							// #endif
+							that.$u.vuex('firendItem', res.response.data)
+						});
+						
+						// 缓存消息列表
+						that.$socket.queryOnlineMessage(that.userData.user.operId,q =>{
+							let data = q.response.data;
+							for(var i in data){
+								initData(data[i].groupMsg.list, data[i].groupInfo.chatId);
+							}
+						})
+						
+						//	缓存链接
+						that.$socket.getLinks(that.userData.user.operId, res=>{
+							that.$u.vuex('linkItem',res.response.data)
+						});
+						
+						
+						// // 跳转到消息列表
+						// that.$u.route({
+						// 	url: 'pages/home/home',
+						// 	type: 'switchTab'
+						// });
+					} else {
+					  uni.showModal({
+						title:res.reason + ",请稍后再试",
+						showCancel:false
+					  })
+					}
+				});
+			}
+		},
+
+	}
+</script>
+
+<style lang='scss' scoped>
+	.password{
+		border:none;
+		outline: none;
+		
+	}
+	.apple{
+		background: #000;
+		width: 35px;
+		height: 35px;
+		padding: 8px;
+		border-radius: 50%;
+		vertical-align: middle;
+	}
+	page {
+		background: #fff;
+	}
+	.cuIcon-weixin{
+		background: #39b54a;
+		color: #fff;
+		font-size: 18px;
+		padding: 9px;
+		border-radius: 50%;
+		vertical-align: middle;
+		margin-right:5px;
+	}
+	.container {
+		padding-top: 85px;
+		position: relative;
+		width: 100vw;
+		height: 100vh;
+		overflow: hidden;
+		background: url('~@/static/img/login/bg.png');
+		background-size:100%;
+	}
+	.close{
+		width:20px;height:20px;position:absolute;
+		right:0px;
+	}
+	.close1{
+		width:20px;height:20px;position:absolute;
+		right:10px;
+		top:0;
+	}
+	.close2{
+		    width: 15px;
+		    height: 15px;
+		    position: absolute;
+		    right: 19px;
+		    top: 50%;
+		    transform: translateY(-45%);
+	}
+	.wrapper {
+		position: relative;
+		z-index: 90;
+		padding-bottom: 40upx;
+		height:100%;
+		padding:0 30px;
+	}
+
+	.back-btn {
+		position: absolute;
+		left: 40upx;
+		z-index: 9999;
+		padding-top: var(--status-bar-height);
+		top: 40upx;
+		font-size: 40upx;
+		color: $font-color-dark;
+	}
+	.verificationCode{
+		margin-top:20px;
+		background:#F5F6F9;
+		color:#AFB3BF;
+	}
+	.verificationCode:after{
+		border:none;
+	}
+	.register{
+		position:absolute;
+		bottom:20px;
+		left:50%;
+		transform: translateX(-50%);
+		color:#333333;
+		height:50px;
+		line-height:50px;
+		border-radius:30px;border: 1px solid #444444;
+	}
+	.register:after{
+		border:none;
+	}
+	.verificationCode.active{
+		background:#22C572;
+		color:#fff;
+	}
+	.getcode{
+		font-size:14px;
+		position:absolute;
+		right:0;
+		top:50%;
+		transform: translateY(-50%);
+		color:#AFB3BF;
+		background:#F5F6F9;
+		height:30px;
+		line-height:30px;
+		
+	}
+	.getcode:after{
+		border:none;
+	}
+	uni-navigator{
+		display:inline-block;
+		color:#22C572;
+	}
+	.getcode.active{
+		background:#22C572;
+		color:#fff;
+	}
+</style>

+ 809 - 0
public/reset.vue

@@ -0,0 +1,809 @@
+<template>
+	<view class="container">
+		<view class="back-btn cuIcon-back" @click="navBack"></view>
+		<!-- 设置白色背景防止软键盘把下部绝对定位元素顶上来盖住输入框等 -->
+		
+		<view class="wrapper">
+			<h2>重置密码</h2>
+			<view style='width:100%;margin-top:50px;border-bottom:1px solid #E8E9ED;padding:10px;' class="flex">
+				<view style='width:15%;border-right:1px solid #E8E9ED;'>+86</view>
+				<view style='width:85%;'><input maxlength="11" @input='phoneinput' style='padding-left:10px;' v-model='phone' placeholder="请输入手机号码" type="text"></view>
+			</view>
+			<view style='width:100%;border-bottom:1px solid #E8E9ED;position:relative;padding:10px;' class="flex">
+				<view style='width:85%;'><input v-model='verifyCode' placeholder="请输入验证码" type="text"></view>
+				<button @click='getcode' :class='status&&!sendDisabled?"active":""' class='getcode'>{{sendText}}</button>
+			</view>
+			<view style='border-bottom:1px solid #E8E9ED;padding:10px;position:relative;'>
+				<input class='password' style='height:30px;' v-model='password' placeholder="请输入新密码,6-16位字符" :type="type" value="" />
+				<view @click='switchover' style='position:absolute;right:0;top:38%;z-index:10;cursor:pointer;' class="iconfont " :class='type=="password"?"icon-yanjing-biyan":"icon-yanjing-zhengyan"'></view>
+			</view>
+			<button :class='phone!=""&&verifyCode!=""&&password!=""?"active":""' @click='reset' class='verificationCode'>重置密码</button>
+		</view>
+	</view>
+</template>
+
+<script>
+	import {
+		mapMutations
+	} from 'vuex';
+	import { openFSqlite, createFSQL, selectFSQL, addFSQL } from '../../util/f.js'
+	import { queryData, upData, initData } from '../../util/dbUtil.js'
+	export default {
+		data() {
+			return {
+				inputContent: null,
+				loginType: "wechat",
+				phone: '',
+				password: '',
+				logining: false,
+				isPhone: false,
+				isApple: true,
+				accessToken:'',
+				params:{
+					encryptedData:'',
+					session_key:'',
+					iv:'',
+				},
+				status:false,
+				userInfo:{
+					nickName:'',
+					avatarUrl:'',
+					gender:'',
+					phone:''
+				},
+				consentStatus:false,
+				type:'password',
+				inputStatus:'none',
+				verifyCode:null,
+				sendText:'获取验证码',
+				sendDisabled: false,
+				system:'',
+				platform:'',
+				userData:undefined,
+				canIUseProfile:false
+			}
+		},
+		onShow() {
+			// this.loginType = "wechat"
+			this.$api.logout()
+		},
+		onLoad(options) {
+			
+			if( wx.getUserProfile ){  
+			    console.log('--check getUserProfile--OK');  
+			    this.canIUseProfile = true;  
+			} 
+			console.log("login on load")
+			var that = this
+			that.$api.request('user', 'sendIsApple', {
+			}).then(res => {
+				that.isApple = res.data
+			})
+			 uni.getSystemInfo({
+				success:(res) => {
+					// console.log(res)
+					this.system = res.system  // ios
+					this.platform = res.platform  // 14.3
+				}
+			})
+		},
+		methods: {
+			phoneinput(e){
+				if(e.detail.value.length==11){
+					this.status=true
+				}
+			},
+			getcode(e){
+				if(this.phone.length!=11){
+					uni.showToast({
+						title: '请输入正确的手机号',
+						icon:'none',
+						duration: 2000
+					})
+					return
+				}
+				if(/^0?1[3|4|5|6|7|8][0-9]\d{8}$/.test(this.phone)){
+				var that=this
+					this.$api.doRequest('get','/commonUser/sendVerifyCode',{phone:this.phone}).then(res => {
+					that.sendDisabled = true
+					let sec = 60
+					let interval = setInterval(() => {
+						sec--;
+						that.sendText = sec + 's后重发'
+						if (sec <= 0) {
+							that.sendDisabled = false
+							that.sendText = "获取验证码"
+							clearInterval(interval)
+						}
+					}, 1000)
+					})
+					.catch(res => {
+					    if(res.errmsg){
+					    	uni.showToast({
+					    		title: res.errmsg,
+					    		icon: 'none',
+					    		duration: 2000
+					    	})
+					    }
+					    else{
+					    	uni.showToast({
+					    		title: "系统异常,请联系管理员",
+					    		icon: 'none',
+					    		duration: 2000
+					    	})
+					    }
+					 });
+				}else{
+					uni.showToast({
+						title: '请输入正确的手机号',
+						icon:'none',
+						duration: 2000
+					})
+				}
+			},
+			reset(){
+				var that = this
+				uni.showLoading({
+					title: '重置密码中'
+				})
+				this.$api.doRequest('post','/commonUser/resetPassword',{phone:this.phone,password:this.password,verifyCode:this.verifyCode}).then(res => {
+				    console.log("重置密码",res)
+					// 获得数据
+					if(res.data.code==200){
+						setTimeout(() => {
+							uni.navigateBack()
+						}, 1000)
+						uni.showToast({
+							title: '重置成功',
+							icon: 'none',
+							duration: 2000
+						})
+					}else{
+						uni.showToast({
+							title: "系统异常,请联系管理员",
+							icon:'none',
+							duration: 2000
+						})
+					}
+					uni.hideLoading()
+				})
+				.catch(res => {
+					console.log("重置密码",res)
+				    uni.showToast({
+				    	title: "系统异常,请联系管理员",
+				    	icon:'none',
+				    	duration: 2000
+				    })
+					uni.hideLoading()
+				});
+			},
+			consent(){
+				this.consentStatus=!this.consentStatus
+				uni.setStorage({
+					key: 'policyStorageKey',
+					data: this.consentStatus
+				});
+			},
+			switchover(){
+				if(this.type=='password'){
+					this.type='text'
+				}else{
+					this.type='password'
+				}
+			},
+			gocode(){
+				uni.navigateTo({
+					url:'/pages/public/login'
+				})
+			},
+			forgetpass(){
+				uni.navigateTo({
+					url:'/pages/public/reset'
+				})
+			},
+			cancel() {
+				this.inputShow = false
+				this.inputStatus = 'none'
+				this.isPhone = false
+			},
+			...mapMutations(['login']),
+			inputChange(e) {
+				const key = e.currentTarget.dataset.key;
+				this[key] = e.detail.value;
+			},
+			chooseLoginType(type) {
+				this.loginType = type
+			},
+			navBack() {
+				uni.navigateBack();
+			},
+			toRegist() {
+				uni.redirectTo({
+					url: '/pages/public/register'
+				})
+			},
+			///发起消息订阅
+			requestSubscribe(){
+				const that = this
+				wx.requestSubscribeMessage({
+			        tmplIds: ['xL_uZEqJz4QP1FbnlzQWAiO2zVBn3Qeu8JwLVOU3hU0','8cVkckXi_8zfHeScXRHhjN6cgZFYYCWIMPDTiPWagXY','IE7WxBsv-fDvPWSrng-97lGWtvZf9rHuECBlhRLlWxI'],//
+			        success :(res)=>{
+			          console.log("订阅消息 成功 "+res);
+			         },
+			        fail :(errMsg) =>{ 
+			          console.log("订阅消息 失败 "+errMsg.errMsg);
+			        },
+			        complete:(errMsg)=>{
+			          console.log("订阅消息 完成 "+errMsg);
+					  
+			        }
+			    
+			      });
+			},
+			getPhoneNumber(e) {
+				
+			  console.log(e)
+			  if (e.mp.detail.errMsg==="getPhoneNumber:ok") {
+				this.isPhone = false
+				this.params.iv = e.mp.detail.iv
+				this.params.encryptedData = e.mp.detail.encryptedData
+				this.params.session_key = this.accessToken
+				console.log(this.params)
+				this.getTokenAsync(this.params)
+			  }
+			  
+			},
+			 // 请求后获取token
+			async getTokenAsync(params) {
+				let that = this
+				this.$api.request('user', 'getPhoneNumber', params).then(res => {
+					 if(res.data.phoneNumber){
+						 that.userInfo.phone = res.data.phoneNumber
+					 }
+					 if(res.data.unionId){
+						 that.userInfo.unionId = res.data.unionId
+					 }
+					 
+					 that.userInfo.cid = uni.getStorageSync("clientId")
+					 console.log(that.userInfo)
+					 that.$api.request('user', 'syncUserInfo', that.userInfo).then(syncRes => {
+					 	uni.setStorageSync('userInfo', that.userInfo)
+					 	that.$store.commit('login', that.userInfo)
+					 	that.$api.setUserInfo(that.userInfo)
+					 	uni.hideLoading()
+						// that.liangxinLogin()
+					 }) 
+					 if(res.data.phoneNumber){
+						uni.switchTab({
+							url: '/pages/sale/information'
+						});
+					 }
+					 
+				 })
+			},
+			async toLogin() {
+				this.verifyCode = ''
+				const that = this
+				if (that.phone.length !== 11) {
+					that.$api.msg('请输入11位中国手机号')
+				} else if (that.password.length < 8) {
+					that.$api.msg('密码至少8位')
+				} else {
+					that.logining = true;
+					//#ifdef MP-WEIXIN
+					//若是小程序平台,则获取到openId。整个过程是静默完成的
+					uni.login({
+						provider: 'weixin',
+						success: (wxres => {
+							that.$api.request('user', 'login', {
+								phone: that.phone,
+								password: that.password,
+								loginType: 1,
+								raw: JSON.stringify(wxres)
+							}, failres => {
+								that.logining = false
+								uni.showToast({
+									title: failres.errmsg,
+									icon: "none"
+								});
+							}).then(res => {
+								that.logining = false
+								that.$store.commit('login', res.data)
+								uni.setStorageSync('userInfo', res.data)
+								if (that.$api.prePage().lodaData) {
+									that.$api.prePage().loadData()
+								}
+								uni.navigateBack()
+							})
+						})
+					})
+					//#endif
+					//#ifdef APP-PLUS || H5
+					//若是App登录,则不需要保存OpenId。可直接登录
+					that.$api.request('user', 'login', {
+						phone: that.phone,
+						password: that.password,
+					}, failres => {
+						that.logining = false
+						uni.showToast({
+							title: failres.errmsg,
+							icon: "none"
+						});
+					}).then(res => {
+						that.logining = false
+						that.$store.commit('login', res.data)
+						uni.setStorageSync('userInfo', res.data)
+						if (that.$api.prePage().lodaData) {
+							that.$api.prePage().loadData()
+						}
+						uni.navigateBack()
+					})
+					//#endif
+				}
+			},
+			
+			miniWechatLogin(e) {
+				const that = this
+				 //旧版本方式  
+				if( this.canIUseProfile == false ){  
+					console.log("旧版本方式")
+					//获取授权信息  
+					if(e.detail.userInfo){  
+			
+					console.log('用户允许了授权')  
+					console.log( e.detail.userInfo );   //1.拿到基本的微信信息!!  
+			
+					 uni.showLoading({
+					 	title: '加载中',
+						mask:true
+					 })
+					 that.logining = true
+					 let loginType = 1
+					 let userInfo = e.detail.userInfo
+					 uni.login({
+					 	provider: 'weixin',
+					 	success: (wxres => {
+					 		that.logining = false
+					 		that.$api.request('user', 'thirdPartLogin', {
+					 			loginType: loginType,
+					 			raw: JSON.stringify(wxres)
+					 		}, failres => {
+					 			that.$api.msg(failres.errmsg)
+					 			uni.hideLoading()
+					 		}).then(res => {
+					 			that.accessToken = res.data.accessToken
+					 			that.$api.setUserInfo(res.data)
+					 			that.userInfo = res.data
+					 			uni.getUserInfo({
+					 				lang: 'zh_CN',
+					 				provider: 'weixin',
+					 				withCredentials:true,
+					 				success: (e) => {
+					 					that.params.iv = e.iv
+					 					that.params.encryptedData = e.encryptedData
+					 					that.params.session_key = that.accessToken
+					 					console.log(this.params)
+					 					that.getTokenAsync(this.params)
+					 					uni.setStorageSync('userInfo', res.data)
+					 					that.$store.commit('login', res.data)
+					 					e.userInfo.nickname = e.userInfo.nickName
+					 					if(e.userInfo.phone == undefined){
+					 						e.userInfo.phone = ''
+					 					}
+										e.userInfo.cid = uni.getStorageSync("clientId")
+					 					console.log(e.userInfo)
+					 					that.$api.request('user', 'syncUserInfo', e.userInfo).then(syncRes => {
+					 						//同步过后
+					 						res.data.nickname = userInfo.nickName
+					 						res.data.avatarUrl = userInfo.avatarUrl
+					 						res.data.gender = userInfo.gender
+					 						if(userInfo.phone){
+					 							res.data.phone = userInfo.phone
+					 							// that.liangxinLogin()
+					 						}
+					 						uni.setStorageSync('userInfo', res.data)
+					 						that.$store.commit('login', res.data)
+					 						that.$api.setUserInfo(res.data)
+					 														
+					 						uni.hideLoading()
+					 						// uni.navigateBack()
+					 					})
+					 				},
+					 				complete: (e) => {
+					 					uni.hideLoading()
+					 					
+					 					if(!res.data.phone||res.data.phone==""||res.data.phone ==undefined){
+					 						that.isPhone = true//显示自定义的获取手机权限提示框
+					 						that.inputStatus = 'inline'
+					 						that.inputContent = ''
+					 					}
+					 					else{
+					 						uni.setStorageSync('PageCur', "sale");
+					 						// uni.switchTab({
+					 						// 	url: '/pages/sale/sale'
+					 						// });
+					 						uni.switchTab({
+					 							url: '/pages/sale/information'
+					 						});
+					 						console.log("complete")
+					 					}
+					 				}
+					 			})
+					 		})
+					 	}),
+					 	
+					 })
+			
+					}  
+			
+				//新版本方式  
+				}else{  
+					console.log("新版本方式")
+					uni.showLoading({
+					 	title: '加载中',
+						mask:true
+					 })
+					 that.logining = true
+					 let loginType = 1
+					wx.getUserProfile({  
+						desc : '用于完善用户资料',  
+						lang : 'zh_CN',  
+						success : function( proRes ){  
+							console.log('proRes.userInfo',proRes.userInfo)
+							uni.login({
+								provider: 'weixin',
+								success: (wxres => {
+									that.logining = false
+									that.$api.request('user', 'thirdPartLogin', {
+										loginType: loginType,
+										raw: JSON.stringify(wxres)
+									}, failres => {
+										that.$api.msg(failres.errmsg)
+										uni.hideLoading()
+									}).then(res => {
+										console.log('res+++++',res)
+										that.accessToken = res.data.accessToken
+										that.$api.setUserInfo(res.data)
+										that.userInfo = res.data
+										// that.params.iv = proRes.iv
+										// that.params.encryptedData = proRes.encryptedData
+										// that.params.session_key = that.accessToken
+										// console.log(that.params)
+										// that.getTokenAsync(that.params)
+										uni.setStorageSync('userInfo', res.data)
+										that.$store.commit('login', res.data)
+										if(proRes.userInfo.phone == undefined){
+											proRes.userInfo.phone = ''
+										}
+										res.data.cid = uni.getStorageSync("clientId")
+										that.$api.request('user', 'syncUserInfo', res.data).then(syncRes => {
+											//同步过后
+											res.data.nickname = proRes.userInfo.nickName
+											res.data.avatarUrl = proRes.userInfo.avatarUrl
+											res.data.gender = proRes.userInfo.gender
+											if(proRes.userInfo.phone){
+												res.data.phone = proRes.userInfo.phone
+											}
+											uni.setStorageSync('userInfo', res.data)
+											that.$store.commit('login', res.data)
+											that.$api.setUserInfo(res.data)
+											uni.hideLoading()
+											if(!that.userInfo.phone||that.userInfo.phone==""||that.userInfo.phone ==undefined){
+												that.isPhone = true//显示自定义的获取手机权限提示框
+												that.inputStatus = 'inline'
+												that.inputContent = ''
+											}
+											else{
+												uni.setStorageSync('PageCur', "sale");
+												// uni.switchTab({
+												// 	url: '/pages/sale/sale'
+												// });
+												uni.reLaunch({
+													url: '/pages/sale/information'
+												});
+												console.log("complete")
+												// that.liangxinLogin()
+											}
+										})		
+										console.log( 'wx.getUserProfile=>用户允许了授权' );
+									})
+								})
+							})
+			
+						},  
+						fail : function( res ){  
+							console.log('wx.getUserProfile=>用户拒绝了授权');  
+							console.log( res );  
+			
+						}
+					});  
+			
+				}  
+				
+				// 获取用户的当前设置,判断是否点击了“总是保持以上,不在询问”
+				// wx.getSetting({
+				//  	 withSubscriptions: true,//是否获取用户订阅消息的订阅状态,默认false不返回
+				//    success(res){
+				// 	
+				//    if(res.subscriptionsSetting.mainSwitch){
+				    
+				//    }else{
+					  
+				// 	}
+				// 	}
+				// })
+				// uni.showModal({
+				// 	  title: '温馨提示',
+				// 	  content: '为更好的与您沟通,小程序需要向您发送通知消息',
+				// 	  confirmText:"同意",
+				// 	  cancelText:"拒绝",
+				// 	  showCancel: false,
+				// 	  success: function (res) {
+				// 		  if (res.confirm) {
+				// 			 //调用订阅消息
+				// 			  that.requestSubscribe();
+				// 		  } else if (res.cancel) {
+				// 			  ///显示第二个弹说明一下
+				// 			  wx.showModal({
+				// 				title: '温馨提示',
+				// 				content: '拒绝后您将无法获取实时的交易、物流消息',
+				// 				confirmText:"知道了",
+				// 				showCancel:false,
+				// 				success: function (res) {
+				// 					 uni.openSetting({ // 打开设置页
+				// 					   success(res) {
+				// 						console.log(res.authSetting)
+				// 					   }
+				// 					 });
+				// 				}
+				// 			});
+				// 		  }
+				// 	  }
+				// });
+				
+				
+
+
+
+			},
+			wechatLogin() {
+				const that = this
+				that.logining = true
+				let loginType = 2
+				uni.showLoading({
+					title: '正在同步消息',
+					mask:true
+				})
+				uni.login({
+					provider: 'weixin',
+					success: (wxres => {
+						that.$api.request('user', 'thirdPartLogin', {
+							loginType: loginType,
+							raw: JSON.stringify(wxres)
+						}, failres => {
+							that.$api.msg(failres.errmsg)
+							uni.hideLoading()
+						}).then(res => {
+							console.log("thirdPartLogin:"+res.data.phone)
+							that.accessToken = res.data.accessToken
+							that.logining = false
+							uni.getUserInfo({
+								lang: 'zh_CN',
+								success: (e) => {
+									uni.setStorageSync('userInfo', res.data)
+									that.$store.commit('login', res.data)
+									e.userInfo.nickname = e.userInfo.nickName
+									e.userInfo.cid = uni.getStorageSync("clientId")
+									console.log(e.userInfo)
+									that.$api.request('user', 'syncUserInfo', e.userInfo).then(syncRes => {
+										//同步过后
+										res.data.nickname = e.userInfo.nickName
+										res.data.avatarUrl = e.userInfo.avatarUrl
+										res.data.gender = e.userInfo.gender
+										if(res.data.phone){
+											res.data.phone = e.userInfo.phone
+											// that.liangxinLogin()
+										}
+										
+										uni.setStorageSync('userInfo', res.data)
+										that.$store.commit('login', res.data)
+									})
+								},
+								complete: (e) => {
+									uni.hideLoading()
+									
+									if(!res.data.phone||res.data.phone==""||res.data.phone ==undefined){
+										that.isPhone = true//显示自定义的获取手机权限提示框
+										that.inputStatus = 'inline'
+										that.inputContent = ''
+									}
+									else{
+										// uni.switchTab({
+										// 	url: '/pages/sale/sale'
+										// });
+										uni.switchTab({
+											url: '/pages/sale/information'
+										});
+										console.log("complete")
+										
+									}
+									
+								}
+							})
+							
+						})
+					})
+				})
+			},
+			wechatH5Login() {
+				const that = this
+				let href = window.location.origin
+				let page = that.$api.prePage()
+				let prePath = '/pages/index/index'
+				if (page) {
+					prePath = page.__page__.path
+				}
+				window.location = 'https://open.weixin.qq.com/connect/oauth2/authorize?' 
+				+ 'appid=' + that.$api.defConfig().h5Appid + '&redirect_uri=' + escape(href) + '&response_type=code&scope=snsapi_userinfo&state=' + escape(prePath) + '#wechat_redirect'
+			},
+			liangxinLogin(){
+				const that = this
+				var userInfoTmp = uni.getStorageSync("userInfo")
+				console.log('userInfoTmp',userInfoTmp)
+				that.$socket.login(userInfoTmp.phone, "123456", null, res=>{
+					console.log('粮信登录',res)
+					if (res.success) {
+						that.$socket.showLoginDialog = false
+						// 缓存用户
+						that.userData = res.response.data
+						console.log('userData',that.userData)
+						that.$u.vuex("userData", that.userData);
+						// 	缓存通讯录
+						that.$socket.listGuests(that.userData.user.operId, res => {						
+							// #ifdef APP-PLUS
+							createFSQL(that.userData.user.operId).then();
+							let contact = res.response.data;
+							contact.forEach(c=>{
+								c.members.forEach(m=>{
+									m.name = c.name;
+									addFSQL(m, that.userData.user.operId).then();
+								})
+							})
+							// #endif
+							that.$u.vuex('firendItem', res.response.data)
+						});
+						
+						// 缓存消息列表
+						that.$socket.queryOnlineMessage(that.userData.user.operId,q =>{
+							let data = q.response.data;
+							for(var i in data){
+								initData(data[i].groupMsg.list, data[i].groupInfo.chatId);
+							}
+						})
+						
+						//	缓存链接
+						that.$socket.getLinks(that.userData.user.operId, res=>{
+							that.$u.vuex('linkItem',res.response.data)
+						});
+						
+						
+						// // 跳转到消息列表
+						// that.$u.route({
+						// 	url: 'pages/home/home',
+						// 	type: 'switchTab'
+						// });
+					} else {
+					  uni.showModal({
+						title:res.reason + ",请稍后再试",
+						showCancel:false
+					  })
+					}
+				});
+			}
+		},
+
+	}
+</script>
+
+<style lang='scss' scoped>
+	
+	.apple{
+		background: #000;
+		width: 35px;
+		height: 35px;
+		padding: 8px;
+		border-radius: 50%;
+		vertical-align: middle;
+	}
+	page {
+		background: #fff;
+	}
+	.cuIcon-weixin{
+		background: #39b54a;
+		color: #fff;
+		font-size: 18px;
+		padding: 9px;
+		border-radius: 50%;
+		vertical-align: middle;
+		margin-right:5px;
+	}
+	.container {
+		padding-top: 85px;
+		position: relative;
+		width: 100vw;
+		height: 100vh;
+		overflow: hidden;
+		background: url('~@/static/img/login/bg.png');
+		background-size:100%;
+	}
+
+	.wrapper {
+		position: relative;
+		z-index: 90;
+		padding-bottom: 40upx;
+		height:100%;
+		padding:0 30px;
+	}
+
+	.back-btn {
+		position: absolute;
+		left: 40upx;
+		z-index: 9999;
+		padding-top: var(--status-bar-height);
+		top: 40upx;
+		font-size: 40upx;
+		color: $font-color-dark;
+	}
+	.verificationCode{
+		margin-top:20px;
+		background:#F5F6F9;
+		color:#AFB3BF;
+	}
+	.verificationCode:after{
+		border:none;
+	}
+	.verificationCode.active{
+		background:#22C572;
+		color:#fff;
+	}
+	.register{
+		position:absolute;
+		bottom:20px;
+		left:50%;
+		transform: translateX(-50%);
+		color:#333333;
+		height:50px;
+		line-height:50px;
+		border-radius:30px;border: 1px solid #444444;
+	}
+	.register:after{
+		border:none;
+	}
+	.getcode{
+		font-size:14px;
+		position:absolute;
+		right:0;
+		top:50%;
+		transform: translateY(-50%);
+		color:#AFB3BF;
+		background:#F5F6F9;
+		height:30px;
+		line-height:30px;
+		
+	}
+	.password{
+		border:none;
+		outline: none;
+	}
+	.getcode:after{
+		border:none;
+	}
+	.getcode.active{
+		background:#22C572;
+		color:#fff;
+	}
+	uni-navigator{
+		display:inline-block;
+		color:#22C572;
+	}
+</style>