<script> import { mapMutations } from 'vuex' import { film, playDate} from '../components/' export default{ data () { return { filmLists: [], itemId: 0, selDateNum: 0, cinemaData: {}, selFilm: {}, palyDate: [ {date: '今天 12-15', num: 0}, {date: '明天 12-16', num: 1}, {date: '后天 12-17', num: 2}, {date: '周五 12-18', num: 3} ] } }, components: { film, playDate }, watch: { itemId () { this.selFilm = this.getDataById(this.filmLists, this.itemId) } }, methods: { ...mapMutations([ 'pushLoadStack', 'completeLoad', 'showCityList', 'updateAreaData' ]), requestData (url, fn) { this.pushLoadStack() this.$http.get(url).then(fn).then(this.completeLoad) }, getDataById (array, id) { for (let i = 0; i < array.length; i++) { if (array[i].id == id) { return array[i] } } return false }, selectDateTab (event) { let num = +event.target.getAttribute('data-num') this.selDateNum = num } }, created () { this.requestData('/movie/cinema_detail', (response) => { let data = response.data this.filmLists = data.data.data.returnValue.shows this.selFilm = this.filmLists[0] }) this.cinemaData = this.getDataById(this.$store.state.cinema.area, this.$route.params.id) if (!this.cinemaData) { this.$router.push('/') } } } </script><script> import { mapMutations } from 'vuex' import { film, playDate} from '../components/' export default{ data () { return { filmLists: [], itemId: 0, selDateNum: 0, cinemaData: {}, selFilm: {}, palyDate: [ {date: '今天 12-15', num: 0}, {date: '明天 12-16', num: 1}, {date: '后天 12-17', num: 2}, {date: '周五 12-18', num: 3} ] } }, components: { film, playDate }, watch: { itemId () { this.selFilm = this.getDataById(this.filmLists, this.itemId) } }, methods: { ...mapMutations([ 'pushLoadStack', 'completeLoad', 'showCityList', 'updateAreaData' ]), requestData (url, fn) { this.pushLoadStack() this.$http.get(url).then(fn).then(this.completeLoad) }, getDataById (array, id) { for (let i = 0; i < array.length; i++) { if (array[i].id == id) { return array[i] } } return false }, selectDateTab (event) { let num = +event.target.getAttribute('data-num') this.selDateNum = num } }, created () { this.requestData('/movie/cinema_detail', (response) => { let data = response.data this.filmLists = data.data.data.returnValue.shows this.selFilm = this.filmLists[0] }) this.cinemaData = this.getDataById(this.$store.state.cinema.area, this.$route.params.id) if (!this.cinemaData) { this.$router.push('/') } } } </script><script> import { mapMutations } from 'vuex' import { film, playDate} from '../components/' export default{ data () { return { filmLists: [], itemId: 0, selDateNum: 0, cinemaData: {}, selFilm: {}, palyDate: [ {date: '今天 12-15', num: 0}, {date: '明天 12-16', num: 1}, {date: '后天 12-17', num: 2}, {date: '周五 12-18', num: 3} ] } }, components: { film, playDate }, watch: { itemId () { this.selFilm = this.getDataById(this.filmLists, this.itemId) } }, methods: { ...mapMutations([ 'pushLoadStack', 'completeLoad', 'showCityList', 'updateAreaData' ]), requestData (url, fn) { this.pushLoadStack() this.$http.get(url).then(fn).then(this.completeLoad) }, getDataById (array, id) { for (let i = 0; i < array.length; i++) { if (array[i].id == id) { return array[i] } } return false }, selectDateTab (event) { let num = +event.target.getAttribute('data-num') this.selDateNum = num } }, created () { this.requestData('/movie/cinema_detail', (response) => { let data = response.data this.filmLists = data.data.data.returnValue.shows this.selFilm = this.filmLists[0] }) this.cinemaData = this.getDataById(this.$store.state.cinema.area, this.$route.params.id) if (!this.cinemaData) { this.$router.push('/') } } } </script> |