xinelu-applet-ui/pagesB/modify/modify.vue
2023-09-20 17:59:34 +08:00

123 lines
2.9 KiB
Vue

<template>
<view class="app">
<view class="body">
<view class="top">
<image :src="img" mode="" @tap='uploadImag' v-if="img"></image>
<image src="../../static/headsculpture.png" mode="" v-else @tap='uploadImag'></image>
<view class="editimg" >
点击编辑头像
</view>
</view>
<view class="item">
<span>姓名:</span>
<u-input placeholder="请输入姓名" type="text"/>
</view>
<view class="item">
<span>性别:</span>
<u-radio-group v-model="appPersonallist.sex" size='44'>
<u-radio @change='sexchange' v-for="(item, index) in sexlist" :key="index" :name="item.name"
:disabled="item.disabled">
{{item.name}}
</u-radio>
</u-radio-group>
<!-- <u-input placeholder="请输入性别" type="text" /> -->
</view>
<view class="item" @tap='timeshow=true'>
<span>出生日期:</span>
<view class="address" style="" v-if="appPersonallist.birthDate">
{{appPersonallist.birthDate}}
</view>
<!-- <u-input placeholder="请输入出生日期" type="text" /> -->
</view>
<view class="item">
<span>手机号:</span>
<u-input placeholder="请输入手机号" type="text" style="margin-left: 20rpx;"/>
</view>
<view class="item">
<span>所属区域:</span>
<view class="address">山东省济南市</view>
<!-- <u-input placeholder="请输入所属区域" type="text" /> -->
</view>
<view class="item">
<span>详细地址:</span>
<u-input placeholder="请输入详细地址" type="text" style="margin-left: 40rpx;"/>
</view>
<view class="submit">
保存
</view>
<u-picker mode="time" v-model="timeshow" :params="params" @confirm='timechange' @canel='timeshow=false'>
</u-picker>
</view>
</view>
</template>
<script>
export default {
data() {
return {
img:'',
timeshow: false, //出生日期
params: {
year: true,
month: true,
day: true,
hour: false,
minute: false,
second: false
},
appPersonallist:{
birthDate: '',
sex:'',
headPictureUrl:'',
},
// 性别
sexlist: [{
name: '男',
disabled: false
},
{
name: '女',
disabled: false
}
],
}
},
methods: {
//上传头像
uploadImag() {
var that = this;
uni.chooseImage({
count: 1,
sizeType: ['original'],
sourceType: ['album'],
success(res) {
that.appPersonallist.headPictureUrl = res.tempFilePaths[0]
that.img = res.tempFilePaths[0]
that.image = res.tempFilePaths[0]
}
})
},
//性别
sexchange(e) {
if (e == '男') {
this.appPersonallist.sex = 'MALE';
} else if (e == '女') {
this.appPersonallist.sex = 'FEMALE';
}
},
//选择出生日期
timechange(e) {
this.appPersonallist.birthDate = e.year + '-' + e.month + '-' + e.day
},
}
}
</script>
<style lang="scss">
@import './modify.scss';
</style>