From 034d8675792fee6af5af592df0b69acd3ad8a215 Mon Sep 17 00:00:00 2001 From: odc.xiaohui <xiaohui@Q1> Date: 星期二, 07 三月 2023 10:50:21 +0800 Subject: [PATCH] 调整群组交流样式 --- src/views/common/Publicity.vue | 335 +++++++++++++++++++++++++++++++++---------------------- 1 files changed, 203 insertions(+), 132 deletions(-) diff --git a/src/views/common/Publicity.vue b/src/views/common/Publicity.vue index 812e706..1890932 100644 --- a/src/views/common/Publicity.vue +++ b/src/views/common/Publicity.vue @@ -21,7 +21,7 @@ <el-form-item> <el-upload name="multipartFile" class="upload-demo" action="/api/publicity/upload " :show-file-list="false" - :before-upload="beforeAvatarUpload" :on-success="respond" :limit="1"> + :before-upload="beforeAvatarUpload" :on-success="respond" :limit="1"> <el-button type="primary">瀵煎叆</el-button> </el-upload> </el-form-item> @@ -52,7 +52,7 @@ <template slot-scope="scope"> <el-button type="text" size="medium" @click="details(scope.row.id)">璇︽儏</el-button> <el-button type="text" size="medium" @click="punlish(scope.row.id, scope.row.status)" - :disabled="scope.row.status == 2"> + :disabled="scope.row.status == 2"> <span v-if="scope.row.status === 1" style="color:#ff0000">涓嬫灦</span> <span v-else>鍙戝竷</span> </el-button> @@ -63,24 +63,38 @@ </el-table> </template> <el-pagination @current-change="handleCurrentChange" :current-page="queryInfo.current" :page-size="queryInfo.size" - layout="prev, pager, next" :total="total"></el-pagination> + layout="prev, pager, next" :total="total"></el-pagination> </el-card> <!--娣诲姞鍏叡瀹d紶寮圭獥--> <el-dialog title="鍏叡瀹d紶娣诲姞" :visible.sync="addPublicityVisibel" width="50%" :before-close="addPublicityClose" - :append-to-body="true"> + :append-to-body="true"> <el-row :gutter="15"> <el-form ref="addPublicityForm" :model="addPublicityForm" :rules="rules" size="medium" label-width="100px"> <el-col :span="12"> <el-form-item label="鏍囬 " prop="publicityTitle"> <el-input v-model="addPublicityForm.publicityTitle" clearable placeholder="璇疯緭鍏ユ爣棰�" - :style="{ width: '100%' }"></el-input> + :style="{ width: '100%' }"></el-input> + </el-form-item> + </el-col> + <el-col> + <el-form-item label="姝f枃鍥剧墖"> + <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 - :autosize="{ minRows: 4, maxRows: 4 }" :style="{ width: '100%' }"></el-input> + :autosize="{ minRows: 4, maxRows: 4 }" :style="{ width: '100%' }"></el-input> </el-form-item> </el-col> </el-form> @@ -91,21 +105,42 @@ </span> </el-dialog> + <!-- 鍥剧墖鏀惧ぇ寮圭獥 --> + <el-dialog :visible.sync="dialogVisible"> + <img width="100%" :src="dialogImageUrl" alt=""> + </el-dialog> + <!--鍏叡瀹d紶璇︽儏寮圭獥--> <el-dialog title="鍏叡瀹d紶璇︽儏" :visible.sync="detailsVisible" width="50%" :append-to-body="true" - :before-close="detailsVisibleclose"> + :before-close="detailsVisibleclose"> <el-row :gutter="15"> - <el-form ref="addGroupForm" :model="addGroupForm" size="medium" label-width="100px"> - <el-col :span="12"> + <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="姝f枃鍥剧墖"> + <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"> <el-form-item label="鍐呭 " prop="text"> <el-input v-model="detailsRow.text" type="textarea" placeholder="璇疯緭鍏ュ叕鍛婂唴瀹�" disabled - :autosize="{ minRows: 4, maxRows: 4 }" :style="{ width: '100%' }"></el-input> + :autosize="{ minRows: 4, maxRows: 4 }" :style="{ width: '100%' }"></el-input> </el-form-item> </el-col> <!-- <el-col :span="12"> @@ -125,7 +160,7 @@ <el-col :span="12"> <el-form-item label="鍙戝竷鏃堕棿" prop="effectiveEtime"> <el-date-picker v-model="detailsRow.releaseTime" type="datetime" placeholder="閫夋嫨鏃ユ湡鏃堕棿" disabled - :style="{ width: '100%' }" value-format="yyyy-MM-dd HH:mm:ss"> + :style="{ width: '100%' }" value-format="yyyy-MM-dd HH:mm:ss"> </el-date-picker> </el-form-item> </el-col> @@ -188,8 +223,9 @@ name: "Publicity", data() { return { - - + fileList: [], + dialogImageUrl: '', + dialogVisible: false, //璇︾粏鍐呭寮规 detailsVisible: false, //璇︾粏鍐呭 @@ -197,7 +233,8 @@ //琛ㄥ崟鎻愪氦鍐呭 addPublicityForm: { publicityTitle: '', - text: '' + text: '', + img: [] }, //娣诲姞寮规 addPublicityVisibel: false, @@ -254,130 +291,161 @@ }, methods: - { - //鍒犻櫎 - remove(val) { - this.$http.delete('/api/publicity/' + val).then(res => { - this.$message({ - message: '鍒犻櫎鎴愬姛', - type: 'success' - }) + { + 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) + } + }, + // 姝f枃鍥剧墖涓婁紶,鍒犻櫎鎿嶄綔 + handleRemove(file, fileList) { + // file鏄偣鍑诲垹闄ょ殑鏂囦欢锛宖ileList鏃跺垹闄ゅ悗鍓╀笅鐨勬枃浠跺垪琛� + this.addPublicityForm.img = fileList + }, + handlePictureCardPreview(file) { + this.dialogImageUrl = file.url + this.dialogVisible = true + }, + //鍒犻櫎 + remove(val) { + this.$http.delete('/api/publicity/' + val).then(res => { + this.$message({ + message: '鍒犻櫎鎴愬姛', + type: 'success' + }) - this.search(); - }) - }, - //鍙戝竷/涓嬫灦 - punlish(val, val2) { - if (val2 == 0) { - this.$http.get('/api/publicity/release/' + val).then(res => { - this.$message({ - message: '鍙戝竷鎴愬姛', - type: 'success' + this.search(); }) + }, + //鍙戝竷/涓嬫灦 + punlish(val, val2) { + if (val2 == 0) { + this.$http.get('/api/publicity/release/' + val).then(res => { + this.$message({ + message: '鍙戝竷鎴愬姛', + type: 'success' + }) - this.search(); - } - ) - } - if (val2 == 1) { - this.$http.get('/api/publicity/offline/' + val).then(res => { - this.$message({ - message: '涓嬫灦鎴愬姛', - type: 'success' - }) - this.search(); - } - ); - } - }, + this.search(); + } + ) + } + if (val2 == 1) { + this.$http.get('/api/publicity/offline/' + val).then(res => { + this.$message({ + message: '涓嬫灦鎴愬姛', + type: 'success' + }) + this.search(); + } + ); + } + }, - //璇︽儏 - details(val) { - this.detailsVisible = true; - this.$http.get('/api/publicity/' + val).then(res => this.detailsRow = res.data.data); - }, - //娣诲姞 - add() { - this.$refs.addPublicityForm.validate(async (vaild) => { - if (!vaild) return this.$message.error('杈撳叆鏈夎') - let param = null; - param = this.addPublicityForm; - addPublicityList(param).then(res => { - this.$message({ - message: '鎿嶄綔鎴愬姛', - type: 'success' + //璇︽儏 + details(val) { + 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 => { + return { + name: item, + url: '/minio/img/' + item, + uid: this.detailsRow['photoStr'].split(',').length + } + }) + this.fileList = this.detailsRow.img }); - this.addPublicityForm = {} - this.init(); - } - ) - this.addPublicityVisibel = false; - }) - }, - //鍏抽棴涔嬪墠 - addPublicityClose() { - this.addPublicityVisibel = false; - }, - detailsVisibleclose() { - this.detailsVisible = false; - }, - //鍒嗛〉鏂规硶 - handleCurrentChange(val) { - this.queryInfo.current = val; - this.search(); - }, - //瀵煎叆 - beforeAvatarUpload(file) { - let Xls = file.name.split('.'); - if (Xls[1] === 'xls' || Xls[1] === 'xlsx') { - return file - } else { - this.$message.error('涓婁紶鏂囦欢鍙兘鏄� xls/xlsx 鏍煎紡!') - return false - } - }, - //瀵煎叆鎴愬姛 - respond(res) { - if (res.code == 200) { - this.$message({ - message: '涓婁紶鎴愬姛', - type: 'success' - } - ) - } else { - this.$message({ - message: res.msg, - type: 'error' - }) - } - location.reload(); - }, - //鍏叡瀹d紶鍔犺浇 - init() { - let param = {} - param.current = this.queryInfo.current - param.size = this.queryInfo.size - param.status = this.queryInfo.status !== null ? this.queryInfo.status : '' - getPublicityList(param).then(res => { - this.publicityList = res.records; - this.total = res.total - }) - }, - //鏌ヨ - search() { - let param = {} - param.publicityTitle = this.queryInfo.publicityTitle; - param.current = this.queryInfo.current - param.size = this.queryInfo.size - param.status = this.queryInfo.status !== null ? this.queryInfo.status : '' - getPublicityList(param).then(res => { - this.publicityList = res.records; - this.total = res.total - this.current = res.current - }) - }, + }, + //娣诲姞 + add() { + this.$refs.addPublicityForm.validate(async (vaild) => { + if (!vaild) return this.$message.error('杈撳叆鏈夎') + let param = null; + param = JSON.parse(JSON.stringify(this.addPublicityForm)); + param.photoStr = param.img.map(item => item.name).join(','); + addPublicityList(param).then(res => { + this.$message({ + message: '鎿嶄綔鎴愬姛', + type: 'success' + }); + this.addPublicityForm = {} + this.init(); + } + ) + this.addPublicityVisibel = false; + }) + }, + //鍏抽棴涔嬪墠 + addPublicityClose() { + this.addPublicityVisibel = false; + }, + detailsVisibleclose() { + this.detailsVisible = false; + }, + //鍒嗛〉鏂规硶 + handleCurrentChange(val) { + this.queryInfo.current = val; + this.search(); + }, + //瀵煎叆 + beforeAvatarUpload(file) { + let Xls = file.name.split('.'); + if (Xls[1] === 'xls' || Xls[1] === 'xlsx') { + return file + } else { + this.$message.error('涓婁紶鏂囦欢鍙兘鏄� xls/xlsx 鏍煎紡!') + return false + } + }, + //瀵煎叆鎴愬姛 + respond(res) { + if (res.code == 200) { + this.$message({ + message: '涓婁紶鎴愬姛', + type: 'success' + } + ) + } else { + this.$message({ + message: res.msg, + type: 'error' + }) + } + location.reload(); + }, + //鍏叡瀹d紶鍔犺浇 + init() { + let param = {} + param.current = this.queryInfo.current + param.size = this.queryInfo.size + param.status = this.queryInfo.status !== null ? this.queryInfo.status : '' + getPublicityList(param).then(res => { + this.publicityList = res.records; + this.total = res.total + }) + }, + //鏌ヨ + search() { + let param = {} + param.publicityTitle = this.queryInfo.publicityTitle; + param.current = this.queryInfo.current + param.size = this.queryInfo.size + param.status = this.queryInfo.status !== null ? this.queryInfo.status : '' + getPublicityList(param).then(res => { + this.publicityList = res.records; + this.total = res.total + this.current = res.current + }) + }, - } + } } </script> @@ -385,4 +453,7 @@ ::v-deep(.el-table thead) { color: #000000; } +.freePic ::v-deep .el-upload--picture-card { + display: none; +} </style> \ No newline at end of file -- Gitblit v1.8.0