This commit is contained in:
cast1e
2024-10-14 22:08:46 +08:00
parent ba2cd4d5a3
commit 21d4c33460
20 changed files with 209 additions and 103 deletions
+1 -2
View File
@@ -1,7 +1,6 @@
<script setup lang="ts">
import TitleBar from './components/TitleBar.vue';
import { RouterLink, RouterView } from 'vue-router'
import { invoke } from "@tauri-apps/api"
import { RouterView } from 'vue-router'
const isDarkTheme = window.matchMedia("(prefers-color-scheme: dark)");
const html_node = document.getElementsByTagName("html")[0]
+1 -1
View File
@@ -1 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1728872416760" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3377" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M874.666667 241.066667h-202.666667V170.666667c0-40.533333-34.133333-74.666667-74.666667-74.666667h-170.666666c-40.533333 0-74.666667 34.133333-74.666667 74.666667v70.4H149.333333c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32h53.333334V853.333333c0 40.533333 34.133333 74.666667 74.666666 74.666667h469.333334c40.533333 0 74.666667-34.133333 74.666666-74.666667V305.066667H874.666667c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32zM416 170.666667c0-6.4 4.266667-10.666667 10.666667-10.666667h170.666666c6.4 0 10.666667 4.266667 10.666667 10.666667v70.4h-192V170.666667z m341.333333 682.666666c0 6.4-4.266667 10.666667-10.666666 10.666667H277.333333c-6.4 0-10.666667-4.266667-10.666666-10.666667V309.333333h490.666666V853.333333z" fill="#currentColor" p-id="3378"></path><path d="M426.666667 736c17.066667 0 32-14.933333 32-32V490.666667c0-17.066667-14.933333-32-32-32s-32 14.933333-32 32v213.333333c0 17.066667 14.933333 32 32 32zM597.333333 736c17.066667 0 32-14.933333 32-32V490.666667c0-17.066667-14.933333-32-32-32s-32 14.933333-32 32v213.333333c0 17.066667 14.933333 32 32 32z" fill="currentColor" p-id="3379"></path></svg>
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1728872416760" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3377" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path fill="currentColor" d="M874.666667 241.066667h-202.666667V170.666667c0-40.533333-34.133333-74.666667-74.666667-74.666667h-170.666666c-40.533333 0-74.666667 34.133333-74.666667 74.666667v70.4H149.333333c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32h53.333334V853.333333c0 40.533333 34.133333 74.666667 74.666666 74.666667h469.333334c40.533333 0 74.666667-34.133333 74.666666-74.666667V305.066667H874.666667c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32zM416 170.666667c0-6.4 4.266667-10.666667 10.666667-10.666667h170.666666c6.4 0 10.666667 4.266667 10.666667 10.666667v70.4h-192V170.666667z m341.333333 682.666666c0 6.4-4.266667 10.666667-10.666666 10.666667H277.333333c-6.4 0-10.666667-4.266667-10.666666-10.666667V309.333333h490.666666V853.333333z" fill="currentColor" p-id="3378"></path><path d="M426.666667 736c17.066667 0 32-14.933333 32-32V490.666667c0-17.066667-14.933333-32-32-32s-32 14.933333-32 32v213.333333c0 17.066667 14.933333 32 32 32zM597.333333 736c17.066667 0 32-14.933333 32-32V490.666667c0-17.066667-14.933333-32-32-32s-32 14.933333-32 32v213.333333c0 17.066667 14.933333 32 32 32z" fill="currentColor" p-id="3379"></path></svg>

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

@@ -1 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1727275506845" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8495" data-darkreader-inline-fill="" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M563.8 512l262.5-312.9c4.4-5.2 0.7-13.1-6.1-13.1h-79.8c-4.7 0-9.2 2.1-12.3 5.7L511.6 449.8 295.1 191.7c-3-3.6-7.5-5.7-12.3-5.7H203c-6.8 0-10.5 7.9-6.1 13.1L459.4 512 196.9 824.9c-4.4 5.2-0.7 13.1 6.1 13.1h79.8c4.7 0 9.2-2.1 12.3-5.7l216.5-258.1 216.5 258.1c3 3.6 7.5 5.7 12.3 5.7h79.8c6.8 0 10.5-7.9 6.1-13.1L563.8 512z" p-id="8496"></path></svg>
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1727275506845" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8495" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path fill="currentColor" d="M563.8 512l262.5-312.9c4.4-5.2 0.7-13.1-6.1-13.1h-79.8c-4.7 0-9.2 2.1-12.3 5.7L511.6 449.8 295.1 191.7c-3-3.6-7.5-5.7-12.3-5.7H203c-6.8 0-10.5 7.9-6.1 13.1L459.4 512 196.9 824.9c-4.4 5.2-0.7 13.1 6.1 13.1h79.8c4.7 0 9.2-2.1 12.3-5.7l216.5-258.1 216.5 258.1c3 3.6 7.5 5.7 12.3 5.7h79.8c6.8 0 10.5-7.9 6.1-13.1L563.8 512z" p-id="8496"></path></svg>

Before

Width:  |  Height:  |  Size: 710 B

After

Width:  |  Height:  |  Size: 699 B

@@ -1 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1727275608799" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="15290" data-darkreader-inline-fill="" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32z m-40 728H184V184h656v656z" p-id="15291"></path></svg>
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1727275608799" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="15290" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path fill="currentColor" d="M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32z m-40 728H184V184h656v656z" p-id="15291"></path></svg>

Before

Width:  |  Height:  |  Size: 529 B

After

Width:  |  Height:  |  Size: 518 B

+35 -23
View File
@@ -48,7 +48,7 @@
</tr>
<tr>
<td></td>
<td><button class="apply-button" @click="handleAdd">添加</button></td>
<td><button class="apply-button" @click="handleAdd" ref="applyButton">添加</button></td>
</tr>
</tbody>
</table>
@@ -89,6 +89,7 @@ const support_img_ext_map: { [key in (typeof support_img_ext)[number]]: string }
'.gif': 'image/gif',
'.webp': 'image/webp'
}
const applyButton = ref<HTMLButtonElement | null>(null);
defineExpose({ open })
@@ -146,33 +147,44 @@ function checkInfo(info: AddInfo) {
}
function handleAdd() {
if (checkInfo(addInfo.value)) invoke("new_wallpaper", {
info: addInfo.value
}).then((res) => {
if (res as string == "Success") {
addInfo.value = {
name: "",
preview: "",
media: "",
description: ""
}
image_src.value = "";
store.commit("getWpList");
toggleVisible();
if (checkInfo(addInfo.value)) {
if (applyButton.value) {
ElMessage({
type: "success",
message: "新建成功"
type:"info",
message:"正在新建项目, 请勿重新点击或关闭程序"
})
applyButton.value.disabled = true;
invoke("new_wallpaper", {
info: addInfo.value
}).then((res) => {
if (applyButton.value) applyButton.value.disabled = false;
if (res as string == "Success") {
addInfo.value = {
name: "",
preview: "",
media: "",
description: ""
}
image_src.value = "";
store.commit("getWpList");
toggleVisible();
ElMessage({
type: "success",
message: "新建成功"
})
}
else ElMessage({
type: "error",
message: `新建失败 ${res}`
})
})
}
else ElMessage({
type: "error",
message: `新建失败 ${res}`
})
})
}
else ElMessage({
type: "error",
message: "请填写名称并选择媒体文件"
})
}
</script>
@@ -256,7 +268,7 @@ function handleAdd() {
}
.item-add-preview:hover {
background: var(--bg-color-alpha-darker);
background: var(--bg-hover-fill);
}
.item-add-preview:active {
@@ -264,7 +276,7 @@ function handleAdd() {
}
.item-add-image {
background: linear-gradient(135deg, transparent 0%, #FFFFFF10 100%);
background: linear-gradient(135deg, #0000001A 0%, #FFFFFF1A 100%);
border-radius: 5px;
width: 400px;
margin-bottom: 10px;
+10 -19
View File
@@ -54,9 +54,10 @@
<script setup lang="ts">
import { defineProps, defineExpose, defineEmits, defineModel, watch, ref, type PropType } from 'vue';
type Position = "left" | "right";
import type { Info, Cell } from '@/ts/types'
import { invoke } from '@tauri-apps/api/core';
import type { Cell } from '@/ts/types'
import { useStore } from 'vuex';
import { getCurrentWebviewWindow } from '@tauri-apps/api/webviewWindow';
const appWindow = getCurrentWebviewWindow();
const props = defineProps({
position: {
type: String as PropType<Position>,
@@ -64,6 +65,7 @@ const props = defineProps({
},
})
const store = useStore();
const visible = defineModel<boolean>();
const emit = defineEmits(["submit"]);
const visible_ = ref(false);
@@ -83,7 +85,6 @@ const cell = ref<Cell>({
}
}
})
const info_items = ref<(keyof Info)[]>(["media_type", "description", "created"]);
const bg = ref<HTMLDivElement | null>(null);
defineExpose({ open })
watch(() => visible.value, (val, _) => {
@@ -102,25 +103,15 @@ function handleClose() {
function open(conFig: Cell) {
cell.value = conFig;
console.log(cell.value)
visible.value = true;
}
import { WebviewWindow } from '@tauri-apps/api/webviewWindow'
function apply() {
const webview = new WebviewWindow('wallitor_video_playback', {
title: "wallitor_video_playback",
url: `/video/?url=${cell.value.path}\\res\\${cell.value.config.info.entry_point}`,
fullscreen: true,
decorations: false
});
webview.once("tauri://created", () => {
invoke("set_wallpaper", {
title: "wallitor_video_playback"
}).then((res) => {
console.log(res)
})
});
store.commit("apply_wallpaper",{
url:`/video/?url=${cell.value.path}\\res\\${cell.value.config.info.entry_point}&mute=${cell.value.config.option.mute}`,
title:"wallitor_video_playback"
})
appWindow.minimize();
}
</script>
+8 -6
View File
@@ -91,7 +91,7 @@ function close() {
position: relative;
justify-content: space-between;
height: var(--titlebar-height);
padding: 5px;
padding: 4px;
color: var(--text-color);
}
@@ -114,7 +114,9 @@ function close() {
}
.titlebar-button-wrapper {
height: var(--titlebar-height);
height: calc(var(--titlebar-height) - 4px);
margin-top: 5px;
margin-right: 5px;
width: fit-content;
place-self: center;
place-items: center;
@@ -128,15 +130,15 @@ function close() {
}
.titlebar-button {
height: calc(var(--titlebar-height) - 6px);
width: calc(var(--titlebar-height) - 6px);
height: 30px;
width: 30px;
padding-top: 3px;
padding-bottom: 3px;
}
.titlebar-button-rect {
height: 34px;
width: 34px;
height: 30px;
width: 30px;
border-radius: 100%;
transition: .3s;
display: flex;
+20 -1
View File
@@ -1,6 +1,7 @@
import { createStore } from 'vuex'
import { invoke } from '@tauri-apps/api/core'
import type { ResourceDir, wpConfig, Cell } from '@/ts/types'
import { WebviewWindow, } from '@tauri-apps/api/webviewWindow'
function arrayBufferToString(buffer: ArrayBuffer): string {
const decoder = new TextDecoder('utf-8')
@@ -15,10 +16,12 @@ const support_ext_map: { [key in (typeof support_ext)[number]]: string } = {
'.webp': 'image/webp'
}
type VideoWindow = null | WebviewWindow
export const store = createStore({
state() {
return {
wpList: [] as Cell[]
wpList: [] as Cell[],
videoWindow: null as VideoWindow
}
},
mutations: {
@@ -69,6 +72,22 @@ export const store = createStore({
})
}
})
},
apply_wallpaper(state, payload:{
title:string,
url:string
}) {
const window_options = {
title: payload.title,
url: payload.url,
fullscreen: true,
shadow:false,
decorations: false,
transparent: true
}
if (state.videoWindow)
state.videoWindow.destroy().then((_) => {state.videoWindow = new WebviewWindow(payload.title, window_options)})
else state.videoWindow = new WebviewWindow(payload.title,window_options)
}
}
})
+9 -11
View File
@@ -14,17 +14,15 @@ html {
--bg-color-alter: #ffffff;
--bg-color: #ffffffae;
--text-color: #1c1c1c;
--bd-color: #bbbbbbce;
--bd-color: #b2b2b2da;
--text-active: #7cbeff;
--login-button-bg: #9acdff;
--login-button-bd: #c8c8c8;
--login-button-hover: #7db7f0;
--branch-viewing-color: rgb(122, 212, 215);
--branch-viewing-hover-color: rgb(102, 177, 180);
--delete-box-left-border: #f56c6c;
--delete-box-bg: #f56c6c42;
--delete-box-title: #511f1f;
--delete-box-text: black;
--titlebar-height: 40px;
--shadow-edge-glow: inset 1px 1px 1px -.5px rgba(255, 255, 255, .2), inset -1px -1px 1px -.5px rgba(255, 255, 255, .12), inset 0 0 4px rgba(255, 255, 255, .4);
--shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .06);
--bg-color-alpha: hsla(240, 17%, 91%, 0.68);
--bg-color-alpha-darker: hsla(0, 22%, 96%, 0.948);
--bg-hover-fill: rgba(172, 172, 193, 0.24);
--bg-hover-fill-close: rgba(239, 90, 90, 0.579);
}
html.dark {
@@ -133,7 +131,7 @@ textarea:focus {
}
.apply-button:hover {
background-color: var(--bg-color-alter);
background-color: var(--bg-hover-fill);
}
.apply-button:active {
+16 -2
View File
@@ -17,7 +17,22 @@ const apply_bar_visible = ref(false);
const applyBar = ref<InstanceType<typeof ApplyBar> | null>(null);
const item_add_visible = ref(false);
const r_display = ref(false);
const r_data = ref<Cell>();
const r_data = ref<Cell>({
img: "",
path: "",
config: {
name: "",
info: {
description: "",
created: 0,
media_type: "Video",
entry_point: ""
},
option: {
mute: true
}
}
});
const menu = ref<InstanceType<typeof CRMenu> | null>(null);
const options = ref<{ name: string, icon: string, handler: (data: Cell) => void }[]>([{
name: "删除",
@@ -30,7 +45,6 @@ onMounted(() => {
})
function openCard(config: Cell) {
console.log(applyBar.value)
if (applyBar.value) applyBar.value.open(config);
}