// components/diy-store/index.js
const Parse = getApp().Parse;
const company = getApp().globalData.company;
var Nova = getApp().Nova;
Component({
    /**
     * 组件的属性列表
     */
    properties: {
        options: null,

    },

    /**
     * 组件的初始数据
     */
    data: {
        // template: {
        //     type: Number,
        //     value: 1,
        // }
        list: null,
    },
    lifetimes: {

    },

    ready: function() {
        // this.getUser();
        // this.getAccount();
        this.loadData();
    },

    /**
     * 组件的方法列表
     */
    methods: {
        async loadData() {
            await Nova.checkComponentsDataProperties(this);
            let list = await Nova.getBlockData(this.data.options.data)
            let {
                options
            } = this.data

            let {
                data,
                style,
            } = options

            this.setData({
                list,
                data,
                style,
            })
            console.log(style, 123);
        },
        // async getUser() {
        //     let _user = new Parse.Query('_User')
        //     let user = await _user.get(Parse.User.current().id)
        //     console.log(user);
        //     this.setData({
        //         user: user.toJSON()
        //     })
        // },

        // async getAccount() {
        //     let uid = Parse.User.current().id
        //     let account = new Parse.Query('Account')
        //     account.equalTo('user', uid)
        //     let users = await account.first()
        //     if (users && users.id) {
        //         this.setData({
        //             account: users.toJSON()
        //         })
        //         console.log(this.data.account);
        //     }
        // }
    }
})