宣传资讯

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

View File

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

View File

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