Skip to content

Commit

Permalink
feat:细节调整
Browse files Browse the repository at this point in the history
  • Loading branch information
hellowmonkey committed Sep 26, 2022
1 parent 3dcb0f1 commit e3c1fee
Show file tree
Hide file tree
Showing 7 changed files with 120 additions and 61 deletions.
60 changes: 49 additions & 11 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,51 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>沃德工具箱</title>
</head>
<body>
<div id="app"><div style="text-align: center; padding: 20% 0; color: #888; font-size: 14px">玩命加载中...</div></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>

<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>沃德工具箱</title>
<style>
body {
padding: 0;
margin: 0;
}

.loading {
box-sizing: border-box;
height: 100vh;
text-align: center;
padding: 30% 0;
color: #888;
background-color: #fff;
font-size: 14px;
}

.loading.dark {
background-color: rgb(24, 24, 28);
color: rgba(255, 255, 255, 0.82);
}
</style>
</head>

<body>
<div id="app">
<div class="loading">玩命加载中...</div>
</div>
<script>
try {
let cls = 'light'
var appConfig = JSON.parse(localStorage.getItem('appConfig'))
if (appConfig.themeType === 'dark' || (appConfig.themeType === 'os' && appConfig.os === "dark")) {
cls = 'dark'
}
document.querySelector('.loading').classList.add(cls)
} catch (e) {
console.log(e)
}
</script>
<script type="module" src="/src/main.ts"></script>
</body>

</html>
1 change: 1 addition & 0 deletions src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ export default {
productName,
releaseName,
releaseUrl,
movieUrl: "https://movie.hellowmonkey.cc",
};
9 changes: 9 additions & 0 deletions src/helper/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -346,3 +346,12 @@ export function getFilePathInfo(fileName: string): [string, string] {
const ext = arr[arr.length - 1];
return [str, ext];
}

// 打开链接
export function openUrl(url: string) {
if (config.isElectron) {
electronAPI.openUrl(url);
} else {
window.open(url);
}
}
59 changes: 30 additions & 29 deletions src/page/util/num-money.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,37 +25,38 @@ export default defineComponent({

return () => (
<div class="d-flex direction-column">
<NInput
placeholder="请输入金额,回车转换"
class="mar-b-4-item"
value={num.value}
onInput={val => {
if (Number(val)) {
num.value = val;
}
}}
size="large"
ref={iptEl}
onKeydown={e => {
if (e.key === "Enter") {
e.preventDefault();
handleSubmit();
}
}}
/>
{num.value ? (
<NButton
type="primary"
<div class="d-flex">
<NInput
placeholder="请输入金额,回车转换"
class="mar-r-3-item"
value={num.value}
onInput={val => {
if (Number(val)) {
num.value = val;
}
}}
size="large"
class="mar-b-4-item"
block
onClick={() => {
handleSubmit();
ref={iptEl}
onKeydown={e => {
if (e.key === "Enter") {
e.preventDefault();
handleSubmit();
}
}}
>
转换
</NButton>
) : null}
/>
{num.value ? (
<NButton
type="primary"
size="large"
class="mar-r-3-item"
onClick={() => {
handleSubmit();
}}
>
转换
</NButton>
) : null}
</div>
{ret.value ? (
<NAlert type="success" showIcon title={ret.value}>
<div class="d-flex justify-end">
Expand Down
39 changes: 26 additions & 13 deletions src/page/video/m3u8.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import config from "@/config";
import { downLoad, getFullUrl } from "@/helper";
import { downLoad, getFullUrl, openUrl } from "@/helper";
import ajax from "@/helper/ajax";
import { dialog, message } from "@/service/common";
import { DownloadStatus, downloadStatusList, IM3u8Item, ITsItem } from "@/service/video";
Expand Down Expand Up @@ -233,18 +233,31 @@ export default defineComponent({
/>
</NInputGroup>
</div>
<NButton
block
class="mar-b-4-item"
size="large"
type="primary"
loading={loading.value}
onClick={() => {
downloadM3u8();
}}
>
解析
</NButton>
<div class="mar-b-4-item d-flex">
<NButton
class="mar-r-3-item"
size="large"
ghost
onClick={() => {
openUrl(config.movieUrl);
}}
>
前往沃德影视
</NButton>
<NButton
block
class="mar-r-3-item flex-item-extend"
size="large"
type="primary"
loading={loading.value}
onClick={() => {
downloadM3u8();
}}
>
解析
</NButton>
</div>

{config.isElectron ? (
<NAlert type="info" class="mar-b-4-item" showIcon title={`视频下载后保存在:${form.filePath || "下载后询问"}`}>
<div class="d-flex justify-end">
Expand Down
9 changes: 2 additions & 7 deletions src/page/video/parse.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import config from "@/config";
import { copyText } from "@/helper";
import { openUrl } from "@/helper";
import { message } from "@/service/common";
import { circuits, videoList } from "@/service/video";
import { NButton, NInput, NInputGroup, NInputGroupLabel, NSelect, NTooltip } from "naive-ui";
Expand Down Expand Up @@ -85,11 +84,7 @@ export default defineComponent({
secondary
type={item.type}
onClick={() => {
if (config.isElectron) {
electronAPI.openUrl(item.url);
} else {
window.open(item.url);
}
openUrl(item.url);
}}
>
{item.name}
Expand Down
4 changes: 3 additions & 1 deletion src/service/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,13 @@ export interface IConfig {
// 主题
themeType: ThemeTypes;
themeColor: ThemeColors;
os: "dark" | "light" | null;
}

export const defaultConfig: IConfig = {
themeType: ThemeTypes.OS,
themeColor: ThemeColors.GREEN,
os: os.value,
};
let localConfig = localStorage.get<IConfig>("appConfig") || defaultConfig;
if (typeof localConfig === "string" || Array.isArray(localConfig)) {
Expand All @@ -127,7 +129,7 @@ export function setAppConfig(params: Partial<IConfig>) {
setAppConfig(localConfig);

export const globalTheme = computed<GlobalTheme | null>(() => {
if (appConfig.value.themeType === ThemeTypes.DARK || (appConfig.value.themeType === ThemeTypes.OS && os.value === "dark")) {
if (appConfig.value.themeType === ThemeTypes.DARK || (appConfig.value.themeType === ThemeTypes.OS && appConfig.value.os === "dark")) {
return darkTheme;
}
return null;
Expand Down

0 comments on commit e3c1fee

Please sign in to comment.