xunji-wode-qianming.vue 1.64 KB
<template>
  <view class="container">
    <view class="content">
      <textarea
        class="signature-textarea"
        placeholder="暂未填写"
        v-model="signature"
        :maxlength="50"
        auto-height
      >
      </textarea>
      <view class="signature-count">
        <text>{{ signature.length }}/50</text>
      </view>
    </view>
    <view class="saveBtn">
      <button class="btn" @click="saveSignature">保存</button>
    </view>
  </view>
</template>

<script setup>
  import { ref } from 'vue';
  import { onLoad } from '@dcloudio/uni-app';
  import UserApi from '@/sheep/api/member/user.js';
  // 签名内容
  const signature = ref('');
  onLoad((e) => {
    signature.value = e.signature || '';
  });
  const saveSignature = async () => {
    await UserApi.updateSignature({
      data: signature.value,
    });
  };
</script>

<style lang="scss">
  .container {
    background-color: #f5f5f5;
    height: 100%;
    .content {
      width: 100%;
      padding: 20rpx 0;
      height: 150rpx;
      position: relative;
      margin-bottom: 80rpx;
      .signature-textarea {
        width: 100%;
        font-size: 28rpx;
        color: #333333;
        background-color: #ffffff;
        border-radius: 8rpx;
        padding: 15rpx;
        height: 100% !important;
      }
      .signature-count {
        position: absolute;
        bottom: 0rpx;
        right: 15rpx;
        font-size: 24rpx;
        color: #999999;
      }
    }
    .btn {
      width: 90%;
      height: 80rpx;
      line-height: 80rpx;
      font-size: 32rpx;
      color: #ffffff;
      background-color: #ff6600;
      border-radius: 8rpx;
    }
  }
</style>