产业分类

This commit is contained in:
shijingjing
2022-04-25 13:59:02 +08:00
parent 71adfa71f7
commit 97f5af4be9
5 changed files with 92 additions and 40 deletions

View File

@@ -46,31 +46,36 @@
isMore: false,
current: 0,
areaId: '',
tabList: [{name: '全部'}, {name: '通知公告'}, {name: '工作动态'},
{name: '惠民政策'}, {name: '中央精神'},{name: '旅游故事'},{name: '特色农产品'}]
tabList: [],
// [{name: '全部'}, {name: '通知公告'}, {name: '工作动态'},
// {name: '惠民政策'}, {name: '中央精神'},{name: '旅游故事'},{name: '特色农产品'}]
parentId: ''
}
},
onLoad (params) {
// this.areaId = params.areaId
// uni.setStorageSync('newTypeIndex', '')
// this.$loading()
// this.getNewsList()
this.areaId = params.areaId
uni.setStorageSync('newTypeIndex', '')
this.getNewsList()
// uni.setNavigationBarTitle({
// title: params.title || '乡村资讯', //页面标题
// })
this.parentId = params.id
},
onShow() {
// if(uni.getStorageSync('newTypeIndex')) {
// this.currIndex = uni.getStorageSync('newTypeIndex')
// this.getListInit()
// }
if(uni.getStorageSync('newTypeIndex')) {
this.currIndex = uni.getStorageSync('newTypeIndex')
this.getListInit()
}
document.title = this.parentName
this.getList()
this.getListInit()
},
methods: {
toSelect() {
// this.$linkTo(`./select?index=${this.currIndex}`)
uni.navigateTo({url: './select'})
// uni.navigateTo(`./select?index=${this.currIndex}`)
uni.navigateTo({url: `./select?parentId=${this.parentId}`})
},
changeTab(index) {
this.currIndex = index
@@ -80,18 +85,35 @@
onConfirm () {
this.isMore = false
this.current = 0
// this.$loading()
this.$nextTick(() => {
this.getNewsList(this.areaId)
})
},
getList() {
this.$http.post('/app/apppublicitycategory/list',null,{
params: {
parentId: this.parentId,
categoryType: '2',
}
}).then((res)=>{
// console.log(res.data.records);
var array = []
res.data.records.map(item=>{
array.push({ name: item.categoryName })
})
this.tabList = array
})
},
toNewList() {
uni.navigateTo({url: `./newList?parentName=${this.parentName}`})
},
getListInit() {
this.isMore = false
this.current = 0
this.newsList = []
// this.$loading()
this.getNewsList()
},
getNewsList() {
@@ -101,12 +123,11 @@
type = ''
}
this.isLoading = true
this.$instance.post(`/app/appnewscenterinfo/listForWxNew?current=${this.current + 1}&type=${type}&size=10&title=${this.title}&areaId=${this.areaId}`, null, {
this.$http.post(`/app/appnewscenterinfo/listForWxNew?current=${this.current + 1}&type=${type}&size=10&title=${this.title}&areaId=${this.areaId}`, null, {
withoutToken: 1
}).then(res => {
if (res.code === 0) {
this.isShowEmpty = true
// this.$hideLoading()
if (this.current === 0) {
this.newsList = []
@@ -130,20 +151,17 @@
this.$nextTick(() => {
this.pageShow = true
})
} else {
// this.$hideLoading()
}
} else {}
}).catch(() => {
// this.$hideLoading()
this.isShowEmpty = true
this.isLoading = false
})
},
toDetail(item) {
if(item.detailType == 6 || item.detailType == 5) { //特色农产品 旅游故事
this.$linkTo(`/subPages/live/products?id=${item.id}&detailType=${item.detailType}`)
uni.navigateTo(`/subPages/live/products?id=${item.id}&detailType=${item.detailType}`)
}else {
this.$linkTo(`/subPages/live/newsDetail?id=${item.id}&areaId=${this.areaId}&type=${this.currIndex}`)
uni.navigateTo(`/subPages/live/newsDetail?id=${item.id}&areaId=${this.areaId}&type=${this.currIndex}`)
}
},
},
@@ -357,4 +375,8 @@
font-size: 28rpx;
}
}
::v-deep .emptyWrap .emptyImg {
margin-top: 40px;
}
</style>