"use strict";const e=require("../../../common/vendor.js"),t=require("../../../request/api.js");require("../../../request/http.js");const a=require("../../../common/assets.js"),i={data:()=>({avatarTop:"",contentTop:"",avatar:"",avatarUrl:"",nickname:"",mobile:"",sexList:["男","女"],sex:"",profile:""}),onLoad(){this.avatarTop=e.inject("navHeight")+.08*e.inject("windowWidth"),this.contentTop=this.avatarTop+.1*e.inject("windowWidth"),this.getUserInfoData()},methods:{chooseAvatar(e){console.log(e),this.avatar=e.detail.avatarUrl},sexChange(e){console.log(e);let t=e.detail.value;this.sex=this.sexList[t]},getPhoneNumData(a){if(console.log(a),"getPhoneNumber:ok"==a.detail.errMsg){let i={code:a.detail.code};t.wxBindPhone(i).then((t=>{200==t.code?(e.index.showToast({title:t.message}),this.mobile=t.data.phone):e.index.showToast({title:t.message,icon:"none"})})).catch((e=>{}))}},clickNext(){if(this.avatar||this.avatarUrl)if(this.nickname)if(this.sex)if(this.profile)if(this.avatar){let a={avatar:this.avatar,nickname:this.nickname,gender:"男"==this.sex?"male":"female",phone:this.mobile,bio:this.profile,isFile:1};t.updateBasicInfo(a).then((t=>{e.index.navigateTo({url:"/pages/mine/investPreference/investPreference"})})).catch((e=>{}))}else{let a={nickname:this.nickname,gender:"男"==this.sex?"male":"female",phone:this.mobile,bio:this.profile};t.updateBasicInfo(a).then((t=>{e.index.navigateTo({url:"/pages/mine/investPreference/investPreference"})})).catch((e=>{}))}else e.index.showToast({title:"请输入个人简介",icon:"none"});else e.index.showToast({title:"请选择性别",icon:"none"});else e.index.showToast({title:"请输入昵称",icon:"none"});else e.index.showToast({title:"请选择头像",icon:"none"})},getUserInfoData(){t.userInfo().then((t=>{200==t.code?(this.avatarUrl=t.data.basic_info.avatar_url,this.nickname=t.data.basic_info.nickname,this.mobile=t.data.basic_info.phone,this.sex="male"==t.data.basic_info.gender?"男":"女",this.profile=t.data.basic_info.bio):e.wx$1.showToast({title:t.message,icon:"none"})})).catch((e=>{}))}}};if(!Array){e.resolveComponent("navBar")()}Math;const o=e._export_sfc(i,[["render",function(t,i,o,n,s,r){return{a:e.p({leftText:"信息完善"}),b:a._imports_0,c:s.avatar?s.avatar:s.avatarUrl,d:a._imports_1$5,e:e.o(((...e)=>r.chooseAvatar&&r.chooseAvatar(...e))),f:e.s("top:"+s.avatarTop+"px;"),g:s.nickname,h:e.o((e=>s.nickname=e.detail.value)),i:e.t(s.mobile),j:e.o(((...e)=>r.getPhoneNumData&&r.getPhoneNumData(...e))),k:e.t(s.sex),l:a._imports_2$5,m:s.sexList,n:e.o(((...e)=>r.sexChange&&r.sexChange(...e))),o:s.profile,p:e.o((e=>s.profile=e.detail.value)),q:e.s("top:"+s.contentTop+"px;"),r:e.o((e=>r.clickNext()))}}]]);wx.createPage(o);
