gjy 3 年 前
コミット
ab31493380
2 ファイル変更67 行追加56 行削除
  1. 66 2
      pages/public/code.vue
  2. 1 54
      pages/public/reset.vue

+ 66 - 2
pages/public/code.vue

@@ -72,6 +72,60 @@
 					})
 				}
 			},
+			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(){
 				this.status=true
 				// console.log(e)150500
@@ -105,9 +159,19 @@
 			},
 			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}).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()
 					            })
 					            .catch(res => {
 					                console.log(res);

+ 1 - 54
pages/public/reset.vue

@@ -143,7 +143,7 @@
 					})
 					this.$api.doRequest('get','/commonUser/login',{phone:this.phone,password:this.password}).then(res => {
 					uni.setStorageSync('userInfo', res.data)
-					that.$store.commit('login', res.data)
+					// that.$store.commit('login', res.data)
 					that.liangxinLogin()
 					uni.switchTab({
 						url: '/pages/sale/information'
@@ -182,31 +182,6 @@
 					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({
@@ -292,34 +267,6 @@
 			     }
 			    })
 			   },
-			   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)
-				})
-				
-			},
 			cancel() {
 				this.inputShow = false
 				this.inputStatus = 'none'