Commit 5b25d660 authored by 王飞龙's avatar 王飞龙

新闻资讯 中心案例修改

parent 0fd74ca6
......@@ -66,3 +66,13 @@ export function exportCmsProject(query) {
responseType: 'blob'
})
}
// 修改状态
export function updateProjectStatus(data) {
const businessId = data.businessId
data = Qs.stringify(data)
return request({
url: '/cmsproject/updateStatus/' + businessId,
method: 'put',
data: data
})
}
......@@ -66,3 +66,13 @@ export function exportSysContentNewsInformation(query) {
responseType: 'blob'
})
}
// 7. 修改新闻资讯状态
export function updateStatus(data) {
const businessId = data.businessId
data = Qs.stringify(data)
return request({
url: '/syscontentnewsinformation/updateStatus/' + businessId,
method: 'put',
data: data
})
}
......@@ -38,7 +38,6 @@
</div>
</el-form>
</div>
<!--------------------------------------------------------课程功能块---------------------------------------------------->
<div style="padding:5px 10px">
<el-table v-loading="fullscreenLoading" :data="tableData" border sortable="true">
<span slot="empty">{{ tableDataTips }}</span>
......@@ -50,7 +49,9 @@
<el-table-column align="center" prop="title" label="标题" />
<el-table-column align="center" label="封面" prop="path">
<template slot-scope="scope">
<el-image :src="scope.row.path" :preview-src-list="scope.row.srclist" style="width:100%;height:100%;" @mouseover="justEnter($event)" @mouseout="justOut($event)" />
<div :id="step(scope.$index)">
<el-image :src="scope.row.path" :preview-src-list="scope.row.srclist" style="width:100%;height:100%;" @click="handleClickStop(scope.$index)" @mouseover="justEnter($event)" @mouseout="justOut($event)" />
</div>
</template>
</el-table-column>
<el-table-column align="center" prop="unit" label="案例单位" />
......@@ -70,6 +71,16 @@
/>
</template>
</el-table-column>
<el-table-column align="center" label="创建人" prop="createBy">
<template slot-scope="scope">
<span>{{ scope.row.createByName }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="创建日期" prop="createDate">
<template slot-scope="scope">
<span>{{ replace(scope.row.createDate) }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="操作" width="200">
<template slot-scope="scope">
......@@ -94,7 +105,8 @@
<script>
import commonField from '@/utils/commonField'
import { delCmsProject, listCmsProject } from '@/api/contentManagement/cmsProject'
import { updateProjectStatus, delCmsProject, listCmsProject } from '@/api/contentManagement/cmsProject'
import { parseTime } from '@/utils'
export default {
name: 'Index',
// components: {
......@@ -176,6 +188,32 @@ export default {
this.loadData()
},
methods: {
step(index) {
return 'step' + index
},
/**
* @description: 点击蒙版关闭预览图片
* @author: gaoyu
* @param: imageId
* @return:
**/
handleClickStop(imageId) {
this.$nextTick(() => {
var domImageView = document.querySelector(`#${this.step(imageId)} .el-image-viewer__mask`)
if (!domImageView) {
return
}
var closeButton = document.querySelector(`#${this.step(imageId)} .el-image-viewer__close`)
domImageView.addEventListener('click', () => {
closeButton.click()
})
})
},
// 日期格式转换
replace(time) {
return parseTime(time, '{y}/{m}/{d}')
},
/** 重置按钮操作 */
resetQuery() {
this.queryParams = {
......@@ -287,66 +325,25 @@ export default {
)
}
},
// test
picturecover(index, row) {
// alert(index);
this.dialogVisible = true
this.lineindex = index
this.teacode = this.tableData[index].tcode
},
// confirm image
confirm() {
const _this = this
const cover = this.filelist[0]
const fileType = cover.name.substring(cover.name.lastIndexOf('.') + 1)
if (cover == 'undefined' || cover == null) {
_this.$notify({
title: '提示',
message: '上传文件不能为空',
type: 'warning'
})
} else if (fileType !== 'jpg' && fileType !== 'png') {
_this.$notify({
title: '提示',
message: '上传文件只能为.jpg格式/.png格式',
type: 'warning'
})
} else {
_this.fullscreenLoading = true
_this.eduUtil.ajaxPostUtil('BLesson/picImport', {
importFile: cover,
code: _this.teacode
}, res => {
_this.fullscreenLoading = false
_this.dialogVisible = false
let type = res.code
const message = res.message
type = (type == 200) ? 'success' : 'error'
_this.$notify({
title: '成功',
message: message,
type: type
})
_this.loadData()
_this.filelist = []
}, err => {
_this.fullscreenLoading = false
console.log(err)
})
// 修改状态
handleStatusChange(row) {
const text = row.flag === '1' ? '启用' : '停用'
const params = {
businessId: row.businessId,
flag: row.flag
}
},
beforeUpload(file) {
// console.log(file);
// this.filelist = [];
this.filelist.push(file)
},
uploadCustom() {
const cover = this.filelist[0]
},
removeCover(file, fileList) {
const cover = null
this.filelist = []
this.$confirm('是否确认操作?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function() {
return updateProjectStatus(params)
}).then(() => {
this.$message({
message: text + '成功',
type: 'success'
})
})
},
/** 新增按钮操作 */
handleAdd() {
......
......@@ -37,9 +37,7 @@
</el-form-item>
</div>
</el-form>
</div>
<!--------------------------------------------------------课程功能块---------------------------------------------------->
<div style="padding:5px 10px">
</div><div style="padding:5px 10px">
<el-table v-loading="fullscreenLoading" :data="tableData" border sortable="true">
<span slot="empty">{{ tableDataTips }}</span>
<el-table-column align="center" prop="id" label="序号" width="55px">
......@@ -51,13 +49,13 @@
<el-table-column align="center" label="封面" prop="pictureId">
<template slot-scope="scope">
<div :id="step(scope.$index)">
<el-image @click="handleClickStop(scope.$index)" :src="scope.row.pictureId" :preview-src-list="scope.row.srclist" style="width:100%;height:100%;" @mouseover="justEnter($event)" @mouseout="justOut($event)"/>
<el-image :src="scope.row.pictureId" :preview-src-list="scope.row.srclist" style="width:100%;height:100%;" @click="handleClickStop(scope.$index)" @mouseover="justEnter($event)" @mouseout="justOut($event)" />
</div>
</template>
</el-table-column>
<el-table-column align="center" prop="releaseDate" label="发布日期">
<template slot-scope="scope">
<span style="max-width: 150px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap" :title="scope.row.releaseDate">{{ scope.row.releaseDate }}</span>
<span>{{ scope.row.releaseDate }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="排序" prop="weight">
......@@ -81,6 +79,16 @@
/>
</template>
</el-table-column>
<el-table-column align="center" label="创建人" prop="createBy">
<template slot-scope="scope">
<span>{{ scope.row.nickName }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="创建日期" prop="createDate">
<template slot-scope="scope">
<span>{{ replace(scope.row.createDate) }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="操作" width="200">
<template slot-scope="scope">
<el-button type="text" @click="handleUpdate(scope.row)">修改</el-button>
......@@ -107,8 +115,10 @@
import commonField from '@/utils/commonField'
import {
delSysContentNewsInformation,
listSysContentNewsInformation
listSysContentNewsInformation, updateStatus,
} from '@/api/contentManagement/sysContentNewsInformation'
import { error } from 'autoprefixer/lib/utils'
import { parseTime } from '@/utils'
export default {
name: 'Index',
// components: {
......@@ -211,6 +221,11 @@ export default {
})
})
},
// 日期格式转换
replace(time) {
return parseTime(time, '{y}/{m}/{d}')
},
/** 重置按钮操作 */
resetQuery() {
this.queryParams = {
......@@ -251,125 +266,26 @@ export default {
})
_this.dataIsReady = true
_this.uploadList.fm = this.interfaceUrl + 'BLesson/picImport'
_this.getCourseDirection()
},
// 上传
importmould() {
document.getElementById('btn_file').click()
},
fileupload() {
const _this = this
this.fullscreenLoading = true
const dom = document.getElementById('btn_file')
const fileSize = dom.files[0].size // 文件的大小,单位为字节B
if (fileSize > 5 * 1024 * 1024) {
this.fullscreenLoading = false
this.$notify({
title: '提示',
message: '上传文件大小不能超过5M',
type: 'warning'
})
return false
}
// 获取欲上传的文件路径
const filePath = dom.value
const suf = filePath.split('.')[filePath.split('.').length - 1]
if (suf !== 'xls' && suf !== 'xlsx') {
this.$notify({
title: '提示',
message: '只能上传.xls/.xlsx格式的文件',
type: 'warning'
})
dom.value = ''
_this.fullscreenLoading = false
} else {
_this.eduUtil.ajaxPostUtil(
'BLesson/excelImport',
{ importFile: dom.files[0] },
function(res) {
console.log(res)
dom.value = ''
_this.fullscreenLoading = false
if (res.code === 200) {
_this.$notify({
title: '成功',
message: res.message,
type: 'success'
})
_this.loadData()
} else {
_this.$notify({
title: '失败',
message: res.message,
type: 'error'
})
}
},
function(err) {
dom.value = ''
_this.$notify({
title: '失败',
message: err.message,
type: 'error'
})
_this.fullscreenLoading = false
}
)
// 修改状态
handleStatusChange(row) {
const text = row.flag === '1' ? '启用' : '停用'
const params = {
businessId: row.businessId,
flag: row.flag
}
},
// test
picturecover(index, row) {
// alert(index);
this.dialogVisible = true
this.lineindex = index
this.teacode = this.tableData[index].tcode
},
// confirm image
confirm() {
const _this = this
const cover = this.filelist[0]
const fileType = cover.name.substring(cover.name.lastIndexOf('.') + 1)
if (cover == 'undefined' || cover == null) {
_this.$notify({
title: '提示',
message: '上传文件不能为空',
type: 'warning'
})
} else if (fileType !== 'jpg' && fileType !== 'png') {
_this.$notify({
title: '提示',
message: '上传文件只能为.jpg格式/.png格式',
type: 'warning'
})
} else {
_this.fullscreenLoading = true
_this.eduUtil.ajaxPostUtil('BLesson/picImport', {
importFile: cover,
code: _this.teacode
}, res => {
_this.fullscreenLoading = false
_this.dialogVisible = false
let type = res.code
const message = res.message
type = (type == 200) ? 'success' : 'error'
_this.$notify({
title: '成功',
message: message,
type: type
})
_this.loadData()
_this.filelist = []
}, err => {
_this.fullscreenLoading = false
console.log(err)
this.$confirm('是否确认操作?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function() {
return updateStatus(params)
}).then(() => {
this.$message({
message: text + '成功',
type: 'success'
})
}
})
},
beforeUpload(file) {
// console.log(file);
......
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