Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
A
ai-astro-app
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-app
Commits
2ffee13a
Commit
2ffee13a
authored
Jun 17, 2025
by
liubinyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
接口
parent
a7caed47
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
117 additions
and
38 deletions
+117
-38
App.vue
App.vue
+11
-15
index.js
api/index.js
+17
-2
interceptor.js
api/interceptor.js
+2
-2
main.js
main.js
+7
-1
chat.vue
pages/chat/chat.vue
+25
-2
home.vue
pages/home/home.vue
+35
-5
index.vue
pages/index/index.vue
+12
-5
user.vue
pages/user/user.vue
+2
-2
AaMeiGuiZhuangYuanTi-2.ttf
static/font/AaMeiGuiZhuangYuanTi-2.ttf
+0
-0
FengYaShiSong-2.otf
static/font/FengYaShiSong-2.otf
+0
-0
LiuShengChangPianJi-2.ttf
static/font/LiuShengChangPianJi-2.ttf
+0
-0
index.js
store/index.js
+4
-1
const.js
utils/const.js
+2
-3
No files found.
App.vue
View file @
2ffee13a
<
script
>
import
store
from
'@/store'
export
default
{
onLaunch
:
function
()
{
console
.
log
(
'App Launch'
)
uni
.
hideTabBar
();
uni
.
getSystemInfo
({
success
(
res
)
{
store
.
commit
(
'xStore'
,
{
name
:
'x_sys'
,
value
:
res
})
}
})
uni
.
getLocation
({
success
(
res
)
{
store
.
commit
(
'xStore'
,
{
name
:
'x_location'
,
value
:
res
})
}
})
},
onShow
:
function
()
{
console
.
log
(
'App Show'
)
...
...
@@ -35,23 +46,8 @@
background-image
:
url(@/static/bg2.png)
;
}
@font-face
{
font-family
:
'FengYaShiSong'
;
src
:
url(@/static/font/FengYaShiSong-2.otf)
;
}
@font-face
{
font-family
:
'MeiGuiZhuangYuanTi'
;
src
:
url(@/static/font/AaMeiGuiZhuangYuanTi-2.ttf)
;
}
@font-face
{
font-family
:
'NotoSerif'
;
src
:
url(@/static/font/NotoSerif.ttf)
;
}
@font-face
{
font-family
:
'LiuShengChangPianJi'
;
src
:
url(@/static/font/LiuShengChangPianJi-2.ttf)
;
}
</
style
>
\ No newline at end of file
api/index.js
View file @
2ffee13a
...
...
@@ -2,12 +2,27 @@ import http from './interceptor.js'
// 游客选择星座字体查看今日所属星座运势
export
function
findConstellation
(
data
)
{
return
http
.
request
({
url
:
'/system/chatCompletionsExample/findConstellation'
,
method
:
'
get
'
,
data
})
return
http
.
request
({
url
:
'/system/chatCompletionsExample/findConstellation'
,
method
:
'
GET
'
,
data
})
}
// 专属运程(免费)
export
function
exclusiveItineraryFree
(
data
)
{
return
http
.
request
({
url
:
'/system/chatCompletionsExample/exclusiveItineraryFree'
,
method
:
'get'
,
data
})
return
http
.
request
({
url
:
'/system/chatCompletionsExample/exclusiveItineraryFree'
,
method
:
'GET'
,
data
})
}
// 解析用户输入的生日返回根据生日的星座信息(更详细)
export
function
analyzingBirthdays
(
data
)
{
return
http
.
request
({
url
:
'/system/chatCompletionsExample/analyzingBirthdays'
,
method
:
'GET'
,
data
})
}
// 获取用户信息
export
function
getUserName
(
data
)
{
return
http
.
request
({
url
:
`/system/user/getUserName
${
tr
(
data
)}
`
,
method
:
'GET'
})
}
// 自动注册用户
export
function
autoRegister
(
data
)
{
return
http
.
request
({
url
:
`/system/user/autoRegister`
,
method
:
'POST'
,
data
})
}
/**
...
...
api/interceptor.js
View file @
2ffee13a
...
...
@@ -10,12 +10,12 @@ http.interceptor.request = (config) => {
const
token
=
uni
.
getStorageSync
(
'token'
);
config
.
header
.
Authorization
=
token
;
}
//
console.log('请求:', config);
console
.
log
(
'请求:'
,
config
);
return
config
;
}
http
.
interceptor
.
response
=
(
res
)
=>
{
//
console.log('响应:', res);
console
.
log
(
'响应:'
,
res
);
if
(
res
.
code
===
200
)
return
res
else
{
uni
.
showToast
({
...
...
main.js
View file @
2ffee13a
...
...
@@ -3,13 +3,19 @@ import App from './App'
// #ifndef VUE3
import
Vue
from
'vue'
import
'./uni.promisify.adaptor'
Vue
.
config
.
productionTip
=
false
import
store
from
'@/store'
;
Vue
.
prototype
.
$store
=
store
import
i18n
from
'./i18n'
Vue
.
config
.
productionTip
=
false
import
$g
from
'@/utils/const'
Vue
.
prototype
.
$g
=
$g
import
*
as
$api
from
'@/api'
Vue
.
prototype
.
$api
=
$api
App
.
mpType
=
'app'
let
vuexStore
=
require
(
'@/store/mixin.js'
);
Vue
.
mixin
(
vuexStore
);
...
...
pages/chat/chat.vue
View file @
2ffee13a
...
...
@@ -67,16 +67,39 @@
if
(
!
res
?.
data
)
return
this
.
addMsg
(
res
.
data
)
},
// 解析生日消息
async
getAnalyz
(
message
)
{
const
res
=
await
this
.
$api
.
analyzingBirthdays
({
language
:
this
.
$g
.
languageMap
[
this
.
$i18n
.
locale
],
message
,
userName
:
this
.
x_sys
.
deviceId
,
})
// 如果解析成功,则重新获取生日信息
if
(
res
?.
data
)
{
const
res
=
await
this
.
$api
.
getUserName
({
userName
:
this
.
x_sys
.
deviceId
})
if
(
res
?.
data
)
{
this
.
vuex
(
'x_user'
,
res
.
data
)
const
xz
=
this
.
$g
.
ConstellationList
.
find
(
i
=>
i
.
constellation
===
res
.
data
.
constellation
)
xz
&&
this
.
vuex
(
'x_xz'
,
xz
)
}
}
const
msg
=
res
?.
data
?.[
0
]?.
message
?.
content
||
'解析失败,请输入正确的提问格式'
this
.
addMsg
(
msg
)
},
// 是否显示头像,每个用户连续的记录,只显示第一个的头像
showAvatar
(
item
,
index
)
{
if
(
index
===
0
)
return
true
else
return
!!
item
.
user
!==
!!
this
.
recordList
[
index
-
1
].
user
},
confirm
()
{
async
confirm
()
{
const
txt
=
this
.
inputText
.
trim
()
if
(
!
txt
)
return
uni
.
showToast
({
title
:
'不能发送空白消息'
,
icon
:
'none'
})
this
.
addMsg
(
txt
,
true
)
this
.
inputText
=
''
this
.
addMsg
(
txt
,
true
)
// 延迟是为了先显示上一条消息
setTimeout
(()
=>
{
this
.
getAnalyz
(
txt
)
},
100
)
},
// 新增记录
addMsg
(
content
,
user
)
{
...
...
pages/home/home.vue
View file @
2ffee13a
...
...
@@ -3,6 +3,7 @@
<view
class=
"card"
:class=
"
{ back: isBack }"
:style="{ transitionDuration: `${duration}s`, transform: `scaleX(${scale})` }" @click="start">
<template
v-if=
"!isBack && info"
>
<view
class=
"zsyc"
>
{{
$t
(
'Exclusive Horoscope'
)
}}
</view>
<view
class=
"title"
>
{{
info
.
constellation
}}
</view>
<view
class=
"date"
>
{{
info
.
date
}}
</view>
<view
class=
"star-list"
>
...
...
@@ -30,7 +31,7 @@
<view
v-if=
"isZS"
class=
"btn"
hover-class=
"btn-hover"
@
click=
"start"
>
{{ $t('Start') }}{{ $t('Exclusive Horoscope') }}
</view>
<view
v-else
class=
"btn"
hover-class=
"btn-hover"
@
click=
"
star
t"
>
<view
v-else
class=
"btn"
hover-class=
"btn-hover"
@
click=
"
goCha
t"
>
{{ $t('Exclusive Horoscope') }}{{ $t('(') }}{{ $t('Free') }}{{ $t(')') }}
</view>
</view>
...
...
@@ -51,9 +52,21 @@
info
:
undefined
,
// 星座信息
};
},
onLoad
()
{
// 如果没选择星座,则跳转星座选择页面
if
(
!
this
.
x_xz
)
{
watch
:
{
// 用户信息更新后翻面
x_user
(
val
)
{
this
.
isBack
=
true
this
.
info
=
undefined
this
.
isZS
=
val
?.
birthday
}
},
async
onLoad
()
{
const
res
=
await
this
.
$api
.
getUserName
({
userName
:
this
.
x_sys
.
deviceId
})
if
(
res
?.
data
)
{
this
.
vuex
(
'x_user'
,
res
.
data
)
const
xz
=
this
.
$g
.
ConstellationList
.
find
(
i
=>
i
.
constellation
===
res
.
data
.
constellation
)
xz
&&
this
.
vuex
(
'x_xz'
,
xz
)
}
else
{
uni
.
reLaunch
({
url
:
'/pages/index/index'
})
...
...
@@ -78,6 +91,10 @@
})
this
.
info
=
res
?.
data
},
// 跳转问答页面
goChat
()
{
uni
.
switchTab
({
url
:
'/pages/chat/chat'
});
},
},
}
</
script
>
...
...
@@ -92,9 +109,22 @@
background-image
:
url(@/static/card-front.png)
;
background-size
:
100%
100%
;
margin
:
0
auto
;
padding
:
1
6
0rpx
60rpx
0
;
padding
:
1
5
0rpx
60rpx
0
;
transition-property
:
transform
;
.zsyc
{
width
:
180rpx
;
height
:
40rpx
;
margin
:
0
auto
;
background-color
:
#F6CF39
;
border-radius
:
50rpx
;
font-size
:
26rpx
;
color
:
#FCFCFC
;
line-height
:
40rpx
;
text-align
:
center
;
margin-bottom
:
30rpx
;
}
.title
{
font-size
:
68rpx
;
text-align
:
center
;
...
...
pages/index/index.vue
View file @
2ffee13a
...
...
@@ -30,11 +30,18 @@
changeXZ
(
xz
)
{
this
.
xz
=
xz
},
go
()
{
this
.
vuex
(
'x_xz'
,
this
.
xz
)
async
go
()
{
const
res
=
await
this
.
$api
.
autoRegister
({
constellation
:
this
.
xz
.
constellation
,
userName
:
this
.
x_sys
.
deviceId
,
latitude
:
this
.
x_location
.
latitude
,
longitude
:
this
.
x_location
.
longitude
,
})
if
(
res
?.
data
)
{
uni
.
reLaunch
({
url
:
'/pages/home/home'
})
}
},
}
}
...
...
pages/user/user.vue
View file @
2ffee13a
...
...
@@ -7,10 +7,10 @@
<view
class=
"txt"
>
{{
$t
(
lang
)
}}
</view>
</picker>
</view>
<view
class=
"item"
>
<
!--
<
view
class=
"item"
>
<view
class=
"txt"
>
{{
$t
(
'Constellation Selection'
)
}}
</view>
<image
class=
"icon"
src=
"@/static/icon-right.svg"
@
click=
"go('/pages/index/index')"
></image>
</view>
</view>
-->
</view>
<tabbar
/>
</view>
...
...
static/font/AaMeiGuiZhuangYuanTi-2.ttf
deleted
100644 → 0
View file @
a7caed47
File deleted
static/font/FengYaShiSong-2.otf
deleted
100644 → 0
View file @
a7caed47
File deleted
static/font/LiuShengChangPianJi-2.ttf
deleted
100644 → 0
View file @
a7caed47
File deleted
store/index.js
View file @
2ffee13a
...
...
@@ -9,7 +9,7 @@ try {
console
.
log
(
'本地储存:'
,
lifeData
)
}
catch
(
e
)
{}
let
saveStateKeys
=
[
'x_xz'
];
let
saveStateKeys
=
[
'x_xz'
,
'x_sys'
,
'x_location'
];
const
saveLifeData
=
function
(
key
,
value
)
{
if
(
saveStateKeys
.
indexOf
(
key
)
!=
-
1
)
{
...
...
@@ -23,6 +23,9 @@ const saveLifeData = function(key, value) {
const
store
=
new
Vuex
.
Store
({
state
:
{
x_xz
:
lifeData
.
x_xz
,
// 用户选择的星座
x_sys
:
lifeData
.
x_sys
,
// 设备信息
x_location
:
lifeData
.
x_location
,
// 位置信息
x_user
:
null
,
// 用户信息
},
mutations
:
{
xStore
(
state
,
payload
)
{
...
...
utils/const.js
View file @
2ffee13a
// 全局常量
export
default
{
// baseUrl: '/api', // 正式环境
// baseUrl: 'http://47.243.113.209:8081', // 正式环境
baseUrl
:
'http://192.168.200.12:8081'
,
// 鸿波
baseUrl
:
'http://47.243.113.209:8081'
,
// 正式环境
// baseUrl: 'http://192.168.200.12:8081', // 鸿波
// 星座列表
ConstellationList
:
[
{
key
:
'Aries'
,
date
:
[
'3.21'
,
'4.19'
],
zodiacSignId
:
'1'
,
angle
:
330
,
constellation
:
'白羊'
},
...
...
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