<template>
  <div class="uploadPhoto">
    <div class="photo">
      <div class="photo-title">图片 <span>（最多1张）</span></div>
      <div class="pad-120">
        <AiUploader :limit="1" multiple placeholder="上传图片" :def.sync="picture" action="/admin/file/add-portrait"/>
      </div>
    </div>
    <div style="height: 56px;"></div>
    <div class="btn" @click="back">返回</div>
  </div>
</template>

<script>
import {mapActions} from "vuex";

export default {
  name: 'uploadPhoto',
  data() {
    return {
      picture: []
    }
  },
  methods: {
    ...mapActions(['getAccount']),
    back() {
      uni.navigateBack({
        success: () => {
          this.getAccount()
        }
      })
    }
  },
  onShow() {
    document.title = '头像上传'
  },

}
</script>

<style lang="scss" scoped>
.uploadPhoto {

  .photo {
    background-color: #FFFFFF;
    padding: 20px 30px;

    .photo-title {
      width: 100%;
      height: 100px;
      line-height: 80px;
      color: #333333;

      & > span {
        color: #999999;
      }
    }

  }

  .btn {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 112px;
    line-height: 112px;
    text-align: center;
    background-color: #1365DD;
    color: #FFFFFF;
  }
}
</style>
