xuqiang 4 jaren geleden
bovenliggende
commit
20989689c3
3 gewijzigde bestanden met toevoegingen van 33 en 15 verwijderingen
  1. 1 1
      .env.development
  2. 1 1
      .env.production
  3. 31 13
      src/pages/store/productEdit.vue

+ 1 - 1
.env.development

@@ -1 +1 @@
-VUE_APP_BASE_URL=http://192.168.50.120:8080
+VUE_APP_BASE_URL=http://localhost:8080

+ 1 - 1
.env.production

@@ -1 +1 @@
-VUE_APP_BASE_URL=http://192.168.50.120:8080
+VUE_APP_BASE_URL=http://localhost:8080

+ 31 - 13
src/pages/store/productEdit.vue

@@ -48,7 +48,10 @@
         </van-cell-group>
         <div class="box-con">
             <div class="label">卡牌细节图</div>
-            <van-uploader :file-list="form.images" :after-read="afterRead" @delete="deleteImg" />
+            <van-uploader :file-list="images" :after-read="afterRead" @delete="deleteImg" />
+            <!-- <div v-for="(item, index) in form.images" :key="index">
+                <van-uploader :file-list="item[0]" :after-read="afterRead" />
+            </div> -->
             <div class="box-top">
                 <div class="top"><span>选择卡包</span></div>
                 <van-sticky :offset-top="0">
@@ -127,16 +130,20 @@ export default {
                 boxesCount: '',
                 postage: 10,
                 boxPrice: '',
+                code: 1,
                 startTime: '',
                 description: '',
                 collectionId: 0,
                 seriesId: 0,
-                caseStatus: 'progress',
-                images: [],
+                packagesCount: null,
+                caseStatus: 'PROGRESS',
                 groupDTOS: []
             },
             show: false,
             name: '',
+            images: [],
+            imagesList: [],
+            imageUrls: [],
             newShow: false,
             nowChooseId: [],
             sotrId: [],
@@ -193,10 +200,11 @@ export default {
                 .then(res => {
                     this.hideLoading();
                     this.actions = res.content;
+                    console.log(this.actions);
                     this.sotrId = this.actions.find(item => {
                         return item.id;
                     });
-                    this.form.collectionId = this.sotrId.id;
+                    this.form.seriesId = this.sotrId.id;
                 })
                 .catch(e => {
                     this.hideLoading();
@@ -246,12 +254,12 @@ export default {
             if (this.closeFlag) {
                 this.name = e.detail.name;
                 this.show = false;
+                this.form.collectionId = e.detail.id;
                 return;
             }
             let data = {
                 seriesId: e.detail.id
             };
-            this.form.seriesId = data.seriesId;
             this.showLoading();
             this.$http
                 .post(
@@ -293,6 +301,7 @@ export default {
                     special: params.special
                 })
                 .then(res => {
+                    console.log(res);
                     this.hideLoading();
                     this.form.groupDTOS = res;
                     console.log(this.form.groupDTOS);
@@ -310,12 +319,15 @@ export default {
             this.$http
                 .uploadFile(file.path)
                 .then(res => {
-                    this.hideLoading();
+                    if (this.images.length > 2) {
+                        this.toast('最多上传三张图片');
+                        return;
+                    }
                     console.log(res);
-                    let images = [];
-                    images.push({ ...file, url: res });
-                    this.form.images = images;
-                    console.log(this.form.images);
+                    this.hideLoading();
+                    this.imagesList.push({ ...file, url: res });
+                    this.images = [...this.imagesList];
+                    this.imageUrls.push(res);
                 })
                 .catch(e => {
                     this.hideLoading();
@@ -327,6 +339,7 @@ export default {
         },
         deleteImg() {
             this.form.images = [];
+            console.log(this.form.images);
         },
         submit() {
             if (!this.name) {
@@ -350,11 +363,16 @@ export default {
                 });
                 return;
             }
-            let form = { ...this.form };
-            console.log(form);
+            let cardCaseInputDTO = { ...this.form };
+            let images = this.imageUrls.join(',');
+            cardCaseInputDTO.images = images;
             this.showLoading();
             this.$http
-                .post('cardCase/save', { form })
+                .post('/cardCase/save', cardCaseInputDTO, {
+                    header: {
+                        'Content-Type': 'application/json'
+                    }
+                })
                 .then(res => {
                     this.hideLoading();
                     console.log(res);