新增内容,新增拉起软件层
This commit is contained in:
2
app/.env
2
app/.env
@@ -11,7 +11,7 @@ zn_username=%E8%87%AA%E5%8A%A8%E5%8C%96_Robot
|
||||
|
||||
client_name=ShuFuAI
|
||||
|
||||
# java_api_base=http://api.aishufu.top:18080/
|
||||
# java_api_base=http://47.111.163.154:18080/
|
||||
java_api_base=http://api.aishufu.top:18080/
|
||||
# java_api_base=http://127.0.0.1:18080/
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
import{bN as r}from"./java-modules-WSWRTEaR.js";const n="";function s(e){return r(`${n}/api/brand/expand-folder-recursive`,{folder:e})}export{s as e};
|
||||
import{b6 as r}from"./java-modules-B9jblDzU.js";const n="";function s(e){return r(`${n}/api/brand/expand-folder-recursive`,{folder:e})}export{s as e};
|
||||
1
app/assets/collect-data-Cb4Clz6L.css
Normal file
1
app/assets/collect-data-Cb4Clz6L.css
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
app/assets/image-video-uN8PfarH.css
Normal file
1
app/assets/image-video-uN8PfarH.css
Normal file
@@ -0,0 +1 @@
|
||||
.image-video-page[data-v-e41486d3]{min-height:100vh;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:40px;color:#333;font-family:Microsoft YaHei,PingFang SC,Hiragino Sans GB,sans-serif;background:linear-gradient(#ffffff80,#ffffff80),url(/static/bg.jpg) center/cover no-repeat,#eef3f7}.page-header[data-v-e41486d3]{position:absolute;top:0;left:0;right:0;height:56px;display:flex;align-items:center;justify-content:space-between;padding:0 24px;background:#ffffff80}.header-title[data-v-e41486d3]{color:#333;font-size:18px;font-weight:600}.back-link[data-v-e41486d3]{color:#555;font-size:14px;text-decoration:none}.back-link[data-v-e41486d3]:hover{color:#667eea}.entrances[data-v-e41486d3]{display:flex;gap:32px;flex-wrap:wrap;justify-content:center}.entrance-btn[data-v-e41486d3]{width:160px;height:100px;display:flex;align-items:center;justify-content:center;color:#333;background:#c5c1c1;border:4px solid #b8d4e3;border-radius:12px;cursor:pointer;font:inherit;font-size:18px;font-weight:600;text-decoration:none;transition:all .2s}.entrance-btn[data-v-e41486d3]:hover:not(:disabled){background:#f8fbfd;box-shadow:0 4px 12px #00000014}.entrance-btn[data-v-e41486d3]:disabled{cursor:wait;opacity:.72}.toast[data-v-e41486d3]{position:fixed;bottom:40px;left:50%;padding:12px 24px;max-width:min(420px,calc(100vw - 48px));color:#fff;background:#000000bf;border-radius:8px;font-size:14px;text-align:center;opacity:0;pointer-events:none;transform:translate(-50%);transition:opacity .3s}.toast.show[data-v-e41486d3]{opacity:1}.toast.error[data-v-e41486d3]{background:#b02a37eb}@media(max-width:640px){.image-video-page[data-v-e41486d3]{padding:88px 24px 40px}.entrances[data-v-e41486d3]{width:100%;gap:18px}.entrance-btn[data-v-e41486d3]{width:100%;max-width:220px}}
|
||||
1
app/assets/image-video.js
Normal file
1
app/assets/image-video.js
Normal file
@@ -0,0 +1 @@
|
||||
import{d as p,a as m,c as f,e as a,t as _,n as v,g as l,i as b,_ as g,j as y,k as h}from"./pywebview-B8lwamDf.js";const w={class:"image-video-page"},k={class:"entrances","aria-label":"图生视频入口"},C=["disabled"],T=p({__name:"ImageVideoPage",setup(I){const o=l(!1),n=l(""),i=l("normal");let r;function s(t,e="normal"){n.value=t,i.value=e,r&&window.clearTimeout(r),r=window.setTimeout(()=>{n.value=""},2200)}function u(t){s(`${t}暂未开通,敬请期待`)}async function c(){const t=b();if(!t?.launch_yaoayanui){s("当前环境不支持拉起桌面端","error");return}o.value=!0;try{const e=await t.launch_yaoayanui();if(e?.success){s("已发送启动请求");return}s(e?.error||"启动失败","error")}catch(e){s(e instanceof Error?e.message:String(e),"error")}finally{o.value=!1}}return(t,e)=>(m(),f("div",w,[e[2]||(e[2]=a("header",{class:"page-header"},[a("span",{class:"header-title"},"数富AI"),a("a",{class:"back-link",href:"/home"},"返回首页")],-1)),a("main",k,[a("button",{type:"button",class:"entrance-btn",disabled:o.value,onClick:c}," 数字人 ",8,C),a("button",{type:"button",class:"entrance-btn",onClick:e[0]||(e[0]=d=>u("带货视频"))}," 带货视频 "),a("button",{type:"button",class:"entrance-btn",onClick:e[1]||(e[1]=d=>u("混剪"))}," 混剪 ")]),a("div",{class:v(["toast",{show:!!n.value,error:i.value==="error"}])},_(n.value),3)]))}}),B=g(T,[["__scopeId","data-v-e41486d3"]]);y(B).use(h).mount("#app");
|
||||
File diff suppressed because one or more lines are too long
6
app/assets/java-modules-B9jblDzU.js
Normal file
6
app/assets/java-modules-B9jblDzU.js
Normal file
File diff suppressed because one or more lines are too long
1
app/assets/java-modules-CXcfGmAJ.css
Normal file
1
app/assets/java-modules-CXcfGmAJ.css
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
50
app/assets/pywebview-B8lwamDf.js
Normal file
50
app/assets/pywebview-B8lwamDf.js
Normal file
File diff suppressed because one or more lines are too long
1
app/assets/pywebview-xvHHTGU_.css
Normal file
1
app/assets/pywebview-xvHHTGU_.css
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
app/assets/similar-asin-CJxBjrIf.css
Normal file
1
app/assets/similar-asin-CJxBjrIf.css
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
app/assets/zh-cn-CqyuNHRW.js
Normal file
1
app/assets/zh-cn-CqyuNHRW.js
Normal file
File diff suppressed because one or more lines are too long
70
app/main.py
70
app/main.py
@@ -419,6 +419,74 @@ class WindowAPI:
|
||||
except Exception as e:
|
||||
return {'success': False, 'error': str(e)}
|
||||
|
||||
def launch_yaoayanui(self):
|
||||
candidates = []
|
||||
env_path = os.getenv('YAOAYANUI_EXE', '').strip()
|
||||
if env_path:
|
||||
candidates.append(env_path)
|
||||
|
||||
candidates.extend([
|
||||
os.path.join(BASE_DIR, 'resources', 'yaoayanui', 'tauri-app.exe'),
|
||||
os.path.abspath(os.path.join(
|
||||
BASE_DIR,
|
||||
'..',
|
||||
'..',
|
||||
'yaoyaoAI',
|
||||
'yaoayanui',
|
||||
'src-tauri',
|
||||
'target',
|
||||
'release',
|
||||
'tauri-app.exe',
|
||||
)),
|
||||
os.path.abspath(os.path.join(
|
||||
BASE_DIR,
|
||||
'..',
|
||||
'..',
|
||||
'yaoyaoAI',
|
||||
'yaoayanui',
|
||||
'src-tauri',
|
||||
'target',
|
||||
'release',
|
||||
'bundle',
|
||||
'nsis',
|
||||
'aiclient_0.1.15_x64-setup.exe',
|
||||
)),
|
||||
])
|
||||
|
||||
exe_path = ''
|
||||
for candidate in candidates:
|
||||
if candidate and os.path.isfile(candidate):
|
||||
exe_path = os.path.abspath(candidate)
|
||||
break
|
||||
|
||||
if not exe_path:
|
||||
return {
|
||||
'success': False,
|
||||
'error': '未找到 yaoayanui 可执行文件,请设置 YAOAYANUI_EXE',
|
||||
}
|
||||
|
||||
try:
|
||||
if sys.platform.startswith('win'):
|
||||
subprocess.Popen(
|
||||
[exe_path],
|
||||
cwd=os.path.dirname(exe_path),
|
||||
stdin=subprocess.DEVNULL,
|
||||
stdout=subprocess.DEVNULL,
|
||||
stderr=subprocess.DEVNULL,
|
||||
creationflags=subprocess.DETACHED_PROCESS | subprocess.CREATE_NEW_PROCESS_GROUP,
|
||||
)
|
||||
else:
|
||||
subprocess.Popen(
|
||||
[exe_path],
|
||||
cwd=os.path.dirname(exe_path),
|
||||
stdin=subprocess.DEVNULL,
|
||||
stdout=subprocess.DEVNULL,
|
||||
stderr=subprocess.DEVNULL,
|
||||
)
|
||||
return {'success': True, 'path': exe_path}
|
||||
except Exception as e:
|
||||
return {'success': False, 'error': str(e)}
|
||||
|
||||
def enqueue_json(self, data):
|
||||
"""保存任务到队列"""
|
||||
try:
|
||||
@@ -538,7 +606,7 @@ def main():
|
||||
|
||||
api = WindowAPI(window)
|
||||
window.expose(api.close, api.minimize, api.maximize, api.toggle_maximize, generate_images, api.save_image, api.save_image_to_folder, api.select_folder, api.select_brand_xlsx_files, api.select_brand_folder,
|
||||
api.save_file_from_url, api.save_template_xlsx,api.save_template_zip,api.upload_file_to_java,api.open_external_url,api.enqueue_json,api.get_detail_del,api.save_file_from_url_new,api.save_file_from_url_with_progress,api.get_device_id)
|
||||
api.save_file_from_url, api.save_template_xlsx,api.save_template_zip,api.upload_file_to_java,api.open_external_url,api.launch_yaoayanui,api.enqueue_json,api.get_detail_del,api.save_file_from_url_new,api.save_file_from_url_with_progress,api.get_device_id)
|
||||
webview.start(
|
||||
debug=True,
|
||||
storage_path=cache_path,
|
||||
|
||||
@@ -5,9 +5,11 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>格式转换 - 数富AI</title>
|
||||
<script type="module" crossorigin src="/assets/convert.js"></script>
|
||||
<link rel="modulepreload" crossorigin href="/assets/java-modules-WSWRTEaR.js">
|
||||
<link rel="modulepreload" crossorigin href="/assets/brand-5GpfAyHD.js">
|
||||
<link rel="stylesheet" crossorigin href="/assets/java-modules-B3hGvRck.css">
|
||||
<link rel="modulepreload" crossorigin href="/assets/pywebview-B8lwamDf.js">
|
||||
<link rel="modulepreload" crossorigin href="/assets/java-modules-B9jblDzU.js">
|
||||
<link rel="modulepreload" crossorigin href="/assets/brand-DE-sObfq.js">
|
||||
<link rel="stylesheet" crossorigin href="/assets/pywebview-xvHHTGU_.css">
|
||||
<link rel="stylesheet" crossorigin href="/assets/java-modules-CXcfGmAJ.css">
|
||||
<link rel="stylesheet" crossorigin href="/assets/convert-6oxZNMye.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -5,9 +5,11 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>数据去重 - 数富AI</title>
|
||||
<script type="module" crossorigin src="/assets/dedupe.js"></script>
|
||||
<link rel="modulepreload" crossorigin href="/assets/java-modules-WSWRTEaR.js">
|
||||
<link rel="modulepreload" crossorigin href="/assets/brand-5GpfAyHD.js">
|
||||
<link rel="stylesheet" crossorigin href="/assets/java-modules-B3hGvRck.css">
|
||||
<link rel="modulepreload" crossorigin href="/assets/pywebview-B8lwamDf.js">
|
||||
<link rel="modulepreload" crossorigin href="/assets/java-modules-B9jblDzU.js">
|
||||
<link rel="modulepreload" crossorigin href="/assets/brand-DE-sObfq.js">
|
||||
<link rel="stylesheet" crossorigin href="/assets/pywebview-xvHHTGU_.css">
|
||||
<link rel="stylesheet" crossorigin href="/assets/java-modules-CXcfGmAJ.css">
|
||||
<link rel="stylesheet" crossorigin href="/assets/dedupe-DpfPYQDv.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -5,10 +5,12 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>删除品牌 - 数富AI</title>
|
||||
<script type="module" crossorigin src="/assets/delete-brand.js"></script>
|
||||
<link rel="modulepreload" crossorigin href="/assets/java-modules-WSWRTEaR.js">
|
||||
<link rel="modulepreload" crossorigin href="/assets/brand-5GpfAyHD.js">
|
||||
<link rel="modulepreload" crossorigin href="/assets/pywebview-B8lwamDf.js">
|
||||
<link rel="modulepreload" crossorigin href="/assets/java-modules-B9jblDzU.js">
|
||||
<link rel="modulepreload" crossorigin href="/assets/brand-DE-sObfq.js">
|
||||
<link rel="modulepreload" crossorigin href="/assets/categorized-timers-JPA-olTr.js">
|
||||
<link rel="stylesheet" crossorigin href="/assets/java-modules-B3hGvRck.css">
|
||||
<link rel="stylesheet" crossorigin href="/assets/pywebview-xvHHTGU_.css">
|
||||
<link rel="stylesheet" crossorigin href="/assets/java-modules-CXcfGmAJ.css">
|
||||
<link rel="stylesheet" crossorigin href="/assets/delete-brand-DZ3x5hOX.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -5,9 +5,11 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>数据拆分 - 数富AI</title>
|
||||
<script type="module" crossorigin src="/assets/split.js"></script>
|
||||
<link rel="modulepreload" crossorigin href="/assets/java-modules-WSWRTEaR.js">
|
||||
<link rel="modulepreload" crossorigin href="/assets/brand-5GpfAyHD.js">
|
||||
<link rel="stylesheet" crossorigin href="/assets/java-modules-B3hGvRck.css">
|
||||
<link rel="modulepreload" crossorigin href="/assets/pywebview-B8lwamDf.js">
|
||||
<link rel="modulepreload" crossorigin href="/assets/java-modules-B9jblDzU.js">
|
||||
<link rel="modulepreload" crossorigin href="/assets/brand-DE-sObfq.js">
|
||||
<link rel="stylesheet" crossorigin href="/assets/pywebview-xvHHTGU_.css">
|
||||
<link rel="stylesheet" crossorigin href="/assets/java-modules-CXcfGmAJ.css">
|
||||
<link rel="stylesheet" crossorigin href="/assets/split-CR1PtDQE.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -1,15 +1,22 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>首页 - 数富AI</title>
|
||||
<style>
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
|
||||
background: linear-gradient(rgba(255,255,255,0.5), rgba(255,255,255,0.5)),
|
||||
url("/static/bg.jpg") center/cover no-repeat;;
|
||||
background: linear-gradient(rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.5)),
|
||||
url("/static/bg.jpg") center/cover no-repeat;
|
||||
;
|
||||
/*background-image: url("/static/bg.jpg");*/
|
||||
|
||||
min-height: 100vh;
|
||||
@@ -19,6 +26,7 @@
|
||||
justify-content: center;
|
||||
padding: 40px;
|
||||
}
|
||||
|
||||
.header {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
@@ -29,20 +37,40 @@
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 0 24px;
|
||||
background: rgba(255,255,255,0.5);
|
||||
background: rgba(255, 255, 255, 0.5);
|
||||
}
|
||||
.header-title { font-size: 18px; font-weight: 600; color: #333; }
|
||||
.header-right { display: flex; align-items: center; gap: 16px; position: relative; }
|
||||
.header-right a, .header-right span {
|
||||
font-size: 14px; color: #555; text-decoration: none;
|
||||
|
||||
.header-title {
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
.header-right a:hover { color: #667eea; }
|
||||
|
||||
.header-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.header-right a,
|
||||
.header-right span {
|
||||
font-size: 14px;
|
||||
color: #555;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.header-right a:hover {
|
||||
color: #667eea;
|
||||
}
|
||||
|
||||
.entrances {
|
||||
display: flex;
|
||||
gap: 32px;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.entrance-btn {
|
||||
width: 160px;
|
||||
height: 100px;
|
||||
@@ -59,21 +87,27 @@
|
||||
transition: all 0.2s;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.entrance-btn:hover {
|
||||
background: #f8fbfd;
|
||||
box-shadow: 0 4px 12px rgba(0,0,0,0.08);
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
.entrance-btn.wb { cursor: pointer; }
|
||||
|
||||
.entrance-btn.wb {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.entrance-btn.disabled {
|
||||
cursor: not-allowed;
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.toast {
|
||||
position: fixed;
|
||||
bottom: 40px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
background: rgba(0,0,0,0.75);
|
||||
background: rgba(0, 0, 0, 0.75);
|
||||
color: #fff;
|
||||
padding: 12px 24px;
|
||||
border-radius: 8px;
|
||||
@@ -82,19 +116,25 @@
|
||||
transition: opacity 0.3s;
|
||||
pointer-events: none;
|
||||
}
|
||||
.toast.show { opacity: 1; }
|
||||
|
||||
.toast.show {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.admin-link {
|
||||
font-size: 13px;
|
||||
color: #888;
|
||||
}
|
||||
|
||||
.update-section {
|
||||
margin-top: 48px;
|
||||
padding: 20px 24px;
|
||||
background: rgba(255,255,255,0.85);
|
||||
background: rgba(255, 255, 255, 0.85);
|
||||
border-radius: 12px;
|
||||
border: 1px solid rgba(0,0,0,0.06);
|
||||
border: 1px solid rgba(0, 0, 0, 0.06);
|
||||
max-width: 420px;
|
||||
}
|
||||
|
||||
.update-section-title {
|
||||
font-size: 14px;
|
||||
color: #333;
|
||||
@@ -103,16 +143,19 @@
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.update-block {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.update-version-text {
|
||||
font-size: 13px;
|
||||
color: #555;
|
||||
}
|
||||
|
||||
.btn-check-update {
|
||||
padding: 8px 14px;
|
||||
font-size: 13px;
|
||||
@@ -122,15 +165,18 @@
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.btn-check-update:hover {
|
||||
background: #5a6fd6;
|
||||
}
|
||||
|
||||
.update-hint {
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
margin-top: 8px;
|
||||
min-height: 18px;
|
||||
}
|
||||
|
||||
.btn-download-update {
|
||||
margin-top: 8px;
|
||||
padding: 8px 14px;
|
||||
@@ -141,15 +187,17 @@
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.btn-download-update:hover {
|
||||
background: #218838;
|
||||
}
|
||||
|
||||
.header-update-btn {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border-radius: 50%;
|
||||
border: none;
|
||||
background: rgba(102,126,234,0.12);
|
||||
background: rgba(102, 126, 234, 0.12);
|
||||
color: #4c5bd4;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
@@ -158,22 +206,25 @@
|
||||
font-size: 15px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.header-update-btn:hover {
|
||||
background: rgba(102,126,234,0.2);
|
||||
background: rgba(102, 126, 234, 0.2);
|
||||
}
|
||||
|
||||
.header-update-panel {
|
||||
position: absolute;
|
||||
top: 44px;
|
||||
right: 0;
|
||||
width: 280px;
|
||||
padding: 14px 16px;
|
||||
background: rgba(255,255,255,0.98);
|
||||
background: rgba(255, 255, 255, 0.98);
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 4px 16px rgba(0,0,0,0.12);
|
||||
border: 1px solid rgba(0,0,0,0.04);
|
||||
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
|
||||
border: 1px solid rgba(0, 0, 0, 0.04);
|
||||
z-index: 10;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.header-update-title {
|
||||
font-size: 13px;
|
||||
color: #333;
|
||||
@@ -184,12 +235,13 @@
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body data-user-id="{{ user_id or '' }}">
|
||||
<header class="header">
|
||||
<span class="header-title">数富AI</span>
|
||||
<div class="header-right">
|
||||
{% if is_admin %}
|
||||
<!-- <a href="/admin" class="admin-link">用户管理</a>-->
|
||||
<!-- <a href="/admin" class="admin-link">用户管理</a>-->
|
||||
{% endif %}
|
||||
<span>{{ username }}</span>
|
||||
<button type="button" class="header-update-btn" id="homeUpdateToggle" title="检测更新">↻</button>
|
||||
@@ -202,7 +254,8 @@
|
||||
</div>
|
||||
<div class="update-hint" id="homeUpdateHint"></div>
|
||||
<div style="margin-top: 4px;">
|
||||
<button type="button" class="btn-download-update" id="homeBtnDownloadUpdate" style="display: none;">立即更新</button>
|
||||
<button type="button" class="btn-download-update" id="homeBtnDownloadUpdate"
|
||||
style="display: none;">立即更新</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -210,7 +263,7 @@
|
||||
|
||||
<div class="entrances" id="entrances">
|
||||
<a class="entrance-btn" href="/brand" data-column-key="brand">亚马逊</a>
|
||||
<a class="entrance-btn disabled" href="javascript:;" data-msg="暂未开通,敬请期待" data-column-key="wb">wildberries</a>
|
||||
<a class="entrance-btn" href="/new_web_source/image-video.html" data-column-key="wb">图生视频</a>
|
||||
<a class="entrance-btn image" href="/image" data-column-key="image">图片</a>
|
||||
</div>
|
||||
|
||||
@@ -221,44 +274,44 @@
|
||||
return 'app_column_permissions:' + String(uid || '');
|
||||
}
|
||||
// 权限校验:根据 Java column-permissions 接口按 column_key 显示入口
|
||||
(function() {
|
||||
localStorage.setItem("uid",{{ user_id }})
|
||||
(function () {
|
||||
localStorage.setItem("uid", {{ user_id }});
|
||||
var uid = document.body.getAttribute('data-user-id');
|
||||
if (!uid) return;
|
||||
var cacheKey = getAppPermissionCacheKey(uid);
|
||||
var AUTH_TOKEN_KEY = 'aiimage_auth_token';
|
||||
var JAVA_API_BASE = "{{ java_api_base or '' }}".replace(/\/+$/, '');
|
||||
var token = '';
|
||||
try { token = localStorage.getItem(AUTH_TOKEN_KEY) || ''; } catch (e) {}
|
||||
try { token = localStorage.getItem(AUTH_TOKEN_KEY) || ''; } catch (e) { }
|
||||
if (!JAVA_API_BASE || !token) return;
|
||||
var apiUrl = JAVA_API_BASE + '/api/admin/permission-users/' + uid + '/column-permissions?menuType=app';
|
||||
fetch(apiUrl, {
|
||||
credentials: 'include',
|
||||
headers: { 'Authorization': 'Bearer ' + token }
|
||||
})
|
||||
.then(function(r) { return r.json(); })
|
||||
.then(function(res) {
|
||||
.then(function (r) { return r.json(); })
|
||||
.then(function (res) {
|
||||
if (!res || !res.success || !Array.isArray(res.data)) return;
|
||||
try {
|
||||
localStorage.setItem(cacheKey, JSON.stringify(res.data));
|
||||
} catch (e) {}
|
||||
var allowedKeys = res.data.map(function(item) { return (item.columnKey || item.column_key || '').toLowerCase(); });
|
||||
document.querySelectorAll('.entrances .entrance-btn[data-column-key]').forEach(function(btn) {
|
||||
} catch (e) { }
|
||||
var allowedKeys = res.data.map(function (item) { return (item.columnKey || item.column_key || '').toLowerCase(); });
|
||||
document.querySelectorAll('.entrances .entrance-btn[data-column-key]').forEach(function (btn) {
|
||||
var key = (btn.getAttribute('data-column-key') || '').toLowerCase();
|
||||
btn.style.display = allowedKeys.indexOf(key) >= 0 ? '' : 'none';
|
||||
});
|
||||
})
|
||||
.catch(function() {});
|
||||
.catch(function () { });
|
||||
})();
|
||||
|
||||
document.querySelectorAll('.entrance-btn.disabled').forEach(function(btn) {
|
||||
btn.onclick = function(e) {
|
||||
document.querySelectorAll('.entrance-btn.disabled').forEach(function (btn) {
|
||||
btn.onclick = function (e) {
|
||||
e.preventDefault();
|
||||
var msg = btn.getAttribute('data-msg') || '暂未开通,敬请期待';
|
||||
var t = document.getElementById('toast');
|
||||
t.textContent = msg;
|
||||
t.classList.add('show');
|
||||
setTimeout(function() { t.classList.remove('show'); }, 2000);
|
||||
setTimeout(function () { t.classList.remove('show'); }, 2000);
|
||||
};
|
||||
});
|
||||
|
||||
@@ -267,7 +320,7 @@
|
||||
var AUTH_TOKEN_KEY = 'aiimage_auth_token';
|
||||
var JAVA_API_BASE = "{{ java_api_base or '' }}".replace(/\/+$/, '');
|
||||
var token = '';
|
||||
try { token = localStorage.getItem(AUTH_TOKEN_KEY) || ''; } catch (e) {}
|
||||
try { token = localStorage.getItem(AUTH_TOKEN_KEY) || ''; } catch (e) { }
|
||||
|
||||
function cleanLocal() {
|
||||
try {
|
||||
@@ -304,7 +357,7 @@
|
||||
}
|
||||
|
||||
// 软件更新(与 index 设置中逻辑一致)
|
||||
(function() {
|
||||
(function () {
|
||||
const versionText = document.getElementById('homeVersionText');
|
||||
const updateHint = document.getElementById('homeUpdateHint');
|
||||
const btnDownload = document.getElementById('homeBtnDownloadUpdate');
|
||||
@@ -316,25 +369,25 @@
|
||||
versionText.textContent = '当前版本: v' + currentVersion;
|
||||
|
||||
// 打开/关闭浮层
|
||||
toggleBtn.addEventListener('click', function(e) {
|
||||
toggleBtn.addEventListener('click', function (e) {
|
||||
e.stopPropagation();
|
||||
const isVisible = updatePanel.style.display === 'block';
|
||||
updatePanel.style.display = isVisible ? 'none' : 'block';
|
||||
});
|
||||
|
||||
// 点击外部关闭浮层
|
||||
document.addEventListener('click', function() {
|
||||
document.addEventListener('click', function () {
|
||||
updatePanel.style.display = 'none';
|
||||
});
|
||||
updatePanel.addEventListener('click', function(e) {
|
||||
updatePanel.addEventListener('click', function (e) {
|
||||
e.stopPropagation();
|
||||
});
|
||||
|
||||
document.getElementById('homeBtnCheckUpdate').onclick = async function() {
|
||||
document.getElementById('homeBtnCheckUpdate').onclick = async function () {
|
||||
updateHint.textContent = '正在检测更新...';
|
||||
btnDownload.style.display = 'none';
|
||||
try {
|
||||
const resp = await fetch('/api/version', { credentials: 'same-origin' }).catch(function() { return null; });
|
||||
const resp = await fetch('/api/version', { credentials: 'same-origin' }).catch(function () { return null; });
|
||||
if (resp && resp.ok) {
|
||||
const data = await resp.json();
|
||||
currentVersion = (data.version || currentVersion).replace(/^v/i, '');
|
||||
@@ -343,7 +396,7 @@
|
||||
updateHint.textContent = '发现新版本 v' + data.latest_version + (data.desc ? ':' + data.desc : '');
|
||||
btnDownload.style.display = 'inline-block';
|
||||
btnDownload.textContent = '立即更新';
|
||||
btnDownload.onclick = async function() {
|
||||
btnDownload.onclick = async function () {
|
||||
if (!confirm('有更新,是否现在更新?\n更新将下载安装包并重启程序。')) return;
|
||||
if (!data.file_url) {
|
||||
updateHint.textContent = '暂无下载地址,请关注官方渠道。';
|
||||
@@ -358,7 +411,7 @@
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ file_url: data.file_url })
|
||||
});
|
||||
const result = await updateResp.json().catch(function() { return {}; });
|
||||
const result = await updateResp.json().catch(function () { return {}; });
|
||||
if (result.success) {
|
||||
updateHint.textContent = '更新已启动,程序即将退出...';
|
||||
} else {
|
||||
@@ -384,4 +437,5 @@
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user