class.js 875 Bytes
import App from '../../utils/api.js'
import util from '../../utils/util.js'
Component({
	properties:{
		seller:Object,
		classidx:{
			type:Number,
			value:0
		}
	},
	data:{
		
	},
	attached(){
		this.getclasslist();
		let systeminfo=util.cache('system.info');
		let ratio=750/systeminfo.windowWidth;
		let headerHeight=util.cache('headerHeight')
		let contentheight=systeminfo.windowHeight-headerHeight-(418/ratio);
		this.setData({
			contentheight:Math.floor(contentheight)
		})
	},
	methods:{
		getclasslist(){
			App.Cookbook.GetCookbookClassBySellerId({SellerId:this.data.seller.id,type:2}).then((json)=>{
				console.log(json)
				this.setData({
					classlist:json.data[0]
				})
			})
		},
		selectclass(e){
			let classidx=e.currentTarget.dataset.index;
			if(classidx!=this.data.classidx){
				this.triggerEvent('tellclass',{classidx:classidx})
			}
			
		}
	}
})