d_index.js 2.55 KB
var comfun = require('../../comjs/comfun.js');
Page({
    data:{
        blocks:[1,2,3],
        banners:[
            // {
            //     imgurl:'http://qn.colorcun.com/a.jpeg',
            //     info:'你愿意跟我做朋友吗'
            // },
            {
                imgurl:'http://qn.colorcun.com/b.png',
                info:'我在认真听讲,不要打扰我'
            },
            {
                imgurl:'http://qn.colorcun.com/c.png',
                info:'我听见背后有人说我帅'
            }
        ],
        midlist:[
            {
                icon:'/pages/image/mid-team.svg',
                title:'组队',
                path:'../team/team'
            },
            {
                icon:'/pages/image/mid-front.svg',
                title:'榜单',
                path:'../rank/rank'
            },
            {
                icon:'/pages/image/mid-say.svg',
                title:'话题',
                path:''
            },
            {
                icon:'/pages/image/mid-act.svg',
                title:'活动',
                path:''
            }
        ],
        isshow:false,
        menuright:20,
        menubottom:650,
        team:true,
        sort:true,
        home:false


    },
    onLoad:function(){
        comfun.setBarTitle('社区')
    },
    onShow:function(){

    },
    record:function(){

    },
    menushow:function(){
        this.setData({
            isshow:!this.data.isshow
        })
    },
    menumove:function(e){
       console.log(e)
       var pagex=e.touches[0].clientX;
       var pagey=e.touches[0].clientY;
       var system=wx.getStorageSync('system')
        console.log(system)
       var screenwidth=system.windowWidth;
       var screenheight=system.windowHeight;
       var ratio=750/screenwidth;
       if(pagex<300/ratio){
           pagex=300/ratio
       }
       if(pagey<240/ratio){
           pagey=240/ratio
       }
       this.setData({
           menuright:Math.round((screenwidth-pagex)*ratio)>=20 ? Math.round((screenwidth-pagex)*ratio) : 20,
           menubottom:Math.round((screenheight-pagey)*ratio)<240 ? 240 : Math.round((screenheight-pagey)*ratio)
       })


    },
    team:function(){
        this.setData({
            team:false,
            sort:true,
            home:true
        })
    },
    sort:function(){
        this.setData({
            team:true,
            sort:false,
            home:true
        })
    },
    home:function(){
        this.setData({
            team:true,
            sort:true,
            home:false
        })
    }
})