查看分类

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

View File

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