parent
5f40f0dad3
commit
a98606c082
|
|
@ -25,7 +25,7 @@ export const addAcademician = (data) => {
|
|||
|
||||
// @Summary 删除
|
||||
// @Produce application/json
|
||||
// @Param ID int
|
||||
// @Param id int
|
||||
// @Router /cms/academician/delete [delete]
|
||||
export const deleteAcademician = (data) => {
|
||||
return service({
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ export const addAdContent = (data) => {
|
|||
|
||||
// @Summary 删除
|
||||
// @Produce application/json
|
||||
// @Param ID int
|
||||
// @Param id int
|
||||
// @Router /cms/adContent/delete [delete]
|
||||
export const deleteAdContent = (data) => {
|
||||
return service({
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ export const addAdPosition = (data) => {
|
|||
|
||||
// @Summary 删除
|
||||
// @Produce application/json
|
||||
// @Param ID int
|
||||
// @Param id int
|
||||
// @Router /cms/adPosition/delete [delete]
|
||||
export const deleteAdPosition = (data) => {
|
||||
return service({
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ export const addArticle = (data) => {
|
|||
|
||||
// @Summary 删除文章
|
||||
// @Produce application/json
|
||||
// @Param ID int
|
||||
// @Param id int
|
||||
// @Router /cms/article/delete [delete]
|
||||
export const deleteArticle = (data) => {
|
||||
return service({
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ export const addCategory = (data) => {
|
|||
|
||||
// @Summary 删除分类
|
||||
// @Produce application/json
|
||||
// @Param ID int
|
||||
// @Param id int
|
||||
// @Router /category/delete [delete]
|
||||
export const deleteCategory = (data) => {
|
||||
return service({
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ export const addChannel = (data) => {
|
|||
|
||||
// @Summary 删除栏目
|
||||
// @Produce application/json
|
||||
// @Param ID int
|
||||
// @Param id int
|
||||
// @Router /cms/channel/delete [delete]
|
||||
export const deleteChannel = (data) => {
|
||||
return service({
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ export const addEntrepreneur = (data) => {
|
|||
|
||||
// @Summary 删除
|
||||
// @Produce application/json
|
||||
// @Param ID int
|
||||
// @Param id int
|
||||
// @Router /cms/entrepreneur/delete [delete]
|
||||
export const deleteEntrepreneur = (data) => {
|
||||
return service({
|
||||
|
|
|
|||
|
|
@ -0,0 +1,63 @@
|
|||
import service from '@/utils/request'
|
||||
|
||||
// @Summary 获取列表
|
||||
// @Produce application/json
|
||||
// @Router /cms/live/getList [post]
|
||||
export const getLiveList = (data) => {
|
||||
return service({
|
||||
url: '/cms/live/getList',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// @Summary 新增
|
||||
// @Produce application/json
|
||||
// @Param menu Object
|
||||
// @Router /cms/live/add [post]
|
||||
export const addLive = (data) => {
|
||||
return service({
|
||||
url: '/cms/live/add',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// @Summary 删除
|
||||
// @Produce application/json
|
||||
// @Param ID int
|
||||
// @Router /cms/live/delete [delete]
|
||||
export const deleteLive = (data) => {
|
||||
return service({
|
||||
url: '/cms/live/delete',
|
||||
method: 'delete',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// @Summary 修改
|
||||
// @Produce application/json
|
||||
// @Param menu Object
|
||||
// @Router /cms/live/update [put]
|
||||
export const updateLive = (data) => {
|
||||
return service({
|
||||
url: '/cms/live/update',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// @Summary 根据id获取
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body api.GetById true "根据id获取"
|
||||
// @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /cms/live/get [get]
|
||||
export const getLiveById = (params) => {
|
||||
return service({
|
||||
url: '/cms/live/get',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
|
@ -74,7 +74,7 @@ export const getMenuAuthority = (data) => {
|
|||
|
||||
// @Summary 删除menu
|
||||
// @Produce application/json
|
||||
// @Param ID float64
|
||||
// @Param id uint
|
||||
// @Router /menu/deleteBaseMenu [post]
|
||||
export const deleteBaseMenu = (data) => {
|
||||
return service({
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ export const addOrganize = (data) => {
|
|||
|
||||
// @Summary 删除部门
|
||||
// @Produce application/json
|
||||
// @Param ID int
|
||||
// @Param id int
|
||||
// @Router /organize/delete [delete]
|
||||
export const deleteOrganize = (data) => {
|
||||
return service({
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ export const addSensitiveWord = (data) => {
|
|||
|
||||
// @Summary 删除
|
||||
// @Produce application/json
|
||||
// @Param ID int
|
||||
// @Param id int
|
||||
// @Router /cms/sensitiveWord/delete [delete]
|
||||
export const deleteSensitiveWord = (data) => {
|
||||
return service({
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ export const addTag = (data) => {
|
|||
|
||||
// @Summary 删除
|
||||
// @Produce application/json
|
||||
// @Param ID int
|
||||
// @Param id int
|
||||
// @Router /cms/tag/delete [delete]
|
||||
export const deleteTag = (data) => {
|
||||
return service({
|
||||
|
|
|
|||
|
|
@ -135,7 +135,6 @@ const page = ref(1)
|
|||
const total = ref(0)
|
||||
const pageSize = ref(10)
|
||||
const isDateEndGtStart = (rule, value, callback) => {
|
||||
console.log('isDateEndGtStart', editForm.value.validStart, value)
|
||||
if (value < editForm.value.validStart) {
|
||||
callback(new Error(rule.message))
|
||||
} else {
|
||||
|
|
@ -317,7 +316,7 @@ const handleDelete = (ID) => {
|
|||
type: 'warning'
|
||||
})
|
||||
.then(async () => {
|
||||
const res = await deleteAdContent({ ID })
|
||||
const res = await deleteAdContent({ id: ID })
|
||||
if (res.code === 0) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
|
|
@ -373,7 +372,7 @@ const handleAdd = (id) => {
|
|||
// 修改方法
|
||||
const handleEdit = async (ID) => {
|
||||
dialogTitle.value = '编辑广告内容'
|
||||
const res = await getAdContentById({ ID })
|
||||
const res = await getAdContentById({ id: ID })
|
||||
editForm.value = res.data.adContent
|
||||
handleChangePosition(editForm.value.adPositionId)
|
||||
handleChangeAdType(editForm.value.adType)
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@ const handleCloseDialog = () => {
|
|||
dialogFormVisible.value = false
|
||||
}
|
||||
|
||||
// 删除菜单
|
||||
// 删除
|
||||
const handleDelete = (ID) => {
|
||||
ElMessageBox.confirm('此操作将永久删除广告位, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
|
|
@ -180,7 +180,7 @@ const handleDelete = (ID) => {
|
|||
type: 'warning'
|
||||
})
|
||||
.then(async () => {
|
||||
const res = await deleteAdPosition({ ID })
|
||||
const res = await deleteAdPosition({ id: ID })
|
||||
if (res.code === 0) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
|
|
@ -210,7 +210,7 @@ const handleAdd = (id) => {
|
|||
// 修改菜单方法
|
||||
const handleEdit = async (ID) => {
|
||||
dialogTitle.value = '编辑广告位'
|
||||
const res = await getAdPositionById({ ID })
|
||||
const res = await getAdPositionById({ id: ID })
|
||||
editForm.value = res.data.adPosition
|
||||
isEdit.value = true
|
||||
dialogFormVisible.value = true
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ const handleRowDelete = (ID) => {
|
|||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(async valid => {
|
||||
const res = await deleteAcademician({ ID })
|
||||
const res = await deleteAcademician({ id: ID })
|
||||
if (res.code === 0) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
|
|
|
|||
|
|
@ -298,7 +298,7 @@ const handleRowDelete = (ID) => {
|
|||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(async valid => {
|
||||
const res = await deleteArticle({ ID })
|
||||
const res = await deleteArticle({ id: ID })
|
||||
if (res.code === 0) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ const clickDelete = (ID) => {
|
|||
type: 'warning'
|
||||
})
|
||||
.then(async () => {
|
||||
const res = await deleteCategory({ ID })
|
||||
const res = await deleteCategory({ id: ID })
|
||||
if (res.code === 0) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
|
|
@ -218,7 +218,7 @@ const clickAdd = (id) => {
|
|||
// 修改方法
|
||||
const clickEdit = async (ID) => {
|
||||
dialogTitle.value = '编辑分类'
|
||||
const res = await getCategoryById({ ID })
|
||||
const res = await getCategoryById({ id: ID })
|
||||
form.value = res.data.category
|
||||
isEdit.value = true
|
||||
setOptions()
|
||||
|
|
|
|||
|
|
@ -271,7 +271,7 @@ const handleCloseDialog = () => {
|
|||
dialogFormVisible.value = false
|
||||
}
|
||||
|
||||
// 删除菜单
|
||||
// 删除
|
||||
const handleDelete = (ID) => {
|
||||
ElMessageBox.confirm('此操作将永久删除栏目, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
|
|
@ -279,7 +279,7 @@ const handleDelete = (ID) => {
|
|||
type: 'warning'
|
||||
})
|
||||
.then(async () => {
|
||||
const res = await deleteChannel({ ID })
|
||||
const res = await deleteChannel({ id: ID })
|
||||
if (res.code === 0) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
|
|
@ -312,7 +312,7 @@ const handleAdd = (id) => {
|
|||
// 修改菜单方法
|
||||
const handleEdit = async (ID) => {
|
||||
dialogTitle.value = '编辑栏目'
|
||||
const res = await getChannelById({ ID })
|
||||
const res = await getChannelById({ id: ID })
|
||||
form.value = res.data.channel
|
||||
isEdit.value = true
|
||||
setOptions()
|
||||
|
|
|
|||
|
|
@ -317,7 +317,7 @@ const openPage = async (params) => {
|
|||
}
|
||||
|
||||
const initFormById = async (ID) => {
|
||||
const res = await getAcademicianById({ ID: ID })
|
||||
const res = await getAcademicianById({ id: ID })
|
||||
if (res.code === 0) {
|
||||
// 初始化表单数据
|
||||
editForm.value = res.data.academician
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@
|
|||
<div v-if="showErrMessage != ''">
|
||||
{{ showErrMessage }}
|
||||
</div>
|
||||
<el-form v-else ref="elEditFormRef" label-position="top" :model="editForm" :rules="formRules">
|
||||
<el-form v-else-if="!fullscreenLoading" ref="elEditFormRef" label-position="top" :model="editForm"
|
||||
:rules="formRules">
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="17">
|
||||
<el-row :gutter="10">
|
||||
|
|
@ -55,7 +56,7 @@
|
|||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item label="文章内容" prop="content">
|
||||
<div v-if="showDrawer">
|
||||
<div v-if="showDrawer && !fullscreenLoading">
|
||||
<RichEdit v-model="editForm.content" media-category="article_content_imgs" style="height: 50rem;" />
|
||||
</div>
|
||||
</el-form-item>
|
||||
|
|
@ -323,7 +324,7 @@ const openPage = async (params) => {
|
|||
}
|
||||
|
||||
const initFormByArticle = async (id) => {
|
||||
const res = await getArticleById({ ID: id })
|
||||
const res = await getArticleById({ id })
|
||||
if (res.code === 0) {
|
||||
// 初始化表单数据
|
||||
editForm.value = res.data.article
|
||||
|
|
@ -350,7 +351,7 @@ const initFormByArticle = async (id) => {
|
|||
|
||||
// 从爬虫数据中获取内容并填充至文章内容中
|
||||
const initFormByFetcher = async (id) => {
|
||||
const res = await importFetcherArticleById({ ID: id })
|
||||
const res = await importFetcherArticleById({ id })
|
||||
if (res.code === 0 && res.data && res.data.article) {
|
||||
fetcherArticleId.value = id
|
||||
const { title, author, source, content, publicTime } = res.data.article
|
||||
|
|
|
|||
|
|
@ -317,7 +317,7 @@ const openPage = async (params) => {
|
|||
}
|
||||
|
||||
const initFormById = async (ID) => {
|
||||
const res = await getEntrepreneurById({ ID: ID })
|
||||
const res = await getEntrepreneurById({ id: ID })
|
||||
if (res.code === 0) {
|
||||
// 初始化表单数据
|
||||
editForm.value = res.data.entrepreneur
|
||||
|
|
|
|||
|
|
@ -168,8 +168,8 @@ const handleRowDelete = (ID) => {
|
|||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(async valid => {
|
||||
const res = await deleteEntrepreneur({ ID })
|
||||
}).then(async () => {
|
||||
const res = await deleteEntrepreneur({ id: ID })
|
||||
if (res.code === 0) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
|
|
@ -188,7 +188,7 @@ const editTitle = ref('')
|
|||
// 添加
|
||||
const handleAdd = () => {
|
||||
editTitle.value = '添加企业家'
|
||||
elEditRef.value.openPage({ id: 0 })
|
||||
elEditRef.value.openPage({ ID: 0 })
|
||||
}
|
||||
// 修改
|
||||
const handleRowEdit = async (ID) => {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<div class="gva-search-box">
|
||||
<el-form ref="elSearchFormRef" :inline="true" :model="searchInfo" label-width="90px" class="demo-form-inline"
|
||||
@keyup.enter="handleSubmitSearch">
|
||||
<el-form-item label="抓取日期" prop="publishDate" style="width:300px">
|
||||
<el-form-item label="抓取日期" prop="publishDate" style="width:350px">
|
||||
<template #label>
|
||||
<span>
|
||||
<el-tooltip content="搜索范围是开始日期(包含)至结束日期(包含)" placement="top-start">
|
||||
|
|
|
|||
|
|
@ -0,0 +1,480 @@
|
|||
<template>
|
||||
<div>
|
||||
<div class="gva-search-box">
|
||||
<el-form ref="elSearchFormRef" :inline="true" :model="searchInfo" label-width="90px" class="demo-form-inline"
|
||||
@keyup.enter="handleSubmitSearch">
|
||||
<el-form-item label="关键词" style="width:300px">
|
||||
<template #label>
|
||||
<span>
|
||||
<el-tooltip content="从标题和简介中搜索" placement="top-start">
|
||||
<el-icon>
|
||||
<QuestionFilled />
|
||||
</el-icon>
|
||||
</el-tooltip>
|
||||
关键词
|
||||
</span>
|
||||
</template>
|
||||
<el-input v-model="searchInfo.keyword" class="keyword" placeholder="请输入" clearable style="width:100%" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="search" @click="handleSubmitSearch">查询</el-button>
|
||||
<el-button icon="refresh" @click="handleResetSearch">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="gva-table-box">
|
||||
<div class="gva-btn-list">
|
||||
<el-button type="primary" icon="plus" @click="handleAdd('0')">新增直播</el-button>
|
||||
</div>
|
||||
<el-table :data="tableData" row-key="ID">
|
||||
<el-table-column type="expand">
|
||||
<template #default="scope">
|
||||
<div>
|
||||
<div class="gva-table-expand" style="max-width: 600px;">
|
||||
<el-text tag="b">简介</el-text>
|
||||
</div>
|
||||
<div class="gva-table-expand" style="max-width: 600px;">
|
||||
{{ scope.row.brief }}
|
||||
</div>
|
||||
<div class="gva-table-expand" style="max-width: 600px;">
|
||||
<el-text tag="b">时间线</el-text>
|
||||
</div>
|
||||
<div class="gva-table-expand" style="max-width: 600px;">
|
||||
<el-timeline style="max-width: 600px;">
|
||||
<el-timeline-item v-for="(item, index) in JSON.parse(scope.row.liveTimeline)" :key="index"
|
||||
hide-timestamp>
|
||||
<div>
|
||||
<h4>{{ item.title }}</h4>
|
||||
<div>{{ item.content }}</div>
|
||||
</div>
|
||||
</el-timeline-item>
|
||||
</el-timeline>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="left" label="ID" min-width="50" prop="ID" />
|
||||
<el-table-column align="left" label="封面" min-width="120" prop="cover">
|
||||
<template #default="scope">
|
||||
<el-image :src="scope.row.cover" class="file" fit="cover" :preview-src-list="[scope.row.cover]"
|
||||
preview-teleported hide-on-click-modal close-on-press-escape style="width: 100px; height: 100px" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="left" label="标题" min-width="220" prop="title" />
|
||||
<el-table-column align="left" label="直播/回放地址" min-width="350" prop="liveUrl">
|
||||
<template #default="scope">
|
||||
<div>
|
||||
直播:<el-text>{{ scope.row.liveUrl }}</el-text>
|
||||
</div>
|
||||
<div>
|
||||
回放:<el-text>{{ scope.row.replayUrl }}</el-text>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="left" label="直播时间" min-width="180" prop="liveTime">
|
||||
<template #default="scope">
|
||||
<div>
|
||||
开始:<el-text>{{ formatDate(scope.row.startTime) }}</el-text>
|
||||
</div>
|
||||
<div>
|
||||
结束:<el-text>{{ formatDate(scope.row.endTime) }}</el-text>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="left" fixed="right" label="操作" width="160">
|
||||
<template #default="scope">
|
||||
<el-button type="primary" link icon="edit" @click="handleEdit(scope.row.ID)">编辑</el-button>
|
||||
<el-button type="danger" link icon="delete" @click="handleDelete(scope.row.ID)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="gva-pagination">
|
||||
<el-pagination layout="total, sizes, prev, pager, next, jumper" :current-page="page" :page-size="pageSize"
|
||||
:page-sizes="[10, 30, 50, 100]" :total="total" @current-change="handleCurrentChange"
|
||||
@size-change="handleSizeChange" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-drawer v-model="dialogFormVisible" size="900" :show-close="false" :before-close="handleCloseDialog"
|
||||
:close-on-click-modal="false" :close-on-press-escape="false">
|
||||
<template #header>
|
||||
<div class="flex justify-between items-center">
|
||||
<span class="text-lg">{{ !isEdit ? '添加' : '修改' }}直播</span>
|
||||
<div>
|
||||
<el-button type="primary" @click="handleFormSubmit">确 定</el-button>
|
||||
<el-button @click="handleCloseDialog">取 消</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<el-form v-if="dialogFormVisible" ref="editFormRef" label-position="top" label-width="auto" :model="editForm"
|
||||
:rules="rules" style="width: 100%">
|
||||
<el-row :gutter="15">
|
||||
<el-col :span="16">
|
||||
<el-form-item label="标题" prop="title" style="width: 100%">
|
||||
<el-input v-model="editForm.title" autocomplete="off" />
|
||||
</el-form-item>
|
||||
<el-form-item label="简介" prop="brief" style="width: 100%">
|
||||
<el-input type="textarea" rows="4" v-model="editForm.brief" autocomplete="off" />
|
||||
</el-form-item>
|
||||
<el-form-item label="直播地址" prop="liveUrl" style="width: 100%">
|
||||
<el-input v-model="editForm.liveUrl" autocomplete="off" placeholder="url地址" />
|
||||
</el-form-item>
|
||||
<el-form-item label="回放地址" prop="replayUrl" style="width: 100%">
|
||||
<el-input v-model="editForm.replayUrl" autocomplete="off" placeholder="url地址" />
|
||||
</el-form-item>
|
||||
<el-form-item label="时间线" prop="liveTimeline" style="width: 100%">
|
||||
<template #default="scope">
|
||||
<el-row :gutter="10" v-for="(item, index) in liveTimelineArr" style="width: 100%">
|
||||
<el-col :span="18">
|
||||
<div class="gva-multi-input">
|
||||
<el-input v-model="item.title" style="width: 100%; margin-bottom: 10px;" placeholder="时间线标题"
|
||||
@blur="timelineBlur" />
|
||||
<el-input v-model="item.content" type="textarea" rows="3" style="width: 100%"
|
||||
placeholder="时间线内容" />
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-button type="primary" plain size="small" @click="timelineAdd(index)">
|
||||
<el-icon>
|
||||
<Plus />
|
||||
</el-icon>
|
||||
</el-button>
|
||||
<el-button type="danger" plain size="small" v-if="index > 0" @click="timelineDel(index)">
|
||||
<el-icon>
|
||||
<Minus />
|
||||
</el-icon>
|
||||
</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="1"><el-divider direction="vertical" style="height: 100%" /></el-col>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="封面" prop="cover" style="width: 100%">
|
||||
<el-upload class="avatar-uploader" :action="`${imgUploadPath}/cms/mediaFile/upload?category=live_cover`"
|
||||
:show-file-list="false" :on-success="uploadSuccess" :on-error="uploadFailure"
|
||||
:before-upload="beforeUpload">
|
||||
<img v-if="editForm.cover" :src="editForm.cover" class="avatar" style="object-fit: cover;">
|
||||
<el-icon v-else class="avatar-uploader-icon">
|
||||
<Plus />
|
||||
</el-icon>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
<el-form-item label="开始时间" prop="startTime" style="width: 100%">
|
||||
<el-date-picker v-model="editForm.startTime" type="datetime" placeholder="请选择" style="width:100%" />
|
||||
</el-form-item>
|
||||
<el-form-item label="结束时间" prop="endTime" style="width: 100%">
|
||||
<el-date-picker v-model="editForm.endTime" type="datetime" placeholder="请选择" style="width:100%" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-drawer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, ref } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import {
|
||||
getLiveList,
|
||||
addLive,
|
||||
updateLive,
|
||||
deleteLive,
|
||||
getLiveById
|
||||
} from '@/api/live'
|
||||
import { isImageMime } from '@/utils/image'
|
||||
import { isUrl } from '@/utils/validator'
|
||||
import { formatDate } from '@/utils/format'
|
||||
|
||||
const page = ref(1)
|
||||
const total = ref(0)
|
||||
const pageSize = ref(10)
|
||||
const searchInfo = ref({})
|
||||
const elSearchFormRef = ref(null)
|
||||
const isDateEndGtStart = (rule, value, callback) => {
|
||||
if (value < editForm.value.startTime) {
|
||||
callback(new Error("结束时间必须大于开始时间"))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
const rules = reactive({
|
||||
cover: [
|
||||
{ required: true, message: '请选择封面', trigger: 'blur' }
|
||||
],
|
||||
title: [
|
||||
{ required: true, message: '请输入标题', trigger: 'blur' }
|
||||
],
|
||||
liveTimeline: [
|
||||
{ required: true, message: '请输入时间线', trigger: 'blur' }
|
||||
],
|
||||
liveUrl: [
|
||||
{ required: true, message: '请输入url', trigger: 'blur' },
|
||||
{ validator: isUrl, message: '请输入正确的url', trigger: 'blur' }
|
||||
],
|
||||
startTime: [
|
||||
{ required: true, message: '请输入开始时间', trigger: 'blur' }
|
||||
],
|
||||
endTime: [
|
||||
{ required: true, message: '请输入结束时间', trigger: 'blur' },
|
||||
{ validator: isDateEndGtStart, message: '结束时间必须大于开始时间', trigger: 'blur' }
|
||||
],
|
||||
replayUrl: [
|
||||
{ validator: isUrl, message: '请输入正确的url', trigger: 'blur' }
|
||||
],
|
||||
})
|
||||
|
||||
const initSearchInfo = () => {
|
||||
searchInfo.value.keyword = ''
|
||||
page.value = 1
|
||||
}
|
||||
initSearchInfo()
|
||||
|
||||
// 重置
|
||||
const handleResetSearch = () => {
|
||||
initSearchInfo()
|
||||
getTableData()
|
||||
}
|
||||
// 搜索
|
||||
const handleSubmitSearch = () => {
|
||||
elSearchFormRef.value?.validate(async valid => {
|
||||
if (!valid) return
|
||||
getTableData()
|
||||
})
|
||||
}
|
||||
|
||||
// 查询
|
||||
const tableData = ref([])
|
||||
const getTableData = async () => {
|
||||
const res = await getLiveList({ page: page.value, pageSize: pageSize.value, ...searchInfo.value })
|
||||
if (res.code === 0) {
|
||||
tableData.value = res.data.list
|
||||
}
|
||||
}
|
||||
|
||||
getTableData()
|
||||
|
||||
// 分页
|
||||
const handleSizeChange = (val) => {
|
||||
pageSize.value = val
|
||||
getTableData()
|
||||
}
|
||||
|
||||
// 修改页面容量
|
||||
const handleCurrentChange = (val) => {
|
||||
page.value = val
|
||||
getTableData()
|
||||
}
|
||||
|
||||
// ----- 以下为 editForm 操作 -----
|
||||
|
||||
// 提交表单
|
||||
const handleFormSubmit = async () => {
|
||||
console.log('handleFormSubmit before validate')
|
||||
copyTimelineData()
|
||||
|
||||
editFormRef.value.validate(async valid => {
|
||||
if (!valid) {
|
||||
return false
|
||||
}
|
||||
let res
|
||||
if (isEdit.value) {
|
||||
res = await updateLive(editForm.value)
|
||||
} else {
|
||||
res = await addLive(editForm.value)
|
||||
}
|
||||
if (res.code === 0) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: isEdit.value ? '编辑成功' : '添加成功!'
|
||||
})
|
||||
getTableData()
|
||||
initForm()
|
||||
dialogFormVisible.value = false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 初始化弹窗内表格方法
|
||||
const editFormRef = ref(null)
|
||||
const editForm = ref({})
|
||||
const checkFlag = ref(false)
|
||||
const liveTimelineArr = ref([])
|
||||
const copyTimelineData = () => {
|
||||
const arr = liveTimelineArr.value.filter(item => item.title.trim() != '')
|
||||
if (arr.length > 0) {
|
||||
editForm.value.liveTimeline = JSON.stringify(arr)
|
||||
}
|
||||
}
|
||||
const timelineAdd = (index) => {
|
||||
liveTimelineArr.value.splice(index + 1, 0, { title: '', content: '' })
|
||||
}
|
||||
const timelineDel = (index) => {
|
||||
liveTimelineArr.value.splice(index, 1)
|
||||
}
|
||||
const timelineBlur = (index) => {
|
||||
copyTimelineData()
|
||||
}
|
||||
const initForm = () => {
|
||||
checkFlag.value = false
|
||||
liveTimelineArr.value = [{
|
||||
title: "",
|
||||
content: "",
|
||||
}]
|
||||
editForm.value = {
|
||||
ID: 0,
|
||||
title: '',
|
||||
brief: '',
|
||||
cover: '',
|
||||
liveTimeline: '',
|
||||
liveUrl: '',
|
||||
startTime: '',
|
||||
endTime: '',
|
||||
replayUrl: '',
|
||||
}
|
||||
}
|
||||
|
||||
// 关闭弹窗
|
||||
const dialogFormVisible = ref(false)
|
||||
const handleCloseDialog = () => {
|
||||
initForm()
|
||||
dialogFormVisible.value = false
|
||||
}
|
||||
|
||||
// 删除
|
||||
const handleDelete = (ID) => {
|
||||
ElMessageBox.confirm('此操作将永久删除直播, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(async () => {
|
||||
const res = await deleteLive({ id: ID })
|
||||
if (res.code === 0) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '删除成功!'
|
||||
})
|
||||
if (tableData.value.length === 1 && page.value > 1) {
|
||||
page.value--
|
||||
}
|
||||
getTableData()
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
ElMessage({
|
||||
type: 'info',
|
||||
message: '已取消删除'
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const isEdit = ref(false)
|
||||
const dialogTitle = ref('新增直播')
|
||||
const handleAdd = (id) => {
|
||||
dialogTitle.value = '新增直播'
|
||||
initForm()
|
||||
isEdit.value = false
|
||||
dialogFormVisible.value = true
|
||||
}
|
||||
// 修改菜单方法
|
||||
const handleEdit = async (ID) => {
|
||||
dialogTitle.value = '编辑直播'
|
||||
const res = await getLiveById({ id: ID })
|
||||
editForm.value = res.data.live
|
||||
if (editForm.value.liveTimeline != '') {
|
||||
liveTimelineArr.value = JSON.parse(editForm.value.liveTimeline)
|
||||
} else {
|
||||
liveTimelineArr.value = [{
|
||||
title: "",
|
||||
content: ""
|
||||
}]
|
||||
}
|
||||
isEdit.value = true
|
||||
dialogFormVisible.value = true
|
||||
}
|
||||
|
||||
// ------- 图片操作 -------
|
||||
const imgUploadPath = ref(import.meta.env.VITE_BASE_API)
|
||||
const beforeUpload = (file) => {
|
||||
const isLt500K = file.size / 1024 / 1024 < 0.5 // 500K, @todo 应支持在项目中设置
|
||||
const isImage = isImageMime(file.type)
|
||||
|
||||
if (!isImage) {
|
||||
ElMessage.error('上传图片只能是 jpg,png,svg,webp 格式!')
|
||||
return false
|
||||
}
|
||||
if (!isLt500K && isImage) {
|
||||
ElMessage.error('未压缩的上传图片大小不能超过 500KB,请使用压缩上传')
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
const uploadSuccess = (res) => {
|
||||
const { code, data, msg } = res
|
||||
if (code !== 0) {
|
||||
ElMessage({ type: 'error', message: msg })
|
||||
return
|
||||
}
|
||||
if (!data.mediaFile) {
|
||||
ElMessage({ type: 'error', message: '返回错误,上传失败' })
|
||||
return
|
||||
}
|
||||
editForm.value.cover = data.mediaFile.url
|
||||
}
|
||||
|
||||
const uploadFailure = () => {
|
||||
ElMessage({
|
||||
type: 'error',
|
||||
message: '上传失败'
|
||||
})
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.avatar-uploader .avatar {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style>
|
||||
.avatar-uploader .el-upload {
|
||||
border: 1px solid var(--el-border-color);
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
transition: var(--el-transition-duration-fast);
|
||||
}
|
||||
|
||||
.avatar-uploader .el-upload:hover {
|
||||
border-color: var(--el-color-primary);
|
||||
}
|
||||
|
||||
.el-icon.avatar-uploader-icon {
|
||||
font-size: 28px;
|
||||
color: #8c939d;
|
||||
width: 178px;
|
||||
height: 178px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.admin-box .el-table td .cell {
|
||||
line-height: 28px;
|
||||
}
|
||||
|
||||
.gva-multi-input {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.gva-table-expand {
|
||||
margin: 15px;
|
||||
line-height: 1.5rem;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -102,7 +102,7 @@ const handleRowDelete = (ID) => {
|
|||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(async valid => {
|
||||
const res = await deleteTag({ ID })
|
||||
const res = await deleteTag({ id: ID })
|
||||
if (res.code === 0) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@
|
|||
</div>
|
||||
<div v-else>
|
||||
<el-text size="large" tag="b">请选择部门</el-text>
|
||||
<el-empty :image-size="200" />
|
||||
</div>
|
||||
<UserEdit ref="elUserEditRef" :authOptions="authOptions" :organizeOptions="props.organizeOptions"
|
||||
@on-save="handleSaveUser" />
|
||||
|
|
|
|||
|
|
@ -49,10 +49,7 @@ import OrganizeEdit from '@/view/organize/components/organizeEdit.vue'
|
|||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import {
|
||||
getOrganizeTree,
|
||||
getOrganizeById,
|
||||
addOrganize,
|
||||
deleteOrganize,
|
||||
updateOrganize,
|
||||
} from '@/api/organize'
|
||||
|
||||
const props = defineProps({
|
||||
|
|
|
|||
|
|
@ -339,7 +339,7 @@ const deleteMenu = (ID) => {
|
|||
type: 'warning'
|
||||
})
|
||||
.then(async () => {
|
||||
const res = await deleteBaseMenu({ ID })
|
||||
const res = await deleteBaseMenu({ id: ID })
|
||||
if (res.code === 0) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
|
|
|
|||
Loading…
Reference in New Issue