add.vue 3.83 KB
<template>
    <div class="case-ctnr">
        <div class="main-wrap">
            <div class="global-title">新增案例</div>
            <glsx-combi-form :isInline="false" class="glsx-combi-form" ref="baseInfoRef" labelWidth="154px" defaultWidth="432px" :formObj.sync="formObj" :formData="formData" :formRules="myRule">
                <div slot="videoCoverSlot">
                    <glsx-preview :picOptions="posterOptions" :imageUrlArr="formObj.videoCoverArr" @change="changeChannelImg"></glsx-preview>
                    <div class="text-tip" style="margin: 0;">建议尺寸:272*364</div>
                </div>
                <div slot="selectBrandSlot">
                    <el-radio-group v-model="formObj.brandType">
                        <el-radio :label="1">全部品牌</el-radio>
                        <el-radio :label="2">部分品牌</el-radio>
                    </el-radio-group>
                    <div v-if="formObj.brandType == 2">
                        <el-button class="el-icon-plus"  size="small" @click="openBrandDialog">选择品牌</el-button>
                    </div>
                </div>
            </glsx-combi-form>
        </div>
        <GLFooter>
            <el-button @click="handleCancel">取消</el-button>
            <el-button type="primary" @click="handleSave">确定</el-button>
        </GLFooter>
        <GLDialog title="选择车系"
            mode="mid"
            :visible.sync="dialogVisible"
            :before-close="handleClose"
            :close-on-click-modal="false"
            @onOk="handleConfirm"
            @onCancel="handleClose">
            <div class="car-container">
            </div>
        </GLDialog>
    </div>
</template>
<script>
import glsxCombiForm from '@/components/glsx-combi-form'
export default {
    name: 'add',
    components: {
        glsxCombiForm
    },
    data() {
        return {
            dialogVisible: false,
            formObj:{
                brandType: 1,
                videoCoverArr: []
            },
            posterOptions: {
                width: '104px',
                height: '138px',
                key: 'posterImg',
                isClose: true
            },
            myRule:{
                title: [{ required: true, message: '请输入案例名称', trigger: 'blur' }],
                channelStyle: [{ required: true, message: '请选择频道主题', trigger: 'change' }],
            },
            formData:[
                {
                    label: '案例名称',
                    name: 'title',
                    type: 'input',
                    isDisabled: false
                },
                {
                    label: '选择视频',
                    name: 'title',
                    type: 'input',
                    isDisabled: false
                },
                {
                    label: '视频封面图',
                    name: 'videoCover',
                    addHtml: 'videoCoverSlot'
                },
                {
                    label: '宣传文案',
                    placeholder: '发现频道视频宣传语',
                    name: 'title',
                    maxlength: 100,
                    type: 'input',
                    showLimit: true,
                    inputType: 'textarea',
                    isDisabled: false
                },
                {
                    label: '适用品牌',
                    name: 'zone',
                    addHtml: 'selectBrandSlot'
                }
            ],
        }
    },
    methods:{
        openBrandDialog(){
            this.dialogVisible = !this.dialogVisible
        },
        changeChannelImg(val){
            console.log(val)
        }
    }
}
</script>
<style scoped lang="scss">
.case-ctnr{
    .glsx-combi-form{
        padding: 20px;
        background-color: #fff;
        margin-bottom: 16px;
    }
}
</style>