Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
A
ai-astro
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liubinyu
ai-astro
Commits
5ea9dc39
Commit
5ea9dc39
authored
May 07, 2025
by
liubinyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
接口
parent
0f35f171
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
176 additions
and
50 deletions
+176
-50
index.html
index.html
+15
-11
config.js
public/config.js
+9
-0
index.js
src/api/index.js
+5
-0
GHeader.vue
src/components/GHeader.vue
+2
-2
cn.json
src/i18n/cn.json
+0
-0
index.js
src/i18n/index.js
+5
-5
const.js
src/utils/const.js
+15
-14
index.js
src/utils/index.js
+28
-0
request.js
src/utils/request.js
+59
-0
home.vue
src/views/home.vue
+28
-17
vite.config.js
vite.config.js
+10
-1
No files found.
index.html
View file @
5ea9dc39
<!doctype html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
/>
<link
rel=
"icon"
type=
"image/svg+xml"
href=
"/vite.svg"
/>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
/>
<title>
AI
</title>
</head>
<body>
<div
id=
"app"
></div>
<script
type=
"module"
src=
"/src/main.js"
></script>
</body>
</html>
<head>
<meta
charset=
"UTF-8"
/>
<link
rel=
"icon"
type=
"image/svg+xml"
href=
"/vite.svg"
/>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
/>
<title>
AI
</title>
<script
src=
"/config.js"
></script>
</head>
<body>
<div
id=
"app"
></div>
<script
type=
"module"
src=
"/src/main.js"
></script>
</body>
</html>
\ No newline at end of file
public/config.js
0 → 100644
View file @
5ea9dc39
window
.
APP_CONFIG
=
{
baseURL
:
`/api`
,
}
Object
.
freeze
(
window
.
APP_CONFIG
);
Object
.
defineProperty
(
window
,
'APP_CONFIG'
,
{
configurable
:
false
,
writable
:
false
,
});
\ No newline at end of file
src/api/index.js
0 → 100644
View file @
5ea9dc39
import
request
from
'@/utils/request.js'
export
function
list
(
params
)
{
return
request
({
url
:
'/system/astrologyForecastDaily/list'
,
method
:
'get'
,
params
})
}
src/components/GHeader.vue
View file @
5ea9dc39
...
...
@@ -48,8 +48,8 @@ navClick(navList.find(i => i.route === router.currentRoute.value.name))
<img
class=
"icon-lang"
src=
"/img/lang.png"
alt=
""
>
<template
#
dropdown
>
<el-dropdown-menu>
<el-dropdown-item
command=
"
e
n"
>
English
</el-dropdown-item>
<el-dropdown-item
command=
"
zh
"
>
简体中文
</el-dropdown-item>
<el-dropdown-item
command=
"
E
n"
>
English
</el-dropdown-item>
<el-dropdown-item
command=
"
Cn
"
>
简体中文
</el-dropdown-item>
</el-dropdown-menu>
</
template
>
</el-dropdown>
...
...
src/i18n/
zh
.json
→
src/i18n/
cn
.json
View file @
5ea9dc39
File moved
src/i18n/index.js
View file @
5ea9dc39
import
{
createI18n
}
from
'vue-i18n'
import
e
n
from
'./en.json'
import
zh
from
'./zh
.json'
import
E
n
from
'./en.json'
import
Cn
from
'./cn
.json'
const
locale
=
localStorage
.
getItem
(
'locale'
)
||
'
e
n'
const
locale
=
localStorage
.
getItem
(
'locale'
)
||
'
E
n'
const
i18n
=
createI18n
({
legacy
:
false
,
locale
,
messages
:
{
e
n
,
zh
E
n
,
Cn
}
})
...
...
src/utils/const.js
View file @
5ea9dc39
import
{
reactive
}
from
"vue"
export
default
{
ConstellationList
:
[
{
key
:
'Aries'
,
date
:
[
'3.21'
,
'4.19'
]
},
{
key
:
'Taurus'
,
date
:
[
'4.20'
,
'5.20'
]
},
{
key
:
'Gemini'
,
date
:
[
'5.21'
,
'6.21'
]
},
{
key
:
'Cancer'
,
date
:
[
'6.22'
,
'7.22'
]
},
{
key
:
'Leo'
,
date
:
[
'7.23'
,
'8.22'
]
},
{
key
:
'Virgo'
,
date
:
[
'8.23'
,
'9.22'
]
},
{
key
:
'HLibra'
,
date
:
[
'9.23'
,
'10.23'
]
},
{
key
:
'Scorpio'
,
date
:
[
'10.24'
,
'11.22'
]
},
{
key
:
'Sagittarius'
,
date
:
[
'11.23'
,
'12.21'
]
},
{
key
:
'Capricornus'
,
date
:
[
'12.22'
,
'1.19'
]
},
{
key
:
'Aquarius'
,
date
:
[
'1.20'
,
'2.18'
]
},
{
key
:
'Pisces'
,
date
:
[
'2.19'
,
'3.20'
]
},
]
ConstellationList
:
reactive
(
[
{
key
:
'Aries'
,
date
:
[
'3.21'
,
'4.19'
]
,
zodiacSignId
:
'1'
,
info
:
{}
},
{
key
:
'Taurus'
,
date
:
[
'4.20'
,
'5.20'
]
,
zodiacSignId
:
'2'
,
info
:
{}
},
{
key
:
'Gemini'
,
date
:
[
'5.21'
,
'6.21'
]
,
zodiacSignId
:
'3'
,
info
:
{}
},
{
key
:
'Cancer'
,
date
:
[
'6.22'
,
'7.22'
]
,
zodiacSignId
:
'4'
,
info
:
{}
},
{
key
:
'Leo'
,
date
:
[
'7.23'
,
'8.22'
]
,
zodiacSignId
:
'5'
,
info
:
{}
},
{
key
:
'Virgo'
,
date
:
[
'8.23'
,
'9.22'
]
,
zodiacSignId
:
'6'
,
info
:
{}
},
{
key
:
'HLibra'
,
date
:
[
'9.23'
,
'10.23'
]
,
zodiacSignId
:
'7'
,
info
:
{}
},
{
key
:
'Scorpio'
,
date
:
[
'10.24'
,
'11.22'
]
,
zodiacSignId
:
'8'
,
info
:
{}
},
{
key
:
'Sagittarius'
,
date
:
[
'11.23'
,
'12.21'
]
,
zodiacSignId
:
'9'
,
info
:
{}
},
{
key
:
'Capricornus'
,
date
:
[
'12.22'
,
'1.19'
]
,
zodiacSignId
:
'10'
,
info
:
{}
},
{
key
:
'Aquarius'
,
date
:
[
'1.20'
,
'2.18'
]
,
zodiacSignId
:
'11'
,
info
:
{}
},
{
key
:
'Pisces'
,
date
:
[
'2.19'
,
'3.20'
]
,
zodiacSignId
:
'12'
,
info
:
{}
},
]
)
}
\ No newline at end of file
src/utils/index.js
0 → 100644
View file @
5ea9dc39
export
function
globalConfig
(
key
)
{
return
window
.
APP_CONFIG
[
key
]
}
export
function
dateFormat
(
date
,
fmt
=
'YYYY-MM-DD'
)
{
if
(
!
date
||
!
fmt
)
return
date
;
date
instanceof
Date
||
(
date
=
new
Date
(
date
));
const
o
=
{
'Y+'
:
date
.
getFullYear
(),
'M+'
:
date
.
getMonth
()
+
1
,
'D+'
:
date
.
getDate
(),
'H+'
:
date
.
getHours
(),
'm+'
:
date
.
getMinutes
(),
's+'
:
date
.
getSeconds
(),
};
for
(
let
k
in
o
)
{
const
ret
=
new
RegExp
(
'('
+
k
+
')'
).
exec
(
fmt
)
if
(
ret
)
{
const
v
=
String
(
o
[
k
])
if
(
/
(
Y+
)
/
.
test
(
k
))
{
fmt
=
fmt
.
replace
(
ret
[
1
],
v
.
substring
(
4
-
ret
[
1
].
length
))
}
else
{
fmt
=
fmt
.
replace
(
ret
[
1
],
ret
[
1
].
length
===
1
?
v
:
v
.
padStart
(
ret
[
1
].
length
,
'0'
))
}
}
}
return
fmt
;
}
src/utils/request.js
0 → 100644
View file @
5ea9dc39
import
axios
from
'axios'
import
{
globalConfig
}
from
'./index'
import
{
ElMessage
}
from
'element-plus'
const
SUCCESS_CODE
=
200
const
service
=
axios
.
create
({
timeout
:
60
*
1000
,
})
function
requestInterceptor
(
config
)
{
config
.
url
=
globalConfig
(
'baseURL'
)
+
config
.
url
return
config
}
function
responseInterceptor
(
response
)
{
const
res
=
response
.
data
if
(
response
.
config
.
orginal
)
{
return
res
}
else
{
if
(
res
.
code
!==
SUCCESS_CODE
)
{
!
response
.
config
.
silence
&&
ElMessage
.
error
(
res
.
msg
||
res
.
message
||
'请求失败'
)
return
}
else
{
return
res
||
true
}
}
}
service
.
interceptors
.
request
.
use
((
config
)
=>
{
requestInterceptor
(
config
)
config
.
requestInterceptor
?.(
config
)
return
config
})
service
.
interceptors
.
response
.
use
(
response
=>
response
.
config
.
responseInterceptor
?.(
response
)
||
responseInterceptor
(
response
),
error
=>
{
switch
(
error
.
response
?.
status
)
{
case
500
:
ElMessage
.
error
(
'服务器异常'
)
break
case
404
:
ElMessage
.
error
(
'找不到资源'
)
break
case
401
:
ElMessage
.
error
(
'没有权限'
)
break
default
:
ElMessage
.
error
(
error
.
message
)
break
}
return
Promise
.
resolve
()
})
export
default
service
src/views/home.vue
View file @
5ea9dc39
...
...
@@ -3,11 +3,26 @@ import { inject, ref } from 'vue';
const
_const
=
inject
(
'_const'
)
import
{
useRouter
}
from
'vue-router'
const
router
=
useRouter
()
const
active
=
ref
(
_const
.
ConstellationList
[
0
])
import
*
as
api
from
'@/api'
import
{
dateFormat
}
from
'@/utils'
import
{
useI18n
}
from
'vue-i18n'
const
{
locale
}
=
useI18n
()
const
active
=
ref
()
async
function
getInfo
()
{
const
res
=
await
api
.
list
({
fortuneDate
:
dateFormat
(
Date
.
now
()),
pageSize
:
20
})
res
?.
rows
?.
forEach
(
i
=>
{
const
item
=
_const
.
ConstellationList
.
find
(
j
=>
j
.
zodiacSignId
===
i
.
zodiacSignId
)
if
(
item
)
{
item
.
info
=
i
}
})
}
getInfo
()
function
changeConstellation
(
item
)
{
active
.
value
=
item
}
changeConstellation
(
_const
.
ConstellationList
[
0
])
function
goDetail
()
{
router
.
push
({
name
:
'Forecast'
,
query
:
{
key
:
active
.
value
.
key
}
})
}
...
...
@@ -51,15 +66,8 @@ function goDetail() {
<img
:src=
"`/img/xz/$
{active.key}1.png`" alt="">
{{
$t
(
active
.
key
)
}}
(
{{
`${active.date[0]
}
~${active.date[1]
}
`
}}
)
<
/div
>
<
div
class
=
"desc"
>
Fluctuating
like
tides
,
flowing
downstream
!
<
/div
>
<
div
class
=
"info"
>
Today
's Pisces seem to be at the boundary between the deep sea and the starry sky, with exceptionally sharp
intuition and inspiration. Suitable for listening to inner voices and resolving problems with emotions, but
avoid excessive indulgence in fantasies. Emotions and creativity are the shining points of today, seize the
opportunity to express yourself!
</div>
<
div
class
=
"desc"
>
{{
active
.
info
[
`title${locale
}
`
]
}}
<
/div
>
<
div
class
=
"info"
>
{{
active
.
info
[
`fortune${locale
}
`
]
}}
<
/div
>
<
div
class
=
"more g-flex-center"
@
click
=
"goDetail"
>
{{
$t
(
'more'
)
}}
<
img
src
=
"/img/arrow.png"
alt
=
""
>
...
...
@@ -227,7 +235,8 @@ function goDetail() {
}
.
constellation
-
detail
.
content
{
padding: 4.375vw 3.4375vw;
flex
:
1
;
padding
:
4
vw
3.4375
vw
;
position
:
relative
;
}
...
...
@@ -246,7 +255,7 @@ function goDetail() {
}
.
constellation
-
detail
.
content
.
desc
{
margin-top: 3
.75
vw;
margin
-
top
:
3
vw
;
margin
-
bottom
:
2.083
vw
;
font
-
family
:
Roboto
-
Medium
;
font
-
weight
:
500
;
...
...
@@ -261,22 +270,23 @@ function goDetail() {
line
-
height
:
2.083
vw
;
text
-
align
:
left
;
height
:
10.415
vw
;
text-overflow: -o-ellipsis-lastline;
overflow
:
hidden
;
/* text-overflow: -o-ellipsis-lastline;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 5;
line-clamp: 5;
-webkit-box-orient: vertical;
-webkit-box-orient: vertical;
*/
}
.
constellation
-
detail
.
content
.
more
{
position
:
absolute
;
right
:
1.5625
vw
;
bottom: 1.
5625
vw;
bottom
:
1.
3
vw
;
font
-
family
:
Roboto
-
Regular
;
font
-
weight
:
400
;
font-size: 1.25vw;
font
-
size
:
1
vw
;
line
-
height
:
0
;
opacity
:
0.8
;
cursor
:
pointer
;
}
...
...
@@ -286,6 +296,7 @@ function goDetail() {
}
.
constellation
-
detail
.
content
.
more
img
{
height
:
1.5625
vw
;
margin
-
left
:
0.833
vw
;
}
...
...
vite.config.js
View file @
5ea9dc39
...
...
@@ -7,8 +7,17 @@ export default defineConfig({
plugins
:
[
vue
()],
resolve
:
{
alias
:
[
//配置别名
{
find
:
'@'
,
replacement
:
resolve
(
__dirname
,
'./src'
)
},
],
},
server
:
{
proxy
:
{
'/api'
:
{
target
:
'http://47.243.113.209:8081'
,
changeOrigin
:
true
,
ws
:
true
,
rewrite
:
(
path
)
=>
path
.
replace
(
'/api'
,
''
)
},
}
},
})
\ No newline at end of file
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