header.js 1.75 KB
import {
	mapState
} from 'vuex'
import VDropdown from '@components/home/dropdown/dropdown.vue'

export default {
	name: 'VHeader',
	components: {
		VDropdown
	},
	data() {
		return {
			maxClientWidth: 950,
			navList: [{
					name: "產品介紹",
					list: []
				},
				{
					name: "客戶服務",
					list: [{
							name: "保單查詢",
							path: ""
						},
						{
							name: "理賠報案",
							path: ""
						},
						{
							name: "客戶投訴",
							path: ""
						},
						{
							name: "保全變更",
							path: ""
						},
						{
							name: "聯繫方式",
							path: ""
						},
						{
							name: "續期繳費",
							path: ""
						},
						{
							name: "預約服務",
							path: ""
						}
					]
				},
				{
					name: "新聞資訊",
					list: []
				},
				{
					name: "關於平安人壽",
					list: [{
							name: "公司簡介",
							path: "/profile"
						},
						{
							name: "領導人概況",
							path: ""
						},
					]
				},
			],
			langData: {
				name: "繁",
				list: [{
						name: "繁",
						path: "",
						value: "tc"
					},
					{
						name: "简",
						path: "",
						value: "zh"
					},
					{
						name: "EN",
						path: "",
						value: "en"
					},
				]
			}
		}
	},
	computed: {
		...mapState({
			isSmallScreen: state => state.isSmallScreen
		})
	},
	methods: {
		toIndex() {
			this.$router.push({
				path: "/"
			})
		},
		checkIsSmallScreen() {
			const self = this;
			if (document.body.clientWidth > self.maxClientWidth) {
				self.$store.commit('IS_SMALL_SCREEN', false)
			} else {
				self.$store.commit('IS_SMALL_SCREEN', true)
			}
		}
	},
	mounted() {
		const self = this;
		self.checkIsSmallScreen();
		document.body.onresize = () => {
			self.checkIsSmallScreen();
		}
	}
}