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/components/common/UploadAvatarImage.vue     |  104 +++++++++++++
 company_admin/src/views/business/category.vue                 |  187 +++++++++++-----------
 company_admin/src/components/business/selectProductItem.vue   |   15 +
 company_admin/src/views/business/pageConfiguration.vue        |  101 ++++++------
 company_admin/src/components/business/OperaCategoryWindow.vue |    7 
 company_admin/src/views/business/brand.vue                    |   11 
 company_admin/src/components/business/OperaGoodsWindow.vue    |    4 
 company_admin/src/components/common/Header.vue                |   14 +
 8 files changed, 283 insertions(+), 160 deletions(-)

diff --git a/company_admin/src/components/business/OperaCategoryWindow.vue b/company_admin/src/components/business/OperaCategoryWindow.vue
index decc097..eff1478 100644
--- a/company_admin/src/components/business/OperaCategoryWindow.vue
+++ b/company_admin/src/components/business/OperaCategoryWindow.vue
@@ -3,6 +3,7 @@
       :title="title"
       :visible.sync="visible"
       :confirm-working="isWorking"
+      width="50%"
       @confirm="confirm"
     >
       <el-alert title="濡傛灉浠庡钩鍙伴�夋嫨鍟嗗搧杩涜鐩存挱锛屽缓璁被鍒�夋嫨浠庡钩鍙板簱閫夋嫨锛岀郴缁熷凡鍋氭暟鎹叧鑱旓紱" type="warning" effect="dark" :closable="false"></el-alert>
@@ -15,7 +16,7 @@
           </el-radio-group>
         </el-form-item>
         <el-form-item label="閫夋嫨绫诲埆" prop="platCateId" v-if="form.type == 1">
-          <el-select v-model="form.platCateId" placeholder="璇烽�夋嫨" @change="changeCategory">
+          <el-select v-model="form.platCateId" filterable placeholder="璇烽�夋嫨" @change="changeCategory">
             <el-option
               v-for="item in categoryList"
               :key="item.id"
@@ -56,7 +57,7 @@
           style="width: 100%">
           <el-table-column label="鍙傛暟鍚�">
             <template slot-scope="scope">
-              <el-input v-model="scope.row.name" placeholder="璇疯緭鍏ュ唴瀹�"></el-input>
+              <el-input v-model="scope.row.name" placeholder="璇疯緭鍏ュ悕绉�"></el-input>
             </template>
           </el-table-column>
           <el-table-column label="璁剧疆涓洪�夐」">
@@ -277,7 +278,7 @@
             this.form.sortnum = item.sortnum
             let arr = []
             item.baseCateParamList.forEach((row, index) => {
-              arr.push({ name: row.name, baseCateParamId: row.id, isselect: index <= 1 ? 1 : 0, isshow: 1 })
+              arr.push({ name: row.name, baseCateParamId: row.id, isselect: 0, isshow: 1 })
             })
             this.form.tableData = arr
             this.form.imgurl = item.imgurl
diff --git a/company_admin/src/components/business/OperaGoodsWindow.vue b/company_admin/src/components/business/OperaGoodsWindow.vue
index f54453e..888e1d3 100644
--- a/company_admin/src/components/business/OperaGoodsWindow.vue
+++ b/company_admin/src/components/business/OperaGoodsWindow.vue
@@ -11,7 +11,7 @@
           <el-input v-model="form.name" maxlength="50" placeholder="璇疯緭鍏ュ晢鍝佸悕绉帮紝涓嶈秴杩�50涓瓧" v-trim/>
         </el-form-item>
         <el-form-item label="鍟嗗搧鍝佺墝" prop="brandId">
-          <el-select v-model="form.brandId" placeholder="璇烽�夋嫨锛屽崟閫�">
+          <el-select v-model="form.brandId" filterable placeholder="璇烽�夋嫨锛屽崟閫�">
             <el-option
               v-for="item in brandList"
               :key="item.id"
@@ -22,7 +22,7 @@
         </el-form-item>
         <el-form-item label="鍟嗗搧绫诲埆" prop="categoryId">
           <!-- @change="changeCategory(form.categoryId)" -->
-          <el-select v-model="form.categoryId" placeholder="璇烽�夋嫨锛屽崟閫�">
+          <el-select v-model="form.categoryId" filterable placeholder="璇烽�夋嫨锛屽崟閫�">
             <el-option
               v-for="item in categoryList"
               :key="item.id"
diff --git a/company_admin/src/components/business/selectProductItem.vue b/company_admin/src/components/business/selectProductItem.vue
index 94f612e..88d80be 100644
--- a/company_admin/src/components/business/selectProductItem.vue
+++ b/company_admin/src/components/business/selectProductItem.vue
@@ -48,7 +48,7 @@
                 <el-table-column prop="price" label="閲囪喘浠凤紙鍏冿級" show-overflow-tooltip min-width="100px"></el-table-column>
                 <el-table-column label="鍏ユ墜浠凤紙鍏冿級" show-overflow-tooltip min-width="100px">
                     <template slot-scope="{row}">
-                        <el-input v-model="row.purchasePrice" placeholder="璇疯緭鍏�"></el-input>
+                        <el-input v-model="row.purchasePrice" @input="changeVal(row)" placeholder="璇疯緭鍏�"></el-input>
                     </template>
                 </el-table-column>
             </el-table>
@@ -101,6 +101,13 @@
         })
     },
     methods: {
+        changeVal(row) {
+            var zz2 = new RegExp("^[0-9]*[1-9][0-9]*$");
+            if (!zz2.test(row.purchasePrice)) {
+                row.purchasePrice = ''
+                this.$message.warning({ message: '鍙兘杈撳叆鏁存暟' })
+            }
+        },
         getList() {
             pageT({
                 capacity: this.pageSize,
@@ -111,7 +118,7 @@
                 page: this.page
             }).then(res => {
                 res.records.forEach(item => {
-                    item.purchasePrice = item.price * this.form.rate
+                    item.purchasePrice = Math.ceil(item.price * this.form.rate)
                 })
                 this.tableData = res.records
                 this.total = res.total
@@ -134,6 +141,10 @@
             console.log(arr)
         },
         confirm() {
+            if (this.form.goodsParamList.length === 0) {
+                this.$message.warning({ message: '璇峰厛鍕鹃�夊晢鍝�' })
+                return
+            }
             // 璋冪敤鏂板缓鎺ュ彛
             this.isWorking = true
             createPlat({
diff --git a/company_admin/src/components/common/Header.vue b/company_admin/src/components/common/Header.vue
index 7fec636..965d88d 100644
--- a/company_admin/src/components/common/Header.vue
+++ b/company_admin/src/components/common/Header.vue
@@ -7,6 +7,7 @@
         {{title}}
       </h2>
       <div class="user">
+        <span style="font-size: 13px">{{ userInfo.company.name }}</span>
         <el-dropdown trigger="click">
           <span class="el-dropdown-link">
             <img v-if="userInfo != null" :src="userInfo.avatar == null ? '@/assets/images/avatar/man.png' : userInfo.avatar" alt="">{{userInfo | displayName}}<i class="el-icon-arrow-down el-icon--right"></i>
@@ -91,9 +92,9 @@
       if (userInfo == null) {
         return ''
       }
-      if (userInfo.realname != null && userInfo.realname.trim().length > 0) {
-        return userInfo.realname
-      }
+      // if (userInfo.realname != null && userInfo.realname.trim().length > 0) {
+      //   return userInfo.realname
+      // }
       return userInfo.username
     }
   },
@@ -178,6 +179,13 @@
     width: 50%;
     flex-shrink: 0;
     text-align: right;
+    display: flex;
+    align-items: center;
+    justify-content: flex-end;
+    text {
+      font-size: 18px !important;
+      color: #222222;
+    }
     .el-dropdown-link {
       height: 100%;
       display: flex;
diff --git a/company_admin/src/components/common/UploadAvatarImage.vue b/company_admin/src/components/common/UploadAvatarImage.vue
new file mode 100644
index 0000000..c19e154
--- /dev/null
+++ b/company_admin/src/components/common/UploadAvatarImage.vue
@@ -0,0 +1,104 @@
+<template>
+  <div>
+    <el-upload
+      :style="customStyle"
+      :action="uploadImgUrl"
+      :data="uploadData"
+      :show-file-list="false"
+      :on-success="handleAvatarSuccess"
+      :on-error="uploadError"
+      :before-upload="beforeAvatarUpload">
+      <img v-if="file.imgurlfull" :src="file.imgurlfull" :style="customStyle" class="avatar">
+      <div v-else :style="customStyle">
+        <i class="el-icon-plus avatar-uploader-icon"></i>
+        <div class="tips-style">{{ tipsLabel }}</div>
+      </div>
+    </el-upload>
+  </div>
+  
+</template>
+
+<script>
+export default {
+  props: {
+    file: {
+      type: Object,
+      default: () => {}
+    },
+    uploadData: Object,
+    tipsLabel: '',
+    customStyle: {
+      type: String,
+      default: 'width: 90px; height: 90px;'
+    }
+  },
+  data() {
+    return {
+      uploadImgUrl: process.env.VUE_APP_API_PREFIX + '/public/upload',
+      // uploadImgUrl: process.env.VUE_APP_API_PREFIX + '/public/uploadPicture',
+      // uploadData: {
+      //   folder: 'upload',
+      //   type: 'image'
+      // },
+      imgurlfull: ''
+    }
+  },
+  
+  methods: {
+    // 涓婁紶鍥剧墖
+    handleAvatarSuccess(res, file) {
+      if (res.code == 200) {
+        let { data } = res
+        this.file.imgurl = data.imgaddr;
+        this.file.imgurlfull = data.url;
+        console.log(this.file);
+        this.$message.success('涓婁紶鎴愬姛')
+        this.$emit('uploadSuccess', { imgurl: data.imgaddr, imgurlfull: data.url })
+      } else {
+        this.$message.error('涓婁紶澶辫触')
+      }
+      this.$emit('uploadEnd')
+    },
+    uploadError() {
+      this.$message.error('涓婁紶澶辫触')
+      this.$emit('endUpload')
+    },
+    // // 鎷︽埅
+    beforeAvatarUpload(file) {
+      this.$emit('uploadBegin')
+      return true;
+    },
+  },
+}
+</script>
+
+<style lang="scss" scoped>
+$image-width: 100px;
+::v-deep .el-upload {
+  border: 1px dashed #d9d9d9;
+  border-radius: 6px;
+  cursor: pointer;
+  position: relative;
+  overflow: hidden;
+}
+.avatar-uploader .el-upload:hover {
+  border-color: #409EFF;
+}
+.avatar-uploader-icon {
+  font-size: 28px;
+  color: #8c939d;
+  line-height: 90px;
+  text-align: center;
+}
+.avatar {
+  display: block;
+}
+.tips-style {
+  height: 13px;
+  font-size: 13px;
+  font-weight: 400;
+  color: #999999;
+  line-height: 13px;
+}
+</style>
+
diff --git a/company_admin/src/views/business/brand.vue b/company_admin/src/views/business/brand.vue
index 4657dc0..07746a4 100644
--- a/company_admin/src/views/business/brand.vue
+++ b/company_admin/src/views/business/brand.vue
@@ -32,8 +32,7 @@
           stripe
           border
           :header-cell-style="rowStyle"
-          :cell-style="rowStyle"
-        >
+          :cell-style="rowStyle">
           <el-table-column prop="name" label="鍝佺墝鍚嶇О" min-width="100px"></el-table-column>
           <el-table-column prop="imgurl" label="鍥炬爣" min-width="100px">
             <template slot-scope="{row}">
@@ -47,8 +46,8 @@
           </el-table-column>
           <el-table-column prop="categoryName" label="绫诲瀷" min-width="100px">
             <template slot-scope="{row}">
-              <span v-if="row.type == 0">鑷缓</span>
-              <span v-else>鎷夊彇</span>
+              <span v-if="row.type == 0">鑷畾涔�</span>
+              <span v-else>绯荤粺</span>
             </template>
           </el-table-column>
           <el-table-column prop="sortnum" label="鎺掑簭鐮�(鍗囧簭)" min-width="100px"></el-table-column>
@@ -96,8 +95,8 @@
           type: ''
         },
         typeList: [
-          { name: '鑷缓', id: 0 },
-          { name: '鎷夊彇', id: 1 }
+          { name: '鑷畾涔�', id: 0 },
+          { name: '绯荤粺', id: 1 }
         ]
       }
     },
diff --git a/company_admin/src/views/business/category.vue b/company_admin/src/views/business/category.vue
index a4314ff..cebee76 100644
--- a/company_admin/src/views/business/category.vue
+++ b/company_admin/src/views/business/category.vue
@@ -1,95 +1,95 @@
 <template>
-    <TableLayout :permissions="['business:category:query']">
-      <!-- 鎼滅储琛ㄥ崟 -->
-      <el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="100px" inline>
-        <el-form-item label="绫诲埆鍚嶇О" prop="name">
-          <el-input v-model="searchForm.name" placeholder="璇疯緭鍏ョ被鍒悕绉�" @keypress.enter.native="search"></el-input>
-        </el-form-item>
-        <el-form-item label="绫诲瀷" prop="type">
-          <el-select v-model="searchForm.type" clearable placeholder="璇烽�夋嫨">
-            <el-option
-              v-for="item in typeList"
-              :key="item.id"
-              :label="item.name"
-              :value="item.id">
-            </el-option>
-          </el-select>
-        </el-form-item>
-        <section>
-          <el-button type="primary" @click="search">鎼滅储</el-button>
-          <!-- <el-button type="primary" :loading="isWorking.export" v-permissions="['business:category:exportExcel']" @click="exportExcel">瀵煎嚭</el-button> -->
-          <el-button @click="reset">閲嶇疆</el-button>
-        </section>
-      </el-form>
-      <!-- 琛ㄦ牸鍜屽垎椤� -->
-      <template v-slot:table-wrap>
-        <ul class="toolbar" v-permissions="['business:category:create']">
-          <li><el-button type="primary" @click="$refs.operaCategoryWindow.open('鏂板缓绫诲埆')" icon="el-icon-plus" v-permissions="['business:category:create']">鏂板缓</el-button></li>
-        </ul>
-        <el-table
-          v-loading="isWorking.search"
-          :data="tableData.list"
-          stripe
-          border
-          :header-cell-style="rowStyle"
-          :cell-style="rowStyle"
+  <TableLayout :permissions="['business:category:query']">
+    <!-- 鎼滅储琛ㄥ崟 -->
+    <el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="100px" inline>
+      <el-form-item label="绫诲埆鍚嶇О" prop="name">
+        <el-input v-model="searchForm.name" placeholder="璇疯緭鍏ョ被鍒悕绉�" @keypress.enter.native="search"></el-input>
+      </el-form-item>
+      <el-form-item label="绫诲瀷" prop="type">
+        <el-select v-model="searchForm.type" clearable placeholder="璇烽�夋嫨">
+          <el-option
+            v-for="item in typeList"
+            :key="item.id"
+            :label="item.name"
+            :value="item.id">
+          </el-option>
+        </el-select>
+      </el-form-item>
+      <section>
+        <el-button type="primary" @click="search">鎼滅储</el-button>
+        <!-- <el-button type="primary" :loading="isWorking.export" v-permissions="['business:category:exportExcel']" @click="exportExcel">瀵煎嚭</el-button> -->
+        <el-button @click="reset">閲嶇疆</el-button>
+      </section>
+    </el-form>
+    <!-- 琛ㄦ牸鍜屽垎椤� -->
+    <template v-slot:table-wrap>
+      <ul class="toolbar" v-permissions="['business:category:create']">
+        <li><el-button type="primary" @click="$refs.operaCategoryWindow.open('鏂板缓绫诲埆')" icon="el-icon-plus" v-permissions="['business:category:create']">鏂板缓</el-button></li>
+      </ul>
+      <el-table
+        v-loading="isWorking.search"
+        :data="tableData.list"
+        stripe
+        border
+        :header-cell-style="rowStyle"
+        :cell-style="rowStyle"
+      >
+        <el-table-column prop="imgurl" label="鍥炬爣" min-width="100px">
+          <template slot-scope="{row}">
+              <el-image
+              v-if="row.imgurl"
+              style="width: 70px; height: 70px"
+              :src="row.prefixUrl + row.imgurl"
+              :preview-src-list="[row.prefixUrl + row.imgurl]"
+              fit="cover"></el-image>
+          </template>
+        </el-table-column>
+        <el-table-column prop="name" label="绫诲埆鍚嶇О" min-width="100px"></el-table-column>
+        <el-table-column prop="categoryName" label="绫诲瀷" min-width="100px">
+          <template slot-scope="{row}">
+            <span v-if="row.type == 0">鑷畾涔�</span>
+            <span v-else>绯荤粺</span>
+          </template>
+        </el-table-column>
+        <el-table-column prop="sortnum" label="鎺掑簭鐮�(鍗囧簭)" min-width="100px"></el-table-column>
+        <el-table-column prop="createDate" label="鍒涘缓鏃堕棿" min-width="100px"></el-table-column>
+        <el-table-column prop="status" label="鐘舵��" min-width="100px">
+          <template slot-scope="{row}">
+              <el-switch
+                  v-model="row.status"
+                  @change="changeStatus(row)"
+                  active-color="#13ce66"
+                  inactive-color="#ff4949"
+                  :active-value="0"
+                  :inactive-value="1">
+              </el-switch>
+          </template>
+        </el-table-column>
+        <el-table-column
+          v-if="containPermissions(['business:category:update', 'business:category:delete'])"
+          label="鎿嶄綔"
+          min-width="120"
+          fixed="right"
         >
-          <el-table-column prop="imgurl" label="鍥炬爣" min-width="100px">
-            <template slot-scope="{row}">
-                <el-image
-                v-if="row.imgurl"
-                style="width: 70px; height: 70px"
-                :src="row.prefixUrl + row.imgurl"
-                :preview-src-list="[row.prefixUrl + row.imgurl]"
-                fit="cover"></el-image>
-            </template>
-          </el-table-column>
-          <el-table-column prop="name" label="绫诲埆鍚嶇О" min-width="100px"></el-table-column>
-          <el-table-column prop="categoryName" label="绫诲瀷" min-width="100px">
-            <template slot-scope="{row}">
-              <span v-if="row.type == 0">鑷缓</span>
-              <span v-else>鎷夊彇</span>
-            </template>
-          </el-table-column>
-          <el-table-column prop="sortnum" label="鎺掑簭鐮�(鍗囧簭)" min-width="100px"></el-table-column>
-          <el-table-column prop="createDate" label="鍒涘缓鏃堕棿" min-width="100px"></el-table-column>
-          <el-table-column prop="status" label="鐘舵��" min-width="100px">
-            <template slot-scope="{row}">
-                <el-switch
-                    v-model="row.status"
-                    @change="changeStatus(row)"
-                    active-color="#13ce66"
-                    inactive-color="#ff4949"
-                    :active-value="0"
-                    :inactive-value="1">
-                </el-switch>
-            </template>
-          </el-table-column>
-          <el-table-column
-            v-if="containPermissions(['business:category:update', 'business:category:delete'])"
-            label="鎿嶄綔"
-            min-width="120"
-            fixed="right"
-          >
-            <template slot-scope="{row}">
-              <el-button type="text" @click="edit(row.id)" icon="el-icon-edit" v-permissions="['business:category:update']">缂栬緫</el-button>
-              <el-button type="text" @click="deleteById(row)" icon="el-icon-delete" v-permissions="['business:category:delete']">鍒犻櫎</el-button>
-            </template>
-          </el-table-column>
-        </el-table>
-        <pagination
-          @size-change="handleSizeChange"
-          @current-change="handlePageChange"
-          :pagination="tableData.pagination"
-        >
-        </pagination>
-      </template>
-      <!-- 鏂板缓/淇敼 -->
-      <OperaCategoryWindow ref="operaCategoryWindow" @success="handlePageChange"/>
-    </TableLayout>
-  </template>
+          <template slot-scope="{row}">
+            <el-button type="text" @click="edit(row.id)" icon="el-icon-edit" v-permissions="['business:category:update']">缂栬緫</el-button>
+            <el-button type="text" @click="deleteById(row)" icon="el-icon-delete" v-permissions="['business:category:delete']">鍒犻櫎</el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+      <pagination
+        @size-change="handleSizeChange"
+        @current-change="handlePageChange"
+        :pagination="tableData.pagination"
+      >
+      </pagination>
+    </template>
+    <!-- 鏂板缓/淇敼 -->
+    <OperaCategoryWindow ref="operaCategoryWindow" @success="handlePageChange"/>
+  </TableLayout>
+</template>
   
-  <script>
+<script>
   import BaseTable from '@/components/base/BaseTable'
   import TableLayout from '@/layouts/TableLayout'
   import Pagination from '@/components/common/Pagination'
@@ -107,8 +107,8 @@
           type: ''
         },
         typeList: [
-          { name: '鑷缓', id: 0 },
-          { name: '鎷夊彇', id: 1 }
+          { name: '鑷畾涔�', id: 0 },
+          { name: '绯荤粺', id: 1 }
         ]
       }
     },
@@ -153,6 +153,7 @@
               platCateId: res.platCateId,
               tableData: res.paramList.map(item => {
                 return {
+                  id: item.id,
                   name: item.name,
                   isselect: item.isselect,
                   isshow: item.isshow
@@ -160,11 +161,9 @@
               }),
               fileList: res.imgurl ? [{ url: res.prefixUrl + res.imgurl }] : []
             }
-            console.log(obj)
             this.$refs.operaCategoryWindow.open('缂栬緫绫诲埆', obj)
           })
       }
     }
   }
-  </script>
-  
\ No newline at end of file
+</script>
\ No newline at end of file
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