| | |
| | | </a-upload> --> |
| | | |
| | | <a-upload :customRequest="customRequest" name="file" :showUploadList="true" @change="handleChange" |
| | | :default-file-list="form.blogFileList" |
| | | :beforeUpload="beforeUpload" |
| | | > |
| | | :default-file-list="form.blogFileList" :beforeUpload="beforeUpload"> |
| | | |
| | | <a-button> |
| | | <a-icon type="upload" />限 markdown/html |
| | |
| | | </a-upload> |
| | | </a-form-model-item> |
| | | |
| | | <a-form-model-item label="日志内容" v-show="form.online" prop="content"> |
| | | <a-form-model-item label="日志内容" v-show="form.online"> |
| | | <a-input v-model="form.content" type="textarea" placeholder="限10k字数" /> |
| | | </a-form-model-item> |
| | | |
| | |
| | | import { |
| | | sysFileInfoUpload |
| | | } from '../../api/fileManage.js'; |
| | | |
| | | import { |
| | | queryBlogArticleType |
| | | } from '../../api/blogArticleType.js' |
| | | |
| | | |
| | | export default { |
| | | beforeMount() { |
| | | queryBlogArticleType({}).then((res) => { |
| | |
| | | if (this.form.online) { |
| | | console.log("内容未填"); |
| | | this.$refs.myForm.validateField('content') |
| | | if (this.form.content == null || this.form.content == "") { |
| | | callback(new Error('内容未填')); |
| | | } |
| | | } else { |
| | | console.log("文件未传"); |
| | | this.$refs.myForm.validateField('blogFileList') |
| | | if (this.form.blogFileList == null || this.form.blogFileList.length == 0) { |
| | | callback(new Error('文件未传')); |
| | | } |
| | | } |
| | | callback(); |
| | | }; |
| | | |
| | | return { |
| | | blogArticleType: [], |
| | | // blogFileList: [], |
| | | // coverFileList: [ |
| | | // // { |
| | | // // uid: '-1', |
| | | // // name: 'xxx.png', |
| | | // // status: 'done', |
| | | // // url: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png', |
| | | // // thumbUrl: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png', |
| | | // // } |
| | | // ], |
| | | tags: [], |
| | | inputVisible: false, |
| | | inputValue: '', |
| | |
| | | trigger: 'blur' |
| | | }, |
| | | { |
| | | min: 5, |
| | | min: 1, |
| | | max: 50, |
| | | message: '字数限制1~50', |
| | | trigger: 'blur' |
| | |
| | | validator: validateContent, |
| | | trigger: [] |
| | | }], |
| | | content: [{ |
| | | max: 10, |
| | | required: true, |
| | | message: '至少填一下上传内容', |
| | | trigger: 'blur' |
| | | }, ], |
| | | blogFileList: [{ |
| | | max: 1, |
| | | required: true, |
| | | message: '文件未上传', |
| | | }], |
| | | // content: [{ |
| | | // max: 10, |
| | | // required: true, |
| | | // message: '至少填一下上传内容', |
| | | // trigger: 'blur' |
| | | // }, ], |
| | | // blogFileList: [{ |
| | | // max: 1, |
| | | // required: true, |
| | | // message: '文件未上传', |
| | | // }], |
| | | class: [{ |
| | | required: true, |
| | | message: '至少选一个分类', |
| | | trigger: 'blur' |
| | | }, ], |
| | | // region: [{ |
| | | // required: true, |
| | | // message: 'Please select Activity zone', |
| | | // trigger: 'change' |
| | | // }], |
| | | // date1: [{ |
| | | // required: true, |
| | | // message: 'Please pick a date', |
| | | // trigger: 'change' |
| | | // }], |
| | | // type: [{ |
| | | // type: 'array', |
| | | // required: true, |
| | | // message: 'Please select at least one activity type', |
| | | // trigger: 'change', |
| | | // }, ], |
| | | // resource: [{ |
| | | // required: true, |
| | | // message: 'Please select activity resource', |
| | | // trigger: 'change' |
| | | // }, ], |
| | | // desc: [{ |
| | | // required: true, |
| | | // message: 'Please input activity form', |
| | | // trigger: 'blur' |
| | | // }], |
| | | |
| | | } |
| | | }; |
| | | }, |
| | |
| | | console.log(333); |
| | | console.log(this.blogFileList); |
| | | return new Promise((resolve, reject) => { |
| | | if(fileList.length>=2){ |
| | | if (fileList.length >= 2) { |
| | | this.$message.error('这里最多上传一个文件'); |
| | | return reject(false); |
| | | } |
| | | // var testmsg=/^image\/(jpeg|png|jpg)$/.test(file.type) |
| | | // // var testmsg=/^image\/(md|html|markdown)$/.test(file.type) |
| | | // if (!testmsg) { |
| | | // this.$message.error('上传文件格式不对!'); |
| | | // return reject(false); |
| | | // } |
| | | |
| | | const isLt2M = file.size / 1024 / 1024 <=2//图片大小不超过2MB |
| | | if(!isLt2M) { |
| | | this.$message.error('上传文件大小不能超过 2M!'); |
| | | return reject(false); |
| | | } |
| | | return resolve(true) |
| | | }); |
| | | |
| | | // var testmsg=/^image\/(jpeg|png|jpg)$/.test(file.type) |
| | | // // var testmsg=/^image\/(md|html|markdown)$/.test(file.type) |
| | | // if (!testmsg) { |
| | | // this.$message.error('上传文件格式不对!'); |
| | | // return reject(false); |
| | | // } |
| | | |
| | | const isLt2M = file.size / 1024 / 1024 <= 2 //图片大小不超过2MB |
| | | if (!isLt2M) { |
| | | this.$message.error('上传文件大小不能超过 2M!'); |
| | | return reject(false); |
| | | } |
| | | return resolve(true) |
| | | }); |
| | | |
| | | }, |
| | | handleChange(info) { |
| | | if (info.file.status !== 'uploading') { |