| | |
| | | :style="{ width: '100%' }"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col> |
| | | <el-form-item label="正文图片"> |
| | | <el-upload |
| | | action="/api/minio/upload" |
| | | list-type="picture-card" |
| | | :with-credentials="true" |
| | | :on-preview="handlePictureCardPreview" |
| | | :on-success="uploadSuccess3" |
| | | :on-remove="handleRemove" |
| | | :file-list="addPublicityForm.img"> |
| | | <i slot="default" class="el-icon-plus"></i> |
| | | </el-upload> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="24"> |
| | | <el-form-item label="内容 " prop="content"> |
| | | <el-input v-model="addPublicityForm.text" type="textarea" placeholder="请输入公告内容" clearable |
| | |
| | | </span> |
| | | </el-dialog> |
| | | |
| | | <!-- 图片放大弹窗 --> |
| | | <el-dialog :visible.sync="dialogVisible"> |
| | | <img width="100%" :src="dialogImageUrl" alt=""> |
| | | </el-dialog> |
| | | |
| | | <!--公共宣传详情弹窗--> |
| | | <el-dialog title="公共宣传详情" :visible.sync="detailsVisible" width="50%" :append-to-body="true" |
| | | :before-close="detailsVisibleclose"> |
| | | |
| | | <el-row :gutter="15"> |
| | | <el-form ref="addGroupForm" :model="addGroupForm" size="medium" label-width="100px"> |
| | | <el-form ref="addGroupForm" :model="detailsRow" size="medium" label-width="100px"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="标题" prop="effectiveEtime"> |
| | | <el-input v-model="detailsRow.publicityTitle" disabled></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="24"> |
| | | <el-form-item label="正文图片"> |
| | | <el-upload |
| | | action="/api/minio/upload" |
| | | list-type="picture-card" |
| | | :with-credentials="true" |
| | | :on-preview="handlePictureCardPreview" |
| | | :on-success="uploadSuccess3" |
| | | :on-remove="handleRemove" |
| | | :file-list="detailsRow.img" |
| | | disabled |
| | | class="freePic"> |
| | | <i slot="default" class="el-icon-plus"></i> |
| | | </el-upload> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="24"> |
| | |
| | | name: "Publicity", |
| | | data() { |
| | | return { |
| | | |
| | | |
| | | fileList: [], |
| | | dialogImageUrl: '', |
| | | dialogVisible: false, |
| | | //详细内容弹框 |
| | | detailsVisible: false, |
| | | //详细内容 |
| | |
| | | //表单提交内容 |
| | | addPublicityForm: { |
| | | publicityTitle: '', |
| | | text: '' |
| | | text: '', |
| | | img: [] |
| | | }, |
| | | //添加弹框 |
| | | addPublicityVisibel: false, |
| | |
| | | }, |
| | | methods: |
| | | { |
| | | uploadSuccess3(res, file) { |
| | | if (res.code === 200) { |
| | | this.addPublicityForm.img.push({ |
| | | name: res.data, |
| | | url: '/minio/img/' + res.data, |
| | | uid: this.addPublicityForm.img.length |
| | | }) |
| | | } else { |
| | | this.$message.error(res.msg) |
| | | } |
| | | }, |
| | | // 正文图片上传,删除操作 |
| | | handleRemove(file, fileList) { |
| | | // file是点击删除的文件,fileList时删除后剩下的文件列表 |
| | | this.addPublicityForm.img = fileList |
| | | }, |
| | | handlePictureCardPreview(file) { |
| | | this.dialogImageUrl = file.url |
| | | this.dialogVisible = true |
| | | }, |
| | | //删除 |
| | | remove(val) { |
| | | this.$http.delete('/api/publicity/' + val).then(res => { |
| | |
| | | //详情 |
| | | details(val) { |
| | | this.detailsVisible = true; |
| | | this.$http.get('/api/publicity/' + val).then(res => this.detailsRow = res.data.data); |
| | | this.$http.get('/api/publicity/' + val).then(res => { |
| | | this.detailsRow = res.data.data |
| | | this.detailsRow.img = this.detailsRow['photoStr'].split(',').map(item => { |
| | | return { |
| | | name: item, |
| | | url: '/minio/img/' + item, |
| | | uid: this.detailsRow['photoStr'].split(',').length |
| | | } |
| | | }) |
| | | this.fileList = this.detailsRow.img |
| | | }); |
| | | }, |
| | | //添加 |
| | | add() { |
| | | this.$refs.addPublicityForm.validate(async (vaild) => { |
| | | if (!vaild) return this.$message.error('输入有误') |
| | | let param = null; |
| | | param = this.addPublicityForm; |
| | | param = JSON.parse(JSON.stringify(this.addPublicityForm)); |
| | | param.photoStr = param.img.map(item => item.name).join(','); |
| | | addPublicityList(param).then(res => { |
| | | this.$message({ |
| | | message: '操作成功', |
| | |
| | | ::v-deep(.el-table thead) { |
| | | color: #000000; |
| | | } |
| | | .freePic ::v-deep .el-upload--picture-card { |
| | | display: none; |
| | | } |
| | | </style> |