jiangping
2023-09-19 0b9c144b5110a7e2a85b2e5581ef304bb81a3ebc
company_admin/src/views/business/pageConfiguration.vue
@@ -4,7 +4,7 @@
        <div class="pz_item">
            <div class="pz_item_label">内容范围尺寸:</div>
            <div class="pz_item_ipt">
                <el-input v-model="from.rangeSize" placeholder="支持750px-1200px"></el-input>
                <el-input v-model="from.rangeSize" type="number" placeholder="支持750px-1200px"></el-input>
            </div>
        </div>
        <div class="pz_item">
@@ -16,47 +16,34 @@
        <div class="pz_item">
            <div class="pz_item_label">背景图:</div>
            <div class="pz_item_ipt">
                <el-upload
                :action="action"
                :data="{ folder: 'web_param' }"
                list-type="picture-card"
                :limit="1"
                :on-exceed="exceed"
                :file-list="fileList1"
                :on-success="fileSuccess1"
                :on-remove="handleRemove1">
                <i class="el-icon-plus"></i>
                </el-upload>
                <UploadAvatarImage
                    :file="{ 'imgurlfull': from.bgImgUrl, 'imgurl': from.bgImg }"
                    :uploadData="{ folder: 'web_param' }"
                    tipsLabel=""
                    @uploadSuccess="uploadReverseSuccess"
                />
            </div>
        </div>
        <div class="pz_item">
            <div class="pz_item_label">顶部宣传图:</div>
            <div class="pz_item_ipt">
                <el-upload
                :action="action"
                :data="{ folder: 'web_param' }"
                list-type="picture-card"
                :on-exceed="exceed"
                :file-list="fileList2"
                :on-success="fileSuccess2"
                :on-remove="handleRemove2">
                <i class="el-icon-plus"></i>
                </el-upload>
                <UploadAvatarImage
                    :file="{ 'imgurlfull': from.topImgUrl, 'imgurl': from.topImg }"
                    :uploadData="{ folder: 'web_param' }"
                    tipsLabel=""
                    @uploadSuccess="uploadReverseSuccess1"
                />
            </div>
        </div>
        <div class="pz_item">
            <div class="pz_item_label">PK台图:</div>
            <div class="pz_item_ipt">
                <el-upload
                :action="action"
                :data="{ folder: 'web_param' }"
                list-type="picture-card"
                :on-exceed="exceed"
                :file-list="fileList3"
                :on-success="fileSuccess3"
                :on-remove="handleRemove3">
                <i class="el-icon-plus"></i>
                </el-upload>
                <UploadAvatarImage
                    :file="{ 'imgurlfull': from.pkImgUrl, 'imgurl': from.pkImg }"
                    :uploadData="{ folder: 'web_param' }"
                    tipsLabel=""
                    @uploadSuccess="uploadReverseSuccess2"
                />
            </div>
        </div>
        <div class="pz_footer">
@@ -68,6 +55,7 @@
    
<script>
import { getByLogin, renew } from '@/api/business/page.js'
import UploadAvatarImage from '@/components/common/UploadAvatarImage.vue'
export default {
    data() {
@@ -77,19 +65,28 @@
                rangeSize: '',
                mainColor: '',
                bgImg: '',
                bgImgUrl: '',
                topImg: '',
                pkImg: ''
            },
            fileList1: [],
            fileList2: [],
            fileList3: []
                topImgUrl: '',
                pkImg: '',
                pkImgUrl: ''
            }
        }
    },
    components: { UploadAvatarImage },
    created() {
        this.getDesc()
    },
    methods: {
        submit() {
            if (this.from.rangeSize < 750) {
                this.$message.warning({ message: '尺寸必须大于750' })
                return
            }
            if (this.from.rangeSize > 1200) {
                this.$message.warning({ message: '尺寸必须小于1200' })
                return
            }
            renew(this.from)
                .then(res => {
                    this.$message.success({ message: '保存成功' })
@@ -103,23 +100,15 @@
                        this.from.mainColor = res.mainColor
                        if (res.bgImg) {
                            this.from.bgImg = res.bgImg
                            this.fileList1 = [{ name: res.bgImg, url: res.resourcePath + res.bgImg }]
                            this.from.bgImgUrl = res.resourcePath + res.bgImg
                        }
                        if (res.topImg) {
                            this.fileList2 = []
                            this.from.topImg = res.topImg
                            let arr = res.topImg.split(',').map(item => item)
                            arr.forEach(item => {
                                this.fileList2.push({ name: item, url: res.resourcePath + item })
                            })
                            this.from.topImgUrl = res.resourcePath + res.topImg
                        }
                        if (res.pkImg) {
                            this.fileList3 = []
                            this.from.pkImg = res.pkImg
                            let arr = res.pkImg.split(',').map(item => item)
                            arr.forEach(item => {
                                this.fileList3.push({ name: item, url: res.resourcePath + item })
                            })
                            this.from.pkImgUrl = res.resourcePath + res.pkImg
                        }
                    }
                })
@@ -127,6 +116,20 @@
        exceed() {
            this.$message.warning({ message: '只能上传一张图片' })
        },
        uploadReverseSuccess2(file) {
            this.from.pkImg = file.imgurl;
            this.from.pkImgUrl = file.imgurlfull;
        },
        uploadReverseSuccess1(file) {
            this.from.topImg = file.imgurl;
            this.from.topImgUrl = file.imgurlfull;
        },
        uploadReverseSuccess(file) {
            this.from.bgImg = file.imgurl;
            this.from.bgImgUrl = file.imgurlfull;
        },
        handleRemove1(file, fileList) {
            this.fileList1 = []