diff --git a/.gitignore b/.gitignore
index cf7ff2f..ad98203 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,6 +9,7 @@ lerna-debug.log*
node_modules
# dist
+diy-dist
dist-ssr
*.local
diff --git a/diy/diy.theme.json b/diy/diy.theme.json
new file mode 100644
index 0000000..3276695
--- /dev/null
+++ b/diy/diy.theme.json
@@ -0,0 +1,98 @@
+{
+ "title": "标题",
+ "desc": "描述",
+ "bgm": "/sound-disco.mp3",
+ "dark": true,
+ "backgroundColor": "#8dac85",
+ "pure": true,
+ "backgroundBlur": false,
+ "icons": [
+ {
+ "name": "1",
+ "content": "/1.png",
+ "clickSound": "button-click",
+ "tripleSound": "triple"
+ },
+ {
+ "name": "2",
+ "content": "/2.png",
+ "clickSound": "button-click",
+ "tripleSound": "triple"
+ },
+ {
+ "name": "3",
+ "content": "/3.png",
+ "clickSound": "button-click",
+ "tripleSound": "triple"
+ },
+ {
+ "name": "4",
+ "content": "/4.png",
+ "clickSound": "button-click",
+ "tripleSound": "triple"
+ },
+ {
+ "name": "5",
+ "content": "/5.png",
+ "clickSound": "button-click",
+ "tripleSound": "triple"
+ },
+ {
+ "name": "6",
+ "content": "/6.png",
+ "clickSound": "button-click",
+ "tripleSound": "triple"
+ },
+ {
+ "name": "7",
+ "content": "/7.png",
+ "clickSound": "button-click",
+ "tripleSound": "triple"
+ },
+ {
+ "name": "8",
+ "content": "/8.png",
+ "clickSound": "button-click",
+ "tripleSound": "triple"
+ },
+ {
+ "name": "9",
+ "content": "/9.png",
+ "clickSound": "button-click",
+ "tripleSound": "triple"
+ },
+ {
+ "name": "10",
+ "content": "/10.png",
+ "clickSound": "button-click",
+ "tripleSound": "triple"
+ }
+ ],
+ "sounds": [
+ {
+ "name": "sound-undo",
+ "src": "/sound-undo.mp3"
+ },
+ {
+ "name": "sound-shift",
+ "src": "/sound-shift.mp3"
+ },
+ {
+ "name": "sound-wash",
+ "src": "/sound-wash.mp3"
+ },
+ {
+ "name": "button-click",
+ "src": "/sound-button-click.mp3"
+ },
+ {
+ "name": "triple",
+ "src": "/sound-triple.mp3"
+ }
+ ],
+ "operateSoundMap": {
+ "shift": "sound-shift",
+ "undo": "sound-undo",
+ "wash": "sound-wash"
+ }
+}
diff --git a/diy/diy.vite.config.ts b/diy/diy.vite.config.ts
new file mode 100644
index 0000000..6cc91ac
--- /dev/null
+++ b/diy/diy.vite.config.ts
@@ -0,0 +1,19 @@
+import { defineConfig } from 'vite';
+import react from '@vitejs/plugin-react';
+
+// https://vitejs.dev/config/
+export default defineConfig({
+ plugins: [react()],
+ root: 'diy',
+ publicDir: './public',
+ build: {
+ outDir: 'diy-dist',
+ },
+ define: {
+ __DIY__: true,
+ },
+ server: {
+ host: true,
+ port: 5556,
+ },
+});
diff --git a/diy/index.html b/diy/index.html
new file mode 100644
index 0000000..699cd97
--- /dev/null
+++ b/diy/index.html
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+ 有解的羊了个羊
+
+
+
+
+
+
+
+
diff --git a/diy/main.tsx b/diy/main.tsx
new file mode 100644
index 0000000..604edc9
--- /dev/null
+++ b/diy/main.tsx
@@ -0,0 +1,15 @@
+import React from 'react';
+import ReactDOM from 'react-dom/client';
+import App from '../src/App';
+import '../src/styles/global.scss';
+import '../src/styles/utils.scss';
+import { domRelatedOptForTheme } from '../src/utils';
+import theme from './diy.theme.json';
+
+domRelatedOptForTheme(theme);
+
+ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
+
+
+
+);
diff --git a/diy/public/1.png b/diy/public/1.png
new file mode 100644
index 0000000..ef7b58b
Binary files /dev/null and b/diy/public/1.png differ
diff --git a/diy/public/10.png b/diy/public/10.png
new file mode 100644
index 0000000..f85515f
Binary files /dev/null and b/diy/public/10.png differ
diff --git a/diy/public/2.png b/diy/public/2.png
new file mode 100644
index 0000000..4ca5fac
Binary files /dev/null and b/diy/public/2.png differ
diff --git a/diy/public/3.png b/diy/public/3.png
new file mode 100644
index 0000000..ac101fb
Binary files /dev/null and b/diy/public/3.png differ
diff --git a/diy/public/4.png b/diy/public/4.png
new file mode 100644
index 0000000..e8fcc41
Binary files /dev/null and b/diy/public/4.png differ
diff --git a/diy/public/5.png b/diy/public/5.png
new file mode 100644
index 0000000..084a110
Binary files /dev/null and b/diy/public/5.png differ
diff --git a/diy/public/6.png b/diy/public/6.png
new file mode 100644
index 0000000..73a250d
Binary files /dev/null and b/diy/public/6.png differ
diff --git a/diy/public/7.png b/diy/public/7.png
new file mode 100644
index 0000000..925543e
Binary files /dev/null and b/diy/public/7.png differ
diff --git a/diy/public/8.png b/diy/public/8.png
new file mode 100644
index 0000000..2aec668
Binary files /dev/null and b/diy/public/8.png differ
diff --git a/diy/public/9.png b/diy/public/9.png
new file mode 100644
index 0000000..7b17779
Binary files /dev/null and b/diy/public/9.png differ
diff --git a/diy/public/favicon.ico b/diy/public/favicon.ico
new file mode 100644
index 0000000..3ab5292
Binary files /dev/null and b/diy/public/favicon.ico differ
diff --git a/diy/public/sound-button-click.mp3 b/diy/public/sound-button-click.mp3
new file mode 100644
index 0000000..39b8ee6
Binary files /dev/null and b/diy/public/sound-button-click.mp3 differ
diff --git a/diy/public/sound-disco.mp3 b/diy/public/sound-disco.mp3
new file mode 100644
index 0000000..492e392
Binary files /dev/null and b/diy/public/sound-disco.mp3 differ
diff --git a/diy/public/sound-shift.mp3 b/diy/public/sound-shift.mp3
new file mode 100644
index 0000000..33ddb1f
Binary files /dev/null and b/diy/public/sound-shift.mp3 differ
diff --git a/diy/public/sound-triple.mp3 b/diy/public/sound-triple.mp3
new file mode 100644
index 0000000..f6f06be
Binary files /dev/null and b/diy/public/sound-triple.mp3 differ
diff --git a/diy/public/sound-undo.mp3 b/diy/public/sound-undo.mp3
new file mode 100644
index 0000000..fa20d12
Binary files /dev/null and b/diy/public/sound-undo.mp3 differ
diff --git a/diy/public/sound-wash.mp3 b/diy/public/sound-wash.mp3
new file mode 100644
index 0000000..2880f82
Binary files /dev/null and b/diy/public/sound-wash.mp3 differ
diff --git a/package.json b/package.json
index e8aa9cc..cbffb15 100644
--- a/package.json
+++ b/package.json
@@ -5,7 +5,9 @@
"type": "module",
"scripts": {
"dev": "vite",
+ "dev:diy": "vite --config diy/diy.vite.config.ts",
"build": "tsc && vite build",
+ "build:diy": "tsc && vite build --config diy/diy.vite.config.ts",
"preview": "vite preview",
"prepare": "husky install",
"release:first": "standard-version -- --first-release",
diff --git a/src/App.tsx b/src/App.tsx
index 549155e..884317c 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -41,6 +41,7 @@ const App: FC<{ theme: Theme }> = ({ theme: initTheme }) => {
// 生产环境才统计
useEffect(() => {
+ if (__DIY__) return;
console.log(import.meta.env.MODE);
if (import.meta.env.PROD) {
const busuanziScript = document.createElement('script');
@@ -71,31 +72,39 @@ const App: FC<{ theme: Theme }> = ({ theme: initTheme }) => {
/>
-
-
- 累计访问:
- 次
-
-
-
-
- Loading}>
- {!theme.pure && (
- <>
-
- setDiyDialogShow(true)}
- />
+ {!__DIY__ && (
+
+
+ 累计访问:
+ 次
+
+
+
+
+ )}
+ {!__DIY__ && !theme.pure && (
+ <>
+
+ setDiyDialogShow(true)}
+ />
+ Loading}>
{diyDialogShow && (
setDiyDialogShow(false)}
previewMethod={previewTheme}
/>
)}
- >
- )}
-
+
+ >
+ )}
>
);
};
diff --git a/src/components/Game.tsx b/src/components/Game.tsx
index 9fb8a20..28063b9 100644
--- a/src/components/Game.tsx
+++ b/src/components/Game.tsx
@@ -142,8 +142,9 @@ const Symbol: FC = ({ x, y, icon, isCover, status, onClick }) => {
style={{ opacity: isCover ? 0.4 : 1 }}
>
{typeof icon.content === 'string' ? (
- icon.content.startsWith('http') ? (
- /*图片外链*/
+ icon.content.startsWith('http') ||
+ icon.content.startsWith('/') ? (
+ /*图片地址*/
) : (
/*字符表情*/
diff --git a/src/main.tsx b/src/main.tsx
index 8ca80ad..c27b491 100644
--- a/src/main.tsx
+++ b/src/main.tsx
@@ -57,6 +57,8 @@ Bmob.initialize(
import.meta.env.VITE_BMOB_SECCODE
);
+console.log(import.meta.env);
+
const loadTheme = () => {
// 请求主题
if (customThemeIdFromPath) {
diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts
index 11f02fe..31cffbd 100644
--- a/src/vite-env.d.ts
+++ b/src/vite-env.d.ts
@@ -1 +1,2 @@
///
+declare const __DIY__: boolean;
diff --git a/vite.config.ts b/vite.config.ts
index 9e955ed..9fc5d3c 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -8,4 +8,7 @@ export default defineConfig({
host: true,
port: 5555,
},
+ define: {
+ __DIY__: false,
+ },
});