d_index.js 2.27 KB
Page({
    data:{
        blocks:[1,2,3],
        searchlist:[
            {
                title:'最新发布',
                isactive:true,
            },
            {
                title:'离我最近',
                isactive:false,
            },
            {
                title:'最快开始',
                isactive:false,
            },
            {
                title:'参与最多',
                isactive:false,
            },
        ],
        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:'我听见背后有人说我帅'
            }
        ],
        isshow:false,
        menuright:20,
        menubottom:650,
        team:true,
        sort:true,
        home:false


    },
    onLoad:function(){

    },
    onShow:function(){

    },
    record:function(){

    },
    menushow:function(){
        this.setData({
            isshow:!this.data.isshow
        })
    },
    menumove:function(e){
       var pagex=e.touches[0].pageX;
       var pagey=e.touches[0].pageY;
       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
        })
    }
})