mirror of
https://github.com/wu736139669/vczero.github.io.git
synced 2026-08-05 06:23:38 +00:00
change div 2 input
This commit is contained in:
+2
-2
@@ -42,12 +42,12 @@ header div:nth-child(2){
|
||||
}
|
||||
#search_btn{
|
||||
width:50px;
|
||||
height:46px;
|
||||
height:40px;
|
||||
line-height:45px;
|
||||
text-align:center;
|
||||
background-color:#0091FF;
|
||||
border-left:0;
|
||||
border:0;
|
||||
border:1px solid #0091FF;
|
||||
cursor:pointer;
|
||||
outline:none;
|
||||
font-size:15px;
|
||||
|
||||
+2
-2
@@ -7,12 +7,12 @@
|
||||
<link rel="stylesheet" type="text/css" href="../css/main.css">
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<header ng-controller="SearchController">
|
||||
<div>
|
||||
<input id="search_input" type="text" placeholder="请输入关键字"/>
|
||||
</div>
|
||||
<div>
|
||||
<div id="search_btn">搜索</div>
|
||||
<input id="search_btn" ng-click="search()" value="搜索"/>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
|
||||
+41
-1
@@ -2,6 +2,7 @@ var app = angular.module('app', ['ngRoute']);
|
||||
|
||||
|
||||
app.config(['$routeProvider', function ($routeProvider) {
|
||||
// $locationProvider.html5Mode(true);
|
||||
$routeProvider
|
||||
.when('/list/book', {
|
||||
templateUrl: 'view/book_list.html',
|
||||
@@ -39,7 +40,7 @@ app.controller('BookListController', function($http, $scope){
|
||||
list.push(item);
|
||||
}
|
||||
$scope.list = list;
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
app.controller('BookDetailController', function($http, $scope, $location){
|
||||
@@ -49,3 +50,42 @@ app.controller('BookDetailController', function($http, $scope, $location){
|
||||
$scope.data = data;
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
app.controller('SearchController', function($http, $scope, $location){
|
||||
var path = $location.path();
|
||||
$scope.search = function(){
|
||||
var value = document.getElementById('search_input').value;
|
||||
console.log(value);
|
||||
console.log(path);
|
||||
//图书搜索
|
||||
if(path.indexOf('/list/book') !== -1 || path === '/'){
|
||||
console.log(window.CONFIG_SERVER.book_search + '?callback=searchBookList&count=10&q=' + value);
|
||||
$http.jsonp(window.CONFIG_SERVER.book_search + '?callback=searchBookList&count=10&q=' + value);
|
||||
window.searchBookList = function(data){
|
||||
if(data.books){
|
||||
document.getElementById('loading').style.visibility = 'hidden';
|
||||
}
|
||||
var list = [];
|
||||
for(var i = 0; i < data.books.length; i++){
|
||||
var book = data.books[i];
|
||||
var item = {
|
||||
id: book.id,
|
||||
image: book.image,
|
||||
origin_title: book.title || '书名未共享',
|
||||
author: book.author[0] || '作者未知',
|
||||
publisher: book.publisher || '出版社未知',
|
||||
price: book.price.split('.')[0] || '未知',
|
||||
pages: book.pages
|
||||
};
|
||||
list.push(item);
|
||||
}
|
||||
$scope.list = list;
|
||||
};
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user