<template>
	<view class="avw">
		<!-- <view class="tabs">
			<u-tabs height="80" :is-scroll="false" :list="list1" @click="changeTab"></u-tabs>
		</view>
		<view v-if="current == 1">
			<tabsColumn :openType="current"></tabsColumn>
		</view>
		<view v-else>
			<tabsColumn :openType="current"></tabsColumn>
		</view> -->

		<tabsColumn :tabsItem="tabsItem" :curNowdata="curNowdata" :tabsList="tabsList" :openType="current"></tabsColumn>
	</view>
</template>

<script>
import tabsColumn from './base/tabs-column.vue'
import * as util from '@/pages/util/util.js'
import {getMenuListByOpen,getArticleByOpen} from '@/http/api/common.js'
export default {
data() {
return {
	list1: [{
		name: '最新资讯',
		key :'1'
	}, {
		name: '视频资讯',
		key:'2'
	}],
	current:'1',
	curNowsubid:'1',
	curNowid:'1',
	tabsList: [],//右侧内容
	tabsItem: [],//左侧菜单
}
},
components: {
	tabsColumn
},
async onLoad(e) {
	this.curNowdata = e
	await this.initData(e)
},
onShow() {
	
},
computed:{
	
},
methods: {
	async initData(e){
		//获取文章分类和数据
		let res = await getMenuListByOpen()
		if (res.data.code == 200 ) {
			this.tabsItem = res.data.data.map(v => {
				return v.name
			})
			//固定添加模块
			this.tabsItem.push('互动天地')

			res.data.data.forEach(item => {
				if (item.id == e.curNowid) {
					item.check = true
				}else{
					item.check = false
				}
				item.columnMenuSubList.forEach(v =>{
					if (v?.id == e.curNowsubid) {
						v.plain = false
					}else{
						v.plain = true
					}
				})
			});
			this.tabsList = res.data.data

			this.tabsList.push({
				name:'互动天地',
				columnMenuSubList:[{
					name:'互动天地',
					plain:true
				}]
			})



		}
	},
	
}
}
</script>

<style>
.tabs{
	display: flex;
    justify-content: center;
}
	
</style>
