mirror of
https://github.com/ArvinLovegood/go-stock.git
synced 2025-07-19 00:00:09 +08:00
refactor(frontend):优化基金组件布局和样式
- 调整净值信息展示布局,使用 Flex 布局优化排版 - 替换标签组件为文本组件,提升用户体验 - 调整标签样式,增加间距和对齐方式 - 优化关注和取消关注按钮样式
This commit is contained in:
parent
c64f865216
commit
e260e3fc71
@ -158,7 +158,7 @@ func (o OpenAi) NewChatStream(stock, stockCode, userQuestion string) <-chan map[
|
|||||||
}
|
}
|
||||||
K := NewTushareApi(getConfig()).GetDaily(code, startDate, endDate, o.CrawlTimeOut)
|
K := NewTushareApi(getConfig()).GetDaily(code, startDate, endDate, o.CrawlTimeOut)
|
||||||
msg = append(msg, map[string]interface{}{
|
msg = append(msg, map[string]interface{}{
|
||||||
"role": "assistant",
|
"role": "user",
|
||||||
"content": stock + "日K数据如下:\n" + K,
|
"content": stock + "日K数据如下:\n" + K,
|
||||||
})
|
})
|
||||||
}()
|
}()
|
||||||
@ -182,7 +182,7 @@ func (o OpenAi) NewChatStream(stock, stockCode, userQuestion string) <-chan map[
|
|||||||
price += message + ";"
|
price += message + ";"
|
||||||
}
|
}
|
||||||
msg = append(msg, map[string]interface{}{
|
msg = append(msg, map[string]interface{}{
|
||||||
"role": "assistant",
|
"role": "user",
|
||||||
"content": stock + time.Now().Format(time.DateOnly) + "价格:" + price,
|
"content": stock + time.Now().Format(time.DateOnly) + "价格:" + price,
|
||||||
})
|
})
|
||||||
}()
|
}()
|
||||||
@ -208,7 +208,7 @@ func (o OpenAi) NewChatStream(stock, stockCode, userQuestion string) <-chan map[
|
|||||||
}
|
}
|
||||||
for _, message := range *messages {
|
for _, message := range *messages {
|
||||||
msg = append(msg, map[string]interface{}{
|
msg = append(msg, map[string]interface{}{
|
||||||
"role": "assistant",
|
"role": "user",
|
||||||
"content": stock + message,
|
"content": stock + message,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -225,7 +225,7 @@ func (o OpenAi) NewChatStream(stock, stockCode, userQuestion string) <-chan map[
|
|||||||
}
|
}
|
||||||
for _, message := range *messages {
|
for _, message := range *messages {
|
||||||
msg = append(msg, map[string]interface{}{
|
msg = append(msg, map[string]interface{}{
|
||||||
"role": "assistant",
|
"role": "user",
|
||||||
"content": message,
|
"content": message,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -238,7 +238,7 @@ func (o OpenAi) NewChatStream(stock, stockCode, userQuestion string) <-chan map[
|
|||||||
}
|
}
|
||||||
for _, message := range *messages {
|
for _, message := range *messages {
|
||||||
msg = append(msg, map[string]interface{}{
|
msg = append(msg, map[string]interface{}{
|
||||||
"role": "assistant",
|
"role": "user",
|
||||||
"content": message,
|
"content": message,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -255,7 +255,7 @@ func (o OpenAi) NewChatStream(stock, stockCode, userQuestion string) <-chan map[
|
|||||||
// }
|
// }
|
||||||
// for _, message := range *messages {
|
// for _, message := range *messages {
|
||||||
// msg = append(msg, map[string]interface{}{
|
// msg = append(msg, map[string]interface{}{
|
||||||
// "role": "assistant",
|
// "role": "user",
|
||||||
// "content": message,
|
// "content": message,
|
||||||
// })
|
// })
|
||||||
// }
|
// }
|
||||||
@ -271,7 +271,7 @@ func (o OpenAi) NewChatStream(stock, stockCode, userQuestion string) <-chan map[
|
|||||||
}
|
}
|
||||||
for _, message := range *messages {
|
for _, message := range *messages {
|
||||||
msg = append(msg, map[string]interface{}{
|
msg = append(msg, map[string]interface{}{
|
||||||
"role": "assistant",
|
"role": "user",
|
||||||
"content": message,
|
"content": message,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -293,7 +293,7 @@ func (o OpenAi) NewChatStream(stock, stockCode, userQuestion string) <-chan map[
|
|||||||
}
|
}
|
||||||
for _, message := range *messages {
|
for _, message := range *messages {
|
||||||
msg = append(msg, map[string]interface{}{
|
msg = append(msg, map[string]interface{}{
|
||||||
"role": "assistant",
|
"role": "user",
|
||||||
"content": message,
|
"content": message,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -341,8 +341,8 @@ func (o OpenAi) NewChatStream(stock, stockCode, userQuestion string) <-chan map[
|
|||||||
for scanner.Scan() {
|
for scanner.Scan() {
|
||||||
line := scanner.Text()
|
line := scanner.Text()
|
||||||
logger.SugaredLogger.Infof("Received data: %s", line)
|
logger.SugaredLogger.Infof("Received data: %s", line)
|
||||||
if strings.HasPrefix(line, "data: ") {
|
if strings.HasPrefix(line, "data:") {
|
||||||
data := strings.TrimPrefix(line, "data: ")
|
data := strutil.Trim(strings.TrimPrefix(line, "data:"))
|
||||||
if data == "[DONE]" {
|
if data == "[DONE]" {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ const danmus = ref([])
|
|||||||
const ws = ref(null)
|
const ws = ref(null)
|
||||||
const icon = ref(null)
|
const icon = ref(null)
|
||||||
const message = useMessage()
|
const message = useMessage()
|
||||||
|
const modalShow = ref(false)
|
||||||
const data = reactive({
|
const data = reactive({
|
||||||
modelName:"",
|
modelName:"",
|
||||||
chatId: "",
|
chatId: "",
|
||||||
@ -142,6 +142,20 @@ function formatterTitle(title){
|
|||||||
},{default: () => title,}
|
},{default: () => title,}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function search(code,name){
|
||||||
|
setTimeout(() => {
|
||||||
|
window.open("https://fund.eastmoney.com/"+code+".html","_blank","noreferrer,width=1000,top=100,left=100,status=no,toolbar=no,location=no,scrollbars=no")
|
||||||
|
//window.open("https://finance.sina.com.cn/fund/quotes/"+code+"/bc.shtml","_blank","width=1000,height=800,top=100,left=100,toolbar=no,location=no")
|
||||||
|
}, 500)
|
||||||
|
}
|
||||||
|
|
||||||
|
function newchart(code,name){
|
||||||
|
modalShow.value=true
|
||||||
|
data.name=name
|
||||||
|
data.code=code
|
||||||
|
data.fenshiURL='https://image.sinajs.cn/newchart/v5/fund/nav/ss/'+code+'.gif'+"?t="+Date.now()
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -154,15 +168,16 @@ function formatterTitle(title){
|
|||||||
<n-tag size="small" :bordered="false" type="info">{{info.code}}</n-tag>
|
<n-tag size="small" :bordered="false" type="info">{{info.code}}</n-tag>
|
||||||
<n-tag size="small" :bordered="false" type="success" @click="unFollow(info.code)"> 取消关注</n-tag>
|
<n-tag size="small" :bordered="false" type="success" @click="unFollow(info.code)"> 取消关注</n-tag>
|
||||||
</template>
|
</template>
|
||||||
<n-tag size="small" :type="info.netEstimatedRate>0?'error':'success'" :bordered="false" v-if="info.netEstimatedUnit">
|
<n-flex>
|
||||||
|
<n-text size="small" :type="info.netEstimatedRate>0?'error':'success'" :bordered="false" v-if="info.netEstimatedUnit">
|
||||||
估算净值:{{info.netEstimatedUnit}}
|
估算净值:{{info.netEstimatedUnit}}
|
||||||
{{info.netEstimatedRate}} %
|
{{info.netEstimatedRate}} %
|
||||||
({{info.netEstimatedUnitTime}})</n-tag>
|
({{info.netEstimatedUnitTime}})</n-text>
|
||||||
<n-divider vertical></n-divider>
|
<br>
|
||||||
<n-tag size="small" :type="info.netEstimatedRate>0?'error':'success'" :bordered="false" v-if="info.netUnitValue">
|
<n-text size="small" :type="info.netEstimatedRate>0?'error':'success'" :bordered="false" v-if="info.netUnitValue">
|
||||||
单位净值:{{info.netUnitValue}} ({{info.netUnitValueDate}})</n-tag>
|
单位净值:{{info.netUnitValue}} ({{info.netUnitValueDate}})</n-text>
|
||||||
<n-divider v-if="info.netUnitValue"></n-divider>
|
</n-flex>
|
||||||
<n-flex justify="start">
|
<n-flex justify="start" style="margin-top: 10px">
|
||||||
<n-tag size="small" :type="info.fundBasic.netGrowth1>0?'error':'success'" :bordered="false" v-if="info.fundBasic.netGrowth1">近一月:{{info.fundBasic.netGrowth1}}%</n-tag>
|
<n-tag size="small" :type="info.fundBasic.netGrowth1>0?'error':'success'" :bordered="false" v-if="info.fundBasic.netGrowth1">近一月:{{info.fundBasic.netGrowth1}}%</n-tag>
|
||||||
<n-tag size="small" :type="info.fundBasic.netGrowth3>0?'error':'success'" :bordered="false" v-if="info.fundBasic.netGrowth3">近三月:{{info.fundBasic.netGrowth3}}%</n-tag>
|
<n-tag size="small" :type="info.fundBasic.netGrowth3>0?'error':'success'" :bordered="false" v-if="info.fundBasic.netGrowth3">近三月:{{info.fundBasic.netGrowth3}}%</n-tag>
|
||||||
<n-tag size="small" :type="info.fundBasic.netGrowth6>0?'error':'success'" :bordered="false" v-if="info.fundBasic.netGrowth6">近六月:{{info.fundBasic.netGrowth6}}%</n-tag>
|
<n-tag size="small" :type="info.fundBasic.netGrowth6>0?'error':'success'" :bordered="false" v-if="info.fundBasic.netGrowth6">近六月:{{info.fundBasic.netGrowth6}}%</n-tag>
|
||||||
@ -173,20 +188,26 @@ function formatterTitle(title){
|
|||||||
<n-tag size="small" :type="info.fundBasic.netGrowthAll>0?'error':'success'" :bordered="false" >成立来:{{info.fundBasic.netGrowthAll}}%</n-tag>
|
<n-tag size="small" :type="info.fundBasic.netGrowthAll>0?'error':'success'" :bordered="false" >成立来:{{info.fundBasic.netGrowthAll}}%</n-tag>
|
||||||
</n-flex>
|
</n-flex>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<n-flex justify="start">
|
<n-flex justify="space-between">
|
||||||
<n-tag size="small" :bordered="false" type="warning"> {{info.fundBasic.type}}</n-tag>
|
<n-tag size="small" :bordered="false" type="warning"> {{info.fundBasic.type}}</n-tag>
|
||||||
<n-tag size="small" :bordered="false" type="info"> {{info.fundBasic.company}}:{{info.fundBasic.manager}}</n-tag>
|
<n-tag size="small" :bordered="false" type="info"> {{info.fundBasic.company}}:{{info.fundBasic.manager}}</n-tag>
|
||||||
</n-flex>
|
</n-flex>
|
||||||
</template>
|
</template>
|
||||||
<!-- <template #action>
|
<template #action>
|
||||||
<n-flex justify="end">
|
<n-flex justify="end">
|
||||||
<n-button size="tiny" type="warning" @click="unFollow(info.code)">取消关注</n-button>
|
<n-button size="tiny" type="error" @click="newchart(info.code,info.name)"> 走势 </n-button>
|
||||||
|
<n-button size="tiny" type="warning" @click="search(info.code,info.name)"> 详情 </n-button>
|
||||||
</n-flex>
|
</n-flex>
|
||||||
</template>-->
|
</template>
|
||||||
</n-card>
|
</n-card>
|
||||||
</n-gi>
|
</n-gi>
|
||||||
</n-grid>
|
</n-grid>
|
||||||
</n-flex>
|
</n-flex>
|
||||||
|
|
||||||
|
<n-modal v-model:show="modalShow" :title="data.name" style="width: 400px" :preset="'card'">
|
||||||
|
<n-image :src="data.fenshiURL" />
|
||||||
|
</n-modal>
|
||||||
|
|
||||||
<div style="position: fixed;bottom: 18px;right:0;z-index: 10;width: 480px">
|
<div style="position: fixed;bottom: 18px;right:0;z-index: 10;width: 480px">
|
||||||
<n-input-group >
|
<n-input-group >
|
||||||
<n-auto-complete v-model:value="data.name"
|
<n-auto-complete v-model:value="data.name"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user