Merge branch 'master' of gitee.com:darlk/ShengTangManage into develop
This commit is contained in:
@ -13,9 +13,9 @@
|
||||
rel="stylesheet"
|
||||
href="//at.alicdn.com/t/font_2343184_w0runuauamq.css"
|
||||
/>
|
||||
<script src="/lib/aliyunVideo/es6-promise.min.js"></script>
|
||||
<script src="/lib/aliyunVideo/aliyun-oss-sdk-6.13.0.min.js"></script>
|
||||
<script src="/lib/aliyunVideo/aliyun-upload-sdk-1.5.2.min.js"></script>
|
||||
<script src="../lib/aliyunVideo/es6-promise.min.js"></script>
|
||||
<script src="../lib/aliyunVideo/aliyun-oss-sdk-6.13.0.min.js"></script>
|
||||
<script src="../lib/aliyunVideo/aliyun-upload-sdk-1.5.2.min.js"></script>
|
||||
|
||||
<title><%= webpackConfig.name %></title>
|
||||
<style>
|
||||
|
20
stdiet-ui/public/lib/aliyunVideo/aliyun-oss-sdk-6.13.0.min.js
vendored
Normal file
20
stdiet-ui/public/lib/aliyunVideo/aliyun-oss-sdk-6.13.0.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
7
stdiet-ui/public/lib/aliyunVideo/aliyun-upload-sdk-1.5.2.min.js
vendored
Normal file
7
stdiet-ui/public/lib/aliyunVideo/aliyun-upload-sdk-1.5.2.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
stdiet-ui/public/lib/aliyunVideo/es6-promise.min.js
vendored
Normal file
1
stdiet-ui/public/lib/aliyunVideo/es6-promise.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -60,3 +60,12 @@ export function getUploadVideoAuth(data) {
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改视频展示状态
|
||||
export function updateWxShow(data){
|
||||
return request({
|
||||
url: '/custom/nutritionalVideo/updateWxShow',
|
||||
method: 'get',
|
||||
params: data
|
||||
})
|
||||
}
|
||||
|
61
stdiet-ui/src/api/custom/videoClassify.js
Normal file
61
stdiet-ui/src/api/custom/videoClassify.js
Normal file
@ -0,0 +1,61 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询视频分类列表
|
||||
export function listVideoClassify(query) {
|
||||
return request({
|
||||
url: '/custom/videoClassify/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询视频分类详细
|
||||
export function getVideoClassify(id) {
|
||||
return request({
|
||||
url: '/custom/videoClassify/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增视频分类
|
||||
export function addVideoClassify(data) {
|
||||
return request({
|
||||
url: '/custom/videoClassify',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改视频分类
|
||||
export function updateVideoClassify(data) {
|
||||
return request({
|
||||
url: '/custom/videoClassify',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除视频分类
|
||||
export function delVideoClassify(id) {
|
||||
return request({
|
||||
url: '/custom/videoClassify/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 导出视频分类
|
||||
export function exportVideoClassify(query) {
|
||||
return request({
|
||||
url: '/custom/videoClassify/export',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
//获取所有分类
|
||||
export function getAllClassify(){
|
||||
return request({
|
||||
url: '/custom/videoClassify/getAllClassify',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
113
stdiet-ui/src/components/FileUpload/UploadFile.vue
Normal file
113
stdiet-ui/src/components/FileUpload/UploadFile.vue
Normal file
@ -0,0 +1,113 @@
|
||||
<template>
|
||||
<el-upload
|
||||
class="avatar-uploader"
|
||||
:headers="upload.headers"
|
||||
:action="upload.url"
|
||||
:show-file-list="false"
|
||||
:on-success="handleFileSuccess"
|
||||
:accept="'.png,.jpg'"
|
||||
:before-upload="beforeAvatarUpload">
|
||||
<img v-if="imageUrl || coverUrl" :src="imageUrl || coverUrl" class="avatar">
|
||||
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
||||
<div class="el-upload__tip" slot="tip">
|
||||
1、只能上传png、jpg文件,且每个文件不超过{{
|
||||
upload.fileSize / (1024 * 1024)
|
||||
}}M
|
||||
</div>
|
||||
</el-upload>
|
||||
</template>
|
||||
<script>
|
||||
import { getToken } from "@/utils/auth";
|
||||
export default {
|
||||
name: "DragUpload",
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
upload: {
|
||||
// 上传的地址
|
||||
url: process.env.VUE_APP_BASE_API + "/custom/fileUpload/" + this.prefix,
|
||||
// 设置上传的请求头部
|
||||
headers: { Authorization: "Bearer " + getToken() },
|
||||
// 其他需要携带的数据
|
||||
data: {},
|
||||
//每个文件大小(单位:byte)
|
||||
fileSize: 1024 * 1024 * 10,
|
||||
},
|
||||
//上传之后的路径
|
||||
imageUrl: null,
|
||||
fileUrl: null
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
resetUpload(){
|
||||
this.imageUrl = null;
|
||||
this.fileUrl = null
|
||||
},
|
||||
// 文件上传成功处理
|
||||
handleFileSuccess(response, file, fileList) {
|
||||
if (response != null && response.code === 200) {
|
||||
this.fileUrl = response.fileUrl;
|
||||
this.imageUrl = response.previewUrl;
|
||||
//this.imageUrl = URL.createObjectURL(file.raw);
|
||||
//文件全部上传成功,则调用回调方法
|
||||
this.$emit("callbackMethod", this.fileUrl);
|
||||
} else {
|
||||
this.$message.error("文件上传失败");
|
||||
}
|
||||
},
|
||||
// 文件上传失败处理
|
||||
handleFileFail(err, file, fileList) {
|
||||
this.$message.error("文件上传失败");
|
||||
},
|
||||
beforeAvatarUpload(file) {
|
||||
if(file.type != 'image/jpeg' && file.type != 'image/png') {
|
||||
this.$message.error('文件格式错误');
|
||||
return false;
|
||||
}
|
||||
if (file.size > this.upload.fileSize) {
|
||||
this.$message.error('文件大小超过最大限制');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
},
|
||||
props: {
|
||||
prefix: {
|
||||
type: String,
|
||||
default: "videoCover",
|
||||
},
|
||||
coverUrl:{
|
||||
type: String,
|
||||
default: ""
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
.avatar-uploader .el-upload {
|
||||
border: 1px dashed #d7e236;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
.avatar-uploader .el-upload:hover {
|
||||
border-color: #409EFF;
|
||||
}
|
||||
.avatar-uploader-icon {
|
||||
font-size: 28px;
|
||||
color: #8c939d;
|
||||
width: 200px;
|
||||
height: 120px;
|
||||
line-height: 120px;
|
||||
text-align: center;
|
||||
}
|
||||
.avatar {
|
||||
width: 200px;
|
||||
height: 120px;
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
|
@ -1,13 +1,13 @@
|
||||
<template>
|
||||
<el-dialog title="视频上传" v-if="open" :visible.sync="open" width="700px" :close-on-click-modal="false" :show-close="false" append-to-body>
|
||||
<el-form ref="videoFrom" :model="videoFrom" :rules="videoRules" label-width="80px">
|
||||
<el-form ref="videoFrom" :model="videoFrom" :rules="videoRules" label-width="80px" style="height: 650px; overflow: auto">
|
||||
<el-form-item label="视频标题" prop="title">
|
||||
<el-input
|
||||
type="textarea"
|
||||
placeholder="请输入视频标题"
|
||||
v-model="videoFrom.title"
|
||||
maxlength="50"
|
||||
rows="3"
|
||||
rows="1"
|
||||
show-word-limit
|
||||
/>
|
||||
</el-form-item>
|
||||
@ -16,11 +16,38 @@
|
||||
type="textarea"
|
||||
placeholder="请输入视频描述"
|
||||
v-model="videoFrom.description"
|
||||
maxlength="2000"
|
||||
rows="10"
|
||||
maxlength="1000"
|
||||
rows="3"
|
||||
show-word-limit
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="视频封面" prop="coverUrl">
|
||||
<UploadFile ref="uploadFile" :prefix="'videoCover'" @callbackMethod="handleCoverUrl"></UploadFile>
|
||||
</el-form-item>
|
||||
<div style="display:flex">
|
||||
<el-form-item label="视频类别" prop="cateId">
|
||||
<el-select v-model="videoFrom.cateId" clearable filterable placeholder="请选择类别">
|
||||
<el-option
|
||||
v-for="classify in classifyList"
|
||||
:key="classify.id"
|
||||
:label="classify.cateName"
|
||||
:value="classify.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="视频权限" prop="payLevel" style="margin-left:40px">
|
||||
<el-select v-model="videoFrom.payLevel" clearable filterable placeholder="请选择权限">
|
||||
<el-option
|
||||
v-for="dict in payVideoLevelList"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="parseInt(dict.dictValue)"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
<el-form-item label="视频文件" prop="file">
|
||||
<div>
|
||||
<input type="file" accept=".mp4" ref="videoFile" id="videoFile" @change="fileChange($event)">
|
||||
@ -28,7 +55,14 @@
|
||||
<div > 1、只能上传mp4文件,上传大文件时请使用客户端上传,防止上传超时</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="展示状态" prop="wxShow">
|
||||
<el-switch
|
||||
v-model="videoFrom.wxShow"
|
||||
active-text="小程序展示"
|
||||
inactive-text="小程序不展示">
|
||||
</el-switch>
|
||||
<div>提示:请保证内容正确再展示到小程序</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="authUpload" :disabled="uploadDisabled">开始上传</el-button>
|
||||
@ -39,17 +73,32 @@
|
||||
</template>
|
||||
<script>
|
||||
import axios from 'axios'
|
||||
import {getUploadVideoAuth } from "@/api/custom/nutritionalVideo";
|
||||
|
||||
import {getUploadVideoAuth,addNutritionalVideo } from "@/api/custom/nutritionalVideo";
|
||||
import {getAllClassify } from "@/api/custom/videoClassify";
|
||||
import UploadFile from "@/components/FileUpload/UploadFile";
|
||||
export default {
|
||||
name: "UploadVideo",
|
||||
data () {
|
||||
return {
|
||||
open: false,
|
||||
videoFrom:{},
|
||||
videoRules:{},
|
||||
videoRules:{
|
||||
title: [
|
||||
{ required: true, message: "标题不能为空", trigger: "blur" },
|
||||
],
|
||||
coverUrl: [
|
||||
{ required: true, message: "封面不能为空", trigger: "blur" },
|
||||
],
|
||||
cateId:[
|
||||
{ required: true, message: "视频类别不能为空", trigger: "blur" },
|
||||
],
|
||||
payLevel:[
|
||||
{ required: true, message: "视频权限不能为空", trigger: "blur" },
|
||||
]
|
||||
},
|
||||
callback: null,
|
||||
|
||||
classifyList: [],
|
||||
payVideoLevelList:[],
|
||||
uploadAuth:{
|
||||
|
||||
},
|
||||
@ -68,24 +117,47 @@
|
||||
pauseDisabled: true,
|
||||
uploader: null,
|
||||
statusText: '',
|
||||
fileType:['mp4'],
|
||||
fileType:['mp4','MP4'],
|
||||
uploading: false
|
||||
}
|
||||
},
|
||||
created(){
|
||||
getAllClassify().then(response => {
|
||||
if(response.code == 200){
|
||||
this.classifyList = response.data;
|
||||
}
|
||||
});
|
||||
this.getDicts("video_pay_level").then((response) => {
|
||||
this.payVideoLevelList = response.data;
|
||||
});
|
||||
|
||||
},
|
||||
components: {
|
||||
UploadFile
|
||||
},
|
||||
methods: {
|
||||
showDialog(callback){
|
||||
this.resetVideoFrom();
|
||||
this.open = true;
|
||||
this.callback = callback;
|
||||
},
|
||||
handleCoverUrl(url){
|
||||
this.videoFrom.coverUrl = url;
|
||||
},
|
||||
resetVideoFrom(){
|
||||
this.videoFrom = {
|
||||
cateId: null,
|
||||
coverUrl: null,
|
||||
title: null,
|
||||
description: null,
|
||||
tags: null,
|
||||
tags: null,
|
||||
payLevel: 0,
|
||||
videoId: null,
|
||||
wxShow: false
|
||||
};
|
||||
if(this.$refs.uploadFile){
|
||||
this.$refs.uploadFile.resetUpload();
|
||||
}
|
||||
this.authProgress = 0;
|
||||
this.file = null;
|
||||
this.videoFileList = [];
|
||||
@ -112,55 +184,53 @@
|
||||
},
|
||||
|
||||
fileChange (e) {
|
||||
if(this.videoFrom.title == null || this.videoFrom.title.trim().length == 0){
|
||||
this.$message({
|
||||
message: "标题不能为空",
|
||||
type: "warning",
|
||||
});
|
||||
return;
|
||||
}
|
||||
if(this.uploading){
|
||||
this.$message({
|
||||
message: "文件正在上传,请勿取消",
|
||||
type: "warning",
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.file = e.target.files[0];
|
||||
var userData = '{"Vod":{}}'
|
||||
/**if (this.uploader) {
|
||||
this.uploader.stopUpload()
|
||||
this.authProgress = 0
|
||||
this.statusText = ""
|
||||
}**/
|
||||
this.videoFrom.fileName = this.file.name;
|
||||
if(this.videoFrom.fileName == null || this.videoFrom.fileName.length == 0 || this.videoFrom.fileName.lastIndexOf(".") == -1){
|
||||
this.$message({
|
||||
message: "当前文件名称错误",
|
||||
type: "warning",
|
||||
});
|
||||
return;
|
||||
}
|
||||
let fileType = this.videoFrom.fileName.substring(this.videoFrom.fileName.lastIndexOf(".")+1);
|
||||
if(this.fileType.indexOf(fileType) == -1){
|
||||
this.$message({
|
||||
message: "当前文件格式错误",
|
||||
type: "warning",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
getUploadVideoAuth(this.videoFrom).then(response => {
|
||||
if(response.code == 200){
|
||||
this.uploadAuth = response.uploadAuth;
|
||||
this.uploader = this.createUploader()
|
||||
this.uploader.addFile(this.file, null, null, null, userData)
|
||||
this.uploadDisabled = false
|
||||
this.pauseDisabled = true
|
||||
this.resumeDisabled = true
|
||||
}
|
||||
})
|
||||
|
||||
this.$refs["videoFrom"].validate((valid) => {
|
||||
if (valid) {
|
||||
if(this.uploading){
|
||||
this.$message({
|
||||
message: "文件正在上传,请勿取消",
|
||||
type: "warning",
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.file = e.target.files[0];
|
||||
var userData = '{"Vod":{}}'
|
||||
/**if (this.uploader) {
|
||||
this.uploader.stopUpload()
|
||||
this.authProgress = 0
|
||||
this.statusText = ""
|
||||
}**/
|
||||
this.videoFrom.fileName = this.file.name;
|
||||
if(this.videoFrom.fileName == null || this.videoFrom.fileName.length == 0 || this.videoFrom.fileName.lastIndexOf(".") == -1){
|
||||
this.$message({
|
||||
message: "当前文件名称错误",
|
||||
type: "warning",
|
||||
});
|
||||
return;
|
||||
}
|
||||
let fileType = this.videoFrom.fileName.substring(this.videoFrom.fileName.lastIndexOf(".")+1);
|
||||
if(this.fileType.indexOf(fileType) == -1){
|
||||
this.$message({
|
||||
message: "当前文件格式错误",
|
||||
type: "warning",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
getUploadVideoAuth(this.videoFrom).then(response => {
|
||||
if(response.code == 200){
|
||||
this.uploadAuth = response.uploadAuth;
|
||||
console.log(this.uploadAuth);
|
||||
this.videoFrom.videoId = this.uploadAuth.videoId;
|
||||
this.uploader = this.createUploader()
|
||||
this.uploader.addFile(this.file, null, null, null, userData)
|
||||
this.uploadDisabled = false
|
||||
this.pauseDisabled = true
|
||||
this.resumeDisabled = true
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
authUpload () {
|
||||
// 然后调用 startUpload 方法, 开始上传
|
||||
@ -259,9 +329,15 @@
|
||||
onUploadEnd: function (uploadInfo) {
|
||||
self.statusText = '文件上传完毕'
|
||||
self.uploading = false;
|
||||
self.msgSuccess("上传成功");
|
||||
self.open = false;
|
||||
self.callback && self.callback();
|
||||
//self.msgSuccess("上传成功");
|
||||
self.videoFrom.showFlag = self.videoFrom.wxShow ? 1 : 0;
|
||||
addNutritionalVideo(self.videoFrom).then(response => {
|
||||
if (response.code === 200) {
|
||||
self.msgSuccess("视频上传成功");
|
||||
self.open = false;
|
||||
self.callback && self.callback();
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
return uploader
|
||||
|
@ -12,6 +12,7 @@
|
||||
v-model="queryParams.postId"
|
||||
placeholder="请选择岗位"
|
||||
clearable
|
||||
filterable
|
||||
size="small"
|
||||
@change="searchPostChange"
|
||||
>
|
||||
@ -28,6 +29,7 @@
|
||||
v-model="queryParams.userId"
|
||||
placeholder="请选择业务员"
|
||||
clearable
|
||||
filterable
|
||||
size="small"
|
||||
>
|
||||
<el-option
|
||||
@ -119,6 +121,7 @@
|
||||
{{ scope.row.rate + "%" }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="开始时间" align="center" prop="startTime"/>
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column
|
||||
label="操作"
|
||||
@ -196,6 +199,16 @@
|
||||
<el-input v-model="form.rate" placeholder="请输入比例" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="开始时间" prop="startTime">
|
||||
<el-date-picker
|
||||
v-model="form.startTime"
|
||||
value-format="yyyy-MM-dd"
|
||||
type="month"
|
||||
placeholder="选择开始时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input
|
||||
@ -240,7 +253,7 @@ export default {
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: false,
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 业务提成比例表格数据
|
||||
@ -282,6 +295,9 @@ export default {
|
||||
rate: [
|
||||
{ required: true, message: "分成比例不能为空", trigger: "blur" },
|
||||
],
|
||||
startTime: [
|
||||
{ required: true, message: "开始时间不能为空", trigger: "blur" },
|
||||
],
|
||||
},
|
||||
};
|
||||
},
|
||||
@ -396,6 +412,7 @@ export default {
|
||||
userName: null,
|
||||
amount: null,
|
||||
rate: null,
|
||||
startTime: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
|
@ -9,7 +9,7 @@
|
||||
size="small"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="展示状态" prop="showFlag">
|
||||
<el-form-item label="小程序展示状态" prop="showFlag" label-width="200">
|
||||
<el-select
|
||||
v-model="queryParams.showFlag"
|
||||
placeholder="请选择展示状态"
|
||||
|
@ -1,11 +1,50 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!--<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="关键词" prop="key">
|
||||
<el-input
|
||||
v-model="queryParams.key"
|
||||
placeholder="请输入关键词"
|
||||
clearable
|
||||
size="small"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="小程序展示状态" prop="showFlag" label-width="200">
|
||||
<el-select
|
||||
v-model="queryParams.showFlag"
|
||||
placeholder="请选示状态"
|
||||
clearable
|
||||
size="small"
|
||||
>
|
||||
<el-option key="0" label="不展示" value="0"/>
|
||||
<el-option key="1" label="展示" value="1"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="视频类别" prop="cateId">
|
||||
<el-select v-model="queryParams.cateId" clearable filterable placeholder="请选择类别">
|
||||
<el-option
|
||||
v-for="classify in classifyList"
|
||||
:key="classify.id"
|
||||
:label="classify.cateName"
|
||||
:value="classify.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="视频权限" prop="payLevel">
|
||||
<el-select v-model="queryParams.payLevel" clearable filterable placeholder="请选择权限">
|
||||
<el-option
|
||||
v-for="dict in payVideoLevelList"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="parseInt(dict.dictValue)"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>-->
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
@ -17,7 +56,7 @@
|
||||
v-hasPermi="['custom:nutritionalVideo:add']"
|
||||
>视频上传</el-button>
|
||||
</el-col>
|
||||
<!--<el-col :span="1.5">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
icon="el-icon-edit"
|
||||
@ -37,6 +76,7 @@
|
||||
v-hasPermi="['custom:nutritionalVideo:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<!--
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
@ -52,24 +92,32 @@
|
||||
<el-table v-loading="loading" :data="nutritionalVideoList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<!--<el-table-column label="视频分类ID" align="center" prop="cateId" />-->
|
||||
<el-table-column label="封面" align="center" prop="coverUrl">
|
||||
<el-table-column label="封面" align="center" prop="coverUrl" width="300">
|
||||
<template slot-scope="scope">
|
||||
<el-image title="点击大图预览"
|
||||
style="width: 200px; height: 200px"
|
||||
<el-image
|
||||
style="width: 300px; height: 200px"
|
||||
:src="scope.row.coverUrl"
|
||||
:preview-src-list="coverImageList">
|
||||
</el-image>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="标题" align="center" prop="title" />
|
||||
<el-table-column label="标题" align="center" prop="title" width="200"/>
|
||||
<el-table-column label="描述" align="center" prop="description" />
|
||||
<el-table-column label="标签" align="center" prop="tags" />
|
||||
<el-table-column label="显示状态" align="center" prop="showFlag">
|
||||
<template slot-scope="scope">
|
||||
{{scope.row.showFlag == 1 ? '正常' : '屏蔽'}}
|
||||
<!--<el-table-column label="标签" align="center" prop="tags" width="100"/>-->
|
||||
<el-table-column label="分类" align="center" prop="cateName" width="100"/>
|
||||
<el-table-column label="权限等级" align="center" prop="payLevelName" width="100"/>
|
||||
<el-table-column label="小程序展示状态" align="center" prop="showFlag" width="200">
|
||||
<template slot-scope="scope" >
|
||||
<el-switch
|
||||
v-model="scope.row.wxShow"
|
||||
active-text="展示"
|
||||
inactive-text="不展示"
|
||||
@change="handleWxShow($event, scope.row)"
|
||||
>
|
||||
</el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!--<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<el-table-column label="操作" align="center" width="200">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
@ -86,9 +134,11 @@
|
||||
v-hasPermi="['custom:nutritionalVideo:remove']"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>-->
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
@ -99,33 +149,61 @@
|
||||
/>
|
||||
|
||||
<!-- 添加或修改营养视频对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-dialog :title="title" :visible.sync="open" width="700px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="视频分类ID" prop="cateId">
|
||||
<el-input v-model="form.cateId" placeholder="请输入视频分类ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="阿里云视频ID" prop="videoId">
|
||||
<el-input v-model="form.videoId" placeholder="请输入阿里云视频ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="视频封面URL" prop="coverUrl">
|
||||
<el-input v-model="form.coverUrl" placeholder="请输入视频封面URL" />
|
||||
</el-form-item>
|
||||
<el-form-item label="视频标题" prop="title">
|
||||
<el-input v-model="form.title" placeholder="请输入视频标题" />
|
||||
<el-input
|
||||
type="textarea"
|
||||
placeholder="请输入视频标题"
|
||||
v-model="form.title"
|
||||
maxlength="50"
|
||||
rows="1"
|
||||
show-word-limit
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="视频描述" prop="description">
|
||||
<el-input v-model="form.description" placeholder="请输入视频描述" />
|
||||
</el-form-item>
|
||||
<el-form-item label="视频大小,单位:字节" prop="videoSize">
|
||||
<el-input v-model="form.videoSize" placeholder="请输入视频大小,单位:字节" />
|
||||
</el-form-item>
|
||||
<el-form-item label="标签,使用 , 隔开" prop="tags">
|
||||
<el-input v-model="form.tags" placeholder="请输入标签,使用 , 隔开" />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否显示,0不显示 1显示,默认0" prop="showFlag">
|
||||
<el-input v-model="form.showFlag" placeholder="请输入是否显示,0不显示 1显示,默认0" />
|
||||
<el-input
|
||||
type="textarea"
|
||||
placeholder="请输入视频描述"
|
||||
v-model="form.description"
|
||||
maxlength="1000"
|
||||
rows="2"
|
||||
show-word-limit
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="视频封面" prop="coverUrl">
|
||||
<UploadFile ref="uploadFile" :prefix="'videoCover'" :coverUrl="form.previewUrl" @callbackMethod="handleCoverUrl"></UploadFile>
|
||||
</el-form-item>
|
||||
<el-form-item label="视频类别" prop="cateId">
|
||||
<el-select v-model="form.cateId" clearable filterable placeholder="请选择类别">
|
||||
<el-option
|
||||
v-for="classify in classifyList"
|
||||
:key="classify.id"
|
||||
:label="classify.cateName"
|
||||
:value="classify.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="视频权限" prop="payLevel">
|
||||
<el-select v-model="form.payLevel" clearable filterable placeholder="请选择权限">
|
||||
<el-option
|
||||
v-for="dict in payVideoLevelList"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="parseInt(dict.dictValue)"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="展示状态" prop="wxShow">
|
||||
<el-switch
|
||||
v-model="form.wxShow"
|
||||
active-text="小程序展示"
|
||||
inactive-text="小程序不展示">
|
||||
</el-switch>
|
||||
<div>提示:请保证内容正确再展示到小程序</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
@ -137,9 +215,10 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listNutritionalVideo, getNutritionalVideo, delNutritionalVideo, addNutritionalVideo, updateNutritionalVideo, exportNutritionalVideo,getUploadVideoAuth } from "@/api/custom/nutritionalVideo";
|
||||
|
||||
import { listNutritionalVideo, getNutritionalVideo, delNutritionalVideo, addNutritionalVideo, updateNutritionalVideo, exportNutritionalVideo, updateWxShow } from "@/api/custom/nutritionalVideo";
|
||||
import {getAllClassify } from "@/api/custom/videoClassify";
|
||||
import UploadVideo from "@/components/UploadVideo";
|
||||
import UploadFile from "@/components/FileUpload/UploadFile";
|
||||
export default {
|
||||
name: "NutritionalVideo",
|
||||
data() {
|
||||
@ -166,29 +245,48 @@
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 5,
|
||||
key: null,
|
||||
showFlag: null,
|
||||
cateId: null,
|
||||
payLevel: null
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
},
|
||||
coverImageList:[]
|
||||
coverImageList:[],
|
||||
//分类列表
|
||||
classifyList:[],
|
||||
//权限等级列表
|
||||
payVideoLevelList:[]
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
getAllClassify().then(response => {
|
||||
if(response.code == 200){
|
||||
this.classifyList = response.data;
|
||||
}
|
||||
});
|
||||
this.getDicts("video_pay_level").then((response) => {
|
||||
this.payVideoLevelList = response.data;
|
||||
});
|
||||
},
|
||||
components: {
|
||||
UploadVideo
|
||||
UploadVideo,UploadFile
|
||||
},
|
||||
methods: {
|
||||
/** 查询营养视频列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listNutritionalVideo(this.queryParams).then(response => {
|
||||
response.rows.forEach(element => {
|
||||
element.wxShow = element.showFlag == 1 ? true : false;
|
||||
});
|
||||
this.nutritionalVideoList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
@ -201,18 +299,13 @@
|
||||
this.form = {
|
||||
id: null,
|
||||
cateId: null,
|
||||
videoId: null,
|
||||
coverUrl: null,
|
||||
title: null,
|
||||
description: null,
|
||||
videoSize: null,
|
||||
tags: null,
|
||||
payLevel:null,
|
||||
showFlag: null,
|
||||
createTime: null,
|
||||
createBy: null,
|
||||
updateTime: null,
|
||||
updateBy: null,
|
||||
delFlag: null
|
||||
wxShow: false
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
@ -248,15 +341,17 @@
|
||||
this.reset();
|
||||
const id = row.id || this.ids
|
||||
getNutritionalVideo(id).then(response => {
|
||||
response.data.wxShow = response.data.showFlag == 1 ? true : false;
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改营养视频";
|
||||
});
|
||||
this.open = true;
|
||||
this.title = "修改营养视频";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
this.form.showFlag = this.form.wxShow ? 1 : 0;
|
||||
if (this.form.id != null) {
|
||||
updateNutritionalVideo(this.form).then(response => {
|
||||
if (response.code === 200) {
|
||||
@ -277,6 +372,16 @@
|
||||
}
|
||||
});
|
||||
},
|
||||
handleWxShow(newWxshow, row){
|
||||
let param = {
|
||||
id: row.id,
|
||||
showFlag: newWxshow ? 1 : 0
|
||||
};
|
||||
updateWxShow(param);
|
||||
},
|
||||
handleCoverUrl(url){
|
||||
this.form.coverUrl = url;
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
|
Reference in New Issue
Block a user