Ver Fonte

修复登录流程、认证图片

yanjie há 4 anos atrás
pai
commit
89ce78f604

+ 0 - 2
common/request.js

xqd
@@ -52,8 +52,6 @@ const post = function(url, data, showloading) {
 			data: data,
 			header: header,
 			success: function(res) {
-				 
-				console.log('post返回的res',res)
 				if (res.statusCode == 200) {
 					if (res.data.code == 403) {
 						store.commit('logout');

+ 2 - 4
common/user.js

xqd xqd
@@ -78,11 +78,9 @@ function loginByWeixinCode() {
 /**
  * 调用微信登录
  */
-function loginByWeixin(userInfo) {
-	console.log('接收到的信息:', userInfo);
+function loginByWeixin(userInfo, phone) {
 	return new Promise(function(resolve, reject) {
 		return login().then((res) => {
-			console.log('接收到then的信息:', res);
 			var code = res.code;
 			//登录远程服务器
 			request.post('common/wxLogin', {
@@ -90,10 +88,10 @@ function loginByWeixin(userInfo) {
 				"wechat_code": code,
 				"nickname": userInfo.nickName,
 				"avatar": userInfo.avatarUrl,
+				'phone': phone
 			}).then(res => {
 				console.log('回调then的信息:', res);
 				if (res.status == 0) {
-
 					if (res.data.openid) {
 						// store.commit('setJwt', res.data.token);
 						// store.commit('setUser', res.data);

+ 3 - 5
pages/information/information.vue

xqd xqd xqd
@@ -13,7 +13,7 @@
 		<view style="margin: 36rpx 28rpx;" class="flex align-center justify-around">
 			<view style="width: 40%;font-size: 28rpx;">个人签名</view>
 			<view class="flex align-center" style="width: 60%;">
-				<u-input v-model="value" @input="inputTextAreaBlur" type="text" :placeholder="placeholder1" input-align="right"
+				<u-input v-model="value" @input="inputTextAreaBlur" type="text" maxlength="10" :placeholder="placeholder1" input-align="right"
 				 :clearable="false" :customStyle="inputStyle" />
 			</view>
 		</view>
@@ -101,11 +101,10 @@
 				//退出登录
 				edit(){
 					let that = this
-					
-					setTimeout(function() {
-						uni.showLoading({
+					uni.showLoading({
 						title: '退出中...'
 					});
+					setTimeout(function() {
 						that.logout ()
 						uni.clearStorage();
 						uni.hideLoading();
@@ -156,7 +155,6 @@
 				      that.imgList = res.tempFilePaths
 					  console.log('我是file:',res.tempFilePaths[0])
 					  that.$request.upload("Common/uploadFile",that.imgList[0],{}).then(res=>{
-						 
 						  that.url = imgHost+JSON.parse(res).data.url;
 						   console.log(that.url)
 					  })

+ 17 - 19
pages/login/doctorRenzheng.vue

xqd xqd xqd xqd xqd xqd
@@ -14,7 +14,7 @@
 			<view class="flex align-center justify-between" style="margin: 20rpx 0;">
 				<view style="width: 30%;font-weight: bold;" class="felx align-center">医生姓名</view>
 				<text v-if="allupload">{{form.name}}</text>
-				<u-input v-model="form.name" type="text" :border="false" placeholder="请填写真实姓名" input-align="right" maxlength="6"
+				<u-input v-model="form.name" type="text" :border="false" placeholder="请填写真实姓名" input-align="right" maxlength="10"
 				 v-else />
 			</view>
 			<u-line color="#f0f2f5" />
@@ -225,19 +225,18 @@
 				let res = await this.$request.post("doctor/getRenInfo");
 				if (res.status == 0) {
 					if (res.data != undefined || res.data != "undefined") {
+						if (res.data.info.is_then == 0) {
+							this.iscertificate = true
+						}
 						if (res.data.oqf.length != 0 || res.data.orgList.length != 0) {
 							if (res.data.info.is_then == 0) {
 								this.allupload = false
 							} else if (res.data.info.is_then == 1) {
 								this.allupload = true
 							}
-
 							this.form.name = res.data.info.name;
 							this.form.sex = res.data.info.sex == 1 ? '男' : '女';
 							this.form.ID = res.data.info.card_id;
-							if (res.data.info.is_then == 0) {
-								this.iscertificate = true
-							}
 							if (res.data.info.practice != '0') {
 								this.form.certificate = res.data.info.practice.split(',');
 							}
@@ -247,16 +246,12 @@
 							if (res.data.info.is_quail != '0') {
 								this.form.doctorQualification = res.data.info.is_quail.split(',');
 							}
-
-
 						}
-						console.log(this.form.certificate)
 						if (res.data.orgList.length != 0 && res.data.oqf.length != 0) {
 							let orglist = res.data.orgList;
 							let oqflist = res.data.oqf;
 							this.mechanismList.length = 0;
 							this.form.works.length = 0;
-							console.log('orglist', orglist)
 							for (let i = 0; i < orglist.length; i++) {
 								// 获取到修改中数据
 								this.form.works.push({
@@ -275,11 +270,8 @@
 									Submit: orglist[i].state, // 0=审核中,1=审核通过,2=审核拒绝 信息状态 0未提交 1审核中 2审核通过 3审核不通过
 									hospitalID: orglist[i].organization.id,
 								})
-								console.log(this.mechanismList)
 							}
 						}
-
-
 					}
 				}
 			},
@@ -535,7 +527,6 @@
 				})
 			},
 			bc: async function() {
-
 				if (this.mechanismList[this.mechanismList.length - 1].preservation == false) {
 					uni.showModal({
 						'title': '请先保存机构!'
@@ -596,29 +587,36 @@
 							this.form.idPhoto = [card_photo[0].response.data.url, card_photo[1].response.data.url]
 							this.form.doctorQualification = [is_quali[0].response.data.url, is_quali[1].response.data.url] */
 
-
+				if (this.form.idPhoto.length != 2) {
+					uni.showToast({
+						title: "请上传完整的身份证",
+						icon: "none"
+					})
+					return false
+				}
 				if (typeof this.form.works != 'string') {
 					this.form.works = JSON.stringify(this.form.works);
 				}
-				console.log('提交表单!', this.form);
-
 				// 注意要 {'doctor_name':'ddd',doctor_sex:1....}分开传值因为我方便拦截垃圾数据
 				let res = await this.$request.post('doctor/addthen', this.form);
-				console.log('res...:', res);
 				if (res.status == 0) {
 					// uni.switchTab({
 					// 	url: '../index/index'
 					// })
+					uni.showToast({
+						title: "审核提交成功",
+						icon: "none",
+						duration: 1000
+					})
 					uni.navigateBack({
 						delta: 1
-					})
+					}, 1000)
 				} else {
 					uni.showToast({
 						icon: 'none',
 						title: res.message
 					})
 				}
-
 			},
 			certificateChooseImage() {
 				let arr = []

+ 54 - 65
pages/login/login.vue

xqd xqd xqd xqd xqd
@@ -71,7 +71,7 @@
 
 			<view class="flex align-center justify-center" style="margin-top: 50rpx;">
 				<button size="default" :class="" style="border: 1rpx solid #84BB43;box-shadow: 0px 0px 16px 0px rgba(0, 0, 0, 0.08);border-radius: 60rpx;border: 0.3rpx solid #dedede;margin: 0;width: 100%;"
-				 open-type="getUserInfo" @getuserinfo="getinfo">
+				 open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
 					<view :class="rotate_loop" style="font-size: 28rpx;color: #84BB43;">
 						<slot name="icon">
 							<u-icon name="weixin-fill" style="margin-right: 20rpx;" size="30"></u-icon>
@@ -86,11 +86,10 @@
 				<view class="text-xl text-bold" style="position: absolute;top:30rpx">
 					提示
 				</view>
-				<view class="text-gray margin-top-sm text-lg">
-					请授权手机号方便注册
+				<view class="text-gray margin-top-sm text-df">
+					请授权个人资料方便体验后续功能
 				</view>
-				<button style="width: 100%;font-size: 32rpx;position: absolute;bottom: 0;" open-type="getPhoneNumber"
-				 @getphonenumber="getPhoneNumber">确认授权</button>
+				<button style="width: 100%;font-size: 32rpx;position: absolute;bottom: 0;" open-type="getUserInfo" @getuserinfo="getinfo">确认授权</button>
 			</view>
 		</u-popup>
 	</view>
@@ -123,7 +122,7 @@
 				//一键登录按钮样式
 				customStyle: {
 					boxShadow: '0px 0px 16px 0px rgba(0, 0, 0, 0.08)',
-					backgroundColor:'#0C74B9'
+					backgroundColor: '#0C74B9'
 				},
 				//logo图片 base64
 				phoneData: '', // 用户/电话
@@ -356,19 +355,16 @@
 			// 一键登录
 			getinfo: async function(e) {
 				let that = this;
-				let meToken = user.loginByWeixin(e.detail.userInfo).then(res => {
-					console.log('返回的res', res)
+				user.loginByWeixin(e.detail.userInfo, uni.getStorageSync('phone')).then(res => {
+					that.show = false
 					if (res.status == 0) {
-						uni.showToast({
-							title: "登录成功",
-							icon: "none",
-							duration: 2000
-						})
-						console.log(res.data);
+						// uni.showToast({
+						// 	title: "登录成功",
+						// 	icon: "none",
+						// 	duration: 2000
+						// })
+						// console.log(res.data);
 						if (typeof res.data.token != 'undefined') {
-
-							console.log('我登录来 !');
-							console.log(res.data)
 							getApp().globalData.imService = new IMService();
 							let loginResult = getApp().globalData.imService.login({
 								uuid: res.data.data.flag,
@@ -385,66 +381,59 @@
 							uni.showToast({
 								title: "登录成功",
 								icon: "none",
-								duration: 2000
+								duration: 1000
 							})
 							setTimeout(function() {
-								uni.navigateBack({
-									delta: 1
-								})
 								uni.switchTab({
-									url: "../index/index"
+									url:'../index/index'
 								})
-							}, 2000)
-						} else {
-							that.session_key = res.data.session_key
-							that.openid = res.data.openid
-							that.show = true
+							}, 1000)
 						}
 					}
 				})
 			},
 
 
-			getPhoneNumber: async function(e) {
-				let res = await this.$request.post("common/getPhoneNumber", {
-					iv: e.detail.iv,
-					encryptedData: e.detail.encryptedData,
-					session_key: this.session_key,
-					openid: this.openid
-				})
-				this.show = false
-				if (res.status == 0) {
-					if (res.data.token) {
-						store.commit('setJwt', res.data.token);
-						store.commit('setUser', res.data);
-						store.commit('login');
-						uni.showToast({
-							title: "登录成功",
-							icon: "none",
-							duration: 2000
+			getPhoneNumber: function(e) {
+				uni.login({
+					success: (data) => {
+						console.log(data.code)
+						this.$request.post("common/getPhoneNumber", {
+							wechat_code: data.code,
+							iv: e.detail.iv,
+							encryptedData: e.detail.encryptedData,
+							// session_key: this.session_key,
+							// openid: this.openid
+						}).then(res => {
+							console.log(res)
+							if (res.status == 0) {
+								uni.setStorageSync('phone', res.data.phoneNumber)
+								this.show = true
+								// uni.showToast({
+								// 	title: "登录成功",
+								// 	icon: "none",
+								// 	duration: 1000
+								// })
+								// getApp().globalData.imService = new IMService();
+								// let loginResult = getApp().globalData.imService.login({
+								// 	uuid: res.data.data.flag,
+								// 	name: res.data.data.name,
+								// 	avatar: res.data.data.avatar
+								// });
+								// if (loginResult) {
+								// 	//连接IM
+								// 	getApp().globalData.imService.connectIM();
+								// }
+								// // 写一个跳转到首页
+								// setTimeout(function() {
+								// 	uni.navigateBack({
+								// 		delta: 1
+								// 	})
+								// }, 1000)
+							}
 						})
-
-						console.log('我登录来 !');
-						console.log(res.data)
-						getApp().globalData.imService = new IMService();
-						let loginResult = getApp().globalData.imService.login({
-							uuid: res.data.data.flag,
-							name: res.data.data.name,
-							avatar: res.data.data.avatar
-						});
-						if (loginResult) {
-							//连接IM
-							getApp().globalData.imService.connectIM();
-						}
-						// 写一个跳转到首页
-						setTimeout(function() {
-							uni.navigateBack({
-								delta: 1
-							})
-
-						}, 2000)
 					}
-				}
+				})
 			}
 		}
 	}