Commit afc29df7 by 前端

更新车主优选代码

1 parent 99802bfc
...@@ -97,7 +97,7 @@ export default{ ...@@ -97,7 +97,7 @@ export default{
}, },
beforeDestroy(){ beforeDestroy(){
window.removeEventListener('resize', this.resizeDom) window.removeEventListener('resize', this.resizeDom)
}, },
methods:{ methods:{
resizeDom(){ resizeDom(){
this.calcWidth() this.calcWidth()
...@@ -116,10 +116,8 @@ export default{ ...@@ -116,10 +116,8 @@ export default{
} }
return pre + curW return pre + curW
},0); },0);
console.log(curIdx)
this.colList = curIdx >-1 ? this.tabList.slice(curIdx) : [] this.colList = curIdx >-1 ? this.tabList.slice(curIdx) : []
this.rowList = curIdx >-1 ? this.tabList.slice(0, curIdx) : this.tabList this.rowList = curIdx >-1 ? this.tabList.slice(0, curIdx) : this.tabList
console.log(this.rowList)
}) })
}, },
selectNav(item){ selectNav(item){
...@@ -260,4 +258,4 @@ export default{ ...@@ -260,4 +258,4 @@ export default{
} }
} }
} }
</style>
\ No newline at end of file \ No newline at end of file
</style>
<template> <template>
<div class="category-list-ctnr"> <div class="category-list-ctnr">
<GLTabs class="tabs" v-model="activeName" :tabPaneList="tabPaneList" @tab-click="handleClick"></GLTabs> <GLTabs ref='GLTabs' class="tabs" v-model="activeName" :tabPaneList="tabPaneList"
<template v-if="activeName ==1"> @tab-click="handleClick" removeTab="removeTab"></GLTabs>
<template v-if="activeName =='1'">
<pullDownNav @confirmDialog="handleEdit" @inputBlur="inputBlur" @delete="delCategory" v-model="curMainCategoryId" <pullDownNav @confirmDialog="handleEdit" @inputBlur="inputBlur" @delete="delCategory" v-model="curMainCategoryId"
:tabList="mainCategoryList" :defaultProps="{id: 'id', name: 'categoryName'}"></pullDownNav> :tabList="mainCategoryList" :defaultProps="{id: 'id', name: 'categoryName'}"></pullDownNav>
<div class="main-wrap"> <div class="main-wrap">
...@@ -33,7 +35,7 @@ ...@@ -33,7 +35,7 @@
</div> </div>
</template> </template>
<template v-if="activeName==2"> <template v-if="activeName=='2'">
<ownerPreference></ownerPreference> <ownerPreference></ownerPreference>
</template> </template>
</div> </div>
...@@ -138,6 +140,7 @@ export default { ...@@ -138,6 +140,7 @@ export default {
}, },
created() { created() {
this.getChannelList() this.getChannelList()
}, },
watch: { watch: {
curMainCategoryId: { curMainCategoryId: {
...@@ -147,15 +150,24 @@ export default { ...@@ -147,15 +150,24 @@ export default {
deep: true deep: true
}, },
activeName: { activeName: {
handler() { handler(val) {
this.getMainCategory() if (val ==1){
this.getMainCategory()
}
}, },
deep: true deep: true
}, },
}, },
mounted() { mounted() {
}, },
methods: { methods: {
handleClick(tab, event) {
sessionStorage.setItem('tagActive', this.activeName)
},
//获取频道名称 //获取频道名称
getChannelList() { getChannelList() {
this.$apis.channel this.$apis.channel
...@@ -167,7 +179,7 @@ export default { ...@@ -167,7 +179,7 @@ export default {
if (res?.list?.length) { if (res?.list?.length) {
let tabPaneList = [] let tabPaneList = []
res.list.forEach(item => { res.list.forEach(item => {
if (item.channelType == 5 || item.channelType == 5) { if (item.channelType == 5 || item.channelType == 6) {
tabPaneList.push({ tabPaneList.push({
label: item.channelName, label: item.channelName,
name: item.channelType == 5 ? 1 : 2, name: item.channelType == 5 ? 1 : 2,
...@@ -175,12 +187,12 @@ export default { ...@@ -175,12 +187,12 @@ export default {
}) })
} }
}) })
tabPaneList.push({
label: '车主优选',
name: 2
})
this.tabPaneList = tabPaneList this.tabPaneList = tabPaneList
this.activeName = tabPaneList[0].name
// 处理返回的tab值
let tagName = sessionStorage.getItem('tagActive')
this.activeName = tagName * 1 || tabPaneList[0].name
// this.activeName = tabPaneList[0].name
} }
}) })
}, },
......
...@@ -45,7 +45,7 @@ export default { ...@@ -45,7 +45,7 @@ export default {
formObj: { formObj: {
id: '', id: '',
categoryName: '', categoryName: '',
categoryStyle: 1, categoryStyle: 0,
videoCoverArr: [] videoCoverArr: []
}, },
brandList: [], brandList: [],
...@@ -119,7 +119,6 @@ export default { ...@@ -119,7 +119,6 @@ export default {
delete params.videoCoverArr delete params.videoCoverArr
if (!params.id) delete params.id if (!params.id) delete params.id
this.$apis.category.addCategoryApi(params).then(res => { this.$apis.category.addCategoryApi(params).then(res => {
console.log(res)
if (res) { if (res) {
this.$message.success('操作成功') this.$message.success('操作成功')
this.handleCancel() this.handleCancel()
...@@ -129,12 +128,12 @@ export default { ...@@ -129,12 +128,12 @@ export default {
}) })
}, },
handleCancel() { handleCancel() {
this.$route.query.name = '2';
this.$router.back() this.$router.back()
}, },
getCaseDetailApi() { getCaseDetailApi() {
this.$apis.category.batchDetailApi({id: this.$route.query.id}).then(res => { this.$apis.category.batchDetailApi({id: this.$route.query.id}).then(res => {
console.log(res)
if (res) { if (res) {
const attrList = ['id', 'categoryName', 'categoryStyle'] const attrList = ['id', 'categoryName', 'categoryStyle']
attrList.forEach(key => { attrList.forEach(key => {
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<span class="table-title"></span> <span class="table-title"></span>
<el-button class="operate-btn" type="primary" size="small" @click="addClassify()">新建分类</el-button> <el-button class="operate-btn" type="primary" size="small" @click="addClassify()">新建分类</el-button>
</div> </div>
<GLTable ref="caseRef" :getListApi="getListApi" :noDataImg="url" :searchForm="searchForm" <GLTable ref="categoryRef" :getListApi="getListApi" :noDataImg="url" :searchForm="searchForm"
:beforeSearchFn="beforeSearchFn" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn" :tableParams="tableParams" :pageConf="pageConf"
@setTableFinishFun="setTableFinishFun"> @setTableFinishFun="setTableFinishFun">
...@@ -18,9 +18,17 @@ ...@@ -18,9 +18,17 @@
</div> </div>
<div slot="categoryStyle" slot-scope="scope"> <div slot="categoryStyle" slot-scope="scope">
<div>{{ <div class="category-style" v-if="scope.scope.categoryStyle == 0">
scope.scope.categoryStyle == 0 ? '竖向排列' : scope.scope.categoryStyle == 1 ? '横向排列' : scope.scope.categoryStyle == 2 ? '种草样式' : '--' <img src="@/assets/category/vertical.png">
}} <span>商品-竖向排列</span>
</div>
<div class="category-style" v-if="scope.scope.categoryStyle == 1">
<img src="@/assets/category/transverse.png">
<span>商品-横向排列</span>
</div>
<div class="category-style" v-if="scope.scope.categoryStyle == 2">
<img src="@/assets/category/recommend.png">
<span>种草模式</span>
</div> </div>
</div> </div>
<div class="table-btns" slot="auth-button" slot-scope="scope"> <div class="table-btns" slot="auth-button" slot-scope="scope">
...@@ -111,7 +119,8 @@ export default { ...@@ -111,7 +119,8 @@ export default {
}, },
{ {
label: '分类布局', label: '分类布局',
addHtml: 'categoryStyle' addHtml: 'categoryStyle',
width: 180
}, },
{ {
label: '创建日期', label: '创建日期',
...@@ -155,7 +164,7 @@ export default { ...@@ -155,7 +164,7 @@ export default {
}) })
}, },
handleSearch() { handleSearch() {
this.$refs.caseRef.refreshTable() this.$refs.categoryRef.refreshTable()
}, },
handleReset() { handleReset() {
...@@ -168,7 +177,7 @@ export default { ...@@ -168,7 +177,7 @@ export default {
}, },
setTableFinishFun() { setTableFinishFun() {
//接收到的数据为空 //接收到的数据为空
this.$refs.caseRef.data.length ? (this.$refs.caseRef.tableHeightValues = '') : this.$refs.caseRef.setTableHeightFun() this.$refs.categoryRef.data.length ? (this.$refs.categoryRef.tableHeightValues = '') : this.$refs.categoryRef.setTableHeightFun()
}, },
addClassify(row = {}, type) { addClassify(row = {}, type) {
this.$router.push({ this.$router.push({
...@@ -207,6 +216,13 @@ export default { ...@@ -207,6 +216,13 @@ export default {
cursor: pointer; cursor: pointer;
} }
} }
.category-style{
display: flex;
align-items: center;
img{
width: 36px;
margin-right: 8px;
}
}
</style> </style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!