flat: 广告管理修改

This commit is contained in:
Apcallover
2024-04-19 16:17:49 +08:00
parent 03e881162e
commit 21ca5f6eaf
2 changed files with 189 additions and 184 deletions

View File

@@ -1,6 +1,6 @@
<template>
<div>
<div class="title">{{menuDetail.menuName}}</div>
<!-- <div class="title">{{menuDetail.menuName}}</div>-->
<avue-crud
:option="option"
:table-loading="loading"
@@ -17,11 +17,11 @@
style="width: 50px; height: 50px"
fit="contain"
:src="row.image"
>
>
</el-image>
</template>
<template slot="link" slot-scope="{row}">
<p @click="openUrl(row)">{{row.link}}</p>
<p @click="openUrl(row)">{{ row.link }}</p>
</template>
<template slot="sort" slot-scope="{row}">
<el-button type="text" v-if="row.sort !== 1" @click="move('up', row)">上移</el-button>
@@ -29,7 +29,7 @@
<el-button type="text" v-if="row.sort !== 1" @click="move('first', row)">置顶</el-button>
</template>
<template slot="isShow" slot-scope="{row}">
<el-button type="text" @click="statusSelect(row)">{{row.isShow === '1'?"显示":"不显示"}}</el-button>
<el-button type="text" @click="statusSelect(row)">{{ row.isShow === '1' ? "显示" : "不显示" }}</el-button>
</template>
<template slot="menu" slot-scope="{row}">
<el-button type="text" @click="modify(row)">编辑</el-button>
@@ -38,7 +38,8 @@
</avue-crud>
<el-drawer :title="drawerTitle" :visible.sync="viewDrawer" size="60%">
<avue-form :option="formOption" :upload-before="uploadBefore" v-model="formDrawer" @submit="handleSubmit" ref="form">
<avue-form :option="formOption" :upload-before="uploadBefore" v-model="formDrawer" @submit="handleSubmit"
ref="form">
</avue-form>
</el-drawer>
@@ -46,32 +47,33 @@
</template>
<script>
import { putFile } from "@/api/resource/oss";
import {isURL} from '@/util/validate'
import {
getCarouselList,
getCarouselAdd,
getCarouselEdit,
getCarouselDel,
getCarouselMoveup,
getCarouselMovedown,
getCarouselMoveFirst,
} from '@/api/help/advertisement/advertisementBody'
const wxStatus = process.env.VUE_APP_SITE
import {putFile} from "@/api/resource/oss";
import {isURL} from '@/util/validate'
import {
getCarouselList,
getCarouselAdd,
getCarouselEdit,
getCarouselDel,
getCarouselMoveup,
getCarouselMovedown,
getCarouselMoveFirst,
} from '@/api/help/advertisement/advertisementBody'
const wxStatus = process.env.VUE_APP_SITE
export default {
name: "advertisementBody",
inject:["recommend"],
inject: ["recommend"],
props: {
menuDetail: {}
},
watch: {},
data () {
data() {
return {
wxStatus,
viewDrawer:false,
dialogShow:true,
loading:false,
viewDrawer: false,
dialogShow: true,
loading: false,
option: {
height: "auto",
tip: false,
@@ -83,7 +85,7 @@ export default {
selection: false,
viewBtn: false,
addBtn: false,
editBtn:false,
editBtn: false,
delBtn: false,
columnBtn: false,
menuWidth: 300,
@@ -133,15 +135,15 @@ export default {
total: 100,
},
formOption: {
labelWidth:120,
labelWidth: 120,
column: [
{
label: "广告位名称",
prop: "name",
span: 24,
row: true,
maxlength:50,
showWordLimit:true,
maxlength: 50,
showWordLimit: true,
rules: [
{
required: true,
@@ -178,7 +180,7 @@ export default {
prop: "link",
span: 24,
row: true,
showWordLimit:true
showWordLimit: true
},
{
label: "状态",
@@ -193,8 +195,8 @@ export default {
value: 2
}],
hide: true,
mock:{
type:'dic',
mock: {
type: 'dic',
},
},
]
@@ -209,7 +211,7 @@ export default {
},
methods: {
isURL,
openUrl (row) {
openUrl(row) {
var url = row.link
// 验证url是否存在http前缀
var status = this.isURL(url)
@@ -223,10 +225,10 @@ export default {
this.formDrawer.image = ''
done()
},
statusSelect (row) {
statusSelect(row) {
row.status = !row.status
},
add () {
add() {
this.drawerTitle = "新增图片"
this.formDrawer = {
isShow: 2,
@@ -239,13 +241,13 @@ export default {
this.$refs.form.clearValidate();
})
},
modify (row){
modify(row) {
this.drawerTitle = "广告位编辑-订单管理"
this.formDrawer = JSON.parse(JSON.stringify(row))
this.formDrawer.isShow = Number(row.isShow)
this.viewDrawer = true
},
del (row) {
del(row) {
this.$confirm('是否删除此数据, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
@@ -266,7 +268,7 @@ export default {
});
},
// 新增
handleSubmit (form, done) {
handleSubmit(form, done) {
if (this.drawerTitle === '新增图片') {
if (this.recommend.titleList[0].select) {
this.pcAdd()
@@ -293,7 +295,7 @@ export default {
})
}
},
pcAdd () {
pcAdd() {
var type = 5
var menuId = this.recommend.menuDetail.menuId
var params = {
@@ -313,7 +315,7 @@ export default {
this.refreshChange()
})
},
bannerAdd () {
bannerAdd() {
var type = this.envType()
var params = {
type,
@@ -332,7 +334,7 @@ export default {
})
},
/* 表格方法 */
refreshChange () {
refreshChange() {
if (this.recommend.titleList[0].select) {
this.onLoad()
} else if (this.recommend.titleList[1].select) {
@@ -351,13 +353,13 @@ export default {
this.loading = false;
});
},
bannerInit (){
bannerInit() {
this.data = []
this.loading = true;
// var type = this.envType()
var type = 1;
getCarouselList(
type,
type,
).then((res) => {
this.data = res.data.data;
this.loading = false;
@@ -367,8 +369,8 @@ export default {
// jlOrHs: 1 企嘉云 2 衡水
// jlOrHs === 1 ? type 根绝所选划分 1(wx/h5):2(主站)
// jlOrHs === 2 ? type 根绝所选划分 3(wx/h5):4(主站)
envType () {
var jlOrHs = (this.wxStatus === 'default' || this.wxStatus ==='fangzhen') ? 1 : 2;
envType() {
var jlOrHs = (this.wxStatus === 'default' || this.wxStatus === 'fangzhen') ? 1 : 2;
var type = 1;
if (jlOrHs === 1) {
type = this.recommend.menuDetail.name === '小程序、H5首页' ? 1 : 2;
@@ -378,18 +380,16 @@ export default {
return type
},
// 排序
move (type, row) {
move(type, row) {
if (type === 'up') {
this.moveUp(JSON.stringify(row))
} else
if (type === 'down') {
} else if (type === 'down') {
this.moveDown(JSON.stringify(row))
} else
if (type === 'first') {
} else if (type === 'first') {
this.moveFirst(JSON.stringify(row))
}
},
moveUp (row) {
moveUp(row) {
getCarouselMoveup(row).then(() => {
this.$message({
type: 'success',
@@ -398,7 +398,7 @@ export default {
this.refreshChange()
})
},
moveDown (row) {
moveDown(row) {
getCarouselMovedown(row).then(() => {
this.$message({
type: 'success',
@@ -407,7 +407,7 @@ export default {
this.refreshChange()
})
},
moveFirst (row) {
moveFirst(row) {
getCarouselMoveFirst(row).then(() => {
this.$message({
type: 'success',
@@ -417,20 +417,19 @@ export default {
})
}
},
computed: {
}
computed: {}
}
</script>
<style scoped>
.title{
height: 24px;
font-size: 16px;
font-weight: 500;
color: rgba(0, 0, 0, 0.85);
line-height: 24px;
padding-bottom: 15px;
margin-bottom: 10px;
border-bottom: 1px solid #E9E9E9;
}
.title {
height: 24px;
font-size: 16px;
font-weight: 500;
color: rgba(0, 0, 0, 0.85);
line-height: 24px;
padding-bottom: 15px;
margin-bottom: 10px;
border-bottom: 1px solid #E9E9E9;
}
</style>