Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
lls_program
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
hookehuyr
2025-09-02 15:15:32 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
eff81f9c54a96476dcbd3577663432265f0f1c23
eff81f9c
1 parent
2f3b2f64
fix(AddProfile): 修复头像显示问题并调整图片大小限制
将头像显示逻辑简化为使用默认头像当未设置时 调整图片上传大小限制从10MB降至5MB
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
src/pages/AddProfile/index.vue
src/pages/AddProfile/index.vue
View file @
eff81f9
...
...
@@ -3,8 +3,7 @@
<!-- Avatar -->
<view class="flex flex-col items-center py-8" @click="changeAvatar">
<view class="w-24 h-24 rounded-full bg-gray-100 flex items-center justify-center mb-2 overflow-hidden">
<image v-if="formData.avatar_url" :src="formData.avatar_url" class="w-full h-full" mode="aspectFill" />
<My size="40" color="#888" v-else />
<image :src="formData.avatar_url || defaultAvatar" class="w-full h-full" mode="aspectFill" />
</view>
<text class="text-gray-500 text-sm">上传头像</text>
</view>
...
...
@@ -85,8 +84,10 @@
<script setup>
import { ref, reactive, onMounted, computed } from 'vue';
import Taro from '@tarojs/taro';
import {
My,
Date as DateIcon, Right } from '@nutui/icons-vue-taro';
import { Date as DateIcon, Right } from '@nutui/icons-vue-taro';
import BASE_URL from '@/utils/config';
// 默认头像
const defaultAvatar = 'https://cdn.ipadbiz.cn/mlaj/images/icon_1.jpeg'
/**
* @description 表单数据
...
...
@@ -180,9 +181,9 @@ const changeAvatar = () => {
sourceType: ['album', 'camera'],
success: (res) => {
const tempFile = res.tempFiles[0];
if (tempFile.size >
10
* 1024 * 1024) {
if (tempFile.size >
5
* 1024 * 1024) {
Taro.showToast({
title: '图片大小不能超过
10
MB',
title: '图片大小不能超过
5
MB',
icon: 'none',
});
return;
...
...
Please
register
or
login
to post a comment