index.js 3.07 KB
import api from '@/api/api'
import {
	httpGet,
	httpPost
} from '@/api/fetch-api.js'


export default {
	data() {
		return {
			key: 'value',
			// swiper
			swiperOption: {
				// navigation: {
				// 	nextEl: '.swiper-button-next',
				// 	prevEl: '.swiper-button-prev'
				// },
				pagination: {
					el: '.swiper-pagination'
				},
				autoplay: {
					delay: 5000,
					stopOnLastSlide: false,
					disableOnInteraction: false
				},
				speed: 1000,

			},
			// 视频
			playerOptions: {
				width: 843,
				height: 475,
				// autoplay: true,
				muted: true,
				language: 'en',
				// playbackRates: [0.7, 1.0, 1.5, 2.0],
				sources: [{
					type: "video/mp4",
					// mp4
					src: "https://ow.go.qudone.com/jyesupload/ee516bb327484197b7ca72f3dc4be9e6.mp4",
					// webm
					// src: "https://cdn.theguardian.tv/webM/2015/07/20/150716YesMen_synd_768k_vp8.webm"
				}],
				poster: "https://ow.go.qudone.com/jyesupload/476b392f19354fb3a21083220200d912.jpg",
			}
		}
	},
	components: {},
	computed: {
		locale() {
			return this.$i18n.locale || 'tc';
		},
		i18n() {
			return this.$i18n.messages && this.$i18n.locale ? this.$i18n.messages[this.$i18n.locale] : {};
		},
		player() {
			return this.$refs.videoPlayer.player
		}
	},
	methods: {

		onPlayerPlay(player) {
			// console.log('player play!', player)
		},
		onPlayerPause(player) {
			// console.log('player pause!', player)
		},
		onPlayerEnded(player) {
			// console.log('player ended!', player)
		},
		onPlayerLoadeddata(player) {
			// console.log('player Loadeddata!', player)
		},
		onPlayerWaiting(player) {
			// console.log('player Waiting!', player)
		},
		onPlayerPlaying(player) {
			// console.log('player Playing!', player)
		},
		onPlayerTimeupdate(player) {
			// console.log('player Timeupdate!', player.currentTime())
		},
		onPlayerCanplay(player) {
			// console.log('player Canplay!', player)
		},
		onPlayerCanplaythrough(player) {
			// console.log('player Canplaythrough!', player)
		},
		// or listen state event
		playerStateChanged(playerCurrentState) {
			// console.log('player current update state', playerCurrentState)
		},
		// player is ready
		playerReadied(player) {
			// seek to 10s
			console.log('example player 1 readied', player)
			player.currentTime(10)
			// console.log('example 01: the player is readied', player)
		},

		/**
		 * 推荐产品
		 */
		onRecommendHandler(val) {
			if (val == 1) {
				this.$router.push({
					path: "/product"
				})
			}
			if (val == 2) {
				this.$router.push({
					path: "/custom/service?q=m6"
				})
			}
			if (val == 3) {
				this.$router.push({
					path: "/custom/product"
				})
			}

		},

		/**
		 * 推荐产品
		 */
		onMoreNewsHandler() {
			this.$router.push({
				path: "/news/list"
			})
		},

		/**
		 * 去新闻详情页面
		 * 需要带id
		 */
		toNewsDetail() {
			this.$router.push({
				path: '/news/detail'
			})
		},
		toProfile() {
			this.$router.push({
				path: '/profile'
			})
		},
		initData() {}
	},
	mounted() {
		setTimeout(() => {
			console.log('dynamic change options', this.player)
			this.player.muted(false)
		}, 2000)
	},
	created() {}
}