shish 10 месяцев назад
Родитель
Сommit
7419f64c22
3 измененных файлов с 36 добавлено и 12 удалено
  1. 6 6
      ghsApp/src/admin/item/add.vue
  2. 15 3
      ghsApp/src/admin/item/detail.vue
  3. 15 3
      hdApp/src/admin/item/detail.vue

+ 6 - 6
ghsApp/src/admin/item/add.vue

@@ -331,10 +331,7 @@ export default {
         that.$forceUpdate()
       })
     },
-    changeCp(item){
-      this.$util.pageTo({url: '/admin/cp/list?skip=1'})
-    },
-    changeClass(item){
+    changeClass(){
       this.$refs.classRef.open('center')
     },
     setThisClass(info){
@@ -531,8 +528,11 @@ export default {
     imgUploadSuccess(res) {
       var _res = JSON.parse(res.data)
       if(_res.code == 1){
-        this.currentImgData.push(_res.data.smallUrl)
-        this.form.cover.push(_res.data.shortUrl)
+        this.currentImgData.push(_res.data.bigUrl)
+        this.form.images.push(_res.data.shortUrl)
+        if (!this.form.cover) {
+          this.form.cover.push(_res.data.shortUrl)
+        }
       }
     },
     imgDeleteFn(res){

+ 15 - 3
ghsApp/src/admin/item/detail.vue

@@ -1051,9 +1051,21 @@ export default {
           this.form[i] = res.data[i];
         });
 
-        this.currentImgData.push(res.data.bigCover)
-        this.form.images = [res.data.shortCover]
-        this.form.cover = res.data.shortCover // 覆盖原来的cover,并要使用短链接图片
+        this.form.cover = res.data.shortCover
+
+        if(!this.$util.isEmpty(res.data.images)){
+          const imageUrls = (res.data.images || '').split(',').filter(i => i);
+          this.form.images = imageUrls;
+          this.currentImgData = imageUrls.map(url => {
+            return this.constant.imgUrl + '/' + url + '?x-oss-process=image/resize,m_fill,h_700,w_700'
+          })
+          if(this.form.cover==''){
+            this.form.cover = this.form.images[0]
+          }
+        }else{
+          this.currentImgData.push(res.data.bigCover)
+          this.form.images = [res.data.shortCover]
+        }
 
         this.form.stock = 0
         this.form.itemId = ptItemId

+ 15 - 3
hdApp/src/admin/item/detail.vue

@@ -1070,9 +1070,21 @@ export default {
           this.form[i] = res.data[i];
         });
 
-        this.currentImgData.push(res.data.bigCover)
-        this.form.images = [res.data.shortCover]
-        this.form.cover = res.data.shortCover // 覆盖原来的cover,并要使用短链接图片
+        this.form.cover = res.data.shortCover
+
+        if(!this.$util.isEmpty(res.data.images)){
+          const imageUrls = (res.data.images || '').split(',').filter(i => i);
+          this.form.images = imageUrls;
+          this.currentImgData = imageUrls.map(url => {
+            return this.constant.imgUrl + '/' + url + '?x-oss-process=image/resize,m_fill,h_700,w_700'
+          })
+          if(this.form.cover==''){
+            this.form.cover = this.form.images[0]
+          }
+        }else{
+          this.currentImgData.push(res.data.bigCover)
+          this.form.images = [res.data.shortCover]
+        }
 
         this.form.stock = 0
         this.form.itemId = ptItemId