| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- <template>
- <view>
- <u-cell title="头像" :isLink="true" arrow-direction="right">
- <div slot="value">
- <!-- <u-image src="https://img.yzcdn.cn/vant/cat.jpeg" width="50px" height="50px" shape="circle" /> -->
- <u-upload :fileList="fileList1" @afterRead="afterRead" @delete="deletePic" name="1" multiple :maxCount="10">
- <u-image :src="src" width="50px" height="50px" shape="circle" />
- </u-upload>
- </div>
- </u-cell>
- <u-cell title="昵称" :isLink="true" url="/components/editUserInfo/editUserName/editUserName" :value="userName" arrow-direction="right" @click="getUserInfo"></u-cell>
- <u-cell title="手机号" :isLink="true" url="/components/editUserInfo/editUserPhone/editUserPhone" arrow-direction="right"></u-cell>
- <u-cell title="实名认证" :isLink="true" url="/components/editUserInfo/nameAuthentication/nameAuthentication" arrow-direction="right"></u-cell>
- <u-cell title="设置支付密码" :isLink="true" url="/components/editUserInfo/editPayPassWord/editPayPassWord" arrow-direction="right"></u-cell>
- <u-cell title="性别" @click="setSex" :value="sex" :isLink="true" arrow-direction="right"></u-cell>
- <u-cell title="生日" @click="showBirthday = true" :value="time" :isLink="true" arrow-direction="right"></u-cell>
- <u-button>退出账户</u-button>
- <u-datetime-picker :show="showBirthday" @confirm="confirm" mode="date" @cancel="showBirthday = false"></u-datetime-picker>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- fileList1: [
- ],
- src: 'https://img.yzcdn.cn/vant/cat.jpeg',
- userName: '',
- sex: '男',
- showBirthday:false,
- time:''
- }
- },
- mounted() {
- },
- methods: {
- getUserInfo() {
- console.log('获取用户信息');
- // uni.getUserProfile({
- // desc: '用于获取您的个人信息',
- // success: (res) => {
- // console.log(res)
- // this.src = res.userInfo.avatarUrl;
- // this.userName = res.userInfo.nickName;
- // },
- // fail:(err)=>{
- // console.log(err);
- // }
- // })
- },
- setSex() {
- uni.showActionSheet({
- itemList: ['男', '女'],
- success: (res) => {
- console.log(res.tapIndex)
- this.sex = res.tapIndex == 0 ? '男' : '女';
- },
- fail: (err) => {
- console.log(err.errMsg)
- }
- });
- },
- formatter(value) {
- if (!value) return ''
- const date = new Date(value)
- const formattedDate = `${date.getFullYear()}-${(date.getMonth() + 1).toString().padStart(2, '0')}-${date.getDate().toString().padStart(2, '0')} ${date.getHours().toString().padStart(2, '0')}:${date.getMinutes().toString().padStart(2, '0')}`
- return formattedDate
- },
- confirm(value){
- console.log('confirm', value);
- this.time = this.formatter(value.value);
- this.showBirthday = false;
- },
- afterRead(file) {
- console.log(file);
- this.src = file[0].url;
- },
- deletePic(file) {
- console.log(file);
- this.src = '';
- }
- }
- }
- </script>
- <style>
- </style>
|