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"
@@ -21,7 +21,7 @@
</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,9 +47,9 @@
</template>
<script>
import { putFile } from "@/api/resource/oss";
import {isURL} from '@/util/validate'
import {
import {putFile} from "@/api/resource/oss";
import {isURL} from '@/util/validate'
import {
getCarouselList,
getCarouselAdd,
getCarouselEdit,
@@ -56,22 +57,23 @@
getCarouselMoveup,
getCarouselMovedown,
getCarouselMoveFirst,
} from '@/api/help/advertisement/advertisementBody'
const wxStatus = process.env.VUE_APP_SITE
} 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,7 +353,7 @@ export default {
this.loading = false;
});
},
bannerInit (){
bannerInit() {
this.data = []
this.loading = true;
// var type = this.envType()
@@ -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,13 +417,12 @@ export default {
})
}
},
computed: {
}
computed: {}
}
</script>
<style scoped>
.title{
.title {
height: 24px;
font-size: 16px;
font-weight: 500;
@@ -432,5 +431,5 @@ export default {
padding-bottom: 15px;
margin-bottom: 10px;
border-bottom: 1px solid #E9E9E9;
}
}
</style>

View File

@@ -1,25 +1,27 @@
<template>
<div>
<basic-container>
<div style="border-bottom: 1px solid #1890FF;">
<button class="btn" v-for="item in titleList" :key="item.name" :class="item.select ? 'primary' : ''" @click="titleActive(item)">{{item.name}}</button>
</div>
<div style="height: 23px;"></div>
<!-- <div style="border-bottom: 1px solid #1890FF;">-->
<!-- <button class="btn" v-for="item in titleList" :key="item.name" :class="item.select ? 'primary' : ''"-->
<!-- @click="titleActive(item)">{{ item.name }}-->
<!-- </button>-->
<!-- </div>-->
<!-- <div style="height: 23px;"></div>-->
<div class="recommendBody">
<div v-if="status" class="leftBox">
<!-- <menuLeft :menu="menu" :loading="leftLoading" @change="menuVal"></menuLeft> -->
<el-menu>
<el-menu-item v-for="(item, index) in menuList" :key="index" :index="index +1" @click="menuVal(item)">
<div slot="title" style="display: flex;justify-content: space-between;align-items: center;">
<span>{{item.name}}</span>
<!-- <el-switch v-model="item.status"></el-switch>-->
</div>
</el-menu-item>
</el-menu>
</div>
<div v-else class="leftBox">
</div>
<!-- <div v-if="status" class="leftBox">-->
<!-- &lt;!&ndash; <menuLeft :menu="menu" :loading="leftLoading" @change="menuVal"></menuLeft> &ndash;&gt;-->
<!-- <el-menu>-->
<!-- <el-menu-item v-for="(item, index) in menuList" :key="index" :index="index +1" @click="menuVal(item)">-->
<!-- <div slot="title" style="display: flex;justify-content: space-between;align-items: center;">-->
<!-- <span>{{item.name}}</span>-->
<!-- &lt;!&ndash; <el-switch v-model="item.status"></el-switch>&ndash;&gt;-->
<!-- </div>-->
<!-- </el-menu-item>-->
<!-- </el-menu>-->
<!-- </div>-->
<!-- <div v-else class="leftBox">-->
<!-- -->
<!-- </div>-->
<div class="containerWrap">
<advertisement-body ref="advertisementBody" :menuDetail="menuDetail"></advertisement-body>
@@ -31,15 +33,15 @@
</template>
<script>
import {mapGetters} from "vuex";
import {mapGetters} from "vuex";
import menuLeft from '../recommend/manage/menuLeft'
import advertisementBody from "./advertisementBody";
import {
import menuLeft from '../recommend/manage/menuLeft'
import advertisementBody from "./advertisementBody";
import {
routesCompany
} from '@/api/help/recommend/route'
} from '@/api/help/recommend/route'
export default {
export default {
name: "index",
components: {
menuLeft,
@@ -57,7 +59,7 @@
this.leftLoading = false
})
},
data () {
data() {
return {
leftLoading: false,
menu: [],
@@ -85,15 +87,15 @@
this.$refs.advertisementBody.bannerInit()
},
methods: {
titleActive (item) {
if(item.select)return
titleActive(item) {
if (item.select) return
this.titleList.forEach(e => {
e.select = false
})
item.select = true
this.menuDetail = {}
},
menuVal (item){
menuVal(item) {
this.menuDetail = JSON.parse(JSON.stringify(item))
if (this.titleList[0].select) {
this.$refs.advertisementBody.onLoad()
@@ -107,29 +109,32 @@
...mapGetters([
// "menu",
]),
status(){
status() {
return this.titleList[0].select
}
}
}
}
</script>
<style scoped>
.recommendBody{
.recommendBody {
display: flex;
box-sizing: border-box;
}
.containerWrap{
}
.containerWrap {
padding-top: 0 !important;
flex:1;
flex: 1;
overflow: auto;
}
.leftBox{
}
.leftBox {
width: 260px;
background: #FAFAFA;
margin-right: 23px;
}
.btn{
}
.btn {
width: 144px;
height: 32px;
background: #FFFFFF;
@@ -142,9 +147,10 @@
line-height: 32px;
margin-right: 16px;
}
.primary{
}
.primary {
background-color: #1890FF !important;
color: #FFFFFF !important;
}
}
</style>