var App=new Vue({
	el:"#App",
	data() {
		return {
			users: [],
			groups: [],
			list: {},
			zm: "A",
			zms: {},
			newNum: 0
		}
	},
	created() {
		this.getPage();
		this.getNewNum();
		 
	},
	onPageScroll: function(e) {
		var that = this;
		//e.scrollTop
		var y = e.scrollTop;
		var zms = this.zms;
		for (var el in zms) {
			if (zms[el] > y) {
				that.zm = el;
				break;
			}
		}
	},
	methods: {
		gourl: function(url) {
			window.location=url;			 
		},
		goPm: function(uid) {
			window.location="/index.php?m=pm&a=pm_detail";
			 
		},
		setZm: function(zm) {
			this.zm = zm;
			var y = this.zms[zm];
			$(window).scrollTop(y);
		},
		getZmsy: function() {
			var that = this;
			var zms = this.zms;
			 
			for (var el in zms) {
				zms[el] = document.getElementById("zms" + el).offsetTop;
			}
			this.zms = zms;
			 


		},
		getPage: function() {
			var that = this;
			$.ajax({
				dataType:"json",
				url: "/index.php?m=friend&a=zm&ajax=1",
				success: function(res) {
					that.list = res.data.list;
					var zms = Array();
					for (var i in that.list) {
						zms[i] = 0;
					}
					that.zms = zms;
					setTimeout(function() {
						that.getZmsy();
					}, 300)
				}
			})
		},
		getNewNum: function() {
			var that = this;
			$.ajax({
				dataType:"json",
				url:  "/index.php?m=friend_apply&a=newnum",
				success: function(res) {
					that.newNum = res.data;
				}
			})
		}
	}
})
