123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 |
- <template>
- <view class="content">
- <view class="listBox">
- <view class="row flex" @click="imgsub">
- <text class="tit">头像</text>
- <view>
- <image class="background-img" v-model="userInfo.avatar" :src="userInfo.avatar" mode="aspectFill">
- </image>
- </view>
- </view>
- <view class="list">
- <view class="flex listItem">
- <view class="flex titleBox">
- <text class="title">昵称</text>
- </view>
- <view class="right flex">
- <input class="input" type="text" v-model="userInfo.nickname" placeholder="请输入昵称" placeholder-class="placeholder" />
- </view>
- </view>
- <view class="flex listItem">
- <view class="flex titleBox">
- <text class="title">ID</text>
- </view>
- <view class="right flex">
- <text>{{userInfo.uid}}</text>
- <!-- <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image> -->
- </view>
- </view>
- <!-- <view class="flex listItem">
- <view class="flex titleBox">
- <text class="title">账户</text>
- </view>
- <view class="right flex">
- <text>{{userInfo.account}}</text>
- </view>
- </view> -->
- </view>
- </view>
- <view class="base-buttom" @click="confirm">提交</view>
- </view>
- </template>
- <script>
- import {
- mapState,
- } from 'vuex';
- import {
- userEdit,
- upload
- } from '@/api/set.js';
- export default {
- data() {
- return {
- }
- },
- onLoad() {
- console.log(this.userInfo)
- },
- computed: {
- ...mapState('user', ['userInfo'])
- },
- methods: {
- imgsub() {
- console.log('上传头像')
- upload({
- filename: ''
- }).then(data => {
- console.log("data", data);
- this.userInfo.avatar = data[0].img;
- })
- },
- confirm() {
- userEdit({
- avatar: this.userInfo.avatar,
- nickname: this.userInfo.nickname
- })
- .then(e => {
- this.$api.msg('修改成功');
- setTimeout(() => {
- uni.switchTab({
- url: '/pages/userhome/user'
- });
- }, 1000);
- console.log(e);
- })
- .catch(e => {
- console.log(e);
- });
- },
- }
- }
- </script>
- <style lang="scss">
- .content {
- padding-top: 30rpx;
- }
- .listBox {
- margin: 0 $page-row-spacing;
- border-radius: 20rpx;
- overflow: hidden;
- background-color: #FFFFFF;
- }
- .list {
- .listItem {
- padding: 35rpx 40rpx;
- border-bottom: 1px solid $page-color-light;
- }
- .listIconImg {
- width: 36rpx;
- }
- .right {
- color: $font-color-light;
- font-size: $font-base;
- flex-grow: 1;
- justify-content: flex-end;
- .img {
- width: 26rpx;
- }
- }
- .input {
- flex-grow: 1;
- text-align: right;
- font-size: $font-base;
- color: $color-gray;
- }
-
- .titleBox {
- .title {
- color: $font-color-base;
- font-size: $font-base;
- }
- }
- }
-
- .row {
- display: flex;
- align-items: center;
- padding: 35rpx 40rpx;
- background: #fff;
- border-bottom: 1px solid $page-color-light;
- .background-img {
- width: 80rpx;
- height: 80rpx;
- border-radius: 50%;
- background: #f2f2f2;
- }
- .tit {
- flex-shrink: 0;
- width: 120upx;
- font-size: $font-base;
- color: $font-color-base;
- }
- }
- </style>
|