<template>
|
<view class="personal">
|
<view class="personal_image">
|
<view class="personal_image_box">
|
<image src="@/static/logo.png" mode="widthFix"></image>
|
<view class="eidt">更换</view>
|
</view>
|
</view>
|
<view class="personal_list">
|
<view class="personal_list_item" @click="open">
|
<view class="label">昵称</view>
|
<view class="right">
|
<text>正义的蜻蜓队长</text>
|
<uni-icons type="right" size="20" color="#CCCCCC"></uni-icons>
|
</view>
|
</view>
|
<view class="personal_list_item">
|
<view class="label">姓名</view>
|
<view class="right">
|
<text class="right_info">请填写</text>
|
<uni-icons type="right" size="20" color="#CCCCCC"></uni-icons>
|
</view>
|
</view>
|
<view class="personal_list_item" @click="openSex">
|
<view class="label">性别</view>
|
<view class="right">
|
<text>女</text>
|
<uni-icons type="right" size="20" color="#CCCCCC"></uni-icons>
|
</view>
|
</view>
|
<view class="personal_list_item" @click="openDate">
|
<view class="label">生日</view>
|
<view class="right">
|
<text class="right_info">选择</text>
|
<uni-icons type="right" size="20" color="#CCCCCC"></uni-icons>
|
</view>
|
</view>
|
<view class="personal_list_item">
|
<view class="label">手机号</view>
|
<view class="right">
|
<text>15738467760</text>
|
</view>
|
</view>
|
<view class="personal_list_item">
|
<view class="label">收货地址</view>
|
<view class="right">
|
<text class="right_info">修改/添加</text>
|
<uni-icons type="right" size="20" color="#CCCCCC"></uni-icons>
|
</view>
|
</view>
|
</view>
|
<!-- 修改昵称 -->
|
<uni-popup ref="popup" background-color="#fff">
|
<view class="popup">
|
<view class="popup_title">修改昵称</view>
|
<view class="popup_ipt">
|
<input type="text" placeholder="请输入" />
|
<image src="@/static/icon/ic_clean@2x.png" mode="widthFix"></image>
|
</view>
|
<view class="popup_footer">
|
<view class="popup_footer_close" @click="close">取消</view>
|
<view class="popup_footer_save">保存</view>
|
</view>
|
</view>
|
</uni-popup>
|
<!-- 性别 -->
|
<uni-popup ref="sex" background-color="#fff">
|
<view class="sex">
|
<view class="title">
|
<text>性别</text>
|
<view class="title_icon" @click="closeSex">
|
<uni-icons color="#CCCCCB" type="closeempty" size="20"></uni-icons>
|
</view>
|
</view>
|
<view class="content">
|
<picker-view
|
:value="sex"
|
:indicator-style="indicatorStyle"
|
@change="bindChange"
|
:immediate-change="true"
|
class="picker-view">
|
<picker-view-column>
|
<view class="item" v-for="(item,index) in list" :key="index">{{item.label}}</view>
|
</picker-view-column>
|
</picker-view>
|
</view>
|
<view class="submit" @click="updateSex">确定</view>
|
</view>
|
</uni-popup>
|
<!-- 日期 -->
|
<uni-popup ref="date" background-color="#fff">
|
<view class="date">
|
<view class="title">
|
<text>我的生日</text>
|
<view class="title_icon" @click="closeDate">
|
<uni-icons color="#CCCCCB" type="closeempty" size="20"></uni-icons>
|
</view>
|
</view>
|
<view class="content">
|
<picker-view
|
:indicator-style="indicatorStyle"
|
:value="date"
|
:immediate-change="true"
|
@change="bindChangeDate"
|
class="picker-view">
|
<picker-view-column>
|
<view class="item" v-for="(item,index) in years" :key="index">{{item}}年</view>
|
</picker-view-column>
|
<picker-view-column>
|
<view class="item" v-for="(item,index) in months" :key="index">{{item}}月</view>
|
</picker-view-column>
|
<picker-view-column>
|
<view class="item" v-for="(item,index) in days" :key="index">{{item}}日</view>
|
</picker-view-column>
|
</picker-view>
|
</view>
|
<view class="submit" @click="updateSex">确定</view>
|
</view>
|
</uni-popup>
|
</view>
|
</template>
|
|
<script>
|
import { getMonthDay } from '@/common/utils.js'
|
export default {
|
data() {
|
return {
|
sex: '',
|
date: [],
|
indicatorStyle: 'height: 40px;',
|
years: [],
|
year: '',
|
months: [],
|
month: '',
|
days: [],
|
day: '',
|
value: [],
|
list: [
|
{
|
label: '男',
|
value: 1
|
},
|
{
|
label: '女',
|
value: 2
|
}
|
]
|
}
|
},
|
onLoad() {
|
this.getDate()
|
},
|
methods: {
|
getDate() {
|
const date = new Date()
|
const years = []
|
const year = date.getFullYear()
|
const months = []
|
const month = date.getMonth() + 1
|
const days = []
|
const day = date.getDate()
|
for (let i = 1990; i <= date.getFullYear(); i++) {
|
years.push(i)
|
}
|
for (let i = 1; i <= 12; i++) {
|
months.push(i)
|
}
|
let time = `1990-01`
|
for (let i = 0; i <= getMonthDay(time); i++) {
|
days.push(i + 1)
|
}
|
this.years = years
|
this.months = months
|
this.days = days
|
this.year = year
|
this.month = month
|
this.day = day
|
this.date = [9999, month - 1, day - 1]
|
},
|
openSex() {
|
this.$refs.sex.open('bottom')
|
},
|
openDate() {
|
this.$refs.date.open('bottom')
|
},
|
open() {
|
this.$refs.popup.open('center')
|
},
|
close() {
|
this.$refs.popup.close()
|
},
|
closeSex() {
|
this.$refs.sex.close()
|
},
|
closeDate() {
|
this.$refs.date.close()
|
},
|
bindChange(e) {
|
console.log(e)
|
},
|
bindChangeDate(e) {
|
let year = this.years[e.detail.value[0]]
|
let month = this.months[e.detail.value[1]]
|
if (month < 10) {
|
month = `0${month}`
|
}
|
let date = `${year}-${month}`
|
this.days = []
|
for (let i = 0; i < getMonthDay(date); i++) {
|
this.days.push(i + 1)
|
}
|
},
|
updateSex() {
|
|
}
|
}
|
}
|
</script>
|
|
<style>
|
.uni-popup__wrapper {
|
border-radius: 32rpx !important;
|
}
|
</style>
|
|
<style lang="scss" scoped>
|
.personal {
|
width: 100%;
|
background-color: #ffffff;
|
.personal_image {
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
padding-top: 64rpx;
|
margin-bottom: 60rpx;
|
.personal_image_box {
|
width: 176rpx;
|
height: 176rpx;
|
border-radius: 50%;
|
overflow: hidden;
|
position: relative;
|
image {
|
width: 100%;
|
height: 100%;
|
}
|
.eidt {
|
width: 100%;
|
height: 37rpx;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
background: rgba(0,0,0,0.3);
|
font-size: 24rpx;
|
font-family: PingFang SC-Medium, PingFang SC;
|
font-weight: 500;
|
color: #FFFFFF;
|
position: absolute;
|
bottom: 0;
|
left: 0;
|
}
|
}
|
}
|
.personal_list {
|
display: flex;
|
flex-direction: column;
|
padding: 0 34rpx;
|
box-sizing: border-box;
|
.personal_list_item {
|
width: 100%;
|
height: 96rpx;
|
display: flex;
|
align-items: center;
|
justify-content: space-between;
|
border-bottom: 2rpx solid #F4F5F4;
|
&:last-child {
|
border: none !important;
|
}
|
.label {
|
font-size: 32rpx;
|
font-family: PingFang SC-Medium, PingFang SC;
|
font-weight: 500;
|
color: #333333;
|
}
|
.right {
|
display: flex;
|
align-items: center;
|
.right_info {
|
font-size: 28rpx;
|
font-family: PingFang SC-Regular, PingFang SC;
|
font-weight: 400;
|
color: #CCCCCB;
|
}
|
text {
|
font-size: 28rpx;
|
font-family: PingFang SC-Regular, PingFang SC;
|
font-weight: 400;
|
color: #666666;
|
margin-right: 12rpx;
|
}
|
}
|
}
|
}
|
.popup {
|
width: 554rpx;
|
padding: 44rpx 32rpx;
|
box-sizing: border-box;
|
background-color: #ffffff;
|
border-radius: 32rpx;
|
.popup_title {
|
width: 100%;
|
text-align: center;
|
font-size: 32rpx;
|
font-family: PingFang SC-Semibold, PingFang SC;
|
font-weight: 600;
|
color: #333333;
|
}
|
.popup_ipt {
|
padding: 20rpx 0;
|
box-sizing: border-box;
|
display: flex;
|
align-items: center;
|
margin-top: 48rpx;
|
border-bottom: 2rpx solid #F4F5F4;
|
input {
|
flex: 1;
|
}
|
image {
|
flex-shrink: 0;
|
width: 50rpx;
|
height: 50rpx;
|
margin-left: 15rpx;
|
}
|
}
|
.popup_footer {
|
margin-top: 56rpx;
|
display: flex;
|
align-items: center;
|
justify-content: space-around;
|
.popup_footer_close {
|
width: 184rpx;
|
height: 64rpx;
|
line-height: 64rpx;
|
text-align: center;
|
border-radius: 56rpx;
|
border: 2rpx solid #D20A0A;
|
font-size: 28rpx;
|
font-family: PingFang SC-Semibold, PingFang SC;
|
font-weight: 600;
|
color: #D20A0A;
|
}
|
.popup_footer_save {
|
width: 184rpx;
|
height: 64rpx;
|
height: 64rpx;
|
line-height: 64rpx;
|
text-align: center;
|
background: linear-gradient(90deg, #D95A5A 0%, #D20A0A 100%);
|
border-radius: 56rpx;
|
font-size: 28rpx;
|
font-family: PingFang SC-Semibold, PingFang SC;
|
font-weight: 600;
|
color: #FFFFFF;
|
}
|
}
|
}
|
.sex {
|
padding: 44rpx 32rpx;
|
background-color: #FFFFFF;
|
box-sizing: border-box;
|
.title {
|
width: 100%;
|
text-align: center;
|
position: relative;
|
text {
|
font-size: 32rpx;
|
font-family: PingFang SC-Semibold, PingFang SC;
|
font-weight: 600;
|
color: #333333;
|
}
|
.title_icon {
|
position: absolute;
|
right: 0;
|
top: 0;
|
}
|
}
|
.content {
|
width: 100%;
|
margin-top: 80rpx;
|
.picker-view {
|
width: 100%;
|
height: 200rpx;
|
.item {
|
height: 40px;
|
line-height: 40px;
|
text-align: center;
|
}
|
}
|
}
|
.submit {
|
width: 100%;
|
height: 72rpx;
|
line-height: 72rpx;
|
text-align: center;
|
background: linear-gradient(270deg, #D20A0A 0%, #D95A5A 100%);
|
border-radius: 36rpx;
|
font-size: 32rpx;
|
font-family: PingFang SC-Medium, PingFang SC;
|
font-weight: 500;
|
color: #FFFFFF;
|
margin-top: 50rpx;
|
}
|
}
|
.date {
|
padding: 44rpx 32rpx;
|
background-color: #FFFFFF;
|
box-sizing: border-box;
|
.title {
|
width: 100%;
|
text-align: center;
|
position: relative;
|
text {
|
font-size: 32rpx;
|
font-family: PingFang SC-Semibold, PingFang SC;
|
font-weight: 600;
|
color: #333333;
|
}
|
.title_icon {
|
position: absolute;
|
right: 0;
|
top: 0;
|
}
|
}
|
.content {
|
width: 100%;
|
margin-top: 80rpx;
|
.picker-view {
|
width: 100%;
|
height: 600rpx;
|
.item {
|
height: 40px;
|
line-height: 40px;
|
text-align: center;
|
}
|
}
|
}
|
.submit {
|
width: 100%;
|
height: 72rpx;
|
line-height: 72rpx;
|
text-align: center;
|
background: linear-gradient(270deg, #D20A0A 0%, #D95A5A 100%);
|
border-radius: 36rpx;
|
font-size: 32rpx;
|
font-family: PingFang SC-Medium, PingFang SC;
|
font-weight: 500;
|
color: #FFFFFF;
|
margin-top: 50rpx;
|
}
|
}
|
}
|
</style>
|