Java之品优购课程讲义_day08(2)

2.1 广告管理
2.1.1 广告图片上传
将 pinyougou-shop-web 的以下资源拷贝到 pinyougou-manager-web
(1) UploadController.java
(2) uploadService.js
(3) application.properties
(4) fdfs_client.conf
在 pinyougou-manager-web 的 springmvc.xml 中添加配置

在 contentController.js 引入 uploadService //控制层 app.controller('contentController' ,function($scope,$controller ,contentService,u ploadService){ 在 content.html 引 入 JS 在 contentController.js 编写代码 //上传广告图 $scope.uploadFile=function(){ uploadService.uploadFile().success( function(response){ if(response.success){ $scope.entity.pic=response.message; }else{ alert("上传失败!"); } } ).error( function(){ alert("上传出错!"); } ); } 修改 content.html 实现上传功能 图片 列表中显示图片

猜你喜欢

转载自blog.51cto.com/13517854/2169650