<template>
    <div class="add-edit-dialog-container">
        <el-dialog :title="title" :visible.sync="visible" width="600px" :before-close="close">
            <el-form :model="formData" ref="formData" :rules="rules" label-width="90px">
                <el-form-item label="标题:">
                    <span>{{ formData.title }}</span>
                </el-form-item>
                <el-form-item label="作者:">
                    <span>{{ formData.nickname }}</span>
                </el-form-item>
                <el-form-item label="品牌:">
                    <span>{{ formData.brandName }}</span>
                </el-form-item>
                <el-form-item label="封面图:">
                    <span @click="imgOpen(formData.cover)">
                        <el-image :src="formData.cover | pathPipe" style="width:100px;height:100px;cursor:pointer;"></el-image>
                    </span>
                </el-form-item>
                <el-form-item label="视频:">
                    <el-link
                    type="primary"
                    v-if="formData.url"
                    :href="formData.url | pathPipe"
                    target="_blank"
                    >查看视频</el-link>
                </el-form-item>
                <el-form-item label="描述:">
                    <span>{{ formData.descr }}</span>
                </el-form-item>
                <el-form-item label="浏览量:">
                    <span>{{ formData.browseNum}}</span>
                </el-form-item>
                <el-form-item label="收藏量:">
                    <span>{{ formData.favoriteNum }}</span>
                </el-form-item>
                <el-form-item label="点赞量:">
                    <span>{{ formData.likeNum }}</span>
                </el-form-item>
                <el-form-item prop="planDate" label="启用状态" min-width="110px;">
                    <el-switch
                        v-model="formData.statuz"
                        active-text="是"
                        inactive-text="否"
                        :active-value="1"
                        :inactive-value="0"
                        disabled
                    ></el-switch>
                </el-form-item>
                <el-form-item label="审核状态:">
                    <div>
                        <span class="warn" v-show="formData.checkFlag == 2">未审核</span>
                        <span class="success" v-show="formData.checkFlag == 1">审核通过</span>
                        <span class="danger" v-show="formData.checkFlag === 0">已驳回</span>
                    </div>
                </el-form-item>
                <el-form-item label="驳回原因:" v-show="formData.checkFlag === 0">
                    <span>{{ formData.checkComment }}</span>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="close()">取 消</el-button>
                <el-button
                    type="primary"
                    @click="submitForm('formData')"
                    :disabled="submitBtndisabled"
                >确 定</el-button>
            </div>
        </el-dialog>
    </div>
</template>
<script>
export default {
    data() {
        return {
            title: '详情',
            submitBtndisabled: false,
            rules: {},
            formData: { url: '' },
            visible: false,
        };
    },
    methods: {
        open(data) {
            this.visible = true;
            console.log(data, 'data');
            this.formData = { ...data };
            // this.formData.url = this.formData.url.split('/').pop();
        },
        close() {
            this.$refs['formData'].resetFields();
            this.visible = false;
        },
        submitForm() {
            this.close();
        },
        imgOpen(cover) {
            window.open(cover);
        },
    },
};
</script>
<style lang="stylus" scoped>
.add-edit-dialog-container {
    ::v-deep .el-form-item {
        margin-bottom: 0;
    }
}
</style>
