luma page video list component is ready

This commit is contained in:
RockYang 2024-08-23 18:25:58 +08:00
parent 04d6ba0853
commit d000cc5a67
16 changed files with 136 additions and 42 deletions

View File

@ -134,7 +134,7 @@ type SystemConfig struct {
Title string `json:"title,omitempty"` // 网站标题
Slogan string `json:"slogan,omitempty"` // 网站 slogan
AdminTitle string `json:"admin_title,omitempty"` // 管理后台标题
Logo string `json:"logo,omitempty"`
Logo string `json:"logo,omitempty"` // 方形 Logo
InitPower int `json:"init_power,omitempty"` // 新用户注册赠送算力值
DailyPower int `json:"daily_power,omitempty"` // 每日赠送算力
InvitePower int `json:"invite_power,omitempty"` // 邀请新用户赠送算力值

View File

@ -452,17 +452,23 @@ func (h *UserHandler) CLoginCallback(c *gin.Context) {
// Session 获取/验证会话
func (h *UserHandler) Session(c *gin.Context) {
user, err := h.GetLoginUser(c)
if err == nil {
var userVo vo.User
err := utils.CopyObject(user, &userVo)
if err != nil {
resp.ERROR(c)
resp.NotAuth(c, err.Error())
return
}
var userVo vo.User
err = utils.CopyObject(user, &userVo)
if err != nil {
resp.ERROR(c, err.Error())
return
}
// 用户 VIP 到期
if user.ExpiredTime > 0 && user.ExpiredTime < time.Now().Unix() {
h.DB.Model(&user).UpdateColumn("vip", false)
}
userVo.Id = user.Id
resp.SUCCESS(c, userVo)
} else {
resp.NotAuth(c)
}
}

View File

@ -29,16 +29,10 @@ func NewLevelDB() (*LevelDB, error) {
}
func (db *LevelDB) Put(key string, value interface{}) error {
var byteData []byte
if v, ok := value.(string); ok {
byteData = []byte(v)
} else {
b, err := json.Marshal(value)
byteData, err := json.Marshal(value)
if err != nil {
return err
}
byteData = b
}
return db.driver.Put([]byte(key), byteData, nil)
}

View File

@ -1,6 +1,6 @@
VUE_APP_API_HOST=http://localhost:5678
VUE_APP_WS_HOST=ws://localhost:5678
VUE_APP_USER=18575670125
VUE_APP_USER=18888888888
VUE_APP_PASS=12345678
VUE_APP_ADMIN_USER=admin
VUE_APP_ADMIN_PASS=admin123

Binary file not shown.

Before

Width:  |  Height:  |  Size: 250 KiB

After

Width:  |  Height:  |  Size: 35 KiB

View File

@ -23,6 +23,8 @@
.el-image {
width 48px
height 48px
background-color #ffffff
border-radius 50%
}
}

View File

@ -56,6 +56,7 @@
.el-image {
height 50px
background-color #ffffff
}
.el-button {
@ -72,6 +73,9 @@
.content {
text-align: center;
position relative
display flex
flex-flow: column;
align-items: center;
h1 {
font-size: 5rem;
@ -88,6 +92,10 @@
max-width 900px
padding 20px
.el-space--horizontal {
justify-content center
}
.nav-item {
width 200px
.el-button {

View File

@ -30,6 +30,8 @@
.el-image {
width 120px;
cursor pointer
background-color #ffffff
border-radius 50%
}
}

View File

@ -95,12 +95,49 @@
}
.video-container {
display flex
flex-flow column
width 100%
padding 0 40px
.h-title {
color #ffffff
max-width 56rem
width 100%
padding 40px 20
font-size 36px
text-align left
}
.videos {
display flex
flex-flow row
.item {
.video-box {
width 100%
border-radius 10px
video,img {
width: 100%;
height: 100%;
object-fit: cover;
border-radius 10px
cursor pointer
}
}
.video-name {
color #e1e1e1
font-size 16px
white-space nowrap
overflow hidden
text-overflow ellipsis
padding 6px 0
text-align center
}
}
}
}
}

View File

@ -15,7 +15,7 @@ export function checkSession() {
httpGet('/api/user/session').then(res => {
item.data = res.data
// cache expires after 10 secs
item.expire = Date.now() + 1000 * 60 * 5
item.expire = Date.now() + 1000 * 30
Storage.set(userDataKey, item)
resolve(item.data)
}).catch(e => {
@ -37,7 +37,7 @@ export function checkAdminSession() {
return new Promise((resolve, reject) => {
httpGet('/api/admin/session').then(res => {
item.data = res.data
item.expire = Date.now() + 1000 * 60 * 5
item.expire = Date.now() + 1000 * 30
Storage.set(adminDataKey, item)
resolve(item.data)
}).catch(e => {
@ -59,7 +59,7 @@ export function getSystemInfo() {
return new Promise((resolve, reject) => {
httpGet('/api/config/get?key=system').then(res => {
item.data = res
item.expire = Date.now() + 1000 * 60 * 10
item.expire = Date.now() + 1000 * 30
Storage.set(systemInfoKey, item)
resolve(item.data)
}).catch(err => {
@ -77,7 +77,7 @@ export function getLicenseInfo() {
return new Promise((resolve, reject) => {
httpGet('/api/config/license').then(res => {
item.data = res
item.expire = Date.now() + 1000 * 60 * 10
item.expire = Date.now() + 1000 * 30
Storage.set(licenseInfoKey, item)
resolve(item.data)
}).catch(err => {

View File

@ -40,7 +40,7 @@
<div class="navs">
<el-space wrap>
<div v-for="item in navs" class="nav-item">
<div v-for="item in navs" :key="item.url" class="nav-item">
<el-button @click="router.push(item.url)" :color="theme.btnBgColor" :style="{color: theme.btnTextColor}" class="shadow" :dark="false">
<i :class="'iconfont '+iconMap[item.url]"></i>
<span>{{item.name}}</span>

View File

@ -27,7 +27,21 @@
</div>
</div>
<el-container class="video-container">
<h2 class="h-title">你的作品</h2>
<el-row :gutter="20" class="videos">
<el-col :span="8" class="item" :key="item.id" v-for="item in videos">
<div class="video-box" @mouseover="item.playing = true" @mouseout="item.playing = false">
<img :src="item.cover" :alt="item.name" v-if="!item.playing"/>
<video :src="item.url" preload="auto" :autoplay="true" loop="loop" muted="muted" v-else>
您的浏览器不支持视频播放
</video>
</div>
<div class="video-name">{{item.name}}</div>
</el-col>
</el-row>
</el-container>
</div>
</template>
@ -42,11 +56,27 @@ const images = ref([
"http://nk.img.r9it.com/chatgpt-plus/1719371605709871.jpg"
])
const list = ref([
const videos = ref([
{
id: 1,
name: '1',
url: 'http://localhost/download/xmind.mp4'
name: 'a dancing girl',
url: 'http://localhost/download/xmind.mp4',
cover: 'https://storage.cdn-luma.com/dream_machine/d133794f-3124-4059-a9f2-e5fed79f0d5b/video_0_thumb.jpg',
playing: false
},
{
id: 1,
name: 'a dancing girl',
url: 'http://localhost/download/dancing.mp4',
cover: 'https://storage.cdn-luma.com/dream_machine/92efa55a-f381-4161-a999-54f8fe460fca/video_1_thumb.jpg',
playing: false
},
{
id: 1,
name: 'a dancing girl',
url: 'http://localhost/download/xmind.mp4',
cover: 'https://storage.cdn-luma.com/dream_machine/d133794f-3124-4059-a9f2-e5fed79f0d5b/video_0_thumb.jpg',
playing: false
}
])

View File

@ -23,8 +23,8 @@
--el-table-row-hover-bg-color:#373C47;
--el-table-header-bg-color:#474E5C;
--el-table-text-color:#d1d1d1">
<el-table-column prop="username" label="用户"/>
<el-table-column prop="model" label="模型"/>
<el-table-column prop="username" label="用户" width="130px"/>
<el-table-column prop="model" label="模型" width="130px"/>
<el-table-column prop="type" label="类型">
<template #default="scope">
<el-tag size="small" :type="tagColors[scope.row.type]">{{ scope.row.type_str }}</el-tag>
@ -39,7 +39,7 @@
</template>
</el-table-column>
<el-table-column prop="balance" label="余额"/>
<el-table-column label="发生时间">
<el-table-column label="发生时间" width="160px">
<template #default="scope">
<span>{{ dateFormat(scope.row['created_at']) }}</span>
</template>

View File

@ -335,6 +335,8 @@ const doSubmitRegister = (verifyData) => {
.el-image {
width 120px;
cursor pointer
background-color #ffffff
border-radius 50%
}
}

View File

@ -145,6 +145,8 @@ const doLogin = function (verifyData) {
.el-image {
width 120px;
cursor pointer
background-color #ffffff
border-radius 50%
}
}

View File

@ -376,6 +376,12 @@
</el-descriptions-item>
</el-descriptions>
<h3>激活后可获得以下权限</h3>
<ol class="active-info">
<li>1使用任意第三方中转 API KEY而不用局限于 GeekAI 推荐的白名单列表</li>
<li>2可以在相关页面去除 GeekAI 的版权信息或者修改为自己的版权信息</li>
</ol>
<el-form :model="system" label-width="150px" label-position="right">
<el-form-item label="许可授权码" prop="license">
<el-input v-model="licenseKey"/>
@ -592,6 +598,11 @@ const onUploadImg = (files, callback) => {
}
}
.active-info {
line-height 1.5
padding 10px 0 30px 0
}
.el-descriptions {
margin-bottom 20px
.el-icon {