|
@@ -34,19 +34,24 @@ import { getRect, addUnit } from 'wot-design-uni/components/common/util'
|
|
|
import Card from '@/components/card.vue'
|
|
|
import { get } from 'radash'
|
|
|
import { DictType } from '../../../core/libs/models'
|
|
|
+import MomentVideo from '@/pages/home/components/moment-video.vue'
|
|
|
+import { ComponentExposed } from 'vue-component-type-helpers'
|
|
|
+import { useShare } from '@/composables/share'
|
|
|
|
|
|
const { features, clickByPermission } = usePermissions()
|
|
|
+const { shareAppMessage } = useShare()
|
|
|
const userStore = useUserStore()
|
|
|
const { userInfo } = storeToRefs(userStore)
|
|
|
const router = useRouter()
|
|
|
const dictStore = useDictStore()
|
|
|
const { getOptionLabel } = dictStore
|
|
|
const id = ref()
|
|
|
-const currentImg = ref(0)
|
|
|
+const current = ref(0)
|
|
|
const isShared = ref(false)
|
|
|
-const commeentRef = ref<InstanceType<typeof WdInput>>()
|
|
|
+const commentRef = ref<InstanceType<typeof WdInput>>()
|
|
|
const commentItemRef = ref<InstanceType<typeof CommentItem>[]>()
|
|
|
const instance = getCurrentInstance()
|
|
|
+const momentVideoRef = ref<ComponentExposed<typeof MomentVideo>[]>()
|
|
|
|
|
|
const focus = ref(false)
|
|
|
const { data, run } = useRequest(() => getCircle(id.value), { initialData: {} })
|
|
@@ -62,24 +67,25 @@ const { data: circleUpvotes, run: setCircleUpvotes } = useRequest(
|
|
|
() => getCircleUpvotes(id.value),
|
|
|
{ initialData: { list: [], total: 0 } },
|
|
|
)
|
|
|
-const swiperSizes = ref()
|
|
|
const swiperStyle = ref()
|
|
|
const reviewContent = ref('')
|
|
|
-const isVideo = ref(false)
|
|
|
const reviewId = ref()
|
|
|
const refreshIndex = ref<number>()
|
|
|
-const handleChange = ({ detail: { current } }) => {
|
|
|
- // console.log(current)
|
|
|
- currentImg.value = current;
|
|
|
- // swiperStyle.value = {
|
|
|
- // height: swiperSizes.value[current].height + 'px',
|
|
|
- // }
|
|
|
+const isVideo = computed(
|
|
|
+ () => data.value?.bannerUrls?.length && isImageOrVideo(data.value.bannerUrls.at(0)) === 'video',
|
|
|
+)
|
|
|
+const handleChange = ({ detail }) => {
|
|
|
+ console.log('current', current.value, detail.current)
|
|
|
+ console.log(momentVideoRef.value)
|
|
|
+ if (isVideo.value) {
|
|
|
+ momentVideoRef.value[current.value]?.videoContext.pause()
|
|
|
+ }
|
|
|
+ current.value = detail.current
|
|
|
}
|
|
|
const setSwiperStyle = async () => {
|
|
|
if (!data.value.bannerUrls.length) return
|
|
|
const { screenWidth } = await uni.getSystemInfo()
|
|
|
- if (data.value.bannerUrls.length === 1 && isImageOrVideo(data.value.bannerUrls[0]) === 'video') {
|
|
|
- isVideo.value = true
|
|
|
+ if (isImageOrVideo(data.value.bannerUrls[0]) === 'video') {
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -90,17 +96,19 @@ const setSwiperStyle = async () => {
|
|
|
height:
|
|
|
height > width
|
|
|
? addUnit(500)
|
|
|
- : height === width?addUnit(screenWidth):addUnit(
|
|
|
- screenWidth / width > 1
|
|
|
- ? height / (screenWidth / width)
|
|
|
- : height * (screenWidth / width),
|
|
|
- ),
|
|
|
+ : height === width
|
|
|
+ ? addUnit(screenWidth)
|
|
|
+ : addUnit(
|
|
|
+ screenWidth / width > 1
|
|
|
+ ? height / (screenWidth / width)
|
|
|
+ : height * (screenWidth / width),
|
|
|
+ ),
|
|
|
}
|
|
|
console.log('swiperStyle', swiperStyle.value)
|
|
|
}
|
|
|
const handleSend = async () => {
|
|
|
if (!reviewContent.value) {
|
|
|
- uni.showToast({ title: '请输入评论内容', icon: 'none' })
|
|
|
+ await uni.showToast({ title: '请输入评论内容', icon: 'none' })
|
|
|
return
|
|
|
}
|
|
|
const { code, msg } = await createCircleReview({
|
|
@@ -111,13 +119,14 @@ const handleSend = async () => {
|
|
|
replayReviewId: reviewId.value,
|
|
|
})
|
|
|
if (code !== 0) {
|
|
|
- uni.showToast({ title: msg, icon: 'none' })
|
|
|
+ await uni.showToast({ title: msg, icon: 'none' })
|
|
|
} else {
|
|
|
reviewContent.value = ''
|
|
|
- uni.showToast({ title: '评论成功', icon: 'none' })
|
|
|
- if (refreshIndex.value) {
|
|
|
+ console.log('refreshIndex', refreshIndex.value)
|
|
|
+ await uni.showToast({ title: '评论成功', icon: 'none' })
|
|
|
+ if (refreshIndex.value !== undefined) {
|
|
|
console.log(instance.refs)
|
|
|
- commentItemRef.value.at(refreshIndex.value).refresh()
|
|
|
+ await commentItemRef.value.at(refreshIndex.value).refresh()
|
|
|
reviewId.value = undefined
|
|
|
refreshIndex.value = undefined
|
|
|
} else {
|
|
@@ -133,22 +142,29 @@ const handleReplay = async (options) => {
|
|
|
}
|
|
|
const handleDelete = async (index?: number) => {
|
|
|
if (index !== undefined) {
|
|
|
- commentItemRef.value.at(index).refresh()
|
|
|
+ await commentItemRef.value.at(index).refresh()
|
|
|
} else {
|
|
|
await runGetReviews()
|
|
|
}
|
|
|
}
|
|
|
const handleUpvote = async (index?: number) => {
|
|
|
if (index !== undefined) {
|
|
|
- commentItemRef.value.at(index).refresh()
|
|
|
+ await commentItemRef.value.at(index).refresh()
|
|
|
} else {
|
|
|
await run()
|
|
|
}
|
|
|
}
|
|
|
+const toDesignerHomepage = () => {
|
|
|
+ if (['1', '2'].includes(String(data.value?.circleType))) {
|
|
|
+ router.push(
|
|
|
+ `/pages/mine/homepage/index?id=${data.value?.stylistId}${isShared.value ? '&isShared=true' : ''}`,
|
|
|
+ )
|
|
|
+ }
|
|
|
+}
|
|
|
onMounted(async () => {})
|
|
|
-onLoad(async (query: { id: string; isShared?: boolean }) => {
|
|
|
- id.value = query.id
|
|
|
- isShared.value = query.isShared
|
|
|
+onLoad(async (query?: { id: string; isShared?: boolean }) => {
|
|
|
+ id.value = query?.id
|
|
|
+ isShared.value = query?.isShared
|
|
|
await run()
|
|
|
await setSwiperStyle()
|
|
|
await runGetReviews()
|
|
@@ -158,31 +174,13 @@ onLoad(async (query: { id: string; isShared?: boolean }) => {
|
|
|
// await shareCircle(id.value)
|
|
|
// return { title: data.value?.circleDesc }
|
|
|
// })
|
|
|
-onShareAppMessage(async ({ from, target }) => {
|
|
|
- console.log('from', from)
|
|
|
- console.log('target', target)
|
|
|
- // if (!features.value.shareMoment) {
|
|
|
- // return handleShareClick()
|
|
|
- // }
|
|
|
- const res: Page.CustomShareContent = {}
|
|
|
- await shareCircle(id.value)
|
|
|
- res.path = `/pages/home/moment/index?id=${id.value}&isShared=true`
|
|
|
- res.imageUrl = data.value?.bannerUrls[0]
|
|
|
- res.title = `${data.value?.stylistName}: ${data.value?.circleDesc}`
|
|
|
- return res
|
|
|
-})
|
|
|
+onShareAppMessage(shareAppMessage)
|
|
|
</script>
|
|
|
<template>
|
|
|
<view class="bg-white flex-grow">
|
|
|
<NavBarEvo placeholder :isShowBack="!isShared">
|
|
|
<template #prepend>
|
|
|
- <div
|
|
|
- class="flex items-center gap-2"
|
|
|
- @click="
|
|
|
- ['1', '2'].includes(data.circleType) &&
|
|
|
- router.push(`/pages/mine/homepage/index?id=${data.stylistId}`)
|
|
|
- "
|
|
|
- >
|
|
|
+ <div class="flex items-center gap-2" @click="toDesignerHomepage">
|
|
|
<wd-img width="24" height="24" round :src="data.headUrl"></wd-img>
|
|
|
<div class="text-black/90 text-sm font-normal font-['PingFang_SC'] leading-[10.18px]">
|
|
|
{{ data.stylistName || data.marketing }}
|
|
@@ -196,23 +194,58 @@ onShareAppMessage(async ({ from, target }) => {
|
|
|
<template v-if="data.circleType === '1'">
|
|
|
<template v-if="!isVideo">
|
|
|
<div class="pos-relative">
|
|
|
- <div class="currentImg">{{ currentImg + 1 }}/{{data?.bannerUrls.length}}</div>
|
|
|
- <swiper :current="currentImg" :style="swiperStyle" @change="handleChange" :indicator-dots="true">
|
|
|
+ <div class="currentImg">{{ current + 1 }}/{{ data?.bannerUrls.length }}</div>
|
|
|
+ <swiper
|
|
|
+ :current="current"
|
|
|
+ :style="swiperStyle"
|
|
|
+ @change="handleChange"
|
|
|
+ :indicator-dots="true"
|
|
|
+ >
|
|
|
<template v-for="it of data?.bannerUrls" :key="it">
|
|
|
<swiper-item>
|
|
|
- <wd-img width="100%" height="100%" :src="it" mode="aspectFill" :enable-preview="true"></wd-img>
|
|
|
+ <wd-img
|
|
|
+ width="100%"
|
|
|
+ height="100%"
|
|
|
+ :src="it"
|
|
|
+ mode="aspectFill"
|
|
|
+ :enable-preview="true"
|
|
|
+ ></wd-img>
|
|
|
</swiper-item>
|
|
|
</template>
|
|
|
</swiper>
|
|
|
</div>
|
|
|
</template>
|
|
|
<template v-if="isVideo">
|
|
|
- <video width="100%" class="w-full aspect-[1.64/1]" :src="data?.bannerUrls[0]"></video>
|
|
|
+ <div class="relative aspect-[1.64/1]">
|
|
|
+ <div class="currentImg">{{ current + 1 }}/{{ data?.bannerUrls.length }}</div>
|
|
|
+ <swiper @change="handleChange">
|
|
|
+ <template v-for="it of data?.bannerUrls" :key="it">
|
|
|
+ <swiper-item>
|
|
|
+ <!-- <video-->
|
|
|
+ <!-- ref="momentVideo"-->
|
|
|
+ <!-- width="100%"-->
|
|
|
+ <!-- class="w-full aspect-[1.64/1]"-->
|
|
|
+ <!-- :controls="'contimg'"-->
|
|
|
+ <!-- :loop="true"-->
|
|
|
+ <!-- :enable-progress-gesture="false"-->
|
|
|
+ <!-- :src="it"-->
|
|
|
+ <!-- ></video>-->
|
|
|
+ <MomentVideo
|
|
|
+ ref="momentVideoRef"
|
|
|
+ :src="it"
|
|
|
+ :enable-progress-gesture="false"
|
|
|
+ ></MomentVideo>
|
|
|
+ </swiper-item>
|
|
|
+ </template>
|
|
|
+ </swiper>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
</template>
|
|
|
<template v-if="data.circleType === '2'">
|
|
|
<div>
|
|
|
- <wd-img width="100%" mode="widthFix" :src="data.bannerUrls[0]"></wd-img>
|
|
|
+ <div class="aspect-[1.02/1]">
|
|
|
+ <wd-img width="100%" height="100%" mode="aspectFill" :src="data.bannerUrls[0]"></wd-img>
|
|
|
+ </div>
|
|
|
<div class="relative">
|
|
|
<div
|
|
|
class="absolute top-0 left-3.5 right-3.5 box-border h-full flex items-center justify-center"
|
|
@@ -287,8 +320,8 @@ onShareAppMessage(async ({ from, target }) => {
|
|
|
<view class="flex-1"></view>
|
|
|
<view><wd-icon class="text-black/65" name="arrow-right" size="22px"></wd-icon></view>
|
|
|
</view> -->
|
|
|
- <div class="h-0.25 bg-[#dadada] my-7"></div>
|
|
|
- <SectionHeading :title="`评论`" size="base">
|
|
|
+ <div v-if="!isShared" class="h-0.25 bg-[#dadada] my-7"></div>
|
|
|
+ <SectionHeading v-if="!isShared" :title="`评论`" size="base">
|
|
|
<template #append>
|
|
|
<view v-if="reviews?.list" class="flex">
|
|
|
<div class="text-black/90 text-xs font-normal font-['PingFang_SC'] leading-[10.18px]">
|
|
@@ -306,7 +339,7 @@ onShareAppMessage(async ({ from, target }) => {
|
|
|
</template>
|
|
|
</SectionHeading>
|
|
|
|
|
|
- <view clas="mt-8.25">
|
|
|
+ <view v-if="!isShared" clas="mt-8.25">
|
|
|
<template v-if="reviews?.list.length">
|
|
|
<template v-for="(it, i) in reviews?.list" :key="it.id">
|
|
|
<CommentItem
|
|
@@ -338,11 +371,11 @@ onShareAppMessage(async ({ from, target }) => {
|
|
|
</template>
|
|
|
</view>
|
|
|
</div>
|
|
|
- <BottomAppBar fixed placeholder border custom-class="">
|
|
|
+ <BottomAppBar v-if="!isShared" fixed placeholder border custom-class="">
|
|
|
<div class="bg-white flex items-center">
|
|
|
<div class="w-[168px] bg-[#f6f6f6] rounded-[60px] px-3.5 py-2 flex items-center">
|
|
|
<wd-input
|
|
|
- ref="commeentRef"
|
|
|
+ ref="commentRef"
|
|
|
custom-class="bg-transparent!"
|
|
|
no-border
|
|
|
confirm-type="send"
|
|
@@ -356,16 +389,44 @@ onShareAppMessage(async ({ from, target }) => {
|
|
|
</div>
|
|
|
<view class="flex justify-around flex-1">
|
|
|
<div>
|
|
|
- <button open-type="share" class="bg-transparent! p-0!">
|
|
|
+ <template v-if="features.shareMoment">
|
|
|
+ <button
|
|
|
+ open-type="share"
|
|
|
+ class="bg-transparent! p-0!"
|
|
|
+ :data-options="data"
|
|
|
+ @click.stop
|
|
|
+ >
|
|
|
+ <view
|
|
|
+ class="flex flex-col items-center text-[rgba(0,0,0,0.85)] text-3.5 font-400 line-height-5.5"
|
|
|
+ >
|
|
|
+ <div class="w-4.5 h-4.5 flex items-center justify-center">
|
|
|
+ <wd-img width="15" height="15" src="/static/svgs/share.svg"></wd-img>
|
|
|
+ </div>
|
|
|
+ <view class="">{{ data?.shareCount || 0 }}</view>
|
|
|
+ </view>
|
|
|
+ </button>
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ <!-- <view-->
|
|
|
+ <!-- @click.stop="clickByPermission('share', () => emits('share', options))"-->
|
|
|
+ <!-- class="flex items-center text-[rgba(0,0,0,0.85)] text-3.5 font-400 line-height-5.5"-->
|
|
|
+ <!-- >-->
|
|
|
+ <!-- <wd-img width="15" height="15" src="/static/svgs/share.svg"></wd-img>-->
|
|
|
+ <!-- <view class="ml-1">{{ props.options.shareCount }}</view>-->
|
|
|
+ <!-- </view>-->
|
|
|
<view
|
|
|
class="flex flex-col items-center text-[rgba(0,0,0,0.85)] text-3.5 font-400 line-height-5.5"
|
|
|
+ @click.stop="clickByPermission('share', () => run())"
|
|
|
>
|
|
|
<div class="w-4.5 h-4.5 flex items-center justify-center">
|
|
|
<wd-img width="15" height="15" src="/static/svgs/share.svg"></wd-img>
|
|
|
</div>
|
|
|
<view class="">{{ data?.shareCount || 0 }}</view>
|
|
|
</view>
|
|
|
- </button>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <!-- <button open-type="share" class="bg-transparent! p-0!">-->
|
|
|
+ <!-- </button>-->
|
|
|
</div>
|
|
|
<view
|
|
|
class="flex flex-col items-center text-[rgba(0,0,0,0.85)] text-3.5 font-400 line-height-5.5"
|
|
@@ -402,18 +463,23 @@ onShareAppMessage(async ({ from, target }) => {
|
|
|
</view>
|
|
|
</div>
|
|
|
</BottomAppBar>
|
|
|
+ <BottomAppBar v-if="isShared" fixed placeholder>
|
|
|
+ <div>
|
|
|
+ <wd-button block :round="false" @click="toDesignerHomepage">查看设计师主页</wd-button>
|
|
|
+ </div>
|
|
|
+ </BottomAppBar>
|
|
|
</view>
|
|
|
</template>
|
|
|
<style lang="scss" scope>
|
|
|
- .currentImg{
|
|
|
- position:absolute;
|
|
|
- z-index:2;
|
|
|
- color:#fff;
|
|
|
- background-color: rgba(0,0,0,.5);
|
|
|
- top:10rpx;
|
|
|
- right:10rpx;
|
|
|
- padding:4rpx 20rpx;
|
|
|
- font-size:24rpx;
|
|
|
- border-radius: 8rpx;
|
|
|
- }
|
|
|
-</style>
|
|
|
+.currentImg {
|
|
|
+ position: absolute;
|
|
|
+ z-index: 2;
|
|
|
+ color: #fff;
|
|
|
+ background-color: rgba(0, 0, 0, 0.5);
|
|
|
+ top: 10rpx;
|
|
|
+ right: 10rpx;
|
|
|
+ padding: 4rpx 20rpx;
|
|
|
+ font-size: 24rpx;
|
|
|
+ border-radius: 8rpx;
|
|
|
+}
|
|
|
+</style>
|