-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathindex.html
187 lines (181 loc) · 5.8 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no" name="viewport">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no, email=no" />
<meta name="screen-orientation" content="portrait">
<meta name="full-screen" content="yes">
<meta name="x5-orientation" content="portrait">
<meta name="x5-fullscreen" content="true">
<meta name="msapplication-tap-highlight" content="no">
<meta name="description" content="" />
<meta name="keywords" content="" />
<meta content="dahuotu" name="author" />
<title>搜小说</title>
<link rel="shortcut icon" href="favicon.ico">
<link rel="Stylesheet" href="css/reset.css" />
<link rel="stylesheet" href="css/app.css" />
<link rel="stylesheet" href="css/pintuer.layer.m.css" />
<script type="text/javascript" src="js/flexible.js"></script>
<style type="text/css">
</style>
</head>
<body>
<header>
搜小说
</header>
<div style="height: 1.1rem;"></div>
<div class="form" id="appform" v-cloak="">
<div class="password"><input id="search" type="search" class="input" placeholder="小说名" v-model="searchVal" /></div>
<br>
<button class="btn" style="background: #f60;" @click="postSearch">搜小说</button>
<div id="booList" class="search">
<div :class="tips_book">为您搜索到的跟<span>{{searchVal}}</span>相关的小说。</div>
<ul class="list">
<template v-for="(item,index) in booList">
<li :key="index" :id="index" :class="{checked:index==isActive_book}" @click="postSearchList(index,item.href,item.title)">
{{item.title}}
</li>
</template>
</ul>
</div>
<div id="catalogList" class="catalog">
<div :class="tips_catalog">为您搜索到<span>{{searchVal}}</span>的最新章节。</div>
<ul class="list">
<template v-for="(item,index) in catalogList">
<li :key="index" :id="index" :class="{checked:index==isActive_catalog}" @click="postSearchPage(index,item.href)">
{{item.title}}
</li>
</template>
</ul>
</div>
<div id="htmlContent" :class="cs_content" v-html="content" :style="bgStyle">
</div>
</div>
<footer>
<div class="nav-flex">
<div class="li" onclick="location.href='index.html'">
<div class="img img-chk">搜</div>
<div class="tips">搜小说</div>
</div>
<div class="li" onclick="location.href='list.html'">
<div class="img">架</div>
<div class="tips">书架</div>
</div>
<div class="li" onclick="location.href='setting.html'">
<div class="img">设</div>
<div class="tips">设置</div>
</div>
</div>
</footer>
</body>
<script type="text/javascript" src="js/vue.js"></script>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/layer.m/layer.min.js"></script>
<script src="https://cdn.bootcss.com/vue-resource/1.5.1/vue-resource.min.js"></script>
<script>
$(function() {
app.loadStyle();
//localStorage.removeItem('bookJson');
});
var app = new Vue({
el: '#appform',
data: {
bgStyle: "",
isActive_book: -1,
isActive_catalog: -1,
tips_book: "tips hide",
tips_catalog: "tips hide",
baseUrl: "//dahuotu.bdery.com/api/",
searchVal: "",
booList: "",
catalogList: "",
content: "",
cs_content: "content hide",
},
methods: {
loadStyle: function() {
app.bgStyle = localStorage.getItem("configStyle");
},
postSearch: function() {
//搜索小说
if(app.searchVal.length > 0) {
layer.open({
type: 2,
content: '搜索中...'
});
this.$http.get(app.baseUrl + "api.aspx?act=xiaoshuo&val=" + app.searchVal).then(function(res) {
//console.log(res.body.data);
app.booList = res.body.data;
app.tips_book = "tips show";
$("html,body").animate({
scrollTop: $("#booList").offset().top - 50
}, 500);
layer.closeAll();
}, function() {
//console.log('请求失败处理');
});
} else {
layer.open({
content: '请输入小说名',
skin: 'msg',
time: 2
});
}
},
postSearchList: function(index, href, title) {
//搜索目录
this.isActive_book = index;
var bookJson = {
title: title,
href: href
}
if(localStorage.getItem('bookJson') != null) {
var oldJson = JSON.parse(localStorage.getItem('bookJson'));
var newJson = oldJson.concat(bookJson);
localStorage.setItem('bookJson',JSON.stringify(newJson));
}else{
localStorage.setItem('bookJson',JSON.stringify(bookJson));
}
layer.open({
type: 2,
content: '搜索最新章节中...'
});
this.$http.get(app.baseUrl + "api.aspx?act=xiaoshuo_list&val=" + href).then(function(res) {
//console.log(res.body.data);
app.catalogList = res.body.data;
app.tips_catalog = "tips show";
$("html,body").animate({
scrollTop: $("#catalogList").offset().top - 50
}, 500);
layer.closeAll();
}, function() {
//console.log('请求失败处理');
});
},
postSearchPage: function(index, href) {
//搜索正文
this.isActive_catalog = index;
layer.open({
type: 2,
content: '正在获取小说正文...'
});
this.$http.get(app.baseUrl + "api.aspx?act=xiaoshuo_page&val=" + href).then(function(res) {
//console.log(res.body);
app.content = res.body;
app.cs_content = "content show";
$("html,body").animate({
scrollTop: $("#htmlContent").offset().top - 50
}, 500);
layer.closeAll();
}, function() {
//console.log('请求失败处理');
});
}
}
});
</script>
</html>