|
@@ -69,7 +69,8 @@
|
|
|
}"
|
|
|
round
|
|
|
@click="handleSwitchType('gallery')"
|
|
|
- ><img src="/img/icon_photo.png" />图片</n-button
|
|
|
+ >
|
|
|
+ <img src="/img/icon_photo.png" />图片</n-button
|
|
|
>
|
|
|
</n-space>
|
|
|
<div class="actions">
|
|
@@ -79,8 +80,11 @@
|
|
|
<img src="/img/reload.png" @click="reloadIframe" />
|
|
|
</div>
|
|
|
<div v-if="isGallery">
|
|
|
- <img src="/img/audio-muted.png" />
|
|
|
- <img src="/img/audio-unmuted.png" />
|
|
|
+ <img src="/img/audio-muted.png" @click="stop" />
|
|
|
+ <img
|
|
|
+ src="/img/audio-unmuted.png"
|
|
|
+ @click="!isPlaying ? play() : () => {}"
|
|
|
+ />
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -89,6 +93,7 @@
|
|
|
|
|
|
<script setup>
|
|
|
import { ref, computed } from "vue";
|
|
|
+import { useSound } from "@vueuse/sound";
|
|
|
|
|
|
const iframeRef = ref();
|
|
|
const type = ref("model");
|
|
@@ -98,10 +103,18 @@ const isModel = computed(() => type.value === "model");
|
|
|
const isVideo = computed(() => type.value === "video");
|
|
|
const isAudio = computed(() => type.value === "audio");
|
|
|
const isGallery = computed(() => type.value === "gallery");
|
|
|
+const { play, isPlaying, stop } = useSound(
|
|
|
+ "//samplelib.com/lib/preview/mp3/sample-15s.mp3"
|
|
|
+);
|
|
|
|
|
|
const handleSwitchType = (value) => {
|
|
|
if (defaultType.value.includes(value)) {
|
|
|
type.value = value;
|
|
|
+ if (value === "gallery") {
|
|
|
+ play();
|
|
|
+ } else {
|
|
|
+ stop();
|
|
|
+ }
|
|
|
} else {
|
|
|
type.value = "model";
|
|
|
}
|
|
@@ -132,20 +145,21 @@ const props = defineProps({
|
|
|
|
|
|
const reloadIframe = () => {
|
|
|
if (iframeRef.value) {
|
|
|
- iframeRef.value.reload();
|
|
|
- // console.log()
|
|
|
+ try {
|
|
|
+ iframeRef.value.src += "";
|
|
|
+ } catch (error) {}
|
|
|
}
|
|
|
};
|
|
|
</script>
|
|
|
|
|
|
<style>
|
|
|
.show-case-container {
|
|
|
- --show-case-width: 1069px;
|
|
|
- --show-case-height: 547px;
|
|
|
- --show-case-border-radius: 10px;
|
|
|
+ --show-case-width: 66.8125rem;
|
|
|
+ --show-case-height: 34.1875rem;
|
|
|
+ --show-case-border-radius: 0.625rem;
|
|
|
--show-case-background: #c1b2b2;
|
|
|
- --show-case-tools-padding: 16px;
|
|
|
- --show-case-btn-font-size: 18px;
|
|
|
+ --show-case-tools-padding: 1rem;
|
|
|
+ --show-case-btn-font-size: 1.125rem;
|
|
|
--show-case-btn-model-bg: url("/img/show_case_m_bg.png");
|
|
|
--show-case-btn-model-bg-active: url("/img/show_case_m_bg_active.png");
|
|
|
--show-case-btn-video-bg: url("/img/show_case_v_bg.png");
|
|
@@ -196,7 +210,7 @@ const reloadIframe = () => {
|
|
|
height: 3.8125rem;
|
|
|
pointer-events: all;
|
|
|
cursor: pointer;
|
|
|
- margin: 0 20px;
|
|
|
+ margin: 0 1.25rem;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -206,7 +220,7 @@ const reloadIframe = () => {
|
|
|
display: inline-flex;
|
|
|
position: absolute;
|
|
|
height: 2.25rem;
|
|
|
- bottom: 20px;
|
|
|
+ bottom: 1.25rem;
|
|
|
flex-direction: row;
|
|
|
justify-content: space-between;
|
|
|
align-items: center;
|
|
@@ -217,9 +231,9 @@ const reloadIframe = () => {
|
|
|
display: inline-flex;
|
|
|
align-items: center;
|
|
|
img {
|
|
|
- height: 40px;
|
|
|
+ height: 2.5rem;
|
|
|
width: auto;
|
|
|
- margin: 0 5px;
|
|
|
+ margin: 0 0.3125rem;
|
|
|
cursor: pointer;
|
|
|
pointer-events: all;
|
|
|
}
|
|
@@ -230,10 +244,10 @@ const reloadIframe = () => {
|
|
|
color: white;
|
|
|
pointer-events: all;
|
|
|
font-size: var(--show-case-btn-font-size);
|
|
|
- padding: 0.625rem 2.5rem;
|
|
|
+ padding: 10px 40px;
|
|
|
img {
|
|
|
- height: 20px;
|
|
|
- margin-right: 8px;
|
|
|
+ height: 1.25rem;
|
|
|
+ margin-right: 0.5rem;
|
|
|
width: auto;
|
|
|
}
|
|
|
&.btn {
|