| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- var app = new Vue({
- el: '#app',
- data: {
- submitStatus: false,
- // 幻灯片列表
- advertList: [],
- // 资讯列表
- noticeList: [],
- // 用户信息
- memberInfo: {},
- },
- created: function () {
- this.getMemberInfo();
- this.getAdvertList();
- this.getNoticeList();
- },
- updated: function(){
- // 顶部轮播图
- var mySwiper = new Swiper ('.swiper-container', {
- // 如果需要分页器
- autoplay:true,
- pagination: {
- el: '.swiper-pagination'
- }
- });
- // 新闻资讯
- var swiper = new Swiper('.notice-box', {
- autoplay:true,
- delay: 1000,
- direction: 'vertical'
- });
- },
- methods: {
- // 获取用户信息
- getMemberInfo: function(){
- var _this = this;
- $.post('/weixin/member/getMemberInfo', {}, function (res) {
- if (res.code == 'success') {
- _this.memberInfo = res.data
- }else if(res.code == 'login'){
- login(res.data.url);
- }
- }, "json");
- },
- // 获取幻灯片,列表
- getAdvertList: function(){
- var _this = this;
- $.showLoading("数据加载中");
- $.post('/weixin/index/getAdvertList', {type:2}, function (res) {
- $.hideLoading();
- if (res.code == 'success') {
- _this.advertList = res.data
- }else if(res.code == 'login'){
- login(res.data.url);
- }
- }, "json");
- },
- // 获取资讯列表
- getNoticeList: function(){
- var _this = this;
- $.showLoading("数据加载中");
- $.post('/weixin/news/getNoticeList', {pageSize: 50}, function (res) {
- $.hideLoading();
- if (res.code == 'success') {
- _this.noticeList = res.data
- }else if(res.code == 'login'){
- login(res.data.url);
- }
- }, "json");
- }
- }
- });
|