<template>
    <div>
        <div>
            <schoolid-card
            />
            <school-card
                />


        </div>
        <add-present-button :can_add="button_active"/>
    </div>
</template>

<script>
    import AddPresentButton from "../components/addPresentButton";
    import SchoolidCard from "../components/schoolidCard";
    import SchoolCard from "../components/schoolCard";
    export default {
        name: "me",
        components: {SchoolCard, SchoolidCard, AddPresentButton},
        data() {
            return {
                button_active: true
            }

        },
        created: function () {
            this.button_active = false;

            var userId = localStorage.getItem("frontend-userid");
            BasicFunction.get_data("smartIdentity/list?userId="+userId, function (response) {
                console.log("------ Data Rcvd in PresentReg --------");
                console.log(response);
                if(response.ret === "10000"){
                    // 不需要 设置 SessionID， 已经自动保存在jSessionID中
                    this.$router.push('index');
                } else {
                    // 注册失败的处理
                    Toast.fail("读取失败，请检查网络");
                }
            }, {});

            BasicFunction.get_data("smartIdentity/updateBatch", function (response) {
                console.log("------ Data Rcvd in PresentReg --------");
                console.log(response);
                if(response.ret === "10000"){
                    this.$router.push('index');
                } else {
                    // 注册失败的处理
                    Toast.fail("上传失败，请检查网络");
                }
            }, [{"reviewId":1,"userId":1,"dormDistrict":10,
                "userSex":1,"userSchoolCard":20123333222,
                "userReviewStatus":1000,
                "reviewerId":1,"reviewerNote":"nmo",
                "reviewerNoteToUser":"noo"}]);
        }
    }
</script>

<style scoped>

</style>