140 lines
4.3 KiB
JavaScript
140 lines
4.3 KiB
JavaScript
import { defineComponent, ref, computed, watch, nextTick, useSSRContext } from 'vue';
|
|
import { ssrRenderComponent } from 'vue/server-renderer';
|
|
import { u as useRouter$1, a as useConfigStore, b as useUserStore, _ as __nuxt_component_0 } from './server.mjs';
|
|
import WaveSurfer from 'wavesurfer.js';
|
|
import { _ as _export_sfc } from './_plugin-vue_export-helper-1tPrXgE0.mjs';
|
|
import '../nitro/nitro.mjs';
|
|
import 'node:http';
|
|
import 'node:https';
|
|
import 'node:events';
|
|
import 'node:buffer';
|
|
import 'node:fs';
|
|
import 'node:path';
|
|
import 'node:crypto';
|
|
import 'node:url';
|
|
import 'consola';
|
|
import 'fast-xml-parser';
|
|
import 'ipx';
|
|
import 'pinia';
|
|
import '@supabase/supabase-js';
|
|
import 'axios';
|
|
import 'lodash-es';
|
|
import '@babel/runtime/helpers/esm/extends';
|
|
import '@babel/runtime/helpers/esm/objectSpread2';
|
|
import '@ant-design/colors';
|
|
import '@ctrl/tinycolor';
|
|
import 'stylis';
|
|
import 'vue-types';
|
|
import '@ant-design/icons-vue';
|
|
import 'unhead/utils';
|
|
|
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
__name: "index",
|
|
__ssrInlineRender: true,
|
|
setup(__props) {
|
|
useRouter$1();
|
|
const config = useConfigStore();
|
|
const userStore = useUserStore();
|
|
ref("");
|
|
ref(null);
|
|
ref(null);
|
|
const selectedFile = ref(null);
|
|
const filePreviewUrl = ref("");
|
|
ref(void 0);
|
|
const waveformContainer = ref(null);
|
|
const wavesurfer = ref(null);
|
|
const isWaveformPlaying = ref(false);
|
|
const waveformCurrentTime = ref(0);
|
|
ref(false);
|
|
ref(null);
|
|
ref([]);
|
|
ref(0);
|
|
ref(null);
|
|
const audioDuration = ref(0);
|
|
ref(null);
|
|
computed(() => config.sellerConfig?.store?.main && userStore.user.id !== config.sellerConfig?.store?.id);
|
|
ref(false);
|
|
ref(false);
|
|
ref(void 0);
|
|
const isAudioFile = (file) => {
|
|
return file.type.startsWith("audio/");
|
|
};
|
|
const initWaveform = async (audioSource) => {
|
|
if (!waveformContainer.value) return;
|
|
if (wavesurfer.value) {
|
|
wavesurfer.value.destroy();
|
|
wavesurfer.value = null;
|
|
}
|
|
const url = URL.createObjectURL(audioSource);
|
|
const ws = WaveSurfer.create({
|
|
container: waveformContainer.value,
|
|
height: 50,
|
|
normalize: true,
|
|
waveColor: "#94a3b8",
|
|
progressColor: "#2563eb",
|
|
cursorColor: "#ef4444",
|
|
barWidth: 3,
|
|
barGap: 2,
|
|
barRadius: 4,
|
|
interact: true,
|
|
dragToSeek: true,
|
|
fillParent: true,
|
|
autoCenter: true
|
|
});
|
|
ws.load(url);
|
|
ws.on("ready", () => {
|
|
audioDuration.value = ws.getDuration();
|
|
});
|
|
ws.on("timeupdate", (time) => {
|
|
waveformCurrentTime.value = time;
|
|
});
|
|
ws.on("play", () => {
|
|
isWaveformPlaying.value = true;
|
|
});
|
|
ws.on("pause", () => {
|
|
isWaveformPlaying.value = false;
|
|
});
|
|
ws.on("finish", () => {
|
|
isWaveformPlaying.value = false;
|
|
waveformCurrentTime.value = 0;
|
|
});
|
|
wavesurfer.value = ws;
|
|
};
|
|
watch(selectedFile, async (newFile) => {
|
|
if (newFile && isAudioFile(newFile) && filePreviewUrl.value) {
|
|
await nextTick();
|
|
const audioBlob = await fetch(filePreviewUrl.value).then((r) => r.blob());
|
|
await initWaveform(audioBlob);
|
|
}
|
|
});
|
|
return (_ctx, _push, _parent, _attrs) => {
|
|
const _component_client_only = __nuxt_component_0;
|
|
_push(ssrRenderComponent(_component_client_only, _attrs, {}, _parent));
|
|
};
|
|
}
|
|
});
|
|
const _sfc_setup$1 = _sfc_main$1.setup;
|
|
_sfc_main$1.setup = (props, ctx) => {
|
|
const ssrContext = useSSRContext();
|
|
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("views/base/pages/direct/detail/index.vue");
|
|
return _sfc_setup$1 ? _sfc_setup$1(props, ctx) : void 0;
|
|
};
|
|
const Index = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-39d83653"]]);
|
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
__name: "detail_message",
|
|
__ssrInlineRender: true,
|
|
setup(__props) {
|
|
return (_ctx, _push, _parent, _attrs) => {
|
|
_push(ssrRenderComponent(Index, _attrs, null, _parent));
|
|
};
|
|
}
|
|
});
|
|
const _sfc_setup = _sfc_main.setup;
|
|
_sfc_main.setup = (props, ctx) => {
|
|
const ssrContext = useSSRContext();
|
|
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("pages/message/detail_message.vue");
|
|
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
|
|
};
|
|
|
|
export { _sfc_main as default };
|