Procházet zdrojové kódy

fix:修改增加属性值数据丢失的问题

徐志豪 před 5 roky
rodič
revize
c4c37d020f

+ 1 - 2
.gitignore

@@ -1,4 +1,3 @@
 node_modules
 dist
-.tmp
-admins/*/js/*/*.js
+.tmp

+ 1 - 46
admins/fd-mall-backstage/WEB-INF/page/shop/goods.html

@@ -3,52 +3,7 @@
 <head>
     <title></title>
     #parse("sys/header.html")
-    <style>
-        .upload-list {
-            display: inline-block;
-            width: 60px;
-            height: 60px;
-            text-align: center;
-            line-height: 60px;
-            border: 1px solid transparent;
-            border-radius: 4px;
-            overflow: hidden;
-            background: #fff;
-            position: relative;
-            box-shadow: 0 1px 1px rgba(0, 0, 0, .2);
-            margin-right: 4px;
-        }
-
-        .upload-list img {
-            width: 100%;
-            height: 100%;
-        }
-
-        .upload-list-cover {
-            display: none;
-            position: absolute;
-            top: 0;
-            bottom: 0;
-            left: 0;
-            right: 0;
-            background: rgba(0, 0, 0, .6);
-        }
-
-        .upload-list:hover .upload-list-cover {
-            display: block;
-        }
-
-        .upload-list-cover i {
-            color: #fff;
-            font-size: 20px;
-            cursor: pointer;
-            margin: 0 2px;
-        }
-
-    </style>
-
-
-    <!-- <script type="text/javascript" src = "https://cdn.polyfill.io/v2/polyfill.min.js?features=es6"></script> -->
+    <link rel="stylesheet" href="${rc.contextPath}/css/goods.css">
 </head>
 <body>
 <div id="rrapp" v-cloak>

+ 47 - 0
admins/fd-mall-backstage/css/goods.css

@@ -0,0 +1,47 @@
+.ip-layout {
+  flex: 1;
+}
+.upload-list {
+  display: inline-block;
+  width: 60px;
+  height: 60px;
+  text-align: center;
+  line-height: 60px;
+  border: 1px solid transparent;
+  border-radius: 4px;
+  overflow: hidden;
+  background: #fff;
+  position: relative;
+  box-shadow: 0 1px 1px rgba(0, 0, 0, .2);
+  margin-right: 4px;
+}
+
+.upload-list img {
+  width: 100%;
+  height: 100%;
+}
+
+.upload-list-cover {
+  display: none;
+  position: absolute;
+  top: 0;
+  bottom: 0;
+  left: 0;
+  right: 0;
+  background: rgba(0, 0, 0, .6);
+}
+
+.upload-list:hover .upload-list-cover {
+  display: block;
+}
+
+.upload-list-cover i {
+  color: #fff;
+  font-size: 20px;
+  cursor: pointer;
+  margin: 0 2px;
+}
+.h-val li {
+  flex: 1;
+  text-align: center;
+}

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 1 - 1
admins/fd-mall-backstage/js/shop/goods.js


+ 2 - 45
admins/zl-mall-backstage/WEB-INF/page/shop/goods.html

@@ -3,50 +3,7 @@
 <head>
     <title></title>
     #parse("sys/header.html")
-    <style>
-        .upload-list {
-            display: inline-block;
-            width: 60px;
-            height: 60px;
-            text-align: center;
-            line-height: 60px;
-            border: 1px solid transparent;
-            border-radius: 4px;
-            overflow: hidden;
-            background: #fff;
-            position: relative;
-            box-shadow: 0 1px 1px rgba(0, 0, 0, .2);
-            margin-right: 4px;
-        }
-
-        .upload-list img {
-            width: 100%;
-            height: 100%;
-        }
-
-        .upload-list-cover {
-            display: none;
-            position: absolute;
-            top: 0;
-            bottom: 0;
-            left: 0;
-            right: 0;
-            background: rgba(0, 0, 0, .6);
-        }
-
-        .upload-list:hover .upload-list-cover {
-            display: block;
-        }
-
-        .upload-list-cover i {
-            color: #fff;
-            font-size: 20px;
-            cursor: pointer;
-            margin: 0 2px;
-        }
-
-    </style>
-
+    <link rel="stylesheet" href="${rc.contextPath}/css/goods.css">
 
     <!-- <script type="text/javascript" src = "https://cdn.polyfill.io/v2/polyfill.min.js?features=es6"></script> -->
 </head>
@@ -196,7 +153,7 @@
                                 <div class="">
                                     <div class="t-header">
                                         <ul class="h-val">
-                                            <li v-for="(item,i) in ggname">{{item.name}}</li>
+                                            <li v-for="(item, i) in ggname" >{{item.name}}</li>
                                         </ul>
                                         <ul>
                                             <li v-for="(item,i) in ggheader">

+ 47 - 0
admins/zl-mall-backstage/css/goods.css

@@ -0,0 +1,47 @@
+.ip-layout {
+  flex: 1;
+}
+.upload-list {
+  display: inline-block;
+  width: 60px;
+  height: 60px;
+  text-align: center;
+  line-height: 60px;
+  border: 1px solid transparent;
+  border-radius: 4px;
+  overflow: hidden;
+  background: #fff;
+  position: relative;
+  box-shadow: 0 1px 1px rgba(0, 0, 0, .2);
+  margin-right: 4px;
+}
+
+.upload-list img {
+  width: 100%;
+  height: 100%;
+}
+
+.upload-list-cover {
+  display: none;
+  position: absolute;
+  top: 0;
+  bottom: 0;
+  left: 0;
+  right: 0;
+  background: rgba(0, 0, 0, .6);
+}
+
+.upload-list:hover .upload-list-cover {
+  display: block;
+}
+
+.upload-list-cover i {
+  color: #fff;
+  font-size: 20px;
+  cursor: pointer;
+  margin: 0 2px;
+}
+.h-val li {
+  flex: 1;
+  text-align: center;
+}

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 1 - 1
admins/zl-mall-backstage/js/shop/goods.js


+ 1 - 0
build/webpack.dev.config.js

@@ -30,6 +30,7 @@ module.exports = {
   plugins: [
     new CopyWebpackPlugin([
       ...copyToApps('statics'),
+      ...copyToApps('css'),
     ]),
     ...htmlPluginsArr
   ]

+ 47 - 0
css/goods.css

@@ -0,0 +1,47 @@
+.ip-layout {
+  flex: 1;
+}
+.upload-list {
+  display: inline-block;
+  width: 60px;
+  height: 60px;
+  text-align: center;
+  line-height: 60px;
+  border: 1px solid transparent;
+  border-radius: 4px;
+  overflow: hidden;
+  background: #fff;
+  position: relative;
+  box-shadow: 0 1px 1px rgba(0, 0, 0, .2);
+  margin-right: 4px;
+}
+
+.upload-list img {
+  width: 100%;
+  height: 100%;
+}
+
+.upload-list-cover {
+  display: none;
+  position: absolute;
+  top: 0;
+  bottom: 0;
+  left: 0;
+  right: 0;
+  background: rgba(0, 0, 0, .6);
+}
+
+.upload-list:hover .upload-list-cover {
+  display: block;
+}
+
+.upload-list-cover i {
+  color: #fff;
+  font-size: 20px;
+  cursor: pointer;
+  margin: 0 2px;
+}
+.h-val li {
+  flex: 1;
+  text-align: center;
+}

+ 17 - 14
js/shop/goods.js

@@ -209,6 +209,17 @@ var vm = new Vue({
         getInputArr:function(){
             let uuidLink = []
             var arr = []
+            function pushArr (arr, uuidLink , inputVal) {
+                let item = vm.inputArr.find(item => item.uuidLink === uuidLink)
+                console.log(item)
+                if (item) {
+                    arr.push(item)
+                } else {
+                    arr.push(Object.assign(inputVal,{
+                        uuidLink
+                    }))
+                }
+            }
             this.ggContent.forEach(function (item){
                 uuidLink = []
                 
@@ -220,28 +231,21 @@ var vm = new Vue({
                             sub.subItems.forEach(function(last){
                                 uuidLink[2] = last.uuid
                                 if (!last.subItems) {
-                                    arr.push(Object.assign({},{
-                                        uuidLink:uuidLink.join('_')
-                                    },last.inputVal))
+                                    pushArr(arr, uuidLink.join('_'), last.inputVal)
                                     uuidLink.pop()
                                 }
                             })
                         }
                         else{
-                            arr.push(Object.assign({},{
-                                uuidLink:uuidLink.join('_')
-                            },sub.inputVal))
+                            pushArr(arr, uuidLink.join('_'), sub.inputVal)
                             uuidLink.pop()
                         }
                     })
                 }else{
-                    arr.push(Object.assign({},{
-                        uuidLink:uuidLink.join('_')
-                    },item.inputVal))
+                    pushArr(arr, uuidLink.join('_'), item.inputVal)
                     uuidLink.pop()
                 }
             })
-
             this.inputArr = arr
         },
         showArrsds:function () {
@@ -312,13 +316,14 @@ var vm = new Vue({
             let itm = []
             let goodsSpecificationList = []
             this.ggname = []
+            console.log(this.guigeArr)
             this.guigeArr.forEach(function(item,idx){
                 itm = []
                 item.val.forEach(function(sub,i){
                     let tt= {
                         value:sub.name,
                         picUrl:sub.picUrl||'',
-                        uuid:sub.uuid||((idx+1)+'-'+(i+1)),
+                        uuid: sub.uuid||((idx+1)+'-'+(i+1)),
                         specificationId: item.specificationId,
                         inputVal:{
                             goodsNumber:'',
@@ -347,7 +352,6 @@ var vm = new Vue({
                 }
                 
             })
-    
             this.ggContent = tmp[0]
             this.goodsSpecificationList = goodsSpecificationList
             this.getInputArr()
@@ -678,12 +682,11 @@ var vm = new Vue({
                     var productList = r.goods.productList.sort(function(a, b) {
                         var a_uuid_sort = vm.countProductSort(a.uuidLink)
                         var b_uuid_sort = vm.countProductSort(b.uuidLink)
-                        console.log(a_uuid_sort, b_uuid_sort)
                         return a_uuid_sort - b_uuid_sort
                         
                     })
                     vm.inputArr = productList
-
+                    vm.goodsSpecificationList = r.goods.goodsSpecificationList
                     vm.guigeArr = JSON.parse(r.goods.guigeArr) || []
                     vm.ggContent = JSON.parse(r.goods.ggContent)
                     vm.ggname = []