This commit is contained in:
@@ -160,7 +160,7 @@ export async function uploadCroppedImage(blob, options = {}) {
|
||||
if (!blob) throw new Error('请选择要上传的文件')
|
||||
|
||||
const formData = new FormData()
|
||||
const filename = options.filename || 'avatar.png'
|
||||
const filename = options.filename || 'avatar.jpg'
|
||||
formData.append('file', blob, filename)
|
||||
|
||||
// 自动检测token类型(管理员或普通用户)
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 158 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.9 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
Before Width: | Height: | Size: 573 KiB |
Binary file not shown.
Before Width: | Height: | Size: 47 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.6 KiB |
@@ -452,7 +452,7 @@ import { getPostDetail } from '@/api/posts.js'
|
||||
import { useScrollLock } from '@/composables/useScrollLock'
|
||||
import { formatTime } from '@/utils/timeFormat'
|
||||
import { sanitizeContent } from '@/utils/contentSecurity'
|
||||
import defaultAvatar from '@/assets/imgs/avatar.png'
|
||||
import defaultAvatar from '@/assets/imgs/avatar.jpg'
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
@@ -2153,7 +2153,7 @@ const handleSendComment = async () => {
|
||||
user_id: response.data.user_display_id || response.data.user_id,
|
||||
user_auto_id: response.data.user_auto_id || response.data.user_id,
|
||||
username: response.data.nickname || '匿名用户',
|
||||
avatar: response.data.user_avatar || new URL('@/assets/imgs/avatar.png', import.meta.url).href,
|
||||
avatar: response.data.user_avatar || new URL('@/assets/imgs/avatar.jpg', import.meta.url).href,
|
||||
verified: response.data.verified || 0, // 认证状态
|
||||
content: response.data.content,
|
||||
time: formatTime(response.data.created_at) || '刚刚',
|
||||
|
@@ -213,7 +213,7 @@ function getFollowingText(user) {
|
||||
}
|
||||
|
||||
function handleAvatarError(event) {
|
||||
import('@/assets/imgs/avatar.png').then(module => {
|
||||
import('@/assets/imgs/avatar.jpg').then(module => {
|
||||
event.target.src = module.default
|
||||
})
|
||||
}
|
||||
|
@@ -12,7 +12,7 @@ import { useLikeStore } from '@/stores/like.js'
|
||||
import { useCollectStore } from '@/stores/collect.js'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
import { getPostList } from '@/api/posts.js'
|
||||
import defaultAvatar from '@/assets/imgs/avatar.png'
|
||||
import defaultAvatar from '@/assets/imgs/avatar.jpg'
|
||||
import defaultPlaceholder from '@/assets/imgs/avatar (11).jpg'
|
||||
|
||||
const props = defineProps({
|
||||
@@ -857,7 +857,7 @@ function onFadeInEnd(item) {
|
||||
// 处理头像加载失败
|
||||
function handleAvatarError(event) {
|
||||
if (event.target) {
|
||||
import('@/assets/imgs/avatar.png').then(module => {
|
||||
import('@/assets/imgs/avatar.jpg').then(module => {
|
||||
if (event.target) {
|
||||
event.target.src = module.default
|
||||
}
|
||||
|
@@ -76,7 +76,7 @@ const emit = defineEmits(['close', 'select'])
|
||||
// 防滚动穿透
|
||||
const { lock, unlock } = useScrollLock()
|
||||
|
||||
const defaultAvatar = new URL('@/assets/imgs/avatar.png', import.meta.url).href
|
||||
const defaultAvatar = new URL('@/assets/imgs/avatar.jpg', import.meta.url).href
|
||||
const searchQuery = ref('')
|
||||
const loading = ref(false)
|
||||
const friends = ref([])
|
||||
|
@@ -371,7 +371,7 @@ const performSubmit = async () => {
|
||||
password: formData.password,
|
||||
captchaId: captchaId.value,
|
||||
captchaText: formData.captchaText,
|
||||
avatar: new URL('@/assets/imgs/avatar.png', import.meta.url).href,
|
||||
avatar: new URL('@/assets/imgs/avatar.jpg', import.meta.url).href,
|
||||
bio: '用户没有任何简介',
|
||||
location: '未知'
|
||||
})
|
||||
|
@@ -120,7 +120,7 @@ class StuckItemManager {
|
||||
img.onerror = () => {
|
||||
// 根据图片类型选择不同的占位图
|
||||
const isAvatar = el.classList.contains('lazy-avatar')
|
||||
const placeholderImg = isAvatar ? '@/assets/imgs/avatar.png' : '@/assets/imgs/avatar (11).jpg'
|
||||
const placeholderImg = isAvatar ? '@/assets/imgs/avatar.jpg' : '@/assets/imgs/avatar (11).jpg'
|
||||
el.src = new URL(placeholderImg, import.meta.url).href
|
||||
el.alt = '图片加载失败'
|
||||
el.dispatchEvent(new Event('load'))
|
||||
@@ -132,7 +132,7 @@ class StuckItemManager {
|
||||
if (!el.src || el.src === 'data:' || el.src.includes('blob:')) {
|
||||
// 根据图片类型选择不同的占位图
|
||||
const isAvatar = el.classList.contains('lazy-avatar')
|
||||
const placeholderImg = isAvatar ? '@/assets/imgs/avatar.png' : '@/assets/imgs/avatar (11).jpg'
|
||||
const placeholderImg = isAvatar ? '@/assets/imgs/avatar.jpg' : '@/assets/imgs/avatar (11).jpg'
|
||||
el.src = new URL(placeholderImg, import.meta.url).href
|
||||
el.alt = '图片加载超时'
|
||||
el.dispatchEvent(new Event('load'))
|
||||
@@ -155,7 +155,7 @@ const loadImageImmediately = (el, src) => {
|
||||
img.onerror = null
|
||||
// 根据图片类型选择不同的占位图
|
||||
const isAvatar = el.classList.contains('lazy-avatar')
|
||||
const placeholderImg = isAvatar ? '@/assets/imgs/avatar.png' : '@/assets/imgs/avatar (11).jpg'
|
||||
const placeholderImg = isAvatar ? '@/assets/imgs/avatar.jpg' : '@/assets/imgs/avatar (11).jpg'
|
||||
el.src = new URL(placeholderImg, import.meta.url).href
|
||||
el.alt = '图片加载超时'
|
||||
el.style.opacity = '1'
|
||||
@@ -178,7 +178,7 @@ const loadImageImmediately = (el, src) => {
|
||||
clearTimeout(timeout)
|
||||
// 根据图片类型选择不同的占位图
|
||||
const isAvatar = el.classList.contains('lazy-avatar')
|
||||
const placeholderImg = isAvatar ? '@/assets/imgs/avatar.png' : '@/assets/imgs/avatar (11).jpg'
|
||||
const placeholderImg = isAvatar ? '@/assets/imgs/avatar.jpg' : '@/assets/imgs/avatar (11).jpg'
|
||||
el.src = new URL(placeholderImg, import.meta.url).href
|
||||
el.alt = '图片加载失败'
|
||||
el.style.opacity = '1'
|
||||
@@ -249,7 +249,7 @@ export const lazyPlugin = {
|
||||
clearTimeout(loadTimeout)
|
||||
// 根据图片类型选择不同的占位图
|
||||
const isAvatar = el.classList.contains('lazy-avatar')
|
||||
const placeholderImg = isAvatar ? '@/assets/imgs/avatar.png' : '@/assets/imgs/avatar (11).jpg'
|
||||
const placeholderImg = isAvatar ? '@/assets/imgs/avatar.jpg' : '@/assets/imgs/avatar (11).jpg'
|
||||
el.src = new URL(placeholderImg, import.meta.url).href
|
||||
el.alt = '图片加载失败'
|
||||
el.style.opacity = '1'
|
||||
@@ -264,7 +264,7 @@ export const lazyPlugin = {
|
||||
}).catch(() => {
|
||||
// 队列加载失败,显示默认图片
|
||||
const isAvatar = el.classList.contains('lazy-avatar')
|
||||
const placeholderImg = isAvatar ? '@/assets/imgs/avatar.png' : '@/assets/imgs/avatar (11).jpg'
|
||||
const placeholderImg = isAvatar ? '@/assets/imgs/avatar.jpg' : '@/assets/imgs/avatar (11).jpg'
|
||||
el.src = new URL(placeholderImg, import.meta.url).href
|
||||
el.alt = '图片加载失败'
|
||||
el.style.opacity = '1'
|
||||
|
@@ -59,7 +59,7 @@ export const useCommentStore = defineStore('comment', () => {
|
||||
user_id: comment.user_display_id || comment.user_id, // 职员号(用于导航)
|
||||
user_auto_id: comment.user_auto_id || comment.user_id, // 用户自增ID(用于权限判断)
|
||||
username: comment.nickname || '匿名用户',
|
||||
avatar: comment.user_avatar || new URL('@/assets/imgs/avatar.png', import.meta.url).href,
|
||||
avatar: comment.user_avatar || new URL('@/assets/imgs/avatar.jpg', import.meta.url).href,
|
||||
verified: comment.verified || 0, // 认证状态
|
||||
content: comment.content,
|
||||
time: formatTime(comment.created_at),
|
||||
|
@@ -45,7 +45,7 @@
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { adminApi } from '@/api'
|
||||
import defaultAvatar from '@/assets/imgs/avatar.png'
|
||||
import defaultAvatar from '@/assets/imgs/avatar.jpg'
|
||||
import ContentRenderer from '@/components/ContentRenderer.vue'
|
||||
const router = useRouter()
|
||||
const activities = ref([])
|
||||
|
@@ -369,7 +369,7 @@ function setupTeleportWatcher() {
|
||||
const { confirmState, handleConfirm, handleCancel, confirmDelete, showError } = useConfirm()
|
||||
|
||||
// 默认头像
|
||||
const defaultAvatar = new URL('@/assets/imgs/avatar.png', import.meta.url).href
|
||||
const defaultAvatar = new URL('@/assets/imgs/avatar.jpg', import.meta.url).href
|
||||
|
||||
// 获取认证头
|
||||
const getAuthHeaders = () => {
|
||||
|
@@ -1221,7 +1221,7 @@ const handleAvatarCropConfirm = async (blob) => {
|
||||
try {
|
||||
// 调用实际的上传API
|
||||
const result = await imageUploadApi.uploadCroppedImage(blob, {
|
||||
filename: 'avatar.png'
|
||||
filename: 'avatar.jpg'
|
||||
})
|
||||
|
||||
if (result.success) {
|
||||
|
@@ -13,7 +13,7 @@ const userStore = useUserStore()
|
||||
const notificationStore = useNotificationStore()
|
||||
const authStore = useAuthStore()
|
||||
|
||||
const defaultAvatar = new URL('@/assets/imgs/avatar.png', import.meta.url).href
|
||||
const defaultAvatar = new URL('@/assets/imgs/avatar.jpg', import.meta.url).href
|
||||
|
||||
// 从store获取未读通知数量
|
||||
const unreadCount = computed(() => notificationStore.unreadCount)
|
||||
@@ -58,7 +58,7 @@ const handleLoginClick = () => {
|
||||
}
|
||||
|
||||
function handleAvatarError(event) {
|
||||
import('@/assets/imgs/avatar.png').then(module => {
|
||||
import('@/assets/imgs/avatar.jpg').then(module => {
|
||||
event.target.src = module.default
|
||||
})
|
||||
}
|
||||
|
@@ -25,7 +25,7 @@ import { useCommentLikeStore } from '@/stores/commentLike'
|
||||
import { useCommentStore } from '@/stores/comment'
|
||||
import { formatTime } from '@/utils/timeFormat'
|
||||
import { sanitizeContent } from '@/utils/contentSecurity'
|
||||
import avatarPlaceholder from '@/assets/imgs/avatar.png'
|
||||
import avatarPlaceholder from '@/assets/imgs/avatar.jpg'
|
||||
import imagePlaceholder from '@/assets/imgs/avatar (11).jpg'
|
||||
|
||||
|
||||
@@ -139,7 +139,7 @@ async function loadCommentsData(isLoadMore = false) {
|
||||
id: item.from_user_id,
|
||||
autoId: item.from_user_auto_id,
|
||||
username: item.from_nickname || '未知用户',
|
||||
avatar: item.from_avatar || new URL('@/assets/imgs/avatar.png', import.meta.url).href,
|
||||
avatar: item.from_avatar || new URL('@/assets/imgs/avatar.jpg', import.meta.url).href,
|
||||
verified: item.from_verified || 0,
|
||||
action: item.title || '评论了你的笔记',
|
||||
time: formatTime(item.created_at),
|
||||
@@ -211,7 +211,7 @@ async function loadLikesData(isLoadMore = false) {
|
||||
id: item.from_user_id, // 使用from_user_id字段(职员号)用于导航
|
||||
autoId: item.from_user_auto_id, // 自增ID,用于API调用
|
||||
username: item.from_nickname || '未知用户',
|
||||
avatar: item.from_avatar || new URL('@/assets/imgs/avatar.png', import.meta.url).href,
|
||||
avatar: item.from_avatar || new URL('@/assets/imgs/avatar.jpg', import.meta.url).href,
|
||||
verified: item.from_verified || 0,
|
||||
action: item.title || '点赞了你的内容', // 使用后端返回的正确标题
|
||||
time: formatTime(item.created_at),
|
||||
@@ -307,7 +307,7 @@ async function loadFollowsData(isLoadMore = false) {
|
||||
from_user_id: item.from_user_id, // 添加from_user_id字段供FollowButton使用
|
||||
autoId: item.from_user_auto_id, // 自增ID,用于API调用
|
||||
username: item.from_nickname || '未知用户',
|
||||
avatar: item.from_avatar || new URL('@/assets/imgs/avatar.png', import.meta.url).href,
|
||||
avatar: item.from_avatar || new URL('@/assets/imgs/avatar.jpg', import.meta.url).href,
|
||||
verified: item.from_verified || 0,
|
||||
action: actionText,
|
||||
time: formatTime(item.created_at),
|
||||
@@ -364,7 +364,7 @@ async function loadCollectionsData(isLoadMore = false) {
|
||||
id: item.from_user_id, // 使用from_user_id字段(职员号)用于导航
|
||||
autoId: item.from_user_auto_id, // 自增ID,用于API调用
|
||||
username: item.from_nickname || '未知用户',
|
||||
avatar: item.from_avatar || new URL('@/assets/imgs/avatar.png', import.meta.url).href,
|
||||
avatar: item.from_avatar || new URL('@/assets/imgs/avatar.jpg', import.meta.url).href,
|
||||
verified: item.from_verified || 0,
|
||||
action: item.title || '收藏了你的笔记', // 使用后端返回的正确标题
|
||||
time: formatTime(item.created_at),
|
||||
|
@@ -83,7 +83,7 @@ const isCurrentUser = computed(() => {
|
||||
})
|
||||
// 处理头像加载失败
|
||||
function handleAvatarError(event) {
|
||||
import('@/assets/imgs/avatar.png').then(module => {
|
||||
import('@/assets/imgs/avatar.jpg').then(module => {
|
||||
event.target.src = module.default
|
||||
})
|
||||
}
|
||||
|
@@ -21,7 +21,7 @@ const navigationStore = useNavigationStore()
|
||||
const userStore = useUserStore()
|
||||
const followStore = useFollowStore()
|
||||
|
||||
const defaultAvatar = new URL('@/assets/imgs/avatar.png', import.meta.url).href
|
||||
const defaultAvatar = new URL('@/assets/imgs/avatar.jpg', import.meta.url).href
|
||||
const userId = ref(route.params.userId)
|
||||
const loading = ref(true)
|
||||
|
||||
@@ -203,7 +203,7 @@ const getFollowStatus = async () => {
|
||||
|
||||
// 处理头像加载失败
|
||||
function handleAvatarError(event) {
|
||||
import('@/assets/imgs/avatar.png').then(module => {
|
||||
import('@/assets/imgs/avatar.jpg').then(module => {
|
||||
event.target.src = module.default
|
||||
})
|
||||
}
|
||||
|
@@ -174,7 +174,7 @@ const $message = inject('$message')
|
||||
// 滚动锁定
|
||||
const { lock, unlock } = useScrollLock()
|
||||
|
||||
const defaultAvatar = new URL('@/assets/imgs/avatar.png', import.meta.url).href
|
||||
const defaultAvatar = new URL('@/assets/imgs/avatar.jpg', import.meta.url).href
|
||||
|
||||
// 表单数据
|
||||
const form = reactive({
|
||||
@@ -612,7 +612,7 @@ const handleSave = async () => {
|
||||
|
||||
try {
|
||||
const result = await imageUploadApi.uploadCroppedImage(form.avatarBlob, {
|
||||
filename: 'avatar.png'
|
||||
filename: 'avatar.jpg'
|
||||
})
|
||||
|
||||
if (result.success) {
|
||||
|
@@ -19,7 +19,7 @@ const router = useRouter()
|
||||
const navigationStore = useNavigationStore()
|
||||
const userStore = useUserStore()
|
||||
|
||||
const defaultAvatar = new URL('@/assets/imgs/avatar.png', import.meta.url).href
|
||||
const defaultAvatar = new URL('@/assets/imgs/avatar.jpg', import.meta.url).href
|
||||
|
||||
// 用户统计信息
|
||||
const userStats = ref({
|
||||
@@ -62,7 +62,7 @@ const previewAvatar = () => {
|
||||
|
||||
// 处理头像加载失败
|
||||
function handleAvatarError(event) {
|
||||
import('@/assets/imgs/avatar.png').then(module => {
|
||||
import('@/assets/imgs/avatar.jpg').then(module => {
|
||||
event.target.src = module.default
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user