Compare commits

..

98 Commits

Author SHA1 Message Date
old burden f9e5a33590 feat: 拆分路由 2026-04-17 14:20:54 +08:00
old burden 162e57e80d feat: 页面风格优化 2026-04-17 14:14:50 +08:00
old burden 21dfc72068 feat: 页面风格优化 2026-04-17 14:12:44 +08:00
yys edbebf0d5d fix: 根据阿里规约修改部份代码问题 2026-04-16 11:52:37 +08:00
yys 4f1240ab0b fix: 解决maven编译出现的一些问题
去掉了七牛工具类的@Component
           mail依赖了两次,删除一个
        AiBannerServiceImpl中的警告(该方法未使用无影响)
2026-04-15 16:59:54 +08:00
yys 391071c8f7 fix: 解决ai_user停用后仍可在portal登录的问题 2026-04-15 16:44:21 +08:00
yys ffc23990a7 Merge branch 'seedance' of https://gitea.06zk.com/best_yunwei/ai_images into seedance 2026-04-15 16:01:57 +08:00
yys b3459fc01f fix: 生成视频产生的流水的备注,用同一个语言 2026-04-15 16:01:49 +08:00
old burden 3dfa25d23b Merge remote-tracking branch 'origin/seedance' into seedance 2026-04-15 15:21:05 +08:00
old burden abae79949f feat: 作品库分页器,操作列优化 2026-04-15 15:20:55 +08:00
yys ff46210c14 fix: 生成视频产生的流水的备注,用同一个语言 2026-04-15 14:58:17 +08:00
yys b93dd9470c fix: 解决合并冲突 2026-04-15 14:06:01 +08:00
yys a26021dc1c Merge branch 'seedance_score' into seedance
# Conflicts:
#	admin-ui/src/views/ai/order/index.vue
2026-04-15 13:59:18 +08:00
yys e93fa6baa9 feat: 管理后台-订单记录,优化界面布局 2026-04-14 11:50:05 +08:00
yys 1bedde7fa7 fix:管理后台-订单记录,按订单查询报错 2026-04-14 11:49:33 +08:00
yys f31e4c38c6 feat: 多语言信息 2026-04-14 11:48:48 +08:00
yys fedaef2ff7 feat: 管理后台,优化订单表格显示列宽,生成结果如果是失败时只显示中文或编号,浮窗显示完整信息 2026-04-14 11:31:26 +08:00
yys b9e08938e0 feat: 生成视频任务失败时记录并在用户前台-对话记录、管理后台-订单显示 2026-04-14 11:18:46 +08:00
yys 85dc61b07d feat: 生成视频时,流水表写入备注,添加tokens用量 2026-04-14 11:01:55 +08:00
old burden 3328aae4e3 feat: 上传接口做优化(目前只使用了/api/file/upload,其他接口前端没使用) 2026-04-13 17:15:43 +08:00
old burden 73f4fcdaf6 feat: 小优化和作品库 2026-04-13 17:14:44 +08:00
yys f1e09eac1a fix: 后台订单预览bug修复 2026-04-13 17:05:30 +08:00
old burden b7d15052cd fix: 后台订单预览bug修复 2026-04-13 17:04:06 +08:00
yys f6408400ee feat: 火山方舟回调增加来源日志 2026-04-13 16:03:52 +08:00
yys 7068fad278 feat: 生成视频时产生的流水都加上备注 2026-04-13 11:39:16 +08:00
yys dda43f2de6 feat: 提交任务、按F5刷新时会读取最新的余额 2026-04-13 10:34:09 +08:00
yys 4d428b9d94 feat: 登录直接跳转到生成视频页面 2026-04-13 09:53:55 +08:00
yys 982ce1f179 feat: 积分先按aimanager配置扣减,任务终态时再回补 2026-04-13 09:53:37 +08:00
old burden 6279abb4f3 fix: 忽略cursor配置文件 2026-04-10 17:06:32 +08:00
yys a67a8e202a feat: 登录后直接跳转到视频生成页面 2026-04-10 14:30:56 +08:00
yys dbc292b058 feat: 去掉无用配置项 2026-04-10 14:28:54 +08:00
yys bb5daf02be fix: 生成视频、任务回调 - 检查代码并修改相关逻辑问题 2026-04-10 12:03:00 +08:00
yys 992d95992a feat: 去掉取消生成视频的功能,简化逻辑 2026-04-10 10:39:49 +08:00
yys f53f849ec8 fix: 生成视频、任务回调 - 检查代码并修改相关逻辑问题 2026-04-10 10:03:28 +08:00
yys 80c136ad18 feat: 生成视频时,按字节接口扣减用量(代码初步完成) 2026-04-09 16:52:50 +08:00
yys 38b26f9ffb feat: 生成视频时,按字节接口扣减用量 2026-04-08 16:56:31 +08:00
yys d807f71677 feat: 图生视频,选择素材窗口优化 2026-04-08 09:43:36 +08:00
yys 2e38bd7539 feat:添加默认的logo与banner 2026-04-08 09:43:06 +08:00
yys ae3be9b48d feat: 优化腾讯存储桶逻辑,不再每次都开关客户端 2026-04-07 13:56:03 +08:00
yys b567ba14b7 feat: 修改日志生成策略,按日期生成 2026-04-07 13:54:34 +08:00
yys b780a4e0d3 fix: 图生视频,解决选择首帧生成视频时编辑器消失的情况 2026-04-07 11:10:05 +08:00
yys 23817f7850 Merge branch 'seedance' of https://gitea.06zk.com/best_yunwei/ai_images into seedance 2026-04-07 10:40:31 +08:00
yys a2076fe18b feat: 修改富文本编辑器组件,实现以下功能
1、图片放大
2、显示区域加大可浮在组件外
3、选择区一行可显示多个
2026-04-07 10:40:23 +08:00
old burden 9250253238 fix: 问题7修复 2026-04-07 10:23:51 +08:00
yys 6037bae970 feat: 添加生成视频任务的扩展状态,在不动现有逻辑的情况下能显示队列中、执行中。并解决刚生成就显示失败的情况 2026-04-07 09:30:08 +08:00
yys 249565ef6d fix: 获取第二部门时的错误 2026-04-03 22:28:07 +08:00
old burden c2c1ff8063 fix: 端点问题调整 2026-04-03 16:14:52 +08:00
old burden eb8cab3f5a fix: 腾讯云cos上传警告 2026-04-03 14:24:33 +08:00
old burden fa99a4fb9b fix: 视频生成状态判断优化 2026-04-03 14:22:40 +08:00
yys b17aec4a1a fix:解决视频生成问题 2026-04-03 14:17:19 +08:00
yys 78b32dd252 Merge branch 'seedance' of https://gitea.06zk.com/best_yunwei/ai_images into seedance 2026-04-03 12:41:06 +08:00
yys 0b21a293b0 feat: admin-ui 部门编辑添加project 2026-04-03 12:40:26 +08:00
old burden 37f3237f61 fix: 视频生成问题 2026-04-03 12:38:46 +08:00
yys 4ea4d009a6 feat: 管理后台添加项目、apikey并加解密 2026-04-03 11:13:16 +08:00
old burden dc56530d47 fix: id大小写 2026-04-02 18:55:53 +08:00
old burden 9f7e43a21a fix: 参考图@插入图bug修复 2026-04-02 18:04:15 +08:00
old burden f3c3e78901 fix: 参考图bug修复 2026-04-02 17:55:33 +08:00
yys 353d8e0069 Merge branch 'seedance' of https://gitea.06zk.com/best_yunwei/ai_images into seedance 2026-04-02 17:14:29 +08:00
yys 67c252d174 fix: 上传素材接口问题 2026-04-02 17:14:24 +08:00
old burden 9a460e2de7 fix: 上传素材优化 2026-04-02 16:49:41 +08:00
yys 96646cf5ed feat: 上传素材接口,前端改传url 2026-04-02 16:43:07 +08:00
yys e888da137e feat: 修改mybatis-plus的日志配置,去掉sql日志 2026-04-02 16:30:14 +08:00
yys e2ab5bcb13 feat: 添加相关接口日志 2026-04-02 16:29:15 +08:00
yys 9c0f533aff Merge branch 'seedance' of https://gitea.06zk.com/best_yunwei/ai_images into seedance 2026-04-02 16:06:46 +08:00
yys 9705c4f472 feat: 部门表中的项目与apikey加密 2026-04-02 16:06:36 +08:00
old burden 0d4b1d18be fix: 生成页面优化布局 2026-04-02 15:56:46 +08:00
yys eb5211b9e4 fix: 修改注释中出现的Id,改成小写的id 2026-04-02 13:37:59 +08:00
old burden aec9dc0152 fix: 对接资产库和优化布局 2026-04-02 12:42:46 +08:00
yys 089ffca4f5 fix: 素材组ListAssetGroups方法去掉请求中的project属性 2026-04-02 10:41:52 +08:00
yys 8faff7562d Merge branch 'seedance' of https://gitea.06zk.com/best_yunwei/ai_images into seedance 2026-04-02 10:23:37 +08:00
yys 2d026feba3 feat: 素材组/素材管理 2026-04-02 10:23:27 +08:00
old burden f075e6b2b1 fix: 区域优化 2026-04-02 09:51:41 +08:00
old burden d2c1fff13f fix: keydown优化 2026-04-01 17:44:14 +08:00
old burden a347873a4e Merge remote-tracking branch 'origin/seedance' into seedance 2026-04-01 17:41:35 +08:00
yys 3ffd78f928 fix: 删除前段无效文件 2026-04-01 17:41:16 +08:00
old burden 2a91a33825 fix: 对接素材管理 2026-04-01 17:40:40 +08:00
yys b13e51a6ca feat: 添加gitignore目录 log 2026-04-01 17:15:08 +08:00
yys 0f6695207e feat: 添加gitignore目录 log 2026-04-01 14:32:52 +08:00
yys afca767422 feat: 火山素材组、素材管理 2026-04-01 14:31:27 +08:00
yys c04c1e572b Merge remote-tracking branch 'origin/seedance' into seedance 2026-04-01 13:28:25 +08:00
old burden ca2989902c fix: seedance 2026-04-01 13:20:15 +08:00
old burden ff18ca4f51 fix: 支持视频音频的参考图模式,资产管理模块初步上线 2026-04-01 10:31:01 +08:00
yys f9c12bb1e0 feat: 火山素材组、素材管理 2026-03-31 18:32:10 +08:00
yys a04bd71afc fix: 修改路径错误 2026-03-31 17:56:37 +08:00
old burden 4cb3f4eb88 fix: 交互优化 2026-03-31 14:40:53 +08:00
old burden 1edf9601c0 fix: 仿照即梦出一版 2026-03-31 13:49:48 +08:00
old burden adcfea0d3c fix: 多语言设置 2026-03-30 17:21:56 +08:00
old burden 33a10f55a5 fix: 个人中心隐藏有奖邀请和邀请消费记录,多语言选择改为disable 2026-03-30 17:21:38 +08:00
old burden 55588504a1 fix: 侧边栏优化,内敛图调大 2026-03-30 13:50:38 +08:00
old burden d69d16e196 fix: bug修改 result 写成 URL 2026-03-30 13:25:53 +08:00
old burden 5ba6c9f746 fix: 页面优化,工具栏显示 2026-03-30 13:05:05 +08:00
old burden 0e94beb477 fix: bug修改字段缺失 2026-03-30 12:30:05 +08:00
old burden 5ae8614b1d fix: 参数选择改到参数文件 2026-03-30 12:06:46 +08:00
old burden 4bba35a426 fix: 新页面 2026-03-30 11:07:36 +08:00
old burden abb8d279c4 fix: 新需求 对接火山seedance 2026-03-27 15:28:19 +08:00
old burden 8959b775a4 fix: 新需求 对接火山seedance 2026-03-27 15:27:28 +08:00
old burden aed52b0437 fix: 新需求 忽略dist 2026-03-27 10:55:10 +08:00
old burden 809b47215c fix: 新需求 2026-03-27 10:51:34 +08:00
213 changed files with 18746 additions and 3272 deletions

29
.gitignore vendored Normal file
View File

@ -0,0 +1,29 @@
.DS_Store
node_modules/
unpackage
/dist/
/manager/dist/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
/test/unit/coverage/
/test/e2e/reports/
selenium-debug.log
nodejs/public/uploads
*.zip
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
package-lock.json
.history
/unpackage/resources/
/unpackage/dist/dev
/unpackage/dist/build/.automator
/unpackage/dist/build/app-plus
*.lock
/.logs/*
/.cursor/*

View File

@ -5,6 +5,8 @@
<excludeFolder url="file://$MODULE_DIR$/.tmp" /> <excludeFolder url="file://$MODULE_DIR$/.tmp" />
<excludeFolder url="file://$MODULE_DIR$/temp" /> <excludeFolder url="file://$MODULE_DIR$/temp" />
<excludeFolder url="file://$MODULE_DIR$/tmp" /> <excludeFolder url="file://$MODULE_DIR$/tmp" />
<excludeFolder url="file://$MODULE_DIR$/python" />
<excludePattern pattern="*.zip" />
</content> </content>
<orderEntry type="inheritedJdk" /> <orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />

View File

@ -5,4 +5,7 @@ VUE_APP_TITLE = 管理系统
ENV = 'production' ENV = 'production'
# 若依管理系统/生产环境 # 若依管理系统/生产环境
VUE_APP_BASE_API = 'https://admin-api.undressing.name' # VUE_APP_BASE_API = 'http://111.230.37.169:10009'
# VUE_APP_BASE_API = 'http://101.96.201.225:8011'
VUE_APP_BASE_API = 'http://47.86.170.114:8011'

View File

@ -8,5 +8,4 @@ NODE_ENV = production
# 测试环境配置 # 测试环境配置
ENV = 'staging' ENV = 'staging'
# 若依管理系统/测试环境 VUE_APP_BASE_API = 'http://101.96.201.225:8011'
VUE_APP_BASE_API = '/api'

1
admin-ui/.gitignore vendored
View File

@ -9,6 +9,7 @@ yarn-error.log*
tests/**/coverage/ tests/**/coverage/
tests/e2e/reports tests/e2e/reports
selenium-debug.log selenium-debug.log
*.zip
# Editor directories and files # Editor directories and files
.idea .idea

View File

@ -0,0 +1,46 @@
import request from '@/utils/request'
export function listDept(query) {
return request({
url: '/ai/dept/list',
method: 'get',
params: query
})
}
export function listDeptExcludeChild(deptId) {
return request({
url: '/ai/dept/list/exclude/' + deptId,
method: 'get'
})
}
export function getDept(deptId) {
return request({
url: '/ai/dept/' + deptId,
method: 'get'
})
}
export function addDept(data) {
return request({
url: '/ai/dept',
method: 'post',
data: data
})
}
export function updateDept(data) {
return request({
url: '/ai/dept',
method: 'put',
data: data
})
}
export function delDept(deptId) {
return request({
url: '/ai/dept/' + deptId,
method: 'delete'
})
}

View File

@ -81,3 +81,12 @@ export function updatePassword(id, newPassword) {
data: data data: data
}) })
} }
/** 分配归属部门deptId 可省略或 null 表示清空 */
export function assignAiUserDept(data) {
return request({
url: '/ai/user/dept',
method: 'put',
data
})
}

View File

@ -0,0 +1,443 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
<el-form-item label="部门名称" prop="deptName">
<el-input
v-model="queryParams.deptName"
placeholder="请输入部门名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="部门状态" clearable>
<el-option
v-for="dict in dict.type.sys_normal_disable"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['ai:dept:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="info"
plain
icon="el-icon-sort"
size="mini"
@click="toggleExpandAll"
>展开/折叠</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table
v-if="refreshTable"
v-loading="loading"
:data="deptList"
row-key="deptId"
:default-expand-all="isExpandAll"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
>
<el-table-column prop="deptName" label="部门名称" width="260"></el-table-column>
<el-table-column prop="orderNum" label="排序" width="200"></el-table-column>
<el-table-column prop="status" label="状态" width="100">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="200">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['ai:dept:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-plus"
@click="handleAdd(scope.row)"
v-hasPermi="['ai:dept:add']"
>新增</el-button>
<el-button
v-if="scope.row.parentId != 0"
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['ai:dept:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<el-dialog :title="title" :visible.sync="open" width="760px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-row>
<el-col :span="24" v-if="form.parentId !== 0">
<el-form-item label="上级部门" prop="parentId">
<treeselect v-model="form.parentId" :options="deptOptions" :normalizer="normalizer" placeholder="选择上级部门" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="部门名称" prop="deptName">
<el-input v-model="form.deptName" placeholder="请输入部门名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="显示排序" prop="orderNum">
<el-input-number v-model="form.orderNum" controls-position="right" :min="0" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="负责人" prop="leader">
<el-input v-model="form.leader" placeholder="请输入负责人" maxlength="20" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="联系电话" prop="phone">
<el-input v-model="form.phone" placeholder="请输入联系电话" maxlength="11" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="邮箱" prop="email">
<el-input v-model="form.email" placeholder="请输入邮箱" maxlength="50" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="部门状态">
<el-radio-group v-model="form.status">
<el-radio
v-for="dict in dict.type.sys_normal_disable"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
<el-row v-if="isSecondLevelCompanyForm">
<el-col :span="24">
<el-form-item label="Byte API Key">
<el-input
v-model="form.byteApiKey"
type="password"
show-password
placeholder="选填"
maxlength="255"
/>
</el-form-item>
</el-col>
</el-row>
<el-row v-if="isSecondLevelCompanyForm">
<el-col :span="24">
<el-form-item label="视频模型">
<div class="model-parm-block">
<div
v-for="(row, idx) in modelParamRows"
:key="'mp-' + idx"
class="model-parm-row"
>
<el-input
v-model="row.label"
placeholder="显示名称(如 Seedance 2.0"
class="model-parm-input-label"
/>
<el-input
v-model="row.value"
placeholder="Endpoint / 模型 IDep-…)"
class="model-parm-input-value"
/>
<el-button
type="text"
icon="el-icon-delete"
:disabled="modelParamRows.length <= 1"
@click="removeModelParamRow(idx)"
/>
</div>
<el-button type="text" icon="el-icon-plus" @click="addModelParamRow">添加模型</el-button>
<p class="model-parm-hint">
保存为 JSON 写入库表 model_parm门户视频生成按用户所属二级部门读取
留空或未配置时使用配置文件 portal.video.models
</p>
</div>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<style scoped>
.model-parm-block {
width: 100%;
}
.model-parm-row {
display: flex;
align-items: center;
margin-bottom: 8px;
}
.model-parm-input-label {
width: 38%;
margin-right: 8px;
}
.model-parm-input-value {
flex: 1;
margin-right: 8px;
}
.model-parm-hint {
margin: 8px 0 0;
font-size: 12px;
color: #909399;
line-height: 1.5;
}
</style>
<script>
import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild } from "@/api/ai/dept"
import Treeselect from "@riophae/vue-treeselect"
import "@riophae/vue-treeselect/dist/vue-treeselect.css"
export default {
name: "AiDept",
dicts: ['sys_normal_disable'],
components: { Treeselect },
data() {
return {
loading: true,
showSearch: true,
deptList: [],
deptOptions: [],
title: "",
open: false,
isExpandAll: true,
refreshTable: true,
queryParams: {
deptName: undefined,
status: undefined
},
form: {},
modelParamRows: [{ label: '', value: '' }],
rules: {
parentId: [
{ required: true, message: "上级部门不能为空", trigger: "blur" }
],
deptName: [
{ required: true, message: "部门名称不能为空", trigger: "blur" }
],
orderNum: [
{ required: true, message: "显示排序不能为空", trigger: "blur" }
],
email: [
{
type: "email",
message: "请输入正确的邮箱地址",
trigger: ["blur", "change"]
}
],
phone: [
{
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
message: "请输入正确的手机号码",
trigger: "blur"
}
]
}
}
},
created() {
this.getList()
},
computed: {
isSecondLevelCompanyForm() {
if (this.form.ancestors === "0,100") {
return true
}
const pid = this.form.parentId
if (pid !== undefined && pid !== null && Number(pid) === 100) {
return true
}
return false
}
},
methods: {
getList() {
this.loading = true
listDept(this.queryParams).then(response => {
this.deptList = this.handleTree(response.data, "deptId")
this.loading = false
})
},
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children
}
return {
id: node.deptId,
label: node.deptName,
children: node.children
}
},
cancel() {
this.open = false
this.reset()
},
reset() {
this.form = {
deptId: undefined,
parentId: undefined,
ancestors: undefined,
deptName: undefined,
orderNum: undefined,
leader: undefined,
phone: undefined,
email: undefined,
byteApiKey: undefined,
modelParm: undefined,
status: "0"
}
this.modelParamRows = [{ label: '', value: '' }]
this.resetForm("form")
},
handleQuery() {
this.getList()
},
resetQuery() {
this.resetForm("queryForm")
this.handleQuery()
},
handleAdd(row) {
this.reset()
if (row != undefined) {
this.form.parentId = row.deptId
}
this.open = true
this.title = "添加部门"
listDept().then(response => {
this.deptOptions = this.handleTree(response.data, "deptId")
})
},
toggleExpandAll() {
this.refreshTable = false
this.isExpandAll = !this.isExpandAll
this.$nextTick(() => {
this.refreshTable = true
})
},
syncModelRowsFromForm() {
this.modelParamRows = [{ label: '', value: '' }]
const raw = this.form.modelParm
if (!raw || String(raw).trim() === '') {
return
}
try {
const arr = JSON.parse(raw)
if (Array.isArray(arr) && arr.length) {
this.modelParamRows = arr.map(x => ({
label: (x && x.label) ? String(x.label) : '',
value: (x && x.value) ? String(x.value) : ''
}))
}
} catch (e) {
this.modelParamRows = [{ label: '', value: '' }]
}
},
buildModelParmPayload() {
if (!this.isSecondLevelCompanyForm) {
return
}
const rows = (this.modelParamRows || []).filter(r => r.label && r.value)
this.form.modelParm = rows.length ? JSON.stringify(rows) : ''
},
addModelParamRow() {
this.modelParamRows.push({ label: '', value: '' })
},
removeModelParamRow(idx) {
if (this.modelParamRows.length <= 1) {
return
}
this.modelParamRows.splice(idx, 1)
},
handleUpdate(row) {
this.reset()
getDept(row.deptId).then(response => {
this.form = response.data
this.syncModelRowsFromForm()
this.open = true
this.title = "修改部门"
listDeptExcludeChild(row.deptId).then(response => {
this.deptOptions = this.handleTree(response.data, "deptId")
if (this.deptOptions.length == 0) {
const noResultsOptions = { deptId: this.form.parentId, deptName: this.form.parentName, children: [] }
this.deptOptions.push(noResultsOptions)
}
})
})
},
submitForm: function() {
this.$refs["form"].validate(valid => {
if (valid) {
this.buildModelParmPayload()
if (this.form.deptId != undefined) {
updateDept(this.form).then(response => {
this.$modal.msgSuccess("修改成功")
this.open = false
this.getList()
})
} else {
addDept(this.form).then(response => {
this.$modal.msgSuccess("新增成功")
this.open = false
this.getList()
})
}
}
})
},
handleDelete(row) {
this.$modal.confirm('是否确认删除名称为"' + row.deptName + '"的数据项?').then(function() {
return delDept(row.deptId)
}).then(() => {
this.getList()
this.$modal.msgSuccess("删除成功")
}).catch(() => {})
}
}
}
</script>

View File

@ -74,11 +74,6 @@
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button <el-button
type="warning" type="warning"
plain plain
@ -87,23 +82,23 @@
@click="handleExport" @click="handleExport"
v-hasPermi="['ai:order:export']" v-hasPermi="['ai:order:export']"
>导出</el-button> >导出</el-button>
</el-col> </el-form-item>
</el-form>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="orderList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="orderList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键ID" align="center" prop="id" /> <el-table-column label="主键ID" align="center" prop="id" width="60" />
<!-- <el-table-column label="备注" align="center" prop="remark" /> --> <!-- <el-table-column label="备注" align="center" prop="remark" /> -->
<el-table-column label="订单编号" align="center" prop="orderNum" /> <el-table-column label="订单编号" align="center" prop="orderNum" width="150"/>
<el-table-column label="用户ID" align="center" prop="uuid" /> <el-table-column label="用户ID" align="center" prop="uuid" width="100" />
<el-table-column label="操作类型" align="center" prop="type"> <el-table-column label="操作类型" align="center" prop="type" width="90" >
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.ai_function_type" :value="scope.row.type" /> <dict-tag :options="dict.type.ai_function_type" :value="scope.row.type" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="金额" align="center" prop="amount" /> <el-table-column label="金额" align="center" prop="amount" width="100" />
<el-table-column label="生成结果" align="center"> <el-table-column label="生成结果" align="center" width="200">
<template slot-scope="scope"> <template slot-scope="scope">
<!-- 判断是否为链接 --> <!-- 判断是否为链接 -->
<template v-if="isUrl(scope.row.result)"> <template v-if="isUrl(scope.row.result)">
@ -123,7 +118,43 @@
@click="playVideo(scope.row.result)" @click="playVideo(scope.row.result)"
/> />
</template> </template>
<!-- 非链接内容 --> <!-- 视频任务失败等场景result VideoTaskError JSON表格内简短悬停看全文 -->
<template v-else-if="parseVolcTaskErrorJson(scope.row.result)">
<span
v-for="err in [parseVolcTaskErrorJson(scope.row.result)]"
:key="'oe-' + scope.row.id"
class="order-result-error-wrap"
>
<el-tooltip
placement="top-start"
effect="dark"
:open-delay="200"
popper-class="order-result-error-tooltip-popper"
>
<div slot="content" class="order-result-error-tooltip-body">
<div class="order-result-error-tooltip-row">
<span class="order-result-error-tooltip-k">错误编号</span>
<span class="order-result-error-tooltip-v">{{ err.code || '—' }}</span>
</div>
<div
v-if="volcTaskErrorHintForCode(err.code)"
class="order-result-error-tooltip-row"
>
<span class="order-result-error-tooltip-k">中文说明</span>
<span class="order-result-error-tooltip-v">{{
volcTaskErrorHintForCode(err.code)
}}</span>
</div>
<div class="order-result-error-tooltip-row order-result-error-tooltip-row--msg">
<span class="order-result-error-tooltip-k">信息</span>
<span class="order-result-error-tooltip-v">{{ err.message || '—' }}</span>
</div>
</div>
<span class="order-result-error-compact">{{ volcTaskErrorCellSummary(err) }}</span>
</el-tooltip>
</span>
</template>
<!-- 非链接内容如任务 id可点击尝试拉取视频 -->
<span v-else @click="handleOtherEvent(scope.row)">{{ scope.row.result }}</span> <span v-else @click="handleOtherEvent(scope.row)">{{ scope.row.result }}</span>
</template> </template>
</el-table-column> </el-table-column>
@ -145,7 +176,7 @@
>{{ scope.row.text}}</div> >{{ scope.row.text}}</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="置顶" align="center" key="status"> <el-table-column label="置顶" align="center" key="status" width="60">
<template slot-scope="scope"> <template slot-scope="scope">
<el-switch <el-switch
v-model="scope.row.isTop" v-model="scope.row.isTop"
@ -155,9 +186,9 @@
></el-switch> ></el-switch>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" /> <el-table-column label="创建时间" align="center" prop="createTime" width="150"/>
<el-table-column label="状态" align="center" prop="status" :formatter="formatStatus" /> <el-table-column label="状态" align="center" prop="status" :formatter="formatStatus" width="70"/>
<el-table-column label="来源" align="center" prop="source" /> <el-table-column label="来源" align="center" prop="source" width="70"/>
</el-table> </el-table>
<pagination <pagination
@ -304,23 +335,70 @@ export default {
row.isTop = row.isTop === "Y" ? "N" : "Y"; row.isTop = row.isTop === "Y" ? "N" : "Y";
}); });
}, },
// URL // http(s) URL portal-ui
isUrl(str) { isUrl(str) {
const urlRegex = /^(https?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})([\/\w.-]*)*\/?$/; const value = String(str || "").trim();
return urlRegex.test(str); return /^https?:\/\//i.test(value);
}, },
// /** 已知错误码对应中文说明(与门户 VideoGen 一致) */
volcTaskErrorHintForCode(code) {
const c = String(code || "").trim();
const hints = {
OutputVideoSensitiveContentDetected: "输出视频可能包含敏感信息",
InvalidParameter: "请求参数无效"
};
return hints[c] || "";
},
/** 表格内摘要:已知码只显示中文,未知码显示 code */
volcTaskErrorCellSummary(err) {
if (!err) return "—";
const code = String(err.code || "").trim();
const hint = this.volcTaskErrorHintForCode(code);
if (hint) return hint;
if (code) return code;
const msg = String(err.message || "").trim();
return msg ? msg.slice(0, 32) + (msg.length > 32 ? "…" : "") : "—";
},
/** 已知火山错误码后附中文说明(括号),导出等场景可用 */
volcFailureCodeWithHint(code) {
const c = String(code || "").trim();
if (!c) return "";
const hint = this.volcTaskErrorHintForCode(c);
return hint ? `${c}${hint}` : c;
},
/** result 为火山回调失败写入的 VideoTaskError JSON 时解析为 { code, message } */
parseVolcTaskErrorJson(str) {
const s = String(str || "").trim();
if (!s || s[0] !== "{") return null;
try {
const o = JSON.parse(s);
if (
o &&
typeof o === "object" &&
!Array.isArray(o) &&
("code" in o || "message" in o)
) {
return {
code: o.code != null ? String(o.code) : "",
message: o.message != null ? String(o.message) : ""
};
}
} catch (_) {
/* ignore */
}
return null;
},
// portal-ui GeneratedAssets
isImage(url) { isImage(url) {
console.log(url) const value = String(url || "").trim();
const imageExtensions = /\.(jpg|jpeg|png|gif|bmp|webp)$/i; if (!value) return false;
var b = imageExtensions.test(url); return /\.(jpeg|jpg|png|gif|webp|bmp)(\?.*)?$/i.test(value);
console.log(b)
return imageExtensions.test(url);
}, },
// // portal-ui VideoGen/GeneratedAssets
isVideo(url) { isVideo(url) {
const videoExtensions = /\.(mp4|avi|mov|wmv|flv|webm)$/i; const value = String(url || "").trim();
return videoExtensions.test(url); if (!value) return false;
return /\.(mp4|mov|webm|ogg|m4v|avi|mkv)(\?.*)?$/i.test(value);
}, },
// //
viewImage(url) { viewImage(url) {
@ -334,6 +412,7 @@ export default {
}, },
// //
async handleOtherEvent(row) { async handleOtherEvent(row) {
if (this.parseVolcTaskErrorJson(row.result)) return;
// //
if (row.isDownloading) return; if (row.isDownloading) return;
const originalResult = row.result; const originalResult = row.result;
@ -510,6 +589,56 @@ export default {
height: auto; height: auto;
} }
.order-result-error-wrap {
display: inline-block;
}
.order-result-error-compact {
display: inline-block;
max-width: 200px;
margin: 0 auto;
font-size: 12px;
line-height: 1.35;
color: #c45656;
cursor: help;
text-align: center;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
vertical-align: middle;
}
.order-result-error-tooltip-body {
max-width: 420px;
text-align: left;
line-height: 1.5;
font-size: 12px;
}
.order-result-error-tooltip-row {
margin-bottom: 6px;
}
.order-result-error-tooltip-row:last-child {
margin-bottom: 0;
}
.order-result-error-tooltip-row--msg .order-result-error-tooltip-v {
display: block;
margin-top: 2px;
white-space: pre-wrap;
word-break: break-word;
}
.order-result-error-tooltip-k {
font-weight: 600;
color: #fde2e2;
}
.order-result-error-tooltip-v {
color: #fff;
}
.text-ellipsis-two-lines { .text-ellipsis-two-lines {
/* 必须设置宽度(继承表格列宽,也可手动指定) */ /* 必须设置宽度(继承表格列宽,也可手动指定) */
width: 100%; width: 100%;

View File

@ -50,6 +50,16 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="归属部门" prop="deptId">
<treeselect
v-model="queryParams.deptId"
:options="deptOptions"
:normalizer="deptNormalizer"
placeholder="全部"
clearable
style="width: 220px"
/>
</el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
@ -57,6 +67,27 @@
</el-form> </el-form>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['ai:user:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete()"
v-hasPermi="['ai:user:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="warning" type="warning"
@ -78,6 +109,7 @@
<el-table-column label="上级ID" align="center" prop="superiorUuid" /> <el-table-column label="上级ID" align="center" prop="superiorUuid" />
<el-table-column label="上级账号" align="center" prop="superiorName" /> <el-table-column label="上级账号" align="center" prop="superiorName" />
<el-table-column label="用户昵称" align="center" prop="nickname" /> <el-table-column label="用户昵称" align="center" prop="nickname" />
<el-table-column label="归属部门" align="center" prop="deptName" width="120" show-overflow-tooltip />
<el-table-column label="邮箱" align="center" prop="email" /> <el-table-column label="邮箱" align="center" prop="email" />
<el-table-column label="性别" align="center" prop="gender"> <el-table-column label="性别" align="center" prop="gender">
<template slot-scope="scope"> <template slot-scope="scope">
@ -103,8 +135,15 @@
</el-table-column> </el-table-column>
<el-table-column label="余额" align="center" prop="balance" /> <el-table-column label="余额" align="center" prop="balance" />
<el-table-column label="source" align="center" prop="source" /> <el-table-column label="source" align="center" prop="source" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="180"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="310">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-office-building"
@click="handleOpenAssignDept(scope.row)"
v-hasPermi="['ai:user:edit']"
>分配部门</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
@ -119,6 +158,13 @@
@click="updateBalance(scope.row)" @click="updateBalance(scope.row)"
v-hasPermi="['ai:user:remove']" v-hasPermi="['ai:user:remove']"
>修改余额</el-button> >修改余额</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['ai:user:remove']"
>删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -132,8 +178,24 @@
/> />
<!-- 添加或修改ai-用户信息对话框 --> <!-- 添加或修改ai-用户信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="520px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="88px">
<el-form-item label="用户账号" prop="username">
<el-input
v-model="form.username"
placeholder="门户登录账号,必填"
:disabled="form.id != null"
/>
</el-form-item>
<el-form-item label="密码" prop="password">
<el-input
v-model="form.password"
type="password"
show-password
:placeholder="form.id != null ? '不填表示不修改密码' : '请输入登录密码'"
autocomplete="new-password"
/>
</el-form-item>
<el-form-item label="用户昵称" prop="nickname"> <el-form-item label="用户昵称" prop="nickname">
<el-input v-model="form.nickname" placeholder="请输入用户昵称" /> <el-input v-model="form.nickname" placeholder="请输入用户昵称" />
</el-form-item> </el-form-item>
@ -158,10 +220,10 @@
<el-form-item label="余额" prop="balance"> <el-form-item label="余额" prop="balance">
<el-input v-model="form.balance" placeholder="请输入余额" /> <el-input v-model="form.balance" placeholder="请输入余额" />
</el-form-item> </el-form-item>
</el-form>
<el-form-item label="备注" prop="remark"> <el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" /> <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form-item> </el-form-item>
</el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button> <el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button> <el-button @click="cancel"> </el-button>
@ -182,6 +244,25 @@
</div> </div>
</el-dialog> </el-dialog>
<!-- 分配部门 -->
<el-dialog title="分配归属部门" :visible.sync="assignDeptOpen" width="480px" append-to-body @close="cancelAssignDept">
<el-form label-width="88px">
<el-form-item label="归属部门">
<treeselect
v-model="assignForm.deptId"
:options="deptOptions"
:normalizer="deptNormalizer"
placeholder="不选则不归属任何部门"
clearable
/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitAssignDept"> </el-button>
<el-button @click="cancelAssignDept"> </el-button>
</div>
</el-dialog>
<!-- 修改余额对话框 --> <!-- 修改余额对话框 -->
<el-dialog :title="title" :visible.sync="openUpdateBalance" width="500px" append-to-body> <el-dialog :title="title" :visible.sync="openUpdateBalance" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="80px">
@ -207,12 +288,17 @@ import {
updateUser, updateUser,
changeBalance, changeBalance,
changeUserStatus, changeUserStatus,
updatePassword updatePassword,
assignAiUserDept
} from "@/api/ai/user"; } from "@/api/ai/user";
import { listDept } from "@/api/ai/dept";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default { export default {
name: "User", name: "User",
dicts: ["sys_normal_disable", "sys_user_sex"], dicts: ["sys_normal_disable", "sys_user_sex"],
components: { Treeselect },
data() { data() {
return { return {
// //
@ -235,6 +321,12 @@ export default {
open: false, open: false,
openUpdatePassword: false, openUpdatePassword: false,
openUpdateBalance: false, openUpdateBalance: false,
assignDeptOpen: false,
deptOptions: [],
assignForm: {
id: null,
deptId: null
},
// //
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
@ -252,25 +344,73 @@ export default {
paymentUrl: null, paymentUrl: null,
loginTime: null, loginTime: null,
balance: null, balance: null,
superiorName: null superiorName: null,
deptId: null
}, },
// //
form: {}, form: {},
// //
rules: { rules: {
delFlag: [ username: [{ required: true, message: "用户账号不能为空", trigger: "blur" }],
{ required: true, message: "删除标志不能为空", trigger: "blur" } password: [
], {
phone: [ validator: (rule, value, callback) => {
{ required: true, message: "手机号码不能为空", trigger: "blur" } if (this.form.id == null && (!value || !String(value).trim())) {
callback(new Error("密码不能为空"));
} else {
callback();
}
},
trigger: "blur"
}
] ]
} }
}; };
}, },
created() { created() {
this.loadDeptTree();
this.getList(); this.getList();
}, },
methods: { methods: {
loadDeptTree() {
listDept().then(res => {
this.deptOptions = this.handleTree(res.data, "deptId");
});
},
deptNormalizer(node) {
if (node.children && !node.children.length) {
delete node.children;
}
return {
id: node.deptId,
label: node.deptName,
children: node.children
};
},
handleOpenAssignDept(row) {
getUser(row.id).then(res => {
this.assignForm = {
id: res.data.id,
deptId: res.data.deptId
};
this.assignDeptOpen = true;
});
},
submitAssignDept() {
const payload = {
id: this.assignForm.id,
deptId: this.assignForm.deptId != null ? this.assignForm.deptId : null
};
assignAiUserDept(payload).then(() => {
this.$modal.msgSuccess("已保存");
this.assignDeptOpen = false;
this.getList();
});
},
cancelAssignDept() {
this.assignDeptOpen = false;
this.assignForm = { id: null, deptId: null };
},
// //
handleCommand(command, row) { handleCommand(command, row) {
switch (command) { switch (command) {
@ -353,6 +493,7 @@ export default {
updateBy: null, updateBy: null,
updateTime: null, updateTime: null,
remark: null, remark: null,
username: null,
nickname: null, nickname: null,
gender: null, gender: null,
avatar: null, avatar: null,
@ -407,13 +548,17 @@ export default {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
if (this.form.id != null) { if (this.form.id != null) {
updateUser(this.form).then(response => { const payload = { ...this.form };
if (!payload.password || !String(payload.password).trim()) {
delete payload.password;
}
updateUser(payload).then(() => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.open = false; this.open = false;
this.getList(); this.getList();
}); });
} else { } else {
addUser(this.form).then(response => { addUser(this.form).then(() => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
this.open = false; this.open = false;
this.getList(); this.getList();
@ -434,11 +579,16 @@ export default {
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const ids = row.id || this.ids; const ids = row && row.id != null ? row.id : this.ids;
if (ids == null || (Array.isArray(ids) && !ids.length)) {
this.$modal.msgWarning("请选择要删除的数据");
return;
}
const idParam = Array.isArray(ids) ? ids.join(",") : ids;
this.$modal this.$modal
.confirm('是否确认删除ai-用户信息编号为"' + ids + '"的数据项?') .confirm('是否确认删除ai-用户信息编号为"' + idParam + '"的数据项?')
.then(function() { .then(() => {
return delUser(ids); return delUser(idParam);
}) })
.then(() => { .then(() => {
this.getList(); this.getList();

View File

@ -97,7 +97,7 @@
</el-table> </el-table>
<!-- 添加或修改部门对话框 --> <!-- 添加或修改部门对话框 -->
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="760px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-row> <el-row>
<el-col :span="24" v-if="form.parentId !== 0"> <el-col :span="24" v-if="form.parentId !== 0">
@ -148,6 +148,67 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row v-if="isSecondLevelCompanyForm">
<el-col :span="24">
<el-form-item label="Byte API Key">
<el-input
v-model="form.byteApiKey"
type="password"
show-password
placeholder="选填"
maxlength="255"
/>
</el-form-item>
</el-col>
</el-row>
<el-row v-if="isSecondLevelCompanyForm">
<el-col :span="24">
<el-form-item label="火山配置项目">
<el-input
v-model="form.project"
type="password"
show-password
placeholder="选填"
maxlength="255"
/>
</el-form-item>
</el-col>
</el-row>
<el-row v-if="isSecondLevelCompanyForm">
<el-col :span="24">
<el-form-item label="视频模型">
<div class="model-parm-block">
<div
v-for="(row, idx) in modelParamRows"
:key="'mp-' + idx"
class="model-parm-row"
>
<el-input
v-model="row.label"
placeholder="显示名称(如 Seedance 2.0"
class="model-parm-input-label"
/>
<el-input
v-model="row.value"
placeholder="Endpoint / 模型 IDep-…)"
class="model-parm-input-value"
/>
<el-button
type="text"
icon="el-icon-delete"
:disabled="modelParamRows.length <= 1"
@click="removeModelParamRow(idx)"
/>
</div>
<el-button type="text" icon="el-icon-plus" @click="addModelParamRow">添加模型</el-button>
<p class="model-parm-hint">
保存为 JSON 写入 model_parm门户视频生成按用户所属二级部门读取
留空则使用 portal.video.models
</p>
</div>
</el-form-item>
</el-col>
</el-row>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button> <el-button type="primary" @click="submitForm"> </el-button>
@ -157,6 +218,31 @@
</div> </div>
</template> </template>
<style scoped>
.model-parm-block {
width: 100%;
}
.model-parm-row {
display: flex;
align-items: center;
margin-bottom: 8px;
}
.model-parm-input-label {
width: 38%;
margin-right: 8px;
}
.model-parm-input-value {
flex: 1;
margin-right: 8px;
}
.model-parm-hint {
margin: 8px 0 0;
font-size: 12px;
color: #909399;
line-height: 1.5;
}
</style>
<script> <script>
import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild } from "@/api/system/dept" import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild } from "@/api/system/dept"
import Treeselect from "@riophae/vue-treeselect" import Treeselect from "@riophae/vue-treeselect"
@ -191,6 +277,7 @@ export default {
}, },
// //
form: {}, form: {},
modelParamRows: [{ label: '', value: '' }],
// //
rules: { rules: {
parentId: [ parentId: [
@ -222,7 +309,54 @@ export default {
created() { created() {
this.getList() this.getList()
}, },
computed: {
/** 二级公司ancestors 为 0,100即上级为根公司 dept_id=100 */
isSecondLevelCompanyForm() {
if (this.form.ancestors === "0,100") {
return true
}
const pid = this.form.parentId
if (pid !== undefined && pid !== null && Number(pid) === 100) {
return true
}
return false
}
},
methods: { methods: {
syncModelRowsFromForm() {
this.modelParamRows = [{ label: '', value: '' }]
const raw = this.form.modelParm
if (!raw || String(raw).trim() === '') {
return
}
try {
const arr = JSON.parse(raw)
if (Array.isArray(arr) && arr.length) {
this.modelParamRows = arr.map(x => ({
label: (x && x.label) ? String(x.label) : '',
value: (x && x.value) ? String(x.value) : ''
}))
}
} catch (e) {
this.modelParamRows = [{ label: '', value: '' }]
}
},
buildModelParmPayload() {
if (!this.isSecondLevelCompanyForm) {
return
}
const rows = (this.modelParamRows || []).filter(r => r.label && r.value)
this.form.modelParm = rows.length ? JSON.stringify(rows) : ''
},
addModelParamRow() {
this.modelParamRows.push({ label: '', value: '' })
},
removeModelParamRow(idx) {
if (this.modelParamRows.length <= 1) {
return
}
this.modelParamRows.splice(idx, 1)
},
/** 查询部门列表 */ /** 查询部门列表 */
getList() { getList() {
this.loading = true this.loading = true
@ -252,13 +386,18 @@ export default {
this.form = { this.form = {
deptId: undefined, deptId: undefined,
parentId: undefined, parentId: undefined,
ancestors: undefined,
deptName: undefined, deptName: undefined,
orderNum: undefined, orderNum: undefined,
leader: undefined, leader: undefined,
phone: undefined, phone: undefined,
email: undefined, email: undefined,
byteApiKey: undefined,
project: undefined,
modelParm: undefined,
status: "0" status: "0"
} }
this.modelParamRows = [{ label: '', value: '' }]
this.resetForm("form") this.resetForm("form")
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
@ -295,6 +434,7 @@ export default {
this.reset() this.reset()
getDept(row.deptId).then(response => { getDept(row.deptId).then(response => {
this.form = response.data this.form = response.data
this.syncModelRowsFromForm()
this.open = true this.open = true
this.title = "修改部门" this.title = "修改部门"
listDeptExcludeChild(row.deptId).then(response => { listDeptExcludeChild(row.deptId).then(response => {
@ -310,6 +450,7 @@ export default {
submitForm: function() { submitForm: function() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
this.buildModelParmPayload()
if (this.form.deptId != undefined) { if (this.form.deptId != undefined) {
updateDept(this.form).then(response => { updateDept(this.form).then(response => {
this.$modal.msgSuccess("修改成功") this.$modal.msgSuccess("修改成功")

View File

@ -4,3 +4,4 @@ VITE_AMAP_SAFE_KEY = 23d3fdbc6b4eaf65d4a82a16510938c9
VITE_REGISTER_SOURCE=ALL VITE_REGISTER_SOURCE=ALL
#VITE_REGISTER_SOURCE=XM001 #VITE_REGISTER_SOURCE=XM001
VITE_SHOW_PAY=SUCCESS VITE_SHOW_PAY=SUCCESS
VITE_API_URL=http://111.230.37.169:10004/api

View File

@ -1,3 +1,4 @@
# 端口 # 端口(等号两侧不要空格,避免解析出带空格的 target
VITE_PORT=8887 VITE_PORT=8887
VITE_API_URL = https://api.undressing.name/api # 仅 dev 时给 vite 代理用;若与 .env.development.local 冲突,以 .local 为准
VITE_API_URL=http://47.86.170.114:8011/api

View File

@ -1,3 +0,0 @@
# 是否生成打包分析图表
VITE_VISUALIZER = false
VITE_API_URL = https://api.undressing.name/api

View File

@ -10,7 +10,7 @@ yarn-error.log*
/test/e2e/reports/ /test/e2e/reports/
selenium-debug.log selenium-debug.log
nodejs/public/uploads nodejs/public/uploads
*.zip
# Editor directories and files # Editor directories and files
.idea .idea
.vscode .vscode

View File

@ -5,10 +5,9 @@
<meta <meta
name="viewport" name="viewport"
content="width=device-width,initial-scale=1.0, maximum-scale=1.0,minimum-scale=1.0" /> content="width=device-width,initial-scale=1.0, maximum-scale=1.0,minimum-scale=1.0" />
<link <link rel="icon" href="/images/favicon.svg" type="image/svg+xml" />
rel="icon" <link rel="alternate icon" href="/images/default/logo.jpg" type="image/jpeg" />
href="/images/logo.png" /> <title>智绘影视</title>
<title>asio</title>
</head> </head>
<body> <body>
<div id="app"></div> <div id="app"></div>

View File

@ -1,3 +1,5 @@
@import './var.less';
html, html,
body { body {
width: 100%; width: 100%;
@ -17,31 +19,38 @@ body {
body { body {
font-size: 14px; font-size: 14px;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
color: #1f2329; color: var(--portal-text-strong);
font-family: 'PingFang SC', 'Microsoft YaHei', Arial, sans-serif; font-family: 'PingFang SC', 'Microsoft YaHei', Arial, sans-serif;
overflow: hidden; overflow: hidden;
position: relative; position: relative;
background-color: var(--portal-bg-deep);
}
body:not([arco-theme='dark']) {
color: #1f2329;
background-color: #f8fafc;
} }
// firefox 滚动条样式 // firefox 滚动条样式
* { * {
scrollbar-color: rgba(144, 147, 153, 0.5) #0f0f12; scrollbar-color: rgba(34, 211, 238, 0.35) var(--portal-bg-surface);
} }
/*滚动条整体样式*/ /*滚动条整体样式*/
::-webkit-scrollbar { ::-webkit-scrollbar {
background-color: #0f0f12; background-color: var(--portal-bg-surface);
} }
/*滚动条里面小方块*/ /*滚动条里面小方块*/
::-webkit-scrollbar-thumb { ::-webkit-scrollbar-thumb {
background-color: red; background: linear-gradient(180deg, rgba(34, 211, 238, 0.45), rgba(56, 189, 248, 0.25));
border: 3px solid #0f0f12; border: 3px solid var(--portal-bg-surface);
border-radius: 8px;
} }
/*滚动条里面轨道*/ /*滚动条里面轨道*/
::-webkit-scrollbar-track { ::-webkit-scrollbar-track {
background: #0f0f12; background: var(--portal-bg-surface);
} }
:focus { :focus {
@ -195,11 +204,11 @@ fieldset {
padding: 20px 10px; padding: 20px 10px;
font-size: 14px; font-size: 14px;
font-weight: bold; font-weight: bold;
color: #fd8000; color: rgb(var(--primary-6));
} }
.page-error { .page-error {
color: red; color: #fbbf24;
font-size: 20px; font-size: 20px;
padding: 30px; padding: 30px;
} }
@ -240,14 +249,15 @@ input:-webkit-autofill {
width: 100vw !important; width: 100vw !important;
height: 100vh !important; height: 100vh !important;
z-index: 100 !important; z-index: 100 !important;
background: #fff; background: var(--portal-bg-deep);
padding: 12px !important; padding: 12px !important;
} }
.arco-modal-simple { .arco-modal-simple {
background: #0f0f12; background: var(--portal-bg-raised);
border-radius: 10px; border-radius: 10px;
border: 2px solid #e6217a; border: 1px solid var(--portal-border-glow);
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4), 0 24px 48px rgba(0, 0, 0, 0.45);
.arco-modal-title { .arco-modal-title {
color: #fff; color: #fff;
} }
@ -257,11 +267,13 @@ input:-webkit-autofill {
.arco-modal-footer { .arco-modal-footer {
.arco-btn-secondary { .arco-btn-secondary {
color: #ffffff; color: #fff;
background-color: #1a1a1a; background-color: rgba(30, 41, 59, 0.35);
border: 1px solid #1a1a1a; border: 1px solid rgba(92, 107, 138, 0.45);
&:hover { &:hover {
background-color: #262626; color: #fff;
background-color: rgba(30, 41, 59, 0.55);
border-color: #5c6b8a;
} }
} }
} }

View File

@ -0,0 +1,99 @@
/**
* 全站按钮:暗色主题下文字统一为白色;线框/文本/虚线在亮色主题保留灰字以保证对比度
* 不改动 danger 状态按钮
*/
@portal-btn-slate: #1e293b;
@portal-btn-slate-hover: #334155;
@portal-btn-slate-active: #0f172a;
@portal-btn-gray: #5c6b8a;
@portal-btn-gray-hover: #94a3b8;
.arco-btn-primary:not(.arco-btn-disabled):not(.arco-btn-status-danger) {
background-color: @portal-btn-slate !important;
border-color: @portal-btn-slate !important;
color: #fff !important;
&:hover {
background-color: @portal-btn-slate-hover !important;
border-color: @portal-btn-slate-hover !important;
color: #fff !important;
}
&:active {
background-color: @portal-btn-slate-active !important;
border-color: @portal-btn-slate-active !important;
color: #fff !important;
}
}
.arco-btn-secondary:not(.arco-btn-disabled):not(.arco-btn-status-danger) {
background-color: rgba(30, 41, 59, 0.42) !important;
border: 1px solid rgba(92, 107, 138, 0.45) !important;
color: #fff !important;
&:hover {
background-color: rgba(30, 41, 59, 0.62) !important;
border-color: @portal-btn-gray !important;
color: #fff !important;
}
}
.arco-btn-outline:not(.arco-btn-disabled):not(.arco-btn-status-danger) {
background-color: transparent !important;
border-color: rgba(92, 107, 138, 0.55) !important;
color: #fff !important;
&:hover {
border-color: @portal-btn-gray !important;
color: #fff !important;
background-color: rgba(92, 107, 138, 0.08) !important;
}
}
.arco-btn-outline.arco-btn-primary:not(.arco-btn-disabled):not(.arco-btn-status-danger) {
background-color: transparent !important;
border-color: rgba(92, 107, 138, 0.55) !important;
color: #fff !important;
&:hover {
border-color: @portal-btn-gray !important;
color: #fff !important;
background-color: rgba(92, 107, 138, 0.1) !important;
}
}
.arco-btn-text:not(.arco-btn-disabled):not(.arco-btn-status-danger) {
color: #fff !important;
background-color: transparent !important;
&:hover {
color: #fff !important;
background-color: rgba(148, 163, 184, 0.08) !important;
}
}
.arco-btn-dashed:not(.arco-btn-disabled):not(.arco-btn-status-danger) {
color: #fff !important;
border-color: rgba(92, 107, 138, 0.5) !important;
background-color: transparent !important;
&:hover {
color: #fff !important;
border-color: @portal-btn-gray !important;
background-color: rgba(92, 107, 138, 0.06) !important;
}
}
/* 亮色主题:透明底按钮若仍用白字会看不清,恢复石板灰字 */
body:not([arco-theme='dark']) {
.arco-btn-outline:not(.arco-btn-disabled):not(.arco-btn-status-danger),
.arco-btn-outline.arco-btn-primary:not(.arco-btn-disabled):not(.arco-btn-status-danger),
.arco-btn-text:not(.arco-btn-disabled):not(.arco-btn-status-danger),
.arco-btn-dashed:not(.arco-btn-disabled):not(.arco-btn-status-danger) {
color: @portal-btn-gray !important;
&:hover {
color: @portal-btn-gray-hover !important;
}
}
}

File diff suppressed because one or more lines are too long

View File

@ -615,4 +615,4 @@
right: 15px right: 15px
} }
/*# sourceMappingURL=quill.core.css.map*/ /* Quill core styles - source map removed to fix build error */

View File

@ -1286,4 +1286,4 @@
border: 1px solid #ccc border: 1px solid #ccc
} }
/*# sourceMappingURL=quill.snow.css.map*/ /* Quill snow styles - source map removed to fix build error */

View File

@ -1,10 +1,20 @@
/* Portal 主题令牌:暗色科技风基底 + 青/Cyan 点缀 */
body { body {
// 背景色 - 浅 --portal-bg-void: #06080d;
--portal-bg-deep: #0a0e14;
--portal-bg-surface: #0f141c;
--portal-bg-raised: #141b26;
--portal-border-subtle: rgba(148, 163, 184, 0.12);
--portal-border-glow: rgba(34, 211, 238, 0.22);
--portal-text-strong: rgba(248, 250, 252, 0.96);
--portal-text-muted: rgba(148, 163, 184, 0.85);
--portal-accent: #22d3ee;
--portal-accent-soft: rgba(34, 211, 238, 0.14);
// 背景色 - 浅(兼容旧变量)
--mf-color-bg-3: #f8f8fa; --mf-color-bg-3: #f8f8fa;
--his-border-color: rgb(166, 124, 82, 0.3); --his-border-color: rgb(166, 124, 82, 0.3);
} }
body[arco-theme='dark'] { body[arco-theme='dark'] {
// 背景色 - 浅 --mf-color-bg-3: #0f141c;
--mf-color-bg-3: #17171a;
} }

View File

@ -8,10 +8,6 @@
fullscreen fullscreen
:class="`${prefixCls}-wrapper`" :class="`${prefixCls}-wrapper`"
:modal-class="`${prefixCls}-dialog`"> :modal-class="`${prefixCls}-dialog`">
<mf-video
autoplay
:controls="false"
modelValue="https://images.iqyjsnwv.com/tmp/hello-BCSGJ8fP.mp4" />
<div :class="`${prefixCls}-shadow`"> <div :class="`${prefixCls}-shadow`">
<div :class="`${prefixCls}-title`"> <div :class="`${prefixCls}-title`">
{{ $t('common.fbTitle') }} {{ $t('common.fbTitle') }}
@ -38,6 +34,8 @@
</template> </template>
<script> <script>
import i18n from '@/lang/i18n'
export default { export default {
name: 'mf-forbidden', name: 'mf-forbidden',
data() { data() {
@ -53,7 +51,13 @@ export default {
this.$router.replace('/403') this.$router.replace('/403')
}, },
ok() { ok() {
this.$store.dispatch('main/setForbidden', false) // 18+
Promise.resolve(this.$store.dispatch('main/setForbidden', false)).finally(() => {
// zh_HK
this.$store.dispatch('main/setLanguage', 'zh_HK')
i18n.global.locale = 'zh_HK'
this.$router.push({ name: 'index' })
})
} }
} }
} }

View File

@ -43,7 +43,7 @@ export default {
overflow: hidden; overflow: hidden;
background: #0f0f12; background: #0f0f12;
border-radius: 20px; border-radius: 20px;
border: 2px solid #e6217a; border: 1px solid rgb(var(--primary-6));
height: 520px; height: 520px;
width: 864px; width: 864px;
top: 45% !important; top: 45% !important;

View File

@ -528,7 +528,7 @@ export default {
rgba(230, 33, 122, 0.7) 49% rgba(230, 33, 122, 0.7) 49%
); );
border-radius: 20px; border-radius: 20px;
border: 2px solid #e6217a; border: 1px solid rgb(var(--primary-6));
width: 500px; width: 500px;
// height: 320px; // height: 320px;
top: 45% !important; top: 45% !important;
@ -629,7 +629,7 @@ export default {
rgba(230, 33, 122, 0.7) 49% rgba(230, 33, 122, 0.7) 49%
); );
border-radius: 20px; border-radius: 20px;
border: 2px solid #e6217a; border: 1px solid rgb(var(--primary-6));
width: 600px; width: 600px;
max-height: 90vh; max-height: 90vh;
overflow-y: auto; overflow-y: auto;
@ -701,7 +701,7 @@ export default {
:deep(.arco-select-dropdown) { :deep(.arco-select-dropdown) {
background-color: rgba(39, 20, 51, 0.95); background-color: rgba(39, 20, 51, 0.95);
border: 1px solid #e6217a; border: 1px solid rgb(var(--primary-6));
} }
:deep(.arco-select-option) { :deep(.arco-select-option) {

View File

@ -126,7 +126,7 @@ export default {
overflow: hidden; overflow: hidden;
background: #0f0f12; background: #0f0f12;
border-radius: 20px; border-radius: 20px;
border: 2px solid #e6217a; border: 1px solid rgb(var(--primary-6));
width: 500px; width: 500px;
top: 45% !important; top: 45% !important;
transform: translateY(-45%) !important; transform: translateY(-45%) !important;

View File

@ -0,0 +1,460 @@
<template>
<div class="rich-editor-root">
<!-- 工具栏 -->
<div class="toolbar">
<button class="tool-btn" type="button" @click="execCommand('bold')"><b>B</b></button>
<button class="tool-btn" type="button" @click="execCommand('italic')"><i>I</i></button>
<button class="tool-btn" type="button" @click="openImagePicker">{{ $t('common.insertImage') || '插入图片' }}</button>
<button class="tool-btn" type="button" @click="clear">清空</button>
</div>
<!-- 隐藏的文件输入 -->
<input
ref="fileInputRef"
class="hidden-input"
type="file"
accept="image/*"
multiple
@change="handleSelectFiles"
/>
<!-- 编辑器区域 -->
<div
ref="editorRef"
class="user-input rich-editor"
contenteditable="true"
:data-placeholder="placeholder || '请输入文本...'"
@input="handleInput"
@keyup="handleKeyup"
@click="handleEditorClick"
@keydown="handleKeydown"
@paste="handlePaste"
></div>
<!-- @ 图片选择面板 -->
<div v-if="mentionVisible" class="mention-panel">
<div
v-for="(item, idx) in mentionImageList"
:key="item.url"
class="mention-item"
@mousedown.prevent="insertMentionImage(item)"
>
<img :src="item.url" class="mention-thumb" />
<span class="mention-label">@{{ idx + 1 }}</span>
</div>
<div v-if="mentionImageList.length === 0" class="mention-empty">
{{ $t('common.noImageToMention') || '暂无可引用图片' }}
</div>
</div>
</div>
</template>
<script>
import { nextTick, onMounted, ref, watch } from 'vue'
import { uploadFile, extractUploadUrlFromResponse, PORTAL_TENCENT_COS_UPLOAD_URL } from '@/utils/file'
export default {
name: 'RichTextEditor',
props: {
modelValue: {
type: String,
default: ''
},
placeholder: {
type: String,
default: '请输入文本生成视频...'
},
uploadedImages: {
type: Array,
default: () => []
}
},
emits: ['update:modelValue', 'text-change', 'image-upload'],
setup(props, { emit }) {
const editorRef = ref(null)
const fileInputRef = ref(null)
const savedSelectionRange = ref(null)
const mentionVisible = ref(false)
const mentionImageList = ref([])
const MAX_IMAGE_COUNT = 4
//
const execCommand = (command) => {
if (!editorRef.value) return
editorRef.value.focus()
document.execCommand(command, false, null)
handleInput()
}
//
const openImagePicker = () => {
if (fileInputRef.value) {
fileInputRef.value.click()
}
}
// -
const handleSelectFiles = async (event) => {
const files = event.target.files
if (!files.length) return
for (let file of files) {
if (file.type.startsWith('image/')) {
try {
//
const loading = window.$message ? window.$message.loading('上传中...') : null
//
const res = await uploadFile({
url: PORTAL_TENCENT_COS_UPLOAD_URL,
file: file,
name: 'file'
})
const imageUrl = extractUploadUrlFromResponse(res)
if (res && (Number(res.code) === 200 || res.code === 200) && imageUrl) {
insertImage(imageUrl, file.name)
// @
emit('image-upload', { url: imageUrl, name: file.name })
} else {
console.error('上传失败:', res)
alert('图片上传失败')
}
} catch (error) {
console.error('上传图片出错:', error)
alert('图片上传失败: ' + (error.message || '未知错误'))
}
}
}
// input
event.target.value = ''
}
//
const insertImage = (url, name = 'image') => {
if (!editorRef.value) return
editorRef.value.focus()
const selection = window.getSelection()
if (!selection) return
const img = document.createElement('img')
img.src = url
img.alt = name
img.style.maxWidth = '100%'
img.style.height = 'auto'
img.style.margin = '4px 0'
img.setAttribute('data-image-name', name)
const range = selection.getRangeAt(0)
range.deleteContents()
range.insertNode(img)
//
const space = document.createTextNode(' ')
range.setStartAfter(img)
range.setEndAfter(img)
range.insertNode(space)
handleInput()
}
//
const handleInput = () => {
if (!editorRef.value) return
const content = editorRef.value.innerHTML
emit('update:modelValue', content)
emit('text-change', content)
}
//
const handleKeyup = (e) => {
if (e.key === '@') {
showMentionPanel()
} else if (e.key === 'Escape' && mentionVisible.value) {
mentionVisible.value = false
}
}
const handleKeydown = (e) => {
if (e.key === '@') {
//
const selection = window.getSelection()
if (selection && selection.rangeCount > 0) {
savedSelectionRange.value = selection.getRangeAt(0).cloneRange()
}
}
}
const insertPlainTextAtCursor = (text) => {
if (!editorRef.value || text == null) return
const normalized = String(text).replace(/\r\n/g, '\n').replace(/\r/g, '\n')
editorRef.value.focus()
const selection = window.getSelection()
if (!selection || selection.rangeCount === 0) return
let range = selection.getRangeAt(0)
if (!editorRef.value.contains(range.commonAncestorContainer)) {
const r = document.createRange()
r.selectNodeContents(editorRef.value)
r.collapse(false)
selection.removeAllRanges()
selection.addRange(r)
range = selection.getRangeAt(0)
}
range.deleteContents()
const lines = normalized.split('\n')
const fragment = document.createDocumentFragment()
lines.forEach((line, index) => {
if (line) fragment.appendChild(document.createTextNode(line))
if (index < lines.length - 1) fragment.appendChild(document.createElement('br'))
})
range.insertNode(fragment)
range.collapse(false)
selection.removeAllRanges()
selection.addRange(range)
}
const handlePaste = (e) => {
if (!editorRef.value) return
const cd = e.clipboardData
if (!cd) return
const items = cd.items
if (items) {
for (let i = 0; i < items.length; i++) {
if (items[i].type.indexOf('image') !== -1) {
const blob = items[i].getAsFile()
const reader = new FileReader()
reader.onload = (event) => {
insertImage(event.target.result, 'pasted-image')
}
reader.readAsDataURL(blob)
e.preventDefault()
return
}
}
}
let text = cd.getData('text/plain') || ''
if (!text && cd.getData('text/html')) {
const tmp = document.createElement('div')
tmp.innerHTML = cd.getData('text/html')
text = tmp.innerText || ''
}
e.preventDefault()
insertPlainTextAtCursor(text)
handleInput()
}
// @
const showMentionPanel = () => {
if (props.uploadedImages && props.uploadedImages.length > 0) {
mentionImageList.value = props.uploadedImages.slice(0, MAX_IMAGE_COUNT)
mentionVisible.value = true
}
}
// @
const insertMentionImage = (imageItem) => {
if (!editorRef.value || !savedSelectionRange.value) {
mentionVisible.value = false
return
}
editorRef.value.focus()
const selection = window.getSelection()
if (selection) {
selection.removeAllRanges()
selection.addRange(savedSelectionRange.value)
}
const img = document.createElement('img')
img.src = imageItem.url
img.alt = '@图片'
img.style.maxWidth = '60px'
img.style.height = 'auto'
img.style.verticalAlign = 'middle'
img.setAttribute('data-mention', 'true')
const range = savedSelectionRange.value
range.deleteContents()
range.insertNode(img)
//
const space = document.createTextNode(' ')
range.setStartAfter(img)
range.setEndAfter(img)
range.insertNode(space)
mentionVisible.value = false
handleInput()
}
//
const clear = () => {
if (!editorRef.value) return
editorRef.value.innerHTML = ''
handleInput()
}
//
const handleEditorClick = () => {
if (mentionVisible.value) {
mentionVisible.value = false
}
}
// props
watch(() => props.modelValue, (newValue) => {
if (editorRef.value && editorRef.value.innerHTML !== newValue) {
editorRef.value.innerHTML = newValue || ''
}
})
//
watch(() => props.uploadedImages, (newImages) => {
mentionImageList.value = newImages || []
}, { immediate: true })
onMounted(() => {
if (editorRef.value) {
editorRef.value.innerHTML = props.modelValue || ''
}
})
return {
editorRef,
fileInputRef,
mentionVisible,
mentionImageList,
execCommand,
openImagePicker,
handleSelectFiles,
handleInput,
handleKeyup,
handleKeydown,
handlePaste,
handleEditorClick,
insertMentionImage,
clear
}
}
}
</script>
<style lang="less" scoped>
.rich-editor-root {
position: relative;
margin-bottom: 16px;
}
.toolbar {
display: flex;
gap: 8px;
margin-bottom: 8px;
padding: 8px;
background: #1a1b20;
border-radius: 6px;
border: 1px solid rgba(255,255,255,0.1);
.tool-btn {
padding: 6px 12px;
background: rgba(255,255,255,0.1);
border: none;
border-radius: 4px;
color: #fff;
cursor: pointer;
font-size: 14px;
&:hover {
background: rgba(255,255,255,0.2);
}
}
}
.rich-editor {
min-height: 120px;
padding: 12px;
background: #1a1b20;
border: 1px solid rgba(255,255,255,0.1);
border-radius: 6px;
color: #fff;
line-height: 1.6;
font-size: 14px;
outline: none;
overflow-y: auto;
/* 覆盖粘贴残留的内联颜色,保证深底上始终可读 */
:deep(*) {
color: #fff !important;
}
&:empty:before {
content: attr(data-placeholder);
color: #666;
pointer-events: none;
}
img {
max-width: 100%;
height: auto;
margin: 4px 0;
border-radius: 4px;
}
}
.mention-panel {
position: absolute;
top: 100%;
left: 0;
background: #1f2128;
border: 1px solid #3a3d47;
border-radius: 6px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
z-index: 1000;
max-height: 200px;
overflow-y: auto;
width: 280px;
.mention-item {
display: flex;
align-items: center;
padding: 8px 12px;
cursor: pointer;
border-bottom: 1px solid rgba(255,255,255,0.1);
&:hover {
background: #2a2d38;
}
&:last-child {
border-bottom: none;
}
.mention-thumb {
width: 40px;
height: 40px;
object-fit: cover;
border-radius: 4px;
margin-right: 12px;
}
.mention-label {
color: #a1a4b3;
font-size: 13px;
}
}
.mention-empty {
padding: 20px;
text-align: center;
color: #666;
font-size: 13px;
}
}
.hidden-input {
display: none;
}
</style>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,600 @@
<template>
<div class="video-editor-root">
<div v-if="showToolbar" class="toolbar">
<button class="tool-btn" type="button" @click="openImagePicker">插入参考素材</button>
<button class="tool-btn" type="button" @click="clear">清空所有参考素材和文字</button>
</div>
<input
ref="fileInputRef"
class="hidden-input"
type="file"
accept="image/*,video/*,audio/*"
multiple
@change="handleSelectFiles" />
<div class="editor-wrapper">
<div
ref="editorRef"
class="user-input video-rich-editor"
contenteditable="true"
:data-placeholder="placeholder || '请输入文本生成视频...'"
@input="handleInput"
@paste="handlePaste"
@keyup="handleKeyup"
@click="handleEditorClick"></div>
<div v-if="mentionVisible" class="mention-panel">
<div
v-for="item in mentionImageList"
:key="item.url"
class="mention-item"
@mousedown.prevent="insertMentionImage(item)">
<img v-if="item.mediaType === 'image'" :src="item.url" class="mention-thumb" alt="" />
<span v-else class="mention-type-badge">{{ item.mediaType === 'video' ? '视频' : '音频' }}</span>
<span class="mention-label">参考{{ item.refNo }}</span>
</div>
<div v-if="mentionImageList.length === 0" class="mention-empty">暂无可引用素材</div>
</div>
</div>
</div>
</template>
<script setup>
import { nextTick, onMounted, ref } from 'vue'
import { Message } from '@arco-design/web-vue'
import { uploadFile, extractUploadUrlFromResponse, PORTAL_TENCENT_COS_UPLOAD_URL } from '@/utils/file'
const props = defineProps({
placeholder: {
type: String,
default: ''
},
/** 文生视频等场景可隐藏工具栏,仅保留纯文本编辑 */
showToolbar: {
type: Boolean,
default: true
}
})
const emit = defineEmits(['text-change'])
const editorRef = ref(null)
const fileInputRef = ref(null)
const savedSelectionRange = ref(null)
const MAX_IMAGE_COUNT = 9
const mentionVisible = ref(false)
const mentionImageList = ref([])
const detectMediaType = (file) => {
const mime = (file?.type || '').toLowerCase()
if (mime.startsWith('image/')) return 'image'
if (mime.startsWith('video/')) return 'video'
if (mime.startsWith('audio/')) return 'audio'
const lowerName = (file?.name || '').toLowerCase()
if (/\.(png|jpe?g|gif|webp|bmp|svg)$/.test(lowerName)) return 'image'
if (/\.(mp4|mov|webm|m4v|avi|mkv)$/.test(lowerName)) return 'video'
if (/\.(mp3|wav|aac|m4a|ogg|flac)$/.test(lowerName)) return 'audio'
return 'image'
}
const getPlainText = () => (editorRef.value?.innerText || '').trim()
const focusEditorToEnd = () => {
if (!editorRef.value) return
editorRef.value.focus()
const selection = window.getSelection()
if (!selection) return
const range = document.createRange()
range.selectNodeContents(editorRef.value)
range.collapse(false)
selection.removeAllRanges()
selection.addRange(range)
savedSelectionRange.value = range.cloneRange()
}
const saveSelection = () => {
const selection = window.getSelection()
if (!selection || selection.rangeCount === 0) return
const range = selection.getRangeAt(0)
if (editorRef.value?.contains(range.commonAncestorContainer)) {
savedSelectionRange.value = range.cloneRange()
}
}
const restoreSelection = () => {
const selection = window.getSelection()
if (!selection || !editorRef.value) return
selection.removeAllRanges()
if (savedSelectionRange.value) {
selection.addRange(savedSelectionRange.value)
} else {
const range = document.createRange()
range.selectNodeContents(editorRef.value)
range.collapse(false)
selection.addRange(range)
}
}
const handleInput = () => {
emit('text-change', getPlainText())
saveSelection()
syncMentionPanelVisibility()
}
const insertPlainTextAtCursor = (text) => {
if (!editorRef.value) return
const normalizedText = text.replace(/\r\n/g, '\n').replace(/\r/g, '\n')
editorRef.value.focus()
restoreSelection()
const selection = window.getSelection()
if (!selection || selection.rangeCount === 0) return
let range = selection.getRangeAt(0)
if (!editorRef.value.contains(range.commonAncestorContainer)) {
focusEditorToEnd()
const currentSelection = window.getSelection()
if (!currentSelection || currentSelection.rangeCount === 0) return
range = currentSelection.getRangeAt(0)
}
range.deleteContents()
const lines = normalizedText.split('\n')
const fragment = document.createDocumentFragment()
lines.forEach((line, index) => {
if (line) fragment.appendChild(document.createTextNode(line))
if (index < lines.length - 1) fragment.appendChild(document.createElement('br'))
})
range.insertNode(fragment)
range.collapse(false)
selection.removeAllRanges()
selection.addRange(range)
saveSelection()
}
const handlePaste = (event) => {
if (!editorRef.value) return
event.preventDefault()
const clipboardText = event.clipboardData?.getData('text/plain') || ''
if (!clipboardText) return
insertPlainTextAtCursor(clipboardText)
emit('text-change', getPlainText())
syncMentionPanelVisibility()
}
const updateMentionImageList = () => {
mentionImageList.value = mentionImageList.value.slice(0, MAX_IMAGE_COUNT)
}
const hideMentionPanel = () => {
mentionVisible.value = false
}
const hasActiveMentionTriggerBeforeCursor = () => {
const selection = window.getSelection()
if (!selection || selection.rangeCount === 0) return false
const range = selection.getRangeAt(0)
if (!range.collapsed) return false
if (!editorRef.value?.contains(range.commonAncestorContainer)) return false
const container = range.startContainer
if (container.nodeType !== Node.TEXT_NODE) return false
const before = container.data.slice(0, range.startOffset)
const atIndex = before.lastIndexOf('@')
if (atIndex < 0) return false
const afterAt = before.slice(atIndex + 1)
return !/\s/.test(afterAt)
}
const syncMentionPanelVisibility = () => {
const shouldShow = hasActiveMentionTriggerBeforeCursor()
if (!shouldShow) {
hideMentionPanel()
return
}
updateMentionImageList()
mentionVisible.value = true
}
const removeMentionKeywordBeforeCursor = () => {
const selection = window.getSelection()
if (!selection || selection.rangeCount === 0) return
const range = selection.getRangeAt(0)
if (!range.collapsed) return
const container = range.startContainer
if (container.nodeType !== Node.TEXT_NODE) return
const before = container.data.slice(0, range.startOffset)
const atIndex = before.lastIndexOf('@')
if (atIndex < 0) return
const afterAt = before.slice(atIndex + 1)
if (/\s/.test(afterAt)) return
const removeRange = document.createRange()
removeRange.setStart(container, atIndex)
removeRange.setEnd(container, range.startOffset)
removeRange.deleteContents()
}
const insertReference = (item) => {
if (!item?.url || !editorRef.value) return
editorRef.value.focus()
restoreSelection()
const selection = window.getSelection()
if (!selection || selection.rangeCount === 0) return
const range = selection.getRangeAt(0)
if (!editorRef.value.contains(range.commonAncestorContainer)) return
const refNoText = `[图${item.refNo}]`
let node
if (item.mediaType === 'image') {
const img = document.createElement('img')
img.src = item.url
img.alt = `reference-${item.refNo}`
img.className = 'inline-rich-image'
img.setAttribute('data-image-url', item.url)
img.setAttribute('data-mention-reference', '1')
img.setAttribute('data-reference-no', String(item.refNo))
node = img
} else {
const tag = document.createElement('span')
tag.className = 'inline-rich-reference'
tag.textContent = refNoText
tag.setAttribute('data-reference-url', item.url)
tag.setAttribute('data-mention-reference', '1')
tag.setAttribute('data-reference-no', String(item.refNo))
tag.setAttribute('data-reference-type', item.mediaType)
node = tag
}
range.insertNode(node)
const space = document.createTextNode(' ')
range.setStartAfter(node)
range.insertNode(space)
range.setStartAfter(space)
range.collapse(true)
selection.removeAllRanges()
selection.addRange(range)
saveSelection()
}
const insertMentionImage = (item) => {
if (!item?.url || !editorRef.value) return
editorRef.value.focus()
restoreSelection()
removeMentionKeywordBeforeCursor()
// @ insertReference restoreSelection Range
saveSelection()
insertReference(item)
hideMentionPanel()
emit('text-change', getPlainText())
}
const handleKeyup = (event) => {
saveSelection()
if (event.key === '@') {
syncMentionPanelVisibility()
return
}
if (event.key === 'Escape') {
hideMentionPanel()
return
}
syncMentionPanelVisibility()
}
const handleEditorClick = () => {
const selection = window.getSelection()
if (!selection || selection.rangeCount === 0) {
focusEditorToEnd()
return
}
const range = selection.getRangeAt(0)
if (!editorRef.value?.contains(range.commonAncestorContainer)) {
focusEditorToEnd()
return
}
saveSelection()
syncMentionPanelVisibility()
}
const getInsertedUniqueImageCount = () => mentionImageList.value.length
const openImagePicker = () => {
const current = getInsertedUniqueImageCount()
if (current >= MAX_IMAGE_COUNT) {
Message.warning(`最多插入 ${MAX_IMAGE_COUNT} 个参考素材`)
return
}
fileInputRef.value?.click()
}
const uploadToCos = async (file) => {
const res = await uploadFile({
url: PORTAL_TENCENT_COS_UPLOAD_URL,
file,
name: 'file'
})
const codeOk = res && (Number(res.code) === 200 || res.code === 200)
const url = extractUploadUrlFromResponse(res)
if (codeOk && url) return url
throw new Error(res?.msg || '上传失败:未返回文件地址')
}
const handleSelectFiles = async (event) => {
const input = event.target
const files = Array.from(input.files || [])
if (!files.length) return
const remain = MAX_IMAGE_COUNT - getInsertedUniqueImageCount()
if (remain <= 0) {
Message.warning(`最多插入 ${MAX_IMAGE_COUNT} 个参考素材`)
input.value = ''
return
}
const selected = files.slice(0, remain)
if (files.length > remain) {
Message.warning(`最多插入 ${MAX_IMAGE_COUNT} 个参考素材,本次仅插入 ${remain}`)
}
for (const file of selected) {
const mediaType = detectMediaType(file)
try {
const url = await uploadToCos(file)
if (url && !mentionImageList.value.some((item) => item.url === url)) {
const refNo = mentionImageList.value.length + 1
mentionImageList.value.push({ url, refNo, mediaType })
}
} catch (e) {
Message.error('参考素材上传失败')
console.error(e)
}
}
input.value = ''
emit('text-change', getPlainText())
}
const getContentItems = () => {
const editor = editorRef.value
const items = []
if (!editor) return items
let textBuffer = ''
const flushText = () => {
const normalized = textBuffer.replace(/\u00a0/g, ' ').replace(/\s+\n/g, '\n')
if (normalized.trim()) items.push({ type: 'text', text: normalized.trim() })
textBuffer = ''
}
const walk = (node) => {
if (node.nodeType === Node.TEXT_NODE) {
textBuffer += node.textContent || ''
return
}
if (node.nodeType !== Node.ELEMENT_NODE) return
const el = node
const referenceUrl = (
el.dataset?.referenceUrl ||
el.dataset?.imageUrl ||
el.getAttribute('src') ||
''
).trim()
if (el.dataset?.mentionReference === '1' && referenceUrl) {
flushText()
items.push({
type: 'image_url',
image_url: { url: referenceUrl },
role: 'reference_image'
})
return
}
if (el.tagName === 'IMG' && (el.dataset?.imageUrl || el.getAttribute('src'))) {
return
}
if (el.tagName === 'BR') {
textBuffer += '\n'
return
}
if (['DIV', 'P', 'LI'].includes(el.tagName) && textBuffer && !textBuffer.endsWith('\n')) textBuffer += '\n'
Array.from(el.childNodes).forEach(walk)
if (['DIV', 'P', 'LI'].includes(el.tagName) && textBuffer && !textBuffer.endsWith('\n')) textBuffer += '\n'
}
Array.from(editor.childNodes).forEach(walk)
flushText()
return items
}
const clear = () => {
if (!editorRef.value) return
editorRef.value.innerHTML = ''
emit('text-change', '')
savedSelectionRange.value = null
mentionImageList.value = []
hideMentionPanel()
}
/** 供父组件持久化:参考图模式的 HTML + 素材列表 */
const getDraftState = () => ({
html: editorRef.value ? editorRef.value.innerHTML : '',
mentionList: mentionImageList.value.map(({ url, refNo, mediaType }) => ({
url,
refNo,
mediaType
}))
})
const applyDraftState = (draft) => {
hideMentionPanel()
savedSelectionRange.value = null
if (!draft || typeof draft !== 'object') {
clear()
return
}
mentionImageList.value = Array.isArray(draft.mentionList)
? draft.mentionList.map((x) => ({
url: x.url,
refNo: Number(x.refNo) || 0,
mediaType: x.mediaType || 'image'
}))
: []
if (editorRef.value) {
editorRef.value.innerHTML = typeof draft.html === 'string' ? draft.html : ''
}
nextTick(() => {
emit('text-change', getPlainText())
})
}
defineExpose({
getContentItems,
getPlainText,
clear,
getDraftState,
applyDraftState
})
onMounted(() => {
nextTick(() => {
focusEditorToEnd()
})
})
</script>
<style scoped>
.video-editor-root {
display: flex;
flex-direction: column;
gap: 8px;
flex: 1;
min-height: 0;
}
.toolbar {
display: flex;
gap: 8px;
flex-wrap: wrap;
}
.hidden-input {
display: none;
}
.editor-wrapper {
position: relative;
flex: 1;
display: flex;
flex-direction: column;
min-height: 200px;
}
.tool-btn {
border: 1px solid rgba(255, 255, 255, 0.12);
border-radius: 8px;
background: rgba(255, 255, 255, 0.06);
color: rgba(255, 255, 255, 0.88);
padding: 6px 12px;
cursor: pointer;
font-size: 12px;
transition: border-color 0.2s, background 0.2s;
}
.tool-btn:hover {
border-color: rgba(0, 202, 224, 0.4);
background: rgba(0, 202, 224, 0.08);
}
.video-rich-editor {
width: 100%;
flex: 1;
min-height: 220px;
font-size: 15px;
line-height: 1.9;
white-space: pre-wrap;
word-break: break-word;
overflow-y: auto;
color: rgba(255, 255, 255, 0.9);
caret-color: #00cae0;
:deep(*) {
color: rgba(255, 255, 255, 0.9) !important;
}
:deep(.inline-rich-reference) {
color: #5eebf5 !important;
background: rgba(0, 202, 224, 0.15);
}
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 14px;
padding: 16px 18px;
background: rgba(0, 0, 0, 0.25);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.video-rich-editor:focus {
border-color: rgba(0, 202, 224, 0.45);
box-shadow: 0 0 0 2px rgba(0, 202, 224, 0.15);
outline: none;
}
.video-rich-editor:empty::before {
content: attr(data-placeholder);
color: rgba(255, 255, 255, 0.35);
pointer-events: none;
display: block;
}
.video-rich-editor :deep(.inline-rich-image) {
display: inline-block;
width: auto;
height: auto;
max-width: min(260px, 100%);
max-height: 148px;
object-fit: contain;
vertical-align: middle;
margin: 6px 8px;
border-radius: 8px;
border: 1px solid rgba(255, 255, 255, 0.12);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.video-rich-editor :deep(.inline-rich-reference) {
display: inline-flex;
align-items: center;
padding: 0 6px;
margin: 0 3px;
border-radius: 4px;
background: rgba(0, 202, 224, 0.15);
color: #5eebf5;
font-size: 0.85em;
line-height: 1.5;
}
.mention-panel {
position: absolute;
left: 8px;
right: 8px;
bottom: 8px;
max-height: 180px;
overflow-y: auto;
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 10px;
background: rgba(22, 24, 30, 0.98);
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
z-index: 20;
}
.mention-item {
display: flex;
align-items: center;
gap: 8px;
padding: 8px 10px;
cursor: pointer;
}
.mention-item:hover {
background: rgba(255, 255, 255, 0.06);
}
.mention-thumb {
width: 32px;
height: 32px;
border-radius: 4px;
object-fit: cover;
border: 1px solid rgba(255, 255, 255, 0.1);
}
.mention-type-badge {
min-width: 32px;
height: 32px;
border-radius: 4px;
border: 1px solid rgba(255, 255, 255, 0.1);
display: inline-flex;
align-items: center;
justify-content: center;
font-size: 11px;
color: rgba(255, 255, 255, 0.65);
background: rgba(0, 0, 0, 0.25);
}
.mention-label {
font-size: 12px;
color: rgba(255, 255, 255, 0.85);
}
.mention-empty {
padding: 8px 10px;
font-size: 12px;
color: rgba(255, 255, 255, 0.4);
}
</style>

View File

@ -16,14 +16,13 @@
} }
&.arco-btn-text { &.arco-btn-text {
// padding: 0 10px 0 0;
&.arco-btn-status-default { &.arco-btn-status-default {
color: var(--color-text-3); color: #fff;
&:hover { &:hover {
color: rgb(var(--primary-5)); color: #fff;
} }
&:active { &:active {
color: rgb(var(--primary-7)); color: #fff;
background-color: transparent; background-color: transparent;
} }
&.arco-btn-disabled { &.arco-btn-disabled {
@ -37,10 +36,14 @@
} }
&.arco-btn-primary { &.arco-btn-primary {
color: #FFF; background-color: #1e293b;
border-color: #1e293b;
color: #fff;
&.arco-btn-loading, &.arco-btn-loading,
&:hover { &:hover {
color: #FFF; color: #fff;
background-color: #334155;
border-color: #334155;
} }
&.arco-btn-disabled { &.arco-btn-disabled {
@ -48,3 +51,18 @@
} }
} }
} }
/* 与 portal-buttons.less 一致:亮色主题下文本按钮用灰字 */
body:not([arco-theme='dark']) {
.mf-button.arco-btn-text.arco-btn-status-default:not(.arco-btn-disabled) {
color: #5c6b8a;
&:hover {
color: #94a3b8;
}
&:active {
color: #94a3b8;
}
}
}

View File

@ -179,7 +179,7 @@ export default {
if (inputType == 'password') { if (inputType == 'password') {
return ( return (
<a-input-password <a-input-password
invisible-button={true} invisible-button={false}
{...inputProps} {...inputProps}
v-slots={inputSlots} v-slots={inputSlots}
/> />

View File

@ -0,0 +1,179 @@
export default {
image1: 'خلع بضغطة واحدة',
image2: 'صورة إلى صورة 2',
uploadImage: 'رفع صورة',
uploadImageTip: 'PNG/JPG، بحد أقصى 10 ميجا',
uploadPlaceholder: 'انقر لرفع صورة',
selectImageSource: 'اختر مصدر الصورة',
selectTemplate: 'اختر القالب',
reselectTemplate: 'إعادة اختيار القالب',
noTemplates: 'لا توجد قوالب',
tag1: 'نوع الوسم 1',
tag2: 'نوع الوسم 2',
tag3: 'نوع الوسم 3',
generateImage: 'إنشاء الآن (يخصم {score} من الرصيد)',
generateImageNow: 'إنشاء الآن',
generateTip: 'بعد الإرسال يمكنك المشاهدة في "أعمالي"',
generateVideo: 'إنشاء فيديو',
imageFace: 'تبديل الوجه في صورة',
videoFace: 'تبديل الوجه في فيديو',
uploadImageFace: 'انقر لرفع صورة الوجه',
uploadTemplate: 'انقر لرفع قالب مخصص',
textPlaceholder: 'صف الصورة التي تريد إنشاءها',
uploadImageError: 'يرجى رفع صورة',
replaceImage: 'استبدال الصورة',
uploadFaceImageError: 'يرجى رفع صورة الوجه',
uploadTemplateError: 'يرجى رفع قالب مخصص',
textError: 'يرجى إدخال النص التوجيهي',
textVideoPlaceholder: 'صف الفيديو الذي تريد إنشاءه',
uploadFirstPlaceholder: 'انقر لرفع الإطار الأول',
uploadLastPlaceholder: 'انقر لرفع الإطار الأخير',
uploadFirstImageError: 'يرجى رفع صورة الإطار الأول',
uploadWaitImageError: 'يرجى انتظار انتهاء الرفع',
saveVideo: 'تحميل الفيديو',
videoLoadingText: 'جاري إنشاء الفيديو...',
viewVideo: 'عرض الفيديو',
changeFacePrompt: 'أخذ الوجه من الصورة الثانية واستبداله بالوجه في الأولى',
rechartTip1: 'عند الشحن via المحفظة تأكد من شبكة المحفظة.',
rechartTip2: 'قد يتأخر الشحن؛ انتظر 35 دقائق ثم حدّث.',
walletAddr: 'عنوان المحفظة:',
fbTitle: 'تحذير! هذا الموقع للبالغين فقط!',
fbContent: 'بالدخول أؤكد أن عمري 18 سنة أو أكثر',
fbCancel: 'أقل من 18',
fbOK: 'عمري 18+',
sorry: 'عذراً!',
useLess: 'لا يمكنك استخدام هذا الموقع...',
loginAccount: 'تسجيل الدخول',
logout: 'تسجيل الخروج',
userEmailPlaceholder: 'أدخل البريد أو اسم المستخدم',
passwordPlaceholder: 'أدخل كلمة المرور',
forgetPassword: 'نسيت كلمة المرور؟',
register: 'التسجيل',
login: 'دخول',
forgotPassword: 'نسيت كلمة المرور',
registerAccount: 'إنشاء حساب',
usernamePlaceholder: 'أدخل اسم المستخدم',
codePlaceholder: 'أدخل رمز التحقق',
confirmPasswordPlaceholder: 'تأكيد كلمة المرور',
backToLogin: 'العودة لتسجيل الدخول',
send: 'إرسال',
emailValidPlaceholder: 'أدخل بريداً إلكترونياً صحيحاً',
confirmPwdValidMsg: 'كلمات المرور غير متطابقة',
editPassword: 'تغيير كلمة المرور',
recharge: 'شحن',
myAccount: 'حسابي',
moneyInvite: 'دعوة مكافآت',
rechargeRecord: 'سجل الشحن',
resumeRecord: 'سجل الاستهلاك',
inviteRecord: 'سجل الدعوات',
username: 'اسم المستخدم',
userId: 'معرف المستخدم',
accountAmount: 'الرصيد',
editUserInfo: 'تعديل البيانات',
contact: 'تواصل معنا',
backToUser: 'رجوع',
moneyTips: 'عند دعوة صديق للتسجيل تحصل على {rate} من مبلغ شحنه في كل مرة.',
inviteCode: 'رمز الدعوة',
inviteLink: 'رابط الدعوة',
saveImage: 'حفظ الصورة',
totalAmount: 'إجمالي الشحن',
amount: 'المبلغ',
sendAmount: 'مبلغ الهدية',
rechargeType: 'طريقة الشحن',
rechargeTime: 'وقت الشحن',
emptyText: 'لا توجد بيانات',
product: 'عمل',
resumeAmount: 'المبلغ المستهلك',
productType: 'نوع العمل',
productTime: 'وقت الإنشاء',
totalReward: 'رصيد المكافآت',
rewardAmount: 'مبلغ المكافأة',
rewardTime: 'وقت المكافأة',
reSend: 'إعادة الإرسال',
registerSuccessfully: 'تم التسجيل بنجاح',
loginSuccessfully: 'تم تسجيل الدخول',
passwordResetSuccessfully: 'تم إعادة تعيين كلمة المرور',
rechargeSuccessfully: 'تم الشحن بنجاح',
avatar: 'الصورة الرمزية',
input: 'أدخل',
save: 'حفظ',
editEmail: 'تغيير البريد',
editEmailSuccessfully: 'تم تحديث البريد',
updateAvatarSuccessfully: 'تم تحديث الصورة الرمزية',
balenceLow: 'رصيدك غير كافٍ، يرجى الشحن',
confirm: 'تأكيد',
createFailed: 'فشل الإنشاء، تمت إعادة الرصيد',
notice: 'تنبيه',
oldPasswordPlaceholder: 'أدخل كلمة المرور القديمة',
newpasswordPlaceholder: 'أدخل كلمة المرور الجديدة',
switchPageTip: 'الفيديو قيد الإنشاء؛ اخرج وتحقق من سجل الاستهلاك.',
loginless: 'انتهت الجلسة! يرجى تسجيل الدخول مجدداً.',
createVideo: 'إنشاء فيديو (يخصم {price} من الرصيد)',
ok: 'تأكيد',
rechartNotice: 'تعليمات الشحن',
rechargeNotice1: '1. يُضاف الشحن فوراً. إن لم يتغير الرصيد حدّث الصفحة.',
rechargeNotice2: '2. الباقات المحدودة عروض؛ يمكنك الشحن أكثر من مرة.',
rechargeNotice3: '3. الرصيد المشحون لا ينتهي صلاحيته.',
rechargeNotice4: 'راجع الباقة قبل الشراء؛ لا استرداد.',
rechargeLeft: 'الرصيد',
dollor: 'USD',
isDevelop: 'قيد التطوير.',
copySuccessfully: 'تم النسخ',
copyLink: 'نسخ الرابط',
goPay: 'الذهاب للدفع',
filePreview: 'معاينة',
doSame: 'عمل نسخة مشابهة',
saveQRCode: 'حفظ رمز QR',
invitationCodePlaceholder: 'أدخل رمز الدعوة',
testRecharge: 'شحن تجريبي',
orderNo: 'رقم الطلب',
orderNoP: 'رقم الطلب مطلوب',
emailNotExists: 'هذا البريد غير مسجّل',
gearNotExists: 'خطة الشحن المختارة غير موجودة؛ اختر غيرها.',
myProduct: 'أعمالي',
permissionError: 'إجمالي شحنك {total}، لا يكفي للمعاينة.',
createTagFailed: 'فشل الإنشاء؛ حدّث وجرب مرة أخرى.',
loadingText: 'جاري التحميل...',
hasMore: 'اسحب لأعلى للمزيد',
noMore: 'لا مزيد',
giftAmount: 'المبلغ المُستَوفى',
cardNo: 'رقم البطاقة',
cardName: 'اسم صاحب البطاقة',
cardNoRequired: 'أدخل رقم البطاقة',
cardNameRequired: 'أدخل اسم صاحب البطاقة',
rechargeFailed: 'فشل الشحن',
vmCardInfo: 'بيانات البطاقة',
cardNumber: 'رقم البطاقة',
cardNumberPlaceholder: 'أدخل رقم البطاقة',
cardNumberRequired: 'أدخل رقم البطاقة',
cardNumberInvalid: 'رقم البطاقة يجب أن يكون 1319 رقماً',
cvc: 'CVC',
cvcPlaceholder: 'أدخل CVC',
cvcRequired: 'أدخل CVC',
cvcInvalid: 'CVC يجب أن يكون 3 أرقام',
expYear: 'سنة انتهاء الصلاحية',
expYearPlaceholder: 'أدخل السنة (مثل 2027)',
expYearRequired: 'أدخل سنة انتهاء الصلاحية',
expYearInvalid: 'السنة يجب أن تكون 4 أرقام',
expMonth: 'شهر انتهاء الصلاحية',
expMonthPlaceholder: 'اختر الشهر',
expMonthRequired: 'اختر الشهر',
email: 'البريد',
emailPlaceholder: 'أدخل البريد',
emailRequired: 'أدخل البريد',
emailInvalid: 'صيغة البريد غير صحيحة',
emailMaxLength: 'البريد لا يتجاوز 30 حرفاً',
firstName: 'الاسم الأول',
firstNamePlaceholder: 'أدخل الاسم الأول',
firstNameRequired: 'أدخل الاسم الأول',
firstNameMaxLength: 'الاسم لا يتجاوز 30 حرفاً',
lastName: 'اسم العائلة',
lastNamePlaceholder: 'أدخل اسم العائلة',
lastNameRequired: 'أدخل اسم العائلة',
lastNameMaxLength: 'اسم العائلة لا يتجاوز 30 حرفاً',
country: 'الدولة',
countryPlaceholder: 'اختر الدولة',
countryRequired: 'اختر الدولة',
submit: 'إرسال',
cancel: 'إلغاء'
}

View File

@ -0,0 +1,7 @@
import route from './route'
import common from './common.js'
export default {
route,
common
}

View File

@ -0,0 +1,14 @@
export default {
index: 'الرئيسية',
imageToImage: 'خلع بضغطة واحدة',
imageToImage2: 'صورة إلى صورة 2',
changeFace: 'تبديل الوجه',
changeFaceVideo: 'تبديل الوجه في الفيديو',
fastImage: 'إنشاء صورة',
fastVideo: 'إنشاء فيديو',
recharge: 'شحن سريع',
help: 'مركز المساعدة',
moneyInvite: 'دعوة مكافآت',
assetGroupManage: 'إدارة مجموعات الأصول',
assetManage: 'إدارة الأصول'
}

View File

@ -143,6 +143,14 @@ export default {
cardNoRequired: 'Please enter card number', cardNoRequired: 'Please enter card number',
cardNameRequired: 'Please enter cardholder name', cardNameRequired: 'Please enter cardholder name',
rechargeFailed: 'Recharge failed', rechargeFailed: 'Recharge failed',
// Model selection
selectModel: 'Select Model',
seedance20: 'Seedance 2.0',
seedance20Fast: 'Seedance 2.0 Fast',
// Rich text editor
insertImage: 'Insert Image',
mentionImage: 'Mention Image',
noImageToMention: 'No images to mention',
// VM支付相关 // VM支付相关
vmCardInfo: 'Credit Card Information', vmCardInfo: 'Credit Card Information',
cardNumber: 'Card Number', cardNumber: 'Card Number',
@ -175,5 +183,9 @@ export default {
country: 'Country', country: 'Country',
countryPlaceholder: 'Select country', countryPlaceholder: 'Select country',
countryRequired: 'Please select country', countryRequired: 'Please select country',
submit: 'Submit' videoGen: 'Video Generation',
uploadFirstImage: 'Upload Reference Image',
insertImage: 'Insert Image',
submit: 'Submit',
cancel: 'Cancel'
} }

View File

@ -1,12 +1,15 @@
export default { export default {
index: 'Home', index: 'Home',
imageToImage: 'One-click undressing', imageToImage: 'Image-to-Image 1',
imageToImage2: 'Image-to-Image2', imageToImage2: 'Image-to-Image2',
changeFace: 'Swap Face', changeFace: 'Swap Face',
changeFaceVideo: 'Swap Video Face', changeFaceVideo: 'Swap Video Face',
fastImage: 'Gen Image', fastImage: 'Gen Image',
fastVideo: 'Gen Video', fastVideo: 'Gen Video',
videoGen: 'Video Generation',
recharge: 'Quick Recharge', recharge: 'Quick Recharge',
help: 'Help Center', help: 'Help Center',
moneyInvite: 'Reward Invitation' moneyInvite: 'Reward Invitation',
assetGroupManage: 'Asset Group Manage',
assetManage: 'Asset Manage'
} }

View File

@ -0,0 +1,179 @@
export default {
image1: 'Desvestir en un clic',
image2: 'Imagen a Imagen 2',
uploadImage: 'Subir imagen',
uploadImageTip: 'Soporta PNG/JPG, máx. 10MB',
uploadPlaceholder: 'Clic para subir imagen',
selectImageSource: 'Seleccionar fuente de imagen',
selectTemplate: 'Seleccionar plantilla',
reselectTemplate: 'Reseleccionar plantilla',
noTemplates: 'Sin plantillas',
tag1: 'Tipo de etiqueta 1',
tag2: 'Tipo de etiqueta 2',
tag3: 'Tipo de etiqueta 3',
generateImage: 'Generar ahora (consume {score} de saldo)',
generateImageNow: 'Generar ahora',
generateTip: 'Después de enviar, puede ver en "Mis obras"',
generateVideo: 'Generar video',
imageFace: 'Cambiar rostro en imagen',
videoFace: 'Cambiar rostro en video',
uploadImageFace: 'Clic para subir imagen de rostro',
uploadTemplate: 'Clic para subir plantilla personalizada',
textPlaceholder: 'Describa la imagen que desea generar',
uploadImageError: 'Por favor suba una imagen',
replaceImage: 'Reemplazar imagen',
uploadFaceImageError: 'Por favor suba una imagen de rostro',
uploadTemplateError: 'Por favor suba una plantilla personalizada',
textError: 'Por favor escriba el texto de indicación',
textVideoPlaceholder: 'Describa el video que desea generar',
uploadFirstPlaceholder: 'Clic para subir imagen del primer frame',
uploadLastPlaceholder: 'Clic para subir imagen del último frame',
uploadFirstImageError: 'Por favor suba la imagen del primer frame',
uploadWaitImageError: 'Espere a que termine la subida',
saveVideo: 'Descargar video',
videoLoadingText: 'Generando video...',
viewVideo: 'Ver video',
changeFacePrompt: 'Extraer el rostro de la segunda imagen y reemplazar en la primera',
rechartTip1: 'Al recargar con transferencia de billetera, confirme la red del monedero.',
rechartTip2: 'La recarga puede tardar; espere 3-5 minutos antes de actualizar.',
walletAddr: 'Dirección del monedero',
fbTitle: 'Advertencia: este sitio es solo para adultos.',
fbContent: 'Al entrar confirmo que tengo 18 años o más',
fbCancel: 'Menor de 18',
fbOK: 'Tengo 18 o más',
sorry: '¡Lo sentimos!',
useLess: 'No puede usar este sitio...',
loginAccount: 'Iniciar sesión',
logout: 'Cerrar sesión',
userEmailPlaceholder: 'Introduzca correo o usuario',
passwordPlaceholder: 'Introduzca contraseña',
forgetPassword: '¿Olvidó la contraseña?',
register: 'Registrarse',
login: 'Iniciar sesión',
forgotPassword: 'Olvidé la contraseña',
registerAccount: 'Crear cuenta',
usernamePlaceholder: 'Introduzca usuario',
codePlaceholder: 'Introduzca código de verificación',
confirmPasswordPlaceholder: 'Confirme la contraseña',
backToLogin: 'Volver al inicio de sesión',
send: 'Enviar',
emailValidPlaceholder: 'Introduzca un correo válido',
confirmPwdValidMsg: 'Las contraseñas no coinciden',
editPassword: 'Cambiar contraseña',
recharge: 'Recargar',
myAccount: 'Mi cuenta',
moneyInvite: 'Invitación con recompensa',
rechargeRecord: 'Historial de recargas',
resumeRecord: 'Historial de consumo',
inviteRecord: 'Historial de invitaciones',
username: 'Usuario',
userId: 'ID de usuario',
accountAmount: 'Saldo',
editUserInfo: 'Editar datos',
contact: 'Contacto',
backToUser: 'Volver',
moneyTips: 'Al invitar a un amigo a registrarse, obtiene {rate} de su recarga cada vez.',
inviteCode: 'Código de invitación',
inviteLink: 'Enlace de invitación',
saveImage: 'Guardar imagen',
totalAmount: 'Total recargado',
amount: 'Monto',
sendAmount: 'Monto de regalo',
rechargeType: 'Método de recarga',
rechargeTime: 'Fecha de recarga',
emptyText: 'Sin datos',
product: 'Obra',
resumeAmount: 'Monto consumido',
productType: 'Tipo de obra',
productTime: 'Fecha de creación',
totalReward: 'Saldo de recompensas',
rewardAmount: 'Monto de recompensa',
rewardTime: 'Fecha de recompensa',
reSend: 'Reenviar',
registerSuccessfully: 'Registro exitoso',
loginSuccessfully: 'Sesión iniciada',
passwordResetSuccessfully: 'Contraseña restablecida',
rechargeSuccessfully: 'Recarga exitosa',
avatar: 'Avatar',
input: 'Introduzca',
save: 'Guardar',
editEmail: 'Cambiar correo',
editEmailSuccessfully: 'Correo actualizado',
updateAvatarSuccessfully: 'Avatar actualizado',
balenceLow: 'Saldo insuficiente, recargue',
confirm: 'Aceptar',
createFailed: 'Error al generar, saldo devuelto',
notice: 'Aviso',
oldPasswordPlaceholder: 'Introduzca la contraseña anterior',
newpasswordPlaceholder: 'Introduzca la nueva contraseña',
switchPageTip: 'El video se está generando; salga y revise el historial de consumo.',
loginless: 'Sesión expirada; inicie sesión de nuevo.',
createVideo: 'Generar video (consume {price} de saldo)',
ok: 'Aceptar',
rechartNotice: 'Instrucciones de recarga',
rechargeNotice1: '1. La recarga se acredita al instante. Si no cambia, actualice la página.',
rechargeNotice2: '2. Los paquetes por tiempo limitado son promociones; puede recargar varias veces.',
rechargeNotice3: '3. El saldo recargado no tiene límite de tiempo.',
rechargeNotice4: 'Revise el paquete antes de comprar; no hay devoluciones.',
rechargeLeft: 'Saldo',
dollor: 'USD',
isDevelop: 'En desarrollo.',
copySuccessfully: 'Copiado',
copyLink: 'Copiar enlace',
goPay: 'Ir a pagar',
filePreview: 'Vista previa',
doSame: 'Hacer similar',
saveQRCode: 'Guardar código QR',
invitationCodePlaceholder: 'Introduzca código de invitación',
testRecharge: 'Recarga de prueba',
orderNo: 'Número de pedido',
orderNoP: 'El número de pedido es obligatorio',
emailNotExists: 'El correo no está registrado',
gearNotExists: 'El plan de recarga no existe; elija otro.',
myProduct: 'Mis obras',
permissionError: 'Su recarga acumulada es {total}, no cumple para previsualizar.',
createTagFailed: 'Error al generar; actualice e intente de nuevo.',
loadingText: 'Cargando...',
hasMore: 'Deslizar para más',
noMore: 'No hay más',
giftAmount: 'Monto acreditado',
cardNo: 'Número de tarjeta',
cardName: 'Nombre en tarjeta',
cardNoRequired: 'Introduzca número de tarjeta',
cardNameRequired: 'Introduzca nombre en tarjeta',
rechargeFailed: 'Recarga fallida',
vmCardInfo: 'Datos de tarjeta',
cardNumber: 'Número de tarjeta',
cardNumberPlaceholder: 'Introduzca número de tarjeta',
cardNumberRequired: 'Introduzca número de tarjeta',
cardNumberInvalid: 'El número debe tener 13-19 dígitos',
cvc: 'CVC',
cvcPlaceholder: 'Introduzca CVC',
cvcRequired: 'Introduzca CVC',
cvcInvalid: 'CVC debe ser 3 dígitos',
expYear: 'Año de vencimiento',
expYearPlaceholder: 'Introduzca año (ej.: 2027)',
expYearRequired: 'Introduzca año de vencimiento',
expYearInvalid: 'El año debe ser 4 dígitos',
expMonth: 'Mes de vencimiento',
expMonthPlaceholder: 'Seleccione mes',
expMonthRequired: 'Seleccione mes',
email: 'Correo',
emailPlaceholder: 'Introduzca correo',
emailRequired: 'Introduzca correo',
emailInvalid: 'Formato de correo no válido',
emailMaxLength: 'Máx. 30 caracteres',
firstName: 'Nombre',
firstNamePlaceholder: 'Introduzca nombre',
firstNameRequired: 'Introduzca nombre',
firstNameMaxLength: 'Máx. 30 caracteres',
lastName: 'Apellido',
lastNamePlaceholder: 'Introduzca apellido',
lastNameRequired: 'Introduzca apellido',
lastNameMaxLength: 'Máx. 30 caracteres',
country: 'País',
countryPlaceholder: 'Seleccione país',
countryRequired: 'Seleccione país',
submit: 'Enviar',
cancel: 'Cancelar'
}

View File

@ -0,0 +1,7 @@
import route from './route'
import common from './common.js'
export default {
route,
common
}

View File

@ -0,0 +1,14 @@
export default {
index: 'Inicio',
imageToImage: 'Desvestir en un clic',
imageToImage2: 'Imagen a Imagen 2',
changeFace: 'Cambiar rostro',
changeFaceVideo: 'Cambiar rostro en video',
fastImage: 'Generar imagen',
fastVideo: 'Generar video',
recharge: 'Recarga rápida',
help: 'Centro de ayuda',
moneyInvite: 'Invitación con recompensa',
assetGroupManage: 'Gestión de grupos de activos',
assetManage: 'Gestión de activos'
}

View File

@ -0,0 +1,179 @@
export default {
image1: 'Déshabiller en un clic',
image2: 'Image vers Image 2',
uploadImage: 'Télécharger une image',
uploadImageTip: 'PNG/JPG, max. 10 Mo',
uploadPlaceholder: 'Cliquez pour télécharger',
selectImageSource: 'Choisir la source de l\'image',
selectTemplate: 'Choisir un modèle',
reselectTemplate: 'Resélectionner un modèle',
noTemplates: 'Aucun modèle',
tag1: 'Type d\'étiquette 1',
tag2: 'Type d\'étiquette 2',
tag3: 'Type d\'étiquette 3',
generateImage: 'Générer maintenant (coûte {score} de solde)',
generateImageNow: 'Générer maintenant',
generateTip: 'Après envoi, voir dans « Mes œuvres »',
generateVideo: 'Générer une vidéo',
imageFace: 'Changer le visage sur image',
videoFace: 'Changer le visage en vidéo',
uploadImageFace: 'Cliquez pour télécharger une photo de visage',
uploadTemplate: 'Cliquez pour télécharger un modèle personnalisé',
textPlaceholder: 'Décrivez l\'image que vous voulez générer',
uploadImageError: 'Veuillez télécharger une image',
replaceImage: 'Remplacer l\'image',
uploadFaceImageError: 'Veuillez télécharger une photo de visage',
uploadTemplateError: 'Veuillez télécharger un modèle personnalisé',
textError: 'Veuillez saisir le texte d\'invite',
textVideoPlaceholder: 'Décrivez la vidéo que vous voulez générer',
uploadFirstPlaceholder: 'Cliquez pour télécharger la première image',
uploadLastPlaceholder: 'Cliquez pour télécharger la dernière image',
uploadFirstImageError: 'Veuillez télécharger l\'image du premier plan',
uploadWaitImageError: 'Veuillez attendre la fin du téléchargement',
saveVideo: 'Télécharger la vidéo',
videoLoadingText: 'Génération de la vidéo...',
viewVideo: 'Voir la vidéo',
changeFacePrompt: 'Extraire le visage de la 2e image et remplacer celui de la 1re',
rechartTip1: 'Lors d\'une recharge par portefeuille, vérifiez le réseau du portefeuille.',
rechartTip2: 'La recharge peut être retardée ; attendez 35 min avant dactualiser.',
walletAddr: 'Adresse du portefeuille : ',
fbTitle: 'Attention ! Ce site est réservé aux adultes.',
fbContent: 'En entrant je confirme avoir 18 ans ou plus',
fbCancel: 'Moins de 18 ans',
fbOK: 'J\'ai 18 ans ou plus',
sorry: 'Désolé !',
useLess: 'Vous ne pouvez pas utiliser ce site...',
loginAccount: 'Connexion',
logout: 'Déconnexion',
userEmailPlaceholder: 'Saisissez l\'email ou lidentifiant',
passwordPlaceholder: 'Saisissez le mot de passe',
forgetPassword: 'Mot de passe oublié ?',
register: 'S\'inscrire',
login: 'Connexion',
forgotPassword: 'Mot de passe oublié',
registerAccount: 'Créer un compte',
usernamePlaceholder: 'Saisissez lidentifiant',
codePlaceholder: 'Saisissez le code de vérification',
confirmPasswordPlaceholder: 'Confirmez le mot de passe',
backToLogin: 'Retour à la connexion',
send: 'Envoyer',
emailValidPlaceholder: 'Saisissez un email valide',
confirmPwdValidMsg: 'Les mots de passe ne correspondent pas',
editPassword: 'Modifier le mot de passe',
recharge: 'Recharger',
myAccount: 'Mon compte',
moneyInvite: 'Invitation avec récompense',
rechargeRecord: 'Historique des recharges',
resumeRecord: 'Historique des consommations',
inviteRecord: 'Historique des invitations',
username: 'Identifiant',
userId: 'ID utilisateur',
accountAmount: 'Solde',
editUserInfo: 'Modifier les informations',
contact: 'Nous contacter',
backToUser: 'Retour',
moneyTips: 'Quand vous parrainez un ami, vous gagnez {rate} de chaque recharge quil fait.',
inviteCode: 'Code de parrainage',
inviteLink: 'Lien d\'invitation',
saveImage: 'Enregistrer l\'image',
totalAmount: 'Total rechargé',
amount: 'Montant',
sendAmount: 'Montant offert',
rechargeType: 'Méthode de recharge',
rechargeTime: 'Date de recharge',
emptyText: 'Aucune donnée',
product: 'Œuvre',
resumeAmount: 'Montant consommé',
productType: 'Type d\'œuvre',
productTime: 'Date de création',
totalReward: 'Solde de récompenses',
rewardAmount: 'Montant de la récompense',
rewardTime: 'Date de la récompense',
reSend: 'Renvoyer',
registerSuccessfully: 'Inscription réussie',
loginSuccessfully: 'Connexion réussie',
passwordResetSuccessfully: 'Mot de passe réinitialisé',
rechargeSuccessfully: 'Recharge réussie',
avatar: 'Avatar',
input: 'Saisir',
save: 'Enregistrer',
editEmail: 'Modifier l\'email',
editEmailSuccessfully: 'Email mis à jour',
updateAvatarSuccessfully: 'Avatar mis à jour',
balenceLow: 'Solde insuffisant, veuillez recharger',
confirm: 'Confirmer',
createFailed: 'Échec de génération, solde remboursé',
notice: 'Avis',
oldPasswordPlaceholder: 'Saisissez lancien mot de passe',
newpasswordPlaceholder: 'Saisissez le nouveau mot de passe',
switchPageTip: 'Une vidéo est en cours de génération ; consultez lhistorique des consommations.',
loginless: 'Session expirée ! Veuillez vous reconnecter.',
createVideo: 'Générer une vidéo (coûte {price} de solde)',
ok: 'Confirmer',
rechartNotice: 'Instructions de recharge',
rechargeNotice1: '1. La recharge est créditée tout de suite. Si rien ne change, actualisez la page.',
rechargeNotice2: '2. Les offres limitées sont des promos ; vous pouvez recharger plusieurs fois.',
rechargeNotice3: '3. Le solde rechargé na pas de limite de durée.',
rechargeNotice4: 'Vérifiez loffre avant dacheter ; pas de remboursement.',
rechargeLeft: 'Solde',
dollor: 'USD',
isDevelop: 'En cours de développement.',
copySuccessfully: 'Copié',
copyLink: 'Copier le lien',
goPay: 'Aller au paiement',
filePreview: 'Aperçu',
doSame: 'Créer un équivalent',
saveQRCode: 'Enregistrer le QR code',
invitationCodePlaceholder: 'Saisissez le code d\'invitation',
testRecharge: 'Recharge test',
orderNo: 'Numéro de commande',
orderNoP: 'Le numéro de commande est obligatoire',
emailNotExists: 'Cet email nest pas inscrit',
gearNotExists: 'Loffre choisie nexiste pas ; choisissez une autre.',
myProduct: 'Mes œuvres',
permissionError: 'Votre total de recharges est {total}, insuffisant pour la prévisualisation.',
createTagFailed: 'Échec de génération ; actualisez et réessayez.',
loadingText: 'Chargement...',
hasMore: 'Tirez pour charger plus',
noMore: 'Plus rien',
giftAmount: 'Montant crédité',
cardNo: 'Numéro de carte',
cardName: 'Nom sur la carte',
cardNoRequired: 'Saisissez le numéro de carte',
cardNameRequired: 'Saisissez le nom sur la carte',
rechargeFailed: 'Recharge échouée',
vmCardInfo: 'Informations de carte',
cardNumber: 'Numéro de carte',
cardNumberPlaceholder: 'Saisissez le numéro de carte',
cardNumberRequired: 'Saisissez le numéro de carte',
cardNumberInvalid: 'Le numéro doit contenir 13 à 19 chiffres',
cvc: 'CVC',
cvcPlaceholder: 'Saisissez le CVC',
cvcRequired: 'Saisissez le CVC',
cvcInvalid: 'Le CVC doit faire 3 chiffres',
expYear: 'Année d\'expiration',
expYearPlaceholder: 'Saisissez lannée (ex. 2027)',
expYearRequired: 'Saisissez lannée d\'expiration',
expYearInvalid: 'Lannée doit faire 4 chiffres',
expMonth: 'Mois d\'expiration',
expMonthPlaceholder: 'Choisissez le mois',
expMonthRequired: 'Choisissez le mois',
email: 'Email',
emailPlaceholder: 'Saisissez lemail',
emailRequired: 'Saisissez lemail',
emailInvalid: 'Format demail invalide',
emailMaxLength: 'Lemail ne doit pas dépasser 30 caractères',
firstName: 'Prénom',
firstNamePlaceholder: 'Saisissez le prénom',
firstNameRequired: 'Saisissez le prénom',
firstNameMaxLength: 'Le prénom ne doit pas dépasser 30 caractères',
lastName: 'Nom de famille',
lastNamePlaceholder: 'Saisissez le nom de famille',
lastNameRequired: 'Saisissez le nom de famille',
lastNameMaxLength: 'Le nom ne doit pas dépasser 30 caractères',
country: 'Pays',
countryPlaceholder: 'Choisissez le pays',
countryRequired: 'Choisissez le pays',
submit: 'Envoyer',
cancel: 'Annuler'
}

View File

@ -0,0 +1,7 @@
import route from './route'
import common from './common.js'
export default {
route,
common
}

View File

@ -0,0 +1,14 @@
export default {
index: 'Accueil',
imageToImage: 'Déshabiller en un clic',
imageToImage2: 'Image vers Image 2',
changeFace: 'Changer le visage',
changeFaceVideo: 'Changer le visage en vidéo',
fastImage: 'Générer une image',
fastVideo: 'Générer une vidéo',
recharge: 'Recharge rapide',
help: 'Centre d\'aide',
moneyInvite: 'Invitation avec récompense',
assetGroupManage: 'Gestion des groupes d\'actifs',
assetManage: 'Gestion des actifs'
}

View File

@ -0,0 +1,179 @@
export default {
image1: 'एक क्लिक में कपड़े उतारें',
image2: 'इमेज टू इमेज 2',
uploadImage: 'छवि अपलोड करें',
uploadImageTip: 'PNG/JPG, अधिकतम 10MB',
uploadPlaceholder: 'अपलोड करने के लिए क्लिक करें',
selectImageSource: 'छवि स्रोत चुनें',
selectTemplate: 'टेम्पलेट चुनें',
reselectTemplate: 'टेम्पलेट दोबारा चुनें',
noTemplates: 'कोई टेम्पलेट नहीं',
tag1: 'टैग प्रकार 1',
tag2: 'टैग प्रकार 2',
tag3: 'टैग प्रकार 3',
generateImage: 'अभी जनरेट करें ({score} बैलेंस खर्च)',
generateImageNow: 'अभी जनरेट करें',
generateTip: 'सबमिट के बाद "मेरी रचनाएं" में देखें',
generateVideo: 'वीडियो जनरेट करें',
imageFace: 'छवि में चेहरा बदलें',
videoFace: 'वीडियो में चेहरा बदलें',
uploadImageFace: 'चेहरे की छवि अपलोड करने के लिए क्लिक करें',
uploadTemplate: 'कस्टम टेम्पलेट अपलोड करने के लिए क्लिक करें',
textPlaceholder: 'वह छवि बताएं जो आप बनाना चाहते हैं',
uploadImageError: 'कृपया एक छवि अपलोड करें',
replaceImage: 'छवि बदलें',
uploadFaceImageError: 'कृपया चेहरे की छवि अपलोड करें',
uploadTemplateError: 'कृपया कस्टम टेम्पलेट अपलोड करें',
textError: 'कृपया प्रॉम्प्ट दर्ज करें',
textVideoPlaceholder: 'वह वीडियो बताएं जो आप बनाना चाहते हैं',
uploadFirstPlaceholder: 'पहला फ्रेम अपलोड करने के लिए क्लिक करें',
uploadLastPlaceholder: 'आखिरी फ्रेम अपलोड करने के लिए क्लिक करें',
uploadFirstImageError: 'कृपया पहले फ्रेम की छवि अपलोड करें',
uploadWaitImageError: 'अपलोड पूरा होने तक प्रतीक्षा करें',
saveVideo: 'वीडियो डाउनलोड करें',
videoLoadingText: 'वीडियो बन रहा है...',
viewVideo: 'वीडियो देखें',
changeFacePrompt: 'दूसरी छवि का चेहरा लेकर पहली छवि के चेहरे से बदलें',
rechartTip1: 'वॉलेट ट्रांसफर से रिचार्ज करते समय वॉलेट का नेटवर्क जांचें।',
rechartTip2: 'रिचार्ज में देरी हो सकती है; 3-5 मिनट बाद रिफ्रेश करें।',
walletAddr: 'वॉलेट पता:',
fbTitle: 'चेतावनी! यह साइट केवल वयस्कों के लिए है।',
fbContent: 'प्रवेश करके मैं पुष्टि करता/करती हूं कि मैं 18 वर्ष या उससे अधिक का हूं',
fbCancel: '18 से कम',
fbOK: 'मैं 18+ हूं',
sorry: 'क्षमा करें!',
useLess: 'आप इस साइट का उपयोग नहीं कर सकते...',
loginAccount: 'लॉगिन',
logout: 'लॉगआउट',
userEmailPlaceholder: 'ईमेल या यूजरनेम दर्ज करें',
passwordPlaceholder: 'पासवर्ड दर्ज करें',
forgetPassword: 'पासवर्ड भूल गए?',
register: 'रजिस्टर',
login: 'लॉगिन',
forgotPassword: 'पासवर्ड भूल गए',
registerAccount: 'अकाउंट बनाएं',
usernamePlaceholder: 'यूजरनेम दर्ज करें',
codePlaceholder: 'वेरिफिकेशन कोड दर्ज करें',
confirmPasswordPlaceholder: 'पासवर्ड की पुष्टि करें',
backToLogin: 'लॉगिन पर वापस',
send: 'भेजें',
emailValidPlaceholder: 'वैध ईमेल दर्ज करें',
confirmPwdValidMsg: 'पासवर्ड मेल नहीं खाते',
editPassword: 'पासवर्ड बदलें',
recharge: 'रिचार्ज',
myAccount: 'मेरा अकाउंट',
moneyInvite: 'इनाम निमंत्रण',
rechargeRecord: 'रिचार्ज रिकॉर्ड',
resumeRecord: 'खर्च रिकॉर्ड',
inviteRecord: 'निमंत्रण रिकॉर्ड',
username: 'यूजरनेम',
userId: 'यूजर आईडी',
accountAmount: 'बैलेंस',
editUserInfo: 'जानकारी संपादित करें',
contact: 'संपर्क करें',
backToUser: 'वापस',
moneyTips: 'जब आप दोस्त को रजिस्टर करवाते हैं, उसके रिचार्ज का {rate} हर बार मिलता है।',
inviteCode: 'इनवाइट कोड',
inviteLink: 'इनवाइट लिंक',
saveImage: 'छवि सहेजें',
totalAmount: 'कुल रिचार्ज',
amount: 'राशि',
sendAmount: 'उपहार राशि',
rechargeType: 'रिचार्ज तरीका',
rechargeTime: 'रिचार्ज समय',
emptyText: 'कोई डेटा नहीं',
product: 'रचना',
resumeAmount: 'खर्च राशि',
productType: 'रचना प्रकार',
productTime: 'बनाने का समय',
totalReward: 'कुल इनाम बैलेंस',
rewardAmount: 'इनाम राशि',
rewardTime: 'इनाम समय',
reSend: 'दोबारा भेजें',
registerSuccessfully: 'रजिस्ट्रेशन सफल',
loginSuccessfully: 'लॉगिन सफल',
passwordResetSuccessfully: 'पासवर्ड रीसेट सफल',
rechargeSuccessfully: 'रिचार्ज सफल',
avatar: 'अवतार',
input: 'दर्ज करें',
save: 'सहेजें',
editEmail: 'ईमेल बदलें',
editEmailSuccessfully: 'ईमेल अपडेट हो गया',
updateAvatarSuccessfully: 'अवतार अपडेट हो गया',
balenceLow: 'बैलेंस कम है, रिचार्ज करें',
confirm: 'पुष्टि करें',
createFailed: 'जनरेशन विफल, बैलेंस वापस',
notice: 'सूचना',
oldPasswordPlaceholder: 'पुराना पासवर्ड दर्ज करें',
newpasswordPlaceholder: 'नया पासवर्ड दर्ज करें',
switchPageTip: 'वीडियो बन रहा है; निकलकर खर्च रिकॉर्ड देखें।',
loginless: 'लॉगिन समाप्त! दोबारा लॉगिन करें।',
createVideo: 'वीडियो जनरेट करें ({price} बैलेंस खर्च)',
ok: 'पुष्टि करें',
rechartNotice: 'रिचार्ज निर्देश',
rechargeNotice1: '1. रिचार्ज तुरंत जमा होता है। बदलाव न दिखे तो रिफ्रेश करें।',
rechargeNotice2: '2. लिमिटेड पैक प्रचार हैं; आप कई बार रिचार्ज कर सकते हैं।',
rechargeNotice3: '3. रिचार्ज की गई राशि की कोई समय सीमा नहीं।',
rechargeNotice4: 'खरीदने से पहले पैक देखें; वापसी नहीं होती।',
rechargeLeft: 'बैलेंस',
dollor: 'USD',
isDevelop: 'विकास में है।',
copySuccessfully: 'कॉपी हुआ',
copyLink: 'लिंक कॉपी करें',
goPay: 'भुगतान पर जाएं',
filePreview: 'पूर्वावलोकन',
doSame: 'इसी तरह बनाएं',
saveQRCode: 'QR कोड सहेजें',
invitationCodePlaceholder: 'इनवाइट कोड दर्ज करें',
testRecharge: 'टेस्ट रिचार्ज',
orderNo: 'ऑर्डर नंबर',
orderNoP: 'ऑर्डर नंबर खाली नहीं हो सकता',
emailNotExists: 'यह ईमेल रजिस्टर नहीं है',
gearNotExists: 'चुना गया रिचार्ज प्लान मौजूद नहीं; दूसरा चुनें।',
myProduct: 'मेरी रचनाएं',
permissionError: 'आपका कुल रिचार्ज {total} है, प्रीव्यू के लिए पर्याप्त नहीं।',
createTagFailed: 'जनरेशन विफल; रिफ्रेश करके दोबारा कोशिश करें।',
loadingText: 'लोड हो रहा है...',
hasMore: 'ऊपर खींचें और अधिक लोड करें',
noMore: 'और नहीं',
giftAmount: 'जमा राशि',
cardNo: 'कार्ड नंबर',
cardName: 'कार्डधारक का नाम',
cardNoRequired: 'कार्ड नंबर दर्ज करें',
cardNameRequired: 'कार्डधारक का नाम दर्ज करें',
rechargeFailed: 'रिचार्ज विफल',
vmCardInfo: 'कार्ड जानकारी',
cardNumber: 'कार्ड नंबर',
cardNumberPlaceholder: 'कार्ड नंबर दर्ज करें',
cardNumberRequired: 'कार्ड नंबर दर्ज करें',
cardNumberInvalid: 'कार्ड नंबर 13-19 अंकों का होना चाहिए',
cvc: 'CVC',
cvcPlaceholder: 'CVC दर्ज करें',
cvcRequired: 'CVC दर्ज करें',
cvcInvalid: 'CVC 3 अंकों का होना चाहिए',
expYear: 'समाप्ति वर्ष',
expYearPlaceholder: 'वर्ष दर्ज करें (जैसे 2027)',
expYearRequired: 'समाप्ति वर्ष दर्ज करें',
expYearInvalid: 'वर्ष 4 अंकों का होना चाहिए',
expMonth: 'समाप्ति माह',
expMonthPlaceholder: 'माह चुनें',
expMonthRequired: 'माह चुनें',
email: 'ईमेल',
emailPlaceholder: 'ईमेल दर्ज करें',
emailRequired: 'ईमेल दर्ज करें',
emailInvalid: 'ईमेल फॉर्मेट गलत',
emailMaxLength: 'ईमेल 30 अक्षर से अधिक नहीं',
firstName: 'पहला नाम',
firstNamePlaceholder: 'पहला नाम दर्ज करें',
firstNameRequired: 'पहला नाम दर्ज करें',
firstNameMaxLength: 'पहला नाम 30 अक्षर से अधिक नहीं',
lastName: 'उपनाम',
lastNamePlaceholder: 'उपनाम दर्ज करें',
lastNameRequired: 'उपनाम दर्ज करें',
lastNameMaxLength: 'उपनाम 30 अक्षर से अधिक नहीं',
country: 'देश',
countryPlaceholder: 'देश चुनें',
countryRequired: 'देश चुनें',
submit: 'भेजें',
cancel: 'रद्द करें'
}

View File

@ -0,0 +1,7 @@
import route from './route'
import common from './common.js'
export default {
route,
common
}

View File

@ -0,0 +1,14 @@
export default {
index: 'होम',
imageToImage: 'एक क्लिक में कपड़े उतारें',
imageToImage2: 'इमेज टू इमेज 2',
changeFace: 'चेहरा बदलें',
changeFaceVideo: 'वीडियो में चेहरा बदलें',
fastImage: 'छवि जनरेट करें',
fastVideo: 'वीडियो जनरेट करें',
recharge: 'त्वरित रिचार्ज',
help: 'सहायता केंद्र',
moneyInvite: 'इनाम निमंत्रण',
assetGroupManage: 'एसेट समूह प्रबंधन',
assetManage: 'एसेट प्रबंधन'
}

View File

@ -1,26 +1,28 @@
import { createI18n } from 'vue-i18n' import { createI18n } from 'vue-i18n'
import Cookies from 'js-cookie' import Cookies from 'js-cookie'
import zh_HK from '@/lang/zh_HK/index.js' import zh_HK from '@/lang/zh_HK/index.js'
/**
import en_US from '@/lang/en_US/index.js' import en_US from '@/lang/en_US/index.js'
import es_ES from '@/lang/es_ES/index.js' mport es_ES from '@/lang/es_ES/index.js'
import pt_BR from '@/lang/pt_BR/index.js' import pt_BR from '@/lang/pt_BR/index.js'
import hi_IN from '@/lang/hi_IN/index.js' import hi_IN from '@/lang/hi_IN/index.js'
import ru_RU from '@/lang/ru_RU/index.js' import ru_RU from '@/lang/ru_RU/index.js'
import ar_SA from '@/lang/ar_SA/index.js' import ar_SA from '@/lang/ar_SA/index.js'
import fr_FR from '@/lang/fr_FR/index.js' import fr_FR from '@/lang/fr_FR/index.js'**/
let locale = Cookies.get('language') || 'en_US' // 多语言切换已禁用:全站固定繁体中文
let locale = 'zh_HK'
/** 各语言在界面上的显示名称 */ /** 各语言在界面上的显示名称 */
export const LOCALE_NAMES = { export const LOCALE_NAMES = {
zh_HK: '繁体中文', zh_HK: '繁体中文',
en_US: 'English', /** en_US: 'English',
es_ES: 'Español', es_ES: 'Español',
pt_BR: 'Português', pt_BR: 'Português',
hi_IN: 'हिन्दी', hi_IN: 'हिन्दी',
ru_RU: 'Русский', ru_RU: 'Русский',
ar_SA: 'العربية', ar_SA: 'العربية',
fr_FR: 'Français' fr_FR: 'Français'**/
} }
const i18n = createI18n({ const i18n = createI18n({
@ -28,13 +30,13 @@ const i18n = createI18n({
locale, locale,
messages: { messages: {
zh_HK, zh_HK,
en_US, /** en_US,
es_ES, es_ES,
pt_BR, pt_BR,
hi_IN, hi_IN,
ru_RU, ru_RU,
ar_SA, ar_SA,
fr_FR fr_FR**/
} }
}) })

View File

@ -1,7 +1,7 @@
import en_USLocale from './en/index' //import en_USLocale from './en/index'
import zh_HKLocale from './zh_HK/index' import zh_HKLocale from './zh_HK/index'
export default { export default {
en_US: en_USLocale, //en_US: en_USLocale,
zh_HK: zh_HKLocale zh_HK: zh_HKLocale
} }

View File

@ -0,0 +1,179 @@
export default {
image1: 'Despir em um clique',
image2: 'Imagem para Imagem 2',
uploadImage: 'Enviar imagem',
uploadImageTip: 'PNG/JPG, máx. 10MB',
uploadPlaceholder: 'Clique para enviar imagem',
selectImageSource: 'Selecionar origem da imagem',
selectTemplate: 'Selecionar modelo',
reselectTemplate: 'Selecionar outro modelo',
noTemplates: 'Sem modelos',
tag1: 'Tipo de tag 1',
tag2: 'Tipo de tag 2',
tag3: 'Tipo de tag 3',
generateImage: 'Gerar agora (usa {score} de saldo)',
generateImageNow: 'Gerar agora',
generateTip: 'Após enviar, veja em "Minhas obras"',
generateVideo: 'Gerar vídeo',
imageFace: 'Trocar rosto em imagem',
videoFace: 'Trocar rosto em vídeo',
uploadImageFace: 'Clique para enviar imagem do rosto',
uploadTemplate: 'Clique para enviar modelo personalizado',
textPlaceholder: 'Descreva a imagem que deseja gerar',
uploadImageError: 'Envie uma imagem',
replaceImage: 'Substituir imagem',
uploadFaceImageError: 'Envie uma imagem do rosto',
uploadTemplateError: 'Envie um modelo personalizado',
textError: 'Digite o texto de indicação',
textVideoPlaceholder: 'Descreva o vídeo que deseja gerar',
uploadFirstPlaceholder: 'Clique para enviar primeiro frame',
uploadLastPlaceholder: 'Clique para enviar último frame',
uploadFirstImageError: 'Envie a imagem do primeiro frame',
uploadWaitImageError: 'Aguarde o envio terminar',
saveVideo: 'Baixar vídeo',
videoLoadingText: 'Gerando vídeo...',
viewVideo: 'Ver vídeo',
changeFacePrompt: 'Extrair o rosto da segunda imagem e substituir na primeira',
rechartTip1: 'Ao recarregar por carteira, confirme a rede do carteira.',
rechartTip2: 'A recarga pode atrasar; aguarde 3-5 minutos antes de atualizar.',
walletAddr: 'Endereço da carteira',
fbTitle: 'Aviso: este site é apenas para maiores de 18 anos.',
fbContent: 'Ao entrar confirmo que tenho 18 anos ou mais',
fbCancel: 'Menor de 18',
fbOK: 'Tenho 18 ou mais',
sorry: 'Desculpe!',
useLess: 'Você não pode usar este site...',
loginAccount: 'Entrar',
logout: 'Sair',
userEmailPlaceholder: 'Digite e-mail ou usuário',
passwordPlaceholder: 'Digite a senha',
forgetPassword: 'Esqueceu a senha?',
register: 'Cadastrar',
login: 'Entrar',
forgotPassword: 'Esqueci a senha',
registerAccount: 'Criar conta',
usernamePlaceholder: 'Digite o usuário',
codePlaceholder: 'Digite o código de verificação',
confirmPasswordPlaceholder: 'Confirme a senha',
backToLogin: 'Voltar ao login',
send: 'Enviar',
emailValidPlaceholder: 'Digite um e-mail válido',
confirmPwdValidMsg: 'As senhas não coincidem',
editPassword: 'Alterar senha',
recharge: 'Recarregar',
myAccount: 'Minha conta',
moneyInvite: 'Convite com recompensa',
rechargeRecord: 'Histórico de recargas',
resumeRecord: 'Histórico de consumo',
inviteRecord: 'Histórico de convites',
username: 'Usuário',
userId: 'ID do usuário',
accountAmount: 'Saldo',
editUserInfo: 'Editar dados',
contact: 'Contato',
backToUser: 'Voltar',
moneyTips: 'Ao convidar um amigo, você ganha {rate} do valor que ele recarregar.',
inviteCode: 'Código de convite',
inviteLink: 'Link de convite',
saveImage: 'Salvar imagem',
totalAmount: 'Total recarregado',
amount: 'Valor',
sendAmount: 'Valor de brinde',
rechargeType: 'Forma de recarga',
rechargeTime: 'Data da recarga',
emptyText: 'Sem dados',
product: 'Obra',
resumeAmount: 'Valor consumido',
productType: 'Tipo de obra',
productTime: 'Data de criação',
totalReward: 'Saldo de recompensas',
rewardAmount: 'Valor da recompensa',
rewardTime: 'Data da recompensa',
reSend: 'Reenviar',
registerSuccessfully: 'Cadastro concluído',
loginSuccessfully: 'Login realizado',
passwordResetSuccessfully: 'Senha redefinida',
rechargeSuccessfully: 'Recarga concluída',
avatar: 'Avatar',
input: 'Digite',
save: 'Salvar',
editEmail: 'Alterar e-mail',
editEmailSuccessfully: 'E-mail atualizado',
updateAvatarSuccessfully: 'Avatar atualizado',
balenceLow: 'Saldo insuficiente, recarregue',
confirm: 'Confirmar',
createFailed: 'Falha na geração, saldo devolvido',
notice: 'Aviso',
oldPasswordPlaceholder: 'Digite a senha antiga',
newpasswordPlaceholder: 'Digite a nova senha',
switchPageTip: 'O vídeo está sendo gerado; saia e veja o histórico de consumo.',
loginless: 'Sessão expirada; faça login novamente.',
createVideo: 'Gerar vídeo (usa {price} de saldo)',
ok: 'Confirmar',
rechartNotice: 'Instruções de recarga',
rechargeNotice1: '1. A recarga é creditada na hora. Se não mudar, atualize a página.',
rechargeNotice2: '2. Pacotes por tempo limitado são promoções; você pode recarregar várias vezes.',
rechargeNotice3: '3. O saldo recarregado não tem prazo.',
rechargeNotice4: 'Confira o pacote antes de comprar; não há reembolso.',
rechargeLeft: 'Saldo',
dollor: 'USD',
isDevelop: 'Em desenvolvimento.',
copySuccessfully: 'Copiado',
copyLink: 'Copiar link',
goPay: 'Ir para pagamento',
filePreview: 'Visualizar',
doSame: 'Fazer igual',
saveQRCode: 'Salvar código QR',
invitationCodePlaceholder: 'Digite o código de convite',
testRecharge: 'Recarga de teste',
orderNo: 'Número do pedido',
orderNoP: 'O número do pedido é obrigatório',
emailNotExists: 'O e-mail não está cadastrado',
gearNotExists: 'O plano de recarga não existe; escolha outro.',
myProduct: 'Minhas obras',
permissionError: 'Sua recarga acumulada é {total}, não atende para visualizar.',
createTagFailed: 'Falha na geração; atualize e tente de novo.',
loadingText: 'Carregando...',
hasMore: 'Deslize para mais',
noMore: 'Não há mais',
giftAmount: 'Valor creditado',
cardNo: 'Número do cartão',
cardName: 'Nome no cartão',
cardNoRequired: 'Digite o número do cartão',
cardNameRequired: 'Digite o nome no cartão',
rechargeFailed: 'Recarga falhou',
vmCardInfo: 'Dados do cartão',
cardNumber: 'Número do cartão',
cardNumberPlaceholder: 'Digite o número do cartão',
cardNumberRequired: 'Digite o número do cartão',
cardNumberInvalid: 'O número deve ter 13-19 dígitos',
cvc: 'CVC',
cvcPlaceholder: 'Digite o CVC',
cvcRequired: 'Digite o CVC',
cvcInvalid: 'CVC deve ter 3 dígitos',
expYear: 'Ano de validade',
expYearPlaceholder: 'Digite o ano (ex.: 2027)',
expYearRequired: 'Digite o ano de validade',
expYearInvalid: 'O ano deve ter 4 dígitos',
expMonth: 'Mês de validade',
expMonthPlaceholder: 'Selecione o mês',
expMonthRequired: 'Selecione o mês',
email: 'E-mail',
emailPlaceholder: 'Digite o e-mail',
emailRequired: 'Digite o e-mail',
emailInvalid: 'Formato de e-mail inválido',
emailMaxLength: 'Máx. 30 caracteres',
firstName: 'Nome',
firstNamePlaceholder: 'Digite o nome',
firstNameRequired: 'Digite o nome',
firstNameMaxLength: 'Máx. 30 caracteres',
lastName: 'Sobrenome',
lastNamePlaceholder: 'Digite o sobrenome',
lastNameRequired: 'Digite o sobrenome',
lastNameMaxLength: 'Máx. 30 caracteres',
country: 'País',
countryPlaceholder: 'Selecione o país',
countryRequired: 'Selecione o país',
submit: 'Enviar',
cancel: 'Cancelar'
}

View File

@ -0,0 +1,7 @@
import route from './route'
import common from './common.js'
export default {
route,
common
}

View File

@ -0,0 +1,14 @@
export default {
index: 'Início',
imageToImage: 'Despir em um clique',
imageToImage2: 'Imagem para Imagem 2',
changeFace: 'Trocar rosto',
changeFaceVideo: 'Trocar rosto em vídeo',
fastImage: 'Gerar imagem',
fastVideo: 'Gerar vídeo',
recharge: 'Recarga rápida',
help: 'Central de ajuda',
moneyInvite: 'Convite com recompensa',
assetGroupManage: 'Gerenciamento de grupos de ativos',
assetManage: 'Gerenciamento de ativos'
}

View File

@ -0,0 +1,179 @@
export default {
image1: 'Раздеть в один клик',
image2: 'Изображение в изображение 2',
uploadImage: 'Загрузить изображение',
uploadImageTip: 'PNG/JPG, макс. 10 МБ',
uploadPlaceholder: 'Нажмите, чтобы загрузить',
selectImageSource: 'Выберите источник изображения',
selectTemplate: 'Выберите шаблон',
reselectTemplate: 'Выбрать шаблон заново',
noTemplates: 'Нет шаблонов',
tag1: 'Тип метки 1',
tag2: 'Тип метки 2',
tag3: 'Тип метки 3',
generateImage: 'Создать сейчас (списание {score} с баланса)',
generateImageNow: 'Создать сейчас',
generateTip: 'После отправки смотрите в «Мои работы»',
generateVideo: 'Создать видео',
imageFace: 'Заменить лицо на изображении',
videoFace: 'Заменить лицо в видео',
uploadImageFace: 'Нажмите, чтобы загрузить фото лица',
uploadTemplate: 'Нажмите, чтобы загрузить свой шаблон',
textPlaceholder: 'Опишите изображение, которое хотите получить',
uploadImageError: 'Загрузите изображение',
replaceImage: 'Заменить изображение',
uploadFaceImageError: 'Загрузите фото лица',
uploadTemplateError: 'Загрузите свой шаблон',
textError: 'Введите текст подсказки',
textVideoPlaceholder: 'Опишите видео, которое хотите получить',
uploadFirstPlaceholder: 'Нажмите, чтобы загрузить первый кадр',
uploadLastPlaceholder: 'Нажмите, чтобы загрузить последний кадр',
uploadFirstImageError: 'Загрузите изображение первого кадра',
uploadWaitImageError: 'Дождитесь окончания загрузки',
saveVideo: 'Скачать видео',
videoLoadingText: 'Создание видео...',
viewVideo: 'Смотреть видео',
changeFacePrompt: 'Взять лицо со второй картинки и заменить им лицо на первой',
rechartTip1: 'При пополнении через кошелёк проверьте сеть кошелька.',
rechartTip2: 'Зачисление может задерживаться; подождите 35 минут и обновите.',
walletAddr: 'Адрес кошелька:',
fbTitle: 'Внимание! Сайт только для взрослых!',
fbContent: 'Входя, я подтверждаю, что мне 18 лет или больше',
fbCancel: 'Мне нет 18',
fbOK: 'Мне есть 18',
sorry: 'Извините!',
useLess: 'Вам запрещено пользоваться этим сайтом...',
loginAccount: 'Вход',
logout: 'Выйти',
userEmailPlaceholder: 'Введите email или логин',
passwordPlaceholder: 'Введите пароль',
forgetPassword: 'Забыли пароль?',
register: 'Регистрация',
login: 'Войти',
forgotPassword: 'Забыл пароль',
registerAccount: 'Создать аккаунт',
usernamePlaceholder: 'Введите имя пользователя',
codePlaceholder: 'Введите код подтверждения',
confirmPasswordPlaceholder: 'Подтвердите пароль',
backToLogin: 'Вернуться к входу',
send: 'Отправить',
emailValidPlaceholder: 'Введите корректный email',
confirmPwdValidMsg: 'Пароли не совпадают',
editPassword: 'Изменить пароль',
recharge: 'Пополнить',
myAccount: 'Мой аккаунт',
moneyInvite: 'Приглашение с наградой',
rechargeRecord: 'История пополнений',
resumeRecord: 'История списаний',
inviteRecord: 'История приглашений',
username: 'Имя пользователя',
userId: 'ID пользователя',
accountAmount: 'Баланс',
editUserInfo: 'Редактировать данные',
contact: 'Связаться с нами',
backToUser: 'Назад',
moneyTips: 'При регистрации по вашей ссылке вы получаете {rate} от каждой его пополнения.',
inviteCode: 'Код приглашения',
inviteLink: 'Ссылка приглашения',
saveImage: 'Сохранить изображение',
totalAmount: 'Всего пополнено',
amount: 'Сумма',
sendAmount: 'Сумма бонуса',
rechargeType: 'Способ пополнения',
rechargeTime: 'Время пополнения',
emptyText: 'Нет данных',
product: 'Работа',
resumeAmount: 'Списано',
productType: 'Тип работы',
productTime: 'Дата создания',
totalReward: 'Баланс наград',
rewardAmount: 'Сумма награды',
rewardTime: 'Время награды',
reSend: 'Отправить снова',
registerSuccessfully: 'Регистрация выполнена',
loginSuccessfully: 'Вход выполнен',
passwordResetSuccessfully: 'Пароль сброшен',
rechargeSuccessfully: 'Пополнение выполнено',
avatar: 'Аватар',
input: 'Введите',
save: 'Сохранить',
editEmail: 'Изменить email',
editEmailSuccessfully: 'Email обновлён',
updateAvatarSuccessfully: 'Аватар обновлён',
balenceLow: 'Недостаточно средств, пополните баланс',
confirm: 'Подтвердить',
createFailed: 'Ошибка создания, средства возвращены',
notice: 'Уведомление',
oldPasswordPlaceholder: 'Введите старый пароль',
newpasswordPlaceholder: 'Введите новый пароль',
switchPageTip: 'Видео создаётся; выйдите и проверьте историю списаний.',
loginless: 'Сессия истекла. Войдите снова.',
createVideo: 'Создать видео (списание {price} с баланса)',
ok: 'Подтвердить',
rechartNotice: 'Правила пополнения',
rechargeNotice1: '1. Средства зачисляются сразу. Если не изменилось — обновите страницу.',
rechargeNotice2: '2. Акционные пакеты проводятся периодически; можно пополнять несколько раз.',
rechargeNotice3: '3. Пополненный баланс не имеет срока действия.',
rechargeNotice4: 'Перед покупкой ознакомьтесь с пакетом; возврат не предусмотрен.',
rechargeLeft: 'Баланс',
dollor: 'USD',
isDevelop: 'В разработке.',
copySuccessfully: 'Скопировано',
copyLink: 'Копировать ссылку',
goPay: 'Перейти к оплате',
filePreview: 'Предпросмотр',
doSame: 'Сделать похожее',
saveQRCode: 'Сохранить QR-код',
invitationCodePlaceholder: 'Введите код приглашения',
testRecharge: 'Тестовое пополнение',
orderNo: 'Номер заказа',
orderNoP: 'Номер заказа обязателен',
emailNotExists: 'Этот email не зарегистрирован',
gearNotExists: 'Выбранный тариф отсутствует; выберите другой.',
myProduct: 'Мои работы',
permissionError: 'Ваше суммарное пополнение {total}, недостаточно для просмотра.',
createTagFailed: 'Ошибка создания; обновите страницу и повторите.',
loadingText: 'Загрузка...',
hasMore: 'Потяните вверх для подгрузки',
noMore: 'Больше нет',
giftAmount: 'Зачисленная сумма',
cardNo: 'Номер карты',
cardName: 'Имя владельца',
cardNoRequired: 'Введите номер карты',
cardNameRequired: 'Введите имя владельца',
rechargeFailed: 'Ошибка пополнения',
vmCardInfo: 'Данные карты',
cardNumber: 'Номер карты',
cardNumberPlaceholder: 'Введите номер карты',
cardNumberRequired: 'Введите номер карты',
cardNumberInvalid: 'Номер карты должен быть из 1319 цифр',
cvc: 'CVC',
cvcPlaceholder: 'Введите CVC',
cvcRequired: 'Введите CVC',
cvcInvalid: 'CVC должен быть из 3 цифр',
expYear: 'Год срока действия',
expYearPlaceholder: 'Введите год (например 2027)',
expYearRequired: 'Введите год',
expYearInvalid: 'Год должен быть из 4 цифр',
expMonth: 'Месяц срока действия',
expMonthPlaceholder: 'Выберите месяц',
expMonthRequired: 'Выберите месяц',
email: 'Email',
emailPlaceholder: 'Введите email',
emailRequired: 'Введите email',
emailInvalid: 'Некорректный email',
emailMaxLength: 'Email не более 30 символов',
firstName: 'Имя',
firstNamePlaceholder: 'Введите имя',
firstNameRequired: 'Введите имя',
firstNameMaxLength: 'Имя не более 30 символов',
lastName: 'Фамилия',
lastNamePlaceholder: 'Введите фамилию',
lastNameRequired: 'Введите фамилию',
lastNameMaxLength: 'Фамилия не более 30 символов',
country: 'Страна',
countryPlaceholder: 'Выберите страну',
countryRequired: 'Выберите страну',
submit: 'Отправить',
cancel: 'Отмена'
}

View File

@ -0,0 +1,7 @@
import route from './route'
import common from './common.js'
export default {
route,
common
}

View File

@ -0,0 +1,14 @@
export default {
index: 'Главная',
imageToImage: 'Раздеть в один клик',
imageToImage2: 'Изображение в изображение 2',
changeFace: 'Заменить лицо',
changeFaceVideo: 'Заменить лицо в видео',
fastImage: 'Создать изображение',
fastVideo: 'Создать видео',
recharge: 'Быстрая пополнение',
help: 'Центр помощи',
moneyInvite: 'Приглашение с наградой',
assetGroupManage: 'Управление группами ресурсов',
assetManage: 'Управление ресурсами'
}

View File

@ -47,6 +47,9 @@ export default {
logout: '退出登入', logout: '退出登入',
userEmailPlaceholder: '請輸入郵箱或帳號', userEmailPlaceholder: '請輸入郵箱或帳號',
passwordPlaceholder: '請輸入密碼', passwordPlaceholder: '請輸入密碼',
loginLabelAccount: '郵箱或帳號',
loginLabelPassword: '密碼',
loginSubtitle: '請輸入帳號與密碼以登入',
forgetPassword: '忘記密碼?', forgetPassword: '忘記密碼?',
register: '註冊', register: '註冊',
login: '登入', login: '登入',
@ -145,6 +148,13 @@ export default {
cardNoRequired: '請輸入銀行卡號', cardNoRequired: '請輸入銀行卡號',
cardNameRequired: '請輸入銀行卡姓名', cardNameRequired: '請輸入銀行卡姓名',
rechargeFailed: '充值失敗', rechargeFailed: '充值失敗',
// 模型选择
selectModel: '選擇模型',
seedance20: 'Seedance 2.0',
seedance20Fast: 'Seedance 2.0 Fast',
// 富文本编辑器
mentionImage: '引用圖片',
noImageToMention: '暫無可引用的圖片',
// VM支付相關 // VM支付相關
vmCardInfo: '信用卡信息', vmCardInfo: '信用卡信息',
cardNumber: '信用卡卡號', cardNumber: '信用卡卡號',
@ -178,6 +188,9 @@ export default {
country: '國家', country: '國家',
countryPlaceholder: '請選擇國家', countryPlaceholder: '請選擇國家',
countryRequired: '請選擇國家', countryRequired: '請選擇國家',
videoGen: '視頻生成',
uploadFirstImage: '上傳首圖',
insertImage: '插入圖片',
submit: '提交', submit: '提交',
cancel: '取消' cancel: '取消'
} }

View File

@ -6,7 +6,11 @@ export default {
changeFaceVideo: '視頻換臉', changeFaceVideo: '視頻換臉',
fastImage: '快捷生圖', fastImage: '快捷生圖',
fastVideo: '快捷生視頻', fastVideo: '快捷生視頻',
videoGen: '視頻生成',
recharge: '快速充值', recharge: '快速充值',
help: '幫助中心', help: '幫助中心',
moneyInvite: '有獎邀請' moneyInvite: '有獎邀請',
assetGroupManage: '資源組管理',
assetManage: '素材管理',
generatedAssets: '作品库'
} }

View File

@ -197,7 +197,7 @@ export default {
); );
background-color: transparent !important; background-color: transparent !important;
border-radius: 20px; border-radius: 20px;
border: 2px solid #e6217a; border: 1px solid rgb(var(--primary-6));
width: 500px; width: 500px;
top: 45% !important; top: 45% !important;
transform: translateY(-45%) !important; transform: translateY(-45%) !important;

View File

@ -244,7 +244,7 @@ export default {
); );
background-color: transparent !important; background-color: transparent !important;
border-radius: 20px; border-radius: 20px;
border: 2px solid #e6217a; border: 1px solid rgb(var(--primary-6));
width: 500px; width: 500px;
top: 45% !important; top: 45% !important;
transform: translateY(-45%) !important; transform: translateY(-45%) !important;

View File

@ -14,39 +14,41 @@
value="icon-close" value="icon-close"
@click="cancel" /> @click="cancel" />
</div> </div>
<div class="login-title"> <div class="login-card">
<header class="login-header">
<h2 class="login-title">
{{ $t('common.loginAccount') }} {{ $t('common.loginAccount') }}
<!-- <div class="login-title-lang"> </h2>
<div <p class="login-desc">
:class="`login-title-lang-item ${ {{ $t('common.loginSubtitle') }}
lang == 'zh_HK' ? 'active' : '' </p>
}`" </header>
@click="changeLang('zh_HK')">
繁中 <div class="login-field">
</div> <label class="login-label" for="login-field-username">
<div class="login-title-lang-divider"></div> {{ $t('common.loginLabelAccount') }}
<div </label>
:class="`login-title-lang-item ${
lang == 'en_US' ? 'active' : ''
}`"
@click="changeLang('en_US')">
English
</div>
</div> -->
</div>
<mf-input <mf-input
id="login-field-username"
v-model="username" v-model="username"
class="login-input" class="login-input"
:placeholder="`${$t('common.userEmailPlaceholder')}`" /> :placeholder="$t('common.userEmailPlaceholder')" />
</div>
<div class="login-field">
<label class="login-label" for="login-field-password">
{{ $t('common.loginLabelPassword') }}
</label>
<mf-input <mf-input
id="login-field-password"
v-model="password" v-model="password"
class="login-input" class="login-input"
inputType="password" inputType="password"
:placeholder="`${$t('common.passwordPlaceholder')}`" /> :placeholder="$t('common.passwordPlaceholder')" />
</div>
<div class="login-link"> <div class="login-link">
<mf-button <mf-button
class="grey" class="login-link-btn"
type="text" type="text"
@click="showForgot"> @click="showForgot">
{{ $t('common.forgotPassword') }} {{ $t('common.forgotPassword') }}
@ -54,11 +56,7 @@
</div> </div>
<div class="login-submit"> <div class="login-submit">
<mf-button <mf-button
size="large" class="login-btn-primary"
@click="showRegister">
{{ $t('common.register') }}
</mf-button>
<mf-button
size="large" size="large"
type="primary" type="primary"
@click="login" @click="login"
@ -66,6 +64,15 @@
{{ $t('common.login') }} {{ $t('common.login') }}
</mf-button> </mf-button>
</div> </div>
<div class="login-register">
<mf-button
class="login-register-btn"
type="text"
@click="showRegister">
{{ $t('common.register') }}
</mf-button>
</div>
</div>
</mf-dialog> </mf-dialog>
<Forgot <Forgot
v-if="forgotVisible" v-if="forgotVisible"
@ -86,8 +93,6 @@
<script> <script>
import Forgot from './Forgot.vue' import Forgot from './Forgot.vue'
import Register from './Register.vue' import Register from './Register.vue'
import { mapGetters } from 'vuex'
import i18n from '@/lang/i18n'
export default { export default {
data() { data() {
@ -109,9 +114,6 @@ export default {
Forgot, Forgot,
Register Register
}, },
computed: {
...mapGetters(['lang'])
},
mounted() { mounted() {
// let loginInfo = this.$auth.getLogin() // let loginInfo = this.$auth.getLogin()
// if (loginInfo) { // if (loginInfo) {
@ -136,12 +138,6 @@ export default {
this.registerVisible = true this.registerVisible = true
this.$emit('cancel') this.$emit('cancel')
}, },
changeLang(value) {
if (value != this.lang) {
this.$store.dispatch('main/setLanguage', value)
i18n.global.locale = value
}
},
back() { back() {
this.forgotVisible = false this.forgotVisible = false
this.$emit('open') this.$emit('open')
@ -181,6 +177,7 @@ export default {
}) })
this.username = "" this.username = ""
this.password = "" this.password = ""
this.$router.replace({ name: 'video-gen' })
this.$emit('cancel') this.$emit('cancel')
}) })
} else { } else {
@ -200,158 +197,262 @@ export default {
</script> </script>
<style lang="less"> <style lang="less">
/* 与 portal-ui 深色壳层一致;表单项带标签,输入区为内嵌深色非白底 */
.login-dialog { .login-dialog {
border-radius: 20px; border-radius: 20px;
overflow: hidden; overflow: visible;
background: linear-gradient( background: var(--portal-bg-deep);
0deg, border: 1px solid rgba(148, 163, 184, 0.12);
rgba(39, 20, 51, 0.7) 0%,
rgba(230, 33, 122, 0.7) 49%
);
border-radius: 20px;
border: 2px solid #e6217a;
width: 500px; width: 500px;
height: 320px; min-height: auto;
top: 45% !important; top: 45% !important;
transform: translateY(-45%) !important; transform: translateY(-45%) !important;
box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
&-wrapper { &-wrapper {
.arco-modal-mask { .arco-modal-mask {
/* 背景高斯模糊关键属性 */
backdrop-filter: blur(10px); backdrop-filter: blur(10px);
background-color: rgba(0, 0, 0, 0.7); background-color: rgba(6, 8, 13, 0.72);
} }
} }
.arco-modal-body { .arco-modal-body {
padding: 24px 30px 30px 30px; padding: 20px 24px 28px;
background: transparent;
} }
.login-close { .login-close {
position: absolute; position: absolute;
right: 12px; right: 14px;
top: 6px; top: 10px;
z-index: 2;
cursor: pointer; cursor: pointer;
color: #fff; color: var(--portal-text-muted);
&:hover {
color: var(--portal-text-strong);
}
.mf-icon { .mf-icon {
font-size: 14px; font-size: 16px;
} }
} }
.login-card {
background: linear-gradient(
165deg,
rgba(20, 27, 38, 0.97) 0%,
rgba(15, 20, 28, 0.99) 100%
);
border-radius: 24px;
border: 1px solid rgba(148, 163, 184, 0.1);
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
padding: 36px 32px 32px;
}
.login-header {
margin-bottom: 28px;
}
.login-title { .login-title {
font-size: 20px; margin: 0;
color: #ffffff; font-size: 26px;
margin-bottom: 10px; line-height: 1.3;
display: flex; font-weight: 600;
align-items: center; color: var(--portal-text-strong);
justify-content: space-between; letter-spacing: -0.02em;
&-lang {
display: flex;
align-items: center;
height: 24px;
background: rgba(0, 0, 0, 0.3);
border-radius: 5px;
&-divider {
height: 8px;
width: 1px;
background-color: rgba(#fff, 0.2);
} }
&-item { .login-desc {
display: flex; margin: 10px 0 0;
align-items: center; font-size: 13px;
justify-content: center; line-height: 1.5;
padding: 0 16px; color: var(--portal-text-muted);
font-size: 12px; }
color: rgba(#ffffff, 0.3);
cursor: pointer;
&.active { .login-field {
color: #fff; & + .login-field {
} margin-top: 22px;
} }
} }
.login-label {
display: block;
font-size: 13px;
font-weight: 600;
color: rgba(226, 232, 240, 0.92);
margin-bottom: 8px;
letter-spacing: 0.01em;
} }
.login-input { .login-input {
display: flex; display: block;
align-items: center; width: 100%;
border-radius: 10px;
justify-content: center;
border-radius: 10px;
border: 1px solid rgba(#ffffff, 0.3);
height: 40px;
margin-top: 20px;
padding: 0 16px;
font-size: 14px;
color: #ffffff;
position: relative;
cursor: pointer;
background-color: transparent !important;
cursor: text;
font-size: 14px;
::placeholder { /* mf-input 根节点本身就是 arco-input-wrapper需要直接覆盖 */
color: rgba(#fff, 0.5); &.arco-input-wrapper {
height: 48px;
min-height: 48px;
border-radius: 12px;
border: 1px solid rgba(148, 163, 184, 0.2) !important;
background: rgba(51, 65, 85, 0.55) !important;
background-color: rgba(51, 65, 85, 0.55) !important;
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.25);
--color-fill-2: rgba(51, 65, 85, 0.55);
}
&.arco-input-wrapper:hover {
border-color: rgba(148, 163, 184, 0.3) !important;
background-color: rgba(51, 65, 85, 0.68) !important;
} }
&.arco-input-wrapper:focus-within { &.arco-input-wrapper:focus-within {
background-color: transparent; border-color: rgba(148, 163, 184, 0.45) !important;
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(148, 163, 184, 0.28);
background-color: rgba(51, 65, 85, 0.75) !important;
} }
&:hover { &.arco-input-wrapper :deep(.arco-input),
background-color: transparent; &.arco-input-wrapper :deep(input.arco-input) {
border-color: #fff; height: 46px;
font-size: 15px;
line-height: 46px;
color: var(--portal-text-strong) !important;
background: transparent !important;
background-color: transparent !important;
-webkit-text-fill-color: var(--portal-text-strong);
} }
.arco-image { &.arco-input-wrapper :deep(.arco-input::placeholder),
position: absolute; &.arco-input-wrapper :deep(input.arco-input::placeholder) {
left: 16px; color: rgba(203, 213, 225, 0.88) !important;
&-img { -webkit-text-fill-color: rgba(203, 213, 225, 0.88);
opacity: 1 !important;
}
/* 密码组件:按钮在右侧一行内,不要纵向堆叠 */
:deep(.arco-input-password) {
display: block;
width: 100%; width: 100%;
height: 100%;
vertical-align: unset;
}
}
} }
.login-submit { :deep(.arco-input-password .arco-input-wrapper) {
display: flex; display: inline-flex;
align-items: center; align-items: center;
justify-content: center; width: 100%;
margin-top: 30px; }
.mf-button {
width: 160px;
border-radius: 10px;
margin: 0 14px;
&:first-child { :deep(.arco-input-wrapper) {
color: #ffffff; height: 48px;
background-color: #1a1a1a; min-height: 48px;
&:hover { border-radius: 12px;
background-color: #262626; border: 1px solid rgba(148, 163, 184, 0.2) !important;
background-color: rgba(51, 65, 85, 0.55) !important;
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.25);
transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
/* 盖住 Arco 默认浅色填充,避免白底 */
--color-fill-2: rgba(51, 65, 85, 0.55);
} }
&:active {
background-color: #0d0d0d; :deep(.arco-input-wrapper:hover) {
border-color: rgba(148, 163, 184, 0.3) !important;
background-color: rgba(51, 65, 85, 0.68) !important;
} }
:deep(.arco-input-wrapper:focus-within) {
border-color: rgba(148, 163, 184, 0.45) !important;
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(148, 163, 184, 0.28);
background-color: rgba(51, 65, 85, 0.75) !important;
} }
:deep(.arco-input) {
height: 46px;
font-size: 15px;
line-height: 46px;
color: var(--portal-text-strong) !important;
background: transparent !important;
background-color: transparent !important;
-webkit-text-fill-color: var(--portal-text-strong);
}
/* 占位符提亮,保证在深色底上可读 */
:deep(.arco-input::placeholder),
:deep(input.arco-input::placeholder) {
color: rgba(203, 213, 225, 0.88) !important;
-webkit-text-fill-color: rgba(203, 213, 225, 0.88);
opacity: 1 !important;
}
:deep(.arco-icon-hover) {
color: rgba(203, 213, 225, 0.85);
}
:deep(.arco-input-clear-btn) {
color: rgba(203, 213, 225, 0.75);
}
/* 明文切换在 suffix 最右侧 */
:deep(.arco-input-suffix) {
display: inline-flex;
align-items: center;
flex-shrink: 0;
padding-right: 4px;
}
:deep(.arco-input-suffix .arco-icon),
:deep(.arco-input-suffix svg) {
color: rgba(203, 213, 225, 0.8);
} }
} }
.login-link { .login-link {
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
color: #999; margin-top: 12px;
margin-top: 10px;
.mf-button { .login-link-btn,
.login-link-btn.arco-btn {
padding: 0; padding: 0;
height: auto;
font-size: 14px;
color: #fff; color: #fff;
font-size: 12px; background: transparent !important;
&:hover { &:hover {
background-color: transparent; color: #fff;
background: transparent !important;
}
}
}
.login-submit {
margin-top: 24px;
width: 100%;
.login-btn-primary {
width: 100%;
height: 48px;
border-radius: 40px !important;
font-size: 16px;
font-weight: 600;
}
}
.login-register {
margin-top: 16px;
text-align: center;
.login-register-btn,
.login-register-btn.arco-btn {
padding: 4px 12px;
height: auto;
font-size: 15px;
color: #fff;
background: transparent !important;
&:hover {
color: #fff;
background: transparent !important;
} }
} }
} }
@ -360,6 +461,18 @@ export default {
@media (max-width: 576px) { @media (max-width: 576px) {
.login-dialog { .login-dialog {
width: calc(100% - 16px) !important; width: calc(100% - 16px) !important;
.login-card {
padding: 28px 20px 26px;
}
.login-title {
font-size: 22px;
}
.login-header {
margin-bottom: 24px;
}
} }
} }
</style> </style>

View File

@ -1,5 +1,7 @@
<template> <template>
<div class="menu-wrapper"> <div
class="menu-wrapper"
:class="{ 'menu-wrapper--collapsed': collapsed }">
<a-scrollbar> <a-scrollbar>
<a-menu <a-menu
:collapsed="collapsed" :collapsed="collapsed"
@ -22,15 +24,11 @@
<template v-else> <template v-else>
<a-menu-item :key="item.key"> <a-menu-item :key="item.key">
<template #icon> <template #icon>
<a-image <span
:width="24" class="menu-svg-icon"
:preview="false" :class="{ active: selectedKeys.indexOf(item.key) > -1 }"
:height="24" v-html="getMenuSvg(item.key)"
:src="`/images/nav/${ ></span>
selectedKeys.indexOf(item.key) > -1
? item.icon + '-a'
: item.icon
}.png`" />
</template> </template>
<div class="menu-item"> <div class="menu-item">
{{ item.label }} {{ item.label }}
@ -50,6 +48,9 @@ import cloneDeep from 'lodash-es/cloneDeep'
import { constantRoutes } from '@/router/index' import { constantRoutes } from '@/router/index'
import { generateTitle, generateLang } from '@/utils/i18n' import { generateTitle, generateLang } from '@/utils/i18n'
/** 左侧导航仅显示这些路由name 与 router/index.js 一致) */
const SIDEBAR_ONLY_ROUTE_NAMES = ['video-gen', 'asset-group-manage', 'asset-manage', 'generatedAssets']
defineProps({ defineProps({
collapsed: Boolean collapsed: Boolean
}) })
@ -62,9 +63,14 @@ const $base = inject('$base')
const $message = inject('$message') const $message = inject('$message')
const menuItems = computed(() => { const menuItems = computed(() => {
return constantRoutes const root = constantRoutes.find((d) => d.path === '/')
.find((d) => d.path == '/') const children = root?.children ?? []
.children.map((route) => ({ return children
.filter(
(r) =>
r.meta?.menuItem !== false && SIDEBAR_ONLY_ROUTE_NAMES.includes(r.name)
)
.map((route) => ({
key: route.name, key: route.name,
label: generateTitle(route.meta?.title), label: generateTitle(route.meta?.title),
meta: route.meta, meta: route.meta,
@ -140,6 +146,19 @@ const count = (system) => {
? servicePolicyCount.value ? servicePolicyCount.value
: agencyPolicyCount.value : agencyPolicyCount.value
} }
const getMenuSvg = (key) => {
if (key === 'video-gen') {
return '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3a9 9 0 1 0 0 18a9 9 0 0 0 0-18Zm-1.5 5.2a.9.9 0 0 1 1.35-.78l4.7 2.7a.9.9 0 0 1 0 1.56l-4.7 2.7a.9.9 0 0 1-1.35-.78V8.2Z"/></svg>'
}
if (key === 'asset-group-manage') {
return '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M3 6.5A2.5 2.5 0 0 1 5.5 4H9l1.7 2H18.5A2.5 2.5 0 0 1 21 8.5v8A2.5 2.5 0 0 1 18.5 19h-13A2.5 2.5 0 0 1 3 16.5v-10Z"/></svg>'
}
if (key === 'asset-manage') {
return '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M5 4h14a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2Zm1.8 11.5h10.4L14 11.4l-2.6 3.1-1.7-2.1-2.9 3.1Zm2.7-6.1a1.6 1.6 0 1 0 0-3.2a1.6 1.6 0 0 0 0 3.2Z"/></svg>'
}
return '<svg viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="8"/></svg>'
}
</script> </script>
<style lang="less"> <style lang="less">
.arco-tooltip-content { .arco-tooltip-content {
@ -149,16 +168,39 @@ const count = (system) => {
<style lang="less" scoped> <style lang="less" scoped>
.menu-wrapper { .menu-wrapper {
height: 100%; height: 100%;
width: 100%;
max-width: 100%;
box-sizing: border-box;
overflow-x: hidden;
.arco-scrollbar { .arco-scrollbar {
height: 100%; height: 100%;
max-width: 100%;
:deep(.arco-scrollbar-container) { :deep(.arco-scrollbar-container) {
height: 100%; height: 100%;
max-width: 100%;
overflow-x: hidden; overflow-x: hidden;
overflow-y: auto; overflow-y: auto;
} }
} }
&--collapsed {
overflow-x: hidden;
:deep(.arco-scrollbar) {
max-width: 100%;
}
:deep(.arco-scrollbar-container) {
overflow-x: hidden !important;
}
/* 避免出现横向滚动条轨道 */
:deep(.arco-scrollbar-track-direction-horizontal) {
display: none !important;
}
}
} }
.menu-item { .menu-item {
@ -166,4 +208,26 @@ const count = (system) => {
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
} }
.menu-svg-icon {
width: 22px;
height: 22px;
display: inline-flex;
align-items: center;
justify-content: center;
color: var(--portal-text-muted);
transition: color 0.2s ease;
}
.menu-svg-icon:deep(svg) {
width: 22px;
height: 22px;
display: block;
fill: currentColor;
}
.menu-svg-icon.active {
color: #e2e8f0;
filter: none;
}
</style> </style>

View File

@ -102,7 +102,7 @@ export default {
&-save { &-save {
width: 410px; width: 410px;
height: 40px; height: 40px;
background: #e6217a; background: rgb(var(--primary-6));
border-radius: 10px; border-radius: 10px;
margin-top: 30px; margin-top: 30px;
} }

View File

@ -272,7 +272,7 @@ export default {
); );
background-color: transparent !important; background-color: transparent !important;
border-radius: 20px; border-radius: 20px;
border: 2px solid #e6217a; border: 1px solid rgb(var(--primary-6));
width: 500px; width: 500px;
top: 45% !important; top: 45% !important;
transform: translateY(-45%) !important; transform: translateY(-45%) !important;

View File

@ -19,31 +19,46 @@
<a-tabs <a-tabs
v-model="current" v-model="current"
lazy-load> lazy-load>
<a-tab-pane <a-tab-pane key="account">
key="account" <template #title>
:title="$t('common.myAccount')"> <span class="user-tab-title">
<svg
class="user-tab-icon"
viewBox="0 0 24 24"
aria-hidden="true">
<path
d="M12 12a4 4 0 1 0-4-4a4 4 0 0 0 4 4Zm0 2c-3.33 0-6 1.34-6 3v1h12v-1c0-1.66-2.67-3-6-3Z" />
</svg>
{{ $t('common.myAccount') }}
</span>
</template>
<UserAccount /> <UserAccount />
</a-tab-pane> </a-tab-pane>
<a-tab-pane <!-- 隐藏有奖邀请 -->
key="money" <!-- <a-tab-pane key="money" :title="$t('common.moneyInvite')"><Money /></a-tab-pane> -->
:title="$t('common.moneyInvite')"> <!-- 隐藏快速充值入口 -->
<Money /> <!-- <a-tab-pane
</a-tab-pane>
<a-tab-pane
key="recharge" key="recharge"
:title="$t('common.rechargeRecord')"> :title="$t('common.rechargeRecord')">
<RechargeRecord /> <RechargeRecord />
</a-tab-pane> </a-tab-pane> -->
<a-tab-pane <a-tab-pane key="resume">
key="resume" <template #title>
:title="$t('common.myProduct')"> <span class="user-tab-title">
<svg
class="user-tab-icon"
viewBox="0 0 24 24"
aria-hidden="true">
<path
d="M4 6.5A2.5 2.5 0 0 1 6.5 4H14l1.6 2H17.5A2.5 2.5 0 0 1 20 8.5v8a2.5 2.5 0 0 1-2.5 2.5h-11A2.5 2.5 0 0 1 4 16.5v-10ZM6 8v8h12V9.5h-2.2L14 7H6.5A.5.5 0 0 0 6 7.5V8Zm3 2.5h6v1.5H9V10.5Zm0 3h4v1.5H9V13.5Z" />
</svg>
{{ $t('common.myProduct') }}
</span>
</template>
<ResumeRecord /> <ResumeRecord />
</a-tab-pane> </a-tab-pane>
<a-tab-pane <!-- 隐藏邀请消费记录 -->
key="invite" <!-- <a-tab-pane key="invite" :title="$t('common.inviteRecord')"><RewardRecord /></a-tab-pane> -->
:title="$t('common.inviteRecord')">
<RewardRecord />
</a-tab-pane>
</a-tabs> </a-tabs>
</div> </div>
</mf-dialog> </mf-dialog>
@ -63,13 +78,8 @@
<script> <script>
import Forgot from './Forgot.vue' import Forgot from './Forgot.vue'
import Register from './Register.vue' import Register from './Register.vue'
import { mapGetters } from 'vuex'
import i18n from '@/lang/i18n'
import Money from './Money.vue'
import UserAccount from './UserAccount.vue' import UserAccount from './UserAccount.vue'
import RechargeRecord from './RechargeRecord.vue'
import ResumeRecord from './ResumeRecord.vue' import ResumeRecord from './ResumeRecord.vue'
import RewardRecord from './RewardRecord.vue'
export default { export default {
data() { data() {
@ -91,14 +101,8 @@ export default {
components: { components: {
Forgot, Forgot,
Register, Register,
Money,
UserAccount, UserAccount,
RechargeRecord, ResumeRecord
ResumeRecord,
RewardRecord
},
computed: {
...mapGetters(['lang'])
}, },
mounted() { mounted() {
if (this.register) { if (this.register) {
@ -124,12 +128,6 @@ export default {
this.registerVisible = true this.registerVisible = true
this.$emit('cancel') this.$emit('cancel')
}, },
changeLang(value) {
if (value != this.lang) {
this.$store.dispatch('main/setLanguage', value)
i18n.global.locale = value
}
},
back() { back() {
this.forgotVisible = false this.forgotVisible = false
this.$emit('open') this.$emit('open')
@ -181,11 +179,12 @@ export default {
<style lang="less"> <style lang="less">
.user-dialog { .user-dialog {
overflow: hidden; /* 允许头像半圆伸出卡片,不被裁掉 */
overflow: visible;
background: #0f0f12; background: #0f0f12;
border-radius: 10px; border-radius: 10px;
border-radius: 20px; border-radius: 20px;
border: 2px solid #e6217a; border: 1px solid rgba(92, 107, 138, 0.46);
width: 500px; width: 500px;
min-height: 520px; min-height: 520px;
top: 45% !important; top: 45% !important;
@ -201,6 +200,7 @@ export default {
.arco-modal-body { .arco-modal-body {
padding: 24px 30px 30px 30px; padding: 24px 30px 30px 30px;
overflow: visible;
} }
.user-close { .user-close {
@ -216,22 +216,42 @@ export default {
} }
.user-wrapper { .user-wrapper {
.user-tab-title {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 8px;
}
.user-tab-icon {
width: 18px;
height: 18px;
flex-shrink: 0;
fill: currentColor;
opacity: 0.9;
}
.arco-tabs { .arco-tabs {
&-tab { &-tab {
width: 130px; min-width: 120px;
width: auto;
padding: 0 14px;
height: 40px; height: 40px;
border-radius: 10px; border-radius: 10px;
font-size: 14px; font-size: 14px;
color: #ffffff; color: #cbd5e1;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
transition: background-color 0.2s ease, color 0.2s ease;
&-active { &-active {
background: #e6217a; background: #1e293b;
color: #e2e8f0;
} }
&:hover { &:hover {
background: #e6217a; background: rgba(30, 41, 59, 0.78);
color: #e2e8f0;
.arco-tabs-tab-title { .arco-tabs-tab-title {
&:before { &:before {
@ -269,9 +289,16 @@ export default {
.user-wrapper { .user-wrapper {
.arco-tabs { .arco-tabs {
&-tab { &-tab {
width: 120px; min-width: 0;
width: auto;
padding: 0 10px;
font-size: 12px; font-size: 12px;
margin: 0 8px; margin: 0 6px;
}
.user-tab-icon {
width: 16px;
height: 16px;
} }
&-nav-button { &-nav-button {
color: #fff !important; color: #fff !important;

View File

@ -284,7 +284,7 @@ export default {
background: #0f0f12; background: #0f0f12;
border-radius: 10px; border-radius: 10px;
border-radius: 20px; border-radius: 20px;
border: 2px solid #e6217a; border: 1px solid rgba(92, 107, 138, 0.46);
width: 500px; width: 500px;
min-height: 400px; min-height: 400px;
top: 45% !important; top: 45% !important;
@ -403,11 +403,18 @@ export default {
<style lang="less" scoped> <style lang="less" scoped>
.user-account { .user-account {
padding: 70px 24px 30px 24px; padding: 70px 24px 30px 24px;
overflow: visible;
&-wrap { &-wrap {
background: #1a1b20; background: #1a1b20;
border-radius: 10px; border-radius: 10px;
padding: 60px 60px 30px 60px; padding: 60px 60px 30px 60px;
position: relative; position: relative;
overflow: visible;
}
:deep(.mf-image-upload-wrap) {
overflow: visible;
} }
:deep(.mf-image-upload) { :deep(.mf-image-upload) {
@ -419,27 +426,68 @@ export default {
width: 60px; width: 60px;
height: 60px; height: 60px;
border-radius: 50%; border-radius: 50%;
overflow: hidden; overflow: visible;
box-sizing: border-box;
/* 头像外圈:深色底上也能看清边界 */
border: 2px solid rgba(148, 163, 184, 0.45);
box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(255, 255, 255, 0.06);
background: rgba(15, 20, 28, 0.95);
.arco-upload-list-item { .arco-upload-list-item {
.arco-upload-list-picture {
width: 60px; width: 60px;
height: 60px; height: 60px;
margin: 0; margin: 0;
display: flex;
align-items: center;
justify-content: center;
.arco-upload-list-picture {
width: 56px;
height: 56px;
margin: 0;
border-radius: 50%;
overflow: hidden;
flex-shrink: 0;
border: 1px solid rgba(148, 163, 184, 0.2);
img {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
border-radius: 50%;
} }
}
.mf-image-upload-btn {
width: 56px;
height: 56px;
margin: 0;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
background: rgba(30, 41, 59, 0.65);
border: 1px dashed rgba(148, 163, 184, 0.35);
box-sizing: border-box;
}
.mf-image-upload-btn .arco-image {
border-radius: 50%;
overflow: hidden;
}
.arco-upload-list-picture-mask { .arco-upload-list-picture-mask {
line-height: 60px; line-height: 56px;
border-radius: 50%;
.mf-icon { .mf-icon {
margin-right: 8px; margin-right: 8px;
} }
// display: none !important;
} }
} }
&:hover { &:hover {
// .user-account-avatar-edit { border-color: rgba(203, 213, 225, 0.55);
// display: flex;
// }
} }
} }
@ -448,7 +496,7 @@ export default {
position: absolute; position: absolute;
right: -8px; right: -8px;
bottom: -8px; bottom: -8px;
color: rgba(var(--primary-6)); color: #94a3b8;
// display: none; // display: none;
// width: 100%; // width: 100%;
// height: 100%; // height: 100%;

View File

@ -24,6 +24,8 @@
<script> <script>
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import Breadcrumb from './Breadcrumb.vue' import Breadcrumb from './Breadcrumb.vue'
const LAYOUT_MOBILE_MAX = 768
export default { export default {
name: 'app-main', name: 'app-main',
props: { props: {
@ -33,6 +35,21 @@ export default {
} }
}, },
components: { Breadcrumb }, components: { Breadcrumb },
data() {
return {
layoutWidth:
typeof window !== 'undefined' ? window.innerWidth : LAYOUT_MOBILE_MAX + 1
}
},
mounted() {
this._layoutOnResize = () => {
this.layoutWidth = window.innerWidth
}
window.addEventListener('resize', this._layoutOnResize)
},
beforeUnmount() {
window.removeEventListener('resize', this._layoutOnResize)
},
computed: { computed: {
...mapGetters(['cachedViews', 'sidebar']), ...mapGetters(['cachedViews', 'sidebar']),
// //
@ -43,7 +60,10 @@ export default {
return !this.sidebar.opened return !this.sidebar.opened
}, },
style() { style() {
let sidebarWidth = this.isCollapsed ? '50px' : this.sidebar.width if (this.layoutWidth <= LAYOUT_MOBILE_MAX) {
return { width: '100%' }
}
const sidebarWidth = this.isCollapsed ? '56px' : this.sidebar.width
return { return {
width: `calc(100% - ${sidebarWidth})` width: `calc(100% - ${sidebarWidth})`
} }
@ -64,13 +84,22 @@ export default {
.app-main { .app-main {
position: relative; position: relative;
height: 100%; height: 100%;
overflow-y: auto;
overflow-x: hidden;
background: var(--portal-bg-surface);
background-image: radial-gradient(
ellipse 80% 50% at 100% 0%,
rgba(56, 189, 248, 0.05) 0%,
transparent 45%
),
radial-gradient(ellipse 60% 40% at 0% 100%, rgba(34, 211, 238, 0.04) 0%, transparent 40%);
&-wrap { &-wrap {
height: 100%; height: 100%;
overflow: hidden; overflow: hidden;
} }
} }
@media (max-width: 576px) { @media (max-width: 768px) {
.app-main { .app-main {
&-wrap { &-wrap {
width: 100% !important; width: 100% !important;

View File

@ -1,11 +1,23 @@
<template> <template>
<div class="navbar"> <div class="navbar">
<div class="left-menu"> <div class="left-menu">
<button
type="button"
class="sidebar-trigger"
:aria-expanded="sidebar.opened"
aria-label="展开或收起侧栏"
@click="$store.dispatch('main/toggleSideBar')">
<mf-icon <mf-icon
:class="['left-collapse', { isCollapse: isCollapse }]" class="sidebar-trigger__icon sidebar-trigger__icon--desktop"
:class="{ isCollapse: isCollapse }"
cursor="pointer" cursor="pointer"
@click="$store.dispatch('main/toggleSideBar')"
value="icon-shrink" /> value="icon-shrink" />
<span class="sidebar-trigger__icon sidebar-trigger__icon--mobile" aria-hidden="true">
<span class="hamburger-line" />
<span class="hamburger-line" />
<span class="hamburger-line" />
</span>
</button>
<div class="logo"> <div class="logo">
<div <div
class="logo-wrap" class="logo-wrap"
@ -31,32 +43,21 @@
</mf-button> </mf-button>
</div> </div>
<div class="right-menu-item language"> <div class="right-menu-item language">
<a-dropdown @select="handleSelect"> <mf-button type="text" disabled class="language-display">
<mf-button type="text">
{{ localeName }} {{ localeName }}
<icon-down />
</mf-button> </mf-button>
<template #content>
<a-doption
v-for="(name, code) in localeNames"
:key="code"
:value="code">
{{ name }}
</a-doption>
</template>
</a-dropdown>
</div> </div>
<div <div
class="right-menu-item user" class="right-menu-item user"
v-if="userInfo.username" v-if="userInfo.username"
@click="showUser"> @click="showUser">
<span> <span>
<a-image <span class="wallet-icon" aria-hidden="true">
class="wallet" <svg viewBox="0 0 24 24">
:preview="false" <path
:width="16" d="M3.8 7.2A2.2 2.2 0 0 1 6 5h11.7A2.3 2.3 0 0 1 20 7.3v1.1h.4a1.6 1.6 0 0 1 1.6 1.6v4a1.6 1.6 0 0 1-1.6 1.6H20v1.1a2.3 2.3 0 0 1-2.3 2.3H6a2.2 2.2 0 0 1-2.2-2.2V7.2Zm2.2-.7a.7.7 0 0 0-.7.7v.2h12.4a.8.8 0 1 0 0-1.6H6Zm12.5 3.4v4.2h2V9.9h-2Zm-.9 5.7V9.4H5.3v7.4c0 .4.3.7.7.7h11.7a.8.8 0 0 0 .8-.8v-1.1h-.9Zm.8-3.6a1.2 1.2 0 1 1 0-2.4a1.2 1.2 0 0 1 0 2.4Z" />
fit="cover" </svg>
src="/images/nav/img_money@2x.png" /> </span>
{{ userInfo.balance || '0.00' }} {{ userInfo.balance || '0.00' }}
</span> </span>
<mf-avatar <mf-avatar
@ -69,7 +70,8 @@
class="right-menu-item logout" class="right-menu-item logout"
v-if="userInfo.username"> v-if="userInfo.username">
<mf-button <mf-button
type="text" class="navbar-logout-btn"
type="outline"
@click="logout"> @click="logout">
{{ $t('common.logout') }} {{ $t('common.logout') }}
</mf-button> </mf-button>
@ -97,8 +99,9 @@ import { mapGetters, mapState } from 'vuex'
import cloneDeep from 'lodash-es/cloneDeep' import cloneDeep from 'lodash-es/cloneDeep'
import { constantRoutes } from '@/router/index.js' import { constantRoutes } from '@/router/index.js'
import Login from './Login.vue' import Login from './Login.vue'
import i18n, { LOCALE_NAMES } from '@/lang/i18n' import { LOCALE_NAMES } from '@/lang/i18n'
import User from './User.vue' import User from './User.vue'
import { getToken } from '@/utils/auth'
export default { export default {
name: 'nav-bar', name: 'nav-bar',
@ -126,9 +129,6 @@ export default {
demoEnv() { demoEnv() {
return import.meta.env.MODE === 'demo' return import.meta.env.MODE === 'demo'
}, },
localeNames() {
return LOCALE_NAMES
},
localeName() { localeName() {
return LOCALE_NAMES[this.lang] || 'English' return LOCALE_NAMES[this.lang] || 'English'
}, },
@ -184,6 +184,9 @@ export default {
this.openLogin() this.openLogin()
} }
this.getLogo() this.getLogo()
if (getToken()) {
this.$store.dispatch('user/getInfo').catch(() => {})
}
}, },
methods: { methods: {
openLogin() { openLogin() {
@ -219,12 +222,6 @@ export default {
this.openLogin() this.openLogin()
} }
}, },
handleSelect(value) {
if (value != this.lang) {
this.$store.dispatch('main/setLanguage', value)
i18n.global.locale = value
}
},
logout() { logout() {
this.$store.dispatch('user/logout2').then((_) => { this.$store.dispatch('user/logout2').then((_) => {
this.$router.replace('/') this.$router.replace('/')
@ -246,28 +243,88 @@ export default {
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
box-sizing: content-box; box-sizing: content-box;
padding-left: 30px; padding-left: 20px;
padding-right: 30px; padding-right: 30px;
position: relative;
background: linear-gradient(
180deg,
rgba(15, 20, 28, 0.97) 0%,
rgba(10, 14, 20, 0.94) 100%
);
backdrop-filter: blur(14px);
-webkit-backdrop-filter: blur(14px);
border-bottom: 1px solid var(--portal-border-subtle);
box-shadow: 0 1px 0 rgba(92, 107, 138, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.03);
.left { &::after {
content: '';
position: absolute;
left: 0;
right: 0;
bottom: 0;
height: 1px;
background: linear-gradient(
90deg,
transparent 0%,
rgba(92, 107, 138, 0.35) 50%,
transparent 100%
);
opacity: 0.5;
pointer-events: none;
}
.left-menu {
display: flex; display: flex;
align-items: center; align-items: center;
flex: 1; flex: 1;
padding-left: 4px;
height: 60px;
gap: 8px;
min-width: 0;
&-collapse { .sidebar-trigger {
display: none; display: inline-flex;
transition: 0.25s; align-items: center;
justify-content: center;
flex-shrink: 0;
padding: 8px;
margin: 0;
border: none;
background: transparent;
cursor: pointer;
border-radius: 10px;
color: rgba(255, 255, 255, 0.92);
&:hover {
background: rgba(255, 255, 255, 0.08);
}
&__icon--desktop {
display: flex;
transition: transform 0.25s;
&.isCollapse { &.isCollapse {
transform: rotate(-180deg); transform: rotate(-180deg);
} }
} }
&-menu { &__icon--mobile {
padding-left: 8px; display: none;
display: flex; flex-direction: column;
align-items: center; justify-content: center;
height: 60px; gap: 5px;
width: 22px;
padding: 2px 0;
}
}
.hamburger-line {
display: block;
height: 2px;
width: 100%;
border-radius: 1px;
background: currentColor;
}
.logo { .logo {
display: flex; display: flex;
@ -281,7 +338,6 @@ export default {
} }
} }
} }
}
.right-menu { .right-menu {
height: 60px; height: 60px;
@ -303,20 +359,55 @@ export default {
&.language { &.language {
.mf-button { .mf-button {
font-size: 14px; font-size: 14px;
color: #999999; color: #fff;
background-color: transparent; background-color: transparent;
&:hover { &:hover {
background-color: transparent; background-color: transparent;
color: #fff;
} }
} }
.language-display[disabled] {
color: rgba(255, 255, 255, 0.55) !important;
opacity: 0.85;
cursor: not-allowed;
}
} }
&.logout { &.logout {
.mf-button { .navbar-logout-btn.mf-button {
background-color: transparent; height: 32px;
padding: 0 14px;
border-radius: 8px;
font-size: 13px;
font-weight: 600;
letter-spacing: 0.02em;
color: #f8fafc !important;
background: linear-gradient(
180deg,
rgba(30, 41, 59, 0.85) 0%,
rgba(15, 23, 42, 0.92) 100%
) !important;
border: 1px solid rgba(34, 211, 238, 0.42) !important;
box-shadow:
0 0 0 1px rgba(0, 0, 0, 0.35),
0 1px 10px rgba(34, 211, 238, 0.12);
&:hover { &:hover {
background-color: transparent; color: #fff !important;
background: linear-gradient(
180deg,
rgba(51, 65, 85, 0.95) 0%,
rgba(30, 41, 59, 0.98) 100%
) !important;
border-color: rgba(34, 211, 238, 0.65) !important;
box-shadow:
0 0 0 1px rgba(34, 211, 238, 0.2),
0 0 16px rgba(34, 211, 238, 0.18);
}
&:active {
transform: translateY(0.5px);
} }
} }
} }
@ -329,12 +420,13 @@ export default {
&.user { &.user {
width: 150px; width: 150px;
color: rgb(var(--primary-6)); color: #cbd5e1;
border: 2px solid transparent; border: 2px solid transparent;
height: 32px; height: 32px;
border: 1px solid #5c5d68; border: 1px solid rgba(92, 107, 138, 0.46);
background: #26272e; background: linear-gradient(135deg, rgba(30, 41, 59, 0.58) 0%, rgba(15, 20, 28, 0.98) 100%);
border-radius: 16px; border-radius: 16px;
box-shadow: 0 0 0 1px rgba(92, 107, 138, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.04);
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
@ -346,8 +438,21 @@ export default {
display: flex; display: flex;
align-items: center; align-items: center;
flex-grow: 1; flex-grow: 1;
.arco-image { color: #e2e8f0;
.wallet-icon {
width: 18px;
height: 18px;
margin-right: 8px; margin-right: 8px;
display: inline-flex;
align-items: center;
justify-content: center;
color: #94a3b8;
svg {
width: 18px;
height: 18px;
fill: currentColor;
}
} }
} }
} }
@ -410,24 +515,24 @@ export default {
} }
} }
@media (max-width: 576px) { @media (max-width: 768px) {
.navbar { .navbar {
padding: 0 10px; padding: 0 12px;
.left {
&-collapse { .left-menu {
display: block; .sidebar-trigger {
font-size: 18px; &__icon--desktop {
display: none !important;
}
&__icon--mobile {
display: flex !important;
}
} }
&-menu {
display: flex;
.logo { .logo {
display: none; display: none;
} }
.mf-icon {
color: #fff;
}
}
} }
.right-menu-item { .right-menu-item {

View File

@ -112,41 +112,120 @@ export default {
position: relative; position: relative;
transition: width 0.3s; transition: width 0.3s;
z-index: 12; z-index: 12;
background-color: #000; background: linear-gradient(180deg, var(--portal-bg-void) 0%, var(--portal-bg-deep) 32%, #0c1018 100%);
border-right: 1px solid; /* 宽度随你调整 */ border-right: 1px solid var(--portal-border-subtle);
border-image: linear-gradient( box-shadow: inset -1px 0 0 rgba(92, 107, 138, 0.12);
to bottom,
#0f0f12 0%,
rgba(255,255,255, 0.7) 40%,
rgba(255,255,255, 0.7) 60%,
#0f0f12 100%
)
1 100%;
&.collapsed { &.collapsed {
width: 50px !important; width: 56px !important;
overflow: hidden; min-width: 56px !important;
max-width: 56px !important;
overflow-x: hidden;
box-sizing: border-box;
:deep(.arco-menu) { :deep(.arco-menu) {
padding-left: 0px; padding: 6px 2px 10px;
width: 100%;
max-width: 100%;
box-sizing: border-box;
overflow-x: hidden;
}
/* 收起:更小一号的图标格,避免撑出横向滚动 */
:deep(.arco-menu-collapsed) {
width: 100%;
max-width: 100%;
overflow-x: hidden;
.arco-menu-item {
width: 40px !important;
min-width: 40px;
max-width: 40px;
height: 40px;
min-height: 40px;
margin-left: auto;
margin-right: auto;
margin-bottom: 6px;
padding: 0 !important;
display: flex;
align-items: center;
justify-content: center;
border-radius: 10px;
}
.arco-menu-item-inner {
padding: 0 !important;
width: 100%;
justify-content: center !important;
}
.arco-menu-icon {
margin-right: 0 !important;
}
/* 收起时标题不占布局宽度,避免图标挤偏;保留节点以免 Tooltip 异常 */
.arco-menu-title {
flex: 0 0 0 !important;
min-width: 0 !important;
max-width: 0 !important;
padding: 0 !important;
margin: 0 !important;
overflow: hidden !important;
opacity: 0 !important;
font-size: 0 !important;
line-height: 0 !important;
}
.arco-menu-item.arco-menu-selected {
background: rgba(30, 41, 59, 0.92) !important;
box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.35) !important;
}
.arco-menu-item.arco-menu-selected .arco-menu-icon {
color: #e2e8f0;
}
}
:deep(.arco-menu-collapsed .menu-svg-icon) {
width: 18px !important;
height: 18px !important;
}
:deep(.arco-menu-collapsed .menu-svg-icon svg) {
width: 18px !important;
height: 18px !important;
} }
} }
:deep(.arco-menu) { :deep(.arco-menu) {
background-color: transparent; background-color: transparent;
padding-left: 16px; padding: 8px 12px 12px;
&-item { &-item {
width: 180px; min-height: 48px;
line-height: 1.4;
font-size: 15px;
background-color: transparent; background-color: transparent;
color: rgba(255, 255, 255, 0.7); color: var(--portal-text-muted);
border-radius: 10px; border-radius: 10px;
margin-bottom: 12px; margin-bottom: 10px;
transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
&.arco-menu-selected, &:hover:not(.arco-menu-selected) {
&:hover { background-color: rgba(255, 255, 255, 0.05);
background-color: rgb(var(--primary-6)); color: var(--portal-text-strong);
} }
&.arco-menu-selected {
color: var(--portal-text-strong);
background: rgba(30, 41, 59, 0.55);
box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.3);
}
}
&:not(.arco-menu-collapsed) .arco-menu-item {
width: calc(100% - 8px);
max-width: 100%;
} }
} }
@ -172,18 +251,22 @@ export default {
} }
} }
@media (max-width: 576px) { @media (max-width: 768px) {
.sidebar-container { .sidebar-container {
position: fixed; position: fixed;
left: 0px; left: 0px;
top: 60px; top: 60px;
z-index: 10; z-index: 100;
height: calc(100% - 60px); height: calc(100% - 60px);
overflow: hidden; overflow: hidden;
box-shadow: 8px 0 32px rgba(0, 0, 0, 0.35);
&.collapsed { &.collapsed {
width: 0px !important; width: 0px !important;
min-width: 0 !important;
border-right: 0; border-right: 0;
box-shadow: none;
pointer-events: none;
} }
} }
} }

View File

@ -1,5 +1,10 @@
<template> <template>
<div class="app-wrapper"> <div class="app-wrapper">
<div
v-show="showSidebar && mobileDrawerOpen"
class="sidebar-backdrop"
aria-hidden="true"
@click="closeMobileDrawer" />
<div class="fixed-header"> <div class="fixed-header">
<nav-bar class="nav-bar" /> <nav-bar class="nav-bar" />
</div> </div>
@ -18,6 +23,8 @@
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import { sideBar, appMain, navBar, appFooter } from './components' import { sideBar, appMain, navBar, appFooter } from './components'
const LAYOUT_MOBILE_MAX = 768
export default { export default {
name: 'layout', name: 'layout',
components: { components: {
@ -26,16 +33,44 @@ export default {
navBar, navBar,
appFooter appFooter
}, },
data() {
return {
layoutWidth:
typeof window !== 'undefined' ? window.innerWidth : LAYOUT_MOBILE_MAX + 1
}
},
computed: { computed: {
...mapGetters(['sidebar']), ...mapGetters(['sidebar']),
isCollapsed() { isCollapsed() {
return !this.sidebar.opened return !this.sidebar.opened
}, },
isMobileLayout() {
return this.layoutWidth <= LAYOUT_MOBILE_MAX
},
mobileDrawerOpen() {
return this.isMobileLayout && this.sidebar.opened
},
// //
showSidebar() { showSidebar() {
let { menu } = this.$route.query || {} let { menu } = this.$route.query || {}
return menu != 0 return menu != 0
} }
},
mounted() {
this._layoutOnResize = () => {
this.layoutWidth = window.innerWidth
}
window.addEventListener('resize', this._layoutOnResize)
},
beforeUnmount() {
window.removeEventListener('resize', this._layoutOnResize)
},
methods: {
closeMobileDrawer() {
if (this.isMobileLayout && this.sidebar.opened) {
this.$store.dispatch('main/closeSideBar')
}
}
} }
} }
</script> </script>
@ -47,7 +82,17 @@ export default {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
overflow: hidden; overflow: hidden;
background: #0f0f12; background: var(--portal-bg-deep);
background-image: radial-gradient(
ellipse 100% 60% at 50% -10%,
rgba(34, 211, 238, 0.07) 0%,
transparent 55%
),
linear-gradient(180deg, var(--portal-bg-void) 0%, var(--portal-bg-deep) 40%, var(--portal-bg-deep) 100%);
.sidebar-backdrop {
display: none;
}
.fixed-header { .fixed-header {
z-index: 100; z-index: 100;
@ -59,6 +104,18 @@ export default {
.main-wrapper { .main-wrapper {
display: flex; display: flex;
height: calc(100% - 60px); height: calc(100% - 60px);
position: relative;
}
}
@media (max-width: 768px) {
.app-wrapper .sidebar-backdrop {
display: block;
position: fixed;
inset: 60px 0 0 0;
z-index: 99;
background: rgba(0, 0, 0, 0.55);
backdrop-filter: blur(2px);
} }
} }
</style> </style>

View File

@ -9,9 +9,11 @@ import router from './router'
import '@/assets/styles/base.less' import '@/assets/styles/base.less'
import '@/assets/styles/quill.bubble.css' // Quill 样式 - 临时注释避免 source map 文件缺失导致的构建错误
import '@/assets/styles/quill.core.css' // 如果后续需要使用 Quill 富文本编辑器,可取消注释
import '@/assets/styles/quill.snow.css' // import '@/assets/styles/quill.bubble.css'
// import '@/assets/styles/quill.core.css'
// import '@/assets/styles/quill.snow.css'
const app = createApp(App) const app = createApp(App)
app.use(router) app.use(router)
@ -102,4 +104,6 @@ import {
} from './directive/clamp' } from './directive/clamp'
app.use(useClamp) app.use(useClamp)
import '@/assets/styles/portal-buttons.less'
app.mount('#app') app.mount('#app')

View File

@ -47,7 +47,7 @@ export const constantRoutes = [{
path: '/', path: '/',
component: Layout, component: Layout,
redirect: { redirect: {
name: 'index' name: 'video-gen'
}, },
children: [{ children: [{
path: 'index', path: 'index',
@ -69,49 +69,47 @@ export const constantRoutes = [{
permission: "pass", permission: "pass",
icon: 'btn_tst' icon: 'btn_tst'
} }
}, }, {
// { path: 'image-to-image?type=2',
// path: 'image-to-image?type=2', name: 'image-to-image2',
// name: 'image-to-image2', component: () => import('@/views/Image.vue'),
// component: () => import('@/views/Image.vue'), meta: {
// meta: { title: 'imageToImage2',
// title: 'imageToImage2', menuItem: true,
// menuItem: true, permission: "pass",
// permission: "pass", icon: 'btn_tst'
// icon: 'btn_tst' }
// } }, {
// }, { path: 'change-face',
// path: 'change-face', name: 'change-face',
// name: 'change-face', component: () => import('@/views/ChangeFace.vue'),
// component: () => import('@/views/ChangeFace.vue'), meta: {
// meta: { title: 'changeFace',
// title: 'changeFace', menuItem: true,
// menuItem: true, permission: "pass",
// permission: "pass", icon: 'btn_yjhl'
// icon: 'btn_yjhl' }
// } }, {
// }, { path: 'change-face-video',
// path: 'change-face-video', name: 'change-face-video',
// name: 'change-face-video', component: () => import('@/views/ChangeFace.vue'),
// component: () => import('@/views/ChangeFace.vue'), meta: {
// meta: { title: 'changeFaceVideo',
// title: 'changeFaceVideo', menuItem: true,
// menuItem: true, permission: "pass",
// permission: "pass", icon: 'btn_yjhl'
// icon: 'btn_yjhl' }
// } }, {
// }, { path: 'fast-image',
// path: 'fast-image', name: 'fast-image',
// name: 'fast-image', component: () => import('@/views/FastImage.vue'),
// component: () => import('@/views/FastImage.vue'), meta: {
// meta: { title: 'fastImage',
// title: 'fastImage', menuItem: true,
// menuItem: true, permission: "pass",
// permission: "pass", icon: 'btn_kjst'
// icon: 'btn_kjst' }
// } }, {
// },
{
path: 'fast-video', path: 'fast-video',
name: 'fast-video', name: 'fast-video',
component: () => import('@/views/FastVideo.vue'), component: () => import('@/views/FastVideo.vue'),
@ -121,6 +119,46 @@ export const constantRoutes = [{
permission: "pass", permission: "pass",
icon: 'btn_kjsp' icon: 'btn_kjsp'
} }
}, {
path: 'video-gen',
name: 'video-gen',
component: () => import('@/views/VideoGen.vue'),
meta: {
title: 'videoGen',
menuItem: true,
permission: "pass",
icon: 'btn_video'
}
}, {
path: 'asset-group-manage',
name: 'asset-group-manage',
component: () => import('@/views/AssetGroupManage.vue'),
meta: {
title: 'assetGroupManage',
menuItem: true,
permission: "pass",
icon: 'btn_video'
}
}, {
path: 'asset-manage',
name: 'asset-manage',
component: () => import('@/views/AssetManage.vue'),
meta: {
title: 'assetManage',
menuItem: true,
permission: "pass",
icon: 'btn_video'
}
}, {
path: 'generated-assets',
name: 'generatedAssets',
component: () => import('@/views/GeneratedAssets.vue'),
meta: {
title: 'generatedAssets',
menuItem: true,
permission: "pass",
icon: 'btn_video'
}
}, { }, {
path: 'recharge', path: 'recharge',
name: 'recharge', name: 'recharge',

View File

@ -16,13 +16,18 @@ const state = {
sidebar: { sidebar: {
opened: isMobile() ? false : true, opened: isMobile() ? false : true,
withoutAnimation: false, withoutAnimation: false,
width: Cookies.get('sidebarWidth') || '230px' // 左侧导航默认适中宽度(用户若需更窄/宽可本地调小范围会写 cookie
width: Cookies.get('sidebarWidth') || '268px'
}, },
topMenu: Cookies.get('topMenu'), topMenu: Cookies.get('topMenu'),
// 当前语言 // 当前语言
language: Cookies.get('language') || 'en_US', // 多语言切换已禁用全站固定繁体中文zh_HK
// 主题 '':亮色 / dark:暗黑 language: 'zh_HK',
theme: $storage.get('theme') || '', // 主题 '':亮色 / dark:暗黑(未存储时默认暗色;显式存 '' 仍为亮色)
theme: (() => {
const t = $storage.get('theme')
return t === undefined || t === null ? 'dark' : t
})(),
// 系统端 // 系统端
system: $storage.get('system') || '', system: $storage.get('system') || '',
// 当前系统的所有多语言数据 // 当前系统的所有多语言数据
@ -39,8 +44,8 @@ const state = {
showMessage: false, showMessage: false,
messageData: {}, messageData: {},
messageCount: 0, messageCount: 0,
// 是否显示18禁弹窗 // 是否显示18禁弹窗:默认不拦截,直接进入首页等主页面
showForbidden: true, showForbidden: false,
// 阻止页面切换 // 阻止页面切换
showPrevent: false, showPrevent: false,
showLogin: false showLogin: false

View File

@ -27,9 +27,12 @@ export const isFirefox = (_) => {
} }
} }
export const isMobile = _=> { export const isMobile = (_) => {
const userAgent = navigator.userAgent; const userAgent = navigator.userAgent
const isMobile = /iPad|Android|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(userAgent); const uaMobile =
const isSmallScreen = window.innerWidth <= 576; /iPad|Android|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
return isMobile || isSmallScreen; userAgent
)
const isSmallScreen = typeof window !== 'undefined' && window.innerWidth <= 768
return uaMobile || isSmallScreen
} }

View File

@ -0,0 +1,18 @@
/**
* 火山素材相关接口 data 层字段兼容
* Spring/Jackson 序列化为 camelCaseitemstotalCount
* 旧前端曾按 PascalCaseItemsTotalCount取值此处统一解析
*/
export function byteApiItems(data) {
if (!data) return []
if (Array.isArray(data.items)) return data.items
if (Array.isArray(data.Items)) return data.Items
return []
}
export function byteApiTotalCount(data) {
if (!data) return 0
const raw = data.totalCount ?? data.TotalCount
const n = Number(raw)
return Number.isFinite(n) ? n : 0
}

View File

@ -130,6 +130,23 @@ export const convertBase64ToUrl = (base64) => {
) )
} }
/**
* 从若依 AjaxResult / 兼容仅返回顶层 url 的上传响应中解析访问地址
*/
export const extractUploadUrlFromResponse = (res) => {
if (!res) return ''
if (typeof res.data === 'string' && res.data.trim()) return res.data.trim()
if (res.data && typeof res.data === 'object') {
const u = res.data.url || res.data.path
if (typeof u === 'string' && u.trim()) return u.trim()
}
if (typeof res.url === 'string' && res.url.trim()) return res.url.trim()
return ''
}
/** 门户统一腾讯云 COS后端 FileController `/api/file/upload`,与 mf-image-upload 一致 */
export const PORTAL_TENCENT_COS_UPLOAD_URL = '/api/file/upload'
/** /**
* 文件上传 * 文件上传
* @param {Object} {url, file,name} 文件上传地址 file 文件 name 文件名参数 * @param {Object} {url, file,name} 文件上传地址 file 文件 name 文件名参数
@ -148,12 +165,10 @@ export const uploadFile = ({
formData.append(key, data[key]) formData.append(key, data[key])
}) })
} }
// 不要手动设置 Content-Type否则缺少 boundary服务端无法解析 multipart文件参数字段为空
return request({ return request({
url: url, url: url,
method: 'POST', method: 'POST',
data: formData, data: formData
headers: {
'Content-Type': 'multipart/form-data'
}
}) })
} }

View File

@ -20,8 +20,13 @@ const messages = i18n.global.messages[lang];
* @constant * @constant
* @desc 创建axios实例 * @desc 创建axios实例
*/ */
// Vite 仅注入 import.meta.envVITE_*);勿用 process.env.VUE_APP_BASE_APIVue CLI
// 开发:走相对路径 + vite 代理 /dev-api生产直连 .env 中的 VITE_API_URL与后端同域时可留空并在构建里写死路径
const service = axios.create({ const service = axios.create({
// baseURL: process.env.VUE_APP_BASE_API, baseURL:
import.meta.env.MODE === 'development'
? ''
: (import.meta.env.VITE_API_URL || ''),
withCredentials: import.meta.env.MODE === 'development', withCredentials: import.meta.env.MODE === 'development',
timeout: 600 * 1000 timeout: 600 * 1000
}) })

View File

@ -0,0 +1,465 @@
<template>
<div class="asset-group-page">
<section class="ag-panel">
<div class="ag-head">
<h3 class="ag-title">资源组管理</h3>
<a-button type="primary" @click="openCreateDialog">新增资源组</a-button>
</div>
<div class="ag-filter">
<div class="ag-field">
<label>名称</label>
<a-input v-model="filters.name" placeholder="按名称过滤" />
</div>
<div class="ag-field">
<label>资源组编号</label>
<a-input v-model="filters.groupIdsText" placeholder="多个编号用英文逗号分隔" />
</div>
<div class="ag-field">
<label>资源组类型</label>
<a-select v-model="filters.groupType">
<a-option value="AIGC">AIGC生成类</a-option>
</a-select>
</div>
<div class="ag-field">
<label>排序字段</label>
<a-select v-model="filters.sortBy">
<a-option value="CreateTime">创建时间</a-option>
<a-option value="UpdateTime">更新时间</a-option>
</a-select>
</div>
<div class="ag-field">
<label>排序方向</label>
<a-select v-model="filters.sortOrder">
<a-option value="Desc">从新到旧</a-option>
<a-option value="Asc">从旧到新</a-option>
</a-select>
</div>
<div class="ag-actions">
<a-button type="primary" :loading="listLoading" @click="search(1)">查询</a-button>
<a-button @click="resetFilters">重置</a-button>
</div>
</div>
<a-spin :loading="listLoading">
<div class="ag-total">总数{{ totalCount }}</div>
<div class="ag-table-wrap">
<table class="ag-table">
<colgroup>
<col class="ag-col-id" />
<col class="ag-col-name" />
<col class="ag-col-desc" />
<col class="ag-col-type" />
<col class="ag-col-project" />
<col class="ag-col-time" />
<col class="ag-col-time" />
<col class="ag-col-action" />
</colgroup>
<thead>
<tr>
<th>编号</th>
<th>名称</th>
<th>描述</th>
<th>类型</th>
<th>项目名称</th>
<th>创建时间</th>
<th>更新时间</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr v-for="item in items" :key="item.Id || item.id">
<td>{{ item.Id || item.id }}</td>
<td>{{ item.Name || item.name }}</td>
<td>{{ item.Description || item.description || '-' }}</td>
<td>{{ formatGroupTypeLabel(item) }}</td>
<td>{{ item.ProjectName || item.projectName || '-' }}</td>
<td>{{ item.CreateTime || item.createTime || '-' }}</td>
<td>{{ item.UpdateTime || item.updateTime || '-' }}</td>
<td>
<a-button
size="mini"
type="outline"
:loading="detailLoadingId === (item.Id || item.id)"
@click="getDetail(item)">
详情
</a-button>
</td>
</tr>
<tr v-if="!items.length">
<td colspan="8" class="ag-empty">暂无数据</td>
</tr>
</tbody>
</table>
</div>
<div class="ag-pagination">
<a-pagination
:total="totalCount"
:current="filters.pageNumber"
:page-size="filters.pageSize"
show-total
show-jumper
show-page-size
:page-size-options="listPageSizeOptions"
@change="onGroupPageChange"
@page-size-change="onPageSizeChange" />
</div>
</a-spin>
</section>
<a-modal v-model:visible="detailVisible" title="资源组详情" :footer="false" width="680px">
<pre class="ag-detail">{{ prettyDetail }}</pre>
</a-modal>
<a-modal
v-model:visible="createVisible"
title="新增资源组"
width="520px"
:confirm-loading="createLoading"
@ok="createGroup">
<!-- 弹层 teleported body使用 FormItem 保证标签与 dark 样式生效 -->
<a-form :model="createForm" layout="horizontal" auto-label-width class="ag-create-modal-form">
<a-form-item label="名称" required>
<a-input
v-model="createForm.name"
placeholder="请输入资源组名称≤64 字符)"
:max-length="64"
allow-clear />
</a-form-item>
<a-form-item label="描述">
<a-textarea
v-model="createForm.description"
:max-length="300"
show-word-limit
:auto-size="{ minRows: 3, maxRows: 8 }"
placeholder="请输入描述≤300 字符)" />
</a-form-item>
</a-form>
</a-modal>
</div>
</template>
<script>
import { byteApiItems, byteApiTotalCount } from '@/utils/byteAssetApi'
const LIST_PAGE_NUMBER_MAX = 100
const LIST_PAGE_SIZE_OPTIONS = [10, 20, 50, 100]
export default {
name: 'AssetGroupManage',
data() {
return {
createLoading: false,
createVisible: false,
listLoading: false,
detailLoadingId: '',
detailVisible: false,
detailData: null,
createForm: {
name: '',
description: '',
groupType: 'AIGC'
},
filters: {
name: '',
groupIdsText: '',
groupType: 'AIGC',
pageNumber: 1,
pageSize: 10,
sortBy: 'CreateTime',
sortOrder: 'Desc'
},
totalCount: 0,
items: [],
listPageSizeOptions: LIST_PAGE_SIZE_OPTIONS
}
},
computed: {
prettyDetail() {
return this.detailData ? JSON.stringify(this.detailData, null, 2) : '{}'
}
},
mounted() {
this.search(1)
},
methods: {
formatGroupTypeLabel(item) {
const t = String(item?.GroupType || item?.groupType || '').trim()
if (!t) return '-'
if (t === 'AIGC') return 'AIGC生成类'
return t
},
clampGroupPage(n) {
const page = Number(n) || 1
const size = Number(this.filters.pageSize) || 10
let maxPage = LIST_PAGE_NUMBER_MAX
if (this.totalCount > 0) {
const totalPages = Math.ceil(this.totalCount / size)
maxPage = Math.min(LIST_PAGE_NUMBER_MAX, Math.max(1, totalPages))
}
return Math.min(Math.max(1, page), maxPage)
},
onGroupPageChange(page) {
this.search(this.clampGroupPage(page))
},
openCreateDialog() {
this.createVisible = true
},
buildGroupIds() {
return String(this.filters.groupIdsText || '')
.split(',')
.map((x) => x.trim())
.filter((x) => !!x)
},
async createGroup() {
const name = String(this.createForm.name || '').trim()
if (!name) {
this.$message.error('请填写名称')
return
}
this.createLoading = true
try {
const res = await this.$axios({
url: 'api/byteAssetGroup/createAssetGroup',
method: 'POST',
data: {
name,
description: String(this.createForm.description || '').trim()
}
})
if (res.code === 200) {
this.$message.success('新增成功')
this.createForm.name = ''
this.createForm.description = ''
this.createVisible = false
this.search(1)
} else {
this.$message.error(res.msg || '新增失败')
}
} catch (e) {
this.$message.error(e?.message || '新增失败')
} finally {
this.createLoading = false
}
},
async search(page = this.filters.pageNumber) {
this.filters.pageNumber = this.clampGroupPage(page)
this.listLoading = true
try {
const payload = {
filter: {
groupType: this.filters.groupType || 'AIGC'
},
pageNumber: this.filters.pageNumber,
pageSize: this.filters.pageSize,
sortBy: this.filters.sortBy,
sortOrder: this.filters.sortOrder
}
const name = String(this.filters.name || '').trim()
if (name) payload.filter.name = name
const ids = this.buildGroupIds()
if (ids.length) payload.filter.groupIds = ids
const res = await this.$axios({
url: 'api/byteAssetGroup/listAssetGroups',
method: 'POST',
data: payload
})
const data = res.data || {}
this.totalCount = byteApiTotalCount(data)
this.items = byteApiItems(data)
if (res.code !== 200) {
this.$message.error(res.msg || '查询失败')
}
} catch (e) {
this.$message.error(e?.message || '查询失败')
} finally {
this.listLoading = false
}
},
onPageSizeChange(size) {
const s = Number(size) || 10
this.filters.pageSize = LIST_PAGE_SIZE_OPTIONS.includes(s) ? s : 10
this.search(1)
},
resetFilters() {
this.filters = {
name: '',
groupIdsText: '',
groupType: 'AIGC',
pageNumber: 1,
pageSize: 10,
sortBy: 'CreateTime',
sortOrder: 'Desc'
}
this.search(1)
},
async getDetail(item) {
const id = item?.Id || item?.id
if (!id) return
this.detailLoadingId = id
try {
const res = await this.$axios({
url: 'api/byteAssetGroup/getAssetGroup',
method: 'POST',
data: { id: id }
})
if (res.code === 200) {
this.detailData = res.data || {}
this.detailVisible = true
} else {
this.$message.error(res.msg || '查询详情失败')
}
} catch (e) {
this.$message.error(e?.message || '查询详情失败')
} finally {
this.detailLoadingId = ''
}
}
}
}
</script>
<style scoped lang="less">
.asset-group-page {
display: flex;
flex-direction: column;
gap: 16px;
padding: 18px;
background: #0a0b0d;
color: rgba(255, 255, 255, 0.88);
min-height: 100%;
}
.ag-panel {
background: rgba(22, 24, 30, 0.92);
border: 1px solid rgba(255, 255, 255, 0.08);
border-radius: 14px;
padding: 14px;
}
.ag-title {
margin: 0;
font-size: 15px;
font-weight: 600;
}
.ag-head {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 14px;
}
.ag-form,
.ag-filter {
display: grid;
grid-template-columns: repeat(3, minmax(180px, 1fr));
gap: 12px;
}
.ag-field {
display: flex;
flex-direction: column;
gap: 6px;
}
.ag-field label {
font-size: 12px;
color: rgba(255, 255, 255, 0.65);
}
.ag-actions {
display: flex;
align-items: flex-end;
gap: 8px;
}
.ag-total {
margin: 6px 0 10px;
font-size: 12px;
color: rgba(255, 255, 255, 0.65);
}
.ag-table-wrap {
width: 100%;
max-width: 100%;
box-sizing: border-box;
overflow-x: auto;
border: 1px solid rgba(255, 255, 255, 0.08);
border-radius: 10px;
}
.ag-table {
width: 100%;
max-width: 100%;
table-layout: fixed;
border-collapse: collapse;
font-size: 12px;
}
/* 列宽按百分比分配随容器100% 宽)随分辨率伸缩 */
.ag-col-id {
width: 10%;
}
.ag-col-name {
width: 12%;
}
.ag-col-desc {
width: 24%;
}
.ag-col-type {
width: 8%;
}
.ag-col-project {
width: 12%;
}
.ag-col-time {
width: 11%;
}
.ag-col-action {
width: 12%;
}
.ag-table th,
.ag-table td {
padding: 10px;
border-bottom: 1px solid rgba(255, 255, 255, 0.06);
text-align: left;
vertical-align: top;
word-break: break-word;
overflow-wrap: anywhere;
}
.ag-table th {
color: rgba(255, 255, 255, 0.7);
font-weight: 600;
background: rgba(255, 255, 255, 0.02);
}
.ag-empty {
text-align: center;
color: rgba(255, 255, 255, 0.5);
}
.ag-pagination {
margin-top: 12px;
display: flex;
justify-content: flex-end;
}
.ag-detail {
margin: 0;
padding: 12px;
border-radius: 8px;
background: rgba(0, 0, 0, 0.35);
color: #d8f4f7;
max-height: 420px;
overflow: auto;
white-space: pre-wrap;
word-break: break-all;
}
@media (max-width: 960px) {
.ag-form,
.ag-filter {
grid-template-columns: 1fr;
}
}
</style>

View File

@ -0,0 +1,932 @@
<template>
<div class="asset-manage-page">
<section class="asset-left">
<div class="asset-left-head">
<div class="panel-title">素材组树</div>
</div>
<div class="group-tree">
<div
v-for="g in groups"
:key="g.Id || g.id"
:class="['group-node', { active: selectedGroupId === (g.Id || g.id) }]"
@click="selectGroup(g)">
<span class="folder-icon">📁</span>
<div class="group-meta">
<div class="group-name">{{ g.Name || g.name || (g.Id || g.id) }}</div>
<div class="group-id">{{ g.Id || g.id }}</div>
</div>
</div>
<div v-if="!groups.length" class="empty-tip">暂无素材组请先在资源组管理创建</div>
</div>
</section>
<section class="asset-right">
<div class="asset-left-head">
<div class="panel-title">素材管理</div>
<div class="field actions">
<a-button type="primary" size="mini" @click="openCreateAssetDialog">新增素材</a-button>
</div>
</div>
<div class="panel-title mtop">查询素材</div>
<div class="form-grid">
<div class="field">
<label>素材组</label>
<a-select
v-model="filters.groupId"
placeholder="请选择素材组"
allow-clear
:loading="groupLoading"
@change="onFilterGroupChange">
<a-option v-for="g in groups" :key="g.Id || g.id" :value="String(g.Id || g.id)">
{{ (g.Name || g.name || g.Id || g.id) + ' · ' + (g.Id || g.id) }}
</a-option>
</a-select>
</div>
<div class="field">
<label>素材名称</label>
<a-input v-model="filters.name" placeholder="按名称筛选" />
</div>
<div class="field">
<label>状态</label>
<a-select v-model="filters.status" placeholder="全部状态">
<a-option value="">全部</a-option>
<a-option value="Active">可用</a-option>
<a-option value="Processing">处理中</a-option>
<a-option value="Failed">失败</a-option>
</a-select>
</div>
<div class="field">
<label>排序字段</label>
<a-select v-model="filters.sortBy">
<a-option value="CreateTime">创建时间</a-option>
<a-option value="UpdateTime">更新时间</a-option>
<a-option value="GroupId">素材组</a-option>
</a-select>
</div>
<div class="field">
<label>排序方向</label>
<a-select v-model="filters.sortOrder">
<a-option value="Desc">从新到旧</a-option>
<a-option value="Asc">从旧到新</a-option>
</a-select>
</div>
<div class="field actions">
<a-button type="primary" :loading="listLoading" @click="searchAssets(1)">查询</a-button>
<a-button @click="resetFilters">重置</a-button>
</div>
</div>
<a-spin :loading="listLoading">
<div class="total-line">总数{{ totalCount }}</div>
<div class="table-wrap">
<table class="asset-table">
<thead>
<tr>
<th>素材编号</th>
<th>名称</th>
<th>访问地址</th>
<th>所属素材组</th>
<th>类型</th>
<th>状态</th>
<th>创建时间</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr v-for="it in items" :key="it.Id || it.id">
<td class="asset-td-id">{{ it.Id || it.id }}</td>
<td>{{ it.Name || it.name || '-' }}</td>
<td class="asset-url-cell">
<template v-if="assetUrlPreviewKind(it) === 'image' && !thumbError[it.Id || it.id]">
<a
:href="assetUrl(it)"
target="_blank"
rel="noreferrer"
class="asset-thumb-link">
<img
class="asset-url-thumb"
:src="assetUrl(it)"
alt=""
loading="lazy"
@error="onAssetThumbError(it)" />
</a>
</template>
<template v-else-if="assetUrlPreviewKind(it) === 'video'">
<video
class="asset-url-video"
:src="assetUrl(it)"
muted
playsinline
preload="metadata"
controls />
</template>
<template v-else-if="assetUrl(it)">
<a :href="assetUrl(it)" target="_blank" rel="noreferrer" class="asset-url-plain">{{
assetUrl(it)
}}</a>
</template>
<span v-else class="asset-url-empty">-</span>
<div
v-if="assetUrlCaptionVisible(it)"
class="asset-url-caption"
:title="assetUrl(it)">
{{ assetUrl(it) }}
</div>
</td>
<td>{{ it.GroupId || it.groupId || '-' }}</td>
<td>{{ formatAssetTypeLabel(it) }}</td>
<td>{{ formatAssetStatusLabel(it) }}</td>
<td>{{ it.CreateTime || it.createTime || '-' }}</td>
<td>
<a-button size="mini" type="outline" @click="getAsset(it)">详情</a-button>
<a-button size="mini" status="danger" @click="deleteAsset(it)">删除</a-button>
</td>
</tr>
<tr v-if="!items.length">
<td colspan="8" class="empty-tip">暂无素材</td>
</tr>
</tbody>
</table>
</div>
<div class="pager">
<a-pagination
:total="totalCount"
:current="filters.pageNumber"
:page-size="filters.pageSize"
show-total
show-jumper
show-page-size
:page-size-options="listPageSizeOptions"
@change="onAssetPageChange"
@page-size-change="onPageSizeChange" />
</div>
</a-spin>
</section>
<a-modal v-model:visible="detailVisible" title="素材详情" :footer="false" width="700px">
<pre class="detail-box">{{ detailText }}</pre>
</a-modal>
<a-modal
v-model:visible="createAssetVisible"
title="新增素材"
width="520px"
:confirm-loading="createLoading"
@ok="createAsset">
<a-form :model="createForm" layout="horizontal" auto-label-width class="asset-create-modal-form">
<a-form-item label="素材组" required>
<a-select v-model="createForm.groupId" placeholder="请选择素材组" allow-clear>
<a-option v-for="g in groups" :key="g.Id || g.id" :value="String(g.Id || g.id)">
{{ g.Name || g.name || (g.Id || g.id) }}
</a-option>
</a-select>
</a-form-item>
<a-form-item label="上传文件" required>
<div
class="asset-file-dropzone"
:class="{ 'asset-file-dropzone--dragover': createUploadDragOver }"
@click="triggerCreateFilePicker"
@dragenter.prevent="onCreateUploadDragEnter"
@dragover.prevent="onCreateUploadDragOver"
@dragleave.prevent="onCreateUploadDragLeave"
@drop.prevent="onCreateUploadDrop">
<input
ref="createAssetFileInput"
class="asset-file-input"
type="file"
style="display: none"
@change="onFileChange" />
<div class="asset-file-dropzone-content">
<div class="asset-file-dropzone-icon">+</div>
<div class="asset-file-dropzone-text">点击选择或拖拽上传</div>
</div>
</div>
<div v-if="createForm.previewUrl && createForm.assetType === 'Image'" class="asset-file-preview">
<img :src="createForm.previewUrl" alt="" />
</div>
<div class="asset-file-hint">{{ createForm.fileName || '未选择文件' }}</div>
</a-form-item>
<a-form-item label="素材名称">
<a-input v-model="createForm.name" placeholder="素材名称(可选)" allow-clear />
</a-form-item>
<a-form-item label="类型">
<a-select v-model="createForm.assetType">
<a-option value="Image">图片</a-option>
<a-option value="Video">视频</a-option>
<a-option value="Audio">音频</a-option>
</a-select>
</a-form-item>
</a-form>
</a-modal>
</div>
</template>
<script>
import { byteApiItems, byteApiTotalCount } from '@/utils/byteAssetApi'
import { extractUploadUrlFromResponse, PORTAL_TENCENT_COS_UPLOAD_URL, uploadFile } from '@/utils/file'
/** 素材树与筛选区素材组列表统一请求体 */
const GROUP_LIST_REQUEST_BODY = {
filter: { groupType: 'AIGC' },
pageNumber: 1,
pageSize: 100,
sortBy: 'CreateTime',
sortOrder: 'Desc'
}
const GROUP_LIST_API = 'api/byteAssetGroup/listAssetGroups'
const ASSET_CREATE_API = 'api/byteAsset/createAsset'
const ASSET_LIST_API = 'api/byteAsset/listAssets'
const ASSET_GET_API = 'api/byteAsset/getAsset'
const ASSET_DELETE_API = 'api/byteAsset/deleteAsset'
/** 列表页码上限(与接口分页一致);每页条数可选项 */
const LIST_PAGE_NUMBER_MAX = 100
const LIST_PAGE_SIZE_OPTIONS = [10, 20, 50, 100]
export default {
name: 'AssetManage',
data() {
return {
groupLoading: false,
createLoading: false,
listLoading: false,
createAssetVisible: false,
groups: [],
selectedGroupId: '',
createForm: {
groupId: '',
file: null,
fileName: '',
previewUrl: '',
localPreviewUrl: '',
name: '',
assetType: 'Image'
},
createUploadDragOver: false,
filters: {
groupId: '',
name: '',
status: '',
pageNumber: 1,
pageSize: 10,
sortBy: 'CreateTime',
sortOrder: 'Desc'
},
totalCount: 0,
items: [],
detailVisible: false,
detailData: null,
listPageSizeOptions: LIST_PAGE_SIZE_OPTIONS,
thumbError: {}
}
},
computed: {
detailText() {
return this.detailData ? JSON.stringify(this.detailData, null, 2) : '{}'
}
},
mounted() {
this.loadGroups()
},
watch: {
createAssetVisible(val) {
if (!val) this.clearCreateUploadPreview()
}
},
methods: {
clearCreateUploadPreview() {
if (this.createForm?.localPreviewUrl) {
try {
URL.revokeObjectURL(this.createForm.localPreviewUrl)
} catch (_) {}
}
this.createForm.previewUrl = ''
this.createForm.localPreviewUrl = ''
},
setCreateFormFile(file) {
this.createForm.file = file || null
this.createForm.fileName = file?.name || ''
const mime = String(file?.type || '').toLowerCase()
//
if (mime.startsWith('image/')) this.createForm.assetType = 'Image'
else if (mime.startsWith('video/')) this.createForm.assetType = 'Video'
else if (mime.startsWith('audio/')) this.createForm.assetType = 'Audio'
//
this.clearCreateUploadPreview()
if (mime.startsWith('image/')) {
try {
this.createForm.localPreviewUrl = URL.createObjectURL(file)
this.createForm.previewUrl = this.createForm.localPreviewUrl
} catch (_) {}
}
},
formatAssetTypeLabel(it) {
const t = String(it?.AssetType || it?.assetType || '').trim()
if (!t) return '-'
const map = {
Image: '图片',
Video: '视频',
Audio: '音频'
}
return map[t] || t
},
formatAssetStatusLabel(it) {
const s = String(it?.Status || it?.status || '').trim()
if (!s) return '-'
const map = {
Active: '可用',
Processing: '处理中',
Failed: '失败'
}
return map[s] || s
},
assetUrl(it) {
return String(it?.URL || it?.url || '').trim()
},
/** image | video | link */
assetUrlPreviewKind(it) {
const u = this.assetUrl(it)
if (!u || !/^https?:\/\//i.test(u)) return 'link'
const t = String(it?.AssetType || it?.assetType || '')
if (/image/i.test(t)) return 'image'
if (/video/i.test(t)) return 'video'
if (/audio/i.test(t)) return 'link'
if (/\.(png|jpe?g|gif|webp|bmp|svg)(\?|#|$)/i.test(u)) return 'image'
if (/\.(mp4|webm|mov|m4v|ogg)(\?|#|$)/i.test(u)) return 'video'
return 'link'
},
onAssetThumbError(it) {
const id = it?.Id || it?.id
if (id) this.thumbError = { ...this.thumbError, [id]: true }
},
assetUrlCaptionVisible(it) {
const u = this.assetUrl(it)
if (!u) return false
const k = this.assetUrlPreviewKind(it)
if (k === 'video') return true
if (k === 'image' && !this.thumbError[it?.Id || it?.id]) return true
return false
},
clampAssetPage(n) {
const page = Number(n) || 1
const size = Number(this.filters.pageSize) || 10
let maxPage = LIST_PAGE_NUMBER_MAX
if (this.totalCount > 0) {
const totalPages = Math.ceil(this.totalCount / size)
maxPage = Math.min(LIST_PAGE_NUMBER_MAX, Math.max(1, totalPages))
}
return Math.min(Math.max(1, page), maxPage)
},
onAssetPageChange(page) {
this.searchAssets(this.clampAssetPage(page))
},
async openCreateAssetDialog() {
await this.loadGroups()
this.createForm.groupId = this.selectedGroupId || this.createForm.groupId || ''
this.createForm.file = null
this.createForm.fileName = ''
this.createForm.name = ''
this.createForm.assetType = 'Image'
this.clearCreateUploadPreview()
this.createAssetVisible = true
},
async loadGroups() {
this.groupLoading = true
try {
const res = await this.$axios({
url: GROUP_LIST_API,
method: 'POST',
data: { ...GROUP_LIST_REQUEST_BODY }
})
this.groups = byteApiItems(res?.data)
if (!this.selectedGroupId && this.groups.length) {
const gid = String(this.groups[0].Id || this.groups[0].id || '')
this.selectedGroupId = gid
this.createForm.groupId = gid
this.filters.groupId = gid
this.searchAssets(1)
}
} catch (e) {
this.$message.error(e?.message || '加载分组失败')
} finally {
this.groupLoading = false
}
},
selectGroup(g) {
const gid = String(g?.Id || g?.id || '')
this.selectedGroupId = gid
this.createForm.groupId = gid
this.filters.groupId = gid
this.searchAssets(1)
},
onFilterGroupChange(val) {
const gid = val != null && val !== '' ? String(val) : ''
this.selectedGroupId = gid
this.createForm.groupId = gid
this.searchAssets(1)
},
triggerCreateFilePicker() {
const el = this.$refs.createAssetFileInput
if (el && typeof el.click === 'function') el.click()
},
onCreateUploadDragEnter() {
this.createUploadDragOver = true
},
onCreateUploadDragOver() {
this.createUploadDragOver = true
},
onCreateUploadDragLeave() {
this.createUploadDragOver = false
},
onCreateUploadDrop(e) {
this.createUploadDragOver = false
const file = e?.dataTransfer?.files?.[0]
if (!file) return
this.setCreateFormFile(file)
},
onFileChange(e) {
const file = e?.target?.files?.[0]
this.setCreateFormFile(file)
},
async createAsset() {
const groupId = String(this.createForm.groupId || '').trim()
if (!groupId) return this.$message.error('请选择素材组')
if (!this.createForm.file) return this.$message.error('请选择上传文件')
this.createLoading = true
try {
// 1) /api/file/upload url
const uploadRes = await uploadFile({
url: PORTAL_TENCENT_COS_UPLOAD_URL,
file: this.createForm.file,
name: 'file'
})
const uploadUrl = extractUploadUrlFromResponse(uploadRes)
if (!uploadUrl) throw new Error(uploadRes?.msg || '上传后未返回文件地址')
//
if (this.createForm.assetType === 'Image') {
this.clearCreateUploadPreview()
this.createForm.previewUrl = uploadUrl
}
// 2) /api/byteAsset/createAsset(JSON) url
const res = await this.$axios({
url: ASSET_CREATE_API,
method: 'POST',
data: {
URL: uploadUrl,
groupId,
assetType: this.createForm.assetType,
name: String(this.createForm.name || '').trim()
}
})
if (res.code === 200) {
this.$message.success(this.createForm.assetType === 'Image' ? '上传图片成功' : '上传成功')
this.createForm.file = null
this.createForm.name = ''
const isImage = this.createForm.assetType === 'Image'
if (isImage) {
//
setTimeout(() => {
this.createAssetVisible = false
}, 500)
} else {
this.createAssetVisible = false
}
this.searchAssets(1)
} else {
this.$message.error(res.msg || '新增素材失败')
}
} catch (e) {
this.$message.error(e?.message || '新增素材失败')
} finally {
this.createLoading = false
}
},
buildListPayload() {
const filter = {
groupType: 'AIGC'
}
const gid = String(this.filters.groupId || '').trim()
if (gid) filter.groupIds = [gid]
const name = String(this.filters.name || '').trim()
if (name) filter.name = name
if (this.filters.status) filter.statuses = [this.filters.status]
return {
filter,
pageNumber: this.filters.pageNumber,
pageSize: this.filters.pageSize,
sortBy: this.filters.sortBy,
sortOrder: this.filters.sortOrder
}
},
async searchAssets(page = this.filters.pageNumber) {
this.filters.pageNumber = this.clampAssetPage(page)
this.listLoading = true
this.thumbError = {}
try {
const res = await this.$axios({
url: ASSET_LIST_API,
method: 'POST',
data: this.buildListPayload()
})
this.totalCount = byteApiTotalCount(res?.data)
this.items = byteApiItems(res?.data)
if (res.code !== 200) {
this.$message.error(res.msg || '查询素材失败')
}
} catch (e) {
this.$message.error(e?.message || '查询素材失败')
} finally {
this.listLoading = false
}
},
onPageSizeChange(size) {
const s = Number(size) || 10
this.filters.pageSize = LIST_PAGE_SIZE_OPTIONS.includes(s) ? s : 10
this.searchAssets(1)
},
resetFilters() {
const gid = this.groups.length
? String(this.groups[0].Id || this.groups[0].id || '')
: String(this.selectedGroupId || '')
this.selectedGroupId = gid
this.createForm.groupId = gid
this.filters = {
groupId: gid,
name: '',
status: '',
pageNumber: 1,
pageSize: 10,
sortBy: 'CreateTime',
sortOrder: 'Desc'
}
this.searchAssets(1)
},
async getAsset(it) {
const id = it?.Id || it?.id
if (!id) return
try {
const res = await this.$axios({
url: ASSET_GET_API,
method: 'POST',
data: { id: id }
})
if (res.code === 200) {
this.detailData = res.data || {}
this.detailVisible = true
} else {
this.$message.error(res.msg || '查询详情失败')
}
} catch (e) {
this.$message.error(e?.message || '查询详情失败')
}
},
deleteAsset(it) {
const id = it?.Id || it?.id
if (!id) return
this.$confirm({
title: '删除素材',
content: `确认删除素材 ${id} 吗?`,
onOk: async () => {
try {
const res = await this.$axios({
url: ASSET_DELETE_API,
method: 'POST',
data: { id: id }
})
if (res.code === 200) {
this.$message.success('删除成功')
this.searchAssets(this.filters.pageNumber)
} else {
this.$message.error(res.msg || '删除失败')
}
} catch (e) {
this.$message.error(e?.message || '删除失败')
}
}
})
}
}
}
</script>
<style scoped lang="less">
.asset-manage-page {
display: grid;
grid-template-columns: 300px 1fr;
gap: 14px;
padding: 16px;
min-height: 100%;
background: #0a0b0d;
color: rgba(255, 255, 255, 0.9);
}
.asset-left,
.asset-right {
background: rgba(22, 24, 30, 0.92);
border: 1px solid rgba(255, 255, 255, 0.08);
border-radius: 12px;
padding: 12px;
}
.asset-right {
min-width: 0;
width: 100%;
}
.panel-title {
font-size: 14px;
font-weight: 600;
margin-bottom: 10px;
}
.asset-left-head {
display: flex;
justify-content: space-between;
align-items: center;
gap: 8px;
}
.group-tree {
margin-top: 10px;
display: flex;
flex-direction: column;
gap: 8px;
max-height: 72vh;
overflow: auto;
}
.group-node {
display: flex;
gap: 8px;
align-items: flex-start;
padding: 8px;
border-radius: 8px;
border: 1px solid rgba(255, 255, 255, 0.08);
cursor: pointer;
}
.group-node:hover {
background: rgba(255, 255, 255, 0.04);
}
.group-node.active {
border-color: rgba(0, 202, 224, 0.45);
background: rgba(0, 202, 224, 0.12);
}
.folder-icon {
font-size: 14px;
line-height: 1.6;
}
.group-name {
font-size: 13px;
}
.group-id {
font-size: 12px;
color: rgba(255, 255, 255, 0.55);
word-break: break-all;
}
.form-grid {
display: grid;
grid-template-columns: repeat(3, minmax(180px, 1fr));
gap: 10px;
}
.field {
display: flex;
flex-direction: column;
gap: 6px;
}
.field label {
font-size: 12px;
color: rgba(255, 255, 255, 0.65);
}
.field.actions {
align-self: end;
flex-direction: row;
align-items: center;
}
.mtop {
margin-top: 14px;
}
.total-line {
margin: 10px 0;
font-size: 12px;
color: rgba(255, 255, 255, 0.65);
}
.table-wrap {
overflow: auto;
width: 100%;
border: 1px solid rgba(255, 255, 255, 0.08);
border-radius: 10px;
}
.asset-table {
width: 100%;
table-layout: fixed;
border-collapse: collapse;
font-size: 12px;
}
.asset-table th:nth-child(1),
.asset-table td:nth-child(1) {
width: 88px;
word-break: break-all;
}
.asset-table th:nth-child(2),
.asset-table td:nth-child(2) {
width: 14%;
word-break: break-word;
}
.asset-table th:nth-child(3),
.asset-table td:nth-child(3) {
width: 30%;
min-width: 160px;
}
.asset-table th:nth-child(4),
.asset-table td:nth-child(4) {
width: 10%;
word-break: break-all;
}
.asset-table th:nth-child(5),
.asset-table td:nth-child(5) {
width: 9%;
}
.asset-table th:nth-child(6),
.asset-table td:nth-child(6) {
width: 9%;
}
.asset-table th:nth-child(7),
.asset-table td:nth-child(7) {
width: 14%;
word-break: break-word;
}
.asset-table th:nth-child(8),
.asset-table td:nth-child(8) {
width: 16%;
}
.asset-table th,
.asset-table td {
padding: 10px;
border-bottom: 1px solid rgba(255, 255, 255, 0.06);
text-align: left;
vertical-align: top;
}
.asset-table th {
color: rgba(255, 255, 255, 0.72);
background: rgba(255, 255, 255, 0.02);
}
.asset-url-cell {
min-width: 0;
word-break: break-word;
}
.asset-thumb-link {
display: inline-block;
max-width: 100%;
vertical-align: top;
}
.asset-url-thumb {
display: block;
max-width: 100%;
max-height: 120px;
width: auto;
height: auto;
object-fit: contain;
border-radius: 6px;
border: 1px solid rgba(255, 255, 255, 0.1);
background: rgba(0, 0, 0, 0.25);
}
.asset-url-video {
display: block;
max-width: 100%;
max-height: 160px;
border-radius: 6px;
border: 1px solid rgba(255, 255, 255, 0.1);
background: #000;
}
.asset-url-plain {
color: rgba(0, 202, 224, 0.95);
word-break: break-all;
}
.asset-url-empty {
color: rgba(255, 255, 255, 0.35);
}
.asset-url-caption {
margin-top: 6px;
font-size: 11px;
line-height: 1.35;
color: rgba(255, 255, 255, 0.45);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
max-width: 100%;
}
.pager {
margin-top: 10px;
display: flex;
justify-content: flex-end;
}
.empty-tip {
color: rgba(255, 255, 255, 0.5);
font-size: 12px;
text-align: center;
padding: 10px 0;
}
.detail-box {
margin: 0;
padding: 10px;
background: rgba(0, 0, 0, 0.35);
border-radius: 8px;
max-height: 420px;
overflow: auto;
color: #d8f4f7;
}
@media (max-width: 980px) {
.asset-manage-page {
grid-template-columns: 1fr;
}
.form-grid {
grid-template-columns: 1fr;
}
}
</style>
<style lang="less">
/* 弹层挂载到 body与深色页搭配的标签可读性 */
.asset-create-modal-form.arco-form .arco-form-item-label-col .arco-form-item-label,
.ag-create-modal-form.arco-form .arco-form-item-label-col .arco-form-item-label {
color: var(--color-text-2, rgba(255, 255, 255, 0.78));
font-weight: 500;
}
.asset-file-input {
display: block;
width: 100%;
max-width: 100%;
padding: 4px 0;
font-size: 13px;
color: rgba(255, 255, 255, 0.88);
}
.asset-file-dropzone {
width: 100%;
max-width: 100%;
min-height: 38px;
padding: 10px 12px;
border-radius: 10px;
border: 1px dashed rgba(255, 255, 255, 0.18);
background: rgba(0, 0, 0, 0.18);
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: all 0.15s ease-in-out;
box-sizing: border-box;
}
.asset-file-dropzone--dragover {
border-color: rgba(0, 202, 224, 0.65);
background: rgba(0, 202, 224, 0.06);
}
.asset-file-dropzone-content {
display: flex;
align-items: center;
gap: 10px;
}
.asset-file-dropzone-icon {
width: 28px;
height: 28px;
border-radius: 8px;
border: 1px solid rgba(0, 202, 224, 0.35);
background: rgba(0, 202, 224, 0.08);
color: rgba(0, 202, 224, 0.8);
display: flex;
align-items: center;
justify-content: center;
font-size: 18px;
flex-shrink: 0;
}
.asset-file-dropzone-text {
font-size: 13px;
color: rgba(255, 255, 255, 0.7);
}
.asset-file-preview {
margin-top: 10px;
width: 100%;
max-width: 160px;
border-radius: 10px;
overflow: hidden;
border: 1px solid rgba(255, 255, 255, 0.14);
background: rgba(0, 0, 0, 0.25);
}
.asset-file-preview img {
display: block;
width: 100%;
height: auto;
}
.asset-file-hint {
margin-top: 6px;
font-size: 12px;
color: rgba(255, 255, 255, 0.5);
word-break: break-all;
}
</style>

View File

@ -68,11 +68,28 @@
</a-radio> </a-radio>
</a-radio-group> </a-radio-group>
</div> </div>
<!-- <div class="text"> <!-- 模型选择 -->
<a-textarea <div class="model-select">
v-model="text" <div class="model-title">{{ $t('common.selectModel') || '选择模型' }}</div>
:placeholder="$t('common.textVideoPlaceholder')" /> <a-select v-model="selectedModel" style="width: 100%;">
</div> --> <a-option
v-for="option in modelOptions"
:key="option.value"
:value="option.value">
{{ option.label }}
</a-option>
</a-select>
</div>
<!-- 富文本编辑器 -->
<RichTextEditor
v-model="editorContent"
:placeholder="$t('common.textVideoPlaceholder') || '请输入文本生成视频...'"
:uploaded-images="uploadedImages"
@text-change="handleTextChange"
@image-upload="handleImageUpload"
/>
<mf-button <mf-button
class="submit" class="submit"
type="primary" type="primary"
@ -175,6 +192,8 @@
<script> <script>
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import RichTextEditor from '@/components/RichTextEditor.vue'
export default { export default {
data() { data() {
return { return {
@ -182,6 +201,7 @@ export default {
firstUrl: '', firstUrl: '',
lastUrl: '', lastUrl: '',
text: '', text: '',
editorContent: '',
interval: null, interval: null,
videoUrl: null, videoUrl: null,
videoLoading: false, videoLoading: false,
@ -202,9 +222,20 @@ export default {
templateLoading: false, templateLoading: false,
selectedTemplate: null, selectedTemplate: null,
selectedTemplatePreview: '', // URL selectedTemplatePreview: '', // URL
maxPollAttempts: 40 // 3 * 40 = 120 maxPollAttempts: 40, // 3 * 40 = 120
//
modelOptions: [
{ label: 'Seedance 2.0', value: 'ep-20260326165811-dlkth' },
{ label: 'Seedance 2.0 Fast', value: 'ep-20260326170056-dkj9m' }
],
selectedModel: 'ep-20260326165811-dlkth',
// @
uploadedImages: []
} }
}, },
components: {
RichTextEditor
},
beforeUnmount() { beforeUnmount() {
this.destroyInterval() this.destroyInterval()
}, },
@ -316,8 +347,25 @@ export default {
// chineseContent englishContent // chineseContent englishContent
if (this.lang === 'zh_HK') { if (this.lang === 'zh_HK') {
return template.chineseContent || template.name || '' return template.chineseContent || template.name || ''
} }else{
return template.englishContent || template.name || '' return template.englishContent || template.name || ''
}
},
//
handleTextChange(content) {
this.editorContent = content
// text
this.text = content
},
// @
handleImageUpload(imageInfo) {
if (imageInfo && imageInfo.url) {
this.uploadedImages.push({
url: imageInfo.url,
name: imageInfo.name || 'image'
})
}
}, },
// //
handleConfirmTemplate() { handleConfirmTemplate() {
@ -477,9 +525,10 @@ export default {
this.generateLoading = true this.generateLoading = true
let params = { let params = {
text: this.text, text: this.editorContent || this.text,
firstUrl: firstImageUrl, firstUrl: firstImageUrl,
functionType: '21' functionType: '21',
model: this.selectedModel //
} }
if (this.lastUrl && this.lastUrl.url) { if (this.lastUrl && this.lastUrl.url) {
params.lastUrl = this.lastUrl.url params.lastUrl = this.lastUrl.url
@ -603,6 +652,74 @@ export default {
.upload { .upload {
margin-bottom: 20px; margin-bottom: 20px;
.model-select {
margin-bottom: 20px;
.model-title {
color: #fff;
margin-bottom: 8px;
font-size: 14px;
}
:deep(.arco-select) {
background-color: #1a1b20;
border-color: rgba(255,255,255,0.1);
}
}
/* 富文本编辑器样式 */
.rich-editor-root {
margin-bottom: 20px;
.toolbar {
display: flex;
gap: 8px;
margin-bottom: 12px;
padding: 8px;
background-color: #1a1b20;
border-radius: 6px;
border: 1px solid rgba(255,255,255,0.1);
.tool-btn {
padding: 6px 12px;
background-color: rgba(255,255,255,0.05);
border: 1px solid rgba(255,255,255,0.1);
color: #fff;
border-radius: 4px;
cursor: pointer;
font-size: 13px;
&:hover {
background-color: rgba(255,255,255,0.1);
border-color: rgba(255,255,255,0.2);
}
}
}
.rich-editor {
min-height: 160px;
padding: 16px;
background-color: #1a1b20;
border: 1px solid rgba(255,255,255,0.1);
border-radius: 6px;
color: #fff;
font-size: 14px;
line-height: 1.6;
outline: none;
resize: none;
&:focus {
border-color: rgb(var(--primary-6));
}
&[data-placeholder]:empty::before {
content: attr(data-placeholder);
color: #5c5d68;
pointer-events: none;
}
}
}
&-title { &-title {
display: flex; display: flex;
align-items: center; align-items: center;

File diff suppressed because it is too large Load Diff

View File

@ -61,13 +61,28 @@
</a-radio> </a-radio>
</a-radio-group> </a-radio-group>
</div> </div>
<!-- <div <!-- 模型选择 -->
class="text" <div class="model-select">
v-if="current == 2"> <div class="model-title">{{ $t('common.selectModel') || '选择模型' }}</div>
<a-textarea <a-select v-model="selectedModel" style="width: 100%;">
v-model="text" <a-option
:placeholder="$t('common.textPlaceholder')" /> v-for="option in modelOptions"
</div> --> :key="option.value"
:value="option.value">
{{ option.label }}
</a-option>
</a-select>
</div>
<!-- 富文本编辑器 -->
<RichTextEditor
v-model="editorContent"
:placeholder="$t('common.textPlaceholder') || '请输入文本生成图片...'"
:uploaded-images="uploadedImages"
@text-change="handleTextChange"
@image-upload="handleImageUpload"
/>
<mf-button <mf-button
class="submit" class="submit"
type="primary" type="primary"
@ -157,6 +172,7 @@
<script> <script>
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import RichTextEditor from '@/components/RichTextEditor.vue'
export default { export default {
data() { data() {
@ -179,9 +195,20 @@ export default {
templateList: [], templateList: [],
templateLoading: false, templateLoading: false,
selectedTemplate: null, selectedTemplate: null,
selectedTemplatePreview: '' // URL selectedTemplatePreview: '', // URL
// - Seedance 2.0
modelOptions: [
{ label: 'Seedance 2.0', value: 'ep-20260326165811-dlkth' },
{ label: 'Seedance 2.0 Fast', value: 'ep-20260326170056-dkj9m' }
],
selectedModel: 'ep-20260326165811-dlkth',
// @
uploadedImages: []
} }
}, },
components: {
RichTextEditor
},
computed: { computed: {
...mapGetters(['lang']), ...mapGetters(['lang']),
}, },
@ -333,6 +360,21 @@ export default {
this.templateDialogVisible = false this.templateDialogVisible = false
// selectedTemplate便 // selectedTemplate便
}, },
//
handleTextChange(content) {
this.editorContent = content
// text
this.text = content
},
// @
handleImageUpload(imageInfo) {
if (imageInfo && imageInfo.url) {
this.uploadedImages.push({
url: imageInfo.url,
name: imageInfo.name || 'image'
})
}
},
close() { close() {
this.showResult = false this.showResult = false
}, },
@ -396,10 +438,11 @@ export default {
url: 'api/ai/imgToImg', url: 'api/ai/imgToImg',
method: 'POST', method: 'POST',
data: { data: {
text: this.text, text: this.editorContent || this.text,
firstUrl: this.firstUrl.url, firstUrl: this.firstUrl.url,
functionType: this.current == 1 ? '11' : '12', functionType: this.current == 1 ? '11' : '12',
tags: tags.join(',') tags: tags.join(','),
model: this.selectedModel //
} }
}) })
.then((res) => { .then((res) => {
@ -496,6 +539,74 @@ export default {
.upload { .upload {
// margin-top: 20px; // margin-top: 20px;
margin-bottom: 20px; margin-bottom: 20px;
.model-select {
margin-bottom: 20px;
.model-title {
color: #fff;
margin-bottom: 8px;
font-size: 14px;
}
:deep(.arco-select) {
background-color: #1a1b20;
border-color: rgba(255,255,255,0.1);
}
}
/* 富文本编辑器样式 */
.rich-editor-root {
margin-bottom: 20px;
.toolbar {
display: flex;
gap: 8px;
margin-bottom: 12px;
padding: 8px;
background-color: #1a1b20;
border-radius: 6px;
border: 1px solid rgba(255,255,255,0.1);
.tool-btn {
padding: 6px 12px;
background-color: rgba(255,255,255,0.05);
border: 1px solid rgba(255,255,255,0.1);
color: #fff;
border-radius: 4px;
cursor: pointer;
font-size: 13px;
&:hover {
background-color: rgba(255,255,255,0.1);
border-color: rgba(255,255,255,0.2);
}
}
}
.rich-editor {
min-height: 160px;
padding: 16px;
background-color: #1a1b20;
border: 1px solid rgba(255,255,255,0.1);
border-radius: 6px;
color: #fff;
font-size: 14px;
line-height: 1.6;
outline: none;
resize: none;
&:focus {
border-color: rgb(var(--primary-6));
}
&[data-placeholder]:empty::before {
content: attr(data-placeholder);
color: #5c5d68;
pointer-events: none;
}
}
}
&-title { &-title {
display: flex; display: flex;
align-items: center; align-items: center;

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@ -0,0 +1,33 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" role="img" aria-label="Site icon">
<title>asio</title>
<defs>
<linearGradient id="favicon-bg" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" stop-color="#141b26"/>
<stop offset="100%" stop-color="#0a0e14"/>
</linearGradient>
</defs>
<rect width="32" height="32" rx="8" fill="url(#favicon-bg)"/>
<rect
x="1"
y="1"
width="30"
height="30"
rx="7"
fill="none"
stroke="#22d3ee"
stroke-opacity="0.35"
stroke-width="1"/>
<rect
x="1.5"
y="1.5"
width="29"
height="29"
rx="6.5"
fill="none"
stroke="#5c6b8a"
stroke-opacity="0.45"
stroke-width="0.75"/>
<path
fill="#22d3ee"
d="M13.2 9.8c0-.45.48-.73.87-.5l8.8 5.2a.58.58 0 0 1 0 1l-8.8 5.2a.58.58 0 0 1-.87-.5v-10.4Z"/>
</svg>

After

Width:  |  Height:  |  Size: 789 B

View File

@ -26,7 +26,8 @@ export default defineConfig({
less: { less: {
modifyVars: { modifyVars: {
'@size-9': '40px', '@size-9': '40px',
'arcoblue-6': '#e6217a' // 主色:青霓虹(替代原品红),与暗色壳层搭配
'arcoblue-6': '#22d3ee'
} }
} }
} }

View File

@ -1,24 +1,55 @@
import { defineConfig, mergeConfig, loadEnv } from 'vite' import { defineConfig, mergeConfig, loadEnv } from 'vite'
import { dirname, resolve } from 'path'
import { fileURLToPath } from 'url'
import baseViteConfig from './vite.config' import baseViteConfig from './vite.config'
const env = loadEnv('development', process.cwd()) const __dirname = dirname(fileURLToPath(import.meta.url))
/** 代理只能用「协议+主机+端口」,不能带 path否则转发路径容易错 */
function devProxyTarget(apiBaseUrl) {
if (!apiBaseUrl || typeof apiBaseUrl !== 'string') {
return ''
}
try {
const u = new URL(apiBaseUrl)
return `${u.protocol}//${u.host}`
} catch {
return ''
}
}
// 与 portal-ui 根目录一致加载 .env*ESM 下必须用 import.meta.url不能依赖未定义的 __dirname
const env = loadEnv('development', resolve(__dirname))
const apiBase = env.VITE_API_URL?.trim() || ''
const proxyTarget = devProxyTarget(apiBase)
if (!proxyTarget) {
console.warn(
'[vite] VITE_API_URL 未配置或无效,/dev-api 代理未启用。请在 .env.development 中设置例如VITE_API_URL=http://47.86.170.114:8011/api'
)
}
const devConfig = defineConfig({ const devConfig = defineConfig({
server: { server: {
host: env.VITE_HOST || 'localhost', host: env.VITE_HOST || 'localhost',
port: env.VITE_PORT || 8081, port: Number(env.VITE_PORT) || 8081,
open: true, open: true,
watch: { watch: {
ignored: [/node_modules/, /dist/, /deploy/] ignored: [/node_modules/, /dist/, /deploy/]
}, },
...(proxyTarget
? {
proxy: { proxy: {
'/dev-api': { '/dev-api': {
target: env.VITE_API_URL, target: proxyTarget,
ws: false, ws: false,
changeOrigin: true, changeOrigin: true,
rewrite: (path) => path.replace(/^\/dev-api/, '') rewrite: (path) => path.replace(/^\/dev-api/, '')
} }
} }
} }
: {})
}
}) })
export default mergeConfig(baseViteConfig, devConfig) export default mergeConfig(baseViteConfig, devConfig)

2
web-api/.gitignore vendored
View File

@ -4,7 +4,7 @@
.gradle .gradle
/build/ /build/
!gradle/wrapper/gradle-wrapper.jar !gradle/wrapper/gradle-wrapper.jar
*.sql
target/ target/
!.mvn/wrapper/maven-wrapper.jar !.mvn/wrapper/maven-wrapper.jar

View File

@ -0,0 +1,64 @@
server {
listen 80;
listen 443 ssl;
http2 on;
server_name undressing.top www.undressing.top;
index index.html index.htm;
ssl_certificate ssl/undressing.top.crt;
ssl_certificate_key ssl/undressing.top.key;
ssl_session_timeout 5m;
# 优化加密套件配置,移除不安全的算法
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4:!3DES;
# 移除不安全的 TLSv1.1,只保留 TLSv1.2 和 TLSv1.3
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
# 启用 SSL session 缓存,提高性能
ssl_session_cache shared:SSL:10m;
ssl_session_tickets off;
root /data/web/client_web;
autoindex off; # 禁用目录列表
# 安全头部
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
location ~* (\.git|\.env|composer\.json|\.log|\.sql)$ {
deny all;
}
location ^~ /api/ {
proxy_pass http://10.0.0.167:8110;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Real-Port $remote_port;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_connect_timeout 60s;
proxy_send_timeout 600s;
proxy_read_timeout 600s;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
# 缓冲配置,提高性能
proxy_buffering on;
proxy_buffer_size 4k;
proxy_buffers 8 4k;
}
location / {
root /data/web/client_web;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
}

View File

@ -51,6 +51,9 @@ public class AiManagerApiController extends BaseController {
@Anonymous @Anonymous
public AjaxResult selectInfo(String aiType) { public AjaxResult selectInfo(String aiType) {
AiManager aiManager = aiManagerService.selectAiManagerByType(aiType); AiManager aiManager = aiManagerService.selectAiManagerByType(aiType);
if (aiManager == null) {
return AjaxResult.error("该功能未配置或已停用");
}
aiManager.setPrompt(null); aiManager.setPrompt(null);
return AjaxResult.success(aiManager); return AjaxResult.success(aiManager);
} }

View File

@ -2,12 +2,9 @@ package com.ruoyi.api;
import com.ruoyi.ai.domain.AiSampleAmount; import com.ruoyi.ai.domain.AiSampleAmount;
import com.ruoyi.ai.domain.AiSampleAmountRecord; import com.ruoyi.ai.domain.AiSampleAmountRecord;
import com.ruoyi.ai.domain.AiStatistics;
import com.ruoyi.ai.domain.enums.AiConfigEnum;
import com.ruoyi.ai.mapper.AiSampleAmountMapper; import com.ruoyi.ai.mapper.AiSampleAmountMapper;
import com.ruoyi.ai.service.EmailVerifyService; import com.ruoyi.ai.service.EmailVerifyService;
import com.ruoyi.ai.service.IAiSampleAmountRecordService; import com.ruoyi.ai.service.IAiSampleAmountRecordService;
import com.ruoyi.ai.service.IAiStatisticsService;
import com.ruoyi.ai.service.IAiUserService; import com.ruoyi.ai.service.IAiUserService;
import com.ruoyi.common.annotation.Anonymous; import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.constant.BalanceChangerConstants; import com.ruoyi.common.constant.BalanceChangerConstants;
@ -22,10 +19,8 @@ import com.ruoyi.common.core.domain.model.RegisterAiUserBody;
import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.exception.job.TaskException; import com.ruoyi.common.exception.job.TaskException;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.IpCountryQueryByApi;
import com.ruoyi.common.utils.MessageUtils; import com.ruoyi.common.utils.MessageUtils;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.ip.IpUtils;
import com.ruoyi.framework.web.service.SysLoginService; import com.ruoyi.framework.web.service.SysLoginService;
import com.ruoyi.quartz.domain.SysJob; import com.ruoyi.quartz.domain.SysJob;
import com.ruoyi.quartz.service.ISysJobService; import com.ruoyi.quartz.service.ISysJobService;
@ -40,7 +35,10 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.mail.MessagingException; import javax.mail.MessagingException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map; import java.util.Map;
import java.util.UUID;
/** /**
@ -104,8 +102,11 @@ public class AiUserApiController extends BaseController {
// 查询启用状态体验金活动 // 查询启用状态体验金活动
AiSampleAmount aiSampleAmount = aiSampleAmountMapper.getSampleAmount(); AiSampleAmount aiSampleAmount = aiSampleAmountMapper.getSampleAmount();
if (aiSampleAmount != null) { if (aiSampleAmount != null) {
String uuid = UUID.randomUUID().toString().replaceAll("-", "").substring(0, 8);
String dateTime = new SimpleDateFormat("yyyyMMdd").format(new Date());
String orderNo = dateTime + uuid;
// 余额变更记录 // 余额变更记录
aiUserService.addUserBalance(aiUser.getId(), aiSampleAmount.getAmount(), BalanceChangerConstants.EXPERIENCE_GOLD_GIFT); aiUserService.addUserBalance(orderNo, aiUser.getId(), aiSampleAmount.getAmount(), BalanceChangerConstants.EXPERIENCE_GOLD_GIFT);
// 新增体验金记录 // 新增体验金记录
AiSampleAmountRecord aiSampleAmountRecord = new AiSampleAmountRecord(); AiSampleAmountRecord aiSampleAmountRecord = new AiSampleAmountRecord();
aiSampleAmountRecord.setUserId(aiUser.getId()); aiSampleAmountRecord.setUserId(aiUser.getId());
@ -218,6 +219,7 @@ public class AiUserApiController extends BaseController {
/** /**
* 查询返佣比例配置 * 查询返佣比例配置
*
* @return * @return
*/ */
@GetMapping("/getRebateConfig") @GetMapping("/getRebateConfig")

View File

@ -1,29 +1,36 @@
package com.ruoyi.api; package com.ruoyi.api;
import com.ruoyi.ai.domain.*; import com.ruoyi.ai.domain.*;
import com.ruoyi.ai.service.IAiManagerService; import com.ruoyi.ai.service.*;
import com.ruoyi.ai.service.IAiOrderService;
import com.ruoyi.ai.service.IAiTagService;
import com.ruoyi.ai.service.IByteService;
import com.ruoyi.api.request.ByteApiRequest; import com.ruoyi.api.request.ByteApiRequest;
import com.ruoyi.common.annotation.Anonymous; import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.model.LoginAiUser; import com.ruoyi.common.core.request.video.dto.VideoTaskCallBackRequest;
import com.ruoyi.common.utils.AwsS3Util; import com.ruoyi.common.core.response.video.GetVideoGenerationTaskResponse;
import com.ruoyi.common.core.response.video.dto.VideoTaskError;
import com.ruoyi.common.enums.AiOrderStatusType;
import com.ruoyi.common.enums.VideoTaskStatusType;
import com.ruoyi.common.utils.JsonUtils;
import com.ruoyi.common.utils.RandomStringUtil; import com.ruoyi.common.utils.RandomStringUtil;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.TencentCosUtil;
import com.ruoyi.common.utils.ip.IpUtils;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.regex.Pattern; import java.util.regex.Pattern;
/** /**
@ -34,14 +41,22 @@ import java.util.regex.Pattern;
@Api(tags = "生成内容") @Api(tags = "生成内容")
@RequiredArgsConstructor(onConstructor_ = @Autowired) @RequiredArgsConstructor(onConstructor_ = @Autowired)
public class ByteApiController extends BaseController { public class ByteApiController extends BaseController {
// 回调时分布式锁的key前缀
private static final String VOLC_CALLBACK_LOCK_KEY_PREFIX = "volc:callback:lock:";
// 锁参数
private static final int LOCK_WAIT_SECONDS = 10;
private static final int LOCK_LEASE_SECONDS = 20;
private final IByteService byteService; private final IByteService byteService;
private final AwsS3Util awsS3Util; private final TencentCosUtil tencentCosUtil;
private final IAiOrderService aiOrderService; private final IAiOrderService aiOrderService;
private final IAiManagerService managerService; private final IAiManagerService managerService;
private final IAiTagService aiTagService; private final IAiTagService aiTagService;
@Value("${byteapi.callBackUrl}") private final RedissonClient redissonClient;
private String url;
@Value("${volcengine.ark.callbackUrl}")
private String volcCallbackUrl;
private final IByteDeptApiKeyService byteDeptApiKeyService;
@PostMapping("/promptToImg") @PostMapping("/promptToImg")
@ApiOperation("文生图") @ApiOperation("文生图")
@ -51,9 +66,12 @@ public class ByteApiController extends BaseController {
return AjaxResult.error("functionType is null"); return AjaxResult.error("functionType is null");
} }
String mode = request.getMode() != null ? request.getMode() : "image-to-video";
AiManager aiManager = managerService.selectAiManagerByType(functionType); AiManager aiManager = managerService.selectAiManagerByType(functionType);
String tags = request.getTags(); String tags = request.getTags();
String text = ""; String text = request.getText();
// 如果使用标签系统生成prompt
if (StringUtils.isNotEmpty(tags)) { if (StringUtils.isNotEmpty(tags)) {
List<AiTag> aiTags = aiTagService.selectAiTagListByIds(request.getTags(), aiManager.getParentIdSort()); List<AiTag> aiTags = aiTagService.selectAiTagListByIds(request.getTags(), aiManager.getParentIdSort());
List<String> tagPrompts = new ArrayList<>(); List<String> tagPrompts = new ArrayList<>();
@ -70,22 +88,24 @@ public class ByteApiController extends BaseController {
tagPrompts.add(p); tagPrompts.add(p);
} }
text = StringUtils.replacePlaceholders(aiManager.getPrompt(), tagPrompts); text = StringUtils.replacePlaceholders(aiManager.getPrompt(), tagPrompts);
} else {
text = aiManager.getPrompt();
} }
if (StringUtils.isEmpty(text)) { if (StringUtils.isEmpty(text)) {
return AjaxResult.error("text is null"); return AjaxResult.error("text is null");
} }
AiOrder aiOrder = aiOrderService.getAiOrder(functionType); AiOrder aiOrder = aiOrderService.getAiOrder(functionType);
try { try {
if (aiOrder == null) { if (aiOrder == null) {
return AjaxResult.error(-1, "You have a low balance, please recharge"); return AjaxResult.error(-1, "You have a low balance, please recharge");
} }
aiOrder.setText(text); aiOrder.setText(text);
aiOrder.setMode(mode); // 记录生成模式
ByteBodyReq byteBodyReq = new ByteBodyReq(); ByteBodyReq byteBodyReq = new ByteBodyReq();
byteBodyReq.setModel("ep-20251104104536-2gpgz"); // model由前端传入默认为Seedance 2.0
byteBodyReq.setModel(StringUtils.isNotEmpty(request.getModel()) ?
request.getModel() : "ep-20260326165811-dlkth");
byteBodyReq.setPrompt(text); byteBodyReq.setPrompt(text);
byteBodyReq.setSequential_image_generation("disabled"); byteBodyReq.setSequential_image_generation("disabled");
byteBodyReq.setResponse_format("url"); byteBodyReq.setResponse_format("url");
@ -96,7 +116,7 @@ public class ByteApiController extends BaseController {
List<ByteDataRes> data = byteBodyRes.getData(); List<ByteDataRes> data = byteBodyRes.getData();
ByteDataRes byteDataRes = data.get(0); ByteDataRes byteDataRes = data.get(0);
String url = byteDataRes.getUrl(); String url = byteDataRes.getUrl();
url = awsS3Util.uploadFileByUrl(url); url = tencentCosUtil.uploadFileByUrl(url);
if (url == null) { if (url == null) {
// 判断生成失败退回金额逻辑 // 判断生成失败退回金额逻辑
aiOrderService.orderFailure(aiOrder); aiOrderService.orderFailure(aiOrder);
@ -163,7 +183,8 @@ public class ByteApiController extends BaseController {
aiOrder.setImg1(firstUrl.toString()); aiOrder.setImg1(firstUrl.toString());
ByteBodyReq byteBodyReq = new ByteBodyReq(); ByteBodyReq byteBodyReq = new ByteBodyReq();
byteBodyReq.setModel("ep-20251104104536-2gpgz"); byteBodyReq.setModel(StringUtils.isNotEmpty(request.getModel()) ?
request.getModel() : "ep-20260326165811-dlkth");
byteBodyReq.setPrompt(text); byteBodyReq.setPrompt(text);
byteBodyReq.setImage(firstUrl); byteBodyReq.setImage(firstUrl);
byteBodyReq.setSequential_image_generation("disabled"); byteBodyReq.setSequential_image_generation("disabled");
@ -175,7 +196,7 @@ public class ByteApiController extends BaseController {
List<ByteDataRes> data = byteBodyRes.getData(); List<ByteDataRes> data = byteBodyRes.getData();
ByteDataRes byteDataRes = data.get(0); ByteDataRes byteDataRes = data.get(0);
String url = byteDataRes.getUrl(); String url = byteDataRes.getUrl();
url = awsS3Util.uploadFileByUrl(url); url = tencentCosUtil.uploadFileByUrl(url);
if (url == null) { if (url == null) {
// 判断生成失败退回金额逻辑 // 判断生成失败退回金额逻辑
aiOrderService.orderFailure(aiOrder); aiOrderService.orderFailure(aiOrder);
@ -191,7 +212,7 @@ public class ByteApiController extends BaseController {
} }
@PostMapping("/imgToVideo") @PostMapping("/imgToVideo")
@ApiOperation("图生视频") @ApiOperation("图生视频 (Seedance 2.0)")
public AjaxResult imgToVideo(@RequestBody ByteApiRequest request) throws Exception { public AjaxResult imgToVideo(@RequestBody ByteApiRequest request) throws Exception {
String functionType = request.getFunctionType(); String functionType = request.getFunctionType();
if (null == functionType) { if (null == functionType) {
@ -235,51 +256,56 @@ public class ByteApiController extends BaseController {
return AjaxResult.error(-1, "You have a low balance, please recharge"); return AjaxResult.error(-1, "You have a low balance, please recharge");
} }
try { try {
// String text = request.getText();
// if (StringUtils.isBlank(text)) {
// return AjaxResult.error("text is null");
// }
// String tags = request.getTags();
// if (StringUtils.isNotBlank(tags)) {
// text = "(优先考虑以下关键词:" + tags + ")";
// }
aiOrder.setText(text); aiOrder.setText(text);
aiOrder.setImg1(firstUrl.toString()); aiOrder.setImg1(firstUrl.toString());
Integer duration = request.getDuration();
Integer duration = request.getDuration() != null ? request.getDuration() : 4;
ByteBodyReq byteBodyReq = new ByteBodyReq(); ByteBodyReq byteBodyReq = new ByteBodyReq();
byteBodyReq.setModel("ep-20251113072240-cfxlz"); // model由前端传入默认为Seedance2.0
byteBodyReq.setCallback_url(url + "/api/ai/callBack"); byteBodyReq.setModel(StringUtils.isNotEmpty(request.getModel()) ?
List<ContentItem> content = new ArrayList<>(); request.getModel() : "ep-20260326165811-dlkth");
ContentItem contentItem = new ContentItem(); byteBodyReq.setCallback_url(volcCallbackUrl);
contentItem.setType("text");
contentItem.setText(text + " --dur " + duration + " --fps 24 --rs 720p --wm false --cf false");
content.add(contentItem);
ContentItem contentItem1 = new ContentItem(); // 构建符合火山引擎格式的content
contentItem1.setType("image_url"); List<ContentItem> contentList = new ArrayList<>();
contentItem1.setRole("first_frame");
ImageUrl imageUrl1 = new ImageUrl();
imageUrl1.setUrl(firstUrl.toString());
contentItem1.setImageUrl(imageUrl1);
content.add(contentItem1);
// 文本提示词
ContentItem textItem = new ContentItem();
textItem.setType("text");
textItem.setText(text);
contentList.add(textItem);
// 首帧图片
ContentItem firstFrameItem = new ContentItem();
firstFrameItem.setType("image_url");
firstFrameItem.setRole("first_frame");
ImageUrl firstImageUrl = new ImageUrl();
firstImageUrl.setUrl(firstUrl.toString());
firstFrameItem.setImageUrl(firstImageUrl);
contentList.add(firstFrameItem);
// 如果有尾帧
String lastUrl = request.getLastUrl(); String lastUrl = request.getLastUrl();
if (StringUtils.isNotBlank(lastUrl)) { if (StringUtils.isNotBlank(lastUrl)) {
ContentItem contentItem2 = new ContentItem(); ContentItem lastFrameItem = new ContentItem();
contentItem2.setType("image_url"); lastFrameItem.setType("image_url");
contentItem2.setRole("last_frame"); lastFrameItem.setRole("last_frame");
ImageUrl imageUrl2 = new ImageUrl(); ImageUrl lastImageUrl = new ImageUrl();
imageUrl2.setUrl(lastUrl); lastImageUrl.setUrl(lastUrl);
contentItem2.setImageUrl(imageUrl2); lastFrameItem.setImageUrl(lastImageUrl);
content.add(contentItem2); contentList.add(lastFrameItem);
aiOrder.setImg2(lastUrl); aiOrder.setImg2(lastUrl);
} }
byteBodyReq.setContent(content);
byteBodyReq.setContent(contentList);
byteBodyReq.setDuration(duration);
byteBodyReq.setResolution("720p");
byteBodyReq.setRatio("3:4");
ByteBodyRes byteBodyRes = byteService.imgToVideo(byteBodyReq); ByteBodyRes byteBodyRes = byteService.imgToVideo(byteBodyReq);
String id = byteBodyRes.getId(); String id = byteBodyRes.getId();
if (id == null) { if (id == null) {
// 判断生成失败退回金额逻辑
aiOrderService.orderFailure(aiOrder); aiOrderService.orderFailure(aiOrder);
return AjaxResult.error(-2, "generation failed, balance has been refunded"); return AjaxResult.error(-2, "generation failed, balance has been refunded");
} }
@ -299,7 +325,7 @@ public class ByteApiController extends BaseController {
if ("succeeded".equals(byteBodyRes.getStatus())) { if ("succeeded".equals(byteBodyRes.getStatus())) {
content content = byteBodyRes.getContent(); content content = byteBodyRes.getContent();
String videoUrl = content.getVideo_url(); String videoUrl = content.getVideo_url();
videoUrl = awsS3Util.uploadFileByUrl(videoUrl); videoUrl = tencentCosUtil.uploadFileByUrl(videoUrl);
content.setVideo_url(videoUrl); content.setVideo_url(videoUrl);
AiOrder aiOrderByResult = aiOrderService.getAiOrderByResult(id); AiOrder aiOrderByResult = aiOrderService.getAiOrderByResult(id);
AiOrder aiOrder = new AiOrder(); AiOrder aiOrder = new AiOrder();
@ -311,24 +337,212 @@ public class ByteApiController extends BaseController {
return AjaxResult.success(byteBodyRes); return AjaxResult.success(byteBodyRes);
} }
@GetMapping(value = "/callBack") @PostMapping(value = "/volcCallback")
@ApiOperation("视频下载回调") @ApiOperation("火山引擎视频回调")
@Anonymous @Anonymous
public AjaxResult callBack(@PathVariable("id") ByteBodyRes byteBodyRes) throws Exception { public AjaxResult volcCallback(@RequestBody VideoTaskCallBackRequest request, HttpServletRequest httpRequest) throws Exception {
if ("succeeded".equals(byteBodyRes.getStatus())) { logger.info("volcCallback 收到回调数据: clientIp = {}, host = {}, request = {}", IpUtils.getIpAddr(httpRequest),
String id = byteBodyRes.getId(); httpRequest.getHeader("Host"), request);
content content = byteBodyRes.getContent(); // 1基础参数校验
String videoUrl = content.getVideo_url(); AjaxResult result = volcCallbackBaseCheck(request);
videoUrl = awsS3Util.uploadFileByUrl(videoUrl); if (result != null) {
content.setVideo_url(videoUrl); return result;
AiOrder aiOrderByResult = aiOrderService.getAiOrderByResult(id); }
AiOrder aiOrder = new AiOrder(); // 2查询订单
aiOrder.setId(aiOrderByResult.getId()); String taskId = request.getId();
aiOrder.setResult(videoUrl); AiOrder order = aiOrderService.selectOneByThirdPartyOrderNum(taskId);
// aiOrder.setUpdateBy(SecurityUtils.getLoginAiUser().getUsername()); if (order == null) {
aiOrderService.updateAiOrder(aiOrder); // 可能是其他环境生成的但回调地址配置成正式的
logger.warn("volcCallback aiorder is not exist! third party order num = {}", taskId);
return AjaxResult.success();
}
// 3从官方获取任务数据
// 根据订单用户ID查询使用的Key
// 严格来讲按逻辑这块是应放在锁内但这是调外部接口如果接口超时整个服务可能会当机所以不放锁内即不做强一致
String apiKey = byteDeptApiKeyService.resolveVolcApiKey(order.getUserId());
GetVideoGenerationTaskResponse taskResp = byteService.getVideoGenerationTasks(request.getId(), apiKey);
// 4官方数据校验
result = volcCallbackByteCheck(request, taskResp);
if (result != null) {
return result;
}
// 5查询订单 taskId 串行Redisson 分布式锁步骤 13 已在锁外
String lockKey = VOLC_CALLBACK_LOCK_KEY_PREFIX + taskId;
RLock lock = redissonClient.getLock(lockKey);
boolean locked = false;
try {
locked = lock.tryLock(LOCK_WAIT_SECONDS, LOCK_LEASE_SECONDS, TimeUnit.SECONDS);
if (!locked) {
logger.warn("volcCallback skip: concurrent handling for same task, third party order num = {}", taskId);
return AjaxResult.success();
}
// 锁内二次查询防止并发时状态变更
order = aiOrderService.selectOneByThirdPartyOrderNum(taskId);
if (order == null) {
// 可能是其他环境生成的但回调地址配置成正式的
logger.warn("volcCallback aiorder is not exist! third party order num = {}", taskId);
return AjaxResult.success();
}
// 6状态为队列中执行中只更新任务状态
result = volcCallbackRunningTaskProcess(taskResp, order);
if (result != null) {
return result;
}
// 7订单数据校验
result = volcCallbackOrderCheck(taskResp, order);
if (result != null) {
return result;
}
// 8根据状态做不同的处理加事务
String status = taskResp.getStatus().toLowerCase();
if (VideoTaskStatusType.SUCCEEDED.getName().equals(status)) {
// 成功预扣
return aiOrderService.volcCallbackSuccessProcess(request, taskResp, order);
} else {
// 前面已判断过status的合法性并处理了三种非失败的状态所以可以确定是取消失败超时
if (taskResp.getError() != null) {
order.setResult(JsonUtils.toJson(taskResp.getError()));
}
aiOrderService.orderFailure(order);
return AjaxResult.success();
}
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
logger.error("volcCallback interrupted while waiting for lock, third party order num = {}", taskId, e);
return AjaxResult.error();
} catch (Exception ex) {
logger.error("volcCallback error! third party order num = {}, status = {}",
request.getId(), request.getStatus(), ex);
return AjaxResult.error();
} finally {
if (locked && lock.isHeldByCurrentThread()) {
lock.unlock();
}
} }
return AjaxResult.success(byteBodyRes);
} }
private AjaxResult volcCallbackOrderCheck(GetVideoGenerationTaskResponse taskResp, AiOrder order) {
// 订单状态如果不为执行中则不做处理
if (order.getStatus() != null && order.getStatus() != AiOrderStatusType.RUNNING.ordinal()) {
logger.warn("volcCallback aiorder's status is not running! third party order num = {}, order status = {}"
, taskResp.getId(), order.getStatus());
return AjaxResult.success();
}
if (order.getIsBackfilled() != null && order.getIsBackfilled() == 1) {
// 已回补过不再回补直接返回成功
logger.warn("volcCallback is back filled! third party order num = {}, order status = {}"
, taskResp.getId(), order.getStatus());
return AjaxResult.success();
}
return null;
}
private AjaxResult volcCallbackByteCheck(VideoTaskCallBackRequest request, GetVideoGenerationTaskResponse taskResp) {
String requestStatus = request.getStatus().toLowerCase();
String responseStatus = taskResp.getStatus().toLowerCase();
// 请求的状态与字节的状态是否一致
if (!requestStatus.equals(responseStatus)) {
// 如果推送的是队列中执行中但官方任务可能已进到下一步的状态时间差此种情况不处理等待后续推送
if (requestStatus.equals(VideoTaskStatusType.QUEUED.getName())
|| requestStatus.equals(VideoTaskStatusType.RUNNING.getName())) {
logger.warn("volcCallback request's status != official status, no process! order third party order num = {}, request's status = {}, official status = {}",
request.getId(), requestStatus, responseStatus);
// 防止再次推送
return AjaxResult.success();
} else {
logger.error("volcCallback request's status != official status! order third party order num = {}, request's status = {}, official status = {}",
request.getId(), requestStatus, responseStatus);
// 不再让对方二次推送
return AjaxResult.error();
}
}
return null;
}
private AjaxResult volcCallbackBaseCheck(VideoTaskCallBackRequest request) {
// 参数校验
String status = request.getStatus();
if (StringUtils.isEmpty(request.getId()) || StringUtils.isEmpty(status)) {
logger.error("volcCallbackBaseCheck id or status is null! third party order num = {}, status = {}"
, request.getId(), status);
return AjaxResult.error("id or status is null!");
}
// 状态是否正确
if (!VideoTaskStatusType.isValidName(status)) {
logger.error("volcCallbackBaseCheck invalid status! third party order num = {}, status = {}"
, request.getId(), status);
return AjaxResult.error();
}
return null;
}
private AjaxResult volcCallbackRunningTaskProcess(GetVideoGenerationTaskResponse taskResp, AiOrder order) {
// 执行中状态 更新到ext_status字段
Integer extStatus = null;
String status = taskResp.getStatus().toLowerCase();
if (VideoTaskStatusType.QUEUED.getName().equals(status)) {
extStatus = 0;
} else if (VideoTaskStatusType.RUNNING.getName().equals(status)) {
extStatus = 1;
}
if (extStatus != null) {
order.setExtStatus(extStatus);
aiOrderService.updateAiOrder(order);
logger.info("volcCallback order extStatus is updated! third party order num = {}, extStatus = {}"
, taskResp.getId(), order.getExtStatus());
return AjaxResult.success();
}
return null;
}
/**
* 回调体 code 200HTTP/业务状态码清空 resultstatus=2不退款
*/
// private void markVolcCallbackOrderClearResultFailed(String taskId, String reason) {
// AiOrder order = findAiOrderByVolcTaskId(taskId);
// if (order == null) {
// logger.warn("volcCallback code 非 200未找到任务对应订单, taskId={}, {}", taskId, reason);
// return;
// }
// AiOrder upd = new AiOrder();
// upd.setId(order.getId());
// upd.setResult("");
// upd.setStatus(2);
// aiOrderService.updateAiOrder(upd);
// logger.warn("volcCallback code 非 200已清空 result 并 status=2, orderId={}, {}", order.getId(), reason);
// }
// private AiOrder findAiOrderByVolcTaskId(String taskId) {
// AiOrder order = aiOrderService.getAiOrderByPortalVideoTask(taskId);
// if (order != null) {
// return order;
// }
// return aiOrderService.getAiOrderByResult(taskId);
// }
/**
* 回调判定任务失败订单仍持有火山任务 id且非已失败时标记失败并退余额orderFailure
*/
// private void handleVolcCallbackFailure(String taskId, String reason) {
// AiOrder order = aiOrderService.getAiOrderByResult(taskId);
// if (order == null) {
// logger.warn("volcCallback 失败:未找到 result={} 的订单, {}", taskId, reason);
// return;
// }
// if (!taskId.equals(order.getResult())) {
// logger.info("volcCallback 失败处理跳过:订单结果已更新, taskId={}, {}", taskId, reason);
// return;
// }
// if (Integer.valueOf(2).equals(order.getStatus())) {
// return;
// }
// aiOrderService.orderFailure(order);
// logger.warn("volcCallback 任务失败,已标记订单失败并退款, taskId={}, reason={}", taskId, reason);
// }
// @PostMapping(value = "/{id}/cancel")
// @ApiOperation("取消视频生成任务")
// public AjaxResult cancelTask(@PathVariable("id") String id) throws Exception {
// return byteService.cancelVideoTask(id);
// }
} }

View File

@ -0,0 +1,87 @@
package com.ruoyi.api;
import com.ruoyi.ai.service.IByteAssetService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.request.asset.*;
import com.ruoyi.common.core.response.asset.GetAssetResponse;
import com.ruoyi.common.core.response.asset.ListAssetsResponse;
import com.ruoyi.common.core.response.asset.UpdateAssetResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 火山 - 素材管理api.docx Assets APICreateAsset 先上传存储桶再调三方接口
*/
@Slf4j
@RestController
@RequestMapping("/api/byteAsset")
@Api(tags = "火山 - 素材管理")
@RequiredArgsConstructor(onConstructor_ = @Autowired)
public class ByteAssetApiController extends BaseController {
private final IByteAssetService byteAssetService;
@PostMapping("/createAsset")
@ApiOperation("CreateAsset创建素材")
public AjaxResult<ListAssetsResponse> createAsset(@RequestBody CreateAssetRequest request) {
try {
return AjaxResult.success(byteAssetService.createAsset(request));
} catch (Exception e) {
log.error("创建素材时发生异常", e);
return AjaxResult.error(e.getMessage());
}
}
@PostMapping("/listAssets")
@ApiOperation("ListAssets查询素材列表")
public AjaxResult<ListAssetsResponse> listAssets(@RequestBody ListAssetsRequest request) {
try {
return AjaxResult.success(byteAssetService.listAssets(request));
} catch (Exception e) {
log.error("查询素材列表时发生异常", e);
return AjaxResult.error(e.getMessage());
}
}
@PostMapping("/getAsset")
@ApiOperation("GetAsset查询单个素材")
public AjaxResult<GetAssetResponse> getAsset(@RequestBody GetAssetRequest request) {
try {
return AjaxResult.success(byteAssetService.getAsset(request));
} catch (Exception e) {
log.error("查询素材详情时发生异常", e);
return AjaxResult.error(e.getMessage());
}
}
@PostMapping("/updateAsset")
@ApiOperation("UpdateAsset更新素材当前仅名称")
public AjaxResult<UpdateAssetResponse> updateAsset(@RequestBody UpdateAssetRequest request) {
try {
return AjaxResult.success(byteAssetService.updateAsset(request));
} catch (Exception e) {
log.error("更新素材时发生异常", e);
return AjaxResult.error(e.getMessage());
}
}
@PostMapping("/deleteAsset")
@ApiOperation("DeleteAsset删除素材")
public AjaxResult<Void> deleteAsset(@RequestBody DeleteAssetRequest request) {
try {
byteAssetService.deleteAsset(request);
return AjaxResult.success();
} catch (Exception e) {
log.error("删除素材时发生异常", e);
return AjaxResult.error(e.getMessage());
}
}
}

View File

@ -0,0 +1,79 @@
package com.ruoyi.api;
import com.ruoyi.ai.service.IByteAssetGroupService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.request.asset.CreateAssetGroupRequest;
import com.ruoyi.common.core.request.asset.GetAssetGroupRequest;
import com.ruoyi.common.core.request.asset.ListAssetsGroupRequest;
import com.ruoyi.common.core.request.asset.UpdateAssetGroupRequest;
import com.ruoyi.common.core.response.asset.CreateAssetGroupResponse;
import com.ruoyi.common.core.response.asset.GetAssetGroupResponse;
import com.ruoyi.common.core.response.asset.ListAssetsGroupResponse;
import com.ruoyi.common.core.response.asset.UpdateAssetGroupResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 火山 - 素材组管理 Controller
*/
@Slf4j
@RestController
@RequestMapping("/api/byteAssetGroup")
@Api(tags = "火山 - 素材组管理")
@RequiredArgsConstructor(onConstructor_ = @Autowired)
public class ByteAssetGroupApiController extends BaseController {
private final IByteAssetGroupService groupService;
@PostMapping("/listAssetGroups")
@ApiOperation("ListAssetGroups查询素材资产组合列表")
public AjaxResult<ListAssetsGroupResponse> listAssetGroups(@RequestBody ListAssetsGroupRequest request) {
try {
return AjaxResult.success(groupService.listAssetGroups(request));
} catch (Exception e) {
log.error("查询素材组列表时发生异常", e);
return AjaxResult.error(e.getMessage());
}
}
@PostMapping("/createAssetGroup")
@ApiOperation("CreateAssetGroup创建素材资产组合")
public AjaxResult<CreateAssetGroupResponse> createAssetGroup(@RequestBody CreateAssetGroupRequest request) {
try {
return AjaxResult.success(groupService.createAssetGroup(request));
} catch (Exception e) {
log.error("创建素材组时发生异常", e);
return AjaxResult.error(e.getMessage());
}
}
@PostMapping("/getAssetGroup")
@ApiOperation("GetAssetGroup查询单个素材资产组合")
public AjaxResult<GetAssetGroupResponse> getAssetGroup(@RequestBody GetAssetGroupRequest request) {
try {
return AjaxResult.success(groupService.getAssetGroup(request));
} catch (Exception e) {
log.error("查询素材组详情时发生异常", e);
return AjaxResult.error(e.getMessage());
}
}
@PostMapping("/updateAssetGroup")
@ApiOperation("UpdateAssetGroup更新素材资产组合")
public AjaxResult<UpdateAssetGroupResponse> updateAssetGroup(@RequestBody UpdateAssetGroupRequest request) {
try {
return AjaxResult.success(groupService.updateAssetGroup(request));
} catch (Exception e) {
log.error("更新素材组时发生异常", e);
return AjaxResult.error(e.getMessage());
}
}
}

View File

@ -0,0 +1,44 @@
package com.ruoyi.api;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.TencentCosUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
/**
* COS 上传兼容接口
*/
@RestController
@RequestMapping("/api/cos")
@Api(tags = "COS文件上传")
@RequiredArgsConstructor(onConstructor_ = @Autowired)
public class CosController {
private final TencentCosUtil tencentCosUtil;
@ApiOperation("COS上传接口")
@PostMapping("/upload")
public AjaxResult upload(
@ApiParam(name = "file", value = "文件", required = true)
@RequestParam("file") MultipartFile file,
@ApiParam(name = "prefix", value = "路径前缀如asset", required = false)
@RequestParam(value = "prefix", required = false) String prefix) throws Exception {
String uploadUrl = tencentCosUtil.uploadMultipartFile(file, true, prefix);
AjaxResult ajax = AjaxResult.success(uploadUrl);
ajax.put("url", uploadUrl);
ajax.put("oldName", file.getOriginalFilename());
if (StringUtils.isNotBlank(prefix)) {
ajax.put("prefix", prefix);
}
return ajax;
}
}

View File

@ -1,7 +1,8 @@
package com.ruoyi.api; package com.ruoyi.api;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.AwsS3Util; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.TencentCosUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
@ -18,20 +19,28 @@ import org.springframework.web.multipart.MultipartFile;
@Api(tags = "文件上传") @Api(tags = "文件上传")
@RequiredArgsConstructor(onConstructor_ = @Autowired) @RequiredArgsConstructor(onConstructor_ = @Autowired)
public class FileController { public class FileController {
private final AwsS3Util awsS3Util; private final TencentCosUtil tencentCosUtil;
/** /**
* 文件上传 * 文件上传支持prefix路径前缀
*/ */
@ApiOperation(value = "文件上传") @ApiOperation(value = "文件上传")
@PostMapping("/upload") @PostMapping("/upload")
public AjaxResult upload( public AjaxResult upload(
@ApiParam(name = "file", value = "文件", required = true) @ApiParam(name = "file", value = "文件", required = true)
@RequestParam("file") MultipartFile file) throws Exception { @RequestParam("file") MultipartFile file,
@ApiParam(name = "prefix", value = "路径前缀如asset、generated等", required = false)
@RequestParam(value = "prefix", required = false) String prefix) throws Exception {
AjaxResult ajax = AjaxResult.success(); AjaxResult ajax = AjaxResult.success();
String uploadUrl = awsS3Util.uploadMultipartFile(file, true); String uploadUrl = tencentCosUtil.uploadMultipartFile(file, true, prefix);
ajax.put("url", uploadUrl); ajax.put("url", uploadUrl);
ajax.put("oldName", file.getOriginalFilename());
if (StringUtils.isNotBlank(prefix)) {
ajax.put("prefix", prefix);
}
return ajax; return ajax;
} }

View File

@ -69,8 +69,8 @@ public class KadaPaymentJava {
map.put("pm", "QRPH"); map.put("pm", "QRPH");
map.put("ref", orderNo); map.put("ref", orderNo);
map.put("payer", payer); map.put("payer", payer);
map.put("redirect", "www.google.com/recharge"); map.put("redirect", "https://undressing.top/recharge");
map.put("callbackUrl", "www.google.com/api/pay/kada-callBack"); map.put("callbackUrl", "https://undressing.top/api/pay/kada-callBack");
return JSON.toJSONString(map); return JSON.toJSONString(map);
} }
@ -84,7 +84,9 @@ public class KadaPaymentJava {
// 转16进制 // 转16进制
StringBuilder sb = new StringBuilder(hash.length * 2); StringBuilder sb = new StringBuilder(hash.length * 2);
for (byte b : hash) sb.append(String.format("%02x", b)); for (byte b : hash) {
sb.append(String.format("%02x", b));
}
return sb.toString(); return sb.toString();
} }

View File

@ -5,8 +5,10 @@ import com.ruoyi.ai.service.IAiRechargeService;
import com.ruoyi.ai.service.IJinShaService; import com.ruoyi.ai.service.IJinShaService;
import com.ruoyi.ai.service.IKaDaService; import com.ruoyi.ai.service.IKaDaService;
import com.ruoyi.ai.service.IYuZhouService; import com.ruoyi.ai.service.IYuZhouService;
import com.ruoyi.ai.service.IVmService;
import com.ruoyi.common.annotation.Anonymous; import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.ip.IpUtils;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@ -25,6 +27,7 @@ public class PayController {
private final IKaDaService kaDaService; private final IKaDaService kaDaService;
private final IAiRechargeService aiRechargeService; private final IAiRechargeService aiRechargeService;
private final IYuZhouService yuZhouService; private final IYuZhouService yuZhouService;
private final IVmService vmService;
/** /**
* jinsha请求支付 * jinsha请求支付
@ -85,4 +88,109 @@ public class PayController {
return s; return s;
} }
/**
* VM请求支付
*/
@PostMapping("/vm-pay")
@ApiOperation("VM请求支付")
public AjaxResult vmPay(@RequestBody VmPayReq req, HttpServletRequest request) throws Exception {
// 获取用户真实IP地址
String clientIp = IpUtils.getIpAddr(request);
PayResVO payResVO = vmService.vmPay(req.getGearId(), req.getVmCardInfo(), clientIp);
return AjaxResult.success(payResVO);
}
@PostMapping("/vm-callBack")
@ApiOperation("VM支付回调")
@Anonymous
public String vmCallBack(HttpServletRequest request) {
// 记录请求的Content-Type
String contentType = request.getContentType();
// 从请求中解析表单参数
VmCallBackReq req = new VmCallBackReq();
// 记录所有请求参数用于调试
java.util.Enumeration<String> paramNames = request.getParameterNames();
java.util.Map<String, String> allParams = new java.util.HashMap<>();
while (paramNames.hasMoreElements()) {
String paramName = paramNames.nextElement();
String paramValue = request.getParameter(paramName);
allParams.put(paramName, paramValue);
}
org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(PayController.class);
log.info("VM支付回调请求参数: {}, Content-Type: {}", allParams, contentType);
req.setMchNo(request.getParameter("mchNo"));
req.setAppId(request.getParameter("appId"));
req.setMchOrderNo(request.getParameter("mchOrderNo"));
req.setPayOrderId(request.getParameter("payOrderId"));
req.setWayCode(request.getParameter("wayCode"));
// 解析整数类型字段
String amountStr = request.getParameter("amount");
if (amountStr != null && !amountStr.isEmpty()) {
try {
req.setAmount(Integer.parseInt(amountStr));
} catch (NumberFormatException e) {
log.warn("VM支付回调amount解析失败: {}", amountStr);
}
}
req.setCurrency(request.getParameter("currency"));
req.setIfCode(request.getParameter("ifCode"));
req.setSubject(request.getParameter("subject"));
req.setBody(request.getParameter("body"));
req.setClientIp(request.getParameter("clientIp"));
// 解析订单状态文档字段名state
String stateStr = request.getParameter("state");
if (stateStr != null && !stateStr.isEmpty()) {
try {
req.setState(Integer.parseInt(stateStr));
} catch (NumberFormatException e) {
log.warn("VM支付回调state解析失败: {}", stateStr);
}
}
req.setChannelOrderNo(request.getParameter("channelOrderNo"));
req.setErrCode(request.getParameter("errCode"));
req.setErrMsg(request.getParameter("errMsg"));
req.setExtParam(request.getParameter("extParam"));
// 解析时间戳createdAtsuccessTimereqTime文档字段名
String createdAtStr = request.getParameter("createdAt");
if (createdAtStr != null && !createdAtStr.isEmpty()) {
try {
req.setCreatedAt(Long.parseLong(createdAtStr));
} catch (NumberFormatException e) {
log.warn("VM支付回调createdAt解析失败: {}", createdAtStr);
}
}
String successTimeStr = request.getParameter("successTime");
if (successTimeStr != null && !successTimeStr.isEmpty()) {
try {
req.setSuccessTime(Long.parseLong(successTimeStr));
} catch (NumberFormatException e) {
log.warn("VM支付回调successTime解析失败: {}", successTimeStr);
}
}
String reqTimeStr = request.getParameter("reqTime");
if (reqTimeStr != null && !reqTimeStr.isEmpty()) {
try {
req.setReqTime(Long.parseLong(reqTimeStr));
} catch (NumberFormatException e) {
log.warn("VM支付回调reqTime解析失败: {}", reqTimeStr);
}
}
req.setSign(request.getParameter("sign"));
req.setSignType(request.getParameter("signType"));
log.info("VM支付回调解析后的对象: mchOrderNo={}, state={}, sign={}",
req.getMchOrderNo(), req.getState(), req.getSign());
return vmService.vmCallBack(req);
}
} }

View File

@ -0,0 +1,146 @@
package com.ruoyi.api;
import com.ruoyi.ai.domain.AiOrder;
import com.ruoyi.ai.service.IAiOrderService;
import com.ruoyi.ai.service.IAiUserService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.AiUser;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.SecurityUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 门户-生成资产管理展示当前用户的AI订单记录支持收藏功能
*/
@Api(tags = "门户-生成资产")
@RestController
@RequestMapping("/api/portal/assets")
@RequiredArgsConstructor(onConstructor_ = @Autowired)
public class PortalAssetsController extends BaseController {
private final IAiOrderService aiOrderService;
private final IAiUserService aiUserService;
/**
* 查询当前用户的生成资产列表
* 支持dept=true参数查询当前用户所在部门的所有作品
*/
@GetMapping("/list")
@ApiOperation("查询生成资产列表支持收藏筛选、时间范围、dept部门查询")
public TableDataInfo list(
@RequestParam(required = false) String is_top,
@RequestParam(required = false) String beginTime,
@RequestParam(required = false) String endTime,
@RequestParam(required = false, defaultValue = "false") Boolean dept) {
AiOrder query = new AiOrder();
Long currentUserId = SecurityUtils.getAiUserId();
if (Boolean.TRUE.equals(dept)) {
// 查询当前用户所在部门的所有作品包括自己
AiUser currentUser = aiUserService.selectAiUserById(currentUserId);
if (currentUser != null && currentUser.getDeptId() != null) {
// 通过部门查询所有用户在XML中通过IN子查询实现
query.getParams().put("deptId", currentUser.getDeptId());
System.out.println("=== 查询部门作品deptId=" + currentUser.getDeptId() + " ===");
} else {
// 兜底只查个人
query.setUserId(currentUserId);
System.out.println("=== 部门ID为空兜底查询个人作品 ===");
}
} else {
// 默认只查询当前用户的数据
query.setUserId(currentUserId);
System.out.println("=== 查询个人作品 userId=" + currentUserId + " ===");
}
System.out.println("=== PortalAssetsController DEBUG START ===");
System.out.println("收到参数: is_top=" + is_top + ", beginTime=" + beginTime + ", endTime=" + endTime + ", dept=" + dept);
// 收藏状态筛选 - is_top: Y=已收藏, N=未收藏
if (is_top != null && !is_top.trim().isEmpty()) {
String trimmedIsTop = is_top.trim();
query.setIsTop(trimmedIsTop);
System.out.println("✓ 设置 isTop = [" + trimmedIsTop + "]");
System.out.println(" query.getIsTop() = " + query.getIsTop());
} else {
System.out.println("✗ is_top 参数为空或未提供,不设置筛选条件");
}
// 时间范围筛选
if (beginTime != null && !beginTime.isEmpty()) {
query.getParams().put("beginTime", beginTime);
System.out.println("✓ 设置 beginTime = " + beginTime);
}
if (endTime != null && !endTime.isEmpty()) {
query.getParams().put("endTime", endTime);
System.out.println("✓ 设置 endTime = " + endTime);
}
System.out.println("查询对象状态: isTop=" + query.getIsTop() + ", userId=" + query.getUserId() + ", params=" + query.getParams());
System.out.println("=== PortalAssetsController DEBUG END ===");
startPage();
List<AiOrder> list = aiOrderService.selectAiOrderList(query);
System.out.println("PortalAssetsController - 查询返回 " + (list != null ? list.size() : 0) + " 条记录");
return getDataTable(list);
}
/**
* 收藏/取消收藏
*/
@PostMapping("/favorite")
@ApiOperation("收藏或取消收藏生成资产")
public AjaxResult favorite(@RequestBody FavoriteRequest request) {
Long userId = SecurityUtils.getAiUserId();
// 验证订单归属
AiOrder order = aiOrderService.selectAiOrderById(request.getId());
if (order == null) {
return AjaxResult.error("订单不存在");
}
if (!userId.equals(order.getUserId())) {
return AjaxResult.error("无权操作该订单");
}
// 更新收藏状态
AiOrder update = new AiOrder();
update.setId(request.getId());
update.setIsTop(request.getIsTop());
int result = aiOrderService.updateAiOrder(update);
return toAjax(result);
}
/**
* 收藏请求体
*/
public static class FavoriteRequest {
private Long id;
private String isTop;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getIsTop() {
return isTop;
}
public void setIsTop(String isTop) {
this.isTop = isTop;
}
}
}

View File

@ -0,0 +1,655 @@
package com.ruoyi.api;
import cn.hutool.core.util.NumberUtil;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.ruoyi.ai.domain.AiOrder;
import com.ruoyi.ai.domain.ByteBodyReq;
import com.ruoyi.ai.domain.ByteBodyRes;
import com.ruoyi.ai.domain.ContentItem;
import com.ruoyi.ai.domain.ImageUrl;
import com.ruoyi.ai.domain.content;
import com.ruoyi.ai.service.IAiOrderService;
import com.ruoyi.ai.service.IAiUserService;
import com.ruoyi.ai.service.IByteDeptApiKeyService;
import com.ruoyi.ai.service.IByteService;
import com.ruoyi.api.request.PortalVideoGenRequest;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.response.video.GetVideoGenerationTaskResponse;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.TencentCosUtil;
import com.ruoyi.config.PortalVideoProperties;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
/**
* 门户视频生成按用户二级部门 byte_api_key 调用火山任务列表含库表与火山过滤列表
*/
@Api(tags = "门户-视频生成")
@RestController
@RequestMapping("/api/portal/video")
@RequiredArgsConstructor(onConstructor_ = @Autowired)
public class PortalVideoController extends BaseController {
private final IByteService byteService;
private final IByteDeptApiKeyService byteDeptApiKeyService;
private final IAiOrderService aiOrderService;
private final TencentCosUtil tencentCosUtil;
private final PortalVideoProperties portalVideoProperties;
private final IAiUserService aiUserService;
@Value("${volcengine.ark.callbackUrl:}")
private String volcCallbackUrl;
private static final ObjectMapper OM = new ObjectMapper();
private String apiKey() {
return byteDeptApiKeyService.resolveVolcApiKey(SecurityUtils.getAiUserId());
}
/** 与 ai_manager.type、portal.video.function-type 对齐,用于扣费 */
private String resolveFunctionType(PortalVideoGenRequest req) {
if (StringUtils.isNotEmpty(req.getFunctionType())) {
return req.getFunctionType();
}
if (StringUtils.isNotEmpty(portalVideoProperties.getFunctionType())) {
return portalVideoProperties.getFunctionType();
}
return "21";
}
private List<PortalVideoProperties.ModelOption> loadModelOptionsForAiUser(Long aiUserId, Long secondDeptId) {
String json = byteDeptApiKeyService.resolveSecondLevelModelParm(aiUserId);
List<PortalVideoProperties.ModelOption> fromDb = parseModelParmJson(json);
if (fromDb != null && !fromDb.isEmpty()) {
return fromDb;
}
return portalVideoProperties.resolveModelsForSecondDept(secondDeptId);
}
private List<PortalVideoProperties.ModelOption> parseModelParmJson(String json) {
if (StringUtils.isEmpty(json)) {
return null;
}
try {
List<PortalVideoProperties.ModelOption> list = OM.readValue(json.trim(),
new TypeReference<List<PortalVideoProperties.ModelOption>>() { });
if (list == null || list.isEmpty()) {
return null;
}
List<PortalVideoProperties.ModelOption> out = new ArrayList<>();
for (PortalVideoProperties.ModelOption o : list) {
if (o != null && StringUtils.isNotEmpty(o.getLabel()) && StringUtils.isNotEmpty(o.getValue())) {
out.add(o);
}
}
return out.isEmpty() ? null : out;
} catch (Exception e) {
logger.warn("解析二级部门 model_parm 失败: {}", e.getMessage());
return null;
}
}
private static boolean isModelInOptions(String modelId, List<PortalVideoProperties.ModelOption> options) {
if (modelId == null || modelId.isEmpty() || options == null) {
return false;
}
for (PortalVideoProperties.ModelOption o : options) {
if (modelId.equals(o.getValue())) {
return true;
}
}
return false;
}
private static void alignDefaultsModelToOptions(PortalVideoProperties.Defaults defs, List<PortalVideoProperties.ModelOption> models) {
if (defs == null || models == null || models.isEmpty()) {
return;
}
String m = defs.getModel();
if (m == null || m.isEmpty()) {
defs.setModel(models.get(0).getValue());
return;
}
if (!isModelInOptions(m, models)) {
defs.setModel(models.get(0).getValue());
}
}
private String resolveDefaultModelForAiUser(Long aiUserId, Long secondDeptId, List<PortalVideoProperties.ModelOption> allowed) {
PortalVideoProperties.Defaults d = portalVideoProperties.resolveEffectiveDefaults(secondDeptId);
if (d.getModel() != null && !d.getModel().isEmpty() && isModelInOptions(d.getModel(), allowed)) {
return d.getModel();
}
if (!allowed.isEmpty() && StringUtils.isNotEmpty(allowed.get(0).getValue())) {
return allowed.get(0).getValue();
}
return null;
}
private void applyOptionalParams(ByteBodyReq body, PortalVideoGenRequest req, Long secondDeptId) {
PortalVideoProperties.Defaults d = portalVideoProperties.resolveEffectiveDefaults(secondDeptId);
body.setDuration(req.getDuration() != null ? req.getDuration() : d.getDuration());
body.setResolution(StringUtils.isNotEmpty(req.getResolution()) ? req.getResolution() : d.getResolution());
body.setRatio(StringUtils.isNotEmpty(req.getRatio()) ? req.getRatio() : d.getRatio());
if (StringUtils.isNotEmpty(volcCallbackUrl)) {
body.setCallback_url(volcCallbackUrl);
}
}
private ByteBodyReq newVideoBody(PortalVideoGenRequest req, List<ContentItem> content) {
Long uid = SecurityUtils.getAiUserId();
Long secondDeptId = byteDeptApiKeyService.resolveSecondLevelDeptId(uid);
List<PortalVideoProperties.ModelOption> allowed = loadModelOptionsForAiUser(uid, secondDeptId);
String modelId = StringUtils.isNotEmpty(req.getModel()) ? req.getModel() : resolveDefaultModelForAiUser(uid, secondDeptId, allowed);
if (StringUtils.isEmpty(modelId)) {
throw new ServiceException("未配置门户视频模型:请在后台为该用户所属二级部门配置 model_parm或在 portal.video.models 中配置全局列表");
}
if (StringUtils.isNotEmpty(req.getModel()) && !isModelInOptions(modelId, allowed)) {
throw new ServiceException("所选模型对当前部门不可用");
}
ByteBodyReq body = new ByteBodyReq();
body.setModel(modelId);
body.setContent(content);
applyOptionalParams(body, req, secondDeptId);
return body;
}
private void applyOrderImages(AiOrder aiOrder, PortalVideoGenRequest req) {
if (StringUtils.isNotEmpty(req.getFirstUrl())) {
aiOrder.setImg1(req.getFirstUrl());
}
if (StringUtils.isNotEmpty(req.getLastUrl())) {
aiOrder.setImg2(req.getLastUrl());
}
if (StringUtils.isNotEmpty(req.getReferenceUrl())) {
aiOrder.setImg1(req.getReferenceUrl());
}
}
/**
* 写入订单提示词生成模式图床 URL以及模型/时长/分辨率/比例与完整 JSON 参数便于对账与审计
*/
private void fillVideoOrderRecord(AiOrder aiOrder, PortalVideoGenRequest req, String mode, ByteBodyReq body, String functionTypeResolved) {
aiOrder.setText(req.getText());
aiOrder.setMode(mode);
aiOrder.setIsBackfilled(0);
applyOrderImages(aiOrder, req);
aiOrder.setExtStatus(0);
if (req.getDuration() != null) {
aiOrder.setDuration(req.getDuration());
} else if (body.getDuration() != null) {
aiOrder.setDuration(body.getDuration());
}
if (StringUtils.isNotEmpty(body.getResolution())) {
aiOrder.setResolution(body.getResolution());
}
if (StringUtils.isNotEmpty(body.getRatio())) {
aiOrder.setRatio(body.getRatio());
}
if (StringUtils.isNotEmpty(body.getModel())) {
aiOrder.setModel(body.getModel());
}
try {
Map<String, Object> snap = new LinkedHashMap<>();
snap.put("generationMode", mode);
snap.put("prompt", req.getText());
snap.put("functionType", functionTypeResolved);
snap.put("model", body.getModel());
snap.put("duration", body.getDuration());
snap.put("resolution", body.getResolution());
snap.put("ratio", body.getRatio());
if (StringUtils.isNotEmpty(req.getFirstUrl())) {
snap.put("firstUrl", req.getFirstUrl());
}
if (StringUtils.isNotEmpty(req.getLastUrl())) {
snap.put("lastUrl", req.getLastUrl());
}
if (StringUtils.isNotEmpty(req.getReferenceUrl())) {
snap.put("referenceUrl", req.getReferenceUrl());
}
if (req.getContent() != null && !req.getContent().isEmpty()) {
snap.put("content", req.getContent());
}
aiOrder.setVideoParams(OM.writeValueAsString(snap));
} catch (Exception e) {
aiOrder.setVideoParams("{\"error\":\"video_params_serialize_failed\"}");
}
}
/** 写入 video_params.volcTaskId任务成功后 result 会改为成品 URL仍应用此 id 校验归属与轮询 */
private void mergeVolcTaskIdIntoVideoParams(AiOrder aiOrder, String volcTaskId) {
if (StringUtils.isEmpty(volcTaskId)) {
return;
}
try {
ObjectNode node;
if (StringUtils.isNotEmpty(aiOrder.getVideoParams())) {
JsonNode existing = OM.readTree(aiOrder.getVideoParams());
if (existing instanceof ObjectNode) {
node = (ObjectNode) existing;
} else {
node = OM.createObjectNode();
node.set("snapshotBeforeVolcId", existing);
}
} else {
node = OM.createObjectNode();
}
node.put("volcTaskId", volcTaskId);
aiOrder.setVideoParams(OM.writeValueAsString(node));
} catch (Exception e) {
aiOrder.setVideoParams("{\"volcTaskId\":\"" + volcTaskId.replace("\"", "") + "\"}");
}
}
private AjaxResult submitOrderAndCreate(PortalVideoGenRequest req, String mode, ByteBodyReq byteBodyReq) {
String functionType = resolveFunctionType(req);
// 判断余额是否足够aimanager里配置了最低限额创建订单
AiOrder aiOrder = aiOrderService.getAiOrder(functionType);
if (aiOrder == null) {
return AjaxResult.error(-1, "You have a low balance, please recharge");
}
try {
fillVideoOrderRecord(aiOrder, req, mode, byteBodyReq, functionType);
aiOrderService.updateAiOrder(aiOrder);
String key = apiKey();
ByteBodyRes byteBodyRes = byteService.imgToVideo(byteBodyReq, key);
String thirdPartyOrderNumId = byteBodyRes.getId();
if (thirdPartyOrderNumId == null) {
aiOrderService.orderFailure(aiOrder);
return AjaxResult.error(-2, "generation failed, balance has been refunded");
}
mergeVolcTaskIdIntoVideoParams(aiOrder, thirdPartyOrderNumId);
aiOrder.setResult(thirdPartyOrderNumId);
// 字节订单号与请求ID
aiOrder.setThirdPartyOrderNum(thirdPartyOrderNumId);
aiOrder.setVideoGenRequestId(byteBodyRes.getRequestId());
// aiOrderService.orderSuccess(aiOrder);
aiOrderService.updateAiOrder(aiOrder);
// 逻辑暂时停用先不预扣 start !!!!!
// 查询任务详情按字节返回的预扣数量扣减
// GetVideoGenerationTaskResponse task = byteService.getVideoGenerationTasks(thirdPartyOrderNumId, key);
// if (task == null || task.getUsage() == null || task.getUsage().getTotalTokens() == null) {
// return AjaxResult.error(-2, "generation failed, byte task's usage is null");
// }
// if (task.getUsage().getTotalTokens() <= 0) {
// return AjaxResult.error(-2, "generation failed, byte task's totalTokens <= 0");
// }
// BigDecimal totalTokens = new BigDecimal(task.getUsage().getTotalTokens());
// // 同步设置aiOrder以防在抛异常时数值没变
// aiOrder.setPreDeductAmount(totalTokens);
// aiOrder.setAmount(totalTokens);
// 设置订单信息
// AiOrder updAiOrder = new AiOrder();
// updAiOrder.setId(aiOrder.getId());
// updAiOrder.setOrderNum(aiOrder.getOrderNum());
// updAiOrder.setPreDeductAmount(totalTokens);
// 先设置成预扣数量等收到回调再改过来这样后续报表会比较准确
// updAiOrder.setAmount(totalTokens);
// aiOrderService.updateAiOrder(updAiOrder);
// 扣减余额
// aiUserService.addUserBalance(aiOrder.getOrderNum(), SecurityUtils.getAiUserId()
// , NumberUtil.mul(-1, totalTokens), aiOrderService.getChangerType(functionType));
// 逻辑暂时停用先不预扣 start !!!!!
return AjaxResult.success(byteBodyRes);
} catch (Exception e) {
aiOrderService.orderFailure(aiOrder);
throw new RuntimeException(e);
}
}
@PostMapping("/text-to-video")
@ApiOperation("文生视频")
public AjaxResult textToVideo(@RequestBody PortalVideoGenRequest request) {
List<ContentItem> contentList;
if (request.getContent() != null && !request.getContent().isEmpty()) {
contentList = request.getContent();
} else {
if (StringUtils.isEmpty(request.getText())) {
return AjaxResult.error("请输入视频描述文本");
}
contentList = new ArrayList<>();
ContentItem textItem = new ContentItem();
textItem.setType("text");
textItem.setText(request.getText());
contentList.add(textItem);
}
ByteBodyReq body = newVideoBody(request, contentList);
return submitOrderAndCreate(request, "text-to-video", body);
}
@PostMapping("/image-first-frame")
@ApiOperation("图生视频-基于首帧")
public AjaxResult imageFirstFrame(@RequestBody PortalVideoGenRequest request) {
if (StringUtils.isEmpty(request.getFirstUrl())) {
return AjaxResult.error("请上传首帧图片");
}
if (StringUtils.isEmpty(request.getText())) {
return AjaxResult.error("请输入视频描述文本");
}
List<ContentItem> contentList = buildTextAndFirstFrame(request.getText(), request.getFirstUrl());
ByteBodyReq body = newVideoBody(request, contentList);
return submitOrderAndCreate(request, "image-first-frame", body);
}
@PostMapping("/image-first-last-frame")
@ApiOperation("图生视频-基于首尾帧")
public AjaxResult imageFirstLastFrame(@RequestBody PortalVideoGenRequest request) {
if (StringUtils.isEmpty(request.getFirstUrl()) || StringUtils.isEmpty(request.getLastUrl())) {
return AjaxResult.error("请同时上传首帧与尾帧图片");
}
if (StringUtils.isEmpty(request.getText())) {
return AjaxResult.error("请输入视频描述文本");
}
List<ContentItem> contentList = buildTextAndFirstFrame(request.getText(), request.getFirstUrl());
ContentItem lastFrameItem = new ContentItem();
lastFrameItem.setType("image_url");
lastFrameItem.setRole("last_frame");
ImageUrl lastImageUrl = new ImageUrl();
lastImageUrl.setUrl(request.getLastUrl());
lastFrameItem.setImageUrl(lastImageUrl);
contentList.add(lastFrameItem);
ByteBodyReq body = newVideoBody(request, contentList);
return submitOrderAndCreate(request, "image-first-last-frame", body);
}
@PostMapping("/image-reference")
@ApiOperation("图生视频-基于参考图")
public AjaxResult imageReference(@RequestBody PortalVideoGenRequest request) {
List<ContentItem> contentList;
if (request.getContent() != null && !request.getContent().isEmpty()) {
contentList = new ArrayList<>(request.getContent());
ContentItem head = contentList.get(0);
if (head == null || !"text".equals(head.getType()) || StringUtils.isEmpty(head.getText())) {
return AjaxResult.error("请输入视频描述文本(首条须为 type=text可含 [图片n]/[视频n]/[音频n] 占位)");
}
// 保留 text + 合法 reference_*//视频允许只有 text 没有参考素材
List<ContentItem> filtered = new ArrayList<>();
filtered.add(head);
for (int i = 1; i < contentList.size(); i++) {
ContentItem it = contentList.get(i);
if (isReferenceImageContentItem(it)
|| isReferenceAudioContentItem(it)
|| isReferenceVideoContentItem(it)) {
filtered.add(it);
}
}
contentList = filtered;
String firstRef = contentList.stream()
.skip(1)
.map(PortalVideoController::firstReferenceUrlFromItem)
.filter(StringUtils::isNotEmpty)
.findFirst()
.orElse(null);
// 无参考图也允许 text 提示词
if (StringUtils.isNotEmpty(firstRef) && StringUtils.isEmpty(request.getReferenceUrl())) {
request.setReferenceUrl(firstRef);
}
} else {
if (StringUtils.isEmpty(request.getReferenceUrl())) {
return AjaxResult.error("请上传参考图");
}
if (StringUtils.isEmpty(request.getText())) {
return AjaxResult.error("请输入视频描述文本");
}
contentList = new ArrayList<>();
ContentItem textItem = new ContentItem();
textItem.setType("text");
textItem.setText(request.getText());
contentList.add(textItem);
ContentItem refItem = new ContentItem();
refItem.setType("image_url");
refItem.setRole("reference_image");
ImageUrl refUrl = new ImageUrl();
refUrl.setUrl(request.getReferenceUrl());
refItem.setImageUrl(refUrl);
contentList.add(refItem);
}
ByteBodyReq body = newVideoBody(request, contentList);
return submitOrderAndCreate(request, "image-reference", body);
}
private static String firstReferenceUrlFromItem(ContentItem item) {
if (isReferenceImageContentItem(item)) {
return item.getImageUrl().getUrl();
}
if (isReferenceVideoContentItem(item)) {
return item.getVideoUrl().getUrl();
}
if (isReferenceAudioContentItem(item)) {
return item.getAudioUrl().getUrl();
}
return null;
}
private static boolean isValidReferenceAssetOrHttpUrl(String raw) {
if (StringUtils.isEmpty(raw)) {
return false;
}
String url = raw.trim().toLowerCase();
return url.startsWith("http://") || url.startsWith("https://") || url.startsWith("asset://");
}
private static boolean isReferenceImageContentItem(ContentItem item) {
if (item == null || !"image_url".equals(item.getType())) {
return false;
}
if (!"reference_image".equals(item.getRole())) {
return false;
}
ImageUrl iu = item.getImageUrl();
if (iu == null || StringUtils.isEmpty(iu.getUrl())) {
return false;
}
return isValidReferenceAssetOrHttpUrl(iu.getUrl());
}
private static boolean isReferenceVideoContentItem(ContentItem item) {
if (item == null || !"video_url".equals(item.getType())) {
return false;
}
if (!"reference_video".equals(item.getRole())) {
return false;
}
ImageUrl vu = item.getVideoUrl();
if (vu == null || StringUtils.isEmpty(vu.getUrl())) {
return false;
}
return isValidReferenceAssetOrHttpUrl(vu.getUrl());
}
private static boolean isReferenceAudioContentItem(ContentItem item) {
if (item == null || !"audio_url".equals(item.getType())) {
return false;
}
if (!"reference_audio".equals(item.getRole())) {
return false;
}
ImageUrl au = item.getAudioUrl();
if (au == null || StringUtils.isEmpty(au.getUrl())) {
return false;
}
return isValidReferenceAssetOrHttpUrl(au.getUrl());
}
private List<ContentItem> buildTextAndFirstFrame(String text, String firstUrl) {
List<ContentItem> contentList = new ArrayList<>();
ContentItem textItem = new ContentItem();
textItem.setType("text");
textItem.setText(text);
contentList.add(textItem);
ContentItem firstFrameItem = new ContentItem();
firstFrameItem.setType("image_url");
firstFrameItem.setRole("first_frame");
ImageUrl firstImageUrl = new ImageUrl();
firstImageUrl.setUrl(firstUrl);
firstFrameItem.setImageUrl(firstImageUrl);
contentList.add(firstFrameItem);
return contentList;
}
@GetMapping("/options")
@ApiOperation("门户视频生成可选参数(模型/比例/时长等,来自配置)")
public AjaxResult videoParamOptions() {
Long uid = SecurityUtils.getAiUserId();
Long secondDeptId = byteDeptApiKeyService.resolveSecondLevelDeptId(uid);
List<PortalVideoProperties.ModelOption> models = loadModelOptionsForAiUser(uid, secondDeptId);
PortalVideoProperties.Defaults defs = portalVideoProperties.resolveEffectiveDefaults(secondDeptId);
alignDefaultsModelToOptions(defs, models);
Map<String, Object> data = new LinkedHashMap<>();
data.put("defaults", defs);
data.put("models", models);
data.put("ratios", portalVideoProperties.getRatios());
data.put("durations", portalVideoProperties.getDurations());
data.put("resolutions", portalVideoProperties.getResolutions());
return AjaxResult.success(data);
}
@GetMapping("/tasks")
@ApiOperation("查询视频生成任务列表(本用户库表分页)")
public TableDataInfo listMyVideoTasks(AiOrder aiOrder) {
aiOrder.setUserId(SecurityUtils.getAiUserId());
aiOrder.setType("21");
startPage();
List<AiOrder> list = aiOrderService.selectAiOrderList(aiOrder);
return getDataTable(list);
}
@GetMapping("/volc-tasks")
@ApiOperation("查询视频生成任务列表(火山平台,按本用户在库中的任务 id 过滤)")
public AjaxResult listVolcTasks(
@RequestParam(defaultValue = "1") int pageNum,
@RequestParam(defaultValue = "20") int pageSize) throws Exception {
Long uid = SecurityUtils.getAiUserId();
String key = apiKey();
String raw = byteService.listVideoGenerationTasks(pageNum, pageSize, key);
String filtered = filterVolcTasksJsonForUser(raw, uid);
return AjaxResult.success(OM.readTree(filtered));
}
private String filterVolcTasksJsonForUser(String raw, Long userId) throws Exception {
AiOrder query = new AiOrder();
query.setUserId(userId);
query.setType("21");
List<AiOrder> mine = aiOrderService.selectAiOrderList(query);
Set<String> allowed = mine.stream()
.map(AiOrder::getResult)
.filter(StringUtils::isNotEmpty)
.collect(Collectors.toSet());
JsonNode root = OM.readTree(raw);
if (!(root instanceof ObjectNode)) {
return raw;
}
ArrayNode arr = null;
String arrayKey = null;
if (root.has("items") && root.get("items").isArray()) {
arr = (ArrayNode) root.get("items");
arrayKey = "items";
} else if (root.has("data") && root.get("data").isArray()) {
arr = (ArrayNode) root.get("data");
arrayKey = "data";
}
if (arr == null) {
return raw;
}
ArrayNode out = OM.createArrayNode();
for (JsonNode n : arr) {
String tid = n.has("id") ? n.get("id").asText() : null;
if (tid != null && allowed.contains(tid)) {
out.add(n);
}
}
ObjectNode result = ((ObjectNode) root).deepCopy();
result.set(arrayKey, out);
result.put("filtered_total", out.size());
return OM.writeValueAsString(result);
}
@GetMapping("/tasks/{taskId}")
@ApiOperation("查询单个视频生成任务(火山)")
public AjaxResult getVolcTask(@PathVariable String taskId) throws Exception {
Long uid = SecurityUtils.getAiUserId();
AiOrder owned = aiOrderService.getAiOrderByPortalVideoTask(taskId);
if (owned == null || !uid.equals(owned.getUserId())) {
return AjaxResult.error("无权查看该任务");
}
String key = apiKey();
ByteBodyRes byteBodyRes;
try {
byteBodyRes = byteService.uploadVideo(taskId, key);
} catch (Exception e) {
String msg = e.getMessage();
// ByteService HTTP 2xx 时抛出以此前缀开头的异常仅此种情况清空订单避免网络抖动等误伤
if (msg != null && msg.startsWith("uploadVideo error")) {
logger.warn("查询火山任务 HTTP 非成功,已清空订单 result 并标记失败, orderId={}, taskId={}",
owned.getId(), taskId, e);
AiOrder failedOrder = new AiOrder();
failedOrder.setId(owned.getId());
failedOrder.setResult("");
failedOrder.setStatus(2);
aiOrderService.updateAiOrder(failedOrder);
return AjaxResult.error(msg);
}
throw e;
}
if ("succeeded".equals(byteBodyRes.getStatus())) {
content contentObj = byteBodyRes.getContent();
if (contentObj != null && StringUtils.isNotEmpty(contentObj.getVideo_url())) {
String videoUrl = tencentCosUtil.uploadFileByUrl(contentObj.getVideo_url());
if (videoUrl != null) {
contentObj.setVideo_url(videoUrl);
AiOrder aiOrder = new AiOrder();
aiOrder.setId(owned.getId());
aiOrder.setResult(videoUrl);
aiOrderService.updateAiOrder(aiOrder);
}
}
}
return AjaxResult.success(byteBodyRes);
}
// @DeleteMapping("/tasks/{taskId}")
// @ApiOperation("删除或取消视频生成任务")
// public AjaxResult deleteOrCancelTask(@PathVariable String taskId) throws Exception {
// Long uid = SecurityUtils.getAiUserId();
// AiOrder owned = aiOrderService.getAiOrderByPortalVideoTask(taskId);
// if (owned == null || !uid.equals(owned.getUserId())) {
// return AjaxResult.error("无权操作该任务");
// }
// String key = apiKey();
// AjaxResult cancelRes = byteService.cancelVideoTask(taskId, key);
// if (cancelRes.isSuccess() && owned.getStatus() != null && owned.getStatus() == 0) {
// aiOrderService.orderFailure(owned);
// }
// return cancelRes;
// }
}

View File

@ -31,6 +31,11 @@ public class ByteApiRequest {
@ApiModelProperty(name = "标签字符串") @ApiModelProperty(name = "标签字符串")
private String tags; private String tags;
@ApiModelProperty(name = "使用的模型")
private String model;
@ApiModelProperty(name = "生成模式text-to-video 或 image-to-video")
private String mode = "text-to-video";
} }

Some files were not shown because too many files have changed in this diff Show More