123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- var homeData = new Vue({
- el: '#container',
- data: {
- images: [],
- recommends: [],
- bigTopicData: [],
- topicData3: [],
- topicData4: [],
- topicData5: [],
- advertising: [],
- asideNav: []
- },
- methods: {
- getBanners: function(){
- var _self = this;
- $.getJSON("/home/banner").done(function (r) {
- if (r.code === 0 && r.data) {
- _self.images = r.data;
- setTimeout(function(){
- if (isPC) {
- $('#swiper-container').slide({
- mainCell:".swiper-wrapper"
- ,titCell:".swiper-pagination span"
- ,effect: "leftLoop"
- ,prevCell:".swiper-button-prev"
- ,nextCell:".swiper-button-next"
- ,interTime: 3000
- ,autoPlay: true
- ,autoPage: false
- ,trigger: "mouseover"
- });
- } else {
- var swiper = new Swiper('#swiper-container', {
- loop : true,
- autoplay: {
- delay: 3000,
- disableOnInteraction: false
- },
- navigation: {
- nextEl: '.swiper-button-next',
- prevEl: '.swiper-button-prev'
- },
- pagination: {
- el: '.swiper-pagination',
- type: 'bullets',
- clickable :true
- }
- });
- }
- },500);
- }
- });
- },
- getRecommends: function(){
- var _self = this;
- $.getJSON("/home/recommend").done(function (r) {
- if (r.code === 0 && r.data) {
- _self.recommends = r.data;
- setTimeout(function(){
- $('#recommendBox').slide({
- mainCell:"ul.bd"
- ,titCell:"ul.hd li"
- ,effect: "leftLoop"
- ,interTime: 2000
- ,autoPlay: true
- ,scroll:3
- ,vis:3
- ,pnLoop:false
- });
- },500);
- }
- });
- },
- getAdvertising: function(){
- var _self = this;
- $.getJSON("/home/advertising").done(function (r) {
- if (r.code === 0 && r.data) {
- _self.advertising = r.data;
- }
- });
- },
- getTopicData: function(){
- var _self = this;
- $.getJSON("/home/topic").done(function (r) {
- if (r.code === 0 && r.data) {
- _self.bigTopicData = r.data.bigTopicData;
- _self.topicData3 = r.data.topicData3;
- _self.topicData4 = r.data.topicData4;
- _self.topicData5 = r.data.topicData5;
- setTimeout(function(){
- _self.setAsideNav();
- },500)
- }
- });
- },
- setAsideNav: function(){
- var _self = this;
- var titArr = $('.floorTit').find('h2,h3');
- for (var i=0; i<titArr.length; i++){
- _self.asideNav.push({
- id: $(titArr[i]).attr("data-id"),
- value: $(titArr[i]).text()
- })
- }
- }
- },
- created: function() {
- this.getBanners();
- this.getRecommends();
- this.getTopicData();
- },
- mounted: function() {
- this.getAdvertising();
- }
- });
|