Skip to content

Commit

Permalink
🔖 v0.7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
fzf404 committed Nov 9, 2022
2 parents a0a4326 + 2ee7718 commit 696e05f
Show file tree
Hide file tree
Showing 45 changed files with 1,357 additions and 1,841 deletions.
1 change: 0 additions & 1 deletion .gitignore
Expand Up @@ -2,7 +2,6 @@
.DS_Store

# depend
.husky
node_modules

# log
Expand Down
4 changes: 4 additions & 0 deletions .husky/pre-commit
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged
2 changes: 2 additions & 0 deletions .npmrc
@@ -1,2 +1,4 @@
auto-install-peers=true

registry=https://registry.npmmirror.com
electron_mirror=https://registry.npmmirror.com/-/binary/electron/
7 changes: 0 additions & 7 deletions .prettierrc

This file was deleted.

7 changes: 6 additions & 1 deletion .vscode/extensions.json
@@ -1,13 +1,18 @@
{
"recommendations": [
"vue.volar",
"jaluik.dot-log",
"syler.sass-indented",
"gruntfuggly.todo-tree",
"chunsen.bracket-select",
"obkoro1.korofileheader",
"pranaygp.vscode-css-peek",
"bradlc.vscode-tailwindcss",
"sdras.vue-vscode-snippets",
"aaron-bond.better-comments",
"formulahendry.auto-close-tag",
"formulahendry.auto-rename-tag",
"vue.vscode-typescript-vue-plugin"
"vue.vscode-typescript-vue-plugin",
"meganrogge.template-string-converter"
]
}
7 changes: 7 additions & 0 deletions app/assets/music/download.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions app/assets/music/single.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion app/components/image.vue
Expand Up @@ -10,7 +10,7 @@
<!-- 图像 -->
<img class="h-2/3" :src="image" alt="图像" />
<!-- 备注 -->
<p class="w-full bg-theme text-center text-lg">{{ remark }}</p>
<p class="bg-theme w-full text-center text-lg">{{ remark }}</p>
</section>
</template>

Expand Down
4 changes: 2 additions & 2 deletions app/components/loading.vue
Expand Up @@ -2,13 +2,13 @@
* @Author: fzf404
* @Date: 2022-09-28 17:05:18
* @LastEditors: fzf404 [email protected]
* @LastEditTime: 2022-10-23 21:44:10
* @LastEditTime: 2022-11-09 19:51:14
* @Description: loading 组件
-->
<template>
<section v-show="show" class="flex-col-center modal z-30 space-y-2">
<!-- 加载动画 -->
<LoadSVG class="w-16 load-rotating" />
<LoadSVG class="text-light load-rotating w-16" />
<!-- 备注 -->
<p class="text-intro" v-for="item in remark">{{ item }}</p>
</section>
Expand Down
152 changes: 79 additions & 73 deletions app/components/setting.vue
Expand Up @@ -2,93 +2,102 @@
* @Author: fzf404
* @Date: 2022-07-23 21:02:45
* @LastEditors: fzf404 [email protected]
* @LastEditTime: 2022-10-23 21:44:56
* @LastEditTime: 2022-11-09 19:05:31
* @Description: setting 组件
-->
<template>
<aside class="flex-col-center modal setting z-40" v-show="store.setting.show">
<!-- 设置框 -->
<ul class="w-3/5 ring-4 rounded-lg px-4 py-3 pb-2 space-y-2" :class="{ 'w-3/4 px-3': size === 'wide' }">
<!-- 项目列表 -->
<li class="flex-row-between h-8 rounded px-2" v-for="item in setting">
<!-- 标签 -->
<label :for="item.id" class="flex space-x-0.5 text-xs">
<span>
{{ item.label }}
</span>
<HelpSVG v-show="item.help" class="w-3 self-center btn-svg text-gray" @click="openURL(item.help as string)" />
</label>
<!-- 选择框 -->
<select
v-if="item.type === 'select'"
:id="item.id"
class="w-3/5 px-2 py-1 rounded outline-none border-none text-xs"
v-model.lazy="config[item.id]"
>
<option v-for="option in item.options" :value="option.value">
{{ option.label }}
</option>
</select>
<!-- 按钮 -->
<button v-else-if="item.type === 'button'" class="w-1/3 btn btn-xs" :id="item.id" @click="item.options.click">
{{ item.options.text }}
</button>
<!-- 复选框 -->
<input
v-else-if="item.type === 'checkbox'"
:id="item.id"
type="checkbox"
class="w-4 h-4 outline-none"
v-model.lazy="(config[item.id] as boolean)"
@keyup.enter="onSave"
/>
<!-- 数字输入框 -->
<input
v-else-if="item.type === 'number'"
:id="item.id"
type="number"
class="w-3/5 px-2 py-1 rounded outline-none border-none text-right text-xs"
v-model.lazy="config[item.id]"
@keyup.enter="onSave"
@input="
<transition name="fade" mode="out-in">
<aside class="flex-col-center modal setting z-40" v-show="pinia.showSetting">
<!-- 设置框 -->
<ul class="w-3/5 space-y-2 rounded-lg px-4 py-3 pb-2 ring-4" :class="{ 'w-3/4 px-3': size === 'wide' }">
<!-- 项目列表 -->
<li class="flex-row-between h-8 rounded px-2" v-for="item in setting">
<!-- 标签 -->
<label :for="item.id" class="flex space-x-0.5 text-xs">
<span>
{{ item.label }}
</span>
<HelpSVG
v-show="item.help"
class="btn-svg text-gray w-3 self-center"
@click="openURL(item.help as string)"
/>
</label>
<!-- 选择框 -->
<select
v-if="item.type === 'select'"
:id="item.id"
class="w-3/5 rounded border-none px-2 py-1 text-xs outline-none"
v-model.lazy="store[item.id]"
>
<option v-for="option in item.options" :value="option.value">
{{ option.label }}
</option>
</select>
<!-- 按钮 -->
<button v-else-if="item.type === 'button'" class="btn btn-xs w-1/3" :id="item.id" @click="item.options.click">
{{ item.options.text }}
</button>
<!-- 复选框 -->
<input
v-else-if="item.type === 'checkbox'"
:id="item.id"
type="checkbox"
class="h-4 w-4 outline-none"
v-model.lazy="(store[item.id] as boolean)"
@keyup.enter="onSave"
/>
<!-- 数字输入框 -->
<input
v-else-if="item.type === 'number'"
:id="item.id"
type="number"
class="w-3/5 rounded border-none px-2 py-1 text-right text-xs outline-none"
v-model.lazy="store[item.id]"
@keyup.enter="onSave"
@input="
(event) => {
// number 最大长度
if ((event.target as HTMLInputElement).value.length > item.options.len)
(event.target as HTMLInputElement).value = (event.target as HTMLInputElement).value.slice(0, item.options.len)
}
"
/>
<!-- 文本输入框 -->
<input
v-else-if="item.type === 'text'"
:id="item.id"
type="text"
class="w-3/5 px-2 py-1 rounded outline-none border-none text-right text-xs"
v-model.lazy="config[item.id]"
@keyup.enter="onSave"
/>
</li>
<!-- 保存 -->
<ol class="flex-row-center-right">
<button @click="onSave" class="btn btn-sm">保存</button>
</ol>
</ul>
</aside>
/>
<!-- 文本输入框 -->
<input
v-else-if="item.type === 'text'"
:id="item.id"
type="text"
class="w-3/5 rounded border-none px-2 py-1 text-right text-xs outline-none"
v-model.lazy="store[item.id]"
@keyup.enter="onSave"
/>
</li>
<!-- 保存 -->
<ol class="flex-row-center-right">
<button @click="onSave" class="btn btn-sm">保存</button>
</ol>
</ul>
</aside>
</transition>
</template>

<script setup lang="ts">
import { openURL } from '#/ipc'
import { useStore } from '@/store'
import { main } from '@/pinia'
import HelpSVG from '@/assets/setting/help.svg'
// 初始化 pinia
const pinia = main()
// props 接口
interface Props {
// 尺寸
size?: 'wide'
// 配置
config: Record<string, Object>
// 信息
// 设置值
store: Record<string, Object>
// 设置项
setting: (
| {
id: string
Expand Down Expand Up @@ -120,20 +129,17 @@ interface Props {
)[]
}
// 初始化信息
defineProps<Props>()
const emit = defineEmits(['save'])
// 初始化 store
const store = useStore()
// 初始化设置
store.setting.has = true
pinia.initSetting()
// 保存
const onSave = () => {
// 隐藏设置框
store.setting.show = false
pinia.closeSetting()
// 发送保存事件
emit('save')
}
Expand Down
37 changes: 28 additions & 9 deletions app/layouts/layout.vue
Expand Up @@ -2,12 +2,14 @@
* @Author: fzf404
* @Date: 2022-08-12 10:39:12
* @LastEditors: fzf404 [email protected]
* @LastEditTime: 2022-10-23 21:46:18
* @LastEditTime: 2022-11-09 19:18:19
* @Description: 布局切换
-->
<template>
<!-- 布局 -->
<component :is="layout[store.layout]" :state="store"></component>
<transition name="fade" mode="out-in">
<component :is="layout[store.layout].component" :layout="layout" :theme="theme" :store="store"></component>
</transition>
<router-view></router-view>
</template>

Expand All @@ -20,29 +22,46 @@ import { storage } from '~/storage'
import maco from './maco.vue'
import wine from './wine.vue'
// 布局
const layout = {
maco,
wine,
maco: {
name: 'maco',
component: maco,
},
wine: {
name: 'wine',
component: wine,
},
}
const theme = {
dark: {
class: 'dark',
},
light: {
class: 'light',
},
punk: {
class: 'punk',
},
}
const store = storage(
{
top: false, // 置顶
layout: 'maco', // 布局
theme: 'dark', //主题
layout: layout.maco.name, // 布局
theme: theme.dark.class, // 主题
},
{
top: (val) => {
sendEvent('win-top', val)
},
theme: (val) => {
document.body.classList = [val]
document.body.setAttribute('class', val)
},
}
)
onMounted(() => {
document.body.classList = [store.theme]
document.body.setAttribute('class', store.theme)
})
</script>

0 comments on commit 696e05f

Please sign in to comment.