yuhaitao14 7 years ago
parent
commit
b99dc6776d

+ 8 - 0
shop/src/main/java/com/zskk/shop/controller/admin/GoodsManagerController.java

@@ -18,6 +18,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.bind.annotation.ResponseBody;
 
 
+import com.alibaba.fastjson.JSON;
 import com.zskk.shop.controller.AbstractController;
 import com.zskk.shop.controller.AbstractController;
 import com.zskk.shop.controller.bean.ControllerResult;
 import com.zskk.shop.controller.bean.ControllerResult;
 import com.zskk.shop.controller.bean.GoodBean;
 import com.zskk.shop.controller.bean.GoodBean;
@@ -64,4 +65,11 @@ public class GoodsManagerController extends AbstractController{
 		pageBean.setTotalCount(totalCount);
 		pageBean.setTotalCount(totalCount);
 		return new ControllerResult(pageBean);
 		return new ControllerResult(pageBean);
 	}
 	}
+	
+	@RequestMapping("edit")
+	@ResponseBody
+	public ControllerResult exit(GoodBase base){
+		System.out.println(JSON.toJSONString(base));
+		return new ControllerResult(Boolean.TRUE);
+	}
 }
 }

+ 1 - 0
shop/static/manager/src/api/index.js

@@ -61,5 +61,6 @@ var post = function(url, params, vue) {
 
 
 export default {
 export default {
     getGoods: (params, vue) => post(`${serverPath}manage/goods`, params, vue),
     getGoods: (params, vue) => post(`${serverPath}manage/goods`, params, vue),
+    editGoods: (params, vue) => post(`${serverPath}manage/edit`, params, vue)
 
 
 }
 }

+ 26 - 8
shop/static/manager/src/components/page/EditGoods.vue

@@ -15,6 +15,10 @@
                 注意:图标比例一定要1:1
                 注意:图标比例一定要1:1
             </p>
             </p>
         </el-form-item>
         </el-form-item>
+        <el-form-item>
+            <el-button type="primary" @click="save">保存</el-button>
+            <el-button>取消</el-button>
+        </el-form-item>
     </el-form>
     </el-form>
 </template>
 </template>
 <script>
 <script>
@@ -25,7 +29,8 @@ export default {
       form: {
       form: {
         name: '',
         name: '',
         describe: '',
         describe: '',
-        icon: ''
+        icon: '',
+        status: false
       }
       }
     }
     }
   },
   },
@@ -42,12 +47,25 @@ export default {
       }
       }
     },
     },
     onUploadSuccess: function(res, file) {
     onUploadSuccess: function(res, file) {
-        if (res.code != 0){
-            this.$message.error('上传图片失败 原因:' + res.msg + "(" + res.code + ")")
-            return;
-        }else{
-            this.form.icon = res.obj;
-        }
+      if (res.code != 0) {
+        this.$message.error(
+          '上传图片失败 原因:' + res.msg + '(' + res.code + ')'
+        )
+        return
+      } else {
+        this.form.icon = res.obj
+      }
+    },
+    save: function() {
+      let goods = {
+        name: this.form.name,
+        describe: this.form.describe,
+        icon: this.form.icon
+      }
+
+      this.$http.editGoods(goods, this).then(data => {
+        console.log(data)
+      })
     }
     }
   }
   }
 }
 }
@@ -81,6 +99,6 @@ export default {
 }
 }
 
 
 .zy {
 .zy {
-    color: red;
+  color: red;
 }
 }
 </style>
 </style>