942c46dd by qingxiao

视频演示 回放

1 parent db447616
......@@ -19,7 +19,7 @@ let requestDomain = "https://ow.go.qudone.com";
if (location.href.indexOf("://k.wxpai.cn") > 0 || location.href.indexOf("://h5.k.wxpai.cn") > 0) {
requestDomain = "https://api.k.wxpai.cn/bizproxy";
}
//requestDomain = 'http://localhost:3111'
//requestDomain = 'http://localhost:6400'
/**
* header不加session的白名单
*/
......
<template>
<el-upload
class="avatar-uploader"
:action="uploadUrl"
:http-request="uploadSumit"
:show-file-list="false"
:on-success="handleAvatarSuccess"
:before-upload="beforeAvatarUpload"
>
<img v-if="currentValue" :src="currentValue" class="avatar">
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
<div class="el-upload__tip" slot="tip" :class="{error:tipsError}">{{tips}}</div>
</el-upload>
</template>
<script>
import { request } from "@/api/fetch-api.js";
/**
* 外层插件可通过监听:v-on:before-upload;v-on:after-upload两个事件监听上传结果
* after-upload(success, src)
*/
export default {
props: ["value"],
data() {
return {
imageUrl: this.value,
uploadUrl: "https://api.k.wxpai.cn/bizproxy/kdapi/file/upload",
tips: "只能上传jpg/png文件,且不超过500kb",
tipsError: false,
uploadInterval: 0
};
},
methods: {
handleAvatarSuccess(res, file) {
this.imageUrl = URL.createObjectURL(file.raw);
},
beforeAvatarUpload(file) {
const isJPG = file.type === "image/jpeg" || file.type === "image/png";
const isLt2M = file.size / 1024 < 500;
if (!isJPG) {
this.tipsError = true;
this.tips = "上传图片只能是 JPG|PNG 格式!";
// this.$message.error("");
}
if (!isLt2M) {
this.tipsError = true;
this.tips = "上传图片大小不能超过 500kb!";
}
return isJPG && isLt2M;
},
uploadSumit(params) {
this.tipsError = false;
this.uploadStart();
this.$emit("before-upload");
let data = {
path: "/pro/tianbao",
file: params.file
};
request
.form(this.uploadUrl, data)
.then(result => {
this.uploadEnd();
this.imageUrl = result.content;
this.$emit("input", this.imageUrl);
this.$emit("after-upload", { success: true, src: this.imageUrl });
})
.catch(res => {
this.uploadEnd();
this.$emit("after-upload", { success: false, src: this.imageUrl });
});
},
uploadStart() {
let that = this;
let times = 0;
this.uploadInterval = setInterval(function() {
times++;
let t = times % 4;
let s = "";
for (let i = 0; i < t; i++) {
s += ".";
}
that.tips = "上传中" + s;
}, 500);
},
uploadEnd() {
clearInterval(this.uploadInterval);
this.tips = "只能上传jpg/png文件,且不超过500kb";
}
},
computed: {
currentValue: function() {
return this.value;
}
}
};
</script>
<style>
.avatar-uploader .el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
padding: 10px;
}
.avatar-uploader .el-upload:hover {
border-color: #409eff;
}
.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 120px;
height: 120px;
line-height: 120px;
text-align: center;
}
.avatar {
max-width: 120px;
max-height: 120px;
display: block;
}
.error {
color: red;
}
</style>
......@@ -149,31 +149,99 @@ export const constantRouterMap = [{
}
}]
},
{
path: '/live',
path: '/edu',
component: Layout,
redirect: '/edu/live',
name: 'live',
meta: {
title: '教育教学',
icon: 'nested'
},
children: [
{
path: 'index',
name: 'Live',
path: '/edu/live',
name: 'live',
component: () => import('@/views/live/index'),
meta: { title: '直播课程', icon: 'form' }
meta: {
title: '直播课程',
icon: ''
}
]
},
{
path: '/public',
component: Layout,
children: [
{
path: 'index',
path: '/edu/public',
name: 'public',
component: () => import('@/views/public/index'),
meta: { title: '公开课', icon: 'form' }
meta: {
title: '公开课',
icon: ''
}
},
{
path: '/edu/playback',
name: 'playback',
component: () => import('@/views/playback/index'),
meta: {
title: '回放视频',
icon: ''
}
},
{
path: '/edu/playbackType',
name: 'playbackType',
component: () => import('@/views/playbackType/index'),
meta: {
title: '回放视频类型',
icon: ''
}
},
{
path: '/edu/video',
name: 'video',
component: () => import('@/views/video/index'),
meta: {
title: '视频演示',
icon: ''
}
},
{
path: '/edu/videoType',
name: 'video',
component: () => import('@/views/videoType/index'),
meta: {
title: '视频演示类型',
icon: ''
}
},
]
},
// {
// path: '/live',
// component: Layout,
// children: [
// {
// path: 'index',
// name: 'Live',
// component: () => import('@/views/live/index'),
// meta: { title: '直播课程', icon: 'form' }
// }
// ]
// },
// {
// path: '/public',
// component: Layout,
// children: [
// {
// path: 'index',
// name: 'public',
// component: () => import('@/views/public/index'),
// meta: { title: '公开课', icon: 'form' }
// }
// ]
// },
// {
// path: '/example',
......
<template>
<div class="app-container">
<el-header height>
<el-input v-model="queryForm.title" style="width: 200px" placeholder="视频名称" clearable></el-input>
<el-select v-model="queryForm.playbackTypeCode" placeholder="请选择" clearable @change="searchPlayback">
<el-option
v-for="item in playbackTypeList"
:key="item.playbackTypeCode"
:label="item.typeName"
:value="item.playbackTypeCode">
</el-option>
</el-select>
<el-button @click="searchPlayback" type="primary">搜索</el-button>
<el-button type="primary" @click="playbackCreate">创建</el-button>
</el-header>
<el-main>
<el-table
:data="playbackList"
style="width: 100%"
stripe
highlight-current-row
v-loading="loading"
>
<el-table-column label="名称" prop="title"></el-table-column>
<el-table-column label="视频链接" prop="videoUrl"></el-table-column>
<el-table-column label="类型" prop="typeName"></el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-link type="primary" @click="playbackEdit(scope.row)">编辑 &nbsp;</el-link>
<el-link type="primary" @click="playbackDelete(scope.row.playbackCode)">删除 &nbsp;</el-link>
</template>
</el-table-column>
</el-table>
</el-main>
<el-footer>
<div style="text-align:right;">
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="queryForm.page"
:page-size="queryForm.size"
layout="total, prev, pager, next"
:total="total">
</el-pagination>
</div>
</el-footer>
<el-dialog
width="60%"
:title="title"
:visible.sync="dialogVisible">
<el-form :model="playbackForm" ref="playbackForm" :rules="playbackRules" label-width="180px">
<el-form-item label="名称:" prop="title">
<el-input v-model="playbackForm.title" maxlength="100" show-word-limit></el-input>
</el-form-item>
<el-form-item label="视频链接:" prop="videoUrl">
<el-input v-model="playbackForm.videoUrl" maxlength="100" show-word-limit></el-input>
</el-form-item>
<el-form-item label="类型:" prop="playbackTypeCode">
<el-select v-model="playbackForm.playbackTypeCode" placeholder="请选择" >
<el-option
v-for="item in playbackTypeList"
:key="item.playbackTypeCode"
:label="item.typeName"
:value="item.playbackTypeCode">
</el-option>
</el-select>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm('playbackForm')">提交</el-button>
<el-button @click="cancelCreate">取消</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import {request} from '@/api/fetch-api'
import UploadItem from '@/components/UploadItem'
let urls = {
playbackTypeListUrl: '/tianbao_edu_api/admin/playbackType/list',
playbackListUrl: '/tianbao_edu_api/admin/playback/list',
playbackSaveUrl: '/tianbao_edu_api/admin/playback/save',
playbackDelUrl: '/tianbao_edu_api/admin/playback/delete',
}
export default {
components: {UploadItem},
data() {
return {
playbackList: [],
total: 0,
loading: false,
queryForm: {
page: 1,
size: 10,
playbackTypeCode:'',
title:''
},
dialogVisible: false,
title: '',
playbackForm: {},
playbackRules: {
title: [{required: true, message: '请输入名称', trigger: 'blur'}],
videoUrl: [{required: true, message: '请输入视频链接', trigger: 'blur'}],
playbackTypeCode: [{required: true, message: '请选择', trigger: 'blur'}]
},
playbackTypeList:[]
}
},
methods: {
searchPlayback(){
this.queryForm.page=1
this.initPlayBack()
},
initPlayBack() {
this.loading = true
request.get(urls.playbackListUrl, this.queryForm).then(data => {
this.loading = false
this.playbackList = data.content.list
this.total = data.content.total
}).catch(() => {
})
},
initPlayBackType() {
let form ={
page:1,
size:1000,
}
request.get(urls.playbackTypeListUrl, form).then(data => {
this.playbackTypeList = data.content.list
}).catch(() => {
})
},
playbackEdit(row) {
this.title = '编辑'
this.dialogVisible = true
this.playbackForm = JSON.parse(JSON.stringify(row))
},
playbackDelete(code) {
this.$confirm('是否永远删除, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let form ={
playbackCode:code
}
request.post(urls.playbackDelUrl, form).then(data => {
this.initPlayBack()
this.$message.success("删除成功")
}).catch(() => {
})
}).catch(() => {
})
},
cancelCreate() {
this.dialogVisible = false
this.playbackForm = {}
},
playbackCreate() {
this.dialogVisible = true
this.title = '创建'
},
submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
request.post(urls.playbackSaveUrl, this.playbackForm).then(response => {
this.dialogVisible = false
this.$message.success("保存成功")
this.initPlayBack()
}).catch(() => {
})
} else {
console.log('error submit!!')
return false
}
})
},
/*分页*/
handleSizeChange(val) {
console.log(`每页 ${val} 条`)
this.queryForm.size = val
this.queryForm.page = 1
this.initPlayBack()
},
handleCurrentChange(val) {
console.log(`当前页: ${val}`)
this.queryForm.page = val
this.initPlayBack()
},
},
created() {
this.initPlayBack()
this.initPlayBackType()
}
}
</script>
<style scoped>
</style>
<template>
<div class="app-container">
<el-header height>
<el-button type="primary" @click="playbackTypeCreate">创建</el-button>
</el-header>
<el-main>
<el-table
:data="playbackTypeList"
style="width: 100%"
stripe
highlight-current-row
v-loading="loading"
>
<el-table-column label="名称" prop="typeName"></el-table-column>
<el-table-column label="图片" prop="typeImage">
<template slot-scope="scope">
<a :href="scope.row.typeImage" target="_blank">
<el-image :src="scope.row.typeImage"></el-image>
</a>
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-link type="primary" @click="playbackTypeEdit(scope.row)">编辑 &nbsp;</el-link>
<el-link type="primary" @click="playbackTypeDelete(scope.row.playbackTypeCode)">删除 &nbsp;</el-link>
</template>
</el-table-column>
</el-table>
</el-main>
<el-footer>
<div style="text-align:right;">
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="queryForm.page"
:page-size="queryForm.size"
layout="total, prev, pager, next"
:total="total">
</el-pagination>
</div>
</el-footer>
<el-dialog
width="60%"
:title="title"
:visible.sync="dialogVisible">
<el-form :model="playbackTypeForm" ref="playbakcForm" :rules="playbackTypeRules" label-width="180px">
<el-form-item label="名称:" prop="typeName">
<el-input v-model="playbackTypeForm.typeName" maxlength="100" show-word-limit></el-input>
</el-form-item>
<el-form-item label="图片:" prop="typeImage">
<upload-item
v-model="playbackTypeForm.typeImage"
v-on:before-upload="loading=true"
v-on:after-upload="loading=false"
></upload-item>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm('playbakcForm')">提交</el-button>
<el-button @click="cancelCreate">取消</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import {request} from '@/api/fetch-api'
import UploadItem from '@/components/UploadItem'
let urls = {
playbackTypeListUrl: '/tianbao_edu_api/admin/playbackType/list',
playbackTypeSaveUrl: '/tianbao_edu_api/admin/playbackType/save',
playbackTypeDelUrl: '/tianbao_edu_api/admin/playbackType/delete',
}
export default {
components: {UploadItem},
data() {
return {
playbackTypeList: [],
total: 0,
loading: false,
queryForm: {
page: 1,
size: 10
},
dialogVisible: false,
title: '',
playbackTypeForm: {},
playbackTypeRules: {
typeName: [{required: true, message: '请输入名称', trigger: 'blur'}],
typeImage: [{required: true, message: '上传缩略图', trigger: 'blur'}]
}
}
},
methods: {
initPlayBackType() {
this.loading = true
request.get(urls.playbackTypeListUrl, this.queryForm).then(data => {
this.loading = false
this.playbackTypeList = data.content.list
this.total = data.content.total
}).catch(() => {
})
},
playbackTypeEdit(row) {
this.title = '编辑'
this.dialogVisible = true
this.playbackTypeForm = JSON.parse(JSON.stringify(row))
},
playbackTypeDelete(code) {
this.$confirm('是否永远删除, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let form ={
playbackTypeCode:code
}
request.post(urls.playbackTypeDelUrl, form).then(data => {
this.initPlayBackType()
this.$message.success("删除成功")
}).catch(() => {
})
}).catch(() => {
})
},
cancelCreate() {
this.dialogVisible = false
this.playbackTypeForm = {}
},
playbackTypeCreate() {
this.dialogVisible = true
this.title = '创建'
},
submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
request.post(urls.playbackTypeSaveUrl, this.playbackTypeForm).then(response => {
this.dialogVisible = false
this.$message.success("保存成功")
this.initPlayBackType()
}).catch(() => {
})
} else {
console.log('error submit!!')
return false
}
})
},
/*分页*/
handleSizeChange(val) {
console.log(`每页 ${val} 条`)
this.queryForm.size = val
this.queryForm.page = 1
this.initPlayBackType()
},
handleCurrentChange(val) {
console.log(`当前页: ${val}`)
this.queryForm.page = val
this.initPlayBackType()
},
},
created() {
this.initPlayBackType()
}
}
</script>
<style scoped>
</style>
<template>
<div class="app-container">
<el-header height>
<el-input type="primary" v-model="queryForm.videoName" placeholder="视频名" style="width: 200px" clearable></el-input>
<el-select v-model="queryForm.videoTypeCode" placeholder="请选择" clearable @change="searchVideo">
<el-option
v-for="item in videoTypeList"
:key="item.videoTypeCode"
:label="item.typeName"
:value="item.videoTypeCode">
<span style="float: left">{{ item.typeName }}</span>
<span style="float: right; color: #8492a6; font-size: 13px" v-if="item.machine===1">软件</span>
<span style="float: right; color: #8492a6; font-size: 13px" v-if="item.machine===0">硬件</span>
</el-option>
</el-select>
<el-button type="primary" @click="searchVideo">搜索</el-button>
<el-button type="primary" @click="videoCreate">创建</el-button>
</el-header>
<el-main>
<el-table
:data="videoList"
style="width: 100%"
stripe
highlight-current-row
v-loading="loading"
>
<el-table-column label="名称" prop="videoName"></el-table-column>
<el-table-column label="视频链接" prop="videoUrl">
<!--<template slot-scope="scope">-->
<!--<video :src="scope.row.videoUrl" controls="controls"></video>-->
<!--</template>-->
</el-table-column>
<el-table-column label="类型" prop="typeName">
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-link type="primary" @click="videoEdit(scope.row)">编辑 &nbsp;</el-link>
<el-link type="primary" @click="videoDelete(scope.row.videoCode)">删除 &nbsp;</el-link>
</template>
</el-table-column>
</el-table>
</el-main>
<el-footer>
<div style="text-align:right;">
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="queryForm.page"
:page-size="queryForm.size"
layout="total, prev, pager, next"
:total="total">
</el-pagination>
</div>
</el-footer>
<el-dialog
width="60%"
:title="title"
:visible.sync="dialogVisible">
<el-form :model="videoForm" ref="videoForm" :rules="videoRules" label-width="180px">
<el-form-item label="名称:" prop="videoName">
<el-input v-model="videoForm.videoName" maxlength="100" show-word-limit></el-input>
</el-form-item>
<el-form-item label="视频链接:" prop="videoUrl">
<el-input v-model="videoForm.videoUrl" maxlength="255" show-word-limit></el-input>
</el-form-item>
<el-form-item label="类型:" prop="videoTypeCode">
<el-select v-model="videoForm.videoTypeCode" placeholder="请选择">
<el-option
v-for="item in videoTypeList"
:key="item.videoTypeCode"
:label="item.typeName"
:value="item.videoTypeCode">
<span style="float: left">{{ item.typeName }}</span>
<span style="float: right; color: #8492a6; font-size: 13px" v-if="item.machine===1">软件</span>
<span style="float: right; color: #8492a6; font-size: 13px" v-if="item.machine===0">硬件</span>
</el-option>
</el-select>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm('videoForm')">提交</el-button>
<el-button @click="cancelCreate">取消</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import {request} from '@/api/fetch-api'
import UploadItem from '@/components/UploadItem'
let urls = {
videoTypeListUrl: '/tianbao_edu_api/admin/videoType/list',
videoListUrl: '/tianbao_edu_api/admin/video/list',
videoSaveUrl: '/tianbao_edu_api/admin/video/save',
videoDelUrl: '/tianbao_edu_api/admin/video/delete',
}
export default {
components: {UploadItem},
data() {
return {
videoList: [],
total: 0,
loading: false,
queryForm: {
page: 1,
size: 10,
videoName: '',
videoTypeCode:''
},
dialogVisible: false,
title: '',
videoForm: {},
videoRules: {
videoName: [{required: true, message: '请输入名称', trigger: 'blur'}],
videoUrl: [{required: true, message: '上传缩略图', trigger: 'blur'}],
videoTypeCode: [{required: true, message: '请选择', trigger: 'blur'}]
},
videoTypeList: []
}
},
methods: {
initVideo() {
this.loading = true
request.get(urls.videoListUrl, this.queryForm).then(data => {
this.loading = false
this.videoList = data.content.list
this.total = data.content.total
}).catch(() => {
})
},
initVideoType() {
let form = {
page: 1,
size: 1000
}
request.get(urls.videoTypeListUrl, this.form).then(data => {
this.videoTypeList = data.content.list
}).catch(() => {
})
},
searchVideo(){
this.queryForm.page=1
this.initVideo()
},
videoEdit(row) {
this.title = '编辑'
this.dialogVisible = true
this.videoForm = JSON.parse(JSON.stringify(row))
},
videoDelete(code) {
this.$confirm('是否永远删除, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let form = {
videoCode: code
}
request.post(urls.videoDelUrl, form).then(data => {
this.initVideo()
this.$message.success("删除成功")
}).catch(() => {
})
}).catch(() => {
})
},
cancelCreate() {
this.dialogVisible = false
this.videoForm = {}
},
videoCreate() {
this.dialogVisible = true
this.title = '创建'
},
submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
request.post(urls.videoSaveUrl, this.videoForm).then(response => {
this.dialogVisible = false
this.$message.success("保存成功")
this.initVideo()
}).catch(() => {
})
} else {
console.log('error submit!!')
return false
}
})
},
/*分页*/
handleSizeChange(val) {
console.log(`每页 ${val} 条`)
this.queryForm.size = val
this.queryForm.page = 1
this.initVideo()
},
handleCurrentChange(val) {
console.log(`当前页: ${val}`)
this.queryForm.page = val
this.initVideo()
},
},
created() {
this.initVideo();
this.initVideoType();
}
}
</script>
<style scoped>
</style>
<template>
<div class="app-container">
<el-header height>
<el-button type="primary" @click="videoTypeCreate">创建</el-button>
</el-header>
<el-main>
<el-table
:data="videoTypeList"
style="width: 100%"
stripe
highlight-current-row
v-loading="loading"
>
<el-table-column label="名称" prop="typeName"></el-table-column>
<el-table-column label="图片" prop="typeImage">
<template slot-scope="scope">
<a :href="scope.row.typeImage" target="_blank">
<el-image :src="scope.row.typeImage"></el-image>
</a>
</template>
</el-table-column>
<el-table-column label="软/硬件" prop="machine">
<template slot-scope="scope">
<span v-if="scope.row.machine===1">软件</span>
<span v-if="scope.row.machine===0">硬件</span>
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-link type="primary" @click="videoTypeEdit(scope.row)">编辑 &nbsp;</el-link>
<el-link type="primary" @click="videoTypeDelete(scope.row.videoTypeCode)">删除 &nbsp;</el-link>
</template>
</el-table-column>
</el-table>
</el-main>
<el-footer>
<div style="text-align:right;">
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="queryForm.page"
:page-size="queryForm.size"
layout="total, prev, pager, next"
:total="total">
</el-pagination>
</div>
</el-footer>
<el-dialog
width="60%"
:title="title"
:visible.sync="dialogVisible">
<el-form :model="videoTypeForm" ref="videoTypeForm" :rules="videoTypeRules" label-width="180px">
<el-form-item label="名称:" prop="typeName">
<el-input v-model="videoTypeForm.typeName" maxlength="100" show-word-limit></el-input>
</el-form-item>
<el-form-item label="图片:" prop="typeImage">
<upload-item
v-model="videoTypeForm.typeImage"
v-on:before-upload="loading=true"
v-on:after-upload="loading=false"
></upload-item>
</el-form-item>
<el-form-item label="软/硬件:" prop="machine">
<el-select v-model="videoTypeForm.machine" placeholder="请选择">
<el-option
v-for="item in machineOption"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm('videoTypeForm')">提交</el-button>
<el-button @click="cancelCreate">取消</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import {request} from '@/api/fetch-api'
import UploadItem from '@/components/UploadItem'
let urls = {
videoTypeListUrl: '/tianbao_edu_api/admin/videoType/list',
videoTypeSaveUrl: '/tianbao_edu_api/admin/videoType/save',
videoTypeDelUrl: '/tianbao_edu_api/admin/videoType/delete',
}
export default {
components: {UploadItem},
data() {
return {
videoTypeList: [],
total: 0,
loading: false,
queryForm: {
page: 1,
size: 10
},
dialogVisible: false,
title: '',
videoTypeForm: {},
videoTypeRules: {
typeName: [{required: true, message: '请输入名称', trigger: 'blur'}],
typeImage: [{required: true, message: '上传缩略图', trigger: 'blur'}],
machine: [{required: true, message: '请选择', trigger: 'blur'}]
},
machineOption:[
{label:'软件',value:1},
{label:'硬件',value:0},
]
}
},
methods: {
initVideoType() {
this.loading = true
request.get(urls.videoTypeListUrl, this.queryForm).then(data => {
this.loading = false
this.videoTypeList = data.content.list
this.total = data.content.total
}).catch(() => {
})
},
videoTypeEdit(row) {
this.title = '编辑'
this.dialogVisible = true
this.videoTypeForm = JSON.parse(JSON.stringify(row))
},
videoTypeDelete(code) {
this.$confirm('是否永远删除, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let form ={
videoTypeCode:code
}
request.post(urls.videoTypeDelUrl, form).then(data => {
this.initVideoType()
this.$message.success("删除成功")
}).catch(() => {
})
}).catch(() => {
})
},
cancelCreate() {
this.dialogVisible = false
this.videoTypeForm = {}
},
videoTypeCreate() {
this.dialogVisible = true
this.title = '创建'
},
submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
request.post(urls.videoTypeSaveUrl, this.videoTypeForm).then(response => {
this.dialogVisible = false
this.$message.success("保存成功")
this.initVideoType()
}).catch(() => {
})
} else {
console.log('error submit!!')
return false
}
})
},
/*分页*/
handleSizeChange(val) {
console.log(`每页 ${val} 条`)
this.queryForm.size = val
this.queryForm.page = 1
this.initVideoType()
},
handleCurrentChange(val) {
console.log(`当前页: ${val}`)
this.queryForm.page = val
this.initVideoType()
},
},
created() {
this.initVideoType()
}
}
</script>
<style scoped>
</style>