查看分类

This commit is contained in:
shijingjing
2022-04-25 14:10:36 +08:00
parent 97f5af4be9
commit fe0b027460
2 changed files with 17 additions and 20 deletions

View File

@@ -10,7 +10,7 @@
<p v-if="parentName == '生态振兴'">构建乡村振兴的环境基础</p>
</div>
<div class="list">
<div class="item" v-for="(item,index) in list" :key="index" @click="toNewList(item.id)">
<div class="item" v-for="(item,index) in list" :key="index" @click="toNewList(item.id,item.categoryName)">
<span>{{ item.categoryName }}</span>
<span><u-icon name="arrow-right"></u-icon></span>
</div>
@@ -45,12 +45,12 @@ export default {
categoryType: '1',
}
}).then((res)=>{
// console.log(res);
console.log(res);
this.list = res.data.records
})
},
toNewList(id) {
uni.navigateTo({url: `./newList?id=${id}`})
toNewList(id,categoryName) {
uni.navigateTo({url: `./newList?id=${id}&parentName=${categoryName}`})
}
},
}

View File

@@ -47,20 +47,16 @@
current: 0,
areaId: '',
tabList: [],
// [{name: '全部'}, {name: '通知公告'}, {name: '工作动态'},
// {name: '惠民政策'}, {name: '中央精神'},{name: '旅游故事'},{name: '特色农产品'}]
parentId: ''
parentId: '',
parentName: ''
}
},
onLoad (params) {
this.areaId = params.areaId
uni.setStorageSync('newTypeIndex', '')
this.getNewsList()
// uni.setNavigationBarTitle({
// title: params.title || '乡村资讯', //页面标题
// })
this.parentId = params.id
this.parentName = params.parentName
},
onShow() {
if(uni.getStorageSync('newTypeIndex')) {
@@ -73,9 +69,9 @@
},
methods: {
// 查看分类
toSelect() {
// uni.navigateTo(`./select?index=${this.currIndex}`)
uni.navigateTo({url: `./select?parentId=${this.parentId}`})
uni.navigateTo({url: `./select?parentId=${this.parentId}&index=${this.currIndex}`})
},
changeTab(index) {
this.currIndex = index
@@ -91,6 +87,7 @@
})
},
// 获取新闻分类
getList() {
this.$http.post('/app/apppublicitycategory/list',null,{
params: {
@@ -98,7 +95,6 @@
categoryType: '2',
}
}).then((res)=>{
// console.log(res.data.records);
var array = []
res.data.records.map(item=>{
array.push({ name: item.categoryName })
@@ -106,9 +102,10 @@
this.tabList = array
})
},
toNewList() {
uni.navigateTo({url: `./newList?parentName=${this.parentName}`})
},
// toNewList() {
// uni.navigateTo({url: `./newList?parentName=${this.parentName}`})
// },
getListInit() {
this.isMore = false
@@ -166,9 +163,9 @@
},
},
onReachBottom () {
this.getNewsList(this.areaId)
}
// onReachBottom () {
// this.getNewsList(this.areaId)
// }
}
</script>