Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
梁建民
/
activity
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
836b7e0e
authored
May 27, 2026
by
liangjianmin
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
feat(weather): 添加天气图标并更新天气数据获取方式
- 在页面中添加天气图标元素 - 更新天气数据接口为 wttr.in - 显示当前温度和天气图标
parent
0087062a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
3 deletions
index.html
js/index/index.js
index.html
View file @
836b7e0e
...
...
@@ -31,6 +31,7 @@
<span>
北京时间
</span>
<span
class=
"color"
id=
"time"
>
00:00:00
</span>
<span
class=
"ml"
>
深圳
</span>
<img
id=
"weatherIcon"
src=
""
alt=
""
style=
"width:20px;height:20px;vertical-align:middle;margin-right:4px;display:none;"
/>
<span
class=
"color"
id=
"wendu"
></span>
</p>
<span
class=
"title"
></span>
...
...
js/index/index.js
View file @
836b7e0e
...
...
@@ -259,13 +259,15 @@
$
(
"#day"
).
text
((
day
<
10
)
?
(
'0'
+
day
)
:
day
);
$
(
"#week"
).
text
(
week
[
weekDay
]);
$
.
ajax
({
url
:
"http
://wthrcdn.etouch.cn/weather_mini?city=深圳
"
,
url
:
"http
s://wttr.in/深圳?format=j1
"
,
dataType
:
'json'
,
type
:
"get"
,
success
:
function
(
res
)
{
$
(
"#wendu"
).
text
(
res
.
data
.
wendu
+
"℃"
);
var
condition
=
res
.
current_condition
[
0
];
$
(
"#wendu"
).
text
(
condition
.
temp_C
+
"℃"
);
var
iconUrl
=
condition
.
weatherIconUrl
[
0
].
value
;
$
(
"#weatherIcon"
).
attr
(
"src"
,
iconUrl
).
css
(
"display"
,
"inline-block"
);
}
})
setInterval
(
function
()
{
var
myDate
=
new
Date
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment