Skip to content

Commit 4901ed8

Browse files
committed
添加新闻中心模块
1 parent 4c4dc32 commit 4901ed8

8 files changed

Lines changed: 252 additions & 39 deletions

File tree

Libs/Js/app.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@
1515
.when('/qaDetail/:catetogyId/:qaId', {
1616
templateUrl: 'Views/qa/qaDetail.html'
1717
})
18+
.when('/newsList/:id', {
19+
templateUrl: 'Views/news/newsList.html'
20+
})
21+
.when('/newsDetail/:catetogyId/:newsId', {
22+
templateUrl: 'Views/news/newsDetail.html'
23+
})
1824
.otherwise({
1925
redirectTo: '/'
2026
});

Libs/Js/ctrls/mainCtrl.js

Lines changed: 6 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -170,17 +170,12 @@
170170
}
171171

172172
})
173-
.controller('QANewsCtrl', function ($scope,qaDataService) {
173+
.controller('QANewsCtrl', function ($scope,qaDataService,newsDataService) {
174174
//news
175-
$scope.news = [
176-
{ content: "新闻一。。。。", url: "#/", isFocus: false },
177-
{ content: "新闻eer。。。。", url: "#/", isFocus: false },
178-
{ content: "sdfdsfsdfd。。。。", url: "#/", isFocus: false },
179-
{ content: "新闻一ddfasdf", url: "#/", isFocus: false },
180-
{ content: "sdfsdfsd。。。。", url: "#/", isFocus: false },
181-
{ content: "ghtrtuyrr。。。。", url: "#/", isFocus: false },
182-
{ content: "htre。。。。", url: "#/", isFocus: false }
183-
]
175+
$scope.newsCategory = newsDataService.getCategory(1);
176+
$scope.newsTabFocus = function (index) {
177+
$scope.newsCategory = newsDataService.getCategory(index);
178+
}
184179
$scope.aLinkHover = function (index) {
185180
$scope.news[index].isFocus = true;
186181
}
@@ -191,33 +186,7 @@
191186
//qa
192187
//$scope.qaZoneLeftImg = "/Sources/imgs/wdBox.png";
193188
$scope.qaZoneLeftImg = "/Sources/realImgs/others/FAQ.jpg";
194-
//$scope.qaList = [
195-
// {
196-
// question: "了空间了空间浪费空间?",
197-
// answer: "了空间链接了解了了时间段里疯狂就死定了拉开距离龙聚楼酒楼。",
198-
// url: "#/"
199-
// },
200-
// {
201-
// question: "欧赔,门将离开了我我我?",
202-
// answer: "路肩路肩了解空间抛弃破IPIQ颇为家里快急死了到家了抛弃破费破量减少了空间刻录机你,没呢,吗。",
203-
// url: "#/"
204-
// },
205-
// {
206-
// question: "户名称来看及?",
207-
// answer: "我我我我ijoiiouosuf看见了看见了看见了健康了健康记录劈破。",
208-
// url: "#/"
209-
// },
210-
// {
211-
// question: "品牌空间关闭接口卡啦啦啦?",
212-
// answer: "哦IE偶奇偶及皮肤鹿鼎记佛经里看见的怕看见了家里快乐偶奇偶及皮肤鹿鼎记佛经里看见的怕看见了家里快乐偶奇偶及皮肤鹿鼎记佛经里看见的怕看见了家里快乐。",
213-
// url: "#/"
214-
// },
215-
// {
216-
// question: "两句话给帮忙看看匹配进口零距离?",
217-
// answer: "我看见了建瓯盘欺骗记录到快来看才看见哦自己哦了。",
218-
// url: "#/"
219-
// }
220-
//];
189+
221190
$scope.qaCategory = qaDataService.getCategory(1);
222191
$scope.tabFocus = function (index) {
223192
$scope.qaCategory = qaDataService.getCategory(index);

Libs/Js/ctrls/news/newsCtrls.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
mainMoudle.controller('newsListCtrl', ['$scope', 'newsDataService', '$routeParams', function ($scope, newsDataService, $routeParams) {
2+
$scope.sideMenu = newsDataService.all();
3+
$scope.newsCategory = newsDataService.getCategory($routeParams.id);
4+
5+
$scope.changeCategory = function (index) {
6+
$scope.newsCategory = newsDataService.getCategory(index + 1);
7+
}
8+
}])
9+
.controller('newsDetailCtrl', function ($scope, newsDataService, $routeParams) {
10+
var newsCategory = newsDataService.getCategory($routeParams.catetogyId);
11+
$scope.news = newsDataService.getNews(newsCategory, $routeParams.newsId);
12+
13+
$scope.sideMenu = newsDataService.all();
14+
$scope.changeCategory = function (index) {
15+
$scope.newsCategory = newsDataService.getCategory(index + 1);
16+
}
17+
})
18+
19+
;

Libs/Js/services/newsDataService.js

Lines changed: 161 additions & 0 deletions
Large diffs are not rendered by default.

Views/main.html

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,16 @@ <h3 style="margin-top:10px;" class="col-md-6"><i class="fa fa-question-circle fa
144144
<h3 style="margin-top:10px;" class="col-md-8"><i class="fa fa-comments fa-margin"></i>行业动态</h3>
145145
<a style="margin-right:10px;margin-top:5px;" class="btn btn-danger pull-right"><i class="fa fa-eye fa-margin"></i>more</a>
146146
</div>
147+
147148
<div class="row zone qa-news-zone">
149+
<div class="qaCategory">
150+
<a href="#/newsList/1" class="btn btn-lg" ng-mouseenter="newsTabFocus(1)">行业新闻</a>
151+
<a href="#/newsList/2" class="btn btn-lg" ng-mouseenter="newsTabFocus(2)">公司新闻</a>
152+
</div>
148153
<ul style="">
149-
<li ng-repeat="new in news">
154+
<li ng-repeat="new in newsCategory.data">
150155
<!--<a ng-href="{{new.url}}" ng-class="{true: 'a-link-hover', false: 'a-link'}[new.isFocus]" ng-mouseover="aLinkHover($index)" ng-mouseleave="aLinkBlur($index)">{{new.content}}</a>-->
151-
<a ng-href="{{new.url}}" class="a-link">{{new.content}}</a>
156+
<a ng-href="{{new.url}}newsDetail/{{newsCategory.id}}/{{new.id}}" class="a-link">{{new.title}}</a>
152157
</li>
153158
</ul>
154159
</div>

Views/news/newsDetail.html

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<div class="row zoneSplit"></div>
2+
<div class="row" ng-controller="newsDetailCtrl">
3+
<div class="col-md-offset-1 col-md-2 sideMenuAndSlideImg zone">
4+
<h3><i class="fa fa-list-ul fa-margin" style="color: #d7000f;padding-left:10px;"></i>新闻中心</h3>
5+
<div class="sideMenu">
6+
<div ng-repeat="menu in sideMenu" class="qaCategory sideMenuItem" ng-click="changeCategory($index)" style="cursor:pointer;">
7+
<a href="#/newsList/{{$index+1}}">{{menu.name}}</a><i class="fa fa-angle-right pull-right" style="padding-right:35px;"></i>
8+
</div>
9+
</div>
10+
11+
</div>
12+
<div class="col-md-8 sideMenuAndSlideImg zone" style="overflow-y: scroll;">
13+
14+
<div style="padding:30px;">
15+
<dl>
16+
<dt>
17+
{{news.title}}
18+
</dt><hr/>
19+
<dd>
20+
{{news.content}}
21+
</dd>
22+
</dl>
23+
</div>
24+
25+
</div>
26+
</div>

Views/news/newsList.html

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<div class="row zoneSplit"></div>
2+
<div class="row" ng-controller="newsListCtrl">
3+
<div class="col-md-offset-1 col-md-2 sideMenuAndSlideImg zone">
4+
<h3><i class="fa fa-list-ul fa-margin" style="color: #d7000f;padding-left:10px;"></i>新闻中心</h3>
5+
<div class="sideMenu">
6+
<div ng-repeat="menu in sideMenu" class="qaCategory sideMenuItem" ng-click="changeCategory($index)" style="cursor:pointer;">
7+
<a href="#/newsList/{{$index+1}}">{{menu.name}}</a><i class="fa fa-angle-right pull-right" style="padding-right:35px;"></i>
8+
</div>
9+
</div>
10+
11+
</div>
12+
<div class="col-md-8 sideMenuAndSlideImg zone" style="overflow-y: scroll;">
13+
14+
<div style="padding:30px;">
15+
<h3>{{newsCategory.name}}</h3><hr />
16+
<ul style="">
17+
<li ng-repeat="new in newsCategory.data">
18+
<a ng-href="{{new.url}}newsDetail/{{newsCategory.id}}/{{new.id}}" class="a-link">{{new.title}}</a>
19+
</li>
20+
</ul>
21+
22+
</div>
23+
24+
</div>
25+
</div>

index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@
1414
<script src="Libs/Js/directives/directives.js"></script>
1515
<!--service-->
1616
<script src="Libs/Js/services/qaDataService.js"></script>
17+
<script src="Libs/Js/services/newsDataService.js"></script>
1718
<!--ctrl-->
1819
<script src="Libs/Js/ctrls/mainCtrl.js"></script>
1920
<script src="Libs/Js/ctrls/ctrls.js"></script>
2021
<script src="Libs/Js/ctrls/qa/qaCtrls.js"></script>
22+
<script src="Libs/Js/ctrls/news/newsCtrls.js"></script>
2123

2224
<script src="Libs/Js/ctrls/sample/sample.js"></script>
2325

0 commit comments

Comments
 (0)