|
|
@ -1,52 +1,66 @@ |
|
|
|
<template> |
|
|
|
<template> |
|
|
|
<!-- 营销推广管理 --> |
|
|
|
<!-- 营销推广管理 --> |
|
|
|
<div style="padding-top: 24px"> |
|
|
|
<div style="padding-top: 24px"> |
|
|
|
|
|
|
|
<div style="margin-bottom: 10px;text-align: right;"> |
|
|
|
|
|
|
|
<el-button v-auth="'平台自建:新增'" type="primary" round @click="add">新增</el-button> |
|
|
|
|
|
|
|
</div> |
|
|
|
<el-table :data="list" class="table" ref="table" stripe header-align="center" row-key="id"> |
|
|
|
<el-table :data="list" class="table" ref="table" stripe header-align="center" row-key="id"> |
|
|
|
<el-table-column type="index" width="100" label="序号" align="center"></el-table-column> |
|
|
|
<el-table-column type="index" width="100" label="序号" align="center"></el-table-column> |
|
|
|
<el-table-column prop="courseName" label="图片" min-width="150" align="center"> |
|
|
|
<el-table-column prop="courseName" label="图片" min-width="150" align="center"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
|
|
|
|
<img width="100" :src="scope.row.banner" alt=""> |
|
|
|
|
|
|
|
</template> |
|
|
|
|
|
|
|
</el-table-column> |
|
|
|
|
|
|
|
<el-table-column prop="title" label="标题" min-width="150" align="center"></el-table-column> |
|
|
|
|
|
|
|
<el-table-column prop="url" label="链接" min-width="150" align="center"></el-table-column> |
|
|
|
|
|
|
|
<el-table-column label="操作" align="center" width="250"> |
|
|
|
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
|
|
|
<el-switch |
|
|
|
|
|
|
|
v-model="scope.row.isOpen" |
|
|
|
|
|
|
|
:active-value="0" |
|
|
|
|
|
|
|
:inactive-value="1" |
|
|
|
|
|
|
|
@change="switchOff($event, scope.row)" |
|
|
|
|
|
|
|
v-auth="'/curriculum:上下架'"> |
|
|
|
|
|
|
|
</el-switch> |
|
|
|
|
|
|
|
<el-button style="margin-left: 10px;" v-auth="'平台自建:删除'" type="text" @click="edit(scope.row)">编辑</el-button> |
|
|
|
|
|
|
|
<el-button v-auth="'平台自建:删除'" type="text" @click="handleDelete(scope.row)">删除</el-button> |
|
|
|
|
|
|
|
</template> |
|
|
|
|
|
|
|
</el-table-column> |
|
|
|
|
|
|
|
</el-table> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-dialog :title="(form.id ? '编辑' : '新增') + 'banner'" :visible.sync="bannerVisible" width="500px" class="dialog" :close-on-click-modal="false"> |
|
|
|
|
|
|
|
<el-form ref="form" label-width="60px"> |
|
|
|
|
|
|
|
<el-form-item label="图片"> |
|
|
|
<el-upload |
|
|
|
<el-upload |
|
|
|
class="avatar-uploader" |
|
|
|
class="avatar-uploader" |
|
|
|
accept=".jpg,.png,.jpeg" |
|
|
|
accept=".jpg,.png,.jpeg" |
|
|
|
:on-success="res => uploadSuccess(res, scope.row)" |
|
|
|
:on-success="uploadSuccess" |
|
|
|
:limit="1" |
|
|
|
:limit="1" |
|
|
|
:action="api.fileupload" |
|
|
|
:action="api.fileupload" |
|
|
|
:headers="headers" |
|
|
|
:headers="headers" |
|
|
|
:show-file-list="false" |
|
|
|
:show-file-list="false" |
|
|
|
name="file" |
|
|
|
name="file" |
|
|
|
> |
|
|
|
> |
|
|
|
<img v-if="scope.row.pic" :src="scope.row.pic" class="avatar"> |
|
|
|
<img v-if="form.banner" :src="form.banner" class="avatar"> |
|
|
|
<div class="uploader-default" v-else> |
|
|
|
<div class="uploader-default" v-else> |
|
|
|
<i class="el-icon-plus"></i> |
|
|
|
<i class="el-icon-plus"></i> |
|
|
|
<p>上传图片</p> |
|
|
|
<p>上传图片</p> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</el-upload> |
|
|
|
</el-upload> |
|
|
|
</template> |
|
|
|
</el-form-item> |
|
|
|
</el-table-column> |
|
|
|
<el-form-item label="标题"> |
|
|
|
<el-table-column prop="courseName" label="标题" min-width="150" align="center"> |
|
|
|
<el-input v-model="form.title" placeholder="请输入标题" maxlength="100"></el-input> |
|
|
|
<template slot-scope="scope"> |
|
|
|
</el-form-item> |
|
|
|
<el-input v-model="scope.row.title" placeholder="请输入标题" maxlength="100"></el-input> |
|
|
|
<el-form-item label="链接"> |
|
|
|
</template> |
|
|
|
<el-input v-model="form.url" placeholder="请输入链接" maxlength="100"></el-input> |
|
|
|
</el-table-column> |
|
|
|
</el-form-item> |
|
|
|
<el-table-column prop="courseName" label="链接" min-width="150" align="center"> |
|
|
|
</el-form> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<span slot="footer" class="dialog-footer"> |
|
|
|
<el-input v-model="scope.row.title" placeholder="请输入链接" maxlength="100"></el-input> |
|
|
|
<el-button @click="bannerVisible = false">取消</el-button> |
|
|
|
</template> |
|
|
|
<el-button type="primary" @click="submitBanner">确定</el-button> |
|
|
|
</el-table-column> |
|
|
|
</span> |
|
|
|
<el-table-column label="操作" align="center" width="250"> |
|
|
|
</el-dialog> |
|
|
|
<template slot-scope="scope"> |
|
|
|
|
|
|
|
<el-switch |
|
|
|
|
|
|
|
v-model="scope.row.isShelves" |
|
|
|
|
|
|
|
:active-value="1" |
|
|
|
|
|
|
|
:inactive-value="0" |
|
|
|
|
|
|
|
@change="switchOff($event, scope.row)" |
|
|
|
|
|
|
|
v-auth="'/curriculum:上下架'"> |
|
|
|
|
|
|
|
</el-switch> |
|
|
|
|
|
|
|
<el-button class="m-l-10" v-auth="'平台自建:编辑信息'" type="text" @click="editCourse(scope.row)">编辑</el-button> |
|
|
|
|
|
|
|
<el-button v-auth="'平台自建:删除'" type="text" @click="handleDelete(scope.row)">删除</el-button> |
|
|
|
|
|
|
|
</template> |
|
|
|
|
|
|
|
</el-table-column> |
|
|
|
|
|
|
|
</el-table> |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
@ -59,36 +73,35 @@ export default { |
|
|
|
headers: { |
|
|
|
headers: { |
|
|
|
token: sessionStorage.getItem("token") |
|
|
|
token: sessionStorage.getItem("token") |
|
|
|
}, |
|
|
|
}, |
|
|
|
list: [{}], |
|
|
|
list: [], |
|
|
|
|
|
|
|
bannerVisible: false, |
|
|
|
|
|
|
|
form: { |
|
|
|
|
|
|
|
id: '', |
|
|
|
|
|
|
|
banner: '', |
|
|
|
|
|
|
|
title: '', |
|
|
|
|
|
|
|
url: '', |
|
|
|
|
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
}, |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
mounted() { |
|
|
|
|
|
|
|
this.getList() |
|
|
|
}, |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
methods: { |
|
|
|
getList() { |
|
|
|
getList() { |
|
|
|
this.$post(this.api.listTheoreticalCourse, { |
|
|
|
this.$post(this.api.listMarketing, { |
|
|
|
pageNum: this.page, |
|
|
|
pageNum: 1, |
|
|
|
pageSize: this.pageSize, |
|
|
|
pageSize: 1000 |
|
|
|
keyWord: this.keyword, |
|
|
|
|
|
|
|
createPlatform: 0, |
|
|
|
|
|
|
|
platformSource: Setting.platformSource, |
|
|
|
|
|
|
|
...this.form |
|
|
|
|
|
|
|
}).then(({ page }) => { |
|
|
|
}).then(({ page }) => { |
|
|
|
this.list = page.records; |
|
|
|
this.list = page.records; |
|
|
|
this.total = page.total; |
|
|
|
this.total = page.total; |
|
|
|
if (!this.list.length && this.total) { |
|
|
|
|
|
|
|
this.page--; |
|
|
|
|
|
|
|
this.getData(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}).catch(res => { |
|
|
|
}).catch(res => { |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
handleExceed() { // 文件超出个数限制时的钩子 |
|
|
|
handleExceed() { // 文件超出个数限制时的钩子 |
|
|
|
this.$message.warning("当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!"); |
|
|
|
this.$message.warning("当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!"); |
|
|
|
}, |
|
|
|
}, |
|
|
|
uploadSuccess(res, row) { // 文件上传成功时的钩子 |
|
|
|
uploadSuccess(res) { // 文件上传成功时的钩子 |
|
|
|
row.pic = res.data.filesResult.fileUrl; |
|
|
|
this.form.banner = res.data.filesResult.fileUrl; |
|
|
|
}, |
|
|
|
}, |
|
|
|
uploadError(err, file, fileList) { // 文件上传失败时的钩子 |
|
|
|
uploadError(err, file, fileList) { // 文件上传失败时的钩子 |
|
|
|
this.$message({ |
|
|
|
this.$message({ |
|
|
@ -103,20 +116,37 @@ export default { |
|
|
|
handleRemove(file, fileList) { // 文件列表移除文件时的钩子 |
|
|
|
handleRemove(file, fileList) { // 文件列表移除文件时的钩子 |
|
|
|
// this.form.coverUrl = '' |
|
|
|
// this.form.coverUrl = '' |
|
|
|
}, |
|
|
|
}, |
|
|
|
addCourse() { |
|
|
|
add() { |
|
|
|
this.$router.push("/addTheoreticalCourse"); |
|
|
|
this.form = { |
|
|
|
|
|
|
|
id: '', |
|
|
|
|
|
|
|
banner: '', |
|
|
|
|
|
|
|
title: '', |
|
|
|
|
|
|
|
url: '', |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.bannerVisible = true |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
edit(row) { |
|
|
|
|
|
|
|
this.form = JSON.parse(JSON.stringify(row)) |
|
|
|
|
|
|
|
this.bannerVisible = true |
|
|
|
}, |
|
|
|
}, |
|
|
|
editCourse(row) { |
|
|
|
// banner弹框提交 |
|
|
|
this.$router.push(`/addTheoreticalCourse?id=${row.id}`); |
|
|
|
submitBanner() { |
|
|
|
|
|
|
|
const { form } = this |
|
|
|
|
|
|
|
if (!form.banner) return util.errorMsg('请上传图片') |
|
|
|
|
|
|
|
if (!form.title) return util.errorMsg('请输入标题') |
|
|
|
|
|
|
|
this.$post(this.api[form.id ? 'updateMarketing' : 'saveMarketing'], form).then(res => { |
|
|
|
|
|
|
|
this.getList() |
|
|
|
|
|
|
|
this.bannerVisible = false |
|
|
|
|
|
|
|
}).catch(res => {}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
handleDelete(row) { |
|
|
|
handleDelete(row) { |
|
|
|
this.$confirm("此删除操作不可逆,是否确认删除选中项?", "提示", { |
|
|
|
this.$confirm("此删除操作不可逆,是否确认删除选中项?", "提示", { |
|
|
|
type: "warning" |
|
|
|
type: "warning" |
|
|
|
}) |
|
|
|
}) |
|
|
|
.then(() => { |
|
|
|
.then(() => { |
|
|
|
this.$post(`${this.api.delTheoreticalCourse}?ids=${row.id}`).then(res => { |
|
|
|
this.$post(`${this.api.delMarketing}?ids=${row.id}`).then(res => { |
|
|
|
util.successMsg("删除成功"); |
|
|
|
util.successMsg("删除成功"); |
|
|
|
this.initData(); |
|
|
|
this.getList(); |
|
|
|
}).catch(res => { |
|
|
|
}).catch(res => { |
|
|
|
}); |
|
|
|
}); |
|
|
|
}) |
|
|
|
}) |
|
|
|