Commit c5de000f authored by lipengcheng 's avatar lipengcheng

x

parent 396049ae
......@@ -11,7 +11,7 @@ charset = utf-8
indent_style = space
#缩进数量可选整数值2 or 4,或者tab
indent_size = 2
indent_size = 4
#换行符的格式 换行符,lf、cr和crlf
end_of_line = lf
......@@ -23,4 +23,4 @@ insert_final_newline = true
trim_trailing_whitespace = true
[*.scss]
indent_size = 2
indent_size = 4
module.exports = {
root: true,
env: {
node: true
},
// 1: ESLint with error prevention only
// extends: ['plugin:vue/essential', 'eslint:recommended'],
// 2: ESLint + Airbnb config
// extends: ['plugin:vue/essential', '@vue/airbnb',],
// 3: ESLint + Standard config
// extends: [ 'plugin:vue/essential', '@vue/airbnb',],
// ESLint + Prettier
extends: ['plugin:vue/recommended', 'eslint:recommended'],
plugins: [],
parserOptions: {
parser: 'babel-eslint'
},
globals: {
axios: false, //全局使用axios
__PROJECTPATH__: false,
__GATEWAYPATH__: false
},
/**add your custom rules here
* 下面这些rules是用来设置从插件来的规范代码的规则,使用必须去掉前缀eslint-plugin-
* 主要有如下的设置规则,可以设置字符串也可以设置数字,两者效果一致
* "off" 或 0 - 关闭规则
* "warn" 或 1 - 开启规则,使用警告级别的错误:warn (不会导致程序退出)
* "error" 或 2 - 开启规则,使用错误级别的错误:error (当被触发的时候,程序会退出)
*/
rules: {
// 是否开启prettier校验,默认开启.可选 warn / error / off
// "prettier/prettier": "warn",
// "no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
'no-console': [0, { llow: ['warn', 'error'] }],
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
indent: [
'error',
2,
{
SwitchCase: 1,
flatTernaryExpressions: true
}
],
'comma-dangle': ['error', 'never'],
quotes: ['error', 'single'],
semi: ['error', 'always'],
'vue/html-indent': [
'error',
2,
{
attribute: 1,
baseIndent: 1,
closeBracket: 0,
alignAttributesVertically: true,
ignores: []
}
],
'vue/html-self-closing': [
'error',
{
html: {
void: 'never',
normal: 'never',
component: 'never'
},
svg: 'never',
math: 'always'
}
]
}
root: true,
env: {
node: true
},
// 1: ESLint with error prevention only
// extends: ['plugin:vue/essential', 'eslint:recommended'],
// 2: ESLint + Airbnb config
// extends: ['plugin:vue/essential', '@vue/airbnb',],
// 3: ESLint + Standard config
// extends: [ 'plugin:vue/essential', '@vue/airbnb',],
// ESLint + Prettier
extends: ['plugin:vue/recommended', 'eslint:recommended', '@vue/prettier'],
plugins: [],
parserOptions: {
parser: 'babel-eslint'
},
/**add your custom rules here
* 下面这些rules是用来设置从插件来的规范代码的规则,使用必须去掉前缀eslint-plugin-
* 主要有如下的设置规则,可以设置字符串也可以设置数字,两者效果一致
* "off" 或 0 - 关闭规则
* "warn" 或 1 - 开启规则,使用警告级别的错误:warn (不会导致程序退出)
* "error" 或 2 - 开启规则,使用错误级别的错误:error (当被触发的时候,程序会退出)
*/
rules: {
// 是否开启prettier校验,默认开启.可选 warn / error / off
// "prettier/prettier": "warn",
// "no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
'no-console': [0, { llow: ['warn', 'error'] }],
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off'
// indent: [
// 'error',
// 2,
// {
// SwitchCase: 1,
// flatTernaryExpressions: true
// }
// ],
// 'comma-dangle': ['error', 'never'],
// quotes: ['error', 'single'],
// semi: ['error', 'always'],
// 'vue/html-indent': [
// 'error',
// 2,
// {
// attribute: 1,
// baseIndent: 1,
// closeBracket: 0,
// alignAttributesVertically: true,
// ignores: []
// }
// ],
// 'vue/html-self-closing': [
// 'error',
// {
// html: {
// void: 'never',
// normal: 'never',
// component: 'never'
// },
// svg: 'never',
// math: 'always'
// }
// ]
}
}
module.exports = {
// 不使用prettier格式化的文件填写在项目的.prettierignore文件中
ignorePath: ".prettierignore",
// ignorePath: ".prettierignore",
// 与eslint集成(让prettier使用eslint的代码格式进行校验)
eslintIntegration: true,
// eslintIntegration: true,
// 换行长度
printWidth: 150,
// tab缩进大小,默认为2
tabWidth: 2,
tabWidth: 4,
// 使用tab缩进,默认false
useTabs: false,
// 是否使用分号, 默认true
......@@ -35,7 +35,7 @@ module.exports = {
// always 总是有括号
arrowParens: 'always',
// 结尾是 \n \r \n\r auto
endOfline: "auto",
endOfLine: "auto",
// 在jsx中把'>' 是否单独放一行
jsxBracketSameLine: false,
}
......
......@@ -3,17 +3,17 @@ console.log('process.env:', process.env)
console.log('process.env.NODE_ENV:', process.env.NODE_ENV)
//
switch (process.env.NODE_ENV) {
case 'development':
baseUrl = 'http://localhost:3000/development' //开发环境url
break
case 'development':
baseUrl = 'http://localhost:3000/development' //开发环境url
break
case 'passports': // 注意这里的名字要和步骤二中设置的环境名字对应起来
baseUrl = 'http://localhost:3000/passports' //测试环境中的url
break
case 'passports': // 注意这里的名字要和步骤二中设置的环境名字对应起来
baseUrl = 'http://localhost:3000/passports' //测试环境中的url
break
case 'production':
baseUrl = 'http://106.13.94.82:3000/production' //生产环境url
break
case 'production':
baseUrl = 'http://106.13.94.82:3000/production' //生产环境url
break
}
export default baseUrl
<template>
<div id="app">
<common-header></common-header>
<body class="body-container">
<side-nav></side-nav>
<router-view style="flex:1;border: 1px solid #666;"></router-view>
<right-panel></right-panel>
</body>
<modal-layer></modal-layer>
<uploader></uploader>
</div>
<div id="app">
<common-header></common-header>
<body class="body-container">
<side-nav></side-nav>
<router-view style="flex:1;border: 1px solid #666;"></router-view>
<right-panel></right-panel>
</body>
<modal-layer></modal-layer>
<uploader></uploader>
</div>
</template>
<script>
import CommonHeader from '@/components/header/index.vue';
import CommonHeader from '@/components/header/index.vue'
export default {
components: {
CommonHeader,
SideNav: () => import('@/components/sideNav/index.vue'),
RightPanel: () => import('@/components/rightPanel/index.vue'),
ModalLayer: () => import('@/components/modal/modalLayer.vue'),
Uploader: () => import('@/components/misc/uploader.vue')
},
data() {
return {};
},
async created() {
let result = await this.$http.get('/webapi/home/banner?type=1&category=18');
console.log('result:', result);
}
};
components: {
CommonHeader,
SideNav: () => import('@/components/sideNav/index.vue'),
RightPanel: () => import('@/components/rightPanel/index.vue'),
ModalLayer: () => import('@/components/modal/modalLayer.vue'),
Uploader: () => import('@/components/misc/uploader.vue')
},
data() {
return {}
},
async created() {
let result = await this.$http.get('/webapi/home/banner?type=1&category=18')
console.log('result:', result)
}
}
</script>
<style lang="scss">
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
display: flex;
flex-direction: column;
height: 100vh;
position: relative;
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
display: flex;
flex-direction: column;
height: 100vh;
position: relative;
}
.body-container {
flex: 1;
display: flex;
justify-content: space-between;
overflow: hidden;
flex: 1;
display: flex;
justify-content: space-between;
overflow: hidden;
}
</style>
<template>
<div class="comp-commonheader">
<h1>LAIHUA</h1>
<div class="current-page">
当前的宝
<div class="comp-commonheader">
<h1>LAIHUA</h1>
<div class="current-page">
当前的宝
</div>
<tip-panel></tip-panel>
<div class="show-modal" @click="showModal">
show-modal
</div>
</div>
<tip-panel></tip-panel>
<div
class="show-modal"
@click="showModal"
>
show-modal
</div>
</div>
</template>
<script>
export default {
components: {
tipPanel: () => import('@/components/header/tipPanel.vue')
},
data() {
return {};
},
created() {},
mounted() {},
methods: {
showModal() {
this.$modal.show('selectModal');
components: {
tipPanel: () => import('@/components/header/tipPanel.vue')
},
data() {
return {}
},
created() {},
mounted() {},
methods: {
showModal() {
this.$modal.show('selectModal')
}
}
}
};
}
</script>
<style scoped lang="scss">
/* @import url(); 引入css类 */
.comp-commonheader {
width: 100%;
height: 100px;
border: 1px solid pink;
display: flex;
align-items: center;
justify-content: flex-start;
width: 100%;
height: 100px;
border: 1px solid pink;
display: flex;
align-items: center;
justify-content: flex-start;
}
</style>
<template>
<div class="comp-header-tippanel">
怎么操作?
</div>
<div class="comp-header-tippanel">
怎么操作?
</div>
</template>
<script>
export default {
data() {
return {};
},
created() {},
mounted() {}
};
data() {
return {}
},
created() {},
mounted() {}
}
</script>
<style scoped lang="scss">
......
<template>
<div></div>
<div></div>
</template>
<script>
export default {
data() {
return {};
},
methods: {}
};
data() {
return {}
},
methods: {}
}
</script>
<style lang="scss" scoped></style>
<template>
<div>
<input
id="video-input"
ref="videoInput"
type="file"
accept="video/mp4, video/NMP4"
@change="onVideoInputChange"
@click="onInputClick"
>
</div>
<div>
<input id="video-input" ref="videoInput" type="file" accept="video/mp4, video/NMP4" @change="onVideoInputChange" @click="onInputClick" />
</div>
</template>
<script>
import { mapActions } from 'vuex';
import { mapActions } from 'vuex'
export default {
data() {
return {
videoInput: {}
};
},
mounted() {
this.videoInput = this.$refs.videoInput;
},
methods: {
...mapActions({
upload: 'uploader/upload'
}),
onVideoInputChange() {
let file = this.videoInput.files[0];
console.log('turbo: onVideoInputChange -> file', file);
data() {
return {
videoInput: {}
}
},
onInputClick() {
const vm = this;
window.addEventListener('focus', function h() {
vm.clearInputValue(vm.videoInput);
console.log('turbo: h -> this.videoInput', vm.videoInput);
window.removeEventListener('focus', h);
});
mounted() {
this.videoInput = this.$refs.videoInput
},
clearInputValue(el) {
if (el) {
el.value = '';
}
methods: {
...mapActions({
upload: 'uploader/upload'
}),
onVideoInputChange() {
let file = this.videoInput.files[0]
console.log('turbo: onVideoInputChange -> file', file)
},
onInputClick() {
const vm = this
window.addEventListener('focus', function h() {
vm.clearInputValue(vm.videoInput)
console.log('turbo: h -> this.videoInput', vm.videoInput)
window.removeEventListener('focus', h)
})
},
clearInputValue(el) {
if (el) {
el.value = ''
}
}
}
}
};
}
</script>
<style lang="scss" scoped></style>
<template>
<div>
complete content
</div>
<div>
complete content
</div>
</template>
<script>
export default {
data() {
return {};
},
methods: {}
};
data() {
return {}
},
methods: {}
}
</script>
<style lang="scss" scoped></style>
<template>
<modal
name="completeModal"
:click-to-close="false"
>
<complete-content></complete-content>
</modal>
<modal name="completeModal" :click-to-close="false">
<complete-content></complete-content>
</modal>
</template>
<script>
import CompleteContent from './completeContent';
import CompleteContent from './completeContent'
export default {
components: {
CompleteContent
},
data() {
return {};
},
methods: {}
};
components: {
CompleteContent
},
data() {
return {}
},
methods: {}
}
</script>
<style lang="scss" scoped></style>
<template>
<div class="modal-layer">
<complete-modal></complete-modal>
<select-modal></select-modal>
</div>
<div class="modal-layer">
<complete-modal></complete-modal>
<select-modal></select-modal>
</div>
</template>
<script>
import CompleteModal from '@/components/modal/completeModal';
import SelectModal from '@/components/modal/selectModal';
import CompleteModal from '@/components/modal/completeModal'
import SelectModal from '@/components/modal/selectModal'
export default {
components: {
CompleteModal,
SelectModal
},
data() {
return {};
},
methods: {}
};
components: {
CompleteModal,
SelectModal
},
data() {
return {}
},
methods: {}
}
</script>
<style lang="scss" scoped>
.modal-layer {
position: absolute;
left: 0;
top: 0;
width: 0;
height: 0;
position: absolute;
left: 0;
top: 0;
width: 0;
height: 0;
}
</style>
<template>
<div>
<div
class="close-btn"
@click="close"
>
close
<div>
<div class="close-btn" @click="close">
close
</div>
<div>选择视频</div>
<ul>
<li v-for="(item, i) in items" :key="i" class="item" @click="itemClick({ item, index: i })">
{{ item.text }}
</li>
</ul>
</div>
<div>选择视频</div>
<ul>
<li
v-for="(item, i) in items"
:key="i"
class="item"
@click="itemClick({ item, index: i })"
>
{{ item.text }}
</li>
</ul>
</div>
</template>
<script>
export default {
data() {
return {
items: [{ text: '本地上传', type: 'upload' }, { text: '视频库' }, { text: '我的作品' }]
};
},
methods: {
close() {
this.$modal.hide('selectModal');
data() {
return {
items: [{ text: '本地上传', type: 'upload' }, { text: '视频库' }, { text: '我的作品' }]
}
},
triggerUpload() {
const el = document.getElementById('video-input');
el && el.click();
},
itemClick({ item = {} } = {}) {
if (item.type === 'upload') {
this.triggerUpload();
}
methods: {
close() {
this.$modal.hide('selectModal')
},
triggerUpload() {
const el = document.getElementById('video-input')
el && el.click()
},
itemClick({ item = {} } = {}) {
if (item.type === 'upload') {
this.triggerUpload()
}
}
}
}
};
}
</script>
<style lang="scss" scoped></style>
<template>
<modal
name="selectModal"
:click-to-close="false"
>
<select-content></select-content>
</modal>
<modal name="selectModal" :click-to-close="false">
<select-content></select-content>
</modal>
</template>
<script>
import SelectContent from './selectContent';
import SelectContent from './selectContent'
export default {
components: {
SelectContent
},
data() {
return {};
},
methods: {}
};
components: {
SelectContent
},
data() {
return {}
},
methods: {}
}
</script>
<style lang="scss" scoped></style>
<template>
<div class="comp-rightpanel">
<router-view name="panel"></router-view>
</div>
<div class="comp-rightpanel">
<router-view name="panel"></router-view>
</div>
</template>
<script>
export default {
data() {
return {};
},
created() {},
mounted() {}
};
data() {
return {}
},
created() {},
mounted() {}
}
</script>
<style scoped lang="scss">
/* @import url(); 引入css类 */
.comp-rightpanel {
width: 150px;
height: 100%;
border: 1px solid skyblue;
width: 150px;
height: 100%;
border: 1px solid skyblue;
}
</style>
<template>
<div>
screenshotPanel
</div>
<div>
screenshotPanel
</div>
</template>
<script>
export default {
data() {
return {};
},
created() {},
mounted() {}
};
data() {
return {}
},
created() {},
mounted() {}
}
</script>
<style></style>
<template>
<div class="comp-sidenav">
<router-link to="/">
Home
</router-link>
<router-link to="/about">
About
</router-link>
<router-link to="/cutter">
cutter
</router-link>
<router-link to="/videoConverter">
转换宝
</router-link>
<router-link to="/screenshot">
screenshot
</router-link>
</div>
<div class="comp-sidenav">
<router-link to="/">
Home
</router-link>
<router-link to="/about">
About
</router-link>
<router-link to="/cutter">
cutter
</router-link>
<router-link to="/videoConverter">
转换宝
</router-link>
<router-link to="/screenshot">
screenshot
</router-link>
</div>
</template>
<script>
export default {
data() {
return {};
},
created() {},
mounted() {}
};
data() {
return {}
},
created() {},
mounted() {}
}
</script>
<style scoped lang="scss">
/* @import url(); 引入css类 */
.comp-sidenav {
padding: 30px;
// width: 100px;
border: 1px solid skyblue;
height: 100%;
// display: flex;
padding: 30px;
// width: 100px;
border: 1px solid skyblue;
height: 100%;
// display: flex;
a {
font-weight: bold;
color: #2c3e50;
display: inline-block;
width: 100%;
padding: 10px 0;
a {
font-weight: bold;
color: #2c3e50;
display: inline-block;
width: 100%;
padding: 10px 0;
&.router-link-exact-active {
color: #42b983;
&.router-link-exact-active {
color: #42b983;
}
}
}
}
</style>
<template>
<div class="taskComplete"></div>
<div class="taskComplete"></div>
</template>
<script>
export default {
name: 'TaskComplete',
components: {},
props: {},
data() {
return {};
},
computed: {},
watch: {},
methods: {}
};
name: 'TaskComplete',
components: {},
props: {},
data() {
return {}
},
computed: {},
watch: {},
methods: {}
}
</script>
<style scoped lang="scss">
.taskComplete {
width: 100%;
height: 100%;
background-color: #fff;
border: 0px solid black;
margin: 0px;
width: 100%;
height: 100%;
background-color: #fff;
border: 0px solid black;
margin: 0px;
}
</style>
<template>
<div class="taskEdit">
<ul>
<li
v-for="(item, index) in taskList"
:key="index"
>
<div class="info">
<div class="cove">
视频封面
</div>
<div>
<div>{{ item.name }}.mp4</div>
<div>时长:{{ item.duration }}</div>
</div>
</div>
<div class="operationPanel">
<div
v-show="item.state == 0"
class="wait"
>
<div>输出格式</div>
<div class="selectionFormat">
mp4
</div>
<div
class="delete"
@click="clearTask(item)"
>
删除
<div class="taskEdit">
<ul>
<li v-for="(item, index) in taskList" :key="index">
<div class="info">
<div class="cove">
视频封面
</div>
<div>
<div>{{ item.name }}.mp4</div>
<div>时长:{{ item.duration }}</div>
</div>
</div>
<div class="operationPanel">
<div v-show="item.state == 0" class="wait">
<div>输出格式</div>
<div class="selectionFormat">
mp4
</div>
<div class="delete" @click="clearTask(item)">
删除
</div>
</div>
<div v-show="item.state == 1" class="active">
<div class="progress">
<div>转换中{{ item.progress }}%</div>
<div class="slide">
<div></div>
</div>
</div>
<div class="stop" @click="stopTask(item)">
取消
</div>
</div>
</div>
</li>
</ul>
<div class="editBar">
<div class="addVideo" @click="addVideo">
添加视频
</div>
</div>
<div
v-show="item.state == 1"
class="active"
>
<div class="progress">
<div>转换中{{ item.progress }}%</div>
<div class="slide">
<div></div>
</div>
<div class="clearList" @click="clearAllTasks">
清空列表
</div>
<div
class="stop"
@click="stopTask(item)"
>
取消
<div class="clearWatermark">
去除水印
</div>
</div>
</div>
</li>
</ul>
<div class="editBar">
<div
class="addVideo"
@click="addVideo"
>
添加视频
</div>
<div
class="clearList"
@click="clearAllTasks"
>
清空列表
</div>
<div class="clearWatermark">
去除水印
</div>
</div>
<div
class="startAll"
@click="startAllTasks"
>
开始转换
<div class="startAll" @click="startAllTasks">
开始转换
</div>
</div>
</div>
</template>
<script>
import { start, stop, clear, checkStatus } from './webApi';
import { start, stop, clear, checkStatus } from './webApi'
export default {
name: 'TaskEdit',
components: {},
props: {},
data() {
return {
taskList: []
};
},
computed: {},
watch: {},
created() {
for (let i = 1; i < 10; i++) {
this.taskList.push({
cover: '',
name: '视频片段' + i,
duration: '10:00',
state: 0,
progress: 60,
outputFormat: 'mp4'
});
}
},
methods: {
async startTask(item) {
let result = await start();
if (result) {
item.state = 1;
} else {
item.state = 2;
}
},
async stopTask(item) {
let result = await stop();
if (result) {
item.state = 0;
}
},
async clearTask(item) {
let result = await clear();
if (result) {
let index = this.taskList.indexOf(item);
if (index > -1) {
this.taskList.splice(index, 1);
name: 'TaskEdit',
components: {},
props: {},
data() {
return {
taskList: []
}
}
},
async checkTaskStatus() {
await checkStatus();
},
addVideo() {
this.taskList.push({
cover: '',
name: '视频片段' + (this.taskList.length + 1),
duration: '10:00',
state: 0,
progress: 60,
outputFormat: 'mp4'
});
},
clearAllTasks() {
this.taskList = [];
computed: {},
watch: {},
created() {
for (let i = 1; i < 10; i++) {
this.taskList.push({
cover: '',
name: '视频片段' + i,
duration: '10:00',
state: 0,
progress: 60,
outputFormat: 'mp4'
})
}
},
startAllTasks() {
this.taskList.forEach((task) => {
task.state = 1;
});
methods: {
async startTask(item) {
let result = await start()
if (result) {
item.state = 1
} else {
item.state = 2
}
},
async stopTask(item) {
let result = await stop()
if (result) {
item.state = 0
}
},
async clearTask(item) {
let result = await clear()
if (result) {
let index = this.taskList.indexOf(item)
if (index > -1) {
this.taskList.splice(index, 1)
}
}
},
async checkTaskStatus() {
await checkStatus()
},
addVideo() {
this.taskList.push({
cover: '',
name: '视频片段' + (this.taskList.length + 1),
duration: '10:00',
state: 0,
progress: 60,
outputFormat: 'mp4'
})
},
clearAllTasks() {
this.taskList = []
},
startAllTasks() {
this.taskList.forEach((task) => {
task.state = 1
})
}
}
}
};
}
</script>
<style scoped lang="scss">
.taskEdit {
width: 100%;
height: 100%;
background-color: #fff;
border: 0px solid black;
margin: 0px;
padding: 0 20px;
display: flex;
flex-direction: column;
align-items: center;
cursor: default;
overflow: hidden;
> ul {
width: 100%;
height: 100%;
border: 1px solid black;
flex-grow: 1;
overflow-y: auto;
> li {
padding: 5px 0;
height: 60px;
display: flex;
justify-content: space-between;
align-items: center;
}
> li:nth-of-type(odd) {
background-color: gainsboro;
}
.info {
display: flex;
align-items: center;
.cove {
width: 100px;
height: 40px;
background-color: #ccc;
line-height: 40px;
margin-right: 10px;
}
}
.operationPanel {
width: 300px;
height: 100%;
.wait {
background-color: #fff;
border: 0px solid black;
margin: 0px;
padding: 0 20px;
display: flex;
flex-direction: column;
align-items: center;
cursor: default;
overflow: hidden;
> ul {
width: 100%;
height: 100%;
display: flex;
align-items: center;
.selectionFormat {
height: 30px;
width: 100px;
line-height: 30px;
border: 1px solid black;
margin-left: 20px;
border: 1px solid black;
flex-grow: 1;
overflow-y: auto;
> li {
padding: 5px 0;
height: 60px;
display: flex;
justify-content: space-between;
align-items: center;
}
.delete {
width: 60px;
height: 30px;
line-height: 30px;
background-color: black;
color: #fff;
margin-left: 20px;
> li:nth-of-type(odd) {
background-color: gainsboro;
}
}
.active {
height: 100%;
width: 300px;
display: flex;
align-items: center;
.progress {
.info {
display: flex;
align-items: center;
.cove {
width: 100px;
height: 40px;
background-color: #ccc;
line-height: 40px;
margin-right: 10px;
}
}
.slide {
width: 200px;
height: 5px;
background: gray;
> div {
width: 120px;
.operationPanel {
width: 300px;
height: 100%;
background-color: black;
}
}
.stop {
width: 60px;
height: 30px;
line-height: 30px;
background-color: black;
color: #fff;
margin-left: 20px;
.wait {
height: 100%;
display: flex;
align-items: center;
.selectionFormat {
height: 30px;
width: 100px;
line-height: 30px;
border: 1px solid black;
margin-left: 20px;
}
.delete {
width: 60px;
height: 30px;
line-height: 30px;
background-color: black;
color: #fff;
margin-left: 20px;
}
}
.active {
height: 100%;
width: 300px;
display: flex;
align-items: center;
.progress {
}
.slide {
width: 200px;
height: 5px;
background: gray;
> div {
width: 120px;
height: 100%;
background-color: black;
}
}
.stop {
width: 60px;
height: 30px;
line-height: 30px;
background-color: black;
color: #fff;
margin-left: 20px;
}
}
}
}
}
}
.editBar {
position: relative;
height: 30px;
width: 100%;
margin: 20px 0;
.editBar {
position: relative;
height: 30px;
width: 100%;
margin: 20px 0;
.addVideo {
position: absolute;
left: 0;
height: 30px;
line-height: 30px;
border: 1px solid black;
}
.clearList {
position: absolute;
left: 100px;
height: 30px;
line-height: 30px;
border: 1px solid black;
.addVideo {
position: absolute;
left: 0;
height: 30px;
line-height: 30px;
border: 1px solid black;
}
.clearList {
position: absolute;
left: 100px;
height: 30px;
line-height: 30px;
border: 1px solid black;
}
.clearWatermark {
position: absolute;
right: 0;
height: 30px;
line-height: 30px;
border: 1px solid black;
}
}
.clearWatermark {
position: absolute;
right: 0;
height: 30px;
line-height: 30px;
border: 1px solid black;
.startAll {
height: 30px;
width: 100px;
background-color: black;
color: #fff;
line-height: 30px;
}
}
.startAll {
height: 30px;
width: 100px;
background-color: black;
color: #fff;
line-height: 30px;
}
}
</style>
async function start() {
let result = await new Promise((resolve) => {
setTimeout(() => {
resolve(true);
}, 1000);
});
return result;
let result = await new Promise((resolve) => {
setTimeout(() => {
resolve(true)
}, 1000)
})
return result
}
async function stop() {
let result = await new Promise((resolve) => {
setTimeout(() => {
resolve(true);
}, 500);
});
return result;
let result = await new Promise((resolve) => {
setTimeout(() => {
resolve(true)
}, 500)
})
return result
}
async function clear() {
let result = await new Promise((resolve) => {
setTimeout(() => {
resolve(true);
}, 500);
});
return result;
let result = await new Promise((resolve) => {
setTimeout(() => {
resolve(true)
}, 500)
})
return result
}
async function checkStatus(fakeValue) {
let result = await new Promise((resolve) => {
setTimeout(() => {
resolve(fakeValue++);
}, 500);
});
return result;
let result = await new Promise((resolve) => {
setTimeout(() => {
resolve(fakeValue++)
}, 500)
})
return result
}
export { start, stop, clear, checkStatus };
export { start, stop, clear, checkStatus }
<template>
<div
class="video-change"
@click="changeVideo"
>
替换视频
</div>
<div class="video-change" @click="changeVideo">
替换视频
</div>
</template>
<script>
export default {
methods: {
changeVideo() {
this.$emit('changeVideo');
methods: {
changeVideo() {
this.$emit('changeVideo')
}
}
}
};
}
</script>
<style lang="scss" scoped>
.video-change {
width: 100px;
height: 30px;
line-height: 30px;
text-align: center;
border: 1px solid #dddddd;
border-radius: 4px;
user-select: none;
cursor: pointer;
width: 100px;
height: 30px;
line-height: 30px;
text-align: center;
border: 1px solid #dddddd;
border-radius: 4px;
user-select: none;
cursor: pointer;
}
</style>
<template>
<div class="video-control">
<div
class="video-play-btn"
@click="play()"
>
播放
<div class="video-control">
<div class="video-play-btn" @click="play()">
播放
</div>
<div class="video-time-content">
<div class="now-time">
{{ nowTime | formatTime }}
</div>
<span>/</span>
<div class="total-time">
{{ duration | formatTime }}
</div>
</div>
</div>
<div class="video-time-content">
<div class="now-time">
{{ nowTime | formatTime }}
</div>
<span>/</span>
<div class="total-time">
{{ duration | formatTime }}
</div>
</div>
</div>
</template>
<script>
export default {
filters: {
formatTime(duration) {
if (duration <= 0) return '00:00';
if (!duration) return '--:--';
let min = ~~(duration / 60);
min = (min + '').length === 1 ? '0' + min : min;
let sec = Math.floor(duration % 60);
sec = (sec + '').length === 1 ? '0' + sec : sec;
min = min || '00';
sec = sec || '00';
return min + ':' + sec;
}
},
props: ['duration', 'nowTime'], // eslint-disable-line
data() {
return {};
},
methods: {
play() {
this.$emit('play');
filters: {
formatTime(duration) {
if (duration <= 0) return '00:00'
if (!duration) return '--:--'
let min = ~~(duration / 60)
min = (min + '').length === 1 ? '0' + min : min
let sec = Math.floor(duration % 60)
sec = (sec + '').length === 1 ? '0' + sec : sec
min = min || '00'
sec = sec || '00'
return min + ':' + sec
}
},
props: ['duration', 'nowTime'], // eslint-disable-line
data() {
return {}
},
methods: {
play() {
this.$emit('play')
}
}
}
};
}
</script>
<style lang="scss" scoped>
.video-control {
display: flex;
justify-content: flex-start;
align-self: center;
width: 200px;
user-select: none;
display: flex;
justify-content: flex-start;
align-self: center;
width: 200px;
user-select: none;
}
.video-play-btn {
border: 1px solid #dddddd;
width: 30px;
height: 30px;
border-radius: 100%;
margin-right: 10px;
cursor: pointer;
border: 1px solid #dddddd;
width: 30px;
height: 30px;
border-radius: 100%;
margin-right: 10px;
cursor: pointer;
}
.video-time-content {
display: flex;
display: flex;
> div,
span {
line-height: 30px;
color: #474261;
}
> div,
span {
line-height: 30px;
color: #474261;
}
}
</style>
<template>
<div class="video-player">
<video
ref="videoDom"
src="https://resources.laihua.com/2020-7-27/547adf9b-73b0-4b14-bed6-6ee278a1b2b2.mp4"
></video>
</div>
<div class="video-player">
<video ref="videoDom" src="https://resources.laihua.com/2020-7-27/547adf9b-73b0-4b14-bed6-6ee278a1b2b2.mp4"></video>
</div>
</template>
<script>
export default {
data() {
return {
state: 'pluse',
times: 0,
canPlay: false
};
},
mounted() {
this.$bus.on('videoPlayer.play', (data) => {
if (data.time !== undefined) {
this.currentTime(data.time);
}
if (data.play) {
this.play();
} else {
this.pause();
}
});
this.$nextTick(() => {
this.$refs.videoDom.addEventListener('canplay', this.canPlayFunc);
this.$refs.videoDom.addEventListener('ended', () => {
this.$emit('ended');
});
this.$refs.videoDom.addEventListener('timeupdate', () => {
this.$emit('timeupdate', this.$refs.videoDom.currentTime);
});
});
},
beforeDestroy() {
this.$refs.videoDom.removeEventListener('canplay');
this.$refs.videoDom.removeEventListener('ended');
this.$refs.videoDom.removeEventListener('timeupdate');
},
methods: {
canPlayFunc() {
this.canPlay = true;
let from = this.$parent.$options.name || 'videoPlayer';
this.$bus.emit(`${from}.canPlay`, this.$refs.videoDom.duration);
data() {
return {
state: 'pluse',
times: 0,
canPlay: false
}
},
play() {
if (!this.canPlay) return;
this.$refs.videoDom.play();
mounted() {
this.$bus.on('videoPlayer.play', (data) => {
if (data.time !== undefined) {
this.currentTime(data.time)
}
if (data.play) {
this.play()
} else {
this.pause()
}
})
this.$nextTick(() => {
this.$refs.videoDom.addEventListener('canplay', this.canPlayFunc)
this.$refs.videoDom.addEventListener('ended', () => {
this.$emit('ended')
})
this.$refs.videoDom.addEventListener('timeupdate', () => {
this.$emit('timeupdate', this.$refs.videoDom.currentTime)
})
})
},
pause() {
if (!this.canPlay) return;
this.$refs.videoDom.pause();
beforeDestroy() {
this.$refs.videoDom.removeEventListener('canplay')
this.$refs.videoDom.removeEventListener('ended')
this.$refs.videoDom.removeEventListener('timeupdate')
},
currentTime(time) {
if (!this.canPlay) return;
this.$refs.videoDom.currentTime = time;
methods: {
canPlayFunc() {
this.canPlay = true
let from = this.$parent.$options.name || 'videoPlayer'
this.$bus.emit(`${from}.canPlay`, this.$refs.videoDom.duration)
},
play() {
if (!this.canPlay) return
this.$refs.videoDom.play()
},
pause() {
if (!this.canPlay) return
this.$refs.videoDom.pause()
},
currentTime(time) {
if (!this.canPlay) return
this.$refs.videoDom.currentTime = time
}
}
}
};
}
</script>
<style lang="scss" scoped>
.video-player {
display: flex;
justify-content: space-around;
align-items: center;
width: 100%;
height: 100%;
background-color: beige;
display: flex;
justify-content: space-around;
align-items: center;
width: 100%;
height: 100%;
background-color: beige;
video {
max-width: 100%;
max-height: 100%;
}
video {
max-width: 100%;
max-height: 100%;
}
}
</style>
<template>
<div class="video-timeline">
<div
ref="sliderWidth"
v-drag
class="time-slider"
>
<div class="time-slider-rail"></div>
<div
class="time-slider-track"
:style="{ width: ((info.val - info.min) / info.max) * 100 + '%' }"
></div>
<div
data-action="handle"
class="time-slider-handle"
:style="{ left: ((info.val - info.min) / info.max) * 100 + '%' }"
></div>
<div class="video-timeline">
<div ref="sliderWidth" v-drag class="time-slider">
<div class="time-slider-rail"></div>
<div class="time-slider-track" :style="{ width: ((info.val - info.min) / info.max) * 100 + '%' }"></div>
<div data-action="handle" class="time-slider-handle" :style="{ left: ((info.val - info.min) / info.max) * 100 + '%' }"></div>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'VideoTimeline',
directives: {
drag(el, binding, vnode) {
let _this = vnode.context,
mousemove = null,
mouseup = null,
dataAction = '';
name: 'VideoTimeline',
directives: {
drag(el, binding, vnode) {
let _this = vnode.context,
mousemove = null,
mouseup = null,
dataAction = ''
mousemove = (e) => {
_this.dragMove && _this.dragMove(e.pageX, dataAction, e);
};
mousemove = (e) => {
_this.dragMove && _this.dragMove(e.pageX, dataAction, e)
}
mouseup = (e) => {
document.removeEventListener('mousemove', mousemove);
document.removeEventListener('mouseup', mouseup);
mouseup = (e) => {
document.removeEventListener('mousemove', mousemove)
document.removeEventListener('mouseup', mouseup)
_this.dragUp && _this.dragUp(e.pageX, dataAction, e);
};
_this.dragUp && _this.dragUp(e.pageX, dataAction, e)
}
el.onmousedown = (e) => {
dataAction = e.target.dataset.action;
el.onmousedown = (e) => {
dataAction = e.target.dataset.action
if (e.which === 3 || e.which === 2) {
e.stopPropagation();
return;
}
if (e.which === 3 || e.which === 2) {
e.stopPropagation()
return
}
document.addEventListener('mousemove', mousemove);
document.addEventListener('mouseup', mouseup);
document.addEventListener('mousemove', mousemove)
document.addEventListener('mouseup', mouseup)
_this.dragDown && _this.dragDown(e.pageX, dataAction, e);
};
}
},
props: {
info: {
type: Object,
required: true,
default: function() {
return { step: 0.1, min: 0, max: 10, val: 0, cut: [0, 10] };
}
}
},
data() {
return {
width: 100
};
},
methods: {
dragDown(dis, action) {
if (!action) return;
this.width = this.$refs.sliderWidth.clientWidth;
this.action = action;
this.dragHand = true;
this.mpos = {
x: dis,
v: this.info.val
};
this.$emit('changeData', { val: this.mpos.v, action: action, type: 'start' });
_this.dragDown && _this.dragDown(e.pageX, dataAction, e)
}
}
},
dragMove(pos) {
if (!this.action) return;
let val = 0;
console.log(pos, '<_-------------');
// let pre = Math.round(((pos.x - this.mpos.x) / 120 * this.item.len + this.mpos.v) / this.item.step) / (1 / this.item.step);
// this.item.val = pre > this.item.max ? this.item.max : pre < this.item.min ? this.item.min : pre;
this.$emit('changeData', { val: val, action: this.action, type: 'change' });
props: {
info: {
type: Object,
required: true,
default: function() {
return { step: 0.1, min: 0, max: 10, val: 0, cut: [0, 10] }
}
}
},
data() {
return {
width: 100
}
},
dragUp() {
if (!this.action) return;
let val = 0;
this.mpos = null;
this.dragHand = false;
this.action = '';
this.$emit('changeData', { val: val, action: this.action, type: 'end' });
methods: {
dragDown(dis, action) {
if (!action) return
this.width = this.$refs.sliderWidth.clientWidth
this.action = action
this.dragHand = true
this.mpos = {
x: dis,
v: this.info.val
}
this.$emit('changeData', { val: this.mpos.v, action: action, type: 'start' })
},
dragMove(pos) {
if (!this.action) return
let val = 0
console.log(pos, '<_-------------')
// let pre = Math.round(((pos.x - this.mpos.x) / 120 * this.item.len + this.mpos.v) / this.item.step) / (1 / this.item.step);
// this.item.val = pre > this.item.max ? this.item.max : pre < this.item.min ? this.item.min : pre;
this.$emit('changeData', { val: val, action: this.action, type: 'change' })
},
dragUp() {
if (!this.action) return
let val = 0
this.mpos = null
this.dragHand = false
this.action = ''
this.$emit('changeData', { val: val, action: this.action, type: 'end' })
}
}
}
};
}
</script>
<style lang="scss" scoped>
.video-timeline {
width: 100%;
height: 50px;
background-color: beige;
width: 100%;
height: 50px;
background-color: beige;
}
.time-slider {
position: relative;
height: 15px;
padding: 5px 0;
width: 100%;
margin-right: 1px;
-ms-touch-action: none;
touch-action: none;
-webkit-box-sizing: border-box;
box-sizing: border-box;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
* {
position: relative;
height: 15px;
padding: 5px 0;
width: 100%;
margin-right: 1px;
-ms-touch-action: none;
touch-action: none;
-webkit-box-sizing: border-box;
box-sizing: border-box;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
* {
-webkit-box-sizing: border-box;
box-sizing: border-box;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
.time-slider-rail {
position: absolute;
width: 100%;
background-color: #d9ddea;
height: 4px;
border-radius: 3px;
}
.time-slider-rail {
position: absolute;
width: 100%;
background-color: #d9ddea;
height: 4px;
border-radius: 3px;
}
.time-slider-track {
position: absolute;
background-color: #737596;
border-radius: 3px;
height: 4px;
left: 0%;
width: 69.1515%;
}
.time-slider-track {
position: absolute;
background-color: #737596;
border-radius: 3px;
height: 4px;
left: 0%;
width: 69.1515%;
}
.time-slider-handle {
position: absolute;
margin-left: -6px;
margin-top: -4px;
left: 69.1515%;
width: 12px;
height: 12px;
background-color: #737596;
cursor: -webkit-grab;
cursor: grab;
border-radius: 50%;
-ms-touch-action: pan-x;
touch-action: pan-x;
}
.time-slider-handle {
position: absolute;
margin-left: -6px;
margin-top: -4px;
left: 69.1515%;
width: 12px;
height: 12px;
background-color: #737596;
cursor: -webkit-grab;
cursor: grab;
border-radius: 50%;
-ms-touch-action: pan-x;
touch-action: pan-x;
}
}
</style>
import Vue from 'vue';
import App from './App.vue';
import router from './router';
import store from './store';
import './registerServiceWorker';
import './assets/style/index.scss';
import axios from 'axios';
import VueBus from 'vue-bus';
import VModal from 'vue-js-modal';
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import './registerServiceWorker'
import './assets/style/index.scss'
import axios from 'axios'
import VueBus from 'vue-bus'
import VModal from 'vue-js-modal'
Vue.use(VueBus);
Vue.use(VModal);
Vue.use(VueBus)
Vue.use(VModal)
import baseURL from '../config/baseUrl.js';
console.log('baseURL:', baseURL);
import baseURL from '../config/baseUrl.js'
console.log('baseURL:', baseURL)
Vue.config.productionTip = false;
Vue.prototype.$http = axios;
Vue.config.productionTip = false
Vue.prototype.$http = axios
new Vue({
router,
store,
render: (h) => h(App)
}).$mount('#app');
router,
store,
render: (h) => h(App)
}).$mount('#app')
/* eslint-disable no-console */
import { register } from 'register-service-worker';
import { register } from 'register-service-worker'
if (process.env.NODE_ENV === 'production') {
register(`${process.env.BASE_URL}service-worker.js`, {
ready() {
console.log('App is being served from cache by a service worker.\n' + 'For more details, visit https://goo.gl/AFskqB');
},
registered() {
console.log('Service worker has been registered.');
},
cached() {
console.log('Content has been cached for offline use.');
},
updatefound() {
console.log('New content is downloading.');
},
updated() {
console.log('New content is available; please refresh.');
},
offline() {
console.log('No internet connection found. App is running in offline mode.');
},
error(error) {
console.error('Error during service worker registration:', error);
}
});
register(`${process.env.BASE_URL}service-worker.js`, {
ready() {
console.log('App is being served from cache by a service worker.\n' + 'For more details, visit https://goo.gl/AFskqB')
},
registered() {
console.log('Service worker has been registered.')
},
cached() {
console.log('Content has been cached for offline use.')
},
updatefound() {
console.log('New content is downloading.')
},
updated() {
console.log('New content is available; please refresh.')
},
offline() {
console.log('No internet connection found. App is running in offline mode.')
},
error(error) {
console.error('Error during service worker registration:', error)
}
})
}
import Vue from 'vue';
import VueRouter from 'vue-router';
import Bao3 from '../views/bao3.vue';
import Screenshot from '../views/screenshot.vue';
import screenshotPanel from '../components/rightPanel/screenshotPanel.vue';
import Vue from 'vue'
import VueRouter from 'vue-router'
import Bao3 from '../views/bao3.vue'
import Screenshot from '../views/screenshot.vue'
import screenshotPanel from '../components/rightPanel/screenshotPanel.vue'
Vue.use(VueRouter);
Vue.use(VueRouter)
const routes = [
{
path: '/',
name: 'Bao3',
component: Bao3
},
{
path: '/about',
name: 'About',
// route level code-splitting
// this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
},
{
path: '/cutter',
name: 'Cutter',
component: () => import(/* webpackChunkName: "bao1" */ '../views/videoCutter.vue')
},
{
path: '/videoConverter',
name: 'VideoConverter',
component: () => import(/* webpackChunkName: "bao2" */ '../views/videoConverter.vue')
},
{
path: '/screenshot',
components: {
default: Screenshot,
panel: screenshotPanel
{
path: '/',
name: 'Bao3',
component: Bao3
},
{
path: '/about',
name: 'About',
// route level code-splitting
// this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
},
{
path: '/cutter',
name: 'Cutter',
component: () => import(/* webpackChunkName: "bao1" */ '../views/videoCutter.vue')
},
{
path: '/videoConverter',
name: 'VideoConverter',
component: () => import(/* webpackChunkName: "bao2" */ '../views/videoConverter.vue')
},
{
path: '/screenshot',
components: {
default: Screenshot,
panel: screenshotPanel
}
}
}
];
]
const router = new VueRouter({
mode: 'history',
base: process.env.BASE_URL,
routes
});
mode: 'history',
base: process.env.BASE_URL,
routes
})
export default router;
export default router
......@@ -2,20 +2,20 @@
// getter调用示例:this.$store.getters['test']
const state = {
_test: 1
};
_test: 1
}
const getters = {
test: (state) => state._test
};
test: (state) => state._test
}
const mutations = {};
const mutations = {}
const actions = {};
const actions = {}
export default {
state,
getters,
mutations,
actions
};
state,
getters,
mutations,
actions
}
import Vue from 'vue';
import Vuex from 'vuex';
import Vue from 'vue'
import Vuex from 'vuex'
import global from './global';
import moduleA from './modules/moduleA';
import uploader from './modules/uploader';
import global from './global'
import moduleA from './modules/moduleA'
import uploader from './modules/uploader'
Vue.use(Vuex);
Vue.use(Vuex)
export default new Vuex.Store({
...global,
modules: {
moduleA,
uploader
}
});
...global,
modules: {
moduleA,
uploader
}
})
......@@ -2,21 +2,21 @@
// getter调用示例:this.$store.getters['moduleA/moduleState']
const state = {
_moduleState: 'moduleState'
};
_moduleState: 'moduleState'
}
const getters = {
moduleState: (state) => state._moduleState
};
moduleState: (state) => state._moduleState
}
const mutations = {};
const mutations = {}
const actions = {};
const actions = {}
export default {
namespaced: true,
state,
getters,
mutations,
actions
};
namespaced: true,
state,
getters,
mutations,
actions
}
......@@ -2,26 +2,26 @@
// getter调用示例:this.$store.getters['moduleA/moduleState']
const state = {
video: {}
};
video: {}
}
const getters = {
video: (state) => state.video
};
video: (state) => state.video
}
const mutations = {};
const mutations = {}
const actions = {
async upload(store, payload) {
console.log('turbo: upload -> store, payload', store, payload);
},
async storeMaterial() {}
};
async upload(store, payload) {
console.log('turbo: upload -> store, payload', store, payload)
},
async storeMaterial() {}
}
export default {
namespaced: true,
state,
getters,
mutations,
actions
};
namespaced: true,
state,
getters,
mutations,
actions
}
<template>
<div class="page-test">
test
</div>
</template>
<script>
export default {
data() {
return {}
}
}
</script>
<style scoped lang="scss">
/* @import url(); 引入css类 */
</style>
<template>
<div class="about">
<h1>This is an about page</h1>
</div>
<div class="about">
<h1>This is an about page</h1>
</div>
</template>
<template>
<div class="comp-bao2">
bao2
</div>
<div class="comp-bao2">
bao2
</div>
</template>
<script>
export default {
data() {
return {};
},
created() {},
mounted() {}
};
data() {
return {}
},
created() {},
mounted() {}
}
</script>
<style scoped lang="scss">
......
<template>
<div class="comp-bao2">
bao3
<!-- <img src="../assets/logo.png" alt=""> -->
</div>
<div class="comp-bao2">
bao3
<!-- <img src="../assets/logo.png" alt=""> -->
</div>
</template>
<script>
export default {
data() {
return {};
},
created() {},
mounted() {}
};
data() {
return {}
},
created() {},
mounted() {}
}
</script>
<style scoped lang="scss">
......
<template>
<div class="screenshot">
<div class="content">
<video
id="screenshot-video"
width="400"
height="300"
:src="srcUrl"
controls
></video>
</div>
<div class="operate-area">
<div class="play-area">
<input
id="screenshot-input"
type="file"
style="display:none;"
@change="changeFile"
>
<label id="select-btn">
<span>选择文件</span>
</label>
</div>
<div class="time-area">
<div id="ss-time-line">
<div class="track"></div>
<div class="screenshot">
<div class="content">
<video id="screenshot-video" width="400" height="300" :src="srcUrl" controls></video>
</div>
<div class="operate-area">
<div class="play-area">
<input id="screenshot-input" type="file" style="display:none;" @change="changeFile" />
<label id="select-btn">
<span>选择文件</span>
</label>
</div>
<div class="time-area">
<div id="ss-time-line">
<div class="track"></div>
</div>
</div>
<div class="clip-area"></div>
</div>
</div>
<div class="clip-area"></div>
</div>
</div>
</template>
<script>
export default {
name: 'Screenshot',
data() {
return {
srcUrl: null,
videoEle: null,
current: 0,
duration: 10
};
},
created() {},
mounted() {
let input = document.getElementById('screenshot-input');
let fileBtn = document.getElementById('select-btn');
fileBtn.addEventListener('click', function() {
input.click();
});
let video = document.getElementById('screenshot-video');
video.onerror = function(e) {
console.log('onerror', e);
};
video.addEventListener('loadedmetadata', function(e) {
console.log('loadedmetadata', e);
//webkitVideoDecodedByteCount
if (e.target.webkitVideoDecodedByteCount < 1) {
console.error('格式不支持');
}
});
name: 'Screenshot',
data() {
return {
srcUrl: null,
videoEle: null,
current: 0,
duration: 10
}
},
created() {},
mounted() {
let input = document.getElementById('screenshot-input')
let fileBtn = document.getElementById('select-btn')
fileBtn.addEventListener('click', function() {
input.click()
})
let video = document.getElementById('screenshot-video')
video.onerror = function(e) {
console.log('onerror', e)
}
video.addEventListener('loadedmetadata', function(e) {
console.log('loadedmetadata', e)
//webkitVideoDecodedByteCount
if (e.target.webkitVideoDecodedByteCount < 1) {
console.error('格式不支持')
}
})
//loadedmetadata
},
methods: {
changeFile(e) {
//console.log('changeFile', e)
if (e.target.files[0]) {
this.srcUrl = URL.createObjectURL(e.target.files[0]);
}
//loadedmetadata
},
methods: {
changeFile(e) {
//console.log('changeFile', e)
if (e.target.files[0]) {
this.srcUrl = URL.createObjectURL(e.target.files[0])
}
}
}
}
};
}
</script>
<style lang="scss" scoped>
.screenshot {
position: relative;
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
.content {
position: relative;
width: 100%;
height: 100%;
margin: 20px 30px;
background-color: lightcyan;
}
.operate-area {
background-color: aqua;
height: 200px;
display: flex;
flex-shrink: 0;
#select-btn {
background-color: bisque;
width: 100px;
height: 30px;
line-height: 30px;
flex-direction: column;
.content {
height: 100%;
margin: 20px 30px;
background-color: lightcyan;
}
.operate-area {
background-color: aqua;
height: 200px;
display: flex;
flex-shrink: 0;
#select-btn {
background-color: bisque;
width: 100px;
height: 30px;
line-height: 30px;
}
}
}
}
</style>
<template>
<div class="videoConverter">
<taskEdit></taskEdit>
</div>
<div class="videoConverter">
<taskEdit></taskEdit>
</div>
</template>
<script>
import taskEdit from '@/components/videoConverter/taskEdit';
import taskEdit from '@/components/videoConverter/taskEdit'
export default {
name: 'VideoConverter',
components: { taskEdit },
props: {},
data() {
return {};
},
computed: {},
watch: {},
created() {},
methods: {}
};
name: 'VideoConverter',
components: { taskEdit },
props: {},
data() {
return {}
},
computed: {},
watch: {},
created() {},
methods: {}
}
</script>
<style scoped lang="scss">
.videoConverter {
width: 100%;
height: 800px;
background-color: #fff;
border: 0px solid black;
margin: 0px;
width: 100%;
height: 800px;
background-color: #fff;
border: 0px solid black;
margin: 0px;
}
</style>
<template>
<div class="video-cutter">
<div class="video-content">
<videoPlayer
@currentTime="changeTime"
@end="playEnd"
@timeupdate="timeupdate"
></videoPlayer>
<div class="video-cutter">
<div class="video-content">
<videoPlayer @currentTime="changeTime" @end="playEnd" @timeupdate="timeupdate"></videoPlayer>
</div>
<div class="video-btn">
<videoChange @changeVideo="changeVideo"></videoChange>
<videoControl :duration="duration" :now-time="nowTime" @play="videoPlay"></videoControl>
<div class="video-water">
<input id="cutterRemoveWater" v-model="noWater" type="checkbox" />
<label for="cutterRemoveWater">去除ddf 水印</label>
</div>
</div>
<div class="timeline-content">
<videoTimeline :info="timelineObj"></videoTimeline>
</div>
<div></div>
</div>
<div class="video-btn">
<videoChange @changeVideo="changeVideo"></videoChange>
<videoControl
:duration="duration"
:now-time="nowTime"
@play="videoPlay"
></videoControl>
<div class="video-water">
<input
id="cutterRemoveWater"
v-model="noWater"
type="checkbox"
>
<label for="cutterRemoveWater">去除水印</label>
</div>
</div>
<div class="timeline-content">
<videoTimeline :info="timelineObj"></videoTimeline>
</div>
<div></div>
</div>
</template>
<script>
export default {
name: 'VideoCutter',
components: {
VideoPlayer: () => import('@/components/videoCutter/videoPlayer.vue'),
VideoChange: () => import('@/components/videoCutter/videoChange.vue'),
VideoControl: () => import('@/components/videoCutter/videoControl.vue'),
VideoTimeline: () => import('@/components/videoCutter/videoTimeline.vue')
},
data() {
return {
name: '',
nowTime: 0,
duration: 0,
playing: false,
canPlay: false,
noWater: true,
timelineObj: { step: 0.1, min: 0, max: 10, val: 0 }
};
},
created() {},
mounted() {
this.$bus.on('VideoCutter.canPlay', this.canPlayFunc);
},
methods: {
changeVideo() {
console.log('todo change video, <-----lilei');
name: 'VideoCutter',
components: {
VideoPlayer: () => import('@/components/videoCutter/videoPlayer.vue'),
VideoChange: () => import('@/components/videoCutter/videoChange.vue'),
VideoControl: () => import('@/components/videoCutter/videoControl.vue'),
VideoTimeline: () => import('@/components/videoCutter/videoTimeline.vue')
},
canPlayFunc(data) {
this.duration = data;
this.timelineObj.max = this.duration;
this.canPlay = true;
},
videoPlay() {
if (!this.canPlay) return;
let ob = {};
if (this.playing) {
ob.play = false;
} else {
ob.play = true;
if (this.nowTime >= this.duration) {
ob.time = 0;
this.timelineObj.val = 0;
data() {
return {
name: '',
nowTime: 0,
duration: 0,
playing: false,
canPlay: false,
noWater: true,
timelineObj: { step: 0.1, min: 0, max: 10, val: 0 }
}
}
this.playing = !this.playing;
this.$bus.emit('videoPlayer.play', ob);
},
changeTime(data) {
console.log(data);
},
playEnd() {
this.playing = false;
this.nowTime = this.duration;
this.timelineObj.val = this.nowTime;
created() {},
mounted() {
this.$bus.on('VideoCutter.canPlay', this.canPlayFunc)
},
timeupdate(time) {
this.nowTime = time;
this.timelineObj.val = this.nowTime;
methods: {
changeVideo() {
console.log('todo change video, <-----lilei')
},
canPlayFunc(data) {
this.duration = data
this.timelineObj.max = this.duration
this.canPlay = true
},
videoPlay() {
if (!this.canPlay) return
let ob = {}
if (this.playing) {
ob.play = false
} else {
ob.play = true
if (this.nowTime >= this.duration) {
ob.time = 0
this.timelineObj.val = 0
}
}
this.playing = !this.playing
this.$bus.emit('videoPlayer.play', ob)
},
changeTime(data) {
console.log(data)
},
playEnd() {
this.playing = false
this.nowTime = this.duration
this.timelineObj.val = this.nowTime
},
timeupdate(time) {
this.nowTime = time
this.timelineObj.val = this.nowTime
}
}
}
};
}
</script>
<style scoped lang="scss">
/* @import url(); 引入css类 */
.video-cutter {
width: 100%;
height: 100%;
width: 100%;
height: 100%;
}
.video-content {
width: 100%;
height: 700px;
width: 100%;
height: 700px;
}
.video-btn {
display: flex;
justify-content: space-between;
display: flex;
justify-content: space-between;
}
.video-water {
display: flex;
align-items: center;
display: flex;
align-items: center;
input {
margin-right: 4px;
}
input {
margin-right: 4px;
}
* {
cursor: pointer;
}
* {
cursor: pointer;
}
}
.timeline-content {
width: 100%;
margin: 10px 0;
padding: 0 20px;
width: 100%;
margin: 10px 0;
padding: 0 20px;
}
</style>
......@@ -2,40 +2,40 @@
console.log('process.env.NODE_ENV1:', process.env.NODE_ENV)
module.exports = {
// outputDir: process.env.outputDir,
// assetsDir: 'static',
publicPath: '/',
devServer: {
open: true,
// host: '0.0.0.0',
port: 3018,
https: false,
hotOnly: false,
proxy: {
webapi: {
target: 'https://test2.laihua.com/',
ws: true,
changeOrigin: true,
pathRewrite: { '^/webapi': '/' }
}
// outputDir: process.env.outputDir,
// assetsDir: 'static',
publicPath: '/',
devServer: {
open: true,
// host: '0.0.0.0',
port: 3018,
https: false,
hotOnly: false,
proxy: {
webapi: {
target: 'https://test2.laihua.com/',
ws: true,
changeOrigin: true,
pathRewrite: { '^/webapi': '/' }
}
}
},
chainWebpack: (config) => {
config.module
.rule('eslint')
.use('eslint-loader')
.loader('eslint-loader')
.tap((options) => {
// 保存自动eslint修复
options.fix = true
return options
})
},
css: {
loaderOptions: {
sass: {
prependData: '@import "@/assets/style/index.scss";'
}
}
}
},
chainWebpack: (config) => {
config.module
.rule('eslint')
.use('eslint-loader')
.loader('eslint-loader')
.tap((options) => {
// 保存自动eslint修复
options.fix = true
return options
})
},
css: {
loaderOptions: {
sass: {
prependData: '@import "@/assets/style/index.scss";'
}
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment