模型上传

This commit is contained in:
2025-09-13 13:36:55 +08:00
parent 5176724172
commit a94ce15731
35 changed files with 158 additions and 39 deletions
-5
View File
@@ -1,5 +0,0 @@
<template>
<div class="home-placeholder">
<p>此页面已被“模型广场”替代。请使用顶部导航。</p>
</div>
</template>
+86 -18
View File
@@ -35,17 +35,20 @@ onMounted(load)
<template>
<div class="list-page">
<div class="toolbar">
<input v-model="st.q" placeholder="搜索标题/描述" @keydown.enter="st.page=1; load()" />
<select v-model="st.sort" @change="st.page=1; load()">
<input v-model="st.q" placeholder="搜索标题/描述"
@keydown.enter="st.page = 1; load()" />
<select v-model="st.sort" @change="st.page = 1; load()">
<option value="new">最新</option>
<option value="old">最早</option>
</select>
<button class="btn" @click="st.page=1; load()" :disabled="st.loading">搜索</button>
<button class="btn" @click="st.page = 1; load()"
:disabled="st.loading">搜索</button>
</div>
<div v-if="st.error" class="error">{{ st.error }}</div>
<div v-else class="grid">
<div v-for="m in st.items" :key="m.id" class="card" @click="goDetail(m.id)">
<div v-for="m in st.items" :key="m.id" class="card"
@click="goDetail(m.id)">
<img :src="api.previewUrl(m.id)" alt="preview" />
<div class="meta">
<h3>{{ m.title }}</h3>
@@ -55,24 +58,89 @@ onMounted(load)
</div>
<div class="pager" v-if="st.total > st.pageSize">
<button :disabled="st.page<=1" @click="st.page--; load()">上一页</button>
<button :disabled="st.page <= 1" @click="st.page--; load()">上一页</button>
<span>第 {{ st.page }} 页</span>
<button :disabled="st.page*st.pageSize>=st.total" @click="st.page++; load()">下一页</button>
<button :disabled="st.page * st.pageSize >= st.total"
@click="st.page++; load()">下一页</button>
</div>
</div>
</template>
<style scoped>
.list-page{padding:12px;height:100%;box-sizing:border-box;overflow:auto}
.toolbar{display:flex;gap:8px;margin-bottom:12px}
input,select{padding:6px 8px;border:1px solid #e5e7eb;border-radius:8px}
.btn{padding:6px 10px;border:1px solid #e5e7eb;border-radius:8px;background:#fff}
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:12px}
.card{border:1px solid #e5e7eb;border-radius:10px;overflow:hidden;cursor:pointer;background:#fff;display:flex;flex-direction:column}
.card img{width:100%;height:140px;object-fit:cover;background:#f3f4f6}
.meta{padding:10px}
.meta h3{margin:0 0 6px 0;font-size:14px}
.meta p{margin:0;color:#6b7280;font-size:12px}
.pager{display:flex;gap:10px;align-items:center;justify-content:center;margin-top:12px}
.error{color:#b91c1c}
.list-page {
padding: 12px;
height: 100%;
box-sizing: border-box;
overflow: auto
}
.toolbar {
display: flex;
gap: 8px;
margin-bottom: 12px
}
input,
select {
padding: 6px 8px;
border: 1px solid #e5e7eb;
border-radius: 8px
}
.btn {
padding: 6px 10px;
border: 1px solid #e5e7eb;
border-radius: 8px;
background: #fff
}
.grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
gap: 12px
}
.card {
border: 1px solid #e5e7eb;
border-radius: 10px;
overflow: hidden;
cursor: pointer;
background: #fff;
display: flex;
flex-direction: column
}
.card img {
width: 100%;
aspect-ratio: 1;
object-fit: contain;
background: white
}
.meta {
padding: 10px
}
.meta h3 {
margin: 0 0 6px 0;
font-size: 14px
}
.meta p {
margin: 0;
color: #6b7280;
font-size: 12px
}
.pager {
display: flex;
gap: 10px;
align-items: center;
justify-content: center;
margin-top: 12px
}
.error {
color: #b91c1c
}
</style>
+4
View File
@@ -972,6 +972,10 @@ function loadFromJSONText(text: string) {
wireSeq = Math.max(wireSeq, maxWireId)
}
// @ts-ignore
window.loadCircuitFromJSONText = loadFromJSONText
function onImportFileChange(e: Event) {
const input = e.target as HTMLInputElement
const file = input.files && input.files[0]
Binary file not shown.

Before

Width:  |  Height:  |  Size: 234 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 154 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 245 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 832 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 252 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 405 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 597 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 318 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 254 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 395 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 402 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

+37
View File
@@ -0,0 +1,37 @@
import os
import subprocess
def convert_png_to_webp():
png_files = []
# 递归遍历当前目录及所有子目录
for root, dirs, files in os.walk('.'):
for file in files:
if file.lower().endswith('.png'):
png_files.append(os.path.join(root, file))
if not png_files:
print("当前目录及子目录下没有找到PNG文件。")
return
print(f"找到 {len(png_files)} 个PNG文件,开始转换...")
# 遍历并转换每个PNG文件
for png_file in png_files:
# 构建输出文件名(替换扩展名为.webp)
webp_file = os.path.splitext(png_file)[0] + '.webp'
# 构建ffmpeg命令,设置压缩质量为80%(可以根据需要调整)
cmd = ['ffmpeg', '-i', png_file, '-c:v', 'libwebp', '-quality', '80', webp_file]
try:
print(f"正在转换: {png_file} -> {webp_file}")
subprocess.run(cmd, check=True)
print(f"成功转换: {webp_file}")
except subprocess.CalledProcessError as e:
print(f"转换失败: {png_file}, 错误: {e}")
print("转换完成!")
if __name__ == "__main__":
convert_png_to_webp()
+13 -13
View File
@@ -1,18 +1,18 @@
// 显式导入所有电路元件图片,并定义其基本属性
import battery from './circuit-ele/battery.png'
import powerSupply from './circuit-ele/power_supply.png'
import capacitor from './circuit-ele/capacitor.png'
import inductor from './circuit-ele/inductor.png'
import lightBulb from './circuit-ele/light_bulb.png'
import lightBulbGrow from './circuit-ele/light_bulb_grow.png'
import resistor from './circuit-ele/resistor.png'
import resistanceBox from './circuit-ele/resistance_box.png'
import switchOff from './circuit-ele/switch_off.png'
import switchOn from './circuit-ele/switch_on.png'
import meter from './circuit-ele/meter.png'
import slidingRheostat from './circuit-ele/sliding_rheostat.png'
import slidingRheostatPin from './circuit-ele/sliding_rheostat_pin.png'
import battery from './circuit-ele/battery.webp'
import powerSupply from './circuit-ele/power_supply.webp'
import capacitor from './circuit-ele/capacitor.webp'
import inductor from './circuit-ele/inductor.webp'
import lightBulb from './circuit-ele/light_bulb.webp'
import lightBulbGrow from './circuit-ele/light_bulb_grow.webp'
import resistor from './circuit-ele/resistor.webp'
import resistanceBox from './circuit-ele/resistance_box.webp'
import switchOff from './circuit-ele/switch_off.webp'
import switchOn from './circuit-ele/switch_on.webp'
import meter from './circuit-ele/meter.webp'
import slidingRheostat from './circuit-ele/sliding_rheostat.webp'
import slidingRheostatPin from './circuit-ele/sliding_rheostat_pin.webp'
import textBox from './circuit-ele/text_box.svg'
export type ConnectionPoint = {