汉丰湖Vlog短视频应用系统

This commit is contained in:
卢序振 2024-06-11 13:55:54 +08:00
parent d744d2a39a
commit 068bb884d1
8 changed files with 1225 additions and 0 deletions

View File

@ -0,0 +1,98 @@
package com.god.templateInfo.controller;
import com.god.common.annotation.Log;
import com.god.common.core.controller.BaseController;
import com.god.common.core.domain.AjaxResult;
import com.god.common.core.page.TableDataInfo;
import com.god.common.enums.BusinessType;
import com.god.common.utils.poi.ExcelUtil;
import com.god.templateInfo.domain.GodTemplateInfo;
import com.god.templateInfo.service.IGodTemplateInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 模板管理Controller
*
* @author Lxz
* @date 2024-06-11
*/
@RestController
@RequestMapping("/godTemplateInfo/templateInfo")
public class GodTemplateInfoController extends BaseController
{
@Autowired
private IGodTemplateInfoService godTemplateInfoService;
/**
* 查询模板管理列表
*/
@PreAuthorize("@ss.hasPermi('godTemplateInfo:templateInfo:list')")
@GetMapping("/list")
public TableDataInfo list(GodTemplateInfo godTemplateInfo)
{
startPage();
List<GodTemplateInfo> list = godTemplateInfoService.selectGodTemplateInfoList(godTemplateInfo);
return getDataTable(list);
}
/**
* 导出模板管理列表
*/
@PreAuthorize("@ss.hasPermi('godTemplateInfo:templateInfo:export')")
@Log(title = "模板管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, GodTemplateInfo godTemplateInfo)
{
List<GodTemplateInfo> list = godTemplateInfoService.selectGodTemplateInfoList(godTemplateInfo);
ExcelUtil<GodTemplateInfo> util = new ExcelUtil<GodTemplateInfo>(GodTemplateInfo.class);
util.exportExcel(response, list, "模板管理数据");
}
/**
* 获取模板管理详细信息
*/
@PreAuthorize("@ss.hasPermi('godTemplateInfo:templateInfo:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id)
{
return success(godTemplateInfoService.selectGodTemplateInfoById(id));
}
/**
* 新增模板管理
*/
@PreAuthorize("@ss.hasPermi('godTemplateInfo:templateInfo:add')")
@Log(title = "模板管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody GodTemplateInfo godTemplateInfo)
{
return toAjax(godTemplateInfoService.insertGodTemplateInfo(godTemplateInfo));
}
/**
* 修改模板管理
*/
@PreAuthorize("@ss.hasPermi('godTemplateInfo:templateInfo:edit')")
@Log(title = "模板管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody GodTemplateInfo godTemplateInfo)
{
return toAjax(godTemplateInfoService.updateGodTemplateInfo(godTemplateInfo));
}
/**
* 删除模板管理
*/
@PreAuthorize("@ss.hasPermi('godTemplateInfo:templateInfo:remove')")
@Log(title = "模板管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids)
{
return toAjax(godTemplateInfoService.deleteGodTemplateInfoByIds(ids));
}
}

View File

@ -0,0 +1,262 @@
package com.god.templateInfo.domain;
import com.god.common.annotation.Excel;
import com.god.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 模板管理对象 god_template_info
*
* @author Lxz
* @date 2024-06-11
*/
public class GodTemplateInfo extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private String id;
/** 模板名称 */
@Excel(name = "模板名称")
private String templateName;
/** 模板类型 */
@Excel(name = "模板类型")
private String templateType;
/** 价格 */
@Excel(name = "价格")
private String price;
/** 视频 */
@Excel(name = "视频")
private String video;
/** 时间 */
@Excel(name = "时间")
private String times;
/** 系统类型 */
@Excel(name = "系统类型")
private String sysType;
/** 模块类型 */
@Excel(name = "模块类型")
private String moduleType;
/** 预留1 */
@Excel(name = "预留1")
private String reserveOne;
/** 预留2 */
@Excel(name = "预留2")
private String reserveTwo;
/** 预留3 */
@Excel(name = "预留3")
private String reserveThree;
/** 预留4 */
@Excel(name = "预留4")
private String reserveFour;
/** 预留5 */
@Excel(name = "预留5")
private String reserveFive;
/** 预留6 */
@Excel(name = "预留6")
private String reserveSix;
/** 预留7 */
@Excel(name = "预留7")
private String reserveSeven;
/** 预留8 */
@Excel(name = "预留8")
private String reserveEight;
/** 预留9 */
@Excel(name = "预留9")
private String reserveNine;
public void setId(String id)
{
this.id = id;
}
public String getId()
{
return id;
}
public void setTemplateName(String templateName)
{
this.templateName = templateName;
}
public String getTemplateName()
{
return templateName;
}
public void setTemplateType(String templateType)
{
this.templateType = templateType;
}
public String getTemplateType()
{
return templateType;
}
public void setPrice(String price)
{
this.price = price;
}
public String getPrice()
{
return price;
}
public void setVideo(String video)
{
this.video = video;
}
public String getVideo()
{
return video;
}
public void setTimes(String times)
{
this.times = times;
}
public String getTimes()
{
return times;
}
public void setSysType(String sysType)
{
this.sysType = sysType;
}
public String getSysType()
{
return sysType;
}
public void setModuleType(String moduleType)
{
this.moduleType = moduleType;
}
public String getModuleType()
{
return moduleType;
}
public void setReserveOne(String reserveOne)
{
this.reserveOne = reserveOne;
}
public String getReserveOne()
{
return reserveOne;
}
public void setReserveTwo(String reserveTwo)
{
this.reserveTwo = reserveTwo;
}
public String getReserveTwo()
{
return reserveTwo;
}
public void setReserveThree(String reserveThree)
{
this.reserveThree = reserveThree;
}
public String getReserveThree()
{
return reserveThree;
}
public void setReserveFour(String reserveFour)
{
this.reserveFour = reserveFour;
}
public String getReserveFour()
{
return reserveFour;
}
public void setReserveFive(String reserveFive)
{
this.reserveFive = reserveFive;
}
public String getReserveFive()
{
return reserveFive;
}
public void setReserveSix(String reserveSix)
{
this.reserveSix = reserveSix;
}
public String getReserveSix()
{
return reserveSix;
}
public void setReserveSeven(String reserveSeven)
{
this.reserveSeven = reserveSeven;
}
public String getReserveSeven()
{
return reserveSeven;
}
public void setReserveEight(String reserveEight)
{
this.reserveEight = reserveEight;
}
public String getReserveEight()
{
return reserveEight;
}
public void setReserveNine(String reserveNine)
{
this.reserveNine = reserveNine;
}
public String getReserveNine()
{
return reserveNine;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("templateName", getTemplateName())
.append("templateType", getTemplateType())
.append("price", getPrice())
.append("video", getVideo())
.append("times", getTimes())
.append("remark", getRemark())
.append("sysType", getSysType())
.append("moduleType", getModuleType())
.append("reserveOne", getReserveOne())
.append("reserveTwo", getReserveTwo())
.append("reserveThree", getReserveThree())
.append("reserveFour", getReserveFour())
.append("reserveFive", getReserveFive())
.append("reserveSix", getReserveSix())
.append("reserveSeven", getReserveSeven())
.append("reserveEight", getReserveEight())
.append("reserveNine", getReserveNine())
.toString();
}
}

View File

@ -0,0 +1,62 @@
package com.god.templateInfo.mapper;
import com.god.templateInfo.domain.GodTemplateInfo;
import java.util.List;
/**
* 模板管理Mapper接口
*
* @author Lxz
* @date 2024-06-11
*/
public interface GodTemplateInfoMapper
{
/**
* 查询模板管理
*
* @param id 模板管理主键
* @return 模板管理
*/
public GodTemplateInfo selectGodTemplateInfoById(String id);
/**
* 查询模板管理列表
*
* @param godTemplateInfo 模板管理
* @return 模板管理集合
*/
public List<GodTemplateInfo> selectGodTemplateInfoList(GodTemplateInfo godTemplateInfo);
/**
* 新增模板管理
*
* @param godTemplateInfo 模板管理
* @return 结果
*/
public int insertGodTemplateInfo(GodTemplateInfo godTemplateInfo);
/**
* 修改模板管理
*
* @param godTemplateInfo 模板管理
* @return 结果
*/
public int updateGodTemplateInfo(GodTemplateInfo godTemplateInfo);
/**
* 删除模板管理
*
* @param id 模板管理主键
* @return 结果
*/
public int deleteGodTemplateInfoById(String id);
/**
* 批量删除模板管理
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteGodTemplateInfoByIds(String[] ids);
}

View File

@ -0,0 +1,62 @@
package com.god.templateInfo.service;
import com.god.templateInfo.domain.GodTemplateInfo;
import java.util.List;
/**
* 模板管理Service接口
*
* @author Lxz
* @date 2024-06-11
*/
public interface IGodTemplateInfoService
{
/**
* 查询模板管理
*
* @param id 模板管理主键
* @return 模板管理
*/
public GodTemplateInfo selectGodTemplateInfoById(String id);
/**
* 查询模板管理列表
*
* @param godTemplateInfo 模板管理
* @return 模板管理集合
*/
public List<GodTemplateInfo> selectGodTemplateInfoList(GodTemplateInfo godTemplateInfo);
/**
* 新增模板管理
*
* @param godTemplateInfo 模板管理
* @return 结果
*/
public int insertGodTemplateInfo(GodTemplateInfo godTemplateInfo);
/**
* 修改模板管理
*
* @param godTemplateInfo 模板管理
* @return 结果
*/
public int updateGodTemplateInfo(GodTemplateInfo godTemplateInfo);
/**
* 批量删除模板管理
*
* @param ids 需要删除的模板管理主键集合
* @return 结果
*/
public int deleteGodTemplateInfoByIds(String[] ids);
/**
* 删除模板管理信息
*
* @param id 模板管理主键
* @return 结果
*/
public int deleteGodTemplateInfoById(String id);
}

View File

@ -0,0 +1,94 @@
package com.god.templateInfo.service.impl;
import com.god.templateInfo.domain.GodTemplateInfo;
import com.god.templateInfo.mapper.GodTemplateInfoMapper;
import com.god.templateInfo.service.IGodTemplateInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 模板管理Service业务层处理
*
* @author Lxz
* @date 2024-06-11
*/
@Service
public class GodTemplateInfoServiceImpl implements IGodTemplateInfoService
{
@Autowired
private GodTemplateInfoMapper godTemplateInfoMapper;
/**
* 查询模板管理
*
* @param id 模板管理主键
* @return 模板管理
*/
@Override
public GodTemplateInfo selectGodTemplateInfoById(String id)
{
return godTemplateInfoMapper.selectGodTemplateInfoById(id);
}
/**
* 查询模板管理列表
*
* @param godTemplateInfo 模板管理
* @return 模板管理
*/
@Override
public List<GodTemplateInfo> selectGodTemplateInfoList(GodTemplateInfo godTemplateInfo)
{
return godTemplateInfoMapper.selectGodTemplateInfoList(godTemplateInfo);
}
/**
* 新增模板管理
*
* @param godTemplateInfo 模板管理
* @return 结果
*/
@Override
public int insertGodTemplateInfo(GodTemplateInfo godTemplateInfo)
{
return godTemplateInfoMapper.insertGodTemplateInfo(godTemplateInfo);
}
/**
* 修改模板管理
*
* @param godTemplateInfo 模板管理
* @return 结果
*/
@Override
public int updateGodTemplateInfo(GodTemplateInfo godTemplateInfo)
{
return godTemplateInfoMapper.updateGodTemplateInfo(godTemplateInfo);
}
/**
* 批量删除模板管理
*
* @param ids 需要删除的模板管理主键
* @return 结果
*/
@Override
public int deleteGodTemplateInfoByIds(String[] ids)
{
return godTemplateInfoMapper.deleteGodTemplateInfoByIds(ids);
}
/**
* 删除模板管理信息
*
* @param id 模板管理主键
* @return 结果
*/
@Override
public int deleteGodTemplateInfoById(String id)
{
return godTemplateInfoMapper.deleteGodTemplateInfoById(id);
}
}

View File

@ -0,0 +1,137 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.god.templateInfo.mapper.GodTemplateInfoMapper">
<resultMap type="GodTemplateInfo" id="GodTemplateInfoResult">
<result property="id" column="id" />
<result property="templateName" column="template_name" />
<result property="templateType" column="template_type" />
<result property="price" column="price" />
<result property="video" column="video" />
<result property="times" column="times" />
<result property="remark" column="remark" />
<result property="sysType" column="sys_type" />
<result property="moduleType" column="module_type" />
<result property="reserveOne" column="reserve_one" />
<result property="reserveTwo" column="reserve_two" />
<result property="reserveThree" column="reserve_three" />
<result property="reserveFour" column="reserve_four" />
<result property="reserveFive" column="reserve_five" />
<result property="reserveSix" column="reserve_six" />
<result property="reserveSeven" column="reserve_seven" />
<result property="reserveEight" column="reserve_eight" />
<result property="reserveNine" column="reserve_nine" />
</resultMap>
<sql id="selectGodTemplateInfoVo">
select id, template_name, template_type, price, video, times, remark, sys_type, module_type, reserve_one, reserve_two, reserve_three, reserve_four, reserve_five, reserve_six, reserve_seven, reserve_eight, reserve_nine from god_template_info
</sql>
<select id="selectGodTemplateInfoList" parameterType="GodTemplateInfo" resultMap="GodTemplateInfoResult">
<include refid="selectGodTemplateInfoVo"/>
<where>
<if test="templateName != null and templateName != ''"> and template_name like concat('%', #{templateName}, '%')</if>
<if test="templateType != null and templateType != ''"> and template_type = #{templateType}</if>
<if test="price != null and price != ''"> and price = #{price}</if>
<if test="video != null and video != ''"> and video = #{video}</if>
<if test="times != null and times != ''"> and times = #{times}</if>
<if test="sysType != null and sysType != ''"> and sys_type = #{sysType}</if>
<if test="moduleType != null and moduleType != ''"> and module_type = #{moduleType}</if>
<if test="reserveOne != null and reserveOne != ''"> and reserve_one = #{reserveOne}</if>
<if test="reserveTwo != null and reserveTwo != ''"> and reserve_two = #{reserveTwo}</if>
<if test="reserveThree != null and reserveThree != ''"> and reserve_three = #{reserveThree}</if>
<if test="reserveFour != null and reserveFour != ''"> and reserve_four = #{reserveFour}</if>
<if test="reserveFive != null and reserveFive != ''"> and reserve_five = #{reserveFive}</if>
<if test="reserveSix != null and reserveSix != ''"> and reserve_six = #{reserveSix}</if>
<if test="reserveSeven != null and reserveSeven != ''"> and reserve_seven = #{reserveSeven}</if>
<if test="reserveEight != null and reserveEight != ''"> and reserve_eight = #{reserveEight}</if>
<if test="reserveNine != null and reserveNine != ''"> and reserve_nine = #{reserveNine}</if>
</where>
</select>
<select id="selectGodTemplateInfoById" parameterType="String" resultMap="GodTemplateInfoResult">
<include refid="selectGodTemplateInfoVo"/>
where id = #{id}
</select>
<insert id="insertGodTemplateInfo" parameterType="GodTemplateInfo">
insert into god_template_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="templateName != null">template_name,</if>
<if test="templateType != null">template_type,</if>
<if test="price != null">price,</if>
<if test="video != null">video,</if>
<if test="times != null">times,</if>
<if test="remark != null">remark,</if>
<if test="sysType != null">sys_type,</if>
<if test="moduleType != null">module_type,</if>
<if test="reserveOne != null">reserve_one,</if>
<if test="reserveTwo != null">reserve_two,</if>
<if test="reserveThree != null">reserve_three,</if>
<if test="reserveFour != null">reserve_four,</if>
<if test="reserveFive != null">reserve_five,</if>
<if test="reserveSix != null">reserve_six,</if>
<if test="reserveSeven != null">reserve_seven,</if>
<if test="reserveEight != null">reserve_eight,</if>
<if test="reserveNine != null">reserve_nine,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="templateName != null">#{templateName},</if>
<if test="templateType != null">#{templateType},</if>
<if test="price != null">#{price},</if>
<if test="video != null">#{video},</if>
<if test="times != null">#{times},</if>
<if test="remark != null">#{remark},</if>
<if test="sysType != null">#{sysType},</if>
<if test="moduleType != null">#{moduleType},</if>
<if test="reserveOne != null">#{reserveOne},</if>
<if test="reserveTwo != null">#{reserveTwo},</if>
<if test="reserveThree != null">#{reserveThree},</if>
<if test="reserveFour != null">#{reserveFour},</if>
<if test="reserveFive != null">#{reserveFive},</if>
<if test="reserveSix != null">#{reserveSix},</if>
<if test="reserveSeven != null">#{reserveSeven},</if>
<if test="reserveEight != null">#{reserveEight},</if>
<if test="reserveNine != null">#{reserveNine},</if>
</trim>
</insert>
<update id="updateGodTemplateInfo" parameterType="GodTemplateInfo">
update god_template_info
<trim prefix="SET" suffixOverrides=",">
<if test="templateName != null">template_name = #{templateName},</if>
<if test="templateType != null">template_type = #{templateType},</if>
<if test="price != null">price = #{price},</if>
<if test="video != null">video = #{video},</if>
<if test="times != null">times = #{times},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="sysType != null">sys_type = #{sysType},</if>
<if test="moduleType != null">module_type = #{moduleType},</if>
<if test="reserveOne != null">reserve_one = #{reserveOne},</if>
<if test="reserveTwo != null">reserve_two = #{reserveTwo},</if>
<if test="reserveThree != null">reserve_three = #{reserveThree},</if>
<if test="reserveFour != null">reserve_four = #{reserveFour},</if>
<if test="reserveFive != null">reserve_five = #{reserveFive},</if>
<if test="reserveSix != null">reserve_six = #{reserveSix},</if>
<if test="reserveSeven != null">reserve_seven = #{reserveSeven},</if>
<if test="reserveEight != null">reserve_eight = #{reserveEight},</if>
<if test="reserveNine != null">reserve_nine = #{reserveNine},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteGodTemplateInfoById" parameterType="String">
delete from god_template_info where id = #{id}
</delete>
<delete id="deleteGodTemplateInfoByIds" parameterType="String">
delete from god_template_info where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询模板管理列表
export function listTemplateInfo(query) {
return request({
url: '/godTemplateInfo/templateInfo/list',
method: 'get',
params: query
})
}
// 查询模板管理详细
export function getTemplateInfo(id) {
return request({
url: '/godTemplateInfo/templateInfo/' + id,
method: 'get'
})
}
// 新增模板管理
export function addTemplateInfo(data) {
return request({
url: '/godTemplateInfo/templateInfo',
method: 'post',
data: data
})
}
// 修改模板管理
export function updateTemplateInfo(data) {
return request({
url: '/godTemplateInfo/templateInfo',
method: 'put',
data: data
})
}
// 删除模板管理
export function delTemplateInfo(id) {
return request({
url: '/godTemplateInfo/templateInfo/' + id,
method: 'delete'
})
}

View File

@ -0,0 +1,466 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="模板名称" prop="templateName">
<el-input
v-model="queryParams.templateName"
placeholder="请输入模板名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="模板类型" prop="templateType">
<el-select v-model="queryParams.templateType" placeholder="请选择模板类型" clearable>
<el-option
v-for="dict in dict.type.template_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="价格" prop="price">
<el-input
v-model="queryParams.price"
placeholder="请输入价格"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" 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-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['godTemplateInfo:templateInfo:add']"
>新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['godTemplateInfo:templateInfo:edit']"
>修改
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['godTemplateInfo:templateInfo:remove']"
>删除
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['godTemplateInfo:templateInfo:export']"
>导出
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="templateInfoList" @selection-change="handleSelectionChange" border>
<el-table-column type="selection" width="55" align="center"/>
<el-table-column label="模板名称" align="center" prop="templateName"/>
<el-table-column label="模板类型" align="center" prop="templateType">
<template slot-scope="scope">
<dict-tag :options="dict.type.template_type" :value="scope.row.templateType"/>
</template>
</el-table-column>
<el-table-column label="价格" align="center" prop="price"/>
<el-table-column label="视频" align="center" prop="video" show-overflow-tooltip/>
<el-table-column label="时间" align="center" prop="times"/>
<el-table-column label="备注" align="center" prop="remark"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['godTemplateInfo:templateInfo:edit']"
>修改
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['godTemplateInfo:templateInfo:remove']"
>删除
</el-button>
<el-button size="mini" type="text" icon="el-icon-video-camera" @click="playVideo(scope.row)"
v-hasPermi="['species:video:remove']"
>查看视频
</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改模板管理对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<!-- <el-form-item label="主键" prop="id">-->
<!-- <el-input v-model="form.id" placeholder="请输入主键"/>-->
<!-- </el-form-item>-->
<el-form-item label="模板名称" prop="templateName">
<el-input v-model="form.templateName" placeholder="请输入模板名称"/>
</el-form-item>
<el-form-item label="模板类型" prop="templateType">
<el-select v-model="form.templateType" placeholder="请选择模板类型">
<el-option
v-for="dict in dict.type.template_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="价格" prop="price">
<el-input v-model="form.price" placeholder="请输入价格"/>
</el-form-item>
<el-form-item label="视频" prop="video">
<el-input v-model="form.video" placeholder="请上传视频" disabled/>
<el-upload class="upload-demo" ref="uploadFile" action="" :on-preview="handlePreview"
:on-remove="handleRemoveFiles" :on-change="handleChangeFiles" :before-upload="beforeUploadFiles"
:file-list="fileList" :auto-upload="true" multiple
>
<el-button size="small" type="primary">上传视频</el-button>
<div slot="tip" class="el-upload__tip">只能上传mp4文件且不超过100M</div>
</el-upload>
</el-form-item>
<!-- <el-form-item label="文件上传">-->
<!-- <el-upload class="upload-demo" ref="uploadFile" action="" :on-preview="handlePreview"-->
<!-- :on-remove="handleRemoveFiles" :on-change="handleChangeFiles" :before-upload="beforeUploadFiles"-->
<!-- :file-list="fileList" :auto-upload="true" multiple-->
<!-- >-->
<!-- <el-button size="small" type="primary">上传视频</el-button>-->
<!-- <div slot="tip" class="el-upload__tip">只能上传mp4文件且不超过100M</div>-->
<!-- </el-upload>-->
<!-- </el-form-item>-->
<el-form-item label="时间" prop="times">
<el-input v-model="form.times" placeholder="请输入时间"/>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注"/>
</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>
</div>
</el-dialog>
<el-dialog title :visible="isShow" width="600px" @close="closeDialog" class="videoBox">
<video
:src="videoUrl"
controls
autoplay
class="video"
width="100%"
></video>
</el-dialog>
</div>
</template>
<script>
import {
listTemplateInfo,
getTemplateInfo,
delTemplateInfo,
addTemplateInfo,
updateTemplateInfo
} from "@/api/godTemplateInfo/templateInfo";
import request from "@/utils/request";
import {getToken} from "@/utils/auth";
export default {
name: "TemplateInfo",
dicts: ['template_type'],
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
templateInfoList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
templateName: null,
templateType: null,
price: null,
video: null,
times: null,
sysType: null,
moduleType: null,
reserveOne: null,
reserveTwo: null,
reserveThree: null,
reserveFour: null,
reserveFive: null,
reserveSix: null,
reserveSeven: null,
reserveEight: null,
reserveNine: null
},
//
form: {},
//
rules: {},
//
fileInfoList: [],
fileList: [],
//
upload: {
//
headers: { Authorization: 'Bearer ' + getToken() },
// TODO
url: '/species/video/upload/file',
//
imageUrl: '',
//
data: {
tableName: '',
linkId: '',
workId: ''
}
},
isShow: false,
videoUrl: '',
baseUrl: process.env.VUE_APP_BASE_API
};
},
created() {
this.getList();
},
methods: {
//
playVideo(row) {
this.isShow = true
// src
let url1 = row.video
// this.videoUrl=this.baseUrl+"/profile/upload/2023/10/24/_20231024154211A001.mp4";
this.videoUrl = this.baseUrl + url1
},
/**
* 关闭视频
*/
closeDialog() {
//
this.isShow = false
this.videoUrl = '' //
},
//
submit() {
this.submitUploadFiles()
},
handlePreview(file, fileList) {
console.log('--->>预览文件', file)
},
beforeUploadFiles: (file, fileList) => {
//
//
return false
},
// false Promise rejectfunction(file, fileList)
handleRemoveFiles(file, fileList) {
this.fileList = fileList
},
handleChangeFiles(file, fileList) {
this.fileList = fileList
this.submitUploadFiles()
},
submitUploadFiles() {
if (this.fileList.length === 0) {
return this.$message.warning('请选取文件后再上传')
}
// FormData:
const formData = new FormData()
// 使FormData.append/
this.fileList.forEach((file) => {
formData.append('files', file.raw)
})
if (this.form.id && this.form.id !== 'null') {
formData.set('workId', this.form.id)
}
formData.set('dataType', this.form.dataType)
request({
method: 'POST',
url: this.upload.url, //
data: formData //formData
}).then((res) => {
if (res.code === 200) {
this.$message.success('上传成功')
// this.open = false;
// this.getList();
console.log('查看上传结果:', res)
if (res.data) {
this.form.video = res.data.fileUrl
}
} else {
this.$message.error('上传失败')
}
//fileList
this.fileList = []
})
// this.$refs.uploadFile.submit();
},
/** 查询模板管理列表 */
getList() {
this.loading = true;
listTemplateInfo(this.queryParams).then(response => {
this.templateInfoList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
templateName: null,
templateType: null,
price: null,
video: null,
times: null,
remark: null,
sysType: null,
moduleType: null,
reserveOne: null,
reserveTwo: null,
reserveThree: null,
reserveFour: null,
reserveFive: null,
reserveSix: null,
reserveSeven: null,
reserveEight: null,
reserveNine: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加模板管理";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getTemplateInfo(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改模板管理";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateTemplateInfo(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addTemplateInfo(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除模板管理编号为"' + ids + '"的数据项?').then(function () {
return delTemplateInfo(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
},
/** 导出按钮操作 */
handleExport() {
this.download('godTemplateInfo/templateInfo/export', {
...this.queryParams
}, `templateInfo_${new Date().getTime()}.xlsx`)
}
}
};
</script>