| | |
| | | <el-table-column label="操作" align="conter"> |
| | | <template slot-scope="scope"> |
| | | <el-button type="text" size="medium" @click="details(scope.row.id)">详情</el-button> |
| | | <el-button size="medium" type="text" @click="edit(scope.row.id)">修改</el-button> |
| | | <el-button type="text" size="medium" @click="punlish(scope.row.id, scope.row.status)" |
| | | :disabled="scope.row.status == 2"> |
| | | <span v-if="scope.row.status === 1" style="color:#ff0000">下架</span> |
| | |
| | | </el-dialog> |
| | | |
| | | <!--公共宣传详情弹窗--> |
| | | <el-dialog title="公共宣传详情" :visible.sync="detailsVisible" width="50%" :append-to-body="true" |
| | | <el-dialog :title="title" :visible.sync="detailsVisible" width="50%" :append-to-body="true" |
| | | :before-close="detailsVisibleclose"> |
| | | |
| | | <el-row :gutter="15"> |
| | | <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-input v-model="detailsRow.publicityTitle" :disabled="title=='详情'"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="24"> |
| | | <el-form-item label="正文图片"> |
| | | <el-upload |
| | | :file-list="detailsRow.media" |
| | | :on-preview="handlePictureCardPreview" |
| | | :on-remove="handleRemoves" |
| | | :on-success="uploadSuccess4" |
| | | :with-credentials="true" |
| | | 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"> |
| | | :disabled="title=='详情'"> |
| | | <i slot="default" class="el-icon-plus"></i> |
| | | </el-upload> |
| | | <!-- <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="title=='详情'"--> |
| | | <!-- class="freePic">--> |
| | | <!-- <i slot="default" class="el-icon-plus"></i>--> |
| | | <!-- </el-upload>--> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="24"> |
| | | <el-form-item label="内容 " prop="text"> |
| | | <el-input v-model="detailsRow.text" type="textarea" placeholder="请输入公告内容" disabled |
| | | <el-input v-model="detailsRow.text" type="textarea" placeholder="请输入公告内容" :disabled="title=='详情'" |
| | | :autosize="{ minRows: 4, maxRows: 4 }" :style="{ width: '100%' }"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | |
| | | </el-col> --> |
| | | <el-col :span="12"> |
| | | <el-form-item label="发布时间" prop="effectiveEtime"> |
| | | <el-date-picker v-model="detailsRow.releaseTime" type="datetime" placeholder="选择日期时间" disabled |
| | | <el-date-picker v-model="detailsRow.releaseTime" type="datetime" placeholder="选择日期时间" :disabled="title=='详情'" |
| | | :style="{ width: '100%' }" value-format="yyyy-MM-dd HH:mm:ss"> |
| | | </el-date-picker> |
| | | </el-form-item> |
| | |
| | | <span v-if="detailsRow.status === 1">已发布</span> |
| | | <span v-else-if="detailsRow.status === 0">未发布</span> |
| | | <span v-else="detailsRow.status === 2">已下架</span> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="24"> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="onSubmit" :disabled="title=='详情'">提交</el-button> |
| | | <el-button @click="detailsVisible= false">取消</el-button> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-form> |
| | |
| | | <script> |
| | | import { |
| | | getPublicityList, |
| | | addPublicityList |
| | | addPublicityList, editPublicityList |
| | | } from '@/api/publicty' |
| | | |
| | | |
| | |
| | | name: "Publicity", |
| | | data() { |
| | | return { |
| | | title:'详情', |
| | | detailsId:null, |
| | | dialogVisibleTime:false, |
| | | fileList: [], |
| | |
| | | handleCloseTime(){ |
| | | this.dialogVisibleTime = false |
| | | }, |
| | | uploadSuccess4(res, file) { |
| | | console.log(res,this.detailsRow.media.length) |
| | | if (res.code === 200) { |
| | | this.detailsRow.media.push({ |
| | | name: res.data, |
| | | url: '/minio/img/' + res.data, |
| | | uid:this.detailsRow.media.length+1 |
| | | }) |
| | | } else { |
| | | this.$message.error(res.msg) |
| | | } |
| | | }, |
| | | uploadSuccess3(res, file) { |
| | | if (res.code === 200) { |
| | | this.addPublicityForm.img.push({ |
| | |
| | | } else { |
| | | this.$message.error(res.msg) |
| | | } |
| | | }, |
| | | handleRemoves(file, fileList){ |
| | | console.log('>>>>>>>>>>>>>>>>>>>>>',this.detailsRow.media) |
| | | this.detailsRow.media = fileList |
| | | console.log(this.detailsRow.media) |
| | | }, |
| | | // 正文图片上传,删除操作 |
| | | handleRemove(file, fileList) { |
| | |
| | | ); |
| | | } |
| | | }, |
| | | |
| | | //详情 |
| | | details(val) { |
| | | onSubmit(){ |
| | | console.log('提交',this.detailsRow) |
| | | let obj = this.detailsRow |
| | | obj.photoStr = obj.media.map(item=> item.name).join(',') |
| | | editPublicityList(this.detailsRow).then(res=>{ |
| | | console.log(res) |
| | | this.detailsVisible = false |
| | | this.$message.success('修改成功') |
| | | }) |
| | | }, |
| | | edit(val){ |
| | | this.title = '修改' |
| | | this.detailsVisible = true; |
| | | this.$http.get('/api/publicity/' + val).then(res => { |
| | | this.detailsRow = res.data.data |
| | | this.detailsRow.img = this.detailsRow['photoStr'].split(',').map(item => { |
| | | this.detailsRow.media = this.detailsRow['photoStr'].split(',').map((item,index) => { |
| | | return { |
| | | name: item, |
| | | url: '/minio/img/' + item, |
| | | uid: this.detailsRow['photoStr'].split(',').length |
| | | uid: index+1 |
| | | } |
| | | }) |
| | | this.fileList = this.detailsRow.img |
| | | this.fileList = this.detailsRow.media |
| | | console.log(this.detailsRow) |
| | | }); |
| | | }, |
| | | //详情 |
| | | details(val) { |
| | | this.title = '详情' |
| | | this.detailsVisible = true; |
| | | this.$http.get('/api/publicity/' + val).then(res => { |
| | | this.detailsRow = res.data.data |
| | | this.detailsRow.media = this.detailsRow['photoStr'].split(',').map((item,index) => { |
| | | return { |
| | | name: item, |
| | | url: '/minio/img/' + item, |
| | | uid: index+1 |
| | | } |
| | | }) |
| | | this.fileList = this.detailsRow.media |
| | | }); |
| | | }, |
| | | //添加 |