You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

99 lines
3.5 KiB

3 years ago
<template>
<div class="main-content">
<div class="form-area">
<el-form size="default" :model="form" label-width="120px">
<el-form-item label="分组" style="width: 80%">
3 years ago
<el-select v-model="form.groupId" placeholder="请选择">
<el-option :value="0" label="不分组"></el-option>
3 years ago
</el-select>
</el-form-item>
<el-form-item label="车系" style="width: 80%">
3 years ago
<div>
<el-checkbox-group v-model="form.brandList">
<el-checkbox v-for="(item,index) in brandData" :key="index" :label="item.id">
{{item.name}}
</el-checkbox>
</el-checkbox-group>
</div>
</el-form-item>
<el-form-item label="类型" style="width: 80%">
<el-select v-model="form.type" placeholder="请选择">
<el-option :value="1" label="视频"></el-option>
<el-option :value="2" label="图片"></el-option>
<el-option :value="3" label="文字"></el-option>
3 years ago
</el-select>
</el-form-item>
<el-form-item label="标签" style="width: 80%">
3 years ago
<el-checkbox-group v-model="form.tagList">
<el-checkbox v-for="(item,index) in tagData" :key="index" :label="item.id">
{{item.title}}
</el-checkbox>
</el-checkbox-group>
3 years ago
</el-form-item>
<el-form-item label="素材描述" style="width: 80%">
<el-input type="textarea" v-model="form.description" />
</el-form-item>
<el-form-item label="素材内容" style="width: 100%">
<uploadFile @change="handlerUpload" :config="{ limit: 1, accept: '.jpg, .jpeg, .png, .gif'}">
<el-button>上传文件</el-button>
</uploadFile>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="confirm"></el-button>
</el-form-item>
</el-form>
</div>
</div>
</template>
<script>
3 years ago
import {defineComponent,reactive,ref,getCurrentInstance} from 'vue'
3 years ago
export default defineComponent({
name: 'v-matUpload',
setup() {
const activeId = reactive({
value: 0
});
const form = reactive({
3 years ago
groupId: 0,
title: '',
tagList: [],
brandList: [],
3 years ago
});
3 years ago
const tagData = ref([]);
const brandData = ref([]);
const { proxy } = getCurrentInstance();
3 years ago
return {
3 years ago
form,proxy,
tagData,brandData,
3 years ago
activeId
}
},
3 years ago
mounted() {
this.getApi()
},
3 years ago
methods: {
3 years ago
getApi() {
this.proxy.$post("/tag/list", {}).then(res => {
this.tagData = res.data.records;
}).catch(() => {});
this.proxy.$post("/brand/list", {}).then(res => {
this.brandData = res.data.records;
}).catch(() => {});
},
3 years ago
confirm() {
this.$router.go(-1);
},
//素材上传
3 years ago
handlerUpload(data) {
console.log(data)
3 years ago
}
}
})
</script>
<style lang="less">
.form-area {
width: 600px
}
</style>