From 3c1d55fe67cf436de36fd2e7ddc057e26b7a89c9 Mon Sep 17 00:00:00 2001
From: odc.xiaohui <xiaohui@Q1>
Date: 星期五, 19 五月 2023 15:12:15 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
src/views/common/Publicity.vue | 400 +++++++++++++++++++++++++++++++++++++-------------------
1 files changed, 265 insertions(+), 135 deletions(-)
diff --git a/src/views/common/Publicity.vue b/src/views/common/Publicity.vue
index 812e706..2d73c31 100644
--- a/src/views/common/Publicity.vue
+++ b/src/views/common/Publicity.vue
@@ -21,8 +21,8 @@
<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">
- <el-button type="primary">瀵煎叆</el-button>
+ :before-upload="beforeAvatarUpload" :on-success="respond" :limit="1">
+<!-- <el-button type="primary">瀵煎叆</el-button>-->
</el-upload>
</el-form-item>
</el-form>
@@ -52,35 +52,51 @@
<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>
<el-button type="text" size="medium" @click="remove(scope.row.id)" style="color:#ff0000">鍒犻櫎
+ </el-button>
+ <el-button type="text" size="medium" @click="delTime(scope.row.id)" style="color:#ff0000">淇敼鏃堕棿
</el-button>
</template>
</el-table-column>
</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 +107,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 +162,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>
@@ -173,7 +210,19 @@
</el-table-column> -->
</el-dialog>
-
+ <el-dialog
+ title="淇敼鏃堕棿"
+ :visible.sync="dialogVisibleTime"
+ width="30%"
+ :before-close="handleCloseTime">
+ <el-date-picker v-model="detailsRow.releaseTime" type="datetime" placeholder="閫夋嫨鏃ユ湡鏃堕棿"
+ :style="{ width: '100%' }" value-format="yyyy-MM-dd HH:mm:ss">
+ </el-date-picker>
+ <span slot="footer" class="dialog-footer">
+ <el-button @click="dialogVisibleTime = false">鍙� 娑�</el-button>
+ <el-button type="primary" @click="subTIme">纭� 瀹�</el-button>
+ </span>
+ </el-dialog>
</div>
</template>
@@ -188,8 +237,11 @@
name: "Publicity",
data() {
return {
-
-
+ detailsId:null,
+ dialogVisibleTime:false,
+ fileList: [],
+ dialogImageUrl: '',
+ dialogVisible: false,
//璇︾粏鍐呭寮规
detailsVisible: false,
//璇︾粏鍐呭
@@ -197,7 +249,9 @@
//琛ㄥ崟鎻愪氦鍐呭
addPublicityForm: {
publicityTitle: '',
- text: ''
+ text: '',
+ img: [],
+ releaseTime:null
},
//娣诲姞寮规
addPublicityVisibel: false,
@@ -254,130 +308,203 @@
},
methods:
- {
- //鍒犻櫎
- remove(val) {
- this.$http.delete('/api/publicity/' + val).then(res => {
- this.$message({
- message: '鍒犻櫎鎴愬姛',
- type: 'success'
- })
+ {
+ handleCloseTime(){
+ this.dialogVisibleTime = false
+ },
+ 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();
+ })
+ },
+ subTIme(){
+ let obj = {
+ id: this.detailsId,
+ time:this.detailsRow.releaseTime
+ }
+ this.$http.get('/api/publicity/changTime?id='+obj.id+'&'+'time='+obj.time).then(res=>{
+ console.log(res)
+ let val = res.data
+ if (val.code ==200){
+
+ this.dialogVisibleTime =false
+ this.init()
+ }else {
+ this.$message.error(val.msg)
+ }
})
- this.search();
- }
- )
- }
- if (val2 == 1) {
- this.$http.get('/api/publicity/offline/' + val).then(res => {
- this.$message({
- message: '涓嬫灦鎴愬姛',
- type: 'success'
- })
- this.search();
- }
- );
- }
- },
+ },
+ delTime(e){
+ console.log(e)
+ this.getDelial(e)
+ this.detailsId = e
+ this.dialogVisibleTime =true
- //璇︽儏
- 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'
+ },
+ getDelial(val){
+ 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
- })
- },
+ },
+ //鍙戝竷/涓嬫灦
+ 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();
+ }
+ );
+ }
+ },
+
+ //璇︽儏
+ 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
+ });
+ },
+ //娣诲姞
+ add() {
+ this.$refs.addPublicityForm.validate(async (vaild) => {
+ if (!vaild) return this.$message.error('杈撳叆鏈夎')
+ let param = null;
+ param = JSON.parse(JSON.stringify(this.addPublicityForm));
+ console.log(param)
+ 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 +512,7 @@
::v-deep(.el-table thead) {
color: #000000;
}
-</style>
\ No newline at end of file
+.freePic ::v-deep .el-upload--picture-card {
+ display: none;
+}
+</style>
--
Gitblit v1.8.0