|
@@ -30,6 +30,7 @@ import { useRouter } from '../../../core/utils/router'
|
|
|
import { usePermissions } from '../../../composables/permissions'
|
|
|
import mpHtml from 'mp-html/dist/uni-app/components/mp-html/mp-html.vue'
|
|
|
import WdInput from 'wot-design-uni/components/wd-input/wd-input.vue'
|
|
|
+import { getRect, addUnit } from 'wot-design-uni/components/common/util'
|
|
|
|
|
|
const { features } = usePermissions()
|
|
|
const userStore = useUserStore()
|
|
@@ -62,9 +63,9 @@ const isVideo = ref(false)
|
|
|
const reviewId = ref()
|
|
|
const refreshIndex = ref<number>()
|
|
|
const handleChange = ({ detail: { current } }) => {
|
|
|
- swiperStyle.value = {
|
|
|
- height: swiperSizes.value[current].height + 'px',
|
|
|
- }
|
|
|
+ // swiperStyle.value = {
|
|
|
+ // height: swiperSizes.value[current].height + 'px',
|
|
|
+ // }
|
|
|
}
|
|
|
const setSwiperStyle = async () => {
|
|
|
if (!data.value.bannerUrls.length) return
|
|
@@ -73,12 +74,21 @@ const setSwiperStyle = async () => {
|
|
|
isVideo.value = true
|
|
|
return
|
|
|
}
|
|
|
- swiperSizes.value = (
|
|
|
- await Promise.all(data.value.bannerUrls.map((src) => uni.getImageInfo({ src })))
|
|
|
- ).map(({ width, height }) => ({ width: screenWidth, height: height / (width / screenWidth) }))
|
|
|
+
|
|
|
+ const { width, height } = await uni.getImageInfo({ src: data.value.bannerUrls.at(0) })
|
|
|
+ console.log(screenWidth / width)
|
|
|
+
|
|
|
swiperStyle.value = {
|
|
|
- height: swiperSizes.value[0].height + 'px',
|
|
|
+ height:
|
|
|
+ height > width
|
|
|
+ ? addUnit(500)
|
|
|
+ : addUnit(
|
|
|
+ screenWidth / width > 1
|
|
|
+ ? height / (screenWidth / width)
|
|
|
+ : height * (screenWidth / width),
|
|
|
+ ),
|
|
|
}
|
|
|
+ console.log('swiperStyle', swiperStyle.value)
|
|
|
}
|
|
|
const handleSend = async () => {
|
|
|
if (!reviewContent.value) {
|
|
@@ -132,8 +142,8 @@ onLoad(async (query: { id: string; isShared?: boolean }) => {
|
|
|
id.value = query.id
|
|
|
isShared.value = query.isShared
|
|
|
await run()
|
|
|
- await runGetReviews()
|
|
|
await setSwiperStyle()
|
|
|
+ await runGetReviews()
|
|
|
await setCircleUpvotes()
|
|
|
})
|
|
|
// onShareAppMessage(async () => {
|
|
@@ -176,12 +186,12 @@ onShareAppMessage(async ({ from, target }) => {
|
|
|
{{ data?.detailsDesc }}
|
|
|
</div> -->
|
|
|
<template v-if="data.circleType === '1'">
|
|
|
- <template v-if="swiperSizes && !isVideo">
|
|
|
+ <template v-if="!isVideo">
|
|
|
<div>
|
|
|
<swiper class="" :style="swiperStyle" @change="handleChange">
|
|
|
<template v-for="it of data?.bannerUrls" :key="it">
|
|
|
<swiper-item>
|
|
|
- <wd-img width="100%" :src="it" mode="widthFix"></wd-img>
|
|
|
+ <wd-img width="100%" height="100%" :src="it" mode="aspectFill"></wd-img>
|
|
|
</swiper-item>
|
|
|
</template>
|
|
|
</swiper>
|