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

新闻资讯 中心案例修改

parent 0fd74ca6
...@@ -66,3 +66,13 @@ export function exportCmsProject(query) { ...@@ -66,3 +66,13 @@ export function exportCmsProject(query) {
responseType: 'blob' 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) { ...@@ -66,3 +66,13 @@ export function exportSysContentNewsInformation(query) {
responseType: 'blob' 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 @@ ...@@ -38,7 +38,6 @@
</div> </div>
</el-form> </el-form>
</div> </div>
<!--------------------------------------------------------课程功能块---------------------------------------------------->
<div style="padding:5px 10px"> <div style="padding:5px 10px">
<el-table v-loading="fullscreenLoading" :data="tableData" border sortable="true"> <el-table v-loading="fullscreenLoading" :data="tableData" border sortable="true">
<span slot="empty">{{ tableDataTips }}</span> <span slot="empty">{{ tableDataTips }}</span>
...@@ -50,7 +49,9 @@ ...@@ -50,7 +49,9 @@
<el-table-column align="center" prop="title" label="标题" /> <el-table-column align="center" prop="title" label="标题" />
<el-table-column align="center" label="封面" prop="path"> <el-table-column align="center" label="封面" prop="path">
<template slot-scope="scope"> <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> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" prop="unit" label="案例单位" /> <el-table-column align="center" prop="unit" label="案例单位" />
...@@ -70,6 +71,16 @@ ...@@ -70,6 +71,16 @@
/> />
</template> </template>
</el-table-column> </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"> <el-table-column align="center" label="操作" width="200">
<template slot-scope="scope"> <template slot-scope="scope">
...@@ -94,7 +105,8 @@ ...@@ -94,7 +105,8 @@
<script> <script>
import commonField from '@/utils/commonField' 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 { export default {
name: 'Index', name: 'Index',
// components: { // components: {
...@@ -176,6 +188,32 @@ export default { ...@@ -176,6 +188,32 @@ export default {
this.loadData() this.loadData()
}, },
methods: { 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() { resetQuery() {
this.queryParams = { this.queryParams = {
...@@ -287,66 +325,25 @@ export default { ...@@ -287,66 +325,25 @@ export default {
) )
} }
}, },
// test // 修改状态
picturecover(index, row) { handleStatusChange(row) {
// alert(index); const text = row.flag === '1' ? '启用' : '停用'
this.dialogVisible = true const params = {
this.lineindex = index businessId: row.businessId,
this.teacode = this.tableData[index].tcode flag: row.flag
},
// 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('是否确认操作?', '警告', {
beforeUpload(file) { confirmButtonText: '确定',
// console.log(file); cancelButtonText: '取消',
// this.filelist = []; type: 'warning'
this.filelist.push(file) }).then(function() {
}, return updateProjectStatus(params)
uploadCustom() { }).then(() => {
const cover = this.filelist[0] this.$message({
}, message: text + '成功',
removeCover(file, fileList) { type: 'success'
const cover = null })
this.filelist = [] })
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
......
...@@ -37,9 +37,7 @@ ...@@ -37,9 +37,7 @@
</el-form-item> </el-form-item>
</div> </div>
</el-form> </el-form>
</div> </div><div style="padding:5px 10px">
<!--------------------------------------------------------课程功能块---------------------------------------------------->
<div style="padding:5px 10px">
<el-table v-loading="fullscreenLoading" :data="tableData" border sortable="true"> <el-table v-loading="fullscreenLoading" :data="tableData" border sortable="true">
<span slot="empty">{{ tableDataTips }}</span> <span slot="empty">{{ tableDataTips }}</span>
<el-table-column align="center" prop="id" label="序号" width="55px"> <el-table-column align="center" prop="id" label="序号" width="55px">
...@@ -51,13 +49,13 @@ ...@@ -51,13 +49,13 @@
<el-table-column align="center" label="封面" prop="pictureId"> <el-table-column align="center" label="封面" prop="pictureId">
<template slot-scope="scope"> <template slot-scope="scope">
<div :id="step(scope.$index)"> <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> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" prop="releaseDate" label="发布日期"> <el-table-column align="center" prop="releaseDate" label="发布日期">
<template slot-scope="scope"> <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> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="排序" prop="weight"> <el-table-column align="center" label="排序" prop="weight">
...@@ -81,6 +79,16 @@ ...@@ -81,6 +79,16 @@
/> />
</template> </template>
</el-table-column> </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"> <el-table-column align="center" label="操作" width="200">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="handleUpdate(scope.row)">修改</el-button> <el-button type="text" @click="handleUpdate(scope.row)">修改</el-button>
...@@ -107,8 +115,10 @@ ...@@ -107,8 +115,10 @@
import commonField from '@/utils/commonField' import commonField from '@/utils/commonField'
import { import {
delSysContentNewsInformation, delSysContentNewsInformation,
listSysContentNewsInformation listSysContentNewsInformation, updateStatus,
} from '@/api/contentManagement/sysContentNewsInformation' } from '@/api/contentManagement/sysContentNewsInformation'
import { error } from 'autoprefixer/lib/utils'
import { parseTime } from '@/utils'
export default { export default {
name: 'Index', name: 'Index',
// components: { // components: {
...@@ -211,6 +221,11 @@ export default { ...@@ -211,6 +221,11 @@ export default {
}) })
}) })
}, },
// 日期格式转换
replace(time) {
return parseTime(time, '{y}/{m}/{d}')
},
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.queryParams = { this.queryParams = {
...@@ -251,125 +266,26 @@ export default { ...@@ -251,125 +266,26 @@ export default {
}) })
_this.dataIsReady = true _this.dataIsReady = true
_this.uploadList.fm = this.interfaceUrl + 'BLesson/picImport' _this.uploadList.fm = this.interfaceUrl + 'BLesson/picImport'
_this.getCourseDirection()
}, },
// 修改状态
// 上传 handleStatusChange(row) {
importmould() { const text = row.flag === '1' ? '启用' : '停用'
document.getElementById('btn_file').click() const params = {
}, businessId: row.businessId,
flag: row.flag
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
}
)
} }
}, this.$confirm('是否确认操作?', '警告', {
// test confirmButtonText: '确定',
picturecover(index, row) { cancelButtonText: '取消',
// alert(index); type: 'warning'
this.dialogVisible = true }).then(function() {
this.lineindex = index return updateStatus(params)
this.teacode = this.tableData[index].tcode }).then(() => {
}, this.$message({
message: text + '成功',
// confirm image type: 'success'
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)
}) })
} })
}, },
beforeUpload(file) { beforeUpload(file) {
// console.log(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