Skip to content

Commit b67ed79

Browse files
committed
修改了部分文档
1 parent d2c6ce9 commit b67ed79

File tree

6 files changed

+247
-36
lines changed

6 files changed

+247
-36
lines changed
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<title>垃圾分类查询助手</title>
6+
<style>
7+
.search, .result {
8+
width: 720px;
9+
margin: 50px auto;
10+
}
11+
.search > input {
12+
width: 520px;
13+
border: none;
14+
outline: none;
15+
text-align: center;
16+
font-size: 36px;
17+
line-height: 36px;
18+
border-bottom: 1px solid gray;
19+
margin: 0 20px;
20+
}
21+
.search button {
22+
background-color: red;
23+
color: white;
24+
font-size: 28px;
25+
border: none;
26+
outline: none;
27+
width: 120px;
28+
}
29+
.result > p, .result > div {
30+
width: 640px;
31+
margin: 0 auto;
32+
}
33+
.result > p, .result span {
34+
text-align: left;
35+
font-size: 28px;
36+
}
37+
.result img {
38+
vertical-align: middle;
39+
}
40+
.explain {
41+
font-size: 12px;
42+
color: darkgray;
43+
}
44+
.result .pre {
45+
font-size: 16px;
46+
}
47+
</style>
48+
</head>
49+
<body>
50+
<div id="app">
51+
<div class="search">
52+
<input type="text" placeholder="请输入垃圾名字" v-model.trim="word" @keydown.enter="search()">
53+
<button @click="search()">查询</button>
54+
</div>
55+
<div class="result">
56+
<p v-if="searched && !results">没有对应的查询结果</p>
57+
<div v-for="result in results">
58+
<p>
59+
<img :src="'images/' + pictures[result.type]" width="56" :alt="types[result.type]">
60+
&nbsp;&nbsp;
61+
<span>{{ result.name }}</span>
62+
&nbsp;&nbsp;
63+
<span class="pre" v-if="result.aipre == 1">(预测结果)</span>
64+
</p>
65+
<p class="explain">说明:{{ result.explain }}</p>
66+
</div>
67+
</div>
68+
</div>
69+
<script src="https://cdn.bootcss.com/vue/2.6.10/vue.min.js"></script>
70+
<script>
71+
new Vue({
72+
el: '#app',
73+
data: {
74+
word: '',
75+
searched: false,
76+
types: ['可回收物', '有害垃圾', '厨余垃圾', '其他垃圾'],
77+
pictures: ['recyclable.png', 'harmful-waste.png', 'kitchen-waste.png', 'other-waste.png'],
78+
results: []
79+
},
80+
methods: {
81+
search() {
82+
if (this.word.trim().length > 0) {
83+
let key = 'e8c5524dd2a365f20908ced735f8e480'
84+
let url = `http://api.tianapi.com/txapi/lajifenlei/?key=${key}&word=${this.word}`
85+
fetch(url)
86+
.then(resp => resp.json())
87+
.then(json => {
88+
this.searched = true
89+
this.results = json.newslist
90+
})
91+
}
92+
}
93+
}
94+
})
95+
</script>
96+
</body>
97+
</html>

Day41-55/46.日志和调试工具栏.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,4 +212,3 @@ queryset = Teacher.objects.values('subject__name').annotate(good=Avg('good_count
212212
```
213213

214214
可见,Django的ORM框架允许我们用面向对象的方式完成关系数据库中的分组和聚合查询。
215-

Day41-55/48.前后端分离开发入门.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,4 +175,3 @@ class SubjectMapper(ModelMapper):
175175
前后端分离的开发需要将前端页面作为静态资源进行部署,项目实际上线的时候,我们会对整个Web应用进行动静分离,静态资源通过Nginx或Apache服务器进行部署,生成动态内容的Python程序部署在uWSGI或者Gunicorn服务器上,对动态内容的请求由Nginx或Apache路由到uWSGI或Gunicorn服务器上。
176176

177177
在开发阶段,我们通常会使用Django自带的测试服务器,如果要尝试前后端分离,可以先将静态页面放在之前创建的放静态资源的目录下,具体的做法可以参考[项目完整代码](https://gitee.com/jackfrued/django19062)
178-

Day66-70/67.NumPy的应用.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -852,7 +852,7 @@ plt.imshow(guido_image[30:350, 90:300])
852852

853853
#### 统计方法
854854

855-
`ndarray`对象的统计方法主要包括:`sum``mean``std``var``min``max``argmin``argmax``cumsum`等,分别用于对数组中的元素求和、求平均、求标准差、求方差、找最大、找最小、求累积和等,请参考下面的代码。
855+
`ndarray`对象的统计方法主要包括:`sum()`、`mean()`、`std()`、`var()`、`min()`、`max()`、`argmin()`、`argmax()`、`cumsum()`等,分别用于对数组中的元素求和、求平均、求标准差、求方差、找最大、找最小、求累积和等,请参考下面的代码。
856856
857857
```Python
858858
array28 = np.array([1, 2, 3, 4, 5, 5, 4, 3, 2, 1])
@@ -920,7 +920,7 @@ print(array28.cumsum())
920920
921921
> **说明**:可以看出,二维数组的点积就是矩阵乘法运算。
922922
923-
4. `dump()`方法:保存数组到文件中,可以通过NumPy中的`load`函数从保存的文件中加载数据创建数组。
923+
4. `dump()`方法:保存数组到文件中,可以通过NumPy中的`load()`函数从保存的文件中加载数据创建数组。
924924
925925
代码:
926926

0 commit comments

Comments
 (0)