1. 首页应用图标同时支持 iconfont 和自定义上传图标

2. 所有模型外键字段都改成int(11) 而不是 bigint
This commit is contained in:
GeekMaster
2025-07-29 11:35:11 +08:00
parent c19b7db8c0
commit ff96fada02
19 changed files with 118 additions and 143 deletions

View File

@@ -126,7 +126,7 @@ func (s *Service) Create(task types.SunoTask) (RespVo, error) {
return RespVo{}, errors.New("no available API KEY for Suno")
}
reqBody := map[string]interface{}{
reqBody := map[string]any{
"task_id": task.RefTaskId,
"continue_clip_id": task.RefSongId,
"continue_at": task.ExtendSecs,
@@ -330,7 +330,13 @@ func (s *Service) SyncTaskProgress() {
job.SongId = v.Id
job.Duration = int(v.Metadata.Duration)
job.Prompt = v.Metadata.Prompt
job.Tags = v.Metadata.Tags
// 修复 tags 字段过长导致插入数据库失败
if len(v.Metadata.Tags) > 255 {
job.Tags = v.Metadata.Tags[:255]
} else {
job.Tags = v.Metadata.Tags
}
job.ModelName = v.ModelName
job.RawData = utils.JsonEncode(v)
job.CoverURL = v.ImageLargeUrl

View File

@@ -5,12 +5,12 @@ import (
)
type ChatItem struct {
Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
ChatId string `gorm:"column:chat_id;type:char(40);uniqueIndex;not null;comment:会话 ID" json:"chat_id"`
UserId uint `gorm:"column:user_id;type:int;not null;comment:用户 ID" json:"user_id"`
RoleId uint `gorm:"column:role_id;type:int;not null;comment:角色 ID" json:"role_id"`
UserId uint `gorm:"column:user_id;type:int(11);not null;comment:用户 ID" json:"user_id"`
RoleId uint `gorm:"column:role_id;type:int(11);not null;comment:角色 ID" json:"role_id"`
Title string `gorm:"column:title;type:varchar(100);not null;comment:会话标题" json:"title"`
ModelId uint `gorm:"column:model_id;type:int;not null;default:0;comment:模型 ID" json:"model_id"`
ModelId uint `gorm:"column:model_id;type:int(11);not null;default:0;comment:模型 ID" json:"model_id"`
Model string `gorm:"column:model;type:varchar(30);comment:模型名称" json:"model"`
CreatedAt time.Time `gorm:"column:created_at;type:datetime;not null;comment:创建时间" json:"created_at"`
UpdatedAt time.Time `gorm:"column:updated_at;type:datetime;not null;comment:更新时间" json:"updated_at"`

View File

@@ -6,11 +6,11 @@ import (
type ChatMessage struct {
Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
UserId uint `gorm:"column:user_id;type:int;not null;comment:用户 ID" json:"user_id"`
UserId uint `gorm:"column:user_id;type:int(11);not null;comment:用户 ID" json:"user_id"`
ChatId string `gorm:"column:chat_id;type:char(40);not null;index;comment:会话 ID" json:"chat_id"`
Type string `gorm:"column:type;type:varchar(10);not null;comment:类型prompt|reply" json:"type"`
Icon string `gorm:"column:icon;type:varchar(255);not null;comment:角色图标" json:"icon"`
RoleId uint `gorm:"column:role_id;type:int;not null;comment:角色 ID" json:"role_id"`
RoleId uint `gorm:"column:role_id;type:int(11);not null;comment:角色 ID" json:"role_id"`
Model string `gorm:"column:model;type:varchar(255);comment:模型名称" json:"model"`
Content string `gorm:"column:content;type:text;not null;comment:聊天内容" json:"content"`
Tokens int `gorm:"column:tokens;type:smallint;not null;comment:耗费 token 数量" json:"tokens"`

View File

@@ -18,7 +18,7 @@ type ChatModel struct {
MaxTokens int `gorm:"column:max_tokens;type:int;not null;default:1024;comment:最大响应长度" json:"max_tokens"`
MaxContext int `gorm:"column:max_context;type:int;not null;default:4096;comment:最大上下文长度" json:"max_context"`
Open bool `gorm:"column:open;type:tinyint(1);not null;comment:是否开放模型" json:"open"`
KeyId uint `gorm:"column:key_id;type:int;not null;comment:绑定API KEY ID" json:"key_id"`
KeyId uint `gorm:"column:key_id;type:int(11);not null;comment:绑定API KEY ID" json:"key_id"`
Options string `gorm:"column:options;type:text;not null;comment:模型自定义选项" json:"options"`
CreatedAt time.Time `gorm:"column:created_at;type:datetime" json:"created_at"`
UpdatedAt time.Time `gorm:"column:updated_at;type:datetime" json:"updated_at"`

View File

@@ -7,14 +7,14 @@ import (
type ChatRole struct {
Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
Name string `gorm:"column:name;type:varchar(30);not null;comment:角色名称" json:"name"`
Tid uint `gorm:"column:tid;type:int;not null;comment:分类ID" json:"tid"`
Tid uint `gorm:"column:tid;type:int(11);not null;comment:分类ID" json:"tid"`
Key string `gorm:"column:marker;type:varchar(30);uniqueIndex;not null;comment:角色标识" json:"marker"`
Context string `gorm:"column:context_json;type:text;not null;comment:角色语料 json" json:"context_json"`
HelloMsg string `gorm:"column:hello_msg;type:varchar(255);not null;comment:打招呼信息" json:"hello_msg"`
Icon string `gorm:"column:icon;type:varchar(255);not null;comment:角色图标" json:"icon"`
Enable bool `gorm:"column:enable;type:tinyint(1);not null;comment:是否被启用" json:"enable"`
SortNum int `gorm:"column:sort_num;type:smallint;not null;default:0;comment:角色排序" json:"sort_num"`
ModelId uint `gorm:"column:model_id;type:int;not null;default:0;comment:绑定模型ID" json:"model_id"`
ModelId uint `gorm:"column:model_id;type:int(11);not null;default:0;comment:绑定模型ID" json:"model_id"`
CreatedAt time.Time `gorm:"column:created_at;type:datetime;not null" json:"created_at"`
UpdatedAt time.Time `gorm:"column:updated_at;type:datetime;not null" json:"updated_at"`
}

View File

@@ -3,8 +3,8 @@ package model
import "time"
type DallJob struct {
Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
UserId uint `gorm:"column:user_id;type:int;not null;comment:用户ID" json:"user_id"`
Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
UserId uint `gorm:"column:user_id;type:int(11);not null;comment:用户ID" json:"user_id"`
Prompt string `gorm:"column:prompt;type:text;not null;comment:提示词" json:"prompt"`
TaskInfo string `gorm:"column:task_info;type:text;not null;comment:任务详情" json:"task_info"`
ImgURL string `gorm:"column:img_url;type:varchar(255);not null;comment:图片地址" json:"img_url"`

View File

@@ -3,8 +3,8 @@ package model
import "time"
type File struct {
Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
UserId uint `gorm:"column:user_id;type:int;not null;comment:用户 ID" json:"user_id"`
Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
UserId uint `gorm:"column:user_id;type:int(11);not null;comment:用户 ID" json:"user_id"`
Name string `gorm:"column:name;type:varchar(255);not null;comment:文件名" json:"name"`
ObjKey string `gorm:"column:obj_key;type:varchar(100);comment:文件标识" json:"obj_key"`
URL string `gorm:"column:url;type:varchar(255);not null;comment:文件地址" json:"url"`

View File

@@ -3,8 +3,8 @@ package model
import "time"
type InviteCode struct {
Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
UserId uint `gorm:"column:user_id;type:int;not null;comment:用户ID" json:"user_id"`
Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
UserId uint `gorm:"column:user_id;type:int(11);not null;comment:用户ID" json:"user_id"`
Code string `gorm:"column:code;type:char(8);uniqueIndex;not null;comment:邀请码" json:"code"`
Hits int `gorm:"column:hits;type:int;not null;comment:点击次数" json:"hits"`
RegNum int `gorm:"column:reg_num;type:smallint;not null;comment:注册数量" json:"reg_num"`

View File

@@ -5,9 +5,9 @@ import (
)
type InviteLog struct {
Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
InviterId uint `gorm:"column:inviter_id;type:int;not null;comment:邀请人ID" json:"inviter_id"`
UserId uint `gorm:"column:user_id;type:int;not null;comment:注册用户ID" json:"user_id"`
Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
InviterId uint `gorm:"column:inviter_id;type:int(11);not null;comment:邀请人ID" json:"inviter_id"`
UserId uint `gorm:"column:user_id;type:int(11);not null;comment:注册用户ID" json:"user_id"`
Username string `gorm:"column:username;type:varchar(30);not null;comment:用户名" json:"username"`
InviteCode string `gorm:"column:invite_code;type:char(8);not null;comment:邀请码" json:"invite_code"`
Remark string `gorm:"column:remark;type:varchar(255);not null;comment:备注" json:"remark"`

View File

@@ -7,7 +7,7 @@ import (
// JimengJob 即梦AI任务模型
type JimengJob struct {
Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
UserId uint `gorm:"column:user_id;type:int;not null;index;comment:用户ID" json:"user_id"`
UserId uint `gorm:"column:user_id;type:int(11);not null;index;comment:用户ID" json:"user_id"`
TaskId string `gorm:"column:task_id;type:varchar(100);not null;index;comment:任务ID" json:"task_id"`
Type JMTaskType `gorm:"column:type;type:varchar(50);not null;comment:任务类型" json:"type"`
ReqKey string `gorm:"column:req_key;type:varchar(100);comment:请求Key" json:"req_key"`

View File

@@ -3,8 +3,8 @@ package model
import "time"
type MidJourneyJob struct {
Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
UserId uint `gorm:"column:user_id;type:int;not null;comment:用户 ID" json:"user_id"`
Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
UserId uint `gorm:"column:user_id;type:int(11);not null;comment:用户 ID" json:"user_id"`
TaskId string `gorm:"column:task_id;type:varchar(20);uniqueIndex;comment:任务 ID" json:"task_id"`
TaskInfo string `gorm:"column:task_info;type:text;not null;comment:任务详情" json:"task_info"`
Type string `gorm:"column:type;type:varchar(20);default:image;comment:任务类别" json:"type"`

View File

@@ -7,16 +7,16 @@ import (
// PowerLog 算力消费日志
type PowerLog struct {
Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
UserId uint `gorm:"column:user_id;type:int;not null;comment:用户ID" json:"user_id"`
Username string `gorm:"column:username;type:varchar(30);not null;comment:用户名" json:"username"`
Type types.PowerType `gorm:"column:type;type:tinyint(1);not null;comment:类型1充值2消费3退费" json:"type"`
Amount int `gorm:"column:amount;type:smallint;not null;comment:算力数值" json:"amount"`
Balance int `gorm:"column:balance;type:int;not null;comment:余额" json:"balance"`
Model string `gorm:"column:model;type:varchar(30);not null;comment:模型" json:"model"`
Remark string `gorm:"column:remark;type:varchar(512);not null;comment:备注" json:"remark"`
Mark types.PowerMark `gorm:"column:mark;type:tinyint(1);not null;comment:资金类型0支出1收入" json:"mark"`
CreatedAt time.Time `gorm:"column:created_at;type:datetime;not null;comment:创建时间" json:"created_at"`
Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
UserId uint `gorm:"column:user_id;type:int(11);not null;comment:用户ID" json:"user_id"`
Username string `gorm:"column:username;type:varchar(30);not null;comment:用户名" json:"username"`
Type types.PowerType `gorm:"column:type;type:tinyint(1);not null;comment:类型1充值2消费3退费" json:"type"`
Amount int `gorm:"column:amount;type:smallint;not null;comment:算力数值" json:"amount"`
Balance int `gorm:"column:balance;type:int;not null;comment:余额" json:"balance"`
Model string `gorm:"column:model;type:varchar(255);not null;comment:模型" json:"model"`
Remark string `gorm:"column:remark;type:varchar(512);not null;comment:备注" json:"remark"`
Mark types.PowerMark `gorm:"column:mark;type:tinyint(1);not null;comment:资金类型0支出1收入" json:"mark"`
CreatedAt time.Time `gorm:"column:created_at;type:datetime;not null;comment:创建时间" json:"created_at"`
}
func (m *PowerLog) TableName() string {

View File

@@ -5,14 +5,14 @@ import "time"
// 兑换码
type Redeem struct {
Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
UserId uint `gorm:"column:user_id;type:int;not null;comment:用户 ID" json:"user_id"`
Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
UserId uint `gorm:"column:user_id;type:int(11);not null;comment:用户 ID" json:"user_id"`
Name string `gorm:"column:name;type:varchar(30);not null;comment:兑换码名称" json:"name"`
Power int `gorm:"column:power;type:int;not null;comment:算力" json:"power"`
Code string `gorm:"column:code;type:varchar(100);uniqueIndex;not null;comment:兑换码" json:"code"`
Enabled bool `gorm:"column:enabled;type:tinyint(1);not null;comment:是否启用" json:"enabled"`
Enabled bool `gorm:"column:enabled;type:tinyint(1);not null;comment:是否启用" json:"enabled"`
CreatedAt time.Time `gorm:"column:created_at;type:datetime;not null" json:"created_at"`
RedeemedAt int64 `gorm:"column:redeemed_at;type:int;not null;comment:兑换时间" json:"redeemed_at"`
RedeemedAt int64 `gorm:"column:redeemed_at;type:int;not null;comment:兑换时间" json:"redeemed_at"`
}
func (m *Redeem) TableName() string {

View File

@@ -3,18 +3,18 @@ package model
import "time"
type SdJob struct {
Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
UserId uint `gorm:"column:user_id;type:int;not null;comment:用户 ID" json:"user_id"`
Type string `gorm:"column:type;type:varchar(20);default:txt2img;comment:任务类别" json:"type"`
TaskId string `gorm:"column:task_id;type:char(30);uniqueIndex;not null;comment:任务 ID" json:"task_id"`
TaskInfo string `gorm:"column:task_info;type:text;not null;comment:任务详情" json:"task_info"`
Prompt string `gorm:"column:prompt;type:text;not null;comment:会话提示词" json:"prompt"`
ImgURL string `gorm:"column:img_url;type:varchar(255);comment:图片URL" json:"img_url"`
Params string `gorm:"column:params;type:text;comment:绘画参数json" json:"params"`
Progress int `gorm:"column:progress;type:smallint;default:0;comment:任务进度" json:"progress"`
Publish int `gorm:"column:publish;type:tinyint(1);not null;comment:是否发布" json:"publish"`
ErrMsg string `gorm:"column:err_msg;type:varchar(1024);comment:错误信息" json:"err_msg"`
Power int `gorm:"column:power;type:smallint;not null;default:0;comment:消耗算力" json:"power"`
Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
UserId uint `gorm:"column:user_id;type:int(11);not null;comment:用户 ID" json:"user_id"`
Type string `gorm:"column:type;type:varchar(20);default:txt2img;comment:任务类别" json:"type"`
TaskId string `gorm:"column:task_id;type:char(30);uniqueIndex;not null;comment:任务 ID" json:"task_id"`
TaskInfo string `gorm:"column:task_info;type:text;not null;comment:任务详情" json:"task_info"`
Prompt string `gorm:"column:prompt;type:text;not null;comment:会话提示词" json:"prompt"`
ImgURL string `gorm:"column:img_url;type:varchar(255);comment:图片URL" json:"img_url"`
Params string `gorm:"column:params;type:text;comment:绘画参数json" json:"params"`
Progress int `gorm:"column:progress;type:smallint;default:0;comment:任务进度" json:"progress"`
Publish int `gorm:"column:publish;type:tinyint(1);not null;comment:是否发布" json:"publish"`
ErrMsg string `gorm:"column:err_msg;type:varchar(1024);comment:错误信息" json:"err_msg"`
Power int `gorm:"column:power;type:smallint;not null;default:0;comment:消耗算力" json:"power"`
CreatedAt time.Time `gorm:"column:created_at;type:datetime;not null" json:"created_at"`
}

View File

@@ -3,31 +3,31 @@ package model
import "time"
type SunoJob struct {
Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
UserId uint `gorm:"column:user_id;type:int;not null;comment:用户 ID" json:"user_id"`
Channel string `gorm:"column:channel;type:varchar(100);not null;comment:渠道" json:"channel"`
Title string `gorm:"column:title;type:varchar(100);comment:歌曲标题" json:"title"`
Type int `gorm:"column:type;type:tinyint(1);default:0;comment:任务类型,1:灵感创作,2:自定义创作" json:"type"`
TaskId string `gorm:"column:task_id;type:varchar(50);comment:任务 ID" json:"task_id"`
TaskInfo string `gorm:"column:task_info;type:text;not null;comment:任务详情" json:"task_info"`
RefTaskId string `gorm:"column:ref_task_id;type:char(50);comment:引用任务 ID" json:"ref_task_id"`
Tags string `gorm:"column:tags;type:varchar(100);comment:歌曲风格" json:"tags"`
Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
UserId uint `gorm:"column:user_id;type:int;not null;comment:用户 ID" json:"user_id"`
Channel string `gorm:"column:channel;type:varchar(100);not null;comment:渠道" json:"channel"`
Title string `gorm:"column:title;type:varchar(100);comment:歌曲标题" json:"title"`
Type int `gorm:"column:type;type:tinyint(1);default:0;comment:任务类型,1:灵感创作,2:自定义创作" json:"type"`
TaskId string `gorm:"column:task_id;type:varchar(50);comment:任务 ID" json:"task_id"`
TaskInfo string `gorm:"column:task_info;type:text;not null;comment:任务详情" json:"task_info"`
RefTaskId string `gorm:"column:ref_task_id;type:char(50);comment:引用任务 ID" json:"ref_task_id"`
Tags string `gorm:"column:tags;type:varchar(255);comment:歌曲风格" json:"tags"`
Instrumental bool `gorm:"column:instrumental;type:tinyint(1);default:0;comment:是否为纯音乐" json:"instrumental"`
ExtendSecs int `gorm:"column:extend_secs;type:smallint;default:0;comment:延长秒数" json:"extend_secs"`
SongId string `gorm:"column:song_id;type:varchar(50);comment:要续写的歌曲 ID" json:"song_id"`
RefSongId string `gorm:"column:ref_song_id;type:varchar(50);not null;comment:引用的歌曲ID" json:"ref_song_id"`
Prompt string `gorm:"column:prompt;type:varchar(2000);not null;comment:提示词" json:"prompt"`
CoverURL string `gorm:"column:cover_url;type:varchar(512);comment:封面图地址" json:"cover_url"`
AudioURL string `gorm:"column:audio_url;type:varchar(512);comment:音频地址" json:"audio_url"`
ModelName string `gorm:"column:model_name;type:varchar(30);comment:模型地址" json:"model_name"`
Progress int `gorm:"column:progress;type:smallint;default:0;comment:任务进度" json:"progress"`
Duration int `gorm:"column:duration;type:smallint;not null;default:0;comment:歌曲时长" json:"duration"`
Publish int `gorm:"column:publish;type:tinyint(1);not null;comment:是否发布" json:"publish"`
ErrMsg string `gorm:"column:err_msg;type:varchar(1024);comment:错误信息" json:"err_msg"`
RawData string `gorm:"column:raw_data;type:text;comment:原始数据" json:"raw_data"`
Power int `gorm:"column:power;type:smallint;not null;default:0;comment:消耗算力" json:"power"`
PlayTimes int `gorm:"column:play_times;type:int;comment:播放次数" json:"play_times"`
CreatedAt time.Time `gorm:"column:created_at;type:datetime;not null" json:"created_at"`
ExtendSecs int `gorm:"column:extend_secs;type:smallint;default:0;comment:延长秒数" json:"extend_secs"`
SongId string `gorm:"column:song_id;type:varchar(50);comment:要续写的歌曲 ID" json:"song_id"`
RefSongId string `gorm:"column:ref_song_id;type:varchar(50);not null;comment:引用的歌曲ID" json:"ref_song_id"`
Prompt string `gorm:"column:prompt;type:varchar(2000);not null;comment:提示词" json:"prompt"`
CoverURL string `gorm:"column:cover_url;type:varchar(512);comment:封面图地址" json:"cover_url"`
AudioURL string `gorm:"column:audio_url;type:varchar(512);comment:音频地址" json:"audio_url"`
ModelName string `gorm:"column:model_name;type:varchar(30);comment:模型地址" json:"model_name"`
Progress int `gorm:"column:progress;type:smallint;default:0;comment:任务进度" json:"progress"`
Duration int `gorm:"column:duration;type:smallint;not null;default:0;comment:歌曲时长" json:"duration"`
Publish int `gorm:"column:publish;type:tinyint(1);not null;comment:是否发布" json:"publish"`
ErrMsg string `gorm:"column:err_msg;type:varchar(1024);comment:错误信息" json:"err_msg"`
RawData string `gorm:"column:raw_data;type:text;comment:原始数据" json:"raw_data"`
Power int `gorm:"column:power;type:smallint;not null;default:0;comment:消耗算力" json:"power"`
PlayTimes int `gorm:"column:play_times;type:int;comment:播放次数" json:"play_times"`
CreatedAt time.Time `gorm:"column:created_at;type:datetime;not null" json:"created_at"`
}
func (m *SunoJob) TableName() string {

View File

@@ -5,8 +5,8 @@ import (
)
type UserLoginLog struct {
Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
UserId uint `gorm:"column:user_id;type:int;not null;comment:用户ID" json:"user_id"`
Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
UserId uint `gorm:"column:user_id;type:int(11);not null;comment:用户ID" json:"user_id"`
Username string `gorm:"column:username;type:varchar(30);not null;comment:用户名" json:"username"`
LoginIp string `gorm:"column:login_ip;type:char(16);not null;comment:登录IP" json:"login_ip"`
LoginAddress string `gorm:"column:login_address;type:varchar(30);not null;comment:登录地址" json:"login_address"`

View File

@@ -3,8 +3,8 @@ package model
import "time"
type VideoJob struct {
Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
UserId uint `gorm:"column:user_id;type:int;not null;comment:用户 ID" json:"user_id"`
Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
UserId uint `gorm:"column:user_id;type:int(11);not null;comment:用户 ID" json:"user_id"`
Channel string `gorm:"column:channel;type:varchar(100);not null;comment:渠道" json:"channel"`
TaskId string `gorm:"column:task_id;type:varchar(100);not null;comment:任务 ID" json:"task_id"`
TaskInfo string `gorm:"column:task_info;type:text;comment:原始任务信息" json:"task_info"`

View File

@@ -69,7 +69,8 @@
class="nav-item-box"
@click="router.push(item.url)"
>
<i :class="'iconfont ' + item.icon"></i>
<i :class="'iconfont mb-2 ' + item.icon" v-if="item.icon.startsWith('icon')"></i>
<el-image :src="item.icon" class="rounded-lg w-10 h-10 mb-2" alt="Geek-AI" v-else />
<div>{{ item.name }}</div>
</div>
</el-space>
@@ -87,18 +88,13 @@ import { checkSession, getLicenseInfo, getSystemInfo } from '@/store/cache'
import { removeUserToken } from '@/store/session'
import { httpGet } from '@/utils/http'
import { ElMessage } from 'element-plus'
import { onMounted, onUnmounted, ref } from 'vue'
import { onMounted, ref } from 'vue'
import { useRouter } from 'vue-router'
const router = useRouter()
// if (isMobile()) {
// router.push('/mobile/index')
// }
const title = ref('')
const logo = ref('')
const slogan = ref('')
const license = ref({ de_copy: true })
const isLogin = ref(false)
@@ -107,24 +103,11 @@ const githubURL = ref(import.meta.env.VITE_GITHUB_URL)
const giteeURL = ref(import.meta.env.VITE_GITEE_URL)
const navs = ref([])
const displayedChars = ref([])
const initAnimation = ref('')
let timer = null // 定时器句柄
// 初始化间隔时间和随机时间数组
const interTime = ref(50)
const interArr = [90, 100, 70, 88, 80, 110, 85, 400, 90, 99]
onMounted(() => {
getSystemInfo()
.then((res) => {
title.value = res.data.title
logo.value = res.data.logo
slogan.value = res.data.slogan
// 确保获取数据后再启动定时器
if (timer) clearInterval(timer) // 清除已有定时器
timer = setInterval(setContent, interTime.value)
})
.catch((e) => {
ElMessage.error('获取系统配置失败:' + e.message)
@@ -154,52 +137,9 @@ onMounted(() => {
.catch(() => {})
})
// 组件销毁时清除定时器
onUnmounted(() => {
if (timer) {
clearInterval(timer)
timer = null
}
})
// 打字机内容逐字符显示
const setContent = () => {
if (!slogan.value) {
if (timer) clearInterval(timer)
timer = setTimeout(setContent, 100)
return
}
if (initAnimation.value.length >= slogan.value.length) {
// 文本已全部输出
initAnimation.value = ''
displayedChars.value = []
if (timer) clearInterval(timer)
timer = setInterval(setContent, interTime.value)
} else {
const nextChar = slogan.value.charAt(initAnimation.value.length)
initAnimation.value += nextChar // 逐字符追加
displayedChars.value.push(nextChar)
interTime.value = interArr[Math.floor(Math.random() * interArr.length)] // 设置随机间隔
if (timer) clearInterval(timer)
timer = setInterval(setContent, interTime.value)
}
}
// 计算彩虹色
const rainbowColor = (index) => {
const hue = (index * 40) % 360 // 每个字符间隔40度形成彩虹色
return `hsl(${hue}, 90%, 50%)` // 色调(hue),饱和度(70%),亮度(50%)
}
const logout = function () {
httpGet('/api/user/logout')
.then(() => {
removeUserToken()
router.push('/login')
})
.catch((e) => {
ElMessage.error('注销失败:' + e.message)
})
const logout = () => {
removeUserToken()
router.push('/login')
}
</script>

View File

@@ -12,6 +12,35 @@
<!-- 秘钥配置分组 -->
<div class="mb-3">
<h3 class="mb-2">秘钥配置</h3>
<el-alert type="info" :closable="false" show-icon>
<p class="mb-1">
1. 要使用即梦 AI 功能需要先在火山引擎控制台开通
<a
href="https://console.volcengine.com/ai/ability/detail/10"
target="_blank"
class="text-blue-500"
>即梦 AI</a
>
<a
href="https://console.volcengine.com/ai/ability/detail/9"
target="_blank"
class="text-blue-500"
>智能绘图</a
>
服务
</p>
<p>
2. AccessKey和SecretKey 请在火山引擎控制台 ->
<a
href="https://console.volcengine.com/iam/keymanage/"
target="_blank"
class="text-blue-500"
>秘钥管理</a
>
获取
</p>
</el-alert>
<el-form-item label="AccessKey" prop="access_key">
<el-input
v-model="jimengConfig.access_key"