1. 加工费模块重构
Some checks failed
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Lint (ubuntu-latest) (push) Has been cancelled
CI / Lint (windows-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CI / CI OK (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
Deploy Website on push / Deploy Push Playground Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Docs Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Antd Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Element Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Naive Ftp (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
Close stale issues / stale (push) Has been cancelled
Lock Threads / action (push) Has been cancelled
Issue Close Require / close-issues (push) Has been cancelled
Some checks failed
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Lint (ubuntu-latest) (push) Has been cancelled
CI / Lint (windows-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CI / CI OK (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
Deploy Website on push / Deploy Push Playground Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Docs Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Antd Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Element Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Naive Ftp (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
Close stale issues / stale (push) Has been cancelled
Lock Threads / action (push) Has been cancelled
Issue Close Require / close-issues (push) Has been cancelled
2. 快递费模块重构 3. 订单导出功能优化 4. 商品订单的折扣功能 5. 修复了一些已知BUG
This commit is contained in:
133
apps/web-antd/src/components/video-player/XgVideoPlayer.vue
Normal file
133
apps/web-antd/src/components/video-player/XgVideoPlayer.vue
Normal file
@@ -0,0 +1,133 @@
|
||||
<script setup lang="ts">
|
||||
import { onBeforeUnmount, onMounted, ref, shallowRef, watch } from 'vue';
|
||||
|
||||
import Player from 'xgplayer';
|
||||
|
||||
import 'xgplayer/dist/index.min.css';
|
||||
|
||||
interface Props {
|
||||
src: string;
|
||||
autoplay?: boolean;
|
||||
controls?: boolean;
|
||||
thumbnail?: boolean;
|
||||
width?: number | string;
|
||||
height?: number | string;
|
||||
poster?: string;
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
autoplay: false,
|
||||
controls: true,
|
||||
thumbnail: false,
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
poster: undefined,
|
||||
});
|
||||
|
||||
const emit = defineEmits<{
|
||||
ready: [player: Player];
|
||||
error: [error: any];
|
||||
ended: [];
|
||||
}>();
|
||||
|
||||
const containerRef = ref<HTMLDivElement>();
|
||||
const player = shallowRef<Player | null>(null);
|
||||
|
||||
function createPlayer() {
|
||||
if (!containerRef.value || !props.src) return;
|
||||
|
||||
player.value?.destroy();
|
||||
player.value = null;
|
||||
|
||||
const ignores = props.thumbnail
|
||||
? [
|
||||
'cssfullscreen',
|
||||
'screenshot',
|
||||
'pip',
|
||||
'miniscreen',
|
||||
'keyboard',
|
||||
'download',
|
||||
'playbackrate',
|
||||
'time',
|
||||
'definition',
|
||||
'fullscreen',
|
||||
'loading',
|
||||
'mobile',
|
||||
'pc',
|
||||
'play',
|
||||
'poster',
|
||||
'progress',
|
||||
'replay',
|
||||
'start',
|
||||
'volume',
|
||||
]
|
||||
: [];
|
||||
|
||||
const p = new Player({
|
||||
el: containerRef.value,
|
||||
url: props.src,
|
||||
autoplay: props.autoplay,
|
||||
controls: props.thumbnail ? false : props.controls,
|
||||
closeVideoClick: props.thumbnail,
|
||||
closeVideoDblclick: props.thumbnail,
|
||||
ignores,
|
||||
fluid: true,
|
||||
fitVideoSize: 'fixWidth',
|
||||
videoInit: true,
|
||||
poster: props.poster,
|
||||
playsinline: true,
|
||||
enableContextmenu: !props.thumbnail,
|
||||
});
|
||||
|
||||
p.on('ready', () => {
|
||||
emit('ready', p);
|
||||
});
|
||||
|
||||
p.on('error', (e: any) => {
|
||||
emit('error', e);
|
||||
});
|
||||
|
||||
p.on('ended', () => {
|
||||
emit('ended');
|
||||
});
|
||||
|
||||
player.value = p;
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
createPlayer();
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
player.value?.destroy();
|
||||
player.value = null;
|
||||
});
|
||||
|
||||
watch(
|
||||
() => props.src,
|
||||
() => {
|
||||
createPlayer();
|
||||
},
|
||||
);
|
||||
|
||||
defineExpose({
|
||||
getPlayer: () => player.value,
|
||||
play: () => player.value?.play(),
|
||||
pause: () => player.value?.pause(),
|
||||
destroy: () => {
|
||||
player.value?.destroy();
|
||||
player.value = null;
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div ref="containerRef" class="xg-video-player"></div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.xg-video-player {
|
||||
width: v-bind(width);
|
||||
height: v-bind(height);
|
||||
}
|
||||
</style>
|
||||
1
apps/web-antd/src/components/video-player/index.ts
Normal file
1
apps/web-antd/src/components/video-player/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export { default as XgVideoPlayer } from './XgVideoPlayer.vue';
|
||||
Reference in New Issue
Block a user