zhengkaixin 1 年之前
父节点
当前提交
18559eeb3a
共有 3 个文件被更改,包括 28 次插入15 次删除
  1. 6 6
      apis/weixin.js
  2. 2 2
      pages/main/index/index.vue
  3. 20 7
      pages/tab/mine/mine.vue

+ 6 - 6
apis/weixin.js

@@ -6,7 +6,7 @@ import request from '@/apis/utils/requestWhite'
 export function getDataByCode(code) {
 	return request({
 		url: '/wechat/findUserInfo/' + code,
-		params: {},
+		data: {},
 		method: 'get',
 	})
 }
@@ -15,7 +15,7 @@ export function getDataByCode(code) {
 export function findAppletUserInfo(code) {
 	return request({
 		url: '/wechat/findAppletUserInfo/' + code,
-		params: {},
+		data: {},
 		method: 'get',
 	})
 }
@@ -24,15 +24,15 @@ export function findAppletUserInfo(code) {
 export function findUserPhoneNumber(code) {
 	return request({
 		url: '/wechat/findUserPhoneNumber/' + code,
-		params: {},
+		data: {},
 		method: 'get',
 	})
 }
 
-export function findByOpenId(openId) {
+export function findByOpenId(data) {
 	return request({
-		url: '/mobile/user/findByOpenId?openId='+openId,
-		params: {},
+		url: '/mobile/user/findByOpenId',
+		data: data,
 		method: 'get',
 	})
 }

+ 2 - 2
pages/main/index/index.vue

@@ -21,7 +21,7 @@
 		</view>
 		<!-- 功能区 -->
 		<view class="function">
-			<view class="function-item" @click="gotoUrl('pages/packages/choreInformation/choreInformation')">
+			<view class="function-item" @click="gotoUrl('pages/tab/choreInformation/choreInformation')">
 				<view class="icon-box icon-box3">
 
 					<view class="icon">
@@ -45,7 +45,7 @@
 					爱心驿站
 				</view>
 			</view>
-			<view class="function-item" @click="gotoUrl('pages/packages/mine/employmentService/shareEmployment')">
+			<view class="function-item" @click="gotoUrl('pages/packages/shareEmployment/shareEmployment')">
 				<view class="icon-box">
 					<view class="icon">
 						<img src="@/assets/img/riFill-cloud-fill@1x.png" alt="">

+ 20 - 7
pages/tab/mine/mine.vue

@@ -11,15 +11,22 @@
 			</view> -->
 			<!-- 已登录 -->
 			<view class="logined">
-				<view class="name">
-					你好,许慕 
-					<view class="img-box">
+				<view class="name" >
+					<template v-if="userInfo&&userInfo.id">
+						你好,{{userInfo.realName?userInfo.realName:'用户'+userInfo.id.slice(0,3)}} 
+					</template>
+					<template v-else>
+						未登录
+					</template>
+					<view class="img-box" v-if="userInfo.status==1">
 						
 						<img src="@/assets/img/riFill-shield-user-fill@1x.png" alt="">
 					</view>
 				</view>
 				<view class="tel">
-					155****1111
+					<template v-if="userInfo&&userInfo.id">
+						{{userInfo.phone.slice(0,3)}}****{{userInfo.phone.slice(-4)}} 
+					</template>
 				</view>
 				
 			</view>
@@ -156,11 +163,13 @@
 				src: '',
 				show:true,
 			    value: 'false',
+				userInfo:{}
 							
 			}
 		},
 		onLoad() {
-			this.findByOpenId()
+			this.findByOpenId();
+			
 		},
 		methods: {
 			findByOpenId(){
@@ -168,15 +177,19 @@
 					title: "加载中",
 					mask: true,
 				})
-				 API_weixin.findByOpenId(this.carhelp.getOpenId()).then((res) => {
+				 API_weixin.findByOpenId({
+					 openId:this.carhelp.getOpenId(),
+					 noerror:true
+				 }).then((res) => {
 					 
 					 this.carhelp.setPersonInfo(res.data.regUser );
 					 this.carhelp.setToken(res.data.token);
 					 this.carhelp.setPersonInfoPlus(res.data);
-					 
+					 this.userInfo=res.data.regUser;
 					 uni.hideLoading();
 					 this.show=false;
 				 }).catch(error => {
+					 this.userInfo=null;
 					 uni.hideLoading();
 				 	// uni.showToast({
 				 	// 	title: error