Skip to content

Commit

Permalink
fix: a
Browse files Browse the repository at this point in the history
  • Loading branch information
IceyWu committed Jan 11, 2025
1 parent 9e8b386 commit c8d59ba
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 21 deletions.
5 changes: 3 additions & 2 deletions src/components/Popper/noticeList.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script setup>
import { useRouter } from 'vue-router'
import { messageUpdate } from '~/api/message'
import { adjustImgData } from '~/utils/tools'
// import { ListItem } from "./data";
import NoticeItem from './noticeItem.vue'
Expand All @@ -15,10 +16,10 @@ function handleItemClick(data) {
const { type, objInfo = {} } = data || {}
switch (type) {
case 'like':
const { id, files } = objInfo
const { id, fileList } = objInfo
// 消息状态更新
handlemessageUpdate(data.id)
const imgCover = files[0].file
const imgCover = adjustImgData(fileList[0]).cover
router.push(`/detail/${id}?imgCover=${imgCover}`)
break
default:
Expand Down
7 changes: 4 additions & 3 deletions src/components/Slider.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,20 @@ function clickTab(item, index) {
console.log('clickTab', item, index)
const { name } = item
if (name === '发布') {
isShowDialog.value = true
// isShowDialog.value = true
ElMessage.warning('发布重构中,尽情期待!')
}
}
</script>
<template>
<div class="slider">
<div class="slider__list">
<div
<div
v-for="(item, index) in showTabList" :key="index" class="slider__item" :class="[
isDark ? 'slider__item-dark' : '',
index === chooseIndex ? 'bg-[#f8f8f8] dark:bg-[#333]' : ' ',
]" @click="clickTab(item, index)"
]" @click="clickTab(item, index)"
>
<router-link :to="item.path" class="slider__link" :class="isDark ? 'slider__link-dark' : ''">
<div class="slider__icon" :class="item.icon">
Expand Down
2 changes: 1 addition & 1 deletion src/components/StarportCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const coverUrl = computed(() => {
<div class="cover-box" />
</div>
<!-- 视频 -->
<template v-if="data.fileType == 'VIDEO'">
<template v-if="data?.fileType == 'VIDEO'">
<template v-if="isDetail">
<div class="relative h-full w-full flex items-center justify-center">
<video
Expand Down
17 changes: 9 additions & 8 deletions src/components/post/base.vue
Original file line number Diff line number Diff line change
Expand Up @@ -200,19 +200,20 @@ async function handleSave() {
saveLoading.value = true
// const files = fileList.value || []
const files = fileList.value.map((item) => {
const { fileType, file, thumbnail, videoSrc } = item
return {
fileType,
file,
thumbnail,
videoSrc,
}
// const { fileType, file, thumbnail, videoSrc } = item
// return {
// fileType,
// file,
// thumbnail,
// videoSrc,
// }
return item.id
})
const params = {
content: formData.content,
title: formData.title,
files,
fileIds: files,
}
if (chooseTagIds.value.length > 0) {
params.tagIds = chooseTagIds.value
Expand Down
10 changes: 5 additions & 5 deletions src/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import Skeleton from '~/components/skeleton'
import StarportCard from '~/components/StarportCard.vue'
import { useUserStore } from '~/stores/user'
import { formatTime } from '~/utils'
import { getUserAvatar } from '~/utils/tools'
import { adjustImgData, getUserAvatar } from '~/utils/tools'
// Import Swiper Vue.js components
Expand Down Expand Up @@ -118,8 +118,8 @@ const parts = computed(() => {
function goDe(item: any) {
// return
const { id, files } = item
const imgCover = files[0].file
const { id, fileList } = item
const imgCover = adjustImgData(fileList[0]).cover
router.push(`/detail/${id}?imgCover=${imgCover}`)
}
// 标签信息
Expand All @@ -140,7 +140,7 @@ function getNext() {
function initData() {
dataParams.value = {
page: 1,
size: 100,
size: 1000,
}
listObj.value.list = []
listObj.value.finished = false
Expand All @@ -155,7 +155,7 @@ const listObj = ref({
})
const dataParams = ref({
page: 1,
size: 100,
size: 1000,
})
async function getConData(readStatus, target) {
listObj.value.loading = true
Expand Down
6 changes: 4 additions & 2 deletions src/utils/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,20 @@ export function isIphoneImg(data: any) {

// 图片数据调整
export function adjustImgData(data: any) {
const { url = '', type = 'image/jpeg', videoSrc = '', cover = '' } = data || {}
const { url = '', type = 'image/jpeg', videoSrc = '', cover = '', fromIphone } = data || {}
const fileType = type.toUpperCase().includes('VIDEO') ? 'VIDEO' : 'IMAGE'
const file = deepClone(url)
let newUrl = deepClone(url)
const isIphone = isIphoneImg(data)

let addInfo = {}
if (fileType === 'IMAGE') {
let preSrc = `${file}?x-oss-process=image/resize,l_50`
let src = `${file}?x-oss-process=image/resize,l_400`
let baseSrc = deepClone(url)
const fileSuffix = file.substring(file.lastIndexOf('.'))?.toLowerCase()
if (['heic', 'HEIC'].includes(fileSuffix) || isIphone) {

if (['.heic', '.HEIC'].includes(fileSuffix) || isIphone || fromIphone) {
if (!file.includes('format,jpg')) {
baseSrc = `${url}?x-oss-process=image/format,jpg`
newUrl = `${url}?x-oss-process=image/format,jpg`
Expand Down

0 comments on commit c8d59ba

Please sign in to comment.