宣传资讯

This commit is contained in:
shijingjing
2022-04-26 17:16:45 +08:00
parent 490c4c399e
commit d389450128
3 changed files with 19 additions and 21 deletions

View File

@@ -53,7 +53,6 @@
isLoading: false,
newsList: [],
isShowEmpty: false,
isMore: false,
current: 1,
areaId: '',
tabList: [],
@@ -63,18 +62,18 @@
},
onLoad (params) {
this.getNewsList()
this.parentId = params.id
this.parentName = params.parentName
},
onShow() {
document.title = this.parentName
this.getList()
if(uni.getStorageSync('newTypeIndex')) {
this.currIndex = uni.getStorageSync('newTypeIndex')
this.getListInit()
}
this.getListInit()
uni.$on('update', (tabIndex)=>{
this.currIndex = tabIndex
this.getListInit()
})
// this.getListInit()
},
methods: {
@@ -82,6 +81,7 @@
toSelect() {
uni.navigateTo({url: `./select?parentId=${this.parentId}&index=${this.currIndex}`})
},
// 切换tab栏
changeTab(index) {
this.newsList = []
this.currIndex = index
@@ -89,14 +89,12 @@
this.getListInit()
},
onConfirm () {
this.isMore = false
this.current = 1
this.$nextTick(() => {
this.getNewsList(this.areaId)
})
},
// onConfirm () {
// this.current = 1
// this.$nextTick(() => {
// this.getNewsList(this.areaId)
// })
// },
// 获取新闻分类
getList() {
@@ -115,12 +113,10 @@
})
})
this.tabList = array
// console.log(this.tabList[this.currIndex].parentId,'parentId');
})
},
getListInit() {
this.isMore = false
this.current = 1
this.newsList = []
this.getNewsList()
@@ -135,12 +131,11 @@
}
}).then(res => {
if (res.code === 0) {
const data = res.data.records
this.newsList.push(...data)
this.current = this.current
this.newsList = this.current == 1 ? [...res.data.records] : [...this.newsList, ...res.data.records]
}
})
},
// 查详情
toDetail(id) {
uni.navigateTo({url: `./newsDetail?id=${id}`})
},

View File

@@ -742,7 +742,9 @@
width: 96px;
height: 96px;
}
div {
align-self: center;
}
}
}

View File

@@ -26,7 +26,8 @@
methods: {
tabClick(index) {
this.tabIndex = index
uni.setStorageSync('newTypeIndex', index)
// uni.setStorageSync('newTypeIndex', index)
uni.$emit('update',this.tabIndex)
uni.navigateBack({delta: 1})
},
getList() {