123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- import { FormSchema } from '/@/components/Form';
- // import { uploadApi } from '/@/api/sys/upload';
- import { Tinymce } from '/@/components/Tinymce/index';
- import { h } from 'vue';
- import { uploadApi } from '/@/api/advertisement/list';
- import { BrandListApi } from '/@/api/order/list';
- export const padsSchemas: FormSchema[] = [
- {
- field: 'image',
- component: 'Upload',
- label: '封面',
- rules: [{ required: true, message: '请选择上传文件' }],
- itemProps: {
- validateTrigger: 'blur',
- },
- componentProps: {
- api: uploadApi,
- maxNumber: 1,
- accept: ['jpg', 'jpeg', 'gif', 'png'],
- afterFetch: function (data) {
- console.log('data', data);
- Reflect.set(data, 'url', data.message);
- return data;
- },
- },
- required: true,
- },
- {
- field: 'title',
- component: 'Input',
- label: '标题',
- componentProps: {
- placeholder: '标题',
- },
- required: true,
- },
- {
- field: 'connectId',
- label: '直播间名称',
- component: 'ApiSelect',
- required: true,
- itemProps: {
- validateTrigger: 'blur',
- },
- componentProps: {
- api: BrandListApi,
- // resultField: 'list',
- // numberToString: true,
- labelField: 'name',
- valueField: 'id',
- immediate: true,
- params: {
- page: 1,
- limit: 1000,
- },
- },
- },
- {
- field: 'orderNum',
- component: 'Input',
- label: '排序',
- defaultValue: 0,
- componentProps: {
- placeholder: '推荐排序',
- type: 'number',
- min: 0,
- },
- required: true,
- },
- // {
- // field: 'connectId',
- // component: 'Input',
- // label: '链接ID',
- // componentProps: {
- // placeholder: '链接',
- // },
- // // required: true,
- // },
- ];
- export const schemas: FormSchema[] = [
- {
- field: 'title',
- component: 'Input',
- label: '正文标题',
- componentProps: {
- placeholder: '轮播图正文标题',
- },
- required: true,
- },
- {
- field: 'orderNum',
- component: 'Input',
- label: '轮播排序',
- defaultValue: 0,
- componentProps: {
- placeholder: '轮播排序',
- type: 'number',
- min: 0,
- },
- required: true,
- },
- {
- field: 'url',
- component: 'Input',
- label: '链接',
- componentProps: {
- placeholder: '链接',
- },
- // required: true,
- },
- {
- field: 'image',
- component: 'Upload',
- label: '封面图',
- rules: [{ required: true, message: '请选择上传文件' }],
- itemProps: {
- validateTrigger: 'blur',
- },
- componentProps: {
- api: uploadApi,
- maxNumber: 1,
- afterFetch(data) {
- // console.log('afterFetch1', data);
- // const covertData = [data.message];
- Reflect.set(data, 'url', data.message);
- // console.log('afterFetch2', data);
- return data;
- },
- },
- required: true,
- },
- {
- field: 'content',
- component: 'Input',
- label: '正文内容',
- defaultValue: '',
- rules: [{ required: true }],
- render: ({ model, field }) => {
- return h(Tinymce, {
- value: model[field],
- onChange: (value: string) => {
- model[field] = value;
- },
- });
- },
- },
- ];
|