Commit b0888fee authored by 冷玲鹏's avatar 冷玲鹏

修改页面bug:数据回显

parent 63531717
import request from '@/utils/request'
import Qs from 'qs'
import {parseTime} from '@/utils/common';
/**
* 1. 列表查询
......@@ -11,7 +12,7 @@ import Qs from 'qs'
*
*/
// 1. 查询新闻资讯列表
// 1. 查询活动列表
export function listCmsActivity(query) {
return request({
url: '/cmsActivity/queryCmsActivityByPagination',
......@@ -20,7 +21,7 @@ export function listCmsActivity(query) {
})
}
// 2. 查询新闻资讯详细信息
// 2. 查询活动详细信息
export function getCmsActivity(businessId) {
return request({
url: '/cmsActivity/detail/' + businessId,
......@@ -28,7 +29,7 @@ export function getCmsActivity(businessId) {
})
}
// 3. 新增新闻资讯
// 3. 新增活动
export function addCmsActivity(data) {
data = Qs.stringify(data)
return request({
......@@ -38,7 +39,7 @@ export function addCmsActivity(data) {
})
}
// 4. 修改新闻资讯
// 4. 修改活动
export function updateCmsActivity(data) {
const businessId = data.businessId
data = Qs.stringify(data)
......@@ -49,7 +50,7 @@ export function updateCmsActivity(data) {
})
}
// 5. 逻辑删除新闻资讯
// 5. 逻辑删除活动
export function delCmsActivity(businessId) {
return request({
url: '/cmsActivity/delete/' + businessId,
......@@ -57,7 +58,7 @@ export function delCmsActivity(businessId) {
})
}
// 6. 导出新闻资讯
// 6. 导出活动
export function exportCmsActivity(query) {
return request({
url: '/cmsActivity/export',
......@@ -66,7 +67,7 @@ export function exportCmsActivity(query) {
responseType: 'blob'
})
}
// 7. 修改新闻资讯状态
// 7. 修改活动状态
export function updateStatus(data) {
const businessId = data.businessId
data = Qs.stringify(data)
......
......@@ -11,7 +11,7 @@ import Qs from 'qs'
*
*/
// 1. 查询新闻资讯列表
// 1. 查询公告列表
export function listCmsNotice(query) {
return request({
url: '/cmsNotice/queryCmsNoticeByPagination',
......@@ -20,7 +20,7 @@ export function listCmsNotice(query) {
})
}
// 2. 查询新闻资讯详细信息
// 2. 查询公告详细信息
export function getCmsNotice(businessId) {
return request({
url: '/cmsNotice/detail/' + businessId,
......@@ -28,7 +28,7 @@ export function getCmsNotice(businessId) {
})
}
// 3. 新增新闻资讯
// 3. 新增公告
export function addCmsNotice(data) {
data = Qs.stringify(data)
return request({
......@@ -38,7 +38,7 @@ export function addCmsNotice(data) {
})
}
// 4. 修改新闻资讯
// 4. 修改公告
export function updateCmsNotice(data) {
const businessId = data.businessId
data = Qs.stringify(data)
......@@ -49,7 +49,7 @@ export function updateCmsNotice(data) {
})
}
// 5. 逻辑删除新闻资讯
// 5. 逻辑删除公告
export function delCmsNotice(businessId) {
return request({
url: '/cmsNotice/delete/' + businessId,
......@@ -57,7 +57,7 @@ export function delCmsNotice(businessId) {
})
}
// 6. 导出新闻资讯
// 6. 导出公告
export function exportCmsNotice(query) {
return request({
url: '/cmsNotice/export',
......@@ -66,7 +66,7 @@ export function exportCmsNotice(query) {
responseType: 'blob'
})
}
// 7. 修改新闻资讯状态
// 7. 修改公告状态
export function updateStatus(data) {
const businessId = data.businessId
data = Qs.stringify(data)
......
......@@ -3,8 +3,8 @@ export { typeField, enableOrDisable, yesOrNo, isExam }
/** banner管理*/
/** 分类*/
const typeField = [
{ value: '0', label: '首页' },
{ value: '1', label: '活动' }
{ value: '1', label: '首页' },
{ value: '0', label: '活动' }
]
/** 启用、停用*/
const enableOrDisable = [
......@@ -14,8 +14,8 @@ const enableOrDisable = [
/** 是、否*/
const yesOrNo = [
{ value: 0, label: '是' },
{ value: 1, label: '否' }
{ value: 1, label: '是' },
{ value: 0, label: '否' }
]
const isExam = [
......
......@@ -53,14 +53,6 @@
:size="commonField.smallSize"
@click="handleAdd"
>{{ commonField.addName }}</el-button>
<!-- //新增按钮-->
<!-- <el-button-->
<!-- :class="commonField.addClass"-->
<!-- :type="commonField.typePrimary"-->
<!-- :icon="commonField.addIcon"-->
<!-- :size="commonField.smallSize"-->
<!-- @click="handleExamination"-->
<!-- >{{ "跳转考核临时" }}</el-button>-->
</el-form-item>
</div>
</el-form>
......@@ -76,14 +68,8 @@
</el-table-column>
<el-table-column align="center" prop="title" label="活动标题" min-width="230" show-overflow-tooltip />
<el-table-column align="center" label="封面" min-width="120" prop="pictureId">
<!-- <template slot-scope="scope">
<div :id="step(scope.$index)">
<el-image :src="scope.row.path" :preview-src-list="[scope.row.path]" style="width:100%;height:100%;" @mouseover="justEnter($event)" @mouseout="justOut($event)" />
</div>
</template>-->
<template slot-scope="scope">
<div :id="step(scope.$index)">
<!-- 修改 src 路径 -->
<el-image
:src="getImagePath(scope.row.path)"
:preview-src-list="[getImagePath(scope.row.path)]"
......@@ -94,14 +80,8 @@
</div>
</template>
</el-table-column>
<!-- <el-table-column align="left" prop="isForntPage" label="是否为头条活动" show-overflow-tooltip>-->
<!-- <template slot-scope="scope">-->
<!-- <span>{{ scope.row.isForntPage === 1 ? '是' : '否' }}</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column align="center" prop="isTop" min-width="80" label="置顶" show-overflow-tooltip>
<template slot-scope="scope">
<!-- 只显示 isTop === 1 时,显示标签 -->
<el-tag v-if="scope.row.isTop === 1" type="success" size="medium ">置顶</el-tag>
</template>
<!-- <template slot-scope="scope">
......@@ -138,15 +118,7 @@
<template slot-scope="scope">
{{ numberFormatter(scope.row.applicationFee, 2) || '-' }}
</template>
<!-- <template slot-scope="scope">
<span>{{ scope.row.applicationFee }}</span>
</template>-->
</el-table-column>
<!-- <el-table-column align="center" prop="createUser" label="提交人" show-overflow-tooltip>
<template slot-scope="scope">
<span>{{ scope.row.nickName }}</span>
</template>
</el-table-column>-->
<el-table-column align="center" prop="publishDate" label="发布日期" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span>{{ scope.row.publishDate }}</span>
......@@ -154,20 +126,14 @@
</el-table-column>
<el-table-column align="center" prop="startTime" label="开始时间" min-width="180" show-overflow-tooltip>
<template slot-scope="scope">
<span>{{ scope.row.startTime }}</span>
<span>{{ scope.row.startTime | transformDateByFormat('YYYY-MM-DD HH:mm') }}</span>
</template>
</el-table-column>
<el-table-column align="center" prop="endTime" label="结束时间" min-width="180" show-overflow-tooltip>
<template slot-scope="scope">
<span>{{ scope.row.endTime }}</span>
<span>{{ scope.row.endTime | transformDateByFormat('YYYY-MM-DD HH:mm') }}</span>
</template>
</el-table-column>
<!-- <el-table-column align="left" prop="createDate" label="提交时间" show-overflow-tooltip>
<template slot-scope="scope">
<span>{{ scope.row.createDate }}</span>
</template>
</el-table-column>-->
<el-table-column align="center" label="操作" min-width="150">
<template slot-scope="scope">
<el-button
......@@ -190,7 +156,6 @@
:size="commonField.size"
@click="removeCourse(scope.row)"
>删除</el-button>
<!-- <el-button type="text" @click="handleView(scope.row)">查看</el-button>-->
</template>
</el-table-column>
......@@ -328,12 +293,9 @@ import {
delCmsActivity,
listCmsActivity, updateStatus
} from '@/api/contentManagement/activity'
import { updateResponseUrl } from '@/utils/updateUrl'
import { error } from 'autoprefixer/lib/utils'
import { parseTime } from '@/utils'
import { getDataCache, setDataCache } from '@/assets/js/filterData'
import { listCmsApplication } from '@/api/contentManagement/application'
import { listCmsBanner } from '@/api/contentManagement/banner'
export default {
name: 'Index',
// components: {
......@@ -345,8 +307,6 @@ export default {
hasAddPerm: ['sys:activity:add'],
hasUpdatePerm: ['sys:activity:update'],
hasDetailPerm: ['sys:activity:query'],
/* imageSrc: require('@/assets/image/test.png'),*/
// 显示开关
showSwitch: {
courseContent: true,
......@@ -500,17 +460,6 @@ export default {
step(index) {
return 'step' + index
},
changPlate(data) {
if (data === '1') {
return '板块一'
}
if (data === '2') {
return '板块二'
}
if (data === '3') {
return '板块三'
}
},
/**
* @description: 点击蒙版关闭预览图片
* @author: gaoyu
......@@ -703,7 +652,6 @@ export default {
},
/** 修改按钮操作 */
handleUpdate(row) {
console.log('我是修改')
this.$router.push({
path: '/contentManagement/activity/info',
query: {
......@@ -747,8 +695,12 @@ export default {
})
},
// 获取图片的正确路径
getImagePath() {
return require(`@/assets/image/testImage/test.png`)
getImagePath(path) {
// 返回图片路径
if (path) {
return path
}
return ''
},
// 封面图片预览
justEnter(event) {
......@@ -770,13 +722,6 @@ export default {
margin: 10px;
height: 45px;
}
/* ::v-deep .el-table .cell {
text-align: center !important;
}
::v-deep .el-table th .cell{
justify-content: center;
text-align: center !important;
}*/
}
app-container1{
font-size: 18px;
......@@ -787,41 +732,5 @@ app-container1{
height: 25px;
}
}
/*.courseContent{
!*padding-left: 15px;*!
width:100%;
height:100%;
::v-deep .el-table th .cell{
justify-content: left!important;
}
::v-deep .el-table td .cell{
margin: 10px 0 10px 0;
text-align: left!important;
}
}
#courseManage .table_box{
margin:0;
height:calc(100% - 175px);
}
#courseManage .el-table{height:100%;}
#courseManage .el-table__body-wrapper{
height:calc(100% - 40px);
overflow-x:hidden;
overflow-y:auto;
}
#courseManage .pages{margin-top:15px;}
#courseManage .breadNav{margin-left:0;}
#courseManage .search_area{margin:1em 0;}
#courseManage .info_change{margin-left:0;}
#courseManage .search_area div{width:190px;}
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {-webkit-appearance: none;}
input[type="number"]{-moz-appearance: textfield;}
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
-webkit-appearance: none !important;
margin: 0;
}*/
</style>
......@@ -67,33 +67,28 @@
</template>
</el-table-column>
<el-table-column align="center" prop="title" label="公告标题" min-width="200" show-overflow-tooltip />
<el-table-column align="center" label="封面" min-width="120" prop="pictureId">
<!-- <template slot-scope="scope">
<div :id="step(scope.$index)">
<el-image :src="scope.row.path" :preview-src-list="[scope.row.path]" style="width:100%;height:100%;" @mouseover="justEnter($event)" @mouseout="justOut($event)" />
</div>
</template>-->
<el-table-column align="center" label="图片" prop="pictureId" min-width="120">
<template slot-scope="scope">
<div :id="step(scope.$index)">
<!-- 修改 src 路径 -->
<el-image
:src="getImagePath(scope.row.path)"
:preview-src-list="[getImagePath(scope.row.path)]"
style="width:100%;height:100%;"
@mouseover="justEnter($event)"
@mouseout="justOut($event)" />
@mouseout="justOut($event)"
/>
</div>
</template>
</el-table-column>
<el-table-column align="left" prop="isTop" min-width="80" label="置顶" show-overflow-tooltip>
<!-- <template slot-scope="scope">
<el-table-column align="left" prop="isTop" min-width="80" label="置顶" show-overflow-tooltip>
<!-- <template slot-scope="scope">
<span>{{ scope.row.isTop === 1 ? '是' : '否' }}</span>
</template>-->
<template slot-scope="scope">
<el-tag v-if="scope.row.isTop === 1" type="success" size="medium ">置顶</el-tag>
</template>
</el-table-column>
<el-table-column align="left" prop="isRecommended" min-width="80" label="推荐" show-overflow-tooltip>
<el-table-column align="left" prop="isRecommended" min-width="80" label="推荐" show-overflow-tooltip>
<template slot-scope="scope">
<el-tag v-if="scope.row.isRecommended === 1" type="warning" size="medium ">推荐</el-tag>
</template>
......@@ -103,7 +98,7 @@
{{ scope.row.weight || '-' }}
</template>
</el-table-column>
<el-table-column align="left" prop="releaseStatus" label="状态" min-width="120" show-overflow-tooltip>
<el-table-column align="left" prop="releaseStatus" label="状态" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<el-switch
v-model="scope.row.flag"
......@@ -114,7 +109,7 @@
/>
</template>
</el-table-column>
<!-- <el-table-column align="left" prop="createUser" label="提交人" show-overflow-tooltip>
<!-- <el-table-column align="left" prop="createUser" label="提交人" show-overflow-tooltip>
<template slot-scope="scope">
<span>{{ scope.row.nickName }}</span>
</template>
......@@ -124,13 +119,13 @@
<span>{{ scope.row.publishDate }}</span>
</template>
</el-table-column>
<!-- <el-table-column align="left" prop="createDate" label="提交时间" show-overflow-tooltip>
<!-- <el-table-column align="left" prop="createDate" label="提交时间" show-overflow-tooltip>
<template slot-scope="scope">
<span>{{ scope.row.createDate }}</span>
</template>
</el-table-column>-->
<el-table-column align="center" label="操作" min-width="160">
<el-table-column align="center" label="操作" min-width="160">
<template slot-scope="scope">
<el-button
v-has-permi="hasDetailPerm"
......@@ -159,8 +154,8 @@
</el-table>
</div>
<pagination
:key="pageKey"
v-show="total>0"
:key="pageKey"
:total="total"
:page.sync="queryParams.page"
:limit.sync="queryParams.rows"
......@@ -177,11 +172,8 @@ import {
delCmsNotice,
listCmsNotice, updateStatus
} from '@/api/contentManagement/notice'
import { updateResponseUrl } from '@/utils/updateUrl'
import { error } from 'autoprefixer/lib/utils'
import { parseTime } from '@/utils'
import { getDataCache, setDataCache } from '@/assets/js/filterData'
import { listCmsActivity } from '@/api/contentManagement/activity'
export default {
name: 'Index',
// components: {
......@@ -193,8 +185,6 @@ export default {
hasAddPerm: ['sys:notice:add'],
hasUpdatePerm: ['sys:notice:update'],
hasDetailPerm: ['sys:notice:query'],
/* imageSrc: require('@/assets/image/test.png'),*/
// 显示开关
showSwitch: {
courseContent: true,
......@@ -216,10 +206,8 @@ export default {
formLabelWidth: '90px',
// 表格
tableData: [],
lineindex: 0,
teacode: '',
// edit form
labelPosition: 'right',
formLabelAlign: {
......@@ -231,21 +219,6 @@ export default {
},
// 日期范围
dateRange: [],
// 板块选择框
plateOptions: [
{
label: '板块一',
value: '1'
},
{
label: '板块二',
value: '2'
},
{
label: '板块三',
value: '3'
}
],
// 发布状态
releaseStatusOptions: [
{
......@@ -257,30 +230,18 @@ export default {
value: '0'
}
],
// 上传提交
uploadList: {
fm: ''
},
// search area
courseid: '',
coursename: '',
queryParams: {
page: 1,
rows: 10,
flag: ''
},
// pagination
total: 0,
actionUrl: '',
filelist: [],
bussid: [],
fullscreenLoading: false,
curCatForm: {
},
tableDataTips: '加载中'
}
},
......@@ -302,7 +263,7 @@ export default {
vm.queryParams.page = JSON.parse(getDataCache(vm.$route.path)).page
setTimeout(() => {
vm.loadData()
},500)
}, 500)
}
})
},
......@@ -316,17 +277,6 @@ export default {
step(index) {
return 'step' + index
},
changPlate(data) {
if (data === '1') {
return '板块一'
}
if (data === '2') {
return '板块二'
}
if (data === '3') {
return '板块三'
}
},
/**
* @description: 点击蒙版关闭预览图片
* @author: gaoyu
......@@ -470,8 +420,12 @@ export default {
},
// 获取图片的正确路径
getImagePath() {
return require(`@/assets/image/testImage/test.png`)
getImagePath(path) {
// 返回图片路径
if (path) {
return path
}
return ''
},
// 封面图片预览
justEnter(event) {
......
......@@ -28,20 +28,7 @@
</el-col>
</el-row>
<el-row :gutter="20">
<!-- <el-col :span="12">-->
<!-- &lt;!&ndash; 是否为头条新闻&ndash;&gt;-->
<!-- <el-form-item-->
<!-- label="是否为头条新闻:"-->
<!-- prop="isForntPage"-->
<!-- :rules="{ required: !(controls.isOperation === '3'), message: '请选择是否为头条新闻', trigger: 'blur' }"-->
<!-- >-->
<!-- <el-select v-model="form.isForntPage" placeholder="请选择是否为头条新闻" size="small" class="normalInput" :disabled="secondFromDisabled">-->
<!-- <el-option v-for="item in yesOrNo" :key="item.value" :label="item.label" :value="item.value" />-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<el-col :span="12">
<!-- 是否推荐-->
<el-form-item
label="是否推荐:"
prop="isRecommended"
......@@ -70,11 +57,11 @@
<el-col :span="12">
<el-form-item
label="发布日期:"
prop="releaseDate"
prop="publishDate"
:rules="{ required: !(controls.isOperation === '3'), message: '请选择发布日期', trigger: 'blur' }"
>
<el-date-picker
v-model="form.releaseDate"
v-model="form.publishDate"
type="date"
placeholder="选择发布日期"
:disabled="secondFromDisabled"
......@@ -84,13 +71,22 @@
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="权重:"
prop="weight"
:rules="{ required: !(controls.isOperation === '3'), message: '请选择权重', trigger: 'change' }"
>
<el-input-number v-model.trim="form.weight" style="width: 100%" controls-position="right" :min="0" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="公告封面:" prop="pictureId">
<el-upload
accept=".png,.jpg,.jpeg,.PNG,.JPG,.JPEG"
ref="upload"
accept=".png,.jpg,.jpeg,.PNG,.JPG,.JPEG"
:file-list="fileList"
list-type="picture-card"
class="avatar-uploader"
......@@ -103,31 +99,11 @@
:auto-upload="true"
:limit="8"
>
<i class="el-icon-plus avatar-uploader-icon"/>
<i class="el-icon-plus avatar-uploader-icon" />
</el-upload>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item
label="公告摘要:"
prop="summary"
:rules="{ required: !(controls.isOperation === '3'), message: '请输入公告简介', trigger: 'blur' }"
>
<el-input
v-model.trim="form.summary"
type="textarea"
:disabled="secondFromDisabled"
placeholder="请输入公告摘要"
size="small"
rows="3"
class="normalInput"
:maxlength="300"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item
......@@ -163,8 +139,7 @@ import {
import { updateResponseUrl } from '@/utils/updateUrl'
import { VueEditor } from 'vue2-editor'
import { yesOrNo, enableOrDisable } from '@/utils/allPageData'
import {uploadPublic} from "@/api/system/ossInfo";
/* import { uploadPublic } from '@/api/contentManagement/sysContest'*/
import { uploadPublic } from '@/api/system/ossInfo'
export default {
components: {
......@@ -221,33 +196,21 @@ export default {
// 提交表单
form: {
// 主表id
businessId: undefined,
createBy: undefined,
createDate: undefined,
deptId: undefined,
deptTwoId: undefined,
noticeName: undefined,
flag: undefined,
photoossId: undefined,
summary: undefined,
weight: undefined,
// isForntPage: undefined,
isRecommended: undefined,
isTop: undefined
businessId: null,
createBy: null,
createDate: null,
deptId: null,
deptTwoId: null,
noticeName: null,
flag: null,
photoossId: null,
summary: null,
weight: null,
isRecommended: null,
isTop: null
},
yesOrNo,
enableOrDisable,
// 状态
statusOptions: [
{
label: '启用',
value: '1'
},
{
label: '停用',
value: '0'
}
],
// 校验规则
rules: {
startDateS: [],
......@@ -301,7 +264,7 @@ export default {
formData.append('temp', 'CmsNotice')
try {
// 发起上传请求
const response = await uploadPublic(formData);
const response = await uploadPublic(formData)
// 获取返回的 businessId,并更新 form.pictureId
const businessId = response.data.businessId
......@@ -312,10 +275,9 @@ export default {
url: response.data.url,
name: response.data.noticeName,
businessId: businessId
});
})
} catch (error) {
console.error('上传失败:', error);
console.error('上传失败:', error)
}
},
setFormDefaults() {
......@@ -375,7 +337,10 @@ export default {
getCmsNotice(this.$route.query.bussinessId).then(response => {
if (response.code === 200) {
this.form = response.data
this.imageUrl = response.data.path
const param = {
url: response.data.path
}
this.fileList.push(param)
}
})
}
......@@ -418,7 +383,7 @@ export default {
this.$refs.deviceFormRef.validate(valid => {
if (valid) {
if (this.form.businessId !== undefined) {
if (this.form.businessId !== null) {
// 编辑
updateCmsNotice(form).then(res => {
if (res.code === 200) {
......@@ -427,7 +392,7 @@ export default {
type: 'success'
})
this.$router.push({
path: '/contentManagement/activity/index'
path: '/contentManagement/notice'
})
}
})
......@@ -439,7 +404,7 @@ export default {
type: 'success'
})
this.$router.push({
path: '/contentManagement/activity/index'
path: 'contentManagement/notice'
})
}
})
......@@ -455,8 +420,9 @@ export default {
this.pubLoading = true
this.$refs.deviceFormRef.validate(valid => {
if (valid) {
if (this.form.businessId !== undefined) {
if (this.form.businessId !== null) {
// 编辑
console.log('编辑打印',form)
form.flag = '1'
updateCmsNotice(form).then(res => {
if (res.code === 200) {
......@@ -466,7 +432,7 @@ export default {
})
this.pubLoading = false
this.$router.push({
path: '/contentManagement/activity/index'
path: '/contentManagement/notice'
})
}
}).catch(() => {
......@@ -482,7 +448,7 @@ export default {
})
this.pubLoading = false
this.$router.push({
path: '/contentManagement/activity/index'
path: '/contentManagement/notice'
})
}
}).catch(() => {
......@@ -505,17 +471,17 @@ export default {
position: relative;
overflow: hidden;
}
::v-deep.avatar-uploader .el-upload:hover {
.avatar-uploader .el-upload:hover {
border-color: #409EFF;
}
::v-deep.avatar-uploader-icon {
/*::v-deep.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 178px;
height: 178px;
line-height: 178px;
text-align: center;
}
}*/
::v-deep.avatar {
width: 178px;
height: 178px;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment