Browse Source

相亲交友编辑提交

zhupeng 3 years ago
parent
commit
fb08d1dcf9

+ 162 - 140
pages/user/edit.vue

@@ -2,7 +2,7 @@
 	<view>
 		<u-navbar back-text="编辑资料"></u-navbar>
 		<view class="edit-head">
-			<u-avatar :src="personal_info.faceImage" size="160" :show-level="true" level-icon="edit-pen-fill" level-bg-color ="#4E8DF6"></u-avatar>
+			<u-avatar :src="personal_info.faceImage" size="160" :show-level="true" level-icon="edit-pen-fill" level-bg-color ="#4E8DF6" @click="uploadPhoto"></u-avatar>
 		</view>
 		
 		<view class="edit-form">
@@ -66,6 +66,10 @@
 				<view class="edit-row">
 					<p>兴趣爱好</p>
 					<view class="edit-label">
+						<span v-for="(item,index) in base_dictionary.hobbyInfoList" :key="index"  :class="item.isMemberSelect ? 'active' : ''"  @tap="selectInterest(index)">
+							{{item.name}}
+						</span>
+						<!--
 						<span class="active">摄影</span>
 						<span>烹饪</span>
 						<span>健身</span>
@@ -73,7 +77,7 @@
 						<span>摄影</span>
 						<span>烹饪</span>
 						<span>健身</span>
-						<span>打游戏</span>
+						<span>打游戏</span>-->
 					</view>
 				</view>
 				
@@ -211,7 +215,7 @@
 <script>
 	import * as loginApi from '@/apis/login.js'
 	import mpvueCityPicker from "../../pagesB/components/mpvue-citypicker/mpvueCityPicker.vue";
-	import {getCityData} from '../../pagesB/components/mpvue-citypicker/city-data/province.js';
+	import {provinceData,setCityData,getCityData} from '../../pagesB/components/mpvue-citypicker/city-data/province.js';
 	let _self;
 	export default {
 		components:{
@@ -310,7 +314,7 @@
 						{
 							_self.base_dictionary.zfqkList[i].label = _self.base_dictionary.zfqkList[i].name;
 						}
-						if(_self.personal_info.housingSituation!=null && _self.personal_info.housingSituation< _self.base_dictionary.zfqkList.length)
+						if(_self.personal_info.housingSituation!=null && _self.personal_info.housingSituation<= _self.base_dictionary.zfqkList.length)
 						{
 							_self.personal_info.housingSituationN =_self.base_dictionary.zfqkList[_self.personal_info.housingSituation-1].label						
 						}
@@ -323,11 +327,11 @@
 						{
 							_self.base_dictionary.yxList[i].label = _self.base_dictionary.yxList[i].name;
 						}
-						if(_self.personal_info.salaryRange!=null && _self.personal_info.salaryRange< _self.base_dictionary.yxList.length)
+						if(_self.personal_info.salaryRange!=null && _self.personal_info.salaryRange<= _self.base_dictionary.yxList.length)
 						{
 							_self.personal_info.salaryRangeN =_self.base_dictionary.yxList[_self.personal_info.salaryRange-1].label						
 						}
-						if(_self.personal_info.taIncomeRange!=null && _self.personal_info.taIncomeRange< _self.base_dictionary.yxList.length)
+						if(_self.personal_info.taIncomeRange!=null && _self.personal_info.taIncomeRange<= _self.base_dictionary.yxList.length)
 						{
 							_self.personal_info.taIncomeRangeN =_self.base_dictionary.yxList[_self.personal_info.taIncomeRange-1].label						
 						}
@@ -340,7 +344,7 @@
 						{
 							_self.base_dictionary.znqkList[i].label = _self.base_dictionary.znqkList[i].name;
 						}
-						if(_self.personal_info.childStatus!=null && _self.personal_info.childStatus< _self.base_dictionary.znqkList.length)
+						if(_self.personal_info.childStatus!=null && _self.personal_info.childStatus<= _self.base_dictionary.znqkList.length)
 						{
 							_self.personal_info.childStatusN =_self.base_dictionary.znqkList[_self.personal_info.childStatus-1].label						
 						}
@@ -362,16 +366,19 @@
 						{
 							_self.base_dictionary.xlList[i].label = _self.base_dictionary.xlList[i].name;
 						}
-						if(_self.personal_info.education!=null && _self.personal_info.education< _self.base_dictionary.xlList.length)
+						
+						//console.log('学历'+JSON.stringify(_self.base_dictionary.xlList.length))
+						if(_self.personal_info.education!=null && _self.personal_info.education <= _self.base_dictionary.xlList.length)
 						{
-							_self.personal_info.educationN =_self.base_dictionary.xlList[_self.personal_info.education-1].label						
+							//console.log('学历'+JSON.stringify(_self.personal_info.education))
+							_self.personal_info.educationN =_self.base_dictionary.xlList[Number(_self.personal_info.education)-1].label						
 						}
-						if(_self.personal_info.taEdu!=null && _self.personal_info.taEdu< _self.base_dictionary.xlList.length)
+						if(_self.personal_info.taEdu!=null && _self.personal_info.taEdu<= _self.base_dictionary.xlList.length)
 						{
 							_self.personal_info.taEduN =_self.base_dictionary.xlList[_self.personal_info.taEdu-1].label						
 						}
 					}
-	//				console.log('学历情况'+JSON.stringify(_self.base_dictionary.xlList));
+					//console.log('学历情况'+JSON.stringify(_self.base_dictionary.xlList));
 					
 					if(_self.base_dictionary.hyList){ 
 						
@@ -379,7 +386,7 @@
 						{
 							_self.base_dictionary.hyList[i].label = _self.base_dictionary.hyList[i].name;
 						}
-						if(_self.personal_info.industry!=null && _self.personal_info.industry< _self.base_dictionary.hyList.length)
+						if(_self.personal_info.industry!=null && _self.personal_info.industry<= _self.base_dictionary.hyList.length)
 						{
 							_self.personal_info.industryN =_self.base_dictionary.hyList[_self.personal_info.industry-1].label						
 						}
@@ -392,7 +399,7 @@
 						{
 							_self.base_dictionary.nlfwList[i].label = _self.base_dictionary.nlfwList[i].name;
 						}
-						if(_self.personal_info.taAgeRange!=null && _self.personal_info.taAgeRange< _self.base_dictionary.nlfwList.length)
+						if(_self.personal_info.taAgeRange!=null && _self.personal_info.taAgeRange<= _self.base_dictionary.nlfwList.length)
 						{
 							_self.personal_info.taAgeRangeN =_self.base_dictionary.nlfwList[_self.personal_info.taAgeRange-1].label						
 						}
@@ -404,7 +411,7 @@
 						{
 							_self.base_dictionary.hyqkList[i].label = _self.base_dictionary.hyqkList[i].name;
 						}
-						if(_self.personal_info.maritalStatus!=null && _self.personal_info.maritalStatus< _self.base_dictionary.hyqkList.length)
+						if(_self.personal_info.maritalStatus!=null && _self.personal_info.maritalStatus<= _self.base_dictionary.hyqkList.length)
 						{
 							_self.personal_info.maritalStatusN =_self.base_dictionary.hyqkList[_self.personal_info.maritalStatus-1].label						
 						}
@@ -414,136 +421,34 @@
 						
 						for(let i = 0;i< _self.base_dictionary.hobbyInfoList.length;i++)
 						{
+							_self.base_dictionary.hobbyInfoList[i].isMemberSelect = false;
 							_self.base_dictionary.hobbyInfoList[i].label = _self.base_dictionary.hobbyInfoList[i].name;
+							if(_self.personal_info.hobbys!=null){
+//								console.log('hobbys'+JSON.stringify(_self.personal_info.hobbys))
+								if(_self.personal_info.hobbys.indexOf(_self.base_dictionary.hobbyInfoList[i].id)>=0)
+								{
+									_self.base_dictionary.hobbyInfoList[i].isMemberSelect = true;
+									console.log('选中'+JSON.stringify(_self.base_dictionary.hobbyInfoList[i]))
+								} 
+							}
 						}
 					} 
-					//console.log('兴趣爱好'+JSON.stringify(_self.base_dictionary.hobbyInfoList));
-					 if(personal_info.birthplace!=null){
-					 	_self.personal_info.birthplaceN = getCityData(Number(personal_info.birthplace));
+//					console.log('兴趣爱好'+JSON.stringify(_self.base_dictionary.hobbyInfoList));
+					 if(_self.personal_info.birthplace!=null){
+					 	_self.personal_info.birthplaceN = getCityData(Number(_self.personal_info.birthplace));
  //						console.log('address'+JSON.stringify(_self.form.addressId))
 					 }
 					 if(_self.personal_info.registeredResidence!=null){
-						 _self.personal_info.registeredResidenceN = getCityData(Number(personal_info.registeredResidence));
+						 _self.personal_info.registeredResidenceN = getCityData(Number(_self.personal_info.registeredResidence));
  					 } 
 					 if(_self.personal_info.workplace!=null){
-					 	_self.personal_info.workplaceN = getCityData(Number(personal_info.workplace));
+					 	_self.personal_info.workplaceN = getCityData(Number(_self.personal_info.workplace));
  					 							 
 					 } 
 					 if(_self.personal_info.taWorkplace!=null){
-					 	_self.personal_info.taWorkplaceN = getCityData(Number(personal_info.taWorkplace));
+					 	_self.personal_info.taWorkplaceN = getCityData(Number(_self.personal_info.taWorkplace));
 					 							 
-					 } 
-					/*
-					if(personal_info)
-					{
-						//console.log('个人信息'+JSON.stringify(personal_info))
-						 
-						 if(personal_info.birthplace!=null){
-							_self.form.address = getCityData(Number(personal_info.birthplace));
-						 	_self.form.addressId = personal_info.birthplace;
-							console.log('address'+JSON.stringify(_self.form.addressId))
-						 }
-						 if(personal_info.registeredResidence!=null){
-							 _self.form.registered_residence = getCityData(Number(personal_info.registeredResidence));
-						 	_self.form.registered_residenceId = personal_info.registeredResidence;
-						 } 
-						 if(personal_info.workplace!=null){
-							 _self.form.work_address = getCityData(Number(personal_info.workplace));
-						 	_self.form.work_addressId = personal_info.workplace;
-							 
-						 } 
-						 if(personal_info.education!=null){
-							 for(let i = 0;i< _self.education_ranges.length;i++)
-							 {
-								 if(personal_info.education.indexOf(_self.education_ranges[i].value)>=0)
-								 {
-									_self.form.education = _self.education_ranges[i].name; 
-									_self.form.educationId = _self.education_ranges[i].value; 
-									 									 
-								 } 						
-							 }
-						 }  
-						  
-						  if(personal_info.workUnit!=null){
-						  		_self.form.work_corporation = personal_info.workUnit; 
-						  }   
-						  
-						  if(personal_info.post!=null){
-						  		_self.form.work_post = personal_info.post; 
-						  }  
-						    
-						 if(personal_info.industry!=null){ 
-								for(let i = 0;i< _self.profession_ragnes.length;i++)
-								{
-									 if(personal_info.industry.indexOf(_self.profession_ragnes[i].value)>=0)
-									 {
-										_self.form.profession = _self.profession_ragnes[i].name; 
-										_self.form.professionId = _self.profession_ragnes[i].value; 
-																			 
-									 } 						
-								} 
-						 }  
-						 				 
-						 if(personal_info.salaryRange!=null){
-							 for(let i = 0;i< _self.salary_ranges.length;i++)
-							 {
-								 if(personal_info.salaryRange.indexOf(_self.salary_ranges[i].value)>=0)
-								 {
-									_self.form.salary_range = _self.salary_ranges[i].name; 
-									_self.form.salary_rangeId = _self.salary_ranges[i].value; 
-																		 
-								 } 						
-							 } 
-						 }  
-						 if(personal_info.housingSituation!=null){
-							 for(let i = 0;i< _self.house_statuses.length;i++)
-							 {
-								 if(personal_info.housingSituation.indexOf(_self.house_statuses[i].value)>=0)
-								 {
-									_self.form.house_status = _self.house_statuses[i].name; 
-									_self.form.house_statusId = _self.house_statuses[i].value; 									 									 
-								 } 	
-							 } 
-						 }  
-						 if(personal_info.maritalStatus!=null){
-							 for(let i = 0;i< _self.marriage_statuses.length;i++)
-							 {
-								 if(personal_info.maritalStatus.indexOf(_self.marriage_statuses[i].value)>=0)
-								 {
-									_self.form.marriage_status = _self.marriage_statuses[i].name; 
-									_self.form.marriage_statusId = _self.marriage_statuses[i].value; 
-																		 
-								 } 						
-							 }   
-						 }  
-						   
-						 if(personal_info.childStatus!=null){ 
-								for(let i = 0;i< _self.children_statuses.length;i++)
-								{
-									 if(personal_info.childStatus.indexOf(_self.children_statuses[i].value)>=0)
-									 {
-										_self.form.children_status = _self.children_statuses[i].name; 
-										_self.form.children_statusId = _self.children_statuses[i].value; 
-																			 
-									 } 						
-								}  
-						 }  
-						 
-						 if(personal_info.selfEvaluation!=null){
-						 		_self.form.self_assess = personal_info.selfEvaluation; 
-						 }   
-						if(personal_info.hobbys!=null){
-								//_self.self_assess = personal_info.hobbys; 
-								for(let i=0;i<_self.interests.length;i++)
-								{
-									if(personal_info.hobbys.indexOf(_self.interests[i].id)>=0)
-									{
-										_self.interests[i].checked = true;
-									} 
-								}
-						}  	
-						 
-					} */
+					 }  
 				} 
 			},function(err){
 				console.log('获取基础字典错误'+JSON.stringify(err))
@@ -575,10 +480,45 @@
 				}
 			}
 			
+			if(provinceData.length<=0){
+				  loginApi.getCityList().then(function(data){
+//					console.log('获取城市成功'+JSON.stringify(data));
+					if(data.result &&  data.data){
+						setCityData(data.data);
+						//_self.$refs.mpvuebirtydayCityPicker.setCityData(data.data);		
+						//console.log('province data '+JSON.stringify(provinceData))
+						if(_self.personal_info.birthplace!=null){
+							_self.personal_info.birthplaceN = getCityData(Number(_self.personal_info.birthplace));
+	//						console.log('address'+JSON.stringify(_self.form.addressId))
+						 }
+						 if(_self.personal_info.registeredResidence!=null){
+							 _self.personal_info.registeredResidenceN = getCityData(Number(_self.personal_info.registeredResidence));
+						 } 
+						 if(_self.personal_info.workplace!=null){
+							_self.personal_info.workplaceN = getCityData(Number(_self.personal_info.workplace));
+													 
+						 } 
+						 if(_self.personal_info.taWorkplace!=null){
+							_self.personal_info.taWorkplaceN = getCityData(Number(_self.personal_info.taWorkplace));
+													 
+						 } 
+					} 
+					
+				  },function(err){
+					console.log('获取城市列表错误'+JSON.stringify(err))
+				  })		
+			}
+			
 			
-			console.log('个人信息'+JSON.stringify(this.personal_info))
+//			console.log('个人信息'+JSON.stringify(this.personal_info))
 		},
 		methods:{
+			
+			selectInterest(index){
+//				let interest = this.interests;
+				this.base_dictionary.hobbyInfoList[index].isMemberSelect = !this.base_dictionary.hobbyInfoList[index].isMemberSelect;
+ 				console.log('item'+JSON.stringify(this.base_dictionary.hobbyInfoList[index])) 
+			},
 			birthdayAddressChange(){
 				this.$refs.mpvuebirtydayCityPicker.show()
 			},
@@ -614,6 +554,24 @@
 			formsubmit(){
 				let personal_info = {type:1,id:this.personal_info.id};
 				let _personal_info = this.personal_info;
+				if(_personal_info.faceImage)
+				{
+					personal_info.faceImage = _personal_info.faceImage;
+					console.log('faceImage'+personal_info.faceImage)
+				} 
+				personal_info.hobbys = ''
+				for(let i=0;i<_self.base_dictionary.hobbyInfoList.length;i++)
+				{
+					if(_self.base_dictionary.hobbyInfoList[i].isMemberSelect)
+					{
+						if(personal_info.hobbys.length>0)
+						{
+							personal_info.hobbys+=','
+						}
+						personal_info.hobbys += _self.base_dictionary.hobbyInfoList[i].id;
+					}
+				} 
+				
 				if(_personal_info.weight)
 				{
 					personal_info.weight = _personal_info.weight;
@@ -635,6 +593,17 @@
 					personal_info.educationN = _personal_info.educationN;
 					console.log('education'+personal_info.educationN)
 				} */
+				if(_personal_info.workUnit)
+				{
+					personal_info.workUnit = _personal_info.workUnit;
+					console.log('workUnit'+personal_info.workUnit)
+				}  
+				if(_personal_info.post)
+				{
+					personal_info.post = _personal_info.post;
+					console.log('post'+personal_info.post)
+				}   
+				
 				if(_personal_info.industry)
 				{
 					personal_info.industry = _personal_info.industry;
@@ -794,7 +763,7 @@
 				} */
 				
 				loginApi.save_personal_info(personal_info).then(function(data){
-					console.log('保存成功'+JSON.stringify(data));
+					//console.log('保存成功'+JSON.stringify(data));
 					_self.findByOpenId();
 					/*uni.navigateTo({
 						url:'../user/index'
@@ -963,6 +932,64 @@
 					this.form.weight  += result;
 				}) 
 			},
+			uploadPhoto(){
+			    // 上传图片
+				//const ctx = uni.createCanvasContext('myCanvas');
+				//console.log('url'+this.uploadUrl)
+				//console.log(this.carhelp.getToken())
+				let _this = this;
+			    uni.chooseImage({
+			        count: 1, //默认9
+			        // sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
+			        sourceType: ['album','camera'], //从相册选择
+			        success:(res)=> {
+			            let imgFile = res.tempFilePaths;
+						console.log(process.car.BASE_URL+"mobile/member/uploadBase64")
+						console.log(imgFile)
+							console.log(process.car.NODE_ENV)
+						
+							console.log()
+						var token=this.carhelp.getToken()
+						for(let i = 0;i < imgFile.length;i++)
+						{
+							 
+							 wx.uploadFile({
+								 url:process.car.BASE_URL+"uploadPicture",
+								 
+								// url:process.car.BASE_URL+"mobile/member/uploadBase64",
+								 name: 'photoFile',
+								     header: {
+								 
+								         //   'appId': process.car.VUE_APP_WXAPPID ,
+								 
+								             'Authorization':token ,
+								 
+								          //   'openId': "wxa8954f417fa7c32f" ,
+								 
+								 
+								               'accept': 'application/json',
+								 //#ifdef MP-WEIXIN
+								                "Content-Type": "multipart/form-data",//记得设置
+								 //#endif
+								 
+								       },
+								  filePath: imgFile[0],
+								    success: function(result) {
+										let imgUrls = JSON.parse(result.data) //百度支持 this.site_url +'/' +
+										//let image ={url: imgUrls.data};											  		 
+										//_self.fileList.push(image); //微信
+										_self.personal_info.faceImage = imgUrls.data;
+									}
+								  
+								  
+								  
+							 })
+							  
+							
+						}
+			        },
+			    }); 
+			},
 			findByOpenId(){
 				var openId=this.carhelp.getOpenId()
 				if(openId==""){
@@ -991,12 +1018,7 @@
 						this.carhelp.setPersonInfo(res.data.data.memberInfo );
 						this.carhelp.setToken(token);
 						this.carhelp.setPersonInfoPlus(res.data.data);
-						
-						setTimeout(()=>{
-							uni.switchTab({
-								url: '/pages/index/index'
-							});
-						},1000)
+						 
 					
 					}  
 				}).catch(error => {

+ 1 - 1
pagesB/components/mpvue-citypicker/mpvueCityPicker.vue

@@ -49,7 +49,7 @@ export default {
 	  _self = this;
 	  if(provinceData.length<=0){
 		  loginApi.getCityList().then(function(data){
-		  	//console.log('获取城市成功'+JSON.stringify(data));
+//		  	console.log('获取城市成功'+JSON.stringify(data));
 		  	if(data.result &&  data.data){
 		  		setCityData(data.data);
 		  		//_self.$refs.mpvuebirtydayCityPicker.setCityData(data.data);		

+ 1 - 1
pagesB/pages/login/step1.vue

@@ -155,7 +155,7 @@
 				let personal_info = _self.carhelp.getPersonInfo();
 				if(personal_info)
 				{
-					console.log('个人信息'+JSON.stringify(personal_info))
+//					console.log('个人信息'+JSON.stringify(personal_info))
 					if(personal_info.gender!=null){
 						if(personal_info.gender)
 							_self.form.sex = "male";

+ 1 - 6
pagesB/pages/login/step4.vue

@@ -207,12 +207,7 @@
 						this.carhelp.setPersonInfo(res.data.data.memberInfo );
 						this.carhelp.setToken(token);
 						this.carhelp.setPersonInfoPlus(res.data.data);
-						
-						setTimeout(()=>{
-							uni.switchTab({
-								url: '/pages/index/index'
-							});
-						},1000)
+						 
 					
 					}  
 				}).catch(error => {