Selaa lähdekoodia

更换登录后获取用户信息接口、更换注册接口"

lihongxiao 1 vuosi sitten
vanhempi
commit
ef28d422ea
3 muutettua tiedostoa jossa 33 lisäystä ja 23 poistoa
  1. 2 2
      config/baseUrl.js
  2. 14 8
      config/login.js
  3. 17 13
      pages/register/register.vue

+ 2 - 2
config/baseUrl.js

@@ -3,8 +3,8 @@ let h5BaseUrl = "";
 let socketUrl = "";
 if (process.env.NODE_ENV === 'development') {
 	// 开发环境
-	baseUrl = "http://39.98.239.48/web-api"; //测试
-	// export const baseUrl = 'http://192.168.0.115:8080'
+	// baseUrl = "http://39.98.239.48/web-api"; //测试
+       baseUrl = 'http://192.168.0.111:8080'
 	h5BaseUrl = "http://39.98.239.48/h5";
 	// baseUrl = "http://sxzgkj.baoxianzhanggui.com/web-api";//正式
 	// h5BaseUrl = "http://sxzgkj.baoxianzhanggui.com/h5";

+ 14 - 8
config/login.js

@@ -164,24 +164,26 @@ function judgeLogin(callback, type = "judge") {
 //获取登录用户信息
 async function getLoginUserInfo(token,userId) {
 	let Author="Bearer"+" "+token;
-	let userInfoRes = await $http.get('/esmUserInternal/findById?id=' + userId, {}, {
+	let userInfoRes = await $http.get('/user/loginUser', {}, {
 		header: {
 			Authorization: Author,
 		}
 	}); //用户信息
 	store.commit('setUserModules', {
 		title: 'userInfo',
-		data: userInfoRes.data
+		data: {
+			sysUser:{...userInfoRes.data}
+		}
 	})
 	store.commit('setUserModules', {
 		title: 'userLoginId',
-		data: userInfoRes.data.sysUser.id
+		data: userInfoRes.data.id
 	})
 	store.commit('setUserModules', {
 		title: 'token',
 		data: Author
 	})
-	if (userInfoRes.data.sysUser.name == '游客') {
+	if (userInfoRes.data.name == '游客') {
 		uni.reLaunch({
 			url: "/pages/user/certify"
 		})
@@ -236,16 +238,20 @@ async function getStaffStatus(userId) {
 	if (res.data.status == '1') {
 		//正式人员
 		status = '5'; //审核通过
-		let userInfoRes = await $http.get('/esmUserInternal/findById?id=' + userId); //用户信息
+		let userInfoRes = await $http.get('/user/loginUser'); //用户信息
 		store.commit('setUserModules', {
 			title: 'userInfo',
-			data: userInfoRes.data
+			data: {
+				sysUser:{...userInfoRes.data}
+			}
 		})
 	} else {
-		let userInfoRes = await $http.get('/esmUserInternal/findById?id=' + userId); //用户信息
+		let userInfoRes = await $http.get('/user/loginUser'); //用户信息
 		store.commit('setUserModules', {
 			title: 'userInfo',
-			data: userInfoRes.data
+			data: {
+				sysUser:{...userInfoRes.data}
+			}
 		})
 		//注册人员
 		let res1 = await $http.get('/esmUserInternalcheck/findById?checkid=' + userId);

+ 17 - 13
pages/register/register.vue

@@ -175,23 +175,23 @@
 					return uni.showToast({title: '密码须6-15位数字与字母组合',icon: 'none'});
 				}
 				// 请求服务器,发送验证码
-				let res = await this.$http.post('/esmUserInternalcheck/userRegist',{
+				let res = await this.$http.post('/user/agentRegist',{
 				  "name":this.name,
 				  "identity":this.identity,
 				  "addressnow":this.addressnow,
 				  "password": this.password,
-				  "phone": this.phone,
-				  "phoneMsg": this.code,
-				  "recommenderid": this.recommenderid,
-				  "recommendername": this.recommendername
+				  "mobile": this.phone,
+				  "mobileMsg": this.code,
+				  "referrerId": this.recommenderid,
+				  "referrerName": this.recommendername
 				});
 				// 请求失败处理
-				var newPhone= "";
-				newPhone = this.phone;
-				this.password="";
-				this.phone="";
-				this.code="";
-				this.name="";
+				// var newPhone= "";
+				// newPhone = this.phone;
+				// this.password="";
+				// this.phone="";
+				// this.code="";
+				// this.name="";
 				if((res.code==200) && (!!res.data)){
 					// #ifndef H5
 					this.setUserModules({title:"userLoginId",data:res.data})
@@ -204,11 +204,15 @@
 					// #ifdef H5
 					setTimeout(() => {
 						return uni.reLaunch({
-							url:"/pages/register/registerSuccess?id="+res.data+'&phone='+newPhone
+							url:"/pages/register/registerSuccess?id="+res.data+'&phone='+ this.phone
 						})
 					}, 2000);
 					// #endif
-				}else{
+				}
+				else if(res.code==500){
+					uni.showToast({ title:res.msg , icon:"success",duration:2000 });
+				}
+				else{
 					uni.showToast({ title: '已注册,重复注册', icon:"success",duration:2000 });
 				}
 			}