Просмотр исходного кода

商品管理中新增商品时添加搜索图片功能

hzj18279462576@163.com 8 месяцев назад
Родитель
Сommit
fe0328b818
5 измененных файлов с 629 добавлено и 169 удалено
  1. 2 2
      config/index.js
  2. 157 155
      src/element-ui/index.js
  3. 2 2
      src/main.js
  4. 4 4
      src/utils/httpRequest.js
  5. 464 6
      src/views/selfShop/shopPublish.vue

+ 2 - 2
config/index.js

@@ -16,8 +16,8 @@ module.exports = {
       '/proxyApi': {
         // target: 'http://iyfpk3.natappfree.cc/sqx_fast',
 
-        // target: 'https://mxys.chuanghai-tech.com/sqx_fast/',//mxys.chuanghai-tech.com
-        target: 'http://192.168.161.190:8171/sqx_fast/',
+        target: 'https://mxys.chuanghai-tech.com/sqx_fast/',//mxys.chuanghai-tech.com
+        // target: 'http://192.168.161.190:8171/sqx_fast/',
         // target: 'https://mxys.chuanghai-tech.com/wm-test/wm-api',//mxys.chuanghai-tech.com
 		    changeOrigin: true,
         pathRewrite: {

+ 157 - 155
src/element-ui/index.js

@@ -1,155 +1,157 @@
-/**
- * UI组件, 统一使用饿了么桌面端组件库(https://github.com/ElemeFE/element)
- *
- * 使用:
- *  1. 项目中需要的组件进行释放(解开注释)
- *
- * 注意:
- *  1. 打包只会包含释放(解开注释)的组件, 减少打包文件大小
- */
-import Vue from 'vue'
-import {
-  Pagination,
-  Dialog,
-  Autocomplete,
-  Dropdown,
-  DropdownMenu,
-  DropdownItem,
-  Menu,
-  Submenu,
-  MenuItem,
-  MenuItemGroup,
-  Input,
-  InputNumber,
-  Radio,
-  RadioGroup,
-  RadioButton,
-  Checkbox,
-  CheckboxButton,
-  CheckboxGroup,
-  Switch,
-  Select,
-  Option,
-  OptionGroup,
-  Button,
-  ButtonGroup,
-  Table,
-  TableColumn,
-  DatePicker,
-  TimeSelect,
-  TimePicker,
-  Popover,
-  Tooltip,
-  Breadcrumb,
-  BreadcrumbItem,
-  Form,
-  FormItem,
-  Tabs,
-  TabPane,
-  Tag,
-  Tree,
-  Alert,
-  Slider,
-  Icon,
-  Row,
-  Col,
-  Upload,
-  Progress,
-  Badge,
-  Card,
-  Rate,
-  Steps,
-  Step,
-  Carousel,
-  CarouselItem,
-  Collapse,
-  CollapseItem,
-  Cascader,
-  ColorPicker,
-  Transfer,
-  Container,
-  Header,
-  Aside,
-  Main,
-  Footer,
-  Loading,
-  MessageBox,
-  Message,
-  Notification
-} from 'element-ui'
-
-Vue.use(Pagination)
-Vue.use(Dialog)
-Vue.use(Autocomplete)
-Vue.use(Dropdown)
-Vue.use(DropdownMenu)
-Vue.use(DropdownItem)
-Vue.use(Menu)
-Vue.use(Submenu)
-Vue.use(MenuItem)
-Vue.use(MenuItemGroup)
-Vue.use(Input)
-Vue.use(InputNumber)
-Vue.use(Radio)
-Vue.use(RadioGroup)
-Vue.use(RadioButton)
-Vue.use(Checkbox)
-Vue.use(CheckboxButton)
-Vue.use(CheckboxGroup)
-Vue.use(Switch)
-Vue.use(Select)
-Vue.use(Option)
-Vue.use(OptionGroup)
-Vue.use(Button)
-Vue.use(ButtonGroup)
-Vue.use(Table)
-Vue.use(TableColumn)
-Vue.use(DatePicker)
-Vue.use(TimeSelect)
-Vue.use(TimePicker)
-Vue.use(Popover)
-Vue.use(Tooltip)
-Vue.use(Breadcrumb)
-Vue.use(BreadcrumbItem)
-Vue.use(Form)
-Vue.use(FormItem)
-Vue.use(Tabs)
-Vue.use(TabPane)
-Vue.use(Tag)
-Vue.use(Tree)
-Vue.use(Alert)
-Vue.use(Slider)
-Vue.use(Icon)
-Vue.use(Row)
-Vue.use(Col)
-Vue.use(Upload)
-Vue.use(Progress)
-Vue.use(Badge)
-Vue.use(Card)
-Vue.use(Rate)
-Vue.use(Steps)
-Vue.use(Step)
-Vue.use(Carousel)
-Vue.use(CarouselItem)
-Vue.use(Collapse)
-Vue.use(CollapseItem)
-Vue.use(Cascader)
-Vue.use(ColorPicker)
-Vue.use(Transfer)
-Vue.use(Container)
-Vue.use(Header)
-Vue.use(Aside)
-Vue.use(Main)
-Vue.use(Footer)
-
-Vue.use(Loading.directive)
-
-Vue.prototype.$loading = Loading.service
-Vue.prototype.$msgbox = MessageBox
-Vue.prototype.$alert = MessageBox.alert
-Vue.prototype.$confirm = MessageBox.confirm
-Vue.prototype.$prompt = MessageBox.prompt
-Vue.prototype.$notify = Notification
-Vue.prototype.$message = Message
-
-Vue.prototype.$ELEMENT = { size: 'medium' }
+/**
+ * UI组件, 统一使用饿了么桌面端组件库(https://github.com/ElemeFE/element)
+ *
+ * 使用:
+ *  1. 项目中需要的组件进行释放(解开注释)
+ *
+ * 注意:
+ *  1. 打包只会包含释放(解开注释)的组件, 减少打包文件大小
+ */
+import Vue from 'vue'
+import {
+  Pagination,
+  Dialog,
+  Autocomplete,
+  Dropdown,
+  DropdownMenu,
+  DropdownItem,
+  Menu,
+  Submenu,
+  MenuItem,
+  MenuItemGroup,
+  Input,
+  Image,
+  InputNumber,
+  Radio,
+  RadioGroup,
+  RadioButton,
+  Checkbox,
+  CheckboxButton,
+  CheckboxGroup,
+  Switch,
+  Select,
+  Option,
+  OptionGroup,
+  Button,
+  ButtonGroup,
+  Table,
+  TableColumn,
+  DatePicker,
+  TimeSelect,
+  TimePicker,
+  Popover,
+  Tooltip,
+  Breadcrumb,
+  BreadcrumbItem,
+  Form,
+  FormItem,
+  Tabs,
+  TabPane,
+  Tag,
+  Tree,
+  Alert,
+  Slider,
+  Icon,
+  Row,
+  Col,
+  Upload,
+  Progress,
+  Badge,
+  Card,
+  Rate,
+  Steps,
+  Step,
+  Carousel,
+  CarouselItem,
+  Collapse,
+  CollapseItem,
+  Cascader,
+  ColorPicker,
+  Transfer,
+  Container,
+  Header,
+  Aside,
+  Main,
+  Footer,
+  Loading,
+  MessageBox,
+  Message,
+  Notification
+} from 'element-ui'
+
+Vue.use(Pagination)
+Vue.use(Dialog)
+Vue.use(Autocomplete)
+Vue.use(Dropdown)
+Vue.use(DropdownMenu)
+Vue.use(DropdownItem)
+Vue.use(Menu)
+Vue.use(Submenu)
+Vue.use(MenuItem)
+Vue.use(MenuItemGroup)
+Vue.use(Input)
+Vue.use(Image)
+Vue.use(InputNumber)
+Vue.use(Radio)
+Vue.use(RadioGroup)
+Vue.use(RadioButton)
+Vue.use(Checkbox)
+Vue.use(CheckboxButton)
+Vue.use(CheckboxGroup)
+Vue.use(Switch)
+Vue.use(Select)
+Vue.use(Option)
+Vue.use(OptionGroup)
+Vue.use(Button)
+Vue.use(ButtonGroup)
+Vue.use(Table)
+Vue.use(TableColumn)
+Vue.use(DatePicker)
+Vue.use(TimeSelect)
+Vue.use(TimePicker)
+Vue.use(Popover)
+Vue.use(Tooltip)
+Vue.use(Breadcrumb)
+Vue.use(BreadcrumbItem)
+Vue.use(Form)
+Vue.use(FormItem)
+Vue.use(Tabs)
+Vue.use(TabPane)
+Vue.use(Tag)
+Vue.use(Tree)
+Vue.use(Alert)
+Vue.use(Slider)
+Vue.use(Icon)
+Vue.use(Row)
+Vue.use(Col)
+Vue.use(Upload)
+Vue.use(Progress)
+Vue.use(Badge)
+Vue.use(Card)
+Vue.use(Rate)
+Vue.use(Steps)
+Vue.use(Step)
+Vue.use(Carousel)
+Vue.use(CarouselItem)
+Vue.use(Collapse)
+Vue.use(CollapseItem)
+Vue.use(Cascader)
+Vue.use(ColorPicker)
+Vue.use(Transfer)
+Vue.use(Container)
+Vue.use(Header)
+Vue.use(Aside)
+Vue.use(Main)
+Vue.use(Footer)
+
+Vue.use(Loading.directive)
+
+Vue.prototype.$loading = Loading.service
+Vue.prototype.$msgbox = MessageBox
+Vue.prototype.$alert = MessageBox.alert
+Vue.prototype.$confirm = MessageBox.confirm
+Vue.prototype.$prompt = MessageBox.prompt
+Vue.prototype.$notify = Notification
+Vue.prototype.$message = Message
+
+Vue.prototype.$ELEMENT = { size: 'medium' }

+ 2 - 2
src/main.js

@@ -14,8 +14,8 @@ import '@/assets/styles/fonts.css' //字体样式
 import * as imageConversion from 'image-conversion';
 import { getCompressionQuality, compressImage } from '@/utils/compressionUtils.js';
 
-// Vue.prototype.Tupiantou ='https://mxys.chuanghai-tech.com/sqx_fast/alioss/upload'//线上
-Vue.prototype.Tupiantou ='http://192.168.161.190:8171/sqx_fast/alioss/upload'//线上
+Vue.prototype.Tupiantou ='https://mxys.chuanghai-tech.com/sqx_fast/alioss/upload'//线上
+// Vue.prototype.Tupiantou ='http://192.168.161.190:8171/sqx_fast/alioss/upload'//线上
 // Vue.prototype.Tupiantou ='https://mxys.chuanghai-tech.com/wm-test/wm-api/sqx_fast/alioss/upload'//线下
 Vue.prototype.Tupian =function(img){
 	return 'https://mxys.chuanghai-tech.com/wmfile'+img

+ 4 - 4
src/utils/httpRequest.js

@@ -61,8 +61,8 @@ http.adornUrl = (actionName) => {
 // return 'https://chtech.ncjti.edu.cn/testingServer/waiMaiAdmin/' + actionName}
 // return 'http://iyfpk3.natappfree.cc/sqx_fast/' + actionName
 
-// return 'https://mxys.chuanghai-tech.com/sqx_fast/' + actionName
-return 'http://192.168.161.190:8171/sqx_fast/' + actionName
+return 'https://mxys.chuanghai-tech.com/sqx_fast/' + actionName
+// return 'http://192.168.161.190:8171/sqx_fast/' + actionName
 // return 'https://mxys.chuanghai-tech.com/wm-test/wm-api/sqx_fast/' + actionName
 }
 
@@ -77,8 +77,8 @@ http.adornUrlMsg = (actionName) => {
 // return 'https://chtech.ncjti.edu.cn/testingServer/waiMaiAdmin/' + actionName}
 // return 'http://iyfpk3.natappfree.cc/sqx_fast/' + actionName
 
-// return 'https://mxys.chuanghai-tech.com/sqx_fast/' + actionName
-return 'http://192.168.161.190:8171/sqx_fast/' + actionName
+return 'https://mxys.chuanghai-tech.com/sqx_fast/' + actionName
+// return 'http://192.168.161.190:8171/sqx_fast/' + actionName
 // return 'https://mxys.chuanghai-tech.com/wm-test/wm-api/sqx_fast/' + actionName
 }
 http.adornWss = (actionName) => {

+ 464 - 6
src/views/selfShop/shopPublish.vue

@@ -29,6 +29,9 @@
               autosize
             >
             </el-input>
+            <el-button type="primary" icon="document" @click="searchTupian"
+              >查询
+            </el-button>
           </el-col>
           <el-col :span="8">
             <span>商品分类:</span>
@@ -245,12 +248,28 @@
           style="display: flex;align-items: center;margin: 2% 0;flex-flow: wrap;"
         >
           <span style="display: inline-block;text-align: right;"
-            >商品轮播图:</span
+            >商品轮播图:<br>(轮播图最多上传4张)&nbsp;&nbsp;&nbsp;</span
           >
-          <div>
+          <div v-for="(item, index) of potost">
+            <div style="position: relative;margin: 5px;">
+              <img
+                :src="item"
+                class="avatar"
+                style="width:148px;height: 148px;"
+              />
+              <div @click="handleRemove(index)" class="divhove">
+                <i
+                  class="el-icon-delete"
+                  style="margin: 0;font-size: 18px;color: #fff;"
+                ></i>
+              </div>
+            </div>
+          </div>
+          <div class="imgs">
             <el-upload
               :action="Tupiantou"
               list-type="picture-card"
+              :show-file-list="false"
               :on-success="handleUploadSuccess"
               :on-change="handleChange"
               :on-remove="handleRemove"
@@ -696,6 +715,102 @@
         </el-button>
       </div>
     </div>
+    <el-dialog
+      custom-class="export"
+      :visible.sync="tupianVisible"
+      center
+      title="选择图片"
+      :close-on-click-modal="false"
+      :before-close="searchCancle"
+    >
+      <div>
+        <div class="title">
+          <span>封面图:</span
+          ><span
+            >共有<span>{{ cover.length }}</span
+            >条结果供选择</span
+          >
+        </div>
+        <div class="tupian" id="cover" @scroll="searchTupianScroll1">
+          <div
+            v-for="item in cover"
+            :key="item.id"
+            class="img-item"
+            :class="isChecked1(item) ? 'checked' : ''"
+            @click="toggle(item, 1)"
+          >
+            <el-image
+              class="el-image"
+              :src="item.goodsCover"
+              name="el-image"
+              fit="cover"
+            ></el-image>
+            <i v-if="isChecked1(item)" class="checked-icon el-icon-check"></i>
+          </div>
+        </div>
+      </div>
+      <div>
+        <div class="title">
+          <span>轮播图:</span
+          ><span
+            >共有<span>{{ carousel.length }}</span
+            >条结果供选择</span
+          >
+        </div>
+        <div class="tupian" id="carousel" @scroll="searchTupianScroll2">
+          <div
+            v-for="item in carousel"
+            :key="item.id"
+            class="img-item"
+            :class="isChecked2(item) ? 'checked' : ''"
+            @click="toggle(item, 2)"
+          >
+            <el-image
+              class="el-image"
+              :src="item.goodsPicture"
+              name="el-image"
+              fit="cover"
+            ></el-image>
+            <i v-if="isChecked2(item)" class="checked-icon el-icon-check"></i>
+          </div>
+        </div>
+      </div>
+      <div>
+        <div class="title">
+          <span>详情图:</span
+          ><span
+            >共有<span>{{ detail.length }}</span
+            >条结果供选择</span
+          >
+        </div>
+        <div class="tupian" id="detail" @scroll="searchTupianScroll3">
+          <div
+            v-for="item in detail"
+            :key="item.id"
+            class="img-item"
+            :class="isChecked3(item) ? 'checked' : ''"
+            @click="toggle(item, 3)"
+          >
+            <el-image
+              class="el-image"
+              :src="item.goodsParticularsPicture"
+              name="el-image"
+              fit="cover"
+            ></el-image>
+            <i v-if="isChecked3(item)" class="checked-icon el-icon-check"></i>
+          </div>
+        </div>
+      </div>
+      <div class="btn">
+        <el-button type="primary" @click="searchCancle">取消</el-button>
+        <el-button
+          type="primary"
+          style="margin-right: 20px;"
+          @click="searchAffirm"
+          >确定</el-button
+        >
+      </div>
+    </el-dialog>
   </div>
 </template>
 
@@ -827,7 +942,35 @@ export default {
       goodsParticularsPicture: [], //商品详情图
       percentage1: 0, //进度条
       dialogImageUrl: [],
-      dialogVisible: false
+      dialogVisible: false,
+
+      tupianVisible: false,
+      // 封面图
+      cover: [],
+      cover1: [],
+      coverPage: 1,
+      coverLimit: 18,
+      coverTotalCount: 10,
+      coverTotalPage: 1,
+      coverBusy: false,
+
+      // 轮播图
+      carousel: [],
+      carousel1: [],
+      carouselPage: 1,
+      carouselLimit: 18,
+      carouselTotalCount: 10,
+      carouselTotalPage: 1,
+      carouselBusy: false,
+
+      // 详情图
+      detail: [],
+      detail1: [],
+      detailPage: 1,
+      detailLimit: 18,
+      detailTotalCount: 10,
+      detailTotalPage: 1,
+      detailBusy: false
     };
   },
 
@@ -925,7 +1068,11 @@ export default {
     //上传成功
     handleUploadSuccess(file, fileList) {
       // this.goodsPicture += file.data + ','
-      this.potost.push(file.data);
+      // this.potost.push(file.data);
+      if(this.potost.length>=4){
+        this.potost.shift()
+      }
+      this.potost.unshift(file.data);
     },
     // 返回上一级
     prev() {
@@ -1399,7 +1546,7 @@ export default {
           ruleId: this.attr[0].ruleId
         })
       }).then(({ data }) => {
-        console.log(data,'ppp');
+        console.log(data, "ppp");
 
         let returnData = data.data;
         this.headerData = returnData.header;
@@ -1416,11 +1563,271 @@ export default {
     },
     //上传成功
     handleUploadSuccessXq(file, fileList) {
-      this.goodsParticularsPicture.push(file.data);
+      // this.goodsParticularsPicture.push(file.data);
+      if(this.goodsParticularsPicture.length>=4){
+        this.goodsParticularsPicture.shift()
+      }
+      this.goodsParticularsPicture.unshift(file.data);
     },
     onprogress1(event, file, fileList) {
       console.log("详情图上传进度", parseInt(event.percent));
       this.percentage1 = parseInt(event.percent);
+    },
+    // 封面图
+    searchTupianList1(scroll) {
+      console.log(this.coverBusy);
+
+      if (this.coverBusy) return; // 二次保护
+      this.coverBusy = true;
+
+      try {
+        this.$http({
+          url: this.$http.adornUrl(`admin/goods/goodsCoverList`),
+          method: "get",
+          params: this.$http.adornParams({
+            page: this.coverPage,
+            limit: this.coverLimit,
+            name: this.goodsName
+          })
+        }).then(({ data }) => {
+          console.log(data, "封面图片列表");
+          if (scroll == "pageAdd") {
+            this.cover = [...this.cover, ...data.data.list];
+          } else {
+            this.cover = data.data.list;
+          }
+          console.log(this.cover.length, "封面图数量");
+
+          this.coverTotalCount = data.data.totalCount;
+          this.coverTotalPage = data.data.totalPage;
+        });
+      } finally {
+        this.coverBusy = false;
+      }
+    },
+    searchTupianScroll1(e) {
+      const el = e.target;
+      let nearBottom = el.scrollTop + el.clientHeight >= el.scrollHeight; // 再多留一点余量
+      if (
+        nearBottom &&
+        !this.coverBusy &&
+        this.coverPage < this.coverTotalPage
+      ) {
+        this.coverPage++;
+        this.searchTupianList1("pageAdd");
+        console.log("滚动到底", this.coverPage, this.coverTotalPage);
+      }
+    },
+    // 轮播图
+    searchTupianList2(scroll) {
+      if (this.carouselBusy) return; // 二次保护
+      this.carouselBusy = true;
+      try {
+        this.$http({
+          url: this.$http.adornUrl(`admin/goods/goodsPictureList`),
+          method: "get",
+          params: this.$http.adornParams({
+            page: this.carouselPage,
+            limit: this.carouselLimit,
+            name: this.goodsName
+          })
+        }).then(({ data }) => {
+          console.log(data, "轮播图片列表");
+          if (scroll == "pageAdd") {
+            this.carousel = [...this.carousel, ...data.data.list];
+          } else {
+            this.carousel = data.data.list;
+          }
+          this.carouselTotalCount = data.data.totalCount;
+          this.carouselTotalPage = data.data.totalPage;
+        });
+      } finally {
+        this.carouselBusy = false;
+      }
+    },
+    searchTupianScroll2(e) {
+      const el = e.target;
+      let nearBottom = el.scrollTop + el.clientHeight >= el.scrollHeight; // 再多留一点余量
+      if (
+        nearBottom &&
+        !this.carouselBusy &&
+        this.carouselPage < this.carouselTotalPage
+      ) {
+        this.carouselPage++;
+        this.searchTupianList2("pageAdd");
+        console.log("滚动到底", this.carouselPage, this.carouselTotalPage);
+      }
+    },
+    // 详情图
+    searchTupianList3(scroll) {
+      if (this.detailBusy) return; // 二次保护
+      this.detailBusy = true;
+      try {
+        this.$http({
+          url: this.$http.adornUrl(`admin/goods/goodsParticularsPictureList`),
+          method: "get",
+          params: this.$http.adornParams({
+            page: this.detailPage,
+            limit: this.detailLimit,
+            name: this.goodsName
+          })
+        }).then(({ data }) => {
+          console.log(data, "详情图片列表");
+          if (scroll == "pageAdd") {
+            this.detail = [...this.detail, ...data.data.list];
+          } else {
+            this.detail = data.data.list;
+          }
+          this.detailTotalCount = data.data.totalCount;
+          this.detailTotalPage = data.data.totalPage;
+        });
+      } finally {
+        this.detailBusy = false;
+      }
+    },
+    searchTupianScroll3(e) {
+      const el = e.target;
+      let nearBottom = el.scrollTop + el.clientHeight >= el.scrollHeight; // 再多留一点余量
+      if (
+        nearBottom &&
+        !this.detailBusy &&
+        this.detailPage < this.detailTotalPage
+      ) {
+        this.detailPage++;
+        this.searchTupianList3("pageAdd");
+        console.log("滚动到底", this.detailPage, this.detailTotalPage);
+      }
+    },
+    // 通过商品名称获取数据弹出
+    searchTupian() {
+      if (!this.goodsName) {
+        this.$notify({
+          title: "提示",
+          duration: 1800,
+          message: "请输入商品标题进行搜索",
+          type: "warning"
+        });
+        return;
+      }
+      this.cover = [];
+      this.cover1 = [];
+      this.carousel = [];
+      this.carousel1 = [];
+      this.detail = [];
+      this.detail1 = [];
+      this.coverPage = 1;
+      this.carouselPage = 1;
+      this.detailPage = 1;
+      this.tupianVisible = true;
+      this.searchTupianList1();
+      this.searchTupianList2();
+      this.searchTupianList3();
+    },
+    // 确定图片
+    searchAffirm() {
+      this.cover1.forEach(i => {
+        this.goodsCover = i.goodsCover;
+      });
+      this.potost = [];
+      for (var a = 0; a < this.carousel.length; a++) {
+        this.carousel1.forEach(i => {
+          if (i.id == this.carousel[a].id) {
+            this.potost.push(this.carousel[a].goodsPicture);
+          }
+        });
+      }
+      this.goodsParticularsPicture = [];
+      for (var b = 0; b < this.detail.length; b++) {
+        this.detail1.forEach(i => {
+          if (i.id == this.detail[b].id) {
+            this.goodsParticularsPicture.push(
+              this.detail[b].goodsParticularsPicture
+            );
+          }
+        });
+      }
+      this.tupianVisible = false;
+      console.log(this.potost, "iii");
+    },
+    // 取消弹出
+    searchCancle() {
+      this.tupianVisible = false;
+      this.cover = [];
+      this.cover1 = [];
+      this.carousel = [];
+      this.carousel1 = [];
+      this.detail = [];
+      this.detail1 = [];
+      this.coverPage = 1;
+      this.carouselPage = 1;
+      this.detailPage = 1;
+    },
+    // 判断是否勾选封面图
+    isChecked1(item) {
+      return this.cover1.some(a => a.id == item.id);
+    },
+    // 判断是否勾选轮播图
+    isChecked2(item) {
+      return this.carousel1.some(a => a.id == item.id);
+    },
+    // 判断是否勾选详情图
+    isChecked3(item) {
+      return this.detail1.some(a => a.id == item.id);
+    },
+    // 勾选判断
+    toggle(item, flag) {
+      if (flag == 1) {
+        // 1) 已经在某个数组中,就把这个数组移除
+        if (this.cover1.some(a => a.id == item.id)) {
+          this.cover1 = this.cover1.filter(v => v.id != item.id);
+          console.log(this.cover1);
+          return;
+        }
+        this.cover1.shift();
+        this.cover1.push({
+          id: item.id,
+          goodsCover: item.goodsCover
+        });
+      }
+      if (flag == 2) {
+        if (this.carousel1.some(a => a.id == item.id)) {
+          this.carousel1 = this.carousel1.filter(v => v.id != item.id);
+          return;
+        }
+        if (this.carousel1.length >= 4) {
+          this.carousel1.shift();
+        }
+        this.carousel1.push({
+          id: item.id,
+          goodsCover: item.goodsCover
+        });
+      }
+      if (flag == 3) {
+        if (this.detail1.some(a => a.id == item.id)) {
+          this.detail1 = this.detail1.filter(v => v.id != item.id);
+          return;
+        }
+        if (this.detail1.length >= 4) {
+          this.detail1.shift();
+        }
+        this.detail1.push({
+          id: item.id,
+          goodsCover: item.goodsCover
+        });
+      }
+
+      // // 2) 尚未选中,需要放进“最少”的数组里
+      // if (this.cover.length >= 1) {
+      //   this.cover.shift();
+      //   this.cover.push(id);
+      // }
+      // else if (this.carousel.length < 7) this.carousel.push(id);
+      // else if (this.detail.length < 4) this.detail.push(id);
+      // else {
+      //   // 全部满了,放轮播,并踢掉第一张
+      //   this.carousel.shift();
+      //   this.carousel.push(id);
+      // }
     }
   },
   mounted() {
@@ -1596,4 +2003,55 @@ export default {
 .divhove:hover {
   opacity: 0.8;
 }
+
+/* 导出限制 */
+.main-cont >>> .export {
+  width: 800px;
+}
+.export .tupian {
+  display: flex;
+  flex-wrap: wrap;
+  border: 1px solid #ccc;
+  overflow: auto;
+  height: 230px;
+}
+.export .btn {
+  margin-top: 15px;
+  display: flex;
+  flex-direction: row-reverse;
+}
+.export .img-pool {
+  display: flex;
+  flex-wrap: wrap;
+}
+.export .img-item {
+  width: 104px;
+  height: 104px;
+  position: relative;
+  margin: 4px;
+  cursor: pointer;
+  border: 2px solid transparent;
+}
+.export .img-item .el-image {
+  display: inline-block;
+  width: 100px;
+  height: 100px;
+  border: 1px solid #ccc;
+}
+.export .img-item .el-image >>> img {
+  width: 100px;
+  height: 100px;
+}
+.export  .img-item.checked {
+  border-color: #409eff;
+}
+.export .checked-icon {
+  position: absolute;
+  bottom: 2px;
+  right: 2px;
+  color: #409eff;
+  background: #fff;
+  border-radius: 50%;
+  padding: 2px;
+}
 </style>