From ef6e3fcdf6367dcb2bfd9c4413ec9b0b1e41c736 Mon Sep 17 00:00:00 2001
From: Mr.Shi <1878285526@qq.com>
Date: 星期二, 19 九月 2023 18:53:04 +0800
Subject: [PATCH] 企业端

---
 company_admin/src/views/business/pageConfiguration.vue |  101 +++++++++++++++++++++++++-------------------------
 1 files changed, 51 insertions(+), 50 deletions(-)

diff --git a/company_admin/src/views/business/pageConfiguration.vue b/company_admin/src/views/business/pageConfiguration.vue
index 193fcfc..319b262 100644
--- a/company_admin/src/views/business/pageConfiguration.vue
+++ b/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,49 +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">椤堕儴瀹d紶鍥撅細</div>
             <div class="pz_item_ipt">
-                <el-upload
-                :action="action"
-                :data="{ folder: 'web_param' }"
-                list-type="picture-card"
-                :on-exceed="exceed"
-                :limit="1"
-                :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"
-                :limit="1"
-                :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">
@@ -70,6 +55,7 @@
     
 <script>
 import { getByLogin, renew } from '@/api/business/page.js'
+import UploadAvatarImage from '@/components/common/UploadAvatarImage.vue'
 
 export default {
     data() {
@@ -79,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: '淇濆瓨鎴愬姛' })
@@ -105,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
                         }
                     }
                 })
@@ -129,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 = []

--
Gitblit v1.9.3