<template>
    <div class="card" style="margin-bottom: 20px">
        <van-row>
            <van-col span="16">
                <h3><strong>校卡审核</strong></h3>
            </van-col>
            <van-col span="8">
               <p :style="{ color: statusColor[2] }">{{statusString[2]}}</p>
            </van-col>
        </van-row>
        <add-photo @uploadPhoto="onReadPhoto"/>
        <p>活动仅允许深大学生参与，请上传正面校卡照片审核~</p>


    </div>
</template>

<script>
    import {  Row, Col,  } from 'vant';
    import AddPhoto from "../components/addPhoto";
    export default {
        name: "schoolCard",
        components: {
            AddPhoto,
            [Row.name]: Row, [Col.name]: Col,
        },
        data() {
            return {
                statusString: ['审核中', '未上传校卡', '审核通过', '审核失败'],
                statusColor: ['#f43736', '#00ff00', '#00fa9a', '#ff0000'],
                photo: null,
            }
        },
        methods: {
            publishPresent() {
                // 检验输入

                if (this.photo === null) {
                    Toast.fail('请上传礼物照片');
                    return;
                }
                // post_present()
                let present = {
                    photo: this.photo
                };
                console.log(present);
                BasicFunction.get_data("ajaxpostpresent", function (response) {
                    console.log("------ Data Rcvd in PresentReg --------");
                    console.log(response);
                    if(response.ret === "10000"){
                        // 不需要 设置 SessionID， 已经自动保存在jSessionID中
                        this.$router.push('index');
                    } else {
                        // 注册失败的处理
                        Toast.fail("上传失败，请检查网络");
                    }
                }, {});
                // this.$router.push('index');
            },
            onReadPhoto(file) {
                this.photo = file;
            }
        },

    }
</script>

<style scoped>
    p, h3 {
        color: #fd6740;
    }
    h3 {
        padding: 5px;
        border-bottom: solid 1px #e4e4e4;
    }
    p {
        padding-top:  3px ;
    }
    .card {
        background-color: white;
        margin: 20px 20px;
        border: solid 1px #e4e4e4;
        padding: 15px;
        text-align: left;
    }
</style>