7.10 增加登录页面,事件详情接口对接,我的点赞,关注收藏页面搭建,接口对接
This commit is contained in:
@@ -3,19 +3,18 @@
|
||||
<navBar leftText="信息完善"></navBar>
|
||||
<image class="topBg absolute" src="/static/image/mine/myTopBg.png" mode="widthFix"></image>
|
||||
<view class="avatarC fixed" :style="'top:'+avatarTop+'px;'">
|
||||
<image class="avatar" src="" mode="aspectFill"></image>
|
||||
<image class="avatar" :src="avatar?avatar:avatarUrl" mode="aspectFill"></image>
|
||||
<image class="icon absolute" src="/static/icon/mine/basicInfo/edit.png" mode="widthFix"></image>
|
||||
<button class="absolute" open-type="chooseAvatar" @chooseavatar="chooseAvatar"></button>
|
||||
</view>
|
||||
<view class="basicInfoC fixed" :style="'top:'+contentTop+'px;'">
|
||||
<view class="title">基本信息</view>
|
||||
<view class="section">昵称</view>
|
||||
<view class="inputC">
|
||||
<input type="text" />
|
||||
<input type="nickname" v-model="nickname" />
|
||||
</view>
|
||||
<view class="section">手机号</view>
|
||||
<view class="inputC">
|
||||
<input type="text" />
|
||||
</view>
|
||||
<view class="inputC">{{mobile}}</view>
|
||||
<view class="section">性别</view>
|
||||
<picker mode="selector" :range="sexList" @change="sexChange">
|
||||
<view class="selectC flex">
|
||||
@@ -25,7 +24,7 @@
|
||||
</picker>
|
||||
<view class="section">个人简介</view>
|
||||
<view class="textareaC">
|
||||
<textarea placeholder="简单介绍一下自己吧" placeholder-style="color:#AAA"></textarea>
|
||||
<textarea v-model="profile" placeholder="简单介绍一下自己吧" placeholder-style="color:#AAA"></textarea>
|
||||
</view>
|
||||
</view>
|
||||
<view class="next fixed" @click="clickNext()">下一步</view>
|
||||
@@ -34,21 +33,42 @@
|
||||
|
||||
<script>
|
||||
import { inject } from 'vue';
|
||||
import { updateBasicInfo, userInfo } from '@/request/api';
|
||||
import { uploadImg } from '@/utils/util';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
avatarTop:'',
|
||||
contentTop:'',
|
||||
avatar:'', //选择头像临时地址
|
||||
avatarUrl:'', //已上传的链接
|
||||
nickname:'', //昵称
|
||||
mobile:'', //手机号
|
||||
sexList:['男','女'],
|
||||
sex:''
|
||||
sex:'',
|
||||
profile:'', //个人简介
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.avatarTop = inject('navHeight') + 60/750*inject('windowWidth')
|
||||
this.contentTop = this.avatarTop + 75/750*inject('windowWidth')
|
||||
this.getUserInfoData()
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 点击选择头像
|
||||
* @param {Object} e
|
||||
*/
|
||||
chooseAvatar(e)
|
||||
{
|
||||
console.log(e)
|
||||
this.avatar = e.detail.avatarUrl
|
||||
},
|
||||
/**
|
||||
* 点击选择性别
|
||||
* @param {Object} e
|
||||
*/
|
||||
sexChange(e)
|
||||
{
|
||||
console.log(e)
|
||||
@@ -60,8 +80,84 @@
|
||||
*/
|
||||
clickNext()
|
||||
{
|
||||
uni.navigateTo({
|
||||
url:'/pages/mine/investPreference/investPreference'
|
||||
if(!this.avatar&&!this.avatarUrl)
|
||||
{
|
||||
uni.showToast({
|
||||
title:'请选择头像',
|
||||
icon:'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
if(!this.nickname)
|
||||
{
|
||||
uni.showToast({
|
||||
title:'请输入昵称',
|
||||
icon:'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
if(!this.sex)
|
||||
{
|
||||
uni.showToast({
|
||||
title:'请选择性别',
|
||||
icon:'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
if(!this.profile)
|
||||
{
|
||||
uni.showToast({
|
||||
title:'请输入个人简介',
|
||||
icon:'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
if(this.avatar)
|
||||
{
|
||||
//如果选择了新头像
|
||||
let param = {avatar:this.avatar,nickname:this.nickname,gender:this.sex=='男'?'male':'female',
|
||||
bio:this.profile,isFile:1}
|
||||
updateBasicInfo(param).then(res=>{
|
||||
uni.navigateTo({
|
||||
url:'/pages/mine/investPreference/investPreference'
|
||||
})
|
||||
}).catch(error=>{
|
||||
|
||||
})
|
||||
}else
|
||||
{
|
||||
//没有选择新头像
|
||||
let param = {nickname:this.nickname,gender:this.sex=='男'?'male':'female',
|
||||
bio:this.profile}
|
||||
updateBasicInfo(param).then(res=>{
|
||||
uni.navigateTo({
|
||||
url:'/pages/mine/investPreference/investPreference'
|
||||
})
|
||||
}).catch(error=>{
|
||||
|
||||
})
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 获取用户信息数据
|
||||
*/
|
||||
getUserInfoData()
|
||||
{
|
||||
userInfo().then(res=>{
|
||||
if(res.code==200)
|
||||
{
|
||||
this.avatarUrl = res.data.basic_info.avatar_url
|
||||
this.nickname = res.data.basic_info.nickname
|
||||
this.mobile = res.data.basic_info.phone
|
||||
this.sex = res.data.basic_info.gender=='male'?'男':'女'
|
||||
this.profile = res.data.basic_info.bio
|
||||
}else
|
||||
wx.showToast({
|
||||
title:res.message,
|
||||
icon:'none'
|
||||
})
|
||||
}).catch(error=>{
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -83,7 +179,6 @@
|
||||
width: 150rpx;
|
||||
.avatar
|
||||
{
|
||||
background-color: red;
|
||||
width: 100%;
|
||||
height: 150rpx;
|
||||
border-radius: 50%;
|
||||
@@ -96,6 +191,13 @@
|
||||
width: 40rpx;
|
||||
height: auto;
|
||||
}
|
||||
button
|
||||
{
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
z-index: 10;
|
||||
}
|
||||
.basicInfoC
|
||||
|
||||
Reference in New Issue
Block a user